<div class="w-full min-height-50px mb-10px justify-between items-center">
    <div class="flex justify-between">
        <div class="flex pr-2">
            <div class="px-1">
                <button type="button" class="ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
                    data-hs-overlay="#company-registration-page-upload-modal">
                    <i class="ri-add-line"></i>
                    นำเข้าข้อมูล
                </button>
                <a class="mx-2 justify-center  -mb-px  inline-flex items-center gap-2 font-weight-500 font-size-12px text-center text-secondary border-secondary border-b-2 align-items-end"
                    href="javascript:void(0);">
                    ดาวน์โหลดตัวอย่างไฟล์
                </a>
            </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 by No. or Name" [(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 href="javascript:void(0);" class="ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
                            data-hs-overlay="#sub-command-structure-alert-delete-modal">
                            <i class="ri-delete-bin-6-line"></i>
                            Delete
                        </button>
                    </div>
                    <div class="px-1">
                        <button href="javascript:void(0);" class="ti-btn ti-btn-soft-warning h-45px 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-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">
                                        <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="!l">
                                                <i class="ti ti-dots-vertical fs-l"></i>
                                            </div>
                                        </th>
                                    </ng-container>
                                </tr>
                            </thead>
                            <tbody>
                                <tr *ngFor="let item of[
                                ['01','001', 'Department Manager 1','Department Manager 1'],
                                ['02','002', 'Department Manager 2','Department Manager 2'],
                                ['03','003', 'Department 1-HRD','Department 1-HRD'],
                                ['04','004', 'Department Manager 3','Department Manager 3'],
                                ['05','005', 'Department Manager 4','Department Manager 4']];let i = index">
                                    <td class="text-center">
                                        {{i+1}}
                                    </td>
                                    <td class="text-center">{{item[1]}}</td>
                                    <td>{{item[2]}}</td>
                                    <td>{{item[3]}}</td>
                                    <td class="flex justify-center">
                                        <i class="ti ti-edit cursor-pointer i-gray fs-l px-1"
                                            data-hs-overlay="#sub-command-structure-modal-edit"></i>
                                        <i class="ti ti-trash cursor-pointer i-gray fs-l px-1"
                                            data-hs-overlay="#sub-command-structure-alert-delete-modal"></i>
                                    </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>
                </ul>
            </nav>
        </div>


        <div id="sub-command-structure-modal-add" 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">
                            เพิ่มข้อมูลรายละเอียดของงาน
                        </h3>
                        <div class="flex justify-end">
                            <button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
                                data-hs-overlay="#sub-command-structure-modal-add">
                                <span class="sr-only">Close</span>
                                <i class="ti ti-circle-x fs-xxl"></i>
                            </button>
                        </div>
                    </div>
                    <div class="ti-modal-center">
                        <div class="flex justify-end" style="padding-right: 1rem;">
                            <div class="px-1">
                                <button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md">
                                    <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 class="px-1">
                                <button href="javascript:void(0);"
                                    class="ti-btn ti-btn-soft-warning h-45px m-0 shadow-md">
                                    <i class="ti ti-book fs-l"></i>
                                    Help
                                </button>
                            </div>
                        </div>
                    </div>
                    <div class="ti-modal-body mt-1">
                        <label for="input-label" class="ti-form-label">รหัสงาน*</label>
                        <input type="text" id="input-label" class="ti-form-input w-1/2 bg-input-readonly" readonly value="001">
                        <label for="input-label" class="ti-form-label mt-2rem">ชื่อลักษณะงาน (ไทย)</label>
                        <input type="text" id="input-label" class="ti-form-input h-10 bg-input-readonly" readonly value="Department Manager 1">
                        <label for="input-label" class="ti-form-label mt-2rem">ชื่อลักษณะงาน (อังกฤษ)</label>
                        <input type="text" id="input-label" class="ti-form-input h-10 bg-input-readonly" readonly value="Department Manager 1">
                        <label class="ti-form-label mt-2rem">ชื่อตำแหน่งผู้บังคับบัญชาโดยตรง</label>
                        <div class="relative flex rounded-md">
                            <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
                                name="hs-leading-button-add-on-with-icon-and-button"
                                class="ti-form-input w-full rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10"
                                style="padding-right: 3.5rem;">
                            <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 type="button" class="flex items-center text-gray-500 dark:text-white/70"
                                    data-hs-overlay="#sub-department-four-bu6-table-modal">
                                    <i class="ri-search-line cursor-pointer text-gray"></i>
                                </button>
                            </div>
                        </div>
                        <label class="ti-form-label mt-2rem">ชื่อตำแหน่งผู้ปฏิบัติงาน</label>
                        <div class="relative flex rounded-md">
                            <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
                                name="hs-leading-button-add-on-with-icon-and-button"
                                class="ti-form-input w-full rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10"
                                style="padding-right: 3.5rem;">
                            <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 type="button" class="flex items-center text-gray-500 dark:text-white/70"
                                    data-hs-overlay="#sub-department-four-bu6-table-modal">
                                    <i class="ri-search-line cursor-pointer text-gray"></i>
                                </button>
                            </div>
                        </div>
                        <label for="detail_eng" class="ti-form-label mt-2rem">
                            ชื่อตำแหน่งและจำนวนผู้ใต้ยังคับบัญชาโดยตรง
                        </label>
                        <div class="icon-container">
                            <i class="ri-group-fill cursor-pointer"></i>
                            <i class="ri-mail-fill cursor-pointer"></i>
                        </div>
                        <textarea type="text" id="detail_eng" class="ti-form-input font-bold" rows="3" cols="50">
