<!-- <div class="w-full min-height-50px mb-10px justify-between items-center">
  <div class="flex justify-between">
    <div class="flex pr-2">
    </div>
    <div class="flex justify-end">
      <div class="px-1">
        <div class="relative shadow-md">
          <input type="text" id="hs-leading-icon" name="hs-leading-icon"
            class="ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 " [placeholder]="'SearchByNoOrName' | translate"
            style="height: 40px;" [(ngModel)]="search">
          <div
            class="absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4">
            <i class="ri-search-line text-gray"></i>
          </div>
        </div>
      </div>
      <div class="px-1">
        <button type="button" class="ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
          data-hs-overlay="#management-evaluation-cycle-page-modal" (click)="modalStatus='add';modalStatusEdit=true;setData()">
          <i class="ri-add-line"></i>
          Add
        </button>
      </div>
      <div class="px-1">
        <button href="javascript:void(0);" class="ti-btn ti-btn-soft-danger h-20px m-0 shadow-md"
          data-hs-overlay="#management-evaluation-cycle-page-alert-modal" (click)="modalStatus='deleteGroup';setData()">
          <i class="ti ti-trash fs-l"></i>
          Delete
        </button>
      </div>
    </div>
  </div>
</div> -->

<div class="w-full min-height-50px mb-10px justify-between items-center">
  <div class="flex justify-end">
    <div class="px-1">
      <div class="relative shadow-md">
        <input type="text" id="hs-leading-icon" name="hs-leading-icon"
          class="ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 " [placeholder]="'SearchByNoOrName' | translate"
          [(ngModel)]="search">

        <div
          class="absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4">
          <i class="ri-search-line text-gray"></i>
        </div>
      </div>
    </div>
    <div class="px-1">
      <button type="button" class="ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
        (click)="modalStatus='add';modalStatusEdit=true;selectPl();selectPmsMasfromEvaluationCycle();openDialog();">
        <i class="ri-add-line"></i>
        {{'Add' | translate }}
      </button>
    </div>
    <div class="px-1">
      <button href="javascript:void(0);" class="ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
        (click)="modalStatus='delete';selectPmsMasfromEvaluationCycle();deletePmsMasfromEvaluation()">
        <i class="ri-delete-bin-6-line"></i>
        {{'Delete' | translate }}
      </button>
    </div>
  </div>
</div>

<div class="page px-rem">
  <app-datagrid-syncfution [searchSettings]="searchSettings" [searchText]="search" [dataSource]="syncfutionDataList"
    [columns]="columns" [selectedItems]="selectedItems" [childForm]="true" (createFormEvent)="createForm($event)"
    (sendNextPageForm)="selectPmsMasfromEvaluationCycle($event); openDialogForm()"
    (sendSelectData)="modalStatus='edit';selectPmsMasfromEvaluationCycle($event);openDialog()"
    (sendSelectedItems)="onSelectItemChange($event)" [actionWidth]="translateService.getCurrentLang()=='th'?220:0">
  </app-datagrid-syncfution>
</div>

