<ion-header>
    <ion-toolbar class="header-toolbar">
        <ion-title color="light"> {{ts.trPK('worklistMain','title')}}</ion-title>
        <ion-buttons slot="start">
            <nav-buttons backLink="/notification/homepage"></nav-buttons>
        </ion-buttons>
    </ion-toolbar>

    <ion-toolbar class="slideToolBar">
        <ion-segment class="segmentPR" scrollable>
            <ion-segment-button value="0" checked>
                <ion-label> {{ts.trPK('worklistMain','info')}}</ion-label>
            </ion-segment-button>
            <ion-segment-button value="1">
                <ion-label> {{ts.trPK('worklistMain','line_details')}}</ion-label>
            </ion-segment-button>
            <ion-segment-button value="2">
                <ion-label>
                    {{'worklistMain, actionHis' | translate}}

                </ion-label>
            </ion-segment-button>
            <ion-segment-button value="3">
                <ion-label>{{'general, attachment' | translate}}
                </ion-label>
            </ion-segment-button>
        </ion-segment>
    </ion-toolbar>
</ion-header>

<ion-content class="colorBG">


    <ion-slides pager="true" class="slides-gray-bullets">
        <ion-slide class="slide-1">

            <div *ngIf="pInformation &&  pInformation != '' " class="tipsPadding">{{pInformation}}</div>

            <ion-card class="cardContent">
           
                <ion-card-content>
                    <ion-grid style="text-align: left">
                        <ion-row>
                            <ion-col>
                                <label class="colItemReq" for=""> {{ts.trPK('worklistMain','description')}}

                                </label>
                                <br />

                                <label for=""> {{ts.trPK('worklistMain','des-PO')}} {{PO_NUMBER}} </label>
                            </ion-col>
                        </ion-row>
                        <ion-row>
                            <ion-col>
                                <label class="colItemReq" for=""> {{ts.trPK('worklistMain','from')}}

                                </label>
                                <br />

                                <label for="">{{getPassNotificationDetails.FROM_USER}}</label>
                            </ion-col>
                        </ion-row>

                        <ion-row>
                            <ion-col>
                                <label class="colItemReq" for="">{{ts.trPK('worklistMain','to')}}
                                </label>
                                <br />

                                <label for=""> {{getPassNotificationDetails.TO_USER}}</label>
                            </ion-col>
                        </ion-row>

                        <ion-row>
                            <ion-col>
                                <label class="colItemReq" for="">{{ts.trPK('worklistMain','sent')}}
                                </label>
                                <br />


                                <label for="">{{getPassNotificationDetails.BEGIN_DATE}}</label>
                            </ion-col>
                        </ion-row>
                        <ion-row>
                            <ion-col>
                                <label class="colItemReq" for="">{{ts.trPK('worklistMain','closed')}}
                                </label>
                                <br />

                                <label for="">{{getPassNotificationDetails.END_DATE}}</label>
                            </ion-col>
                        </ion-row>
                        <ion-row>
                            <ion-col>
                                <label class="colItemReq" for="">{{ts.trPK('worklistMain','id')}}
                                </label>
                                <br />

                                <label for="">{{getPassNotificationDetails.NOTIFICATION_ID}}</label>
                            </ion-col>
                        </ion-row>
                        <ion-row *ngIf=" getPassNotificationDetails.RESPONDER != '' ">
                            <ion-col>
                                <label class="colItemReq" for="">{{ts.trPK('worklistMain','responder')}}
                                </label>
                                <br />

                                <label for="">{{getPassNotificationDetails.RESPONDER}} </label>
                            </ion-col>
                        </ion-row>

                        <ion-row>
                            <ion-col>
                                <label class="colItemReq" for="">{{ts.trPK('worklistMain','subject')}} </label>
                                <br />


                                <label for="">{{getPassNotificationDetails.SUBJECT}} </label>
                            </ion-col>
                        </ion-row>


                        <div *ngFor="let header of POHeader">


                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','Supplier')}} </label>
                                    <br />

                                    <label for="">{{header.VENDOR_NAME}} </label>
                                </ion-col>
                            </ion-row>
                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','Site')}} </label>
                                    <br />

                                    <label for="">{{header.VENDOR_SITE_CODE}} </label>
                                </ion-col>
                            </ion-row>
                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','Buyer')}} </label>
                                    <br />

                                    <label for="">{{header.BUYER}} </label>
                                </ion-col>
                            </ion-row>
                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','Preparer')}} </label>
                                    <br />

                                    <label for="">{{header.PREPARER}} </label>
                                </ion-col>
                            </ion-row>
                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','CreationDate')}}</label>
                                    <br />

                                    <label for="">{{header.CREATION_DATE}} </label>
                                </ion-col>
                            </ion-row>
                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','ShipToLocation')}}
                                    </label>
                                    <br />

                                    <label for="">{{header.SHIP_TO_LOCATION_NAME}} </label>
                                </ion-col>
                            </ion-row>
                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','QuotationNumber')}}
                                    </label>
                                    <br />

                                    <label for="">{{header.QUOTATION_NUMBER}} </label>
                                </ion-col>
                            </ion-row>
                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','QuotationDate')}}
                                    </label>
                                    <br />

                                    <label for="">{{header.QUOTATION_DATE}} </label>
                                </ion-col>
                            </ion-row>
                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','PaymentTerms')}} </label>
                                    <br />

                                    <label for="">{{header.PAYMENT_TERMS}} </label>
                                </ion-col>
                            </ion-row>
                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','Currency')}} </label>
                                    <br />

                                    <label for="">{{header.CURRENCY_NAME}} - {{header.LOC_CUR}} </label>
                                </ion-col>
                            </ion-row>
                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','GrossAmount')}} </label>
                                    <br />

                                    <label for="">{{header.GROSS_AMOUNT}} </label>
                                </ion-col>
                            </ion-row>
                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','DiscountAmount')}}
                                    </label>
                                    <br />

                                    <label for="">{{header.DISCOUNT_AMOUNT}} </label>
                                </ion-col>
                            </ion-row>
                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq"
                                        for="">{{ts.trPK('worklistMain','TotalPODiscount')}}</label>
                                    <br />

                                    <label for="">{{header.TOTAL_PO_DISCOUNT}} </label>
                                </ion-col>
                            </ion-row>
                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','VATAmount')}} </label>
                                    <br />

                                    <label for="">{{header.SALES_TAX}} </label>
                                </ion-col>
                            </ion-row>

                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','CustomDuty')}} </label>
                                    <br />

                                    <label for="">{{header.CUSTOM_DUTY}} </label>
                                </ion-col>
                            </ion-row>
                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','ShipHandle')}} </label>
                                    <br />

                                    <label for="">{{header.SHIP_HANDLE}} </label>
                                </ion-col>
                            </ion-row>
                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','OtherCharges')}}</label>
                                    <br />

                                    <label for="">{{header.OTHER_CHARGES}} </label>
                                </ion-col>
                            </ion-row>
                            <!-- <ion-row>
                                          <ion-col>
                                              <label class="colItemReq" for="">{{ts.trPK('worklistMain','Currency')}} </label>
                                              <br />
            
                                              <label for="">{{header.LOC_CUR}} </label>
                                          </ion-col>
                                        </ion-row>
                                        <ion-row> -->


                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','TotalPOAmountWithVAT')}}
                                    </label>
                                    <br />

                                    <label for="">{{header.TOT_PO_AMT}} </label>
                                </ion-col>
                            </ion-row>

                            <ion-row>
                                <ion-col>
                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','TotalPOAmountInWords')}}
                                    </label>
                                    <br />

                                    <label for="">{{header.TOT_PO_AMT_WORD}} </label>
                                </ion-col>
                            </ion-row>
                            <!-- <ion-row>
                                                                <ion-col>
                                                                    <label class="colItemReq" for="">{{ts.trPK('worklistMain','PONumber')}} </label>
                                                                    <br />
                                  
                                                                    <label for="">{{header.PO_NUMBER}} </label>
                                                                </ion-col>
                                                              </ion-row> -->

                        </div>
                        <br />



                        <ion-grid>
                            <div>
                                <ion-row style="text-align: center !important">
                                    <ion-col *ngIf="totalH">
                                        <div class="colItemReq" style="text-align: center !important">{{totalH}}</div>
                                        <div class="labelTotal">{{valueH}}</div>

                                    </ion-col>
                                    <ion-col *ngIf="taxH ">
                                        <div class="colItemReq" style="text-align: center !important">{{taxH}}</div>
                                        <div class="labelTotal">{{taxvalueH}}</div>

                                    </ion-col>
                                </ion-row>

                            </div>
                        </ion-grid>



                    </ion-grid>
                    <!-- -->
                    <button ion-button [hidden]="IsReachEnd" class="itemHISBtn" (click)="loadMoreNotificationBody()">Load More</button>


                </ion-card-content>


                <ion-card-content>
                    <div>

                        <div id="notificationDynamicFields1">
                        </div>

                    </div>

                </ion-card-content>
            </ion-card>


        </ion-slide>
        <ion-slide>
            <!-- <ion-card class="cardContent">
              
                <ion-card-content> -->
            <div [hidden]="POLines && POLines.length > 0">
                <p>{{ 'general, empty' | translate}}</p>
            </div>
            <ion-list class="itemReqList" *ngIf="POLines && POLines.length > 0 ">

                <div>
                    <ion-grid class="gridItemReq">


                        <ion-item class="itemReqContent" *ngFor="let Lines of POLines; let i=index;">
                            <div class="itemReqDiv">


                                <ion-row>
                                    <ion-col class="colItemReqHeader">

                                        <label for="">{{i+1}}. {{Lines.ITEM_DESCRIPTION}} </label>
                                    </ion-col>
                                </ion-row>
                                <ion-row>
                                    <ion-col class="colItems">
                                        <label class="colItemReq" for="">{{ts.trPK('worklistMain','code')}} </label>
                                        <br />

                                        <ion-label class="labelValue" for="">{{Lines.ITEM_CODE}} </ion-label>
                                    </ion-col>
                                    <ion-col class="colItems">
                                        <label class="colItemReq" for="">{{ts.trPK('worklistMain','MFG')}}
                                        </label>
                                        <br />

                                        <ion-label class="labelValue" for="">{{Lines.MFG}} *</ion-label>
                                    </ion-col>


                                </ion-row>
                                <ion-row>
                                    <ion-col class="colItems">
                                        <label class="colItemReq" for="">{{ts.trPK('worklistMain','LINE_TYPE')}}
                                        </label>
                                        <br />

                                        <ion-label class="labelValue" for="">{{Lines.LINE_TYPE}} </ion-label>
                                    </ion-col>

                                    <ion-col class="colItems">
                                        <label class="colItemReq" for="">{{ts.trPK('worklistMain','unit')}} </label>
                                        <br />

                                        <ion-label class="labelValue" for="">{{Lines.UOM}} </ion-label>
                                    </ion-col>




                                </ion-row>
                                <ion-row>

                                    <ion-col class="colItems">
                                        <label class="colItemReq" for="">{{ts.trPK('worklistMain','price')}} </label>
                                        <br />

                                        <ion-label class="labelValue" for="">{{Lines.UNIT_PRICE}} </ion-label>

                                    </ion-col>
                                    <ion-col class="colItems">
                                        <label class="colItemReq" for="">{{ts.trPK('worklistMain','LINE_AMOUNT')}}
                                        </label>
                                        <br />

                                        <ion-label class="labelValue" for="">{{Lines.LINE_AMOUNT}} </ion-label>
                                    </ion-col>




                                </ion-row>
                                <ion-row>

                                    <ion-col class="colItems">
                                        <label class="colItemReq" for="">{{ts.trPK('worklistMain','quantity')}} </label>
                                        <br />

                                        <ion-label class="labelValue" for="">{{Lines.QUANTITY}} </ion-label>

                                    </ion-col>
                                    <ion-col class="colItems">
                                        <label class="colItemReq" for="">{{ts.trPK('worklistMain','LINE_DIS')}} </label>
                                        <br />

                                        <ion-label class="labelValue" for="">{{Lines.LINE_DISC_PERCENTAGE}} </ion-label>
                                    </ion-col>





                                </ion-row>
                                <ion-row>

                                    <ion-col class="colItems">
                                        <label class="colItemReq" for="">{{ts.trPK('worklistMain','NEED_TO')}} </label>
                                        <br />

                                        <ion-label class="labelValue" for="">{{Lines.NEED_BY_DATE}} </ion-label>

                                    </ion-col>
                                    <ion-col class="colItems">
                                        <label class="colItemReq" for="">{{ts.trPK('worklistMain','PROMISED_DATE')}}
                                        </label>
                                        <br />

                                        <ion-label class="labelValue" for="">{{Lines.PROMISED_DATE}} </ion-label>
                                    </ion-col>





                                </ion-row>
                                <ion-row>

                                    <ion-col class="colItems">
                                        <label class="colItemReq" for="">{{ts.trPK('worklistMain','DELIVER_TO')}}
                                        </label>
                                        <br />

                                        <ion-label class="labelValue" for="">{{Lines.DELIVER_TO_LOCATION}} </ion-label>

                                    </ion-col>
                                    <ion-col class="colItems">
                                        <label class="colItemReq" for="">{{ts.trPK('worklistMain','PR_NO')}} </label>
                                        <br />

                                        <ion-label class="labelValue" for="">{{Lines.PR_NUM}} </ion-label>
                                    </ion-col>





                                </ion-row>
                                <ion-row>

                                    <ion-col class="colItems">

                                        <label class="colItemReq" for="">{{ts.trPK('worklistMain','REQUEST')}} </label>
                                        <br />

                                        <ion-label class="labelValue" for="">{{Lines.REQUESTOR}} </ion-label>

                                    </ion-col>
                                    <!-- <ion-col>
                                        <label class="colItemReq" for="">{{ts.trPK('payslip','amount')}} </label>
                                        <br />
                                        	Quotation Analysis
                                        <label for="">{{Item History}} </label>
                                    </ion-col> -->





                                </ion-row>

                                <ion-row>

                                    <ion-col>

                                        <div style="text-align: center">

                                            <button ion-button class="itemHISBtn"
                                                (click)="getItemHistory(Lines.ITEM_ID)">
                                                {{ts.trPK('worklistMain','ITEM_HIS')}}
                                                <!-- (click)="openNoteDetail(actionHistory.NOTE ,actionHistory.NAME)"
                                                [hidden]="actionHistory.NOTE == '' || actionHistory.NOTE == null"
                                                style=" background: none;width: 60%;">

                                                <img src="../assets/imgs/noteSmall.png"> -->

                                            </button>
                                        </div>
                                        <!-- <label class="colItemReq" for="">{{ts.trPK('worklistMain','ITEM_HIS')}} </label> -->
                                        <!-- <br /> -->

                                        <!-- <label for="">{{Lines.REQUESTOR}} </label> -->

                                    </ion-col>
                                    <ion-col>

                                        <div style="text-align: center">

                                            <button ion-button class="itemHISBtn"
                                                (click)="getQutationAnalysis(Lines.PO_HEADER_ID ,Lines.ITEM_ID)">
                                                {{ts.trPK('worklistMain','QUOTATION_ANALYSIS')}}
                                                <!-- (click)="getQutationAnalysis(Lines.PO_HEADER_ID ,Lines.ITEM_CODE)"
                                                [hidden]="actionHistory.NOTE == '' || actionHistory.NOTE == null"
                                                style=" background: none;width: 60%;">
                                                <img src="../assets/imgs/noteSmall.png"> -->
                                            </button>
                                        </div>

                                    </ion-col>

                                </ion-row>

                            </div>
                        </ion-item>

                    </ion-grid>
                </div>
            </ion-list>
            <!-- </ion-card-content>
            </ion-card> -->
        </ion-slide>

        <ion-slide>

            <ion-card class="cardContent">
                <ion-card-content>

                    <div [hidden]="actionHistoryRes && actionHistoryRes.length > 0">
                        <p>{{ 'general, empty' | translate}}</p>
                    </div>
                    <div *ngIf="actionHistoryRes && actionHistoryRes.length > 0 ">
                        <ion-list class="notification-list ">
                            <div class="timeline">
                                <ion-item *ngFor="let actionHistory of actionHistoryRes">

                                    <div class="timeline-item" slot="start">

                                        <div>

                                            <button ion-button
                                                (click)="openNoteDetail(actionHistory.NOTE ,actionHistory.NAME)"
                                                [hidden]="actionHistory.NOTE == '' || actionHistory.NOTE == null"
                                                style=" background: none;width: 60%;">

                                                <img src="../assets/imgs/noteSmall.png">

                                            </button>
                                        </div>

                                        <div [ngClass]="{'bg-blue-dot' : actionHistory.ACTION === 'Submitted' || actionHistory.ACTION === 'Submit' ,'bg-orange-dot' : actionHistory.ACTION === 'Pending' ,'bg-red-dot' : actionHistory.ACTION === 'Rejected','bg-green-dot' : actionHistory.ACTION != 'Pending' && actionHistory.ACTION != 'Rejected' && actionHistory.ACTION != 'Submitted' && actionHistory.ACTION != 'Submit'}"
                                            class="timeline-thumb  timeline-icon">
                                        </div>
                                    </div>
                                    <ion-col>
                                        <ion-label
                                            [ngClass]="{'bg-blue-txt' : actionHistory.ACTION === 'Submitted' || actionHistory.ACTION === 'Submit' ,'bg-orange-txt' : actionHistory.ACTION === 'Pending' ,'bg-red-txt' : actionHistory.ACTION === 'Rejected','bg-green-txt' : actionHistory.ACTION != 'Pending' && actionHistory.ACTION != 'Rejected' && actionHistory.ACTION != 'Submitted' && actionHistory.ACTION != 'Submit'}"
                                            class=""> {{actionHistory.ACTION}}</ion-label>
                                        <ion-label> {{actionHistory.NAME}}
                                        </ion-label>

                                        <ion-label> {{actionHistory.NOTIFICATION_DATE| dateString }} </ion-label>
                                    </ion-col>
                                </ion-item>
                            </div>
                        </ion-list>
                    </div>
                    <button ion-button [hidden]="IsReachEnd" class="itemHISBtn" (click)="loadMoreActionHistory()">Load More</button>

                </ion-card-content>

            </ion-card>
        </ion-slide>

        <ion-slide>
            <ion-card class="cardContent">
                <ion-card-content>
                    <div [hidden]="attachmentRes && attachmentRes.length > 0">
                        <p>{{ 'general, notAttch' | translate}}</p>
                    </div>
                    <div *ngIf="attachmentRes && attachmentRes.length > 0 ">

                        <ion-grid>
                            <div *ngFor="let attachList of attachmentRes">
                                <ion-row (click)="OpenAttachFiles(attachList.FILE_DATA,attachList.FILE_CONTENT_TYPE)">
                                    <ion-col col-12>
                                        <div
                                            *ngIf="attachList.FILE_CONTENT_TYPE === 'pdf' || attachList.FILE_CONTENT_TYPE === 'PDF'">
                                            <img float-start class="attachImg" src="../assets/imgs/pdf.png">
                                        </div>
                                        <div *ngIf="attachList.FILE_CONTENT_TYPE === 'txt'"> <img float-start
                                                class="attachImg" src="../assets/imgs/doc.png">
                                        </div>
                                        <div
                                            *ngIf="attachList.FILE_CONTENT_TYPE != 'txt' && attachList.FILE_CONTENT_TYPE != 'PDF' && attachList.FILE_CONTENT_TYPE != 'pdf' && attachList.FILE_CONTENT_TYPE != 'png'  && attachList.FILE_CONTENT_TYPE != 'jpeg' && attachList.FILE_CONTENT_TYPE != 'jpg' && attachList.FILE_CONTENT_TYPE != 'PNG' && attachList.FILE_CONTENT_TYPE != 'JPEG' && attachList.FILE_CONTENT_TYPE != 'JPG'">
                                            <img float-start class="attachImg" src="../assets/imgs/nonfile.png">
                                        </div>
                                        <div
                                            *ngIf="attachList.FILE_CONTENT_TYPE === 'png'  || attachList.FILE_CONTENT_TYPE === 'jpeg' || attachList.FILE_CONTENT_TYPE === 'jpg'|| attachList.FILE_CONTENT_TYPE === 'PNG' || attachList.FILE_CONTENT_TYPE === 'JPEG'|| attachList.FILE_CONTENT_TYPE === 'JPG'">
                                            <img float-start class="attachImg" src="../assets/imgs/img.png">
                                        </div>
                                        <ion-label>
                                            {{attachList.SEQ_NUM }}. {{attachList.FILE_NAME}} </ion-label>
                                    </ion-col>

                                </ion-row>
                            </div>

                        </ion-grid>


                    </div>
                </ion-card-content>
            </ion-card>
        </ion-slide>

    </ion-slides>



