<div bsModal #createOrEditModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
    aria-labelledby="createOrEditModal" aria-hidden="true" [config]="{backdrop: 'static'}">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <form *ngIf="active" #userPreferenceForm="ngForm" novalidate (ngSubmit)="save()" autocomplete="off">
                <div class="modal-header">
                    <h4 class="modal-title">
                        <span *ngIf="userPreference.id">{{l("EditUserPreference")}}</span>
                        <span *ngIf="!userPreference.id">{{l("CreateNewUserPreference")}}</span>
                    </h4>
                    <button type="button" class="close" (click)="close()" aria-label="Close" [disabled]="saving">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label for="UserPreference_UserId">{{l("UserId")}}</label>
                        <input type="text" id="UserPreference_UserId" class="form-control"
                            [(ngModel)]="userPreference.userId" name="UserId" />
                    </div>
                    <div class="form-group">
                        <label for="UserPreference_PreferenceId">{{l("Preferences")}}</label>
                        <select class="form-control kt-select2" id="selectedPreference" data-placeholder="Select City"
                            name="selectPreview">
                            <option value="0">Select Preference</option>
                            <option *ngFor="let preference of filteredPreferences" [(value)]="preference.preference.id"
                                [selected]="preference.preference.id==userPreference.preferenceId">
                                {{preference.preference.code}}
                            </option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="UserPreference_Value">{{l("Value")}}</label>
                        <input type="text" id="UserPreference_Value" class="form-control"
                            [(ngModel)]="userPreference.value" name="Value" />
                    </div>
                </div>
                <div class="modal-footer">
                    <button [disabled]="saving" type="button" class="btn btn-default btn-pill"
                        (click)="close()">{{l("Cancel")}}</button>
                    <button type="submit" class="btn btn-primary blue btn-pill"
                        [disabled]="!userPreferenceForm.form.valid" [buttonBusy]="saving"
                        [busyText]="l('SavingWithThreeDot')"><i class="fa fa-save"></i>
                        <span>{{l("Save")}}</span></button>
                </div>
            </form>
        </div>
    </div>

</div>