<ng-template #managementEvaluationCycleModal let-modal>
  <h3 mat-dialog-title>
    {{modalStatus=='add'?'เพิ่มรอบการประเมิน':'EvaluationPeriod' | translate}}
  </h3>
  <div class="w-full flex justify-end mb-1rem">
    <div class="absolute flex">
      <div class="px-1">
        <button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
          (click)="selectPl();selectPmsMasfromEvaluationCycle()">
          <i class="ti ti-eraser text-base"></i>
          {{'Clear' | translate}}
        </button>
      </div>
    </div>
  </div>
  <mat-dialog-content>
    <label for="input-label" class="ti-form-label mt-2rem">{{'PeriodCode'| translate }}<span
        class="text-danger">*<ng-container *ngIf="modalStatus=='add'&&checkPrimary()">
          รหัสรอบการประเมินซ้ำ
        </ng-container></span></label>
    <input type="text" id="input-label" class="ti-form-input w-1/2"
      [ngClass]="{'!bg-input-readonly': modalStatus == 'edit'}" [readonly]="modalStatus =='edit'"
      [(ngModel)]="pmsMasfromEvaluation.select.pmsEvaluationRoundId">

    <label for="detail_th" class="ti-form-label mt-2rem">{{'DescriptionThai'| translate }}<span
        class="text-danger">*</span></label>
    <input type="text" id="detail_th" class="ti-form-input h-16"
      [ngClass]="{'!bg-input-readonly': modalStatus == 'edit'}" [(ngModel)]="pmsMasfromEvaluation.select.tdesc"
      [readonly]="modalStatus =='edit'">

    <label for="detail_eng" class="ti-form-label mt-2rem">{{'DescriptionEng'| translate }}</label>
    <input type="text" id="detail_eng" class="ti-form-input h-16"
      [ngClass]="{'!bg-input-readonly': modalStatus == 'edit'}" [(ngModel)]="pmsMasfromEvaluation.select.edesc"
      [readonly]="modalStatus =='edit'">

    <label for="input-label" class="ti-form-label mt-2rem">{{'Year_round'| translate }}<span
        class="text-danger">*</span></label>
    <select class="ti-form-select" [(ngModel)]="pmsMasfromEvaluation.select.apsyear"
      [ngClass]="{'!bg-input-readonly': modalStatus == 'edit'}" [disabled]="modalStatus == 'edit'">
      <option *ngFor="let item of yearList" [ngValue]="item">{{ item }}</option>
    </select>
    <label for="input-label" class="ti-form-label mt-2rem">{{'StartDate'| translate }}<span
        class="text-danger">*</span></label>
    <input type="date" id="input-label" class="ti-form-input w-1/2"
      [(ngModel)]="pmsMasfromEvaluation.select.apsPeriodStart" [ngClass]="{'!bg-input-readonly': modalStatus == 'edit'}"
      [readonly]="modalStatus =='edit'">

    <label for="input-label" class="ti-form-label mt-2rem">{{'EndDate'| translate }}<span
        class="text-danger">*</span></label>
    <input type="date" id="input-label" class="ti-form-input w-1/2"
      [(ngModel)]="pmsMasfromEvaluation.select.apsPeriodEnd" [ngClass]="{'!bg-input-readonly': modalStatus == 'edit'}"
      [readonly]="modalStatus =='edit'">

    <label for="input-label" class="ti-form-label mt-2rem">{{'JobDescription(JD)'| translate }}</label>
    <div *ngFor="let item of pmsMasfromEvaluation.select.jd;let i = index;let f=first;let l = last"
      class="grid grid-cols-2">
      <div class="col-span-1">
        <div class="flex relative">
          <input type="text" class="ti-form-input pointer-events-none" readonly
            [ngClass]="{'input-list-f1': f&&!l, 'input-list-c1': !f&&!l, 'input-list-l1': !f&&l, 'input-list-fl1': f&&l,'!bg-input-readonly':modalStatus == 'edit'}"
            [(ngModel)]="item.jobCodeId">
          <div
            [ngClass]="{'input-list-line-f': f&&!l, 'input-list-line-c': !f&&!l, 'input-list-line-l': !f&&l, 'input-list-line-fl': f&&l}">
            <div class="input-list-line"></div>
          </div>
          <input type="text" class="ti-form-input pointer-events-none" readonly
            [ngClass]="{'input-list-f2': f&&!l, 'input-list-c2': !f&&!l, 'input-list-l2': !f&&l, 'input-list-fl2': f&&l,'!bg-input-readonly':modalStatus == 'edit'}"
            [(ngModel)]="item.tdesc">
          <div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
            <button *ngIf="item.jobCodeId && modalStatus !== 'edit'" type="button"
              class="flex items-center text-red-500" (click)="pl.selectIndex=i;selectPl();">
              <i class="ti ti-circle-x cursor-pointer"></i>
            </button>
          </div>
        </div>
      </div>
      <div class="col-span-1 ml-1" *ngIf="f && modalStatus !== 'edit'">
        <ng-component *ngTemplateOutlet="plSearchButton"></ng-component>
      </div>
    </div>
    <div class="grid grid-cols-2" *ngIf="!pmsMasfromEvaluation.select.jd.length">
      <div class="col-span-1">
        <div class="flex relative">
          <input type="text" class="ti-form-input input-list-fl1 pointer-events-none" readonly>
          <div class="input-list-line-fl">
            <div class="input-list-line"></div>
          </div>
          <input type="text" class="ti-form-input input-list-fl2 pointer-events-none" readonly>
        </div>
      </div>
      <div class="col-span-1 ml-1" *ngIf="modalStatus !== 'edit'">
        <ng-component *ngTemplateOutlet="plSearchButton"></ng-component>
      </div>
    </div>
    <ng-template #plSearchButton>
      <button type="button"
        class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary !m-0 h-full"
        style="height: 44.8px !important;"
        (click)="openPLDialog();PLsearchmodal.search='';searchModalChange(plListFilter())">
        <i class="ri-search-line cursor-pointer text-gray"></i>
      </button>
    </ng-template>
    <span class="text-danger mt-1">**{{'NoteIfYouDoNotSelectAJDLevelTheSystemWillSelectAll' | translate}}</span>
  </mat-dialog-content>
  <mat-dialog-actions align="end">
    <button type="button" mat-button [mat-dialog-close]
      class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10">
      {{'Back' | translate}}
    </button>
    <button *ngIf="modalStatus == 'add'" type="button" class="ti-btn ti-btn-success" mat-button
      [class.ti-btn-disabled]="!pmsMasfromEvaluation.select.pmsEvaluationRoundId||!pmsMasfromEvaluation.select.tdesc||(modalStatus=='add'&&checkPrimary())"
      (click)="addPmsMasfromEvaluation()"
      [disabled]="!pmsMasfromEvaluation.select.pmsEvaluationRoundId||!pmsMasfromEvaluation.select.tdesc||(modalStatus=='add'&&checkPrimary())">
      {{'SaveData' | translate}}
    </button>
  </mat-dialog-actions>
