<ng-container *ngIf="!typeTab">
    <div class="w-full min-height-50px mb-10px justify-between items-center">
        <div class="flex justify-between">
            <div class="flex">
                <div class="flex items-center">
                    <input type="checkbox" class="ti-form-checkbox pointer-events-none" id="hs-default-checkbox"
                        [(ngModel)]="isDataListChecked">
                    <label for="hs-default-checkbox" class="text-sm text-gray-500 mx-2 pointer-events-none">
                        {{numDataListChecked}} {{'Selected_ed' | translate}}</label>
                </div>
                <div class="mx-1 flex items-center">
                    <button (click)="isDataListCheckedAll = !isDataListCheckedAll;dataListCheckAll()" id="checkbox"
                        class="focus:ring-2 focus:ring-primary rounded-sm flex item-center">
                        <i class="fs-l transition-all duration-200"
                            [ngClass]="{'ri-checkbox-multiple-line text-gray-500': !isDataListCheckedAll, 'ri-checkbox-multiple-fill text-primary': isDataListCheckedAll}"></i>
                    </button>
                    <label class="text-sm text-gray-500 ml-2" for="checkbox">{{'SelectAll'| translate}}</label>
                </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]="'SearchByNoOrName' | translate" style="height: 40px;" [(ngModel)]="search"
                            (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-10 m-0 shadow-md"
                        (click)="selectData();pathTitleChange('add')">
                        <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-10 m-0 shadow-md"
                        data-hs-overlay="#grade-management-alert-delete-modal" (click)="selectData()">
                        <i class="ri-delete-bin-6-line"></i>
                        {{'Delete' | translate}}
                    </button>
                </div>
                <!-- <div class="px-1">
                    <button href="javascript:void(0);" class="ti-btn ti-btn-soft-warning h-10 m-0 shadow-md">
                        <i class="ti ti-book fs-l"></i>
                        Help
                    </button>
                </div> -->
            </div>
        </div>
    </div>
    <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 ['','Code','DescriptionJobTypeThai','DescriptionJobTypeEng','Action']; let f = first; let l = last">
                            <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 | translate}}</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="!dataListFilter().length">
                    <tr>
                        <td class="text-center" colspan="100%">
                            ไม่พบข้อมูล
                        </td>
                    </tr>
                </tbody>
                <tbody *ngIf="dataListFilter().length">
                    <tr
                        *ngFor="let item of dataListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index">
                        <td class="text-center">
                            <input type="checkbox" class="ti-form-checkbox cursor-pointer" [(ngModel)]="item.check"
                                (ngModelChange)="dataListCheck()" id="checkbox-{{item.code}}">
                        </td>
                        <td class="text-center">
                            <label for="checkbox-{{item.code}}">&nbsp;{{item.code}}</label>
                        </td>
                        <td>{{item.tdesc}}</td>
                        <td>{{item.edesc}}</td>
                        <td class="flex justify-center">
                            <i class="ti ti-edit cursor-pointer i-gray fs-l px-1"
                                (click)="selectData(item);pathTitleChange('edit')"></i>
                            <!-- <i class="ti ti-trash cursor-pointer i-gray fs-l px-1"
                                data-hs-overlay="#grade-management-alert-delete-modal" (click)="selectData(item)"></i> -->
                        </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>
        </nav>
    </div>

    <div id="grade-management-alert-delete-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">
                        <button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
                            data-hs-overlay="#grade-management-alert-delete-modal">
                            <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">
                        <ng-container *ngIf="numDataListChecked">
                            ยืนยันการลบข้อมูลหรือไม่
                        </ng-container>
                        <ng-container *ngIf="!numDataListChecked">
                            เลือกข้อมูลที่ต้องการลบ
                        </ng-container>
                    </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"
                            data-hs-overlay="#grade-management-alert-delete-modal">
                            ย้อนกลับ
                        </button>
                        <a class="ti-btn ti-btn-danger" href="javascript:void(0);"
                            data-hs-overlay="#grade-management-alert-delete-modal"
                            (click)="deleteCompetencyGroupGradeList();" *ngIf="numDataListChecked">
                            ลบข้อมูล
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</ng-container>


<ng-container *ngIf="typeTab">
    <app-group-grade [dataSelect]="dataSelect" [typeTab]="typeTab" (sendBackTab)="pathTitleChange($event)"
        (sendDataList)="dataList=$event"></app-group-grade>
</ng-container>

<!-- <ng-container *ngIf="editTab">
    <app-edit-group-grade (sendEdit)="editTab=$event;pathTitleChange();search=''"
        [dataSelect]="dataSelect"></app-edit-group-grade>
</ng-container>

 -->