<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-md">

        <div class="modal-content">

            <form #routeCreateForm="ngForm" role="form" novalidate enctype="multipart/form-data" class="form-validation"
                *ngIf="active" (submit)="save()">
                <div class="modal-header">
                    <h5 class="modal-title">
                        <span>{{"CreateRoute" | 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">

                    <div class="form-group">
                        <label for="Location">{{"Location" | localize}} *</label>
                        <select class="form-control kt-select2" id="location" data-placeholder="Select Location"
                            [(ngModel)]="locationInput" name="location" #location="ngModel">
                            <option *ngFor="let location of filteredLocation" [(value)]="location.id">
                                {{location.name}}
                            </option>
                        </select>
                        <validation-messages [formCtrl]="location"></validation-messages>
                    </div>

                    <div class="form-group">
                        <label for="Vehicle">{{"Vehicle" | localize}} *</label>
                        <select class="form-control kt-select2" id="vehicle" data-placeholder="Select Vehicle"
                            [(ngModel)]="vehicleInput" name="vehicle" #vehicle="ngModel">
                            <option *ngFor="let vehicle of filteredVehicle" [(value)]="vehicle.id">
                                {{vehicle.name}}
                            </option>
                        </select>
                        <validation-messages [formCtrl]="vehicle"></validation-messages>
                    </div>

                    <div class="form-group">
                        <label for="RouteTemplate">{{"Template" | localize}} *</label>
                        <select class="form-control kt-select2" id="routeTemplate" data-placeholder="Select Template"
                            [(ngModel)]="routeTemplateInput" name="RouteTemplate" #routeTemplate="ngModel">
                            <option *ngFor="let routeTemplate of filteredRouteTemplate" [(value)]="routeTemplate.id">
                                {{routeTemplate.name}}
                            </option>
                        </select>
                        <validation-messages [formCtrl]="vehicle"></validation-messages>
                    </div>

                    <div class="form-group">
                        <div class="row">
                            <div class="col-sm-12">
                                <label for="LoadDate" style="padding-bottom: 5px;">{{"Date" | localize}} *</label>
                                <input name="LoadDate" type="text" class="form-control" id="LoadDate" bsDatepicker
                                    [(ngModel)]="loadDate" readonly="readonly" placeholder="Select Date"
                                    #LoadDateDate="ngModel" required />
                                <validation-messages [formCtrl]="LoadDateDate"></validation-messages>
                            </div>


                        </div>
                        <div class="row" style="padding-top: 15px;">
                            <div class="col-sm-6">
                                <label for="departure" style="padding-bottom: 5px;">{{"Departure" | localize}} *</label>

                                <kendo-timepicker [(value)]="departure"> </kendo-timepicker>
                            </div>
                            <div class="col-sm-6">
                                <label for="completion" style="padding-bottom: 5px;">{{"Completion" | localize}} *</label>
                                <kendo-timepicker [(value)]="completion"> </kendo-timepicker>
                            </div>

                        </div>
                    </div>

                    <div class="form-group">

                        <label class="kt-checkbox kt-checkbox--bold kt-checkbox--brand">

                            <input id="locked" type="checkbox" name="locked" [(ngModel)]="locked">
                            {{"Locked" | localize}}
                            <span></span>

                        </label>

                    </div>


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