</ng-template>

<ng-template #managementEvaluationCycleModalForm let-modal>
  <h3 mat-dialog-title>
    เเก้ไขเเบบฟอร์มตามรอบการประเมิน
  </h3>
  <mat-dialog-content>
    <!-- <app-edit-define-document-form *ngIf="pmsMasfromEvaluation.select.pmsEvaluationRoundId"
      [evaluationRoundId]="pmsMasfromEvaluation.select.pmsEvaluationRoundId"></app-edit-define-document-form> -->
    <app-edit-evaluation-form *ngIf="pmsMasfromEvaluation.select.pmsEvaluationRoundId"
      [evaluationRoundId]="pmsMasfromEvaluation.select.pmsEvaluationRoundId"
      [apsyear]="pmsMasfromEvaluation.select.apsyear"></app-edit-evaluation-form>

  </mat-dialog-content>
  <mat-dialog-actions align="end">
    <button type="button" mat-button [mat-dialog-close]
      class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10">
      ย้อนกลับ
    </button>
  </mat-dialog-actions>
</ng-template>

<ng-template #PLModal let-modal>
  <h3 mat-dialog-title>
    ข้อมูลลักษณะงาน (JD)
  </h3>
  <mat-dialog-content>
    <div class="flex justify-end pb-1rem">
      <div class="px-1">
        <div class="relative shadow-md">
          <input type="text" id="hs-leading-icon" name="hs-leading-icon"
            class="ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 " [placeholder]="'SearchByNoOrName' | translate"
            [(ngModel)]="PLsearchmodal.search" (ngModelChange)="onPLModalSearchChange()">
          <div
            class="absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4">
            <i class="ri-search-line text-gray"></i>
          </div>
        </div>
      </div>
    </div>
    <div class="overflow-auto border">
      <table class="ti-custom-table ti-custom-table-head ti-custom-table-hover">
        <thead>
          <tr>
            <ng-container
              *ngFor="let item of ['ลำดับ','รหัสลักษณะงาน (JD)','รายละเอียดฝ่าย (ไทย)','รายละเอียดฝ่าย (อังกฤษ)']; let f = first; let l = last">
              <th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary" [class.!text-center]="f">
                <span class="text-sm">{{ item }}</span>
                <div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l">
                  <i class="ti ti-dots-vertical fs-l"></i>
                </div>
              </th>
            </ng-container>
          </tr>
        </thead>
        <tbody *ngIf="!plListFilter().length">
          <tr>
            <td class="text-center" colspan="100%">
              ไม่พบข้อมูล
            </td>
          </tr>
        </tbody>
        <tbody *ngIf="plListFilter().length">
          <tr
            *ngFor="let item of plListFilter() | slice:((PLsearchmodal.currentPage-1) * PLsearchmodal.pageSize) : (((PLsearchmodal.currentPage-1) * PLsearchmodal.pageSize) + PLsearchmodal.pageSize);let i = index"
            class="cursor-pointer" (click)="selectPl(item);closePLDialog()">
            <td class="flex justify-center">
              {{((PLsearchmodal.currentPage-1) * PLsearchmodal.pageSize)+(i+1)}}
            </td>
            <td>{{item.jobCodeId}}</td>
            <td>{{item.tdesc}}</td>
            <td>{{item.edesc}}</td>
          </tr>
        </tbody>
      </table>
    </div>
    <app-pagination [totalItems]="plListFilter().length" [pageSize]="PLsearchmodal.pageSize"
      (pageChange)="PLsearchmodal.currentPage = $event"
      (pageSizeChange)="PLsearchmodal.pageSize = $event;PLsearchmodal.currentPage = 1"></app-pagination>
  </mat-dialog-content>
  <mat-dialog-actions align="end">
    <button type="button" mat-button [mat-dialog-close]
      class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10">
      ย้อนกลับ
    </button>
  </mat-dialog-actions>
</ng-template>

