<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>{{"Orders" | localize}}</span>
                    </h3>
                    <span class="kt-subheader__separator kt-subheader__separator--v"></span>
                    <span class="kt-subheader__desc">
                            {{"OrderManagement" | localize}}
                    </span>
                </div>
                <div class="kt-subheader__toolbar">
                    <div class="kt-subheader__wrapper">
                        <!-- <button (click)="createOrder()" *ngIf="isGranted('Pages.Orders.Create')" class="btn btn-primary btn-elevate btn-pill btn-elevate-air"><i class="fa fa-plus"></i> {{"OrderCreate" | localize}}</button> -->
                        <button (click)="createOrUpdate('/app/sprintship/order-create')" *ngIf="isGranted('Pages.Orders.Create')" class="btn btn-primary btn-elevate btn-pill"><i class="fa fa-plus"></i> {{"OrderCreate" | localize}}</button>
                                
                        <!-- <button (click)="createTag()" *ngIf="isGranted('Pages.Orders.Create')" class="btn btn-primary btn-elevate btn-pill btn-elevate-air"><i class="fa fa-plus"></i> {{"TagCreate" | localize}}</button> -->
                    </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">
                        <form (submit)="getOrders()" 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 [(ngModel)]="filterText" name="filterText" autoFocus class="form-control m-input" [placeholder]="l('SearchWithThreeDot')" type="text">
                                            <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>

                       <!--  <form (submit)="getOrders()" autocomplete="off" class="kt-form" >
                                <div class="row align-items-center mb-4">
                                        <div class="col-xl-6"> -->
                                            <!-- <label for="FleetName">{{"Location" | localize}}</label> -->
                                            
                                            <!-- <select class="form-control kt-select2" style="width:100%" id="FilterByLocation" [(ngModel)]="locationFilter" name="FilterByLocation"  #packageCtrl="ngModel" >
                                                <option *ngFor="let location of filteredLocation"  [(value)]="location.id">
                                                    {{location.name}}
                                                </option>
                                            </select> -->
    <!-- 
                                            <p-autoComplete [(ngModel)]="locationFilter"
                                                id="FilterByLocation"
                                                [suggestions]="filteredLocation"
                                                (completeMethod)="filterLocation($event)"
                                                field="name"
                                                placeholder="Filter by location...."
                                                [minLength]="1"
                                                name="FilterByLocation"
                                                inputStyleClass="form-control"
                                                styleClass="width-percent-100">
                                            </p-autoComplete> -->
                                        <!-- </div> -->
                                        <!-- <div class="col-xl-6">
                                            <div class="input-group">
                                                <input id="FilterDatePicker"
                                                    [(ngModel)]="filterDate"
                                                    type="text"
                                                    #SampleDatePicker
                                                    name="FilterDatePicker"
                                                    class="form-control"
                                                    readonly="readonly"
                                                    bsDatepicker
                                                >
                                                <span class="input-group-btn">
                                                    <button class="btn btn-primary" type="submit"><i class="flaticon-search-1" [attr.aria-label]="l('Search')"></i></button>
                                                </span>
                                            </div>
                                        </div> -->
                           <!--      </div>
                            </form> -->

                    <div class="row align-items-center">
                        <!--<Primeng-TurboTable-Start>-->
                        <div class="col-xl-12">
                            <div class="primeng-datatable-container" >
                                <p-table #dataTable
                                            (onLazyLoad)="getOrders($event)"
                                            [value]="primengTableHelper.records"
                                            rows="{{primengTableHelper.defaultRecordsCountPerPage}}"
                                            [paginator]="false"
                                            [lazy]="true"
                                            [scrollable]="true"
                                            ScrollWidth="100%"
                                            [responsive]="primengTableHelper.isResponsive"
                                            [resizableColumns]="primengTableHelper.resizableColumns">
                                    <ng-template pTemplate="header">
                                        <tr>
                                            <th style="width: 130px" >{{'Actions' | localize}}</th>
                                            <th style="width: 130px" pSortableColumn="id">
                                                {{'Id' | localize}}
                                                <p-sortIcon field="id"></p-sortIcon>
                                            </th>
                                            <th style="width: 150px" pSortableColumn="location.Name">
                                                {{'Location' | localize}}
                                                <p-sortIcon field="location.Name"></p-sortIcon>
                                            </th>
                                            <th style="width: 150px" pSortableColumn="pickupDetail.etaStart">
                                                {{'PickupEta' | localize}}
                                                <p-sortIcon field="pickupDetail.etaStart"></p-sortIcon>
                                            </th>
                                            <th style="width: 150px" pSortableColumn="deliveryDetail.etaEnd">
                                                {{'DeliveryEta' | localize}}
                                                <p-sortIcon field="deliveryDetail.etaEnd"></p-sortIcon>
                                            </th>
                                            <!-- <th style="width: 150px">
                                                {{'TotalPackage' | localize}}
                                            </th> -->
                                        </tr>
                                    </ng-template>
                                    <ng-template pTemplate="body" let-record="$implicit">
                                        <tr>
                                            <td style="width: 130px"
                                                [hidden]="!isGrantedAny('Pages.Orders.Update', 'Pages.Orders.Delete')">
                                                <div class="btn-group dropdown" dropdown container="body">
                                                    <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.Orders.Update' | permission"
                                                                (click)="createOrUpdate('/app/sprintship/order-update',record.id)">{{'Edit' | localize}}</a>
                                                            <!-- <a href="javascript:;" *ngIf="'Pages.Orders.Update' | permission"
                                                                (click)="updateOrderModal.show(record.id)">{{'Edit' | localize}}</a> -->
                                                        </li>
                                                        <li>
                                                            <a href="javascript:;" *ngIf="'Pages.Orders.Delete' | permission"
                                                                (click)="deleteOrder(record)">{{'Delete' | localize}}</a>
                                                        </li>
                                                    </ul>
                                                </div>
                                            </td>
                                            <td style="width: 130px">
                                                <span class="ui-column-title"> {{'Id' | localize}}</span>
                                                {{record.id}}
                                            </td>
                                            <td style="width: 150px">
                                                <span class="ui-column-title"> {{'Location' | localize}}</span>
                                                {{record.location.name}}
                                            </td>
                                            <td style="width: 150px">
                                                <span class="ui-column-title"> {{'PickupEta' | localize}}</span>
                                                {{record.pickupDetail.etaEnd | date:'MM/dd/yyyy hh:mm aa'}}
                                            </td>
                                            <td style="width: 150px">
                                                <span class="ui-column-title"> {{'DeliveryEta' | localize}}</span>
                                                {{record.deliveryDetail.etaEnd | date:'MM/dd/yyyy hh:mm aa'}}
                                            </td>
                                            <!-- <td style="width: 150px">
                                                <span class="ui-column-title"> {{'TotalPackages' | localize}}</span>
                                                {{record.totalPackages}}
                                            </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)="getOrders($event)"
                                                    [totalRecords]="primengTableHelper.totalRecordsCount"
                                                    [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage">
        
                                    </p-paginator>
                                    <span class="total-records-count">
                                        {{'TotalRecordsCount' | localize:primengTableHelper.totalRecordsCount}}
                                    </span>
                                </div>
                            </div>
                        </div>
                        <!--<Primeng-TurboTable-End>-->
                    </div>
                </div>
            </div>
        </div>

    <!-- <createOrderModal #createOrderModal (modalSave)="getOrders()"></createOrderModal>
    <updateOrderModal #updateOrderModal (modalSave)="getOrders()"></updateOrderModal> -->
    </div>
</div>
