<div bsModal #createModal="bs-modal" (onShown)="onShown()" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="createModal"
     aria-hidden="true" [config]="{backdrop: 'static', keyboard: !saving}">
    <div class="modal-dialog modal-lg">

        <div class="modal-content">

            <form #locationCreateForm="ngForm" role="form" novalidate class="form-validation" *ngIf="active" (submit)="save()">
                <div class="modal-header">
                    <h5 class="modal-title">
                        <span>{{"CreateLocation" | localize}}</span>
                    </h5>
                    <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')" [disabled]="saving">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>

                <div class="modal-body">

                  <tabset class="tab-container tabbable-line">
                    <tab heading="{{'Location' | localize}}" customClass="m-tabs__item">
                      <div class="form-group">
                          <label for="Name">{{"Name" | localize}} *</label>
                          <input id="nameInput" style="border: 1px solid #a6a6a6;" #nameInput="ngModel" type="text" name="Name" class="form-control"  [(ngModel)]="location.name" required>
                          <validation-messages [formCtrl]="nameInput"></validation-messages>
                      </div>
                      <div class="form-group">
                          <label for="minutesPerMileInput">{{"MinutePerMile" | localize}} *</label>
                          <input id="minutesPerMileInput" style="border: 1px solid #a6a6a6;" #minutesPerMileInput="ngModel" type="text" name="minutesPerMileInput" class="form-control"  [(ngModel)]="location.minutesPerMile" required>
                          <validation-messages [formCtrl]="minutesPerMileInput"></validation-messages>
                      </div>
                      <div class="form-group">
                          <label for="minutesPerStopInput">{{"MinutePerStop" | localize}} *</label>
                          <input id="minutesPerStopInput" style="border: 1px solid #a6a6a6;" #minutesPerStopInput="ngModel" type="text" name="minutesPerStopInput" class="form-control"  [(ngModel)]="location.minutesPerStop" required>
                          <validation-messages [formCtrl]="minutesPerStopInput"></validation-messages>
                      </div>
                      <div class="form-group">
                          <label for="cityInput">{{"TimeZone" | localize}} *</label>
                          <p-autoComplete [(ngModel)]="timeZone"
                                          id="TimeZoneSelectInput"
                                          [suggestions]="filteredTimeZones"
                                          (completeMethod)="filterTimeZones($event)"
                                          field="value"
                                          placeholder="Enter TimeZone"
                                          [minLength]="1"
                                          name="TimeZoneSelectInput"
                                          styleClass="width-percent-100"
                                          [style]="{'width':'100%'}"
                                          [inputStyle]="{'width':'95%','height':'33px'}"
                                          [dropdown]="true">
                                          >
                          </p-autoComplete>
                          <!-- <validation-messages [formCtrl]="TimeZoneSelectInput"></validation-messages> -->
                      </div>
                    </tab>

                    <tab heading="{{'Contact' | localize}}" customClass="m-tabs__item">
                      <tabset class="tab-container tabbable-line">
                        <tab heading="{{'Contact Detail' | localize}}" customClass="m-tabs__item">
                          <div class="form-group">
                              <label for="firstNameInput">{{"FirstName" | localize}} *</label>
                              <input id="firstNameInput" style="border: 1px solid #a6a6a6;" #firstNameInput="ngModel" type="text" name="firstNameInput" class="form-control"  [(ngModel)]="contact.firstName" required>
                              <validation-messages [formCtrl]="firstNameInput"></validation-messages>
                          </div>
                          <div class="form-group">
                              <label for="lastNameInput">{{"LastName" | localize}} *</label>
                              <input id="lastNameInput" style="border: 1px solid #a6a6a6;" #lastNameInput="ngModel" type="text" name="lastNameInput" class="form-control"  [(ngModel)]="contact.lastName" required>
                              <validation-messages [formCtrl]="lastNameInput"></validation-messages>
                          </div>
                        </tab>

                        <tab heading="{{'Address' | localize}}" customClass="m-tabs__item">
                          <div class="form-group">
                              <label for="address1Input">{{"Address1" | localize}} *</label>
                              <input id="address1Input" style="border: 1px solid #a6a6a6;" #address1Input="ngModel" type="text" name="Address1" class="form-control"  [(ngModel)]="address.addressLine1" required>
                              <validation-messages [formCtrl]="address1Input"></validation-messages>
                          </div>
                          <div class="form-group">
                              <label for="address2Input">{{"Address2" | localize}} </label>
                              <input id="address2Input" style="border: 1px solid #a6a6a6;" #address2Input="ngModel" type="text" name="Address2" class="form-control"  [(ngModel)]="address.addressLine2" >
                              <validation-messages [formCtrl]="address2Input"></validation-messages>
                          </div>
                          <div class="form-group">
                              <label for="countryInput">{{"Country" | localize}} *</label>
                              <p-autoComplete [(ngModel)]="country"
                                              id="CountrySelectInput"
                                              [suggestions]="filteredCountries"
                                              (completeMethod)="filterCountries($event)"
                                              field="name"
                                              placeholder="Enter Country"
                                              [minLength]="1"
                                              name="CountrySelectInput"
                                              styleClass="width-percent-100"
                                              [style]="{'width':'100%'}"
                                              [inputStyle]="{'width':'95%','height':'33px'}"
                                              [dropdown]="true">
                                              >
                              </p-autoComplete>
                              <!-- <validation-messages [formCtrl]="CountrySelectInput"></validation-messages> -->
                          </div>
                          <div class="form-group">
                              <label for="postalInput">{{"Postal Code" | localize}} *</label>
                              <p-autoComplete [(ngModel)]="postal"
                                              id="PostalselectInput"
                                              [suggestions]="filteredPostal"
                                              (completeMethod)="filterPostal($event)"
                                              field="name"
                                              placeholder="Enter Postal Code"
                                              [minLength]="1"
                                              name="PostalselectInput"
                                              styleClass="width-percent-100"
                                              [style]="{'width':'100%'}"
                                              [inputStyle]="{'width':'95%','height':'33px'}"
                                              [dropdown]="true">
                                              >
                              </p-autoComplete>
                              <!-- <validation-messages [formCtrl]="PostalselectInput"></validation-messages> -->
                          </div>
                          <div class="form-group">
                              <label for="stateInput">{{"State" | localize}} *</label>
                              <p-autoComplete [(ngModel)]="state"
                                              id="StateSelectInput"
                                              [suggestions]="filteredStates"
                                              (completeMethod)="filterStates($event)"
                                              field="name"
                                              placeholder="Enter State"
                                              [minLength]="1"
                                              name="StateSelectInput"
                                              styleClass="width-percent-100"
                                              [style]="{'width':'100%'}"
                                              [inputStyle]="{'width':'95%','height':'33px'}"
                                              [dropdown]="true">
                                              >
                              </p-autoComplete>
                              <!-- <validation-messages [formCtrl]="StateSelectInput"></validation-messages> -->
                          </div>
                          <div class="form-group">
                              <label for="cityInput">{{"City" | localize}} *</label>
                              <p-autoComplete [(ngModel)]="city"
                                              id="CitySelectInput"
                                              [suggestions]="filteredCities"
                                              (completeMethod)="filterCities($event)"
                                              field="name"
                                              placeholder="Enter City"
                                              [minLength]="1"
                                              name="CitySelectInput"
                                              styleClass="width-percent-100"
                                              [style]="{'width':'100%'}"
                                              [inputStyle]="{'width':'95%','height':'33px'}"
                                              [dropdown]="true">
                                              >
                              </p-autoComplete>
                              <!-- <validation-messages [formCtrl]="CitySelectInput"></validation-messages> -->
                          </div>
                        </tab>
                      </tabset>
                    </tab>
                  </tabset>


                </div>
                <div class="modal-footer">
                    <button type="button" [disabled]="saving" class="btn btn-secondary" (click)="close()">{{"Cancel" | localize}}</button>
                    <button type="submit" [buttonBusy]="saving" [busyText]="l('SavingWithThreeDot')" class="btn btn-primary btn-brand btn-pill" [disabled]="!locationCreateForm.form.valid || saving"><i class="fa fa-save"></i> <span>{{"Save" | localize}}</span></button>
                </div>
            </form>
        </div>
    </div>
</div>