<!-- <div class="page px-rem">
  <div class="overflow-auto table-bordered rounded-top-0.65rem">
    <table class="ti-custom-table ti-custom-table-head ti-custom-table-hover">
      <thead class="height-50px">
        <tr class="font-size-12px">
          <ng-container
            *ngFor="let item of ['','รหัส','รายละเอียด','รอบปีการประเมิน','วันที่เริ่มต้น','วันที่สิ้นสุด','สถานะ','การจัดการ']; let f = first; let l = last">
            <th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary" [class.!text-center]="f||l">
              <span class="font-size-12px font-weight-700">{{ item }}</span>
              <div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!f&&!l">
                <i class="ti ti-dots-vertical fs-l"></i>
              </div>
            </th>
          </ng-container>
        </tr>
      </thead>
      <tbody *ngIf="dataLoading">
        <tr>
          <td class="text-center" colspan="100%">
            <div *ngFor="let item of [1,2,3]" class="ti-spinner w-8 h-8 text-secondary mx-1" role="status"
              aria-label="loading">
              <span class="sr-only">Loading...</span>
            </div>
          </td>
        </tr>
      </tbody>
      <tbody *ngIf="!dataLoading&&!pmsMasfromEvaluationCycleFilter().length">
        <tr>
          <td class="text-center" colspan="100%">
            ไม่พบข้อมูล
          </td>
        </tr>
      </tbody>
      <tbody *ngIf="!dataLoading&&pmsMasfromEvaluationCycleFilter().length">
        <tr
          *ngFor="let item of pmsMasfromEvaluationCycleFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index">
          <td class="text-center">
            <input type="checkbox" class="ti-form-checkbox cursor-pointer"
              id="checkbox-{{item.data.pmsEvaluationRoundId}}" [(ngModel)]="item.check"
              (ngModelChange)="dataListCheck()">
          </td>
          <td>
            <label for="checkbox-{{item.data.pmsEvaluationRoundId}}">&nbsp;{{item.data.pmsEvaluationRoundId}}</label>
          </td>
          <td>{{item.data.tdesc}}</td>
          <td>{{item.data.apsyear}}</td>
          <td>{{item.data.apsPeriodStart}}</td>
          <td>{{item.data.apsPeriodEnd}}</td>
          <td>
            <span class="flex justify-center items-center rounded-full h-5 w-5 text-white"
              [ngClass]="{'bg-success':item.data.statusCode.code=='0','bg-warning':item.data.statusCode.code=='1','bg-gray-400':item.data.statusCode.code=='2'}">
              <ng-container [ngSwitch]="item.data.statusCode.code">
                <span class="hs-tooltip ti-main-tooltip flex items-center">
                  <i *ngSwitchCase="'0'" class="ti ti-clock hs-tooltip-toggle"></i>
                  <span
                    class="hs-tooltip-content ti-main-tooltip-content py-1 px-2 bg-primary text-white shadow-sm dark:bg-slate-700"
                    role="tooltip">
                    {{item.data.statusCode.tdesc}}
                  </span>
                </span>
                <span class="hs-tooltip ti-main-tooltip flex items-center">
                  <i *ngSwitchCase="'1'" class="ti ti-hourglass-empty hs-tooltip-toggle"></i>
                  <span
                    class="hs-tooltip-content ti-main-tooltip-content py-1 px-2 bg-primary text-white shadow-sm dark:bg-slate-700"
                    role="tooltip">
                    {{item.data.statusCode.tdesc}}
                  </span>
                </span>
                <span class="hs-tooltip ti-main-tooltip flex items-center">
                  <i *ngSwitchCase="'2'" class="ti ti-check hs-tooltip-toggle"></i>
                  <span
                    class="hs-tooltip-content ti-main-tooltip-content py-1 px-2 bg-primary text-white shadow-sm dark:bg-slate-700"
                    role="tooltip">
                    {{item.data.statusCode.tdesc}}
                  </span>
                </span>
                <span *ngSwitchDefault></span>
              </ng-container>
            </span>
          </td>
          <td class="flex justify-center items-center">
            <i class="ti ti-edit cursor-pointer i-gray fs-l px-1" 
              (click)="modalStatus='edit';modalStatusEdit=(item.data.statusFrom.code == '0'?true:false);setData(item.data)"
              data-hs-overlay="#management-evaluation-cycle-page-modal"></i>

            <i class="ti ti-user cursor-pointer i-gray fs-l px-1" data-hs-overlay="#evaluation-cycle-person-modal" *ngIf="item.data.statusFrom.code =='1'"
              (click)="openModal('evaluation-cycle-person-modal',item.data.pmsEvaluationRoundId)"></i>
            <span class="badge text-white m-1 cursor-pointer"
              data-hs-overlay="#management-evaluation-cycle-page-alert-modal"
              (click)="modalStatus='createForm';setData(item.data)" *ngIf="item.data.statusFrom.code == '0'" [ngClass]="{
              'bg-secondary': item.data.statusFrom.code == '0',
              'text-white': item.data.statusFrom.code == '0'
            }">
              สร้างแบบฟอร์ม
            </span>

            <span class="badge text-white m-1" *ngIf="item.data.statusFrom.code == '1'" [ngClass]="{
                'bg-primary': item.data.statusFrom.code == '1',
                'text-white': item.data.statusFrom.code == '1'
              }">
              ปิดรอบประเมิน
            </span>
            <span class="badge text-white m-1" *ngIf="item.data.statusFrom.code == '2'" [ngClass]="{
                'bg-gray-400': item.data.statusFrom.code == '2',
                'text-white': item.data.statusFrom.code == '2'
              }">
              ปิดรอบประเมิน
            </span>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
  <nav class="pagination-style-3 overflow-auto my-5" *ngIf="page.length">
    <ul class="ti-pagination">
      <li>
        <a aria-label="anchor" class="page-link" href="javascript:void(0);"
          (click)="currentPage = (currentPage-1 || 1)">
          <i class="ri-arrow-left-s-line align-middle rtl:rotate-180"></i>
        </a>
      </li>
      <li *ngFor="let item of page;let f = first;let l = last">
        <ng-container *ngIf="item==3&&currentPage!=1&&currentPage!=2&&currentPage!=3">
          <a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i>
          </a>
        </ng-container>
        <ng-container *ngIf="(f||l)||(item==currentPage-1||item==currentPage||item==currentPage+1)">
          <a class="page-link" href="javascript:void(0);" [class.active]="item==currentPage"
            (click)="currentPage=item">{{item}}
          </a>
        </ng-container>
        <ng-container
          *ngIf="item==page.length-2&&currentPage!=page.length&&currentPage!=page.length-1&&currentPage!=page.length-2">
          <a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i>
          </a>
        </ng-container>
      </li>
      <li>
        <a aria-label="anchor" class="page-link" href="javascript:void(0);"
          (click)="currentPage = (currentPage > page.length-1 ? currentPage: currentPage+1 )">
          <i class="ri-arrow-right-s-line align-middle rtl:rotate-180"></i>
        </a>
      </li>
    </ul>
    <ul class="nav-tabs mt-3">
      <span>Show {{((currentPage-1) * 10)+1}} to {{pmsMasfromEvaluationCycleFilter().length<10
          ?pmsMasfromEvaluationCycleFilter().length: (currentPage==page.length ? ((currentPage * 10) - ((currentPage *
          10) - pmsMasfromEvaluationCycleFilter().length) ) :(currentPage * 10) ) }} of
          {{pmsMasfromEvaluationCycleFilter().length}} items</span>
    </ul>
  </nav>
