<div [@routerTransition]>
 
    <div class="kt-content  kt-grid__item kt-grid__item--fluid kt-grid kt-grid--hor">
        <div class="kt-subheader kt-grid__item">
            <div [class]="containerClass">
                <div class="kt-subheader__main">
                    <h3 class="kt-subheader__title">
                        <span>{{"Routes" | localize}}</span>
                    </h3>
                    <span class="kt-subheader__separator kt-subheader__separator--v"></span>
                    <span class="kt-subheader__desc">
                        {{"RoutesHeaderInfo" | localize}}
                    </span>
                </div>
                <div class="kt-subheader__toolbar">
                    <div class="kt-subheader__wrapper">
                        <div class="btn-group" dropdown>
                    <button *ngIf="'Pages.Shipping.Routes.Create' | permission" (click)="createRoute()" class="btn btn-primary btn-elevate btn-pill"><i class="fa fa-plus"></i>{{"CreateNewRoute" | localize}}</button>
                        
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div [class]="containerClass + ' kt-grid__item kt-grid__item--fluid'">
            <div class="kt-portlet kt-portlet--mobile">
                <div class="kt-portlet__body">
                    <div class="row align-items-center">
                        <div class="col-md-12">
                            <form (submit)="getRoutes()" autocomplete="off" class="kt-form" >
                                <div class="row align-items-center mb-4">
                                    <div class="col-md-12">
                                        <div class="kt-searchbar">
                                            <div class="kt-input-icon kt-input-icon--right">
                                                
                                                <input type="text" [(ngModel)]="filters.location" name="value" autoFocus class="form-control k-input" [placeholder]="l('Location')">

                                                    <span class="kt-input-icon__icon kt-input-icon__icon--right">
                                                    <span class="" id="basic-addon1"><i class="flaticon-search"></i></span>
                                                </span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="col-md-12">
                        <div class="primeng-datatable-container" >
                            <p-table #dataTable
                                    (onLazyLoad)="getRoutes($event)"
                                    [value]="primengTableHelper.records"
                                    rows="{{primengTableHelper.defaultRecordsCountPerPage}}"
                                    [paginator]="false"
                                    [lazy]="true"
                                    [responsive]="primengTableHelper.isResponsive">
                                <ng-template pTemplate="header">
                                    <tr>
                                        <th style="width:130px">{{'Actions' | localize}}</th>
                                        <th pSortableColumn="Id">
                                            {{'Id' | localize}}
                                            <p-sortIcon field="Id"></p-sortIcon>
                                        </th>
                                        <th pSortableColumn="Location">
                                            {{'Location' | localize}}
                                            <p-sortIcon field="location"></p-sortIcon>
                                        </th>
                                        <th pSortableColumn="LoadDate">
                                            {{'Load Date' | localize}}
                                            <p-sortIcon field="loadDate"></p-sortIcon>
                                        </th>
                                        <th pSortableColumn="Template">
                                            {{'Template' | localize}}
                                            <p-sortIcon field="template"></p-sortIcon>
                                        </th>
                                        <th pSortableColumn="Vehicle">
                                            {{'Vehicle' | localize}}
                                            <p-sortIcon field="vehicle"></p-sortIcon>
                                        </th>
                                        <th pSortableColumn="Locked">
                                            {{'Locked' | localize}}
                                            <p-sortIcon field="locked"></p-sortIcon>
                                        </th>
                                    </tr>
                                </ng-template>
                                <ng-template pTemplate="body" let-record="$implicit">
                                    <tr>
                                        <td style="width: 130px">
                                            <div class="btn-group dropdown" dropdown>
                                                <button dropdownToggle class="dropdown-toggle btn btn-sm btn-primary btn-elevate btn-pill">
                                                    <i class="fa fa-cog"></i><span class="caret"></span> {{"Actions" | localize}}
                                                </button>
                                                <ul class="dropdown-menu" *dropdownMenu>
                                                    <li>
                                                        <a href="javascript:;" *ngIf="'Pages.Shipping.Routes.Edit' | permission"
                                                        (click)="editRouteModal.show(record.id)">{{'Edit' | localize}}</a>
                                                    </li>
                                                    <li>
                                                        <a href="javascript:;" *ngIf="'Pages.Shipping.Routes.Delete' | permission"
                                                        (click)="deleteRoute(record)">{{'Delete' | localize}}</a>
                                                    </li>
                                                </ul>
                                            </div>
                                        </td>
                                        <td>
                                            <span class="ui-column-title">{{'Id' | localize}}</span>
                                            {{ record.id }}
                                        </td>
                                        <td>
                                            <span class="ui-column-title">{{'Location' | localize}}</span>
                                            {{ record.location.name }}
                                        </td>
                                        <td>
                                            <span class="ui-column-title">{{'Load Date' | localize}}</span>
                                            {{ record.loadDate | date }}
                                        </td>
                                        <td>
                                            <span class="ui-column-title">{{'Template' | localize}}</span>
                                            {{ record.routeTemplate.name }}
                                        </td>
                                        <td>
                                            <span class="ui-column-title">{{'Vehicle' | localize}}</span>
                                            {{ record.vehicle.name }}
                                        </td>
                                        <td>
                                            <span class="ui-column-title">{{'Locked' | localize}}</span>
                                            {{ record.locked }}

                                        </td>
                                    </tr>
                                </ng-template>
                            </p-table>
                            <div class="primeng-no-data" *ngIf="primengTableHelper.totalRecordsCount == 0">
                                {{'NoData' | localize}}
                            </div>
                            <div class="primeng-paging-container">
                                <p-paginator [rows]="primengTableHelper.defaultRecordsCountPerPage"
                                            #paginator
                                            (onPageChange)="getRoutes($event)"
                                            [totalRecords]="primengTableHelper.totalRecordsCount"
                                            [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage">
                                </p-paginator>
                                <span class="total-records-count">
                                    {{'TotalRecordsCount' | localize:primengTableHelper.totalRecordsCount}}
                                </span>
                            </div> 
                        </div>
                        </div>
                    </div>
                    
                   
                </div>
            </div>
        </div>

     <createRouteModal #createRouteModal (modalSave)="getRoutes()"></createRouteModal>
     <editRouteModal #editRouteModal (modalSave)="getRoutes()"></editRouteModal>
    <!-- <zoneFeaturesModal #zoneFeaturesModal></zoneFeaturesModal>
    <commonLookupModal #impersonateUserLookupModal (itemSelected)="impersonateUser($event)"></commonLookupModal>
    <entityTypeHistoryModal #entityTypeHistoryModal></entityTypeHistoryModal> -->
    </div>
</div>