1.
2.
3.
                        </textarea>
                        <div class="flex justify-end mt-3rem 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="#sub-command-structure-alert-add-modal">
                                ย้อนกลับ
                            </button>
                            <a class="ti-btn ti-btn-success" href="javascript:void(0);"
                                data-hs-overlay="#sub-command-structure-alert-add-modal">
                                บันทึกข้อมูล
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div id="sub-command-structure-modal-edit" 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">
                            แก้ไขข้อมูลรายละเอียดของงาน
                        </h3>
                        <div class="flex justify-end">
                            <button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
                                data-hs-overlay="#sub-command-structure-modal-edit">
                                <span class="sr-only">Close</span>
                                <i class="ti ti-circle-x fs-xxl"></i>
                            </button>
                        </div>
                    </div>
                    <div class="ti-modal-center">
                        <div class="flex justify-end" style="padding-right: 1rem;">
                            <div class="px-1">
                                <button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md">
                                    <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 class="px-1">
                                <button href="javascript:void(0);"
                                    class="ti-btn ti-btn-soft-warning h-45px m-0 shadow-md">
                                    <i class="ti ti-book fs-l"></i>
                                    Help
                                </button>
                            </div>
                        </div>
                    </div>
                    <div class="ti-modal-body mt-1">
                        <label for="input-label" class="ti-form-label">รหัสงาน*</label>
                        <input type="text" id="input-label" class="ti-form-input w-1/2 bg-input-readonly" readonly value="001">
                        <label for="input-label" class="ti-form-label mt-2rem">ชื่อลักษณะงาน (ไทย)</label>
                        <input type="text" id="input-label" class="ti-form-input h-10 bg-input-readonly" readonly value="Department Manager 1">
                        <label for="input-label" class="ti-form-label mt-2rem">ชื่อลักษณะงาน (อังกฤษ)</label>
                        <input type="text" id="input-label" class="ti-form-input h-10 bg-input-readonly" readonly value="Department Manager 1">
                        <label class="ti-form-label mt-2rem">ชื่อตำแหน่งผู้บังคับบัญชาโดยตรง</label>
                        <div class="relative flex rounded-md">
                            <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
                                name="hs-leading-button-add-on-with-icon-and-button"
                                class="ti-form-input w-full rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10"
                                style="padding-right: 3.5rem;">
                            <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 type="button" class="flex items-center text-gray-500 dark:text-white/70"
                                    data-hs-overlay="#sub-department-four-bu6-table-modal">
                                    <i class="ri-search-line cursor-pointer text-gray"></i>
                                </button>
                            </div>
                        </div>
                        <label class="ti-form-label mt-2rem">ชื่อตำแหน่งผู้ปฏิบัติงาน</label>
                        <div class="relative flex rounded-md">
                            <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
                                name="hs-leading-button-add-on-with-icon-and-button"
                                class="ti-form-input w-full rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10"
                                style="padding-right: 3.5rem;">
                            <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 type="button" class="flex items-center text-gray-500 dark:text-white/70"
                                    data-hs-overlay="#sub-department-four-bu6-table-modal">
                                    <i class="ri-search-line cursor-pointer text-gray"></i>
                                </button>
                            </div>
                        </div>
                        <label for="detail_eng" class="ti-form-label mt-2rem">
                            ชื่อตำแหน่งและจำนวนผู้ใต้ยังคับบัญชาโดยตรง
                        </label>
                        <div class="icon-container">
                            <i class="ri-group-fill cursor-pointer"></i>
                            <i class="ri-mail-fill cursor-pointer"></i>
                        </div>
                        <textarea type="text" id="detail_eng" class="ti-form-input font-bold" rows="3" cols="50">
1.
2.
3.
                        </textarea>
                        <div class="flex justify-end mt-3rem 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="#sub-command-structure-modal-edit">
                                ย้อนกลับ
                            </button>
                            <a class="ti-btn ti-btn-success" href="javascript:void(0);"
                                data-hs-overlay="#sub-command-structure-alert-add-modal">
                                บันทึกข้อมูล
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div id="sub-command-structure-alert-add-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="#sub-command-structure-alert-add-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">
                            ยืนยันการบันทึกข้อมูลหรือไม่
                        </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="#sub-command-structure-modal-edit">
                                ย้อนกลับ
                            </button>
                            <a class="ti-btn ti-btn-success" href="javascript:void(0);"
                                data-hs-overlay="#sub-command-structure-alert-add-modal" (click)="addBu1();showSuccessAdd()">
                                บันทึกข้อมูล
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div id="sub-command-structure-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="#sub-command-structure-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">
                            ยืนยันการลบข้อมูลหรือไม่!
                        </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="#sub-command-structure-alert-delete-modal">
                                ย้อนกลับ
                            </button>
                            <a class="ti-btn ti-btn-success" href="javascript:void(0);"
                                data-hs-overlay="#sub-command-structure-alert-delete-modal"
                                (click)="addBu1();showSuccessDelete()">
                                ลบข้อมูล
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>