</div> -->

<!-- <div id="management-evaluation-cycle-page-modal" class="hs-overlay hidden ti-modal">
  <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)]">
    <div class="max-h-full overflow-hidden ti-modal-content">
      <div class="ti-modal-header">
        <h3 class="text-xxl font-bold text-primary">
          {{modalStatus=='add'?'เพิ่มรอบการประเมิน':'แก้ไขรอบการประเมิน'}}
        </h3>
        <div class="flex justify-end">
          <button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
            data-hs-overlay="#management-evaluation-cycle-page-modal">
            <span class="sr-only">Close</span>
            <i class="ti ti-circle-x fs-xxl"></i>
          </button>
        </div>
      </div>
      <div class="w-full flex justify-end">
        <div class="absolute flex">
          <div class="px-1">
            <button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md" (click)="clear()">
              <svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00"
                xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#595BEA" stroke-width="3.84"
                transform="rotate(45)matrix(-1, 0, 0, 1, 0, 0)">
                <g id="SVGRepo_bgCarrier" stroke-width="0"></g>
                <g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
                <g id="SVGRepo_iconCarrier">
                  <path d="M15 49A24 24 0 0 1 32 8"></path>
                  <path d="M49 15a24 24 0 0 1-17 41"></path>
                  <polyline points="15.03 40 15.03 48.97 8 48.97"></polyline>
                  <polyline points="48.97 24 48.97 15.03 56 15.03"></polyline>
                </g>
              </svg>
              Clear
            </button>
          </div>
        </div>
      </div>
      <div class="ti-modal-body padding-16px pt-0 overflow-y-0">
        <label for="input-label" class="ti-form-label mt-2rem">รหัสรอบการประเมิน<span
            class="text-danger">*<ng-container *ngIf="modalStatus=='add'&&checkPrimary()">
              รหัสรอบการประเมินซ้ำ
          </ng-container></span></label>
        <input type="text" id="input-label" class="ti-form-input w-1/2"
          [ngClass]="{'bg-input-readonly':modalStatus =='edit'}" [readonly]="modalStatus =='edit'"
          [(ngModel)]="pmsMasfromEvaluation.pmsEvaluationRoundId">

        <label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)<span
            class="text-danger">*</span></label>
        <input type="text" id="detail_th" class="ti-form-input h-16" [ngClass]="{'!bg-input-readonly': modalStatus == 'edit'}"  [(ngModel)]="pmsMasfromEvaluation.tdesc" [readonly]="modalStatus =='edit'"> 

        <label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียด (อังกฤษ)</label>
        <input type="text" id="detail_eng" class="ti-form-input h-16" [ngClass]="{'!bg-input-readonly': modalStatus == 'edit'}"  [(ngModel)]="pmsMasfromEvaluation.edesc" [readonly]="modalStatus =='edit'">

        <label for="input-label" class="ti-form-label mt-2rem">ปีการประเมิน<span class="text-danger">*</span></label>
        <select class="ti-form-select" [(ngModel)]="pmsMasfromEvaluation.apsyear"     [ngClass]="{'!bg-input-readonly': modalStatus == 'edit'}" [disabled]="!modalStatusEdit">
          <option *ngFor="let item of yearList" [ngValue]="item">{{ item }}</option>
        </select>
        <label for="input-label" class="ti-form-label mt-2rem">เริ่มวันที่<span class="text-danger">*</span></label>
        <input type="date" id="input-label" class="ti-form-input w-1/2"
          [(ngModel)]="pmsMasfromEvaluation.apsPeriodStart" [ngClass]="{'!bg-input-readonly': modalStatus == 'edit'}" [readonly]="modalStatus =='edit'">

        <label for="input-label" class="ti-form-label mt-2rem">สิ้นสุดวันที่<span class="text-danger">*</span></label>
        <input type="date" id="input-label" class="ti-form-input w-1/2" [(ngModel)]="pmsMasfromEvaluation.apsPeriodEnd" [ngClass]="{'!bg-input-readonly': modalStatus == 'edit'}" [readonly]="modalStatus =='edit'">

        <label for="input-label" class="ti-form-label mt-2rem">ลักษณะงาน (JD)</label>
        <div *ngFor="let item of pmsMasfromEvaluation.personalLevel;let i = index;let f=first;let l = last"
          class="grid grid-cols-2">
          <div class="col-span-1">
            <div class="flex relative">
              <input type="text" class="ti-form-input pointer-events-none" readonly
                [ngClass]="{'input-list-f1': f&&!l, 'input-list-c1': !f&&!l, 'input-list-l1': !f&&l, 'input-list-fl1': f&&l,'bg-input-readonly':!modalStatusEdit}"
                [(ngModel)]="item.plId">
              <div
                [ngClass]="{'input-list-line-f': f&&!l, 'input-list-line-c': !f&&!l, 'input-list-line-l': !f&&l, 'input-list-line-fl': f&&l,'bg-input-readonly':!modalStatusEdit}">
                <div class="input-list-line"></div>
              </div>
              <input type="text" class="ti-form-input pointer-events-none" readonly
                [ngClass]="{'input-list-f2': f&&!l, 'input-list-c2': !f&&!l, 'input-list-l2': !f&&l, 'input-list-fl2': f&&l,'bg-input-readonly':!modalStatusEdit}"
                [(ngModel)]="item.tdesc">
              <div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
                <button *ngIf="item.plId&&modalStatusEdit" type="button" class="flex items-center text-red-500"
                  (click)="pl.selectIndex=i;selectPl()">
                  <i class="ti ti-circle-x cursor-pointer"></i>
                </button>
              </div>
            </div>
          </div>
          <div class="col-span-1 ml-1" *ngIf="f&&modalStatusEdit">
            <ng-component *ngTemplateOutlet="plSearchButton"></ng-component>
          </div>
        </div>
        <div class="grid grid-cols-2" *ngIf="!pmsMasfromEvaluation.personalLevel.length">
          <div class="col-span-1">
            <div class="flex relative">
              <input type="text" class="ti-form-input input-list-fl1 pointer-events-none" readonly>
              <div class="input-list-line-fl">
                <div class="input-list-line"></div>
              </div>
              <input type="text" class="ti-form-input input-list-fl2 pointer-events-none" readonly>
            </div>
          </div>
          <div class="col-span-1 ml-1">
            <ng-component *ngTemplateOutlet="plSearchButton"></ng-component>
          </div>
        </div>
        <ng-template #plSearchButton>
          <button type="button"
            class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary !m-0 h-full"
            style="height: 44.8px !important;" (click)="modal.search='';searchModalChange(plListFilter())"
            data-hs-overlay="#management-evaluation-cycle-pl-table-modal">
            <i class="ri-search-line cursor-pointer text-gray"></i>
          </button>
        </ng-template>
        <span class="text-danger mt-1">**หมายเหตุ ถ้าไม่เลือกระดับ JD ระบบจะทำการเลือกทั้งหมด</span>
        
        <div class="flex justify-end mt-2rem mb-1rem">
          <button type="button"
            class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
            data-hs-overlay="#management-evaluation-cycle-page-modal">
            ย้อนกลับ
          </button>
          <button type="button" class="ti-btn ti-btn-success"
            data-hs-overlay="#management-evaluation-cycle-page-alert-modal" *ngIf="modalStatusEdit"
            [class.ti-btn-disabled]="!pmsMasfromEvaluation.pmsEvaluationRoundId||!pmsMasfromEvaluation.tdesc||!pmsMasfromEvaluation.apsyear||!pmsMasfromEvaluation.apsPeriodStart||!pmsMasfromEvaluation.apsPeriodEnd||(modalStatus=='add'&&checkPrimary())"
            [disabled]="!pmsMasfromEvaluation.pmsEvaluationRoundId||!pmsMasfromEvaluation.tdesc||!pmsMasfromEvaluation.apsyear||!pmsMasfromEvaluation.apsPeriodStart||!pmsMasfromEvaluation.apsPeriodEnd||(modalStatus=='add'&&checkPrimary())">
            บันทึกข้อมูล
          </button>
        </div>
      </div>
    </div>
  </div>
