Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
37 lines
1.7 KiB
HTML
37 lines
1.7 KiB
HTML
{{/*
|
|
model-select: Reusable provider + model dropdown pair.
|
|
Used in admin roles page with FilterType for model_type filtering.
|
|
When provider changes, Pages.roleProviderChanged() filters models
|
|
from __PAGE_DATA__.Models on the client side.
|
|
*/}}
|
|
{{define "model-select"}}
|
|
<div class="form-group model-select-group" data-field="{{index . "FieldName"}}">
|
|
{{if index . "Label"}}<label>{{index . "Label"}}</label>{{end}}
|
|
<div class="form-row" style="gap:8px;align-items:center">
|
|
<select name="{{index . "FieldName"}}_provider"
|
|
class="model-provider-select"
|
|
data-target="{{index . "FieldName"}}_model"
|
|
data-filter-type="{{index . "FilterType"}}"
|
|
style="min-width:140px">
|
|
<option value="">— select provider —</option>
|
|
{{$selProv := index . "SelectedProvider"}}
|
|
{{range index . "Providers"}}
|
|
<option value="{{.ID}}"{{if eq .ID $selProv}} selected{{end}}>{{.Name}}</option>
|
|
{{end}}
|
|
</select>
|
|
<select name="{{index . "FieldName"}}_model"
|
|
class="model-model-select"
|
|
style="min-width:200px">
|
|
<option value="">— select model —</option>
|
|
{{$selModel := index . "SelectedModel"}}
|
|
{{$filterType := index . "FilterType"}}
|
|
{{range index . "Models"}}
|
|
{{if and (eq .ProviderConfigID $selProv) (or (eq $filterType "") (eq .ModelType $filterType))}}
|
|
<option value="{{.ModelID}}"{{if eq .ModelID $selModel}} selected{{end}}>{{.DisplayName}}</option>
|
|
{{end}}
|
|
{{end}}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
{{end}}
|