
<div class="body-content">
    <div class="page">
        <div class="border-b  border-gray-200 dark:border-white/10">
            <div class="grid grid-cols-2 gap-6">
                <div class="col-span-1">
                    <label for="hs-trailing-button-add-on-with-icon" class="ti-form-label">รอบการประเมิน</label>
                </div>
                <div class="col-span-1">
                    <label for="hs-trailing-button-add-on-with-icon" class="ti-form-label">ปีการประเมิน</label>
                </div>
            </div>
            <div class="grid grid-cols-2 gap-6 mb-5">
                <div class="col-span-1">
                    <input type="text" id="input-label" class="ti-form-input w-full pr-10 bg-input-readonly" readonly [value]="evaluationRound.tdesc || ''">
                </div>
                <div class="col-span-1">
                    <input type="text" id="input-label" class="ti-form-input w-full pr-10 bg-input-readonly" readonly [value]="evaluationRound.apsyear || ''">
                </div>
            </div>
        </div>
    </div>
</div>

<div class="header-title-type">
        <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="Search"  [(ngModel)]="search" (ngModelChange)="searchChange()"
                        style="height: 40px;">
                    <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>


<div class="page px-rem">
    <div class="overflow-auto table-bordered rounded-t-md">
        <div id="card-type-1" role="tabpanel" aria-labelledby="card-type-item-1">
            <div class="overflow-auto shadow-md">
                <table class="ti-custom-table ti-custom-table-head ti-custom-table-hover">
                    <thead>
                        <tr>
                            <ng-container
                                *ngFor="let item of ['รหัสแบบฟอร์ม','ชื่อพนักงาน','ตำแหน่ง','ลักษณะงาน','การจัดการ']; let f = first; let l = last; let i = index">
                                <th scope="col"
                                    class="relative px-10px py-10px bg-soft-secondary text-primary !text-center">
                                    <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="loadingAssessmentList">
                        <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="!loadingAssessmentList&&!assessmentListFilter().length">
                        <tr>
                          <td class="text-center" colspan="100%">
                            ไม่พบข้อมูล
                          </td>
                        </tr>
                      </tbody>
                    <tbody *ngIf="!loadingAssessmentList&&assessmentListFilter().length > 0">
                        <tr
                            *ngFor="let item of assessmentListFilter() | slice:((currentPage-1) * this.pageSize) : (((currentPage-1) * this.pageSize) + this.pageSize);let i = index">
                            <td class="flex justify-center items-center">
                                {{item.masfromEvaluationRound.evaluationRoundId}}</td>
                            <td>{{item.apsassessy.fname}} {{item.apsassessy.lname}}</td>
                            <td class="text-center">{{item.apsassessy.position.tdesc}}</td>
                            <td class="text-center">{{item.jd.tdesc}}</td>
                            <td class="flex justify-center items-center space-x-2">
                                <i class="ti ti-edit cursor-pointer i-gray fs-xl px-1" *ngIf="item.active"  (click)="openAddRoundModel(item.masfromEvaluationRound.evaluationRoundId,item.apsassessy.employeeId,item,'form-pm-emp')"  ></i>
                                <input type="checkbox" id="hs-small-switch{{i+1}}"  [(ngModel)]="item.active" (ngModelChange)="saveAssessmentOne(item)" 
                                    class="ti-switch checked:bg-none checked:bg-green-600 checked:hover:bg-green-600 checked:focus:bg-green-600 focus:border-green-600 dark:checked:bg-green-600 checked:before:bg-green-200 dark:checked:before:bg-green-200 shrink-0 w-11 h-6 before:w-5 before:h-5">
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </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>
          <li>
            <select class="ti-form-select"  [(ngModel)]="pageSize" (ngModelChange)="searchChange()">
                <option [value]="10">10</option>
                <option [value]="20">20</option>
                <option [value]="50">50</option>
                <option [value]="100">100</option>
              </select>
          </li>
        </ul>
        <ul class="nav-tabs mt-3">
          <span>Show {{((currentPage-1) * pageSize)+1}} to {{(assessmentListFilter().length < pageSize) ?assessmentListFilter().length:
              (currentPage==page.length ? ((currentPage * pageSize) - ((currentPage * pageSize) - assessmentListFilter().length) )
              :(currentPage * pageSize) ) }} of {{assessmentListFilter().length}} items</span>
        </ul>
      </nav>