</div> -->

<!-- <div id="management-evaluation-cycle-page-alert-modal" class="hs-overlay hidden ti-modal">
  <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] flex items-center">
    <div class="max-h-full overflow-hidden ti-modal-content w-full">
      <div class="ti-modal-header">
        <h3 class="text-xxl font-bold text-primary">
          แจ้งเตือน
        </h3>
        <div class="flex justify-end">
          <ng-container *ngIf="modalStatus=='add'||modalStatus =='edit'">
            <button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
              data-hs-overlay="#management-evaluation-cycle-page-modal">
              <span class="sr-only">Close</span>
              <i class="ti ti-circle-x fs-xxl"></i>
            </button>
          </ng-container>
          <ng-container *ngIf="modalStatus=='delete'||modalStatus=='deleteGroup'">
            <button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
              data-hs-overlay="#management-evaluation-cycle-page-alert-modal">
              <span class="sr-only">Close</span>
              <i class="ti ti-circle-x fs-xxl"></i>
            </button>
          </ng-container>
        </div>
      </div>
      <div class="ti-modal-body ">
        <p class="mt-1 text-gray-800 dark:text-white/70">
          <ng-container *ngIf="modalStatus=='add'||modalStatus =='edit'">
            ยืนยันการบันทึกข้อมูลหรือไม่
          </ng-container>
          <ng-container *ngIf="modalStatus=='delete'||modalStatus=='deleteGroup'">
            <ng-container *ngIf="numDataListChecked">
                            ยืนยันการลบข้อมูลหรือไม่
                        </ng-container>
                        <ng-container *ngIf="!numDataListChecked">
                            เลือกข้อมูลที่ต้องการลบ
                        </ng-container>
          </ng-container>
          <ng-container *ngIf="modalStatus=='createForm'">
            คุณต้องการสร้างแบบฟอร์มการประเมินใหม่หรือไม่
          </ng-container>
        </p>

        <div class="flex justify-end mt-2rem mb-1rem">
          <ng-container *ngIf="modalStatus=='add'||modalStatus =='edit'">
            <button type="button"
              class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
              data-hs-overlay="#management-evaluation-cycle-page-modal">
              ย้อนกลับ
            </button>
            <a class="ti-btn ti-btn-success" href="javascript:void(0);"
              data-hs-overlay="#management-evaluation-cycle-page-alert-modal" (click)="addPmsMasfromEvaluation()">
              บันทึกข้อมูล
            </a>
          </ng-container>
          <ng-container *ngIf="modalStatus=='delete'||modalStatus=='deleteGroup'">
            <button type="button"
              class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
              data-hs-overlay="#management-evaluation-cycle-page-alert-modal">
              ย้อนกลับ
            </button>
            <a class="ti-btn ti-btn-danger" href="javascript:void(0);"  *ngIf="numDataListChecked"
              data-hs-overlay="#management-evaluation-cycle-page-alert-modal" (click)="deletePmsMasfromEvaluation()">
              ลบข้อมูล
            </a>
          </ng-container>
          <ng-container *ngIf="modalStatus=='createForm'">
            <button type="button"
              class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
              data-hs-overlay="#management-evaluation-cycle-page-alert-modal">
              ย้อนกลับ
            </button>
            <a class="ti-btn ti-btn-success" href="javascript:void(0);"
              data-hs-overlay="#management-evaluation-cycle-page-alert-modal" (click)="createForm()">
              ยืนยัน
            </a>
          </ng-container>
        </div>
      </div>
    </div>
  </div>