</ion-content>
<ion-footer class="footerSearchBtn">

    <ion-row>
        <ion-col col-12>
            <div id="notificationDynamicFields">
            </div>
        </ion-col>
    </ion-row>

    <ion-row>
        <ion-col col-2>

        </ion-col>
        <ion-col col-8>


            <ion-item *ngIf="notificationButtonRes?.length >0" class="requiredItem actionList">
                <ion-label class="boldTxtNav">{{'actionHis, action' | translate}} </ion-label>
                <ion-select (ionChange)="actionButton()" okText="{{ts.trPK('general','ok')}}"
                    cancelText="{{ts.trPK('general','cancel')}}" [(ngModel)]="actionType" required>
                    <ion-select-option value="{{notificationButtons.BUTTON_ACTION}}"
                        *ngFor="let notificationButtons of notificationButtonRes; let i=index;">
                        {{notificationButtons.BUTTON_LABEL}}</ion-select-option>
                </ion-select>
            </ion-item>

        </ion-col>

        <ion-col col-2 style="bottom: -8px">
            <ion-button class="skipbutton" (click)="nextNotfification()">
                {{'worklistMain, skip' | translate}}
                <img class="arrowIcon" src="../assets/imgs/arrowRight.png">

            </ion-button>
        </ion-col>
    </ion-row>






</ion-footer>