</div>




<ng-template #evaluationFormEmpModal let-modal>
    <h3 mat-dialog-title>
        แก้ไขรายการสมรรถนะ
    </h3>
    <mat-dialog-content >
        <div class="body-content">
            <div class="page">
                <div class="py-2 border-b-2 border-collapse ">
                    <div class="grid grid-cols-2 gap-6">
                        <div class="col-span-1">
                            <label for="hs-trailing-button-add-on-with-icon" class="ti-form-label">รหัสแบบฟอร์ม</label>
                        </div>
                        <div class="col-span-1">
                            <label for="hs-trailing-button-add-on-with-icon" class="ti-form-label">ชื่อพนักงาน</label>
                        </div>
                    </div>
                    <div class="grid grid-cols-2 gap-6">
                        <div class="col-span-1">
                            <input type="text" id="input-label"
                                class="py-2 px-3  ltr:pr-11 rtl:pl-11 ti-form-input rounded-md ltr:rounded-r-md rtl:rounded-l-md focus:z-10 bg-input-readonly"
                                readonly value="{{selectEmp.masfromEvaluationRound.evaluationRoundId}}">
                        </div>
                        <div class="col-span-1">
                            <input type="text" id="input-label"
                                class="py-2 px-3  ltr:pr-11 rtl:pl-11 ti-form-input rounded-md ltr:rounded-r-md rtl:rounded-l-md focus:z-10 bg-input-readonly"
                                readonly value="{{selectEmp.apsassessy.fname}} {{selectEmp.apsassessy.lname}}">
                        </div>
                    </div>
                </div>
            </div>
        </div>
            <div class="header-title-type">
                <div class="flex justify-between">
                    <div class="flex">
                        <!-- Content ของ div แรก -->
                        <div class="flex gap-x-6">
                            <div class="flex items-center">
                                <input type="checkbox" class="ti-form-checkbox mt-0.5" id="hs-checkbox-group-1" disabled [(ngModel)]="isChecked">
                                <label for="hs-checkbox-group-1"
                                    class="text-sm text-gray-500 ltr:ml-2 rtl:mr-2 dark:text-white/70">{{numDataListChecked}}
                                    Selected</label>
                            </div>

                            <div class="flex items-center">
                                <i (click)="toggleCheckbox()"
                                    [ngClass]="{'ri-checkbox-multiple-line': !isChecked, 'ri-checkbox-multiple-fill': isChecked}"
                                    class="ri-checkbox-multiple-line text-gray-500 dark:text-white/70"></i>
                                <label for="hs-checkbox-group-2"
                                    class="text-sm text-gray-500 ltr:ml-2 rtl:mr-2 dark:text-white/70"
                                    (click)="toggleCheckbox()">Select All</label>
                            </div>
                        </div>
                    </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="Search" style="height: 40px;" [(ngModel)]="searchRound" (ngModelChange)="searchChange()">
                                <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" (click)="searchIndicatorsChange();openModalIndicators();">
                                <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" (click)="deleteAssessmentList()">
                                <i class="ri-delete-bin-6-line"></i>
                                Delete
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        <div class="page px-rem">
            <div class="overflow-auto table-bordered rounded-t-md">
                <div id="card-type-1" role="tabpanel" aria-labelledby="card-type-item-1">
                    <div class="overflow-auto shadow-md">
                        <table class="ti-custom-table ti-custom-table-head ti-custom-table-hover">
                            <thead>
                                <tr>
                                    <ng-container
                                        *ngFor="let item of ['','รหัสสมรรถนะ','ชื่อสมรรถนะ','ระดับความหวัง','การจัดการ']; let f = first; let l = last; let i = index">
                                        <th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
                                            [class.!text-center]="f || l || item === 'ระดับความหวัง'">
                                            <span class="text-sm">{{ item }}</span>
                                        </th>
                                    </ng-container>
                                </tr>
                            </thead>
                            <tbody *ngIf="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="!loading&&!empassessmentListFilter().length">
                                <tr>
                                  <td class="text-center" colspan="100%">
                                    ไม่พบข้อมูล
                                  </td>
                                </tr>
                              </tbody>
                            <tbody *ngIf="!loading&&empassessmentListFilter().length > 0">
                                <tr  *ngFor="let item of empassessmentListFilter() | slice:((currentPageRound-1) * pageSizeRound) : (((currentPageRound-1) * pageSizeRound) + pageSizeRound);let i = index">
                                    <td class="text-center">
                                        <input type="checkbox" class="ti-form-checkbox cursor-pointer"
                                            id="checkbox-{{item.item.groupAssessment1.competencyIndicatorsCourses1Mini.competencyIndicatorsCourses0.competencyTopic.competencyTopicId}}" [(ngModel)]="item.checkbox" (change)="checkempassessmentRoundListCheckbox()">
                                    </td>
                                    <td>
                                        <label
                                            for="checkbox-{{item.item.groupAssessment1.competencyIndicatorsCourses1Mini.competencyIndicatorsCourses0.competencyTopic.competencyTopicId}}">{{item.item.groupAssessment1.competencyIndicatorsCourses1Mini.competencyIndicatorsCourses0.competencyTopic.competencyTopicId}}</label>
                                    </td>
                                    <td >{{item.item.groupAssessment1.competencyIndicatorsCourses1Mini.competencyIndicatorsCourses0.competencyTopic.tdesc}}</td>
                                    <td class="!text-center">{{item.item.groupAssessment1.competencyIndicatorsCourses1Mini.lineNo}}</td>
                                    <td class="flex justify-center">
                                        <i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="deleteFormOne(item.item);"></i>
                                    </td>

                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <nav class="pagination-style-3 overflow-auto my-5" *ngIf="pageRound.length">
                <ul class="ti-pagination">
                    <li>
                        <a aria-label="anchor" class="page-link" href="javascript:void(0);"
                            (click)="currentPageRound = (currentPageRound-1 || 1)">
                            <i class="ri-arrow-left-s-line align-middle rtl:rotate-180"></i>
                        </a>
                    </li>
                    <li *ngFor="let item of pageRound;let f = first;let l = last">
                        <ng-container *ngIf="item==3&&currentPageRound!=1&&currentPageRound!=2&&currentPageRound!=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==currentPageRound-1||item==currentPageRound||item==currentPageRound+1)">
                            <a class="page-link" href="javascript:void(0);" [class.active]="item==currentPageRound"
                                (click)="currentPageRound=item">{{item}}
                            </a>
                        </ng-container>
                        <ng-container
                            *ngIf="item==pageRound.length-2&&currentPageRound!=pageRound.length&&currentPageRound!=pageRound.length-1&&currentPageRound!=pageRound.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)="currentPageRound = (currentPageRound > pageRound.length-1 ? currentPageRound: currentPageRound+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 {{((currentPageRound-1) * pageSizeRound)+1}} to {{empassessmentListFilter().length< pageSizeRound
                            ?empassessmentListFilter().length: (currentPageRound==pageRound.length ? ((currentPageRound * pageSizeRound) - ((currentPageRound *
                            pageSizeRound) - empassessmentListFilter().length) ) :(currentPageRound * pageSizeRound) ) }} of {{empassessmentListFilter().length}}
                            items</span>
                </ul>
            </nav>
        </div>

    </mat-dialog-content>

    <mat-dialog-actions align="end">
        <button type="button"  mat-button [mat-dialog-close] cdkFocusInitial
        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>
    <button type="button" class="ti-btn ti-btn-success"  (click)="saveIndicators();">
        บันทึกข้อมูล
    </button>
    </mat-dialog-actions>
  </ng-template>


  <ng-template #IndicatorsEmpModal let-modal>
    <h3 mat-dialog-title>
        รายการสมรรถนะ
    </h3>
    <mat-dialog-content >
        <div class="ti-modal-body">
            <div class="header-title-type">
                <div class="flex justify-between">
                    <div class="flex">
                    </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="Search" style="height: 40px;"  [(ngModel)]="searchIndicator" (ngModelChange)="searchIndicatorsChange()">
                                <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>
            </div>
        <div class="page px-rem">
            <div class="overflow-auto table-bordered rounded-t-md">
                <div id="card-type-1" role="tabpanel" aria-labelledby="card-type-item-1">
                    <div class="overflow-auto shadow-md">
                        <table class="ti-custom-table ti-custom-table-head ti-custom-table-hover">
                            <thead>
                                <tr>
                                    <ng-container
                                        *ngFor="let item of ['รหัส','ชื่อประเภท','ความคาดหวัง','การจัดการ']; let f = first; let l = last; let i = index">
                                        <th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
                                            [class.!text-center]="f||l">
                                            <span class="text-sm">{{ item }}</span>
                                            <div class="absolute top-1/2 transform -translate-y-1/2 right-0"
                                                *ngIf="!f && i==1">
                                                <svg class="head-table-icon" xmlns="http://www.w3.org/2000/svg"
                                                    width="30" height="13" fill="currentColor" viewBox="0 0 16 16">
                                                    <path
                                                        d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z">
                                                    </path>
                                                </svg>
                                            </div>
                                            <div class="absolute top-1/2 transform -translate-y-1/2 right-0"
                                                *ngIf="!f && i==2">
                                                <svg class="head-table-icon" xmlns="http://www.w3.org/2000/svg"
                                                    width="30" height="13" fill="currentColor" viewBox="0 0 16 16">
                                                    <path
                                                        d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z">
                                                    </path>
                                                </svg>
                                            </div>
                                        </th>
                                    </ng-container>
                                </tr>
                            </thead>
                            <tbody *ngIf="!filterIndicators().length">
                                <tr>
                                  <td class="text-center" colspan="100%">
                                    ไม่พบข้อมูล
                                  </td>
                                </tr>
                              </tbody>
                            <tbody *ngIf="filterIndicators().length > 0">
                                <tr  *ngFor="let item of filterIndicators() | slice:((currentPageIndicator-1) * pageSizeIndicator) : (((currentPageIndicator-1) * pageSizeIndicator) + pageSizeIndicator);let i = index">
                                    <td>{{item.groupAssessment1.competencyIndicatorsCourses1Mini.competencyIndicatorsCourses0.competencyTopic.competencyTopicId}}</td>
                                    <td >{{item.groupAssessment1.competencyIndicatorsCourses1Mini.competencyIndicatorsCourses0.competencyTopic.tdesc}}</td>
                                    <td class="!text-center">{{item.groupAssessment1.competencyIndicatorsCourses1Mini.lineNo}}</td>
                                    <td class="flex justify-center">
                                        <div class="px-1">
                                            <button type="button" mat-dialog-close (click)="addIndicators(item)"
                                                class="ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md" >
                                                <i class="ri-add-line"></i>
                                                เพิ่มรายการ 
                                            </button>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <nav class="pagination-style-3 overflow-auto my-5" *ngIf="pageIndicator.length">
                <ul class="ti-pagination">
                    <li>
                        <a aria-label="anchor" class="page-link" href="javascript:void(0);"
                            (click)="currentPageIndicator = (currentPageIndicator-1 || 1)">
                            <i class="ri-arrow-left-s-line align-middle rtl:rotate-180"></i>
                        </a>
                    </li>
                    <li *ngFor="let item of pageIndicator;let f = first;let l = last">
                        <ng-container *ngIf="item==3&&currentPageIndicator!=1&&currentPageIndicator!=2&&currentPageIndicator!=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==currentPageIndicator-1||item==currentPageIndicator||item==currentPageIndicator+1)">
                            <a class="page-link" href="javascript:void(0);" [class.active]="item==currentPageIndicator"
                                (click)="currentPageIndicator=item">{{item}}
                            </a>
                        </ng-container>
                        <ng-container
                            *ngIf="item==pageIndicator.length-2&&currentPageIndicator!=pageIndicator.length&&currentPageIndicator!=pageIndicator.length-1&&currentPageIndicator!=pageIndicator.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)="currentPageIndicator = (currentPageIndicator > pageIndicator.length-1 ? currentPageIndicator: currentPageIndicator+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 {{((currentPageIndicator-1) * pageSizeIndicator)+1}} to {{filterIndicators().length< pageSizeIndicator
                            ?filterIndicators().length: (currentPageIndicator==pageIndicator.length ? ((currentPageIndicator * pageSizeIndicator) - ((currentPageIndicator *
                            pageSizeIndicator) - filterIndicators().length) ) :(currentPageIndicator * pageSizeIndicator) ) }} of {{filterIndicators().length}}
                            items</span>
                </ul>
            </nav>
        </div>
        </div>
    </mat-dialog-content>
    <mat-dialog-actions align="end">
        <button type="button"  mat-button [mat-dialog-close] cdkFocusInitial
        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  id="form-pm-emp" class="hs-overlay hidden ti-modal" >
    <div class="hs-overlay-open:mt-7 ti-modal-box ease-out lg:!max-w-4xl lg:w-full m-3 lg:!mx-auto mt-7">
        <div class="max-h-full overflow-hidden ti-modal-content !width-80 !box-modal" >
            <div class="ti-modal-header">
                <h3 class="text-xxl font-bold text-primary">
                    แก้ไขรายการสมรรถนะ
                </h3>
                <div class="flex justify-end">
                    <button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger" (click)="closeModalClass('form-pm-emp')">
                        <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="py-2 border-b-2 border-collapse ">
                    <div class="grid grid-cols-2 gap-6">
                        <div class="col-span-1">
                            <label for="hs-trailing-button-add-on-with-icon" class="ti-form-label">รหัสแบบฟอร์ม</label>
                        </div>
                        <div class="col-span-1">
                            <label for="hs-trailing-button-add-on-with-icon" class="ti-form-label">ชื่อพนักงาน</label>
                        </div>
                    </div>
                    <div class="grid grid-cols-2 gap-6">
                        <div class="col-span-1">
                            <input type="text" id="input-label"
                                class="py-2 px-3  ltr:pr-11 rtl:pl-11 ti-form-input rounded-md ltr:rounded-r-md rtl:rounded-l-md focus:z-10 bg-input-readonly"
                                readonly value="{{selectEmp.masfromEvaluationRound.evaluationRoundId}}">
                        </div>
                        <div class="col-span-1">
                            <input type="text" id="input-label"
                                class="py-2 px-3  ltr:pr-11 rtl:pl-11 ti-form-input rounded-md ltr:rounded-r-md rtl:rounded-l-md focus:z-10 bg-input-readonly"
                                readonly value="{{selectEmp.apsassessy.fname}} {{selectEmp.apsassessy.lname}}">
                        </div>
                    </div>
                </div>

                <div class="header-title-type">
                    <div class="flex justify-between">
                        <div class="flex">
                            <!-- Content ของ div แรก -->
                            <div class="flex gap-x-6">
                                <div class="flex items-center">
                                    <input type="checkbox" class="ti-form-checkbox mt-0.5" id="hs-checkbox-group-1" disabled [(ngModel)]="isChecked">
                                    <label for="hs-checkbox-group-1"
                                        class="text-sm text-gray-500 ltr:ml-2 rtl:mr-2 dark:text-white/70">{{numDataListChecked}}
                                        Selected</label>
                                </div>

                                <div class="flex items-center">
                                    <i (click)="toggleCheckbox()"
                                        [ngClass]="{'ri-checkbox-multiple-line': !isChecked, 'ri-checkbox-multiple-fill': isChecked}"
                                        class="ri-checkbox-multiple-line text-gray-500 dark:text-white/70"></i>
                                    <label for="hs-checkbox-group-2"
                                        class="text-sm text-gray-500 ltr:ml-2 rtl:mr-2 dark:text-white/70"
                                        (click)="toggleCheckbox()">Select All</label>
                                </div>
                            </div>
                        </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="Search" style="height: 40px;" [(ngModel)]="searchRound" (ngModelChange)="searchChange()">
                                    <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" (click)="openModalClass('form-assessment');searchIndicatorsChange()">
                                    <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" (click)="deleteAssessmentList()">
                                    <i class="ri-delete-bin-6-line"></i>
                                    Delete
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            <div class="page px-rem">
                <div class="overflow-auto table-bordered rounded-t-md">
                    <div id="card-type-1" role="tabpanel" aria-labelledby="card-type-item-1">
                        <div class="overflow-auto shadow-md">
                            <table class="ti-custom-table ti-custom-table-head ti-custom-table-hover">
                                <thead>
                                    <tr>
                                        <ng-container
                                            *ngFor="let item of ['','รหัสสมรรถนะ','ชื่อสมรรถนะ','ระดับความหวัง','การจัดการ']; let f = first; let l = last; let i = index">
                                            <th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
                                                [class.!text-center]="f || l || item === 'ระดับความหวัง'">
                                                <span class="text-sm">{{ item }}</span>
                                            </th>
                                        </ng-container>
                                    </tr>
                                </thead>
                                <tbody *ngIf="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="!loading&&!empassessmentListFilter().length">
                                    <tr>
                                      <td class="text-center" colspan="100%">
                                        ไม่พบข้อมูล
                                      </td>
                                    </tr>
                                  </tbody>
                                <tbody *ngIf="!loading&&empassessmentListFilter().length > 0">
                                    <tr  *ngFor="let item of empassessmentListFilter() | slice:((currentPageRound-1) * pageSizeRound) : (((currentPageRound-1) * pageSizeRound) + pageSizeRound);let i = index">
                                        <td class="text-center">
                                            <input type="checkbox" class="ti-form-checkbox cursor-pointer"
                                                id="checkbox-{{item.item.groupAssessment1.competencyIndicatorsCourses1Mini.competencyIndicatorsCourses0.competencyTopic.competencyTopicId}}" [(ngModel)]="item.checkbox" (change)="checkempassessmentRoundListCheckbox()">
                                        </td>
                                        <td>
                                            <label
                                                for="checkbox-{{item.item.groupAssessment1.competencyIndicatorsCourses1Mini.competencyIndicatorsCourses0.competencyTopic.competencyTopicId}}">{{item.item.groupAssessment1.competencyIndicatorsCourses1Mini.competencyIndicatorsCourses0.competencyTopic.competencyTopicId}}</label>
                                        </td>
                                        <td >{{item.item.groupAssessment1.competencyIndicatorsCourses1Mini.competencyIndicatorsCourses0.competencyTopic.tdesc}}</td>
                                        <td class="!text-center">{{item.item.groupAssessment1.competencyIndicatorsCourses1Mini.lineNo}}</td>
                                        <td class="flex justify-center">
                                            <i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="deleteFormOne(item.item);"></i>
                                        </td>

                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <nav class="pagination-style-3 overflow-auto my-5" *ngIf="pageRound.length">
                    <ul class="ti-pagination">
                        <li>
                            <a aria-label="anchor" class="page-link" href="javascript:void(0);"
                                (click)="currentPageRound = (currentPageRound-1 || 1)">
                                <i class="ri-arrow-left-s-line align-middle rtl:rotate-180"></i>
                            </a>
                        </li>
                        <li *ngFor="let item of pageRound;let f = first;let l = last">
                            <ng-container *ngIf="item==3&&currentPageRound!=1&&currentPageRound!=2&&currentPageRound!=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==currentPageRound-1||item==currentPageRound||item==currentPageRound+1)">
                                <a class="page-link" href="javascript:void(0);" [class.active]="item==currentPageRound"
                                    (click)="currentPageRound=item">{{item}}
                                </a>
                            </ng-container>
                            <ng-container
                                *ngIf="item==pageRound.length-2&&currentPageRound!=pageRound.length&&currentPageRound!=pageRound.length-1&&currentPageRound!=pageRound.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)="currentPageRound = (currentPageRound > pageRound.length-1 ? currentPageRound: currentPageRound+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 {{((currentPageRound-1) * pageSizeRound)+1}} to {{empassessmentListFilter().length< pageSizeRound
                                ?empassessmentListFilter().length: (currentPageRound==pageRound.length ? ((currentPageRound * pageSizeRound) - ((currentPageRound *
                                pageSizeRound) - empassessmentListFilter().length) ) :(currentPageRound * pageSizeRound) ) }} of {{empassessmentListFilter().length}}
                                items</span>
                    </ul>
                </nav>
            </div>
                <div class="ti-modal-footer">
                    <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"
                        (click)="closeModalClass('form-pm-emp')">
                        ย้อนกลับ
                    </button>
                    <button type="button" class="ti-btn ti-btn-success" (click)="openModalClass('modal-alert','addIndicator')">
                        บันทึกข้อมูล
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>

<div  id="form-assessment" class="hs-overlay hidden ti-modal" >
    <div class="hs-overlay-open:mt-7 ti-modal-box ease-out lg:!max-w-4xl lg:w-full m-3 lg:!mx-auto mt-7">
        <div class="max-h-full overflow-hidden ti-modal-content !width-80 !box-modal" >
            <div class="ti-modal-header">
                <h3 class="text-xxl font-bold text-primary">
                    รายการสมรรถนะ
                </h3>
                <div class="flex justify-end">
                    <button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger" (click)="closeModalClass('form-assessment')">
                        <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="header-title-type">
                    <div class="flex justify-between">
                        <div class="flex">
                        </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="Search" style="height: 40px;"  [(ngModel)]="searchIndicator" (ngModelChange)="searchIndicatorsChange()">
                                    <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>
                </div>
            <div class="page px-rem">
                <div class="overflow-auto table-bordered rounded-t-md">
                    <div id="card-type-1" role="tabpanel" aria-labelledby="card-type-item-1">
                        <div class="overflow-auto shadow-md">
                            <table class="ti-custom-table ti-custom-table-head ti-custom-table-hover">
                                <thead>
                                    <tr>
                                        <ng-container
                                            *ngFor="let item of ['รหัส','ชื่อประเภท','ความคาดหวัง','การจัดการ']; let f = first; let l = last; let i = index">
                                            <th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
                                                [class.!text-center]="f||l">
                                                <span class="text-sm">{{ item }}</span>
                                                <div class="absolute top-1/2 transform -translate-y-1/2 right-0"
                                                    *ngIf="!f && i==1">
                                                    <svg class="head-table-icon" xmlns="http://www.w3.org/2000/svg"
                                                        width="30" height="13" fill="currentColor" viewBox="0 0 16 16">
                                                        <path
                                                            d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z">
                                                        </path>
                                                    </svg>
                                                </div>
                                                <div class="absolute top-1/2 transform -translate-y-1/2 right-0"
                                                    *ngIf="!f && i==2">
                                                    <svg class="head-table-icon" xmlns="http://www.w3.org/2000/svg"
                                                        width="30" height="13" fill="currentColor" viewBox="0 0 16 16">
                                                        <path
                                                            d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z">
                                                        </path>
                                                    </svg>
                                                </div>
                                            </th>
                                        </ng-container>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr  *ngFor="let item of filterIndicators() | slice:((currentPageIndicator-1) * pageSizeIndicator) : (((currentPageIndicator-1) * pageSizeIndicator) + pageSizeIndicator);let i = index">
                                        <td>{{item.groupAssessment1.competencyIndicatorsCourses1Mini.competencyIndicatorsCourses0.competencyTopic.competencyTopicId}}</td>
                                        <td >{{item.groupAssessment1.competencyIndicatorsCourses1Mini.competencyIndicatorsCourses0.competencyTopic.tdesc}}</td>
                                        <td class="!text-center">{{item.groupAssessment1.competencyIndicatorsCourses1Mini.lineNo}}</td>
                                        <td class="flex justify-center">
                                            <div class="px-1">
                                                <button type="button" (click)="addIndicators(item)"
                                                    class="ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md" >
                                                    <i class="ri-add-line"></i>
                                                    เพิ่มรายการ 
                                                </button>
                                            </div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <nav class="pagination-style-3 overflow-auto my-5" *ngIf="pageIndicator.length">
                    <ul class="ti-pagination">
                        <li>
                            <a aria-label="anchor" class="page-link" href="javascript:void(0);"
                                (click)="currentPageIndicator = (currentPageIndicator-1 || 1)">
                                <i class="ri-arrow-left-s-line align-middle rtl:rotate-180"></i>
                            </a>
                        </li>
                        <li *ngFor="let item of pageIndicator;let f = first;let l = last">
                            <ng-container *ngIf="item==3&&currentPageIndicator!=1&&currentPageIndicator!=2&&currentPageIndicator!=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==currentPageIndicator-1||item==currentPageIndicator||item==currentPageIndicator+1)">
                                <a class="page-link" href="javascript:void(0);" [class.active]="item==currentPageIndicator"
                                    (click)="currentPageIndicator=item">{{item}}
                                </a>
                            </ng-container>
                            <ng-container
                                *ngIf="item==pageIndicator.length-2&&currentPageIndicator!=pageIndicator.length&&currentPageIndicator!=pageIndicator.length-1&&currentPageIndicator!=pageIndicator.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)="currentPageIndicator = (currentPageIndicator > pageIndicator.length-1 ? currentPageIndicator: currentPageIndicator+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 {{((currentPageIndicator-1) * pageSizeIndicator)+1}} to {{filterIndicators().length< pageSizeIndicator
                                ?filterIndicators().length: (currentPageIndicator==pageIndicator.length ? ((currentPageIndicator * pageSizeIndicator) - ((currentPageIndicator *
                                pageSizeIndicator) - filterIndicators().length) ) :(currentPageIndicator * pageSizeIndicator) ) }} of {{filterIndicators().length}}
                                items</span>
                    </ul>
                </nav>
            </div>
                <div class="ti-modal-footer">
                    <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"
                        (click)="closeModalClass('form-assessment')">
                        ย้อนกลับ
                    </button>
                 
                </div>
            </div>
        </div>
    </div>
</div>



<div id="modal-alert" 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 !box-modal">
            <div class="ti-modal-header">
                <h3 class="text-xxl font-bold text-primary">
                    แจ้งเตือน
                </h3>
                <div class="flex justify-end" >
                    <button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"   (click)="closeModalClass('modal-alert')"> 
                        <span class="sr-only" >Close</span>
                        <i class="ti ti-circle-x fs-xxl" ></i>
                    </button>
                </div>
            </div>
            <div class="ti-modal-body ">
                <p class="mt-1 text-gray-800 dark:text-white/70">
                    {{msg}}
                </p>

                <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"
                        (click)="closeModalClass('modal-alert')">
                        ย้อนกลับ
                    </button>
                    <button type="button" class="ti-btn ti-btn-success" *ngIf="typeForm=='addForm'" (click)="saveAssessmentList();closeModalClass('modal-alert')">
                        บันทึกข้อมูล
                    </button>
                    <button type="button" class="ti-btn ti-btn-success" *ngIf="typeForm=='addIndicator'" (click)="saveIndicators();closeModalClass('modal-alert')">
                        บันทึกข้อมูล
                    </button>
                    <button type="button" class="ti-btn ti-btn-success" *ngIf="typeForm=='deleteForm'|| typeForm=='deleteFormOne'" (click)="closeModalClass('modal-alert')">
                        บันทึกข้อมูล
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>