</div> -->

<!-- <div id="management-evaluation-cycle-pl-table-modal" class="hs-overlay hidden ti-modal">
  <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out lg:!max-w-4xl lg:w-full m-3 lg:!mx-auto">
    <div class="max-h-full overflow-hidden ti-modal-content">
      <div class="ti-modal-header">
        <h3 class="text-xxl font-bold text-primary">
          ข้อมูลลักษณะงาน (JD)
        </h3>
        <div class="flex justify-end">
          <button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
            data-hs-overlay="#management-evaluation-cycle-page-modal">
            <span class="sr-only">Close</span>
            <i class="ti ti-circle-x fs-xxl"></i>
          </button>
        </div>
      </div>
      <div class="ti-modal-body">
        <div class="flex justify-end pb-1rem">
          <div class="px-1">
            <div class="relative shadow-md">
              <input type="text" class="ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
                [placeholder]="'SearchByNoOrName' | translate" [(ngModel)]="modal.search"
                (ngModelChange)="searchModalChange(plListFilter())">
              <div
                class="absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4">
                <i class="ri-search-line text-gray"></i>
              </div>
            </div>
          </div>
        </div>
        <div class="overflow-auto border">
          <table class="ti-custom-table ti-custom-table-head ti-custom-table-hover">
            <thead>
              <tr>
                <ng-container
                  *ngFor="let item of ['ลำดับ','รหัสลักษณะงาน (JD)','รายละเอียดฝ่าย(ไทย)','รายละเอียดฝ่าย(อังกฤษ)']; let f = first; let l = last">
                  <th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
                    [class.!text-center]="f">
                    <span class="text-sm">{{ item }}</span>
                    <div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l">
                      <i class="ti ti-dots-vertical fs-l"></i>
                    </div>
                  </th>
                </ng-container>
              </tr>
            </thead>
            <tbody *ngIf="pl.loading">
              <tr>
                <td class="text-center" colspan="100%">
                  <div *ngFor="let item of [1,2,3]" class="ti-spinner w-8 h-8 text-secondary mx-1" role="status"
                    aria-label="loading">
                    <span class="sr-only">Loading...</span>
                  </div>
                </td>
              </tr>
            </tbody>
            <tbody *ngIf="!pl.loading&&!plListFilter().length">
              <tr>
                <td class="text-center" colspan="100%">
                  ไม่พบข้อมูล
                </td>
              </tr>
            </tbody>
            <tbody *ngIf="!pl.loading&&plListFilter().length">
              <tr
                *ngFor="let item of plListFilter() | slice:((modal.currentPage-1) * 10) : (((modal.currentPage-1) * 10) + 10);let i = index"
                class="cursor-pointer" data-hs-overlay="#management-evaluation-cycle-page-modal"
                (click)="selectPl(item)">
                <td class="flex justify-center">
                  {{((modal.currentPage-1) * 10)+(i+1)}}
                </td>
                <td>{{item.plId}}</td>
                <td>{{item.tdesc}}</td>
                <td>{{item.edesc}}</td>
              </tr>
            </tbody>
          </table>
        </div>
        <nav class="pagination-style-3 my-5" *ngIf="modal.page.length">
          <ul class="ti-pagination">
            <li>
              <a aria-label="anchor" class="page-link" href="javascript:void(0);"
                (click)="modal.currentPage = (modal.currentPage-1 || 1)">
                <i class="ri-arrow-left-s-line align-middle rtl:rotate-180"></i>
              </a>
            </li>
            <li *ngFor="let item of modal.page;let f = first;let l = last">
              <ng-container *ngIf="item==3&&modal.currentPage!=1&&modal.currentPage!=2&&modal.currentPage!=3">
                <a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i>
                </a>
              </ng-container>
              <ng-container
                *ngIf="(f||l)||(item==modal.currentPage-1||item==modal.currentPage||item==modal.currentPage+1)">
                <a class="page-link" href="javascript:void(0);" [class.active]="item==modal.currentPage"
                  (click)="modal.currentPage=item">{{item}}
                </a>
              </ng-container>
              <ng-container
                *ngIf="item==modal.page.length-2&&modal.currentPage!=modal.page.length&&modal.currentPage!=modal.page.length-1&&modal.currentPage!=modal.page.length-2">
                <a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i>
                </a>
              </ng-container>
            </li>
            <li>
              <a aria-label="anchor" class="page-link" href="javascript:void(0);"
                (click)="modal.currentPage = (modal.currentPage > modal.page.length-1 ? modal.currentPage: modal.currentPage+1 )">
                <i class="ri-arrow-right-s-line align-middle rtl:rotate-180"></i>
              </a>
            </li>
          </ul>
          <ul class="nav-tabs mt-3">
            <span>Show {{((modal.currentPage-1) * 10)+1}} to {{plListFilter().length<10 ?plListFilter().length:
                (modal.currentPage==modal.page.length ? ((modal.currentPage * 10) - ((modal.currentPage * 10) -
                plListFilter().length) ) :(modal.currentPage * 10) ) }} of {{plListFilter().length}} items</span>
          </ul>
        </nav>
        <div class="flex justify-end mt-2rem mb-1rem space-x-4">
          <button type="button"
            class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
            data-hs-overlay="#management-evaluation-cycle-page-modal">
            ย้อนกลับ
          </button>
        </div>
      </div>
    </div>
  </div>
</div> -->