@pnkx-lib/ui 1.9.38 → 1.9.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10277,388 +10277,660 @@ const HeadingTable = (props) => {
10277
10277
  );
10278
10278
  };
10279
10279
 
10280
- const EditableCell = ({
10281
- editing,
10282
- dataIndex,
10283
- inputType,
10284
- children,
10285
- control,
10280
+ const ConfirmModal = ({
10281
+ title,
10282
+ content,
10283
+ typeIcon,
10284
+ titleCancelBtn = "Huỷ bỏ",
10285
+ titleSubmitBtn = "Xác nhận",
10286
+ handleCancel,
10287
+ handleSubmit,
10286
10288
  ...restProps
10287
10289
  }) => {
10288
- return /* @__PURE__ */ jsxRuntimeExports.jsx("td", { ...restProps, children: editing ? /* @__PURE__ */ jsxRuntimeExports.jsx(
10289
- PnkxField,
10290
- {
10291
- name: dataIndex,
10292
- control,
10293
- component: Input,
10294
- type: inputType
10290
+ //! State
10291
+ const IconType = () => {
10292
+ switch (typeIcon) {
10293
+ case "success":
10294
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10295
+ "svg",
10296
+ {
10297
+ xmlns: "http://www.w3.org/2000/svg",
10298
+ width: "24",
10299
+ height: "24",
10300
+ viewBox: "0 0 24 24",
10301
+ fill: "none",
10302
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10303
+ "path",
10304
+ {
10305
+ d: "M12 1.5C6.20156 1.5 1.5 6.20156 1.5 12C1.5 17.7984 6.20156 22.5 12 22.5C17.7984 22.5 22.5 17.7984 22.5 12C22.5 6.20156 17.7984 1.5 12 1.5ZM16.5352 8.57109L11.5992 15.4148C11.5302 15.5111 11.4393 15.5896 11.3339 15.6437C11.2286 15.6978 11.1118 15.7261 10.9934 15.7261C10.8749 15.7261 10.7582 15.6978 10.6528 15.6437C10.5474 15.5896 10.4565 15.5111 10.3875 15.4148L7.46484 11.3648C7.37578 11.2406 7.46484 11.0672 7.61719 11.0672H8.71641C8.95547 11.0672 9.18281 11.182 9.32344 11.3789L10.9922 13.6945L14.6766 8.58516C14.8172 8.39062 15.0422 8.27344 15.2836 8.27344H16.3828C16.5352 8.27344 16.6242 8.44688 16.5352 8.57109Z",
10306
+ fill: "#52C41A"
10307
+ }
10308
+ )
10309
+ }
10310
+ );
10311
+ case "error":
10312
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10313
+ "svg",
10314
+ {
10315
+ xmlns: "http://www.w3.org/2000/svg",
10316
+ width: "24",
10317
+ height: "24",
10318
+ viewBox: "0 0 24 24",
10319
+ fill: "none",
10320
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10321
+ "path",
10322
+ {
10323
+ d: "M12 1.5C6.20156 1.5 1.5 6.20156 1.5 12C1.5 17.7984 6.20156 22.5 12 22.5C17.7984 22.5 22.5 17.7984 22.5 12C22.5 6.20156 17.7984 1.5 12 1.5ZM15.8766 15.9891L14.3297 15.982L12 13.2047L9.67266 15.9797L8.12344 15.9867C8.02031 15.9867 7.93594 15.9047 7.93594 15.7992C7.93594 15.7547 7.95234 15.7125 7.98047 15.6773L11.0297 12.0445L7.98047 8.41406C7.95215 8.37971 7.93643 8.3367 7.93594 8.29219C7.93594 8.18906 8.02031 8.10469 8.12344 8.10469L9.67266 8.11172L12 10.8891L14.3273 8.11406L15.8742 8.10703C15.9773 8.10703 16.0617 8.18906 16.0617 8.29453C16.0617 8.33906 16.0453 8.38125 16.0172 8.41641L12.9727 12.0469L16.0195 15.6797C16.0477 15.7148 16.0641 15.757 16.0641 15.8016C16.0641 15.9047 15.9797 15.9891 15.8766 15.9891Z",
10324
+ fill: "#FF4D4F"
10325
+ }
10326
+ )
10327
+ }
10328
+ );
10329
+ case "info":
10330
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10331
+ "svg",
10332
+ {
10333
+ xmlns: "http://www.w3.org/2000/svg",
10334
+ width: "24",
10335
+ height: "24",
10336
+ viewBox: "0 0 24 24",
10337
+ fill: "none",
10338
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10339
+ "path",
10340
+ {
10341
+ d: "M12 1.5C6.20156 1.5 1.5 6.20156 1.5 12C1.5 17.7984 6.20156 22.5 12 22.5C17.7984 22.5 22.5 17.7984 22.5 12C22.5 6.20156 17.7984 1.5 12 1.5ZM12.75 17.0625C12.75 17.1656 12.6656 17.25 12.5625 17.25H11.4375C11.3344 17.25 11.25 17.1656 11.25 17.0625V10.6875C11.25 10.5844 11.3344 10.5 11.4375 10.5H12.5625C12.6656 10.5 12.75 10.5844 12.75 10.6875V17.0625ZM12 9C11.7056 8.99399 11.4253 8.87282 11.2192 8.6625C11.0132 8.45218 10.8977 8.16945 10.8977 7.875C10.8977 7.58055 11.0132 7.29782 11.2192 7.0875C11.4253 6.87718 11.7056 6.75601 12 6.75C12.2944 6.75601 12.5747 6.87718 12.7808 7.0875C12.9868 7.29782 13.1023 7.58055 13.1023 7.875C13.1023 8.16945 12.9868 8.45218 12.7808 8.6625C12.5747 8.87282 12.2944 8.99399 12 9Z",
10342
+ fill: "#1677FF"
10343
+ }
10344
+ )
10345
+ }
10346
+ );
10347
+ case "warning":
10348
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10349
+ "svg",
10350
+ {
10351
+ xmlns: "http://www.w3.org/2000/svg",
10352
+ width: "24",
10353
+ height: "24",
10354
+ viewBox: "0 0 24 24",
10355
+ fill: "none",
10356
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10357
+ "path",
10358
+ {
10359
+ d: "M12 1.5C6.20156 1.5 1.5 6.20156 1.5 12C1.5 17.7984 6.20156 22.5 12 22.5C17.7984 22.5 22.5 17.7984 22.5 12C22.5 6.20156 17.7984 1.5 12 1.5ZM11.25 6.9375C11.25 6.83437 11.3344 6.75 11.4375 6.75H12.5625C12.6656 6.75 12.75 6.83437 12.75 6.9375V13.3125C12.75 13.4156 12.6656 13.5 12.5625 13.5H11.4375C11.3344 13.5 11.25 13.4156 11.25 13.3125V6.9375ZM12 17.25C11.7056 17.244 11.4253 17.1228 11.2192 16.9125C11.0132 16.7022 10.8977 16.4195 10.8977 16.125C10.8977 15.8305 11.0132 15.5478 11.2192 15.3375C11.4253 15.1272 11.7056 15.006 12 15C12.2944 15.006 12.5747 15.1272 12.7808 15.3375C12.9868 15.5478 13.1023 15.8305 13.1023 16.125C13.1023 16.4195 12.9868 16.7022 12.7808 16.9125C12.5747 17.1228 12.2944 17.244 12 17.25Z",
10360
+ fill: "#FAAD14"
10361
+ }
10362
+ )
10363
+ }
10364
+ );
10295
10365
  }
10296
- ) : children });
10366
+ };
10367
+ //! Function
10368
+ //! Render
10369
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { ...restProps, footer: null, closeIcon: null, width: 400, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
10370
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-3", children: [
10371
+ /* @__PURE__ */ jsxRuntimeExports.jsx(IconType, {}),
10372
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
10373
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-base font-semibold", children: title }),
10374
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm", children: content })
10375
+ ] })
10376
+ ] }),
10377
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 w-full justify-end items-end pt-3", children: [
10378
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { shape: "round", onClick: handleCancel, children: titleCancelBtn }),
10379
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { shape: "round", type: "primary", onClick: handleSubmit, children: titleSubmitBtn })
10380
+ ] })
10381
+ ] }) });
10297
10382
  };
10298
- const tableCss = css`
10299
- .ant-table-cell::before {
10300
- display: none !important;
10301
- }
10302
- .ant-table-thead .ant-table-cell {
10303
- background-color: #d6e6fe;
10304
- font-weight: 500;
10305
- }
10306
-
10307
- .ant-table-thead th.ant-table-column-has-sorters:hover {
10308
- background-color: #d6e6fe;
10309
- }
10310
10383
 
10311
- .ant-table-row.table-row-even {
10312
- background-color: #f7f7f8;
10313
- }
10384
+ var CATEGORY_LIST_ENUM = /* @__PURE__ */ ((CATEGORY_LIST_ENUM2) => {
10385
+ CATEGORY_LIST_ENUM2[CATEGORY_LIST_ENUM2["DRAFT"] = 0] = "DRAFT";
10386
+ CATEGORY_LIST_ENUM2[CATEGORY_LIST_ENUM2["WATING_APPROVAL"] = 1] = "WATING_APPROVAL";
10387
+ CATEGORY_LIST_ENUM2[CATEGORY_LIST_ENUM2["ACTIVE"] = 2] = "ACTIVE";
10388
+ CATEGORY_LIST_ENUM2[CATEGORY_LIST_ENUM2["INACTIVE"] = 3] = "INACTIVE";
10389
+ CATEGORY_LIST_ENUM2[CATEGORY_LIST_ENUM2["REJECT"] = 4] = "REJECT";
10390
+ CATEGORY_LIST_ENUM2[CATEGORY_LIST_ENUM2["DELETE"] = 5] = "DELETE";
10391
+ return CATEGORY_LIST_ENUM2;
10392
+ })(CATEGORY_LIST_ENUM || {});
10314
10393
 
10315
- .ant-table-row.table-row-odd {
10316
- background-color: #ffffff;
10317
- }
10318
- .ant-table-row:hover {
10319
- background-color: #e7f0ff;
10320
- }
10321
- `;
10322
- const Table = ({
10323
- dataSource,
10324
- columns,
10325
- loading = false,
10326
- totalItems,
10327
- filters,
10328
- onChangePage,
10329
- onChangePageSize,
10330
- onSort,
10331
- rowsSelected,
10332
- onSelect,
10333
- onRowClick,
10334
- rowKey = "id",
10335
- className,
10336
- editable,
10337
- onSave,
10338
- titleSettingTableModal,
10339
- showSetting,
10340
- setColumns,
10341
- resetToInitialFilters,
10342
- handleSearch,
10343
- groupHeadingButtonItems,
10344
- tagSearchItems,
10345
- setTagSearchItems,
10346
- setKeyActive,
10347
- keyActive,
10348
- ...rest
10394
+ const BulkAction = ({
10395
+ quantity,
10396
+ handleRestore,
10397
+ handleSendApproval,
10398
+ handleCancelSendApproval,
10399
+ handleRefuseApproval,
10400
+ handleApproval,
10401
+ handleCancelApproval,
10402
+ handleDelete,
10403
+ handleActivate,
10404
+ handleInActivate,
10405
+ status
10349
10406
  }) => {
10350
10407
  //! State
10351
- const paginationConfig = {
10352
- current: filters.PageIndex,
10353
- pageSize: filters.PageSize,
10354
- total: totalItems,
10355
- showSizeChanger: true,
10356
- showQuickJumper: true,
10357
- showTotal: (total, range) => `${range[0]}-${range[1]} of ${total} items`,
10358
- onChange: (page, pageSize) => {
10359
- if (page !== filters.PageIndex) onChangePage(page);
10360
- if (pageSize !== filters.PageSize) onChangePageSize(pageSize);
10361
- }
10362
- };
10363
- const [openSetting, setOpenStting] = useState(false);
10364
- const rowSelection = {
10365
- selectedRowKeys: rowsSelected,
10366
- onChange: onSelect
10367
- // getCheckboxProps: (record: any) => ({
10368
- // disabled: true, // Ví dụ: disable nếu tuổi > 40
10369
- // }),
10370
- };
10371
- const { control, handleSubmit, reset } = useForm();
10372
- const [data, setData] = useState([]);
10373
- const [editingKey, setEditingKey] = useState("");
10374
- const getRowKeyValue = (record) => typeof rowKey === "function" ? rowKey(record) : record[rowKey];
10375
- const isEditing = (record) => getRowKeyValue(record) === editingKey;
10376
- const edit = (record) => {
10377
- reset(record);
10378
- setEditingKey(getRowKeyValue(record));
10379
- };
10380
- const save = (formValues) => {
10381
- const key = editingKey;
10382
- const newData = [...data];
10383
- const index = newData.findIndex((item) => getRowKeyValue(item) === key);
10384
- if (onSave) {
10385
- onSave(formValues);
10386
- }
10387
- if (index > -1) {
10388
- newData[index] = { ...newData[index], ...formValues };
10389
- setData(newData);
10390
- setEditingKey("");
10391
- }
10392
- };
10393
- const cancel = () => {
10394
- setEditingKey("");
10395
- };
10396
- //! Function
10397
- useEffect(() => {
10398
- setData(Array.isArray(dataSource) ? dataSource : []);
10399
- }, [JSON.stringify(dataSource)]);
10400
- const columnsEditable = [
10401
- ...columns,
10408
+ const listIcon = [
10402
10409
  {
10403
- title: "Operation",
10404
- dataIndex: "operation",
10405
- render: (_, record) => {
10406
- const editable2 = isEditing(record);
10407
- return editable2 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
10408
- /* @__PURE__ */ jsxRuntimeExports.jsx(
10409
- Popconfirm$1,
10410
- {
10411
- title: "Bạn có chắc chắn muốn huỷ chỉnh sửa?",
10412
- onConfirm: cancel,
10413
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography$1.Text, { type: "danger", children: " Huỷ bỏ" })
10414
- }
10415
- ),
10416
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { htmlType: "submit", variant: "text", color: "blue", children: "Lưu" })
10417
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
10418
- /* @__PURE__ */ jsxRuntimeExports.jsx(
10419
- Button,
10420
- {
10421
- disabled: editingKey !== "",
10422
- onClick: () => edit(record),
10423
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$4, {}),
10424
- variant: "text",
10425
- color: "blue"
10426
- }
10427
- ),
10428
- /* @__PURE__ */ jsxRuntimeExports.jsx(Popconfirm$1, { title: "Bạn có muốn xoá ?", onConfirm: () => {
10429
- }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10430
- Button,
10431
- {
10432
- disabled: editingKey !== "",
10433
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$5, {}),
10434
- variant: "text",
10435
- color: "red"
10436
- }
10437
- ) })
10438
- ] });
10439
- }
10410
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RestoreIcon, { stroke: "white" }),
10411
+ action: handleRestore,
10412
+ showConfirmModal: false,
10413
+ title: "Khôi phục",
10414
+ arrShow: [CATEGORY_LIST_ENUM?.DELETE, CATEGORY_LIST_ENUM?.REJECT]
10415
+ },
10416
+ {
10417
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(SendApprovalIcon, { stroke: "white" }),
10418
+ action: handleSendApproval,
10419
+ showConfirmModal: true,
10420
+ typeIcon: "info",
10421
+ title: "Xác nhận gửi duyệt",
10422
+ content: "Bạn có chắc chắn muốn gửi duyệt mục này không?",
10423
+ arrShow: [CATEGORY_LIST_ENUM?.DRAFT]
10424
+ },
10425
+ {
10426
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(CancelSendApprovalIcon, { stroke: "white" }),
10427
+ action: handleCancelSendApproval,
10428
+ showConfirmModal: true,
10429
+ typeIcon: "error",
10430
+ title: "Xác nhận hủy gửi duyệt",
10431
+ content: "Bạn có chắc chắn muốn hủy gửi duyệt mục này không?",
10432
+ arrShow: [CATEGORY_LIST_ENUM?.WATING_APPROVAL]
10433
+ },
10434
+ {
10435
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefuseApprovalIcon, { stroke: "white" }),
10436
+ action: handleRefuseApproval,
10437
+ showConfirmModal: true,
10438
+ typeIcon: "error",
10439
+ title: "Xác nhận từ chối duyệt",
10440
+ content: "Bạn chắc chắn muốn từ chối duyệt mục này không? Hành động này không thể hoàn tác.",
10441
+ arrShow: [CATEGORY_LIST_ENUM?.WATING_APPROVAL]
10442
+ },
10443
+ {
10444
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(ApprovalIcon, { stroke: "white" }),
10445
+ action: handleApproval,
10446
+ showConfirmModal: true,
10447
+ typeIcon: "info",
10448
+ title: "Xác nhận duyệt",
10449
+ content: "Bạn có chắc chắn muốn duyệt mục này không?",
10450
+ arrShow: [CATEGORY_LIST_ENUM?.WATING_APPROVAL]
10451
+ },
10452
+ {
10453
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(CancelApprovalIcon, { stroke: "white" }),
10454
+ action: handleCancelApproval,
10455
+ showConfirmModal: true,
10456
+ typeIcon: "error",
10457
+ title: "Xác nhận hủy duyệt",
10458
+ content: "Bạn có chắc chắn muốn hủy duyệt mục này không?",
10459
+ arrShow: [CATEGORY_LIST_ENUM?.ACTIVE]
10460
+ },
10461
+ {
10462
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(DeleteIcon, { fill: "white" }),
10463
+ action: handleDelete,
10464
+ showConfirmModal: true,
10465
+ typeIcon: "error",
10466
+ title: "Xác nhận xóa",
10467
+ content: "Bạn có chắc chắn muốn xóa mục này không? Hành động này không thể hoàn tác.",
10468
+ arrShow: [
10469
+ CATEGORY_LIST_ENUM?.DRAFT,
10470
+ CATEGORY_LIST_ENUM?.ACTIVE,
10471
+ CATEGORY_LIST_ENUM?.INACTIVE
10472
+ ]
10473
+ },
10474
+ {
10475
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(ActivateIcon, { stroke: "white" }),
10476
+ action: handleActivate,
10477
+ showConfirmModal: true,
10478
+ typeIcon: "info",
10479
+ title: "Xác nhận kích hoạt",
10480
+ content: "Bạn có chắc chắn muốn kích hoạt mục này không?",
10481
+ arrShow: [CATEGORY_LIST_ENUM?.INACTIVE]
10482
+ },
10483
+ {
10484
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(InActiveIcon, { stroke: "white" }),
10485
+ action: handleInActivate,
10486
+ showConfirmModal: true,
10487
+ typeIcon: "info",
10488
+ title: "Xác nhận vô hiệu hóa",
10489
+ content: "Bạn có chắc chắn muốn vô hiệu hóa mục này không?",
10490
+ arrShow: [CATEGORY_LIST_ENUM?.ACTIVE]
10440
10491
  }
10441
10492
  ];
10442
- const mergedColumns = columnsEditable.map(
10443
- (col) => {
10444
- if (!col.editable) return col;
10445
- return {
10446
- ...col,
10447
- onCell: (record) => ({
10448
- record,
10449
- inputType: "text",
10450
- dataIndex: "dataIndex" in col ? col.dataIndex : void 0,
10451
- title: col.title,
10452
- editing: isEditing(record),
10453
- control
10454
- })
10455
- };
10456
- }
10457
- );
10458
- const handleTableChange = (sorter) => {
10459
- if (sorter && sorter.field && onSort) {
10460
- onSort(sorter.field);
10461
- }
10462
- };
10463
- const handleOnClickRow = (record, onRowClick2) => (e) => {
10464
- const target = e.target;
10465
- if (target.closest("input") || // ⛔ Checkbox
10466
- target.closest("button") || // ⛔ Button trong row
10467
- target.closest("svg") || // ⛔ Icon
10468
- target.closest(".ant-checkbox") || // ⛔ AntD checkbox
10469
- target.closest("a")) {
10470
- return;
10493
+ const [open, setOpen] = useState(false);
10494
+ const [notifyContent, setNotifyContent] = useState({
10495
+ title: "",
10496
+ content: "",
10497
+ typeIcon: "info",
10498
+ handleCancel: () => {
10499
+ },
10500
+ handleSubmit: () => {
10471
10501
  }
10472
- onRowClick2?.(record);
10473
- };
10474
- if (loading) return /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { type: "table" });
10475
- const EmptyTable = () => {
10476
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center text-center", children: [
10477
- /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: "https://i.ibb.co/39C3x4LZ/Component-1.png", alt: "no data" }),
10478
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-lg font-bold text-black", children: "Không có dữ liệu nào phù hợp" }),
10479
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-gray-500", children: "Kiểm tra lại bộ lọc hoặc thêm mới dữ liệu" })
10480
- ] });
10502
+ });
10503
+ //! Function
10504
+ const IsShow = (arrStatus) => {
10505
+ return arrStatus.includes(status);
10481
10506
  };
10482
- const tableContent = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: twMerge(showSetting ? "relative" : ""), children: [
10483
- /* @__PURE__ */ jsxRuntimeExports.jsx(
10484
- HeadingTable,
10485
- {
10486
- filters,
10487
- handleSearch,
10488
- resetToInitialFilters,
10489
- setOpenStting,
10490
- showSetting,
10491
- groupHeadingButtonItems,
10492
- tagSearchItems,
10493
- setTagSearchItems,
10494
- keyActive,
10495
- setKeyActive
10496
- }
10497
- ),
10498
- /* @__PURE__ */ jsxRuntimeExports.jsx(
10499
- Table$1,
10500
- {
10501
- rowKey,
10502
- dataSource: data,
10503
- columns: editable ? mergedColumns : columns,
10504
- pagination: paginationConfig,
10505
- loading,
10506
- rowSelection,
10507
- onChange: handleTableChange,
10508
- onRow: (record) => ({
10509
- onClick: handleOnClickRow(record, onRowClick)
10510
- }),
10511
- locale: {
10512
- emptyText: /* @__PURE__ */ jsxRuntimeExports.jsx(EmptyTable, {})
10507
+ //! Render
10508
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full flex justify-center items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3 px-[10px] py-3 bg-[#2561ED] rounded-lg w-fit", children: [
10509
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-white px-3", children: [
10510
+ "Đã chọn: ",
10511
+ quantity
10512
+ ] }),
10513
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-5 border-l border-white mx-1" }),
10514
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-3", children: listIcon.map(
10515
+ (item, index) => IsShow(item?.arrShow) && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { title: item?.title, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10516
+ "button",
10517
+ {
10518
+ className: "p-1 rounded-sm transition duration-200 cursor-pointer hover:bg-[#1B4ACB] hover:rounded-sm",
10519
+ onClick: item?.showConfirmModal ? () => {
10520
+ setOpen(true);
10521
+ setNotifyContent({
10522
+ title: item?.title || "",
10523
+ content: item?.content || "",
10524
+ typeIcon: item?.typeIcon,
10525
+ handleCancel: () => {
10526
+ setOpen(false);
10527
+ },
10528
+ handleSubmit: item?.action
10529
+ });
10530
+ } : item?.action,
10531
+ children: item.icon
10513
10532
  },
10514
- rowClassName: (_, index) => `table-row-${index % 2 === 0 ? "even" : "odd"}`,
10515
- className: cx(tableCss, className),
10516
- components: editable ? {
10517
- body: { cell: EditableCell }
10518
- } : void 0,
10519
- ...rest
10520
- }
10521
- ),
10533
+ index
10534
+ ) })
10535
+ ) }),
10522
10536
  /* @__PURE__ */ jsxRuntimeExports.jsx(
10523
- SettingTable,
10537
+ ConfirmModal,
10524
10538
  {
10525
- open: openSetting,
10526
- setOpen: setOpenStting,
10527
- title: titleSettingTableModal,
10528
- showSetting,
10529
- defaultSettingColumnItems: editable ? mergedColumns : columns,
10530
- setDefaultSettingColumnItems: setColumns
10539
+ title: notifyContent?.title,
10540
+ content: notifyContent?.content,
10541
+ typeIcon: notifyContent?.typeIcon,
10542
+ open,
10543
+ handleCancel: notifyContent?.handleCancel,
10544
+ handleSubmit: notifyContent?.handleSubmit
10531
10545
  }
10532
10546
  )
10533
- ] });
10534
- const renderTableContent = () => {
10535
- if (editable) {
10536
- return /* @__PURE__ */ jsxRuntimeExports.jsx("form", { onSubmit: handleSubmit(save), children: tableContent });
10537
- }
10538
- return tableContent;
10539
- };
10540
- //! Render
10541
- if (loading) return /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { type: "table" });
10542
- return renderTableContent();
10547
+ ] }) });
10543
10548
  };
10544
10549
 
10545
- const createStoreImpl = (createState) => {
10546
- let state;
10547
- const listeners = /* @__PURE__ */ new Set();
10548
- const setState = (partial, replace) => {
10549
- const nextState = typeof partial === "function" ? partial(state) : partial;
10550
- if (!Object.is(nextState, state)) {
10551
- const previousState = state;
10552
- state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
10553
- listeners.forEach((listener) => listener(state, previousState));
10554
- }
10555
- };
10556
- const getState = () => state;
10557
- const getInitialState = () => initialState;
10558
- const subscribe = (listener) => {
10559
- listeners.add(listener);
10560
- return () => listeners.delete(listener);
10561
- };
10562
- const api = { setState, getState, getInitialState, subscribe };
10563
- const initialState = state = createState(setState, getState, api);
10564
- return api;
10565
- };
10566
- const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
10567
-
10568
- const identity = (arg) => arg;
10569
- function useStore(api, selector = identity) {
10570
- const slice = React__default.useSyncExternalStore(
10571
- api.subscribe,
10572
- () => selector(api.getState()),
10573
- () => selector(api.getInitialState())
10574
- );
10575
- React__default.useDebugValue(slice);
10576
- return slice;
10577
- }
10578
- const createImpl = (createState) => {
10579
- const api = createStore(createState);
10580
- const useBoundStore = (selector) => useStore(api, selector);
10581
- Object.assign(useBoundStore, api);
10582
- return useBoundStore;
10583
- };
10584
- const create = (createState) => createState ? createImpl(createState) : createImpl;
10585
-
10586
- const useTabStore = create((set) => ({
10587
- activeTabKey: void 0,
10588
- // giá trị mặc định
10589
- setActiveTabKey: (key) => set({ activeTabKey: key })
10590
- }));
10591
-
10592
- const Tabs = ({
10593
- items,
10594
- lazyRender = false,
10595
- defaultActiveKey,
10596
- ...rest
10550
+ const EditableCell = ({
10551
+ editing,
10552
+ dataIndex,
10553
+ inputType,
10554
+ children,
10555
+ control,
10556
+ ...restProps
10597
10557
  }) => {
10598
- const { activeTabKey, setActiveTabKey } = useTabStore();
10599
- const defaultKey = defaultActiveKey?.toString() || items[0]?.key;
10600
- useEffect(() => {
10601
- if (!activeTabKey && defaultKey) {
10602
- setActiveTabKey(defaultKey);
10603
- }
10604
- }, [activeTabKey, defaultKey, setActiveTabKey]);
10605
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
10606
- Tabs$1,
10558
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("td", { ...restProps, children: editing ? /* @__PURE__ */ jsxRuntimeExports.jsx(
10559
+ PnkxField,
10607
10560
  {
10608
- items,
10609
- destroyInactiveTabPane: lazyRender,
10610
- activeKey: activeTabKey,
10611
- defaultActiveKey,
10612
- onChange: (key) => setActiveTabKey(key),
10613
- ...rest
10561
+ name: dataIndex,
10562
+ control,
10563
+ component: Input,
10564
+ type: inputType
10614
10565
  }
10615
- );
10566
+ ) : children });
10616
10567
  };
10568
+ const tableCss = css`
10569
+ .ant-table-cell::before {
10570
+ display: none !important;
10571
+ }
10572
+ .ant-table-thead .ant-table-cell {
10573
+ background-color: #d6e6fe;
10574
+ font-weight: 500;
10575
+ }
10617
10576
 
10618
- const Popover = (props) => {
10619
- const { containerClassName, popoverClassName, ...restProps } = props;
10620
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: containerClassName, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Popover$1, { className: popoverClassName, ...restProps }) });
10621
- };
10577
+ .ant-table-thead th.ant-table-column-has-sorters:hover {
10578
+ background-color: #d6e6fe;
10579
+ }
10622
10580
 
10623
- const Container = ({
10624
- children,
10581
+ .ant-table-row.table-row-even {
10582
+ background-color: #f7f7f8;
10583
+ }
10584
+
10585
+ .ant-table-row.table-row-odd {
10586
+ background-color: #ffffff;
10587
+ }
10588
+ .ant-table-row:hover {
10589
+ background-color: #e7f0ff;
10590
+ }
10591
+ `;
10592
+ const Table = ({
10593
+ dataSource,
10594
+ columns,
10595
+ loading = false,
10596
+ totalItems,
10597
+ filters,
10598
+ onChangePage,
10599
+ onChangePageSize,
10600
+ onSort,
10601
+ rowsSelected,
10602
+ onSelect,
10603
+ onRowClick,
10604
+ rowKey = "id",
10625
10605
  className,
10626
- size
10606
+ editable,
10607
+ onSave,
10608
+ titleSettingTableModal,
10609
+ showSetting,
10610
+ setColumns,
10611
+ resetToInitialFilters,
10612
+ handleSearch,
10613
+ groupHeadingButtonItems,
10614
+ tagSearchItems,
10615
+ setTagSearchItems,
10616
+ setKeyActive,
10617
+ keyActive,
10618
+ status,
10619
+ ...rest
10627
10620
  }) => {
10628
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
10629
- "div",
10621
+ //! State
10622
+ const paginationConfig = {
10623
+ current: filters.PageIndex,
10624
+ pageSize: filters.PageSize,
10625
+ total: totalItems,
10626
+ showSizeChanger: true,
10627
+ showQuickJumper: true,
10628
+ showTotal: (total, range) => `${range[0]}-${range[1]} of ${total} items`,
10629
+ onChange: (page, pageSize) => {
10630
+ if (page !== filters.PageIndex) onChangePage(page);
10631
+ if (pageSize !== filters.PageSize) onChangePageSize(pageSize);
10632
+ }
10633
+ };
10634
+ const [openSetting, setOpenStting] = useState(false);
10635
+ const rowSelection = {
10636
+ selectedRowKeys: rowsSelected,
10637
+ onChange: onSelect
10638
+ // getCheckboxProps: (record: any) => ({
10639
+ // disabled: true, // Ví dụ: disable nếu tuổi > 40
10640
+ // }),
10641
+ };
10642
+ const { control, handleSubmit, reset } = useForm();
10643
+ const [data, setData] = useState([]);
10644
+ const [editingKey, setEditingKey] = useState("");
10645
+ const getRowKeyValue = (record) => typeof rowKey === "function" ? rowKey(record) : record[rowKey];
10646
+ const isEditing = (record) => getRowKeyValue(record) === editingKey;
10647
+ const edit = (record) => {
10648
+ reset(record);
10649
+ setEditingKey(getRowKeyValue(record));
10650
+ };
10651
+ const save = (formValues) => {
10652
+ const key = editingKey;
10653
+ const newData = [...data];
10654
+ const index = newData.findIndex((item) => getRowKeyValue(item) === key);
10655
+ if (onSave) {
10656
+ onSave(formValues);
10657
+ }
10658
+ if (index > -1) {
10659
+ newData[index] = { ...newData[index], ...formValues };
10660
+ setData(newData);
10661
+ setEditingKey("");
10662
+ }
10663
+ };
10664
+ const cancel = () => {
10665
+ setEditingKey("");
10666
+ };
10667
+ //! Function
10668
+ useEffect(() => {
10669
+ setData(Array.isArray(dataSource) ? dataSource : []);
10670
+ }, [JSON.stringify(dataSource)]);
10671
+ const columnsEditable = [
10672
+ ...columns,
10630
10673
  {
10631
- className: classNames(size, "mx-auto px-4 sm:px-6 lg:px-8", className),
10632
- children
10674
+ title: "Operation",
10675
+ dataIndex: "operation",
10676
+ render: (_, record) => {
10677
+ const editable2 = isEditing(record);
10678
+ return editable2 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
10679
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
10680
+ Popconfirm$1,
10681
+ {
10682
+ title: "Bạn có chắc chắn muốn huỷ chỉnh sửa?",
10683
+ onConfirm: cancel,
10684
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography$1.Text, { type: "danger", children: " Huỷ bỏ" })
10685
+ }
10686
+ ),
10687
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { htmlType: "submit", variant: "text", color: "blue", children: "Lưu" })
10688
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
10689
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
10690
+ Button,
10691
+ {
10692
+ disabled: editingKey !== "",
10693
+ onClick: () => edit(record),
10694
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$4, {}),
10695
+ variant: "text",
10696
+ color: "blue"
10697
+ }
10698
+ ),
10699
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Popconfirm$1, { title: "Bạn có muốn xoá ?", onConfirm: () => {
10700
+ }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10701
+ Button,
10702
+ {
10703
+ disabled: editingKey !== "",
10704
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$5, {}),
10705
+ variant: "text",
10706
+ color: "red"
10707
+ }
10708
+ ) })
10709
+ ] });
10710
+ }
10711
+ }
10712
+ ];
10713
+ const mergedColumns = columnsEditable.map(
10714
+ (col) => {
10715
+ if (!col.editable) return col;
10716
+ return {
10717
+ ...col,
10718
+ onCell: (record) => ({
10719
+ record,
10720
+ inputType: "text",
10721
+ dataIndex: "dataIndex" in col ? col.dataIndex : void 0,
10722
+ title: col.title,
10723
+ editing: isEditing(record),
10724
+ control
10725
+ })
10726
+ };
10633
10727
  }
10634
10728
  );
10635
- };
10636
-
10637
- const Col = (props) => {
10638
- const { colClassName, ...restProps } = props;
10639
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Col$1, { className: colClassName, ...restProps });
10640
- };
10641
-
10642
- const Row = (props) => {
10643
- const { rowClassName, ...restProps } = props;
10644
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Row$1, { className: rowClassName, ...restProps });
10645
- };
10646
-
10647
- const Dropdown = (props) => {
10648
- const { containerClassName, dropdownClassName, ...restProps } = props;
10649
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: containerClassName, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown$1, { className: dropdownClassName, ...restProps }) });
10650
- };
10651
-
10652
- const Flex = (props) => {
10653
- const { containerClassName, flexClassName, ...restProps } = props;
10654
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: containerClassName, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Flex$1, { className: flexClassName, ...restProps }) });
10655
- };
10656
-
10657
- function _arrayWithoutHoles(r) {
10658
- if (Array.isArray(r)) return _arrayLikeToArray(r);
10659
- }
10660
-
10661
- function _iterableToArray(r) {
10729
+ const handleTableChange = (sorter) => {
10730
+ if (sorter && sorter.field && onSort) {
10731
+ onSort(sorter.field);
10732
+ }
10733
+ };
10734
+ const handleOnClickRow = (record, onRowClick2) => (e) => {
10735
+ const target = e.target;
10736
+ if (target.closest("input") || // ⛔ Checkbox
10737
+ target.closest("button") || // Button trong row
10738
+ target.closest("svg") || // Icon
10739
+ target.closest(".ant-checkbox") || // ⛔ AntD checkbox
10740
+ target.closest("a")) {
10741
+ return;
10742
+ }
10743
+ onRowClick2?.(record);
10744
+ };
10745
+ if (loading) return /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { type: "table" });
10746
+ const EmptyTable = () => {
10747
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center text-center", children: [
10748
+ /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: "https://i.ibb.co/39C3x4LZ/Component-1.png", alt: "no data" }),
10749
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-lg font-bold text-black", children: "Không có dữ liệu nào phù hợp" }),
10750
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-gray-500", children: "Kiểm tra lại bộ lọc hoặc thêm mới dữ liệu" })
10751
+ ] });
10752
+ };
10753
+ const tableContent = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: twMerge(showSetting ? "relative" : ""), children: [
10754
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
10755
+ HeadingTable,
10756
+ {
10757
+ filters,
10758
+ handleSearch,
10759
+ resetToInitialFilters,
10760
+ setOpenStting,
10761
+ showSetting,
10762
+ groupHeadingButtonItems,
10763
+ tagSearchItems,
10764
+ setTagSearchItems,
10765
+ keyActive,
10766
+ setKeyActive
10767
+ }
10768
+ ),
10769
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
10770
+ Table$1,
10771
+ {
10772
+ rowKey,
10773
+ dataSource: data,
10774
+ columns: editable ? mergedColumns : columns,
10775
+ pagination: paginationConfig,
10776
+ loading,
10777
+ rowSelection,
10778
+ onChange: handleTableChange,
10779
+ onRow: (record) => ({
10780
+ onClick: handleOnClickRow(record, onRowClick)
10781
+ }),
10782
+ locale: {
10783
+ emptyText: /* @__PURE__ */ jsxRuntimeExports.jsx(EmptyTable, {})
10784
+ },
10785
+ rowClassName: (_, index) => `table-row-${index % 2 === 0 ? "even" : "odd"}`,
10786
+ className: cx(tableCss, className),
10787
+ components: editable ? {
10788
+ body: { cell: EditableCell }
10789
+ } : void 0,
10790
+ ...rest
10791
+ }
10792
+ ),
10793
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
10794
+ SettingTable,
10795
+ {
10796
+ open: openSetting,
10797
+ setOpen: setOpenStting,
10798
+ title: titleSettingTableModal,
10799
+ showSetting,
10800
+ defaultSettingColumnItems: editable ? mergedColumns : columns,
10801
+ setDefaultSettingColumnItems: setColumns
10802
+ }
10803
+ ),
10804
+ rowsSelected?.length && rowsSelected?.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fixed bottom-1/100 left-1/2 -translate-x-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(BulkAction, { quantity: rowsSelected?.length || 0, status }) })
10805
+ ] });
10806
+ const renderTableContent = () => {
10807
+ if (editable) {
10808
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("form", { onSubmit: handleSubmit(save), children: tableContent });
10809
+ }
10810
+ return tableContent;
10811
+ };
10812
+ //! Render
10813
+ if (loading) return /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { type: "table" });
10814
+ return renderTableContent();
10815
+ };
10816
+
10817
+ const createStoreImpl = (createState) => {
10818
+ let state;
10819
+ const listeners = /* @__PURE__ */ new Set();
10820
+ const setState = (partial, replace) => {
10821
+ const nextState = typeof partial === "function" ? partial(state) : partial;
10822
+ if (!Object.is(nextState, state)) {
10823
+ const previousState = state;
10824
+ state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
10825
+ listeners.forEach((listener) => listener(state, previousState));
10826
+ }
10827
+ };
10828
+ const getState = () => state;
10829
+ const getInitialState = () => initialState;
10830
+ const subscribe = (listener) => {
10831
+ listeners.add(listener);
10832
+ return () => listeners.delete(listener);
10833
+ };
10834
+ const api = { setState, getState, getInitialState, subscribe };
10835
+ const initialState = state = createState(setState, getState, api);
10836
+ return api;
10837
+ };
10838
+ const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
10839
+
10840
+ const identity = (arg) => arg;
10841
+ function useStore(api, selector = identity) {
10842
+ const slice = React__default.useSyncExternalStore(
10843
+ api.subscribe,
10844
+ () => selector(api.getState()),
10845
+ () => selector(api.getInitialState())
10846
+ );
10847
+ React__default.useDebugValue(slice);
10848
+ return slice;
10849
+ }
10850
+ const createImpl = (createState) => {
10851
+ const api = createStore(createState);
10852
+ const useBoundStore = (selector) => useStore(api, selector);
10853
+ Object.assign(useBoundStore, api);
10854
+ return useBoundStore;
10855
+ };
10856
+ const create = (createState) => createState ? createImpl(createState) : createImpl;
10857
+
10858
+ const useTabStore = create((set) => ({
10859
+ activeTabKey: void 0,
10860
+ // giá trị mặc định
10861
+ setActiveTabKey: (key) => set({ activeTabKey: key })
10862
+ }));
10863
+
10864
+ const Tabs = ({
10865
+ items,
10866
+ lazyRender = false,
10867
+ defaultActiveKey,
10868
+ ...rest
10869
+ }) => {
10870
+ const { activeTabKey, setActiveTabKey } = useTabStore();
10871
+ const defaultKey = defaultActiveKey?.toString() || items[0]?.key;
10872
+ useEffect(() => {
10873
+ if (!activeTabKey && defaultKey) {
10874
+ setActiveTabKey(defaultKey);
10875
+ }
10876
+ }, [activeTabKey, defaultKey, setActiveTabKey]);
10877
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10878
+ Tabs$1,
10879
+ {
10880
+ items,
10881
+ destroyInactiveTabPane: lazyRender,
10882
+ activeKey: activeTabKey,
10883
+ defaultActiveKey,
10884
+ onChange: (key) => setActiveTabKey(key),
10885
+ ...rest
10886
+ }
10887
+ );
10888
+ };
10889
+
10890
+ const Popover = (props) => {
10891
+ const { containerClassName, popoverClassName, ...restProps } = props;
10892
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: containerClassName, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Popover$1, { className: popoverClassName, ...restProps }) });
10893
+ };
10894
+
10895
+ const Container = ({
10896
+ children,
10897
+ className,
10898
+ size
10899
+ }) => {
10900
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10901
+ "div",
10902
+ {
10903
+ className: classNames(size, "mx-auto px-4 sm:px-6 lg:px-8", className),
10904
+ children
10905
+ }
10906
+ );
10907
+ };
10908
+
10909
+ const Col = (props) => {
10910
+ const { colClassName, ...restProps } = props;
10911
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Col$1, { className: colClassName, ...restProps });
10912
+ };
10913
+
10914
+ const Row = (props) => {
10915
+ const { rowClassName, ...restProps } = props;
10916
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Row$1, { className: rowClassName, ...restProps });
10917
+ };
10918
+
10919
+ const Dropdown = (props) => {
10920
+ const { containerClassName, dropdownClassName, ...restProps } = props;
10921
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: containerClassName, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown$1, { className: dropdownClassName, ...restProps }) });
10922
+ };
10923
+
10924
+ const Flex = (props) => {
10925
+ const { containerClassName, flexClassName, ...restProps } = props;
10926
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: containerClassName, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Flex$1, { className: flexClassName, ...restProps }) });
10927
+ };
10928
+
10929
+ function _arrayWithoutHoles(r) {
10930
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
10931
+ }
10932
+
10933
+ function _iterableToArray(r) {
10662
10934
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
10663
10935
  }
10664
10936
 
@@ -16892,7 +17164,7 @@ const Sidebar = ({ children, menu }) => {
16892
17164
  onMouseEnter: () => setCollapse(true),
16893
17165
  onMouseLeave: () => setCollapse(false),
16894
17166
  className: twMerge(
16895
- "flex flex-col gap-y-5 h-full z-50 bg-[#1C2D5A] transition-all duration-300",
17167
+ "flex flex-col gap-y-5 h-full z-50 bg-[#001523] transition-all duration-300",
16896
17168
  collapse ? "w-60" : "w-16",
16897
17169
  openSubCollapse && "absolute"
16898
17170
  ),
@@ -16914,80 +17186,87 @@ const Sidebar = ({ children, menu }) => {
16914
17186
  }
16915
17187
  ),
16916
17188
  /* @__PURE__ */ jsxRuntimeExports.jsxs("nav", { className: twMerge("flex flex-1 flex-col px-2"), children: [
16917
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { role: "list", className: twMerge("-mx-2 space-y-1 relative"), children: menu.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
16918
- "li",
16919
- {
16920
- className: twMerge("relative cursor-pointer pl-2"),
16921
- children: [
16922
- (activeMainMenu === item.href || item.href === pathUrl) && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
16923
- /* @__PURE__ */ jsxRuntimeExports.jsx(
16924
- "span",
16925
- {
16926
- className: twMerge(
16927
- "absolute top-[-40px] right-0 w-10 h-10 rounded-full "
16928
- )
16929
- }
16930
- ),
16931
- /* @__PURE__ */ jsxRuntimeExports.jsx(
16932
- "span",
16933
- {
16934
- className: twMerge(
16935
- "absolute bottom-[-40px] right-0 w-10 h-10 rounded-full "
16936
- )
16937
- }
16938
- )
16939
- ] }),
16940
- openSubCollapse && !collapse && activeMainMenu === item.href && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
16941
- /* @__PURE__ */ jsxRuntimeExports.jsx(
16942
- "span",
16943
- {
16944
- className: twMerge(
16945
- "absolute top-[-40px] right-0 w-10 h-10 rounded-full shadow-[24px_24px_0_white]"
16946
- )
16947
- }
16948
- ),
17189
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { role: "list", className: twMerge("-mx-2 space-y-1 relative"), children: menu.map((item) => {
17190
+ const isActive = openSubCollapse || [activeMainMenu, pathUrl].includes(item.href) || collapse;
17191
+ const isActiveUrl = item.href === activeMainMenu || item.href === pathUrl;
17192
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
17193
+ "li",
17194
+ {
17195
+ className: twMerge(
17196
+ "relative cursor-pointer",
17197
+ isActive ? "ml-2" : "ml-0"
17198
+ ),
17199
+ children: [
17200
+ (activeMainMenu === item.href || item.href === pathUrl) && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
17201
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
17202
+ "span",
17203
+ {
17204
+ className: twMerge(
17205
+ "absolute top-[-40px] right-0 w-10 h-10 rounded-full"
17206
+ )
17207
+ }
17208
+ ),
17209
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
17210
+ "span",
17211
+ {
17212
+ className: twMerge(
17213
+ "absolute bottom-[-40px] right-0 w-10 h-10 rounded-full"
17214
+ )
17215
+ }
17216
+ )
17217
+ ] }),
17218
+ (activeMainMenu === item.href || item.href === pathUrl) && !collapse && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
17219
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
17220
+ "span",
17221
+ {
17222
+ className: twMerge(
17223
+ "absolute top-[-40px] right-0 w-10 h-10 rounded-full shadow-[24px_24px_0_white]"
17224
+ )
17225
+ }
17226
+ ),
17227
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
17228
+ "span",
17229
+ {
17230
+ className: twMerge(
17231
+ "absolute bottom-[-40px] right-0 w-10 h-10 rounded-full shadow-[24px_-24px_0_white]"
17232
+ )
17233
+ }
17234
+ )
17235
+ ] }),
16949
17236
  /* @__PURE__ */ jsxRuntimeExports.jsx(
16950
- "span",
17237
+ "div",
16951
17238
  {
16952
17239
  className: twMerge(
16953
- "absolute bottom-[-40px] right-0 w-10 h-10 rounded-full shadow-[24px_-24px_0_white]"
17240
+ "relative group rounded-bl-full rounded-tl-full hover:text-black",
17241
+ !collapse && "hover:bg-[#FFFFFF]"
17242
+ ),
17243
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
17244
+ "a",
17245
+ {
17246
+ onClick: () => {
17247
+ handleActiveMain(item.href);
17248
+ setCollapse(false);
17249
+ setOpenSubCollapse(true);
17250
+ },
17251
+ className: twMerge(
17252
+ isActiveUrl ? "bg-[#FFFFFF] text-black hover:text-black" : "text-[#FFFFFF] hover:bg-[#FFFFFF] hover:text-black",
17253
+ "py-2 rounded-md mt-2 text-sm whitespace-nowrap leading-6 font-semibold relative z-10",
17254
+ collapse ? "pl-4 mr-2 " : "rounded-bl-full rounded-tl-full justify-center",
17255
+ "flex items-center whitespace-nowrap gap-2"
17256
+ ),
17257
+ children: [
17258
+ item.icon,
17259
+ collapse && item.name
17260
+ ]
17261
+ }
16954
17262
  )
16955
17263
  }
16956
17264
  )
16957
- ] }),
16958
- /* @__PURE__ */ jsxRuntimeExports.jsx(
16959
- "div",
16960
- {
16961
- className: twMerge(
16962
- "relative group rounded-bl-full rounded-tl-full hover:text-black",
16963
- !collapse && "hover:bg-[#FFFFFF]"
16964
- ),
16965
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
16966
- "a",
16967
- {
16968
- onClick: () => {
16969
- handleActiveMain(item.href);
16970
- setCollapse(false);
16971
- setOpenSubCollapse(true);
16972
- },
16973
- className: twMerge(
16974
- item.href === activeMainMenu || item.href === pathUrl ? "bg-white text-black hover:text-black" : "text-white hover:bg-[#FFFFFF] hover:text-black",
16975
- "py-2 rounded-md mt-2 text-sm whitespace-nowrap leading-6 font-semibold relative z-10",
16976
- collapse ? "pl-4 mr-2" : "rounded-bl-full rounded-tl-full justify-center",
16977
- "flex items-center gap-2"
16978
- ),
16979
- children: [
16980
- item.icon,
16981
- collapse && item.name
16982
- ]
16983
- }
16984
- )
16985
- }
16986
- )
16987
- ]
16988
- },
16989
- item.name
16990
- )) }),
17265
+ ]
17266
+ },
17267
+ item.name
17268
+ );
17269
+ }) }),
16991
17270
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: twMerge("mt-auto pb-4"), children: /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: bottomMenu.map(
16992
17271
  (bm) => bm.show && /* @__PURE__ */ jsxRuntimeExports.jsx(
16993
17272
  "li",
@@ -17019,7 +17298,7 @@ const Sidebar = ({ children, menu }) => {
17019
17298
  {
17020
17299
  onClick: () => setOpenSubCollapse(false),
17021
17300
  className: twMerge(
17022
- "absolute top-1/19 transform -translate-y-1/2 cursor-pointer bg-white z-10 text-[#3078BD] rounded-full w-10 h-10 flex items-center justify-center shadow transition-all duration-300 left-44 sm:left-40 md:left-48 lg:left-70"
17301
+ "absolute top-1/19 transform -translate-y-1/2 cursor-pointer bg-[#FFFFFF] z-10 text-[#3078BD] rounded-full w-10 h-10 flex items-center justify-center shadow transition-all duration-300 left-44 sm:left-40 md:left-48 lg:left-70"
17023
17302
  ),
17024
17303
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(ForwardRef$2, { className: twMerge("w-4 h-4") })
17025
17304
  }
@@ -17030,7 +17309,7 @@ const Sidebar = ({ children, menu }) => {
17030
17309
  className: twMerge(
17031
17310
  openSubCollapse ? "ml-25" : "ml-0",
17032
17311
  collapse ? "w-17" : "w-50",
17033
- "flex mt-3 flex-col border-gray-200 bg-white h-screen transition-all duration-300"
17312
+ "flex mt-3 flex-col border-gray-200 bg-[#FFFFFF] h-screen transition-all duration-300"
17034
17313
  ),
17035
17314
  children: [
17036
17315
  !collapse && /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -17070,7 +17349,7 @@ const Sidebar = ({ children, menu }) => {
17070
17349
  },
17071
17350
  className: twMerge(
17072
17351
  activeMenu.href === pathUrl ? "bg-[#EEEEF0] text-black" : "text-gray-700 hover:bg-[#EEEEF0]",
17073
- "group flex gap-x-3 rounded-md p-2 mr-8 text-sm leading-6 transition-all duration-300 font-semibold items-center"
17352
+ "group flex gap-x-3 rounded-md p-2 mr-8 text-sm leading-6 transition-all duration-300 font-semibold items-center"
17074
17353
  ),
17075
17354
  children: [
17076
17355
  activeMenu.icon,
@@ -17085,7 +17364,7 @@ const Sidebar = ({ children, menu }) => {
17085
17364
  onClick: () => router(sub.href),
17086
17365
  className: twMerge(
17087
17366
  sub.href === pathUrl ? "bg-[#EEEEF0] text-black" : "",
17088
- "text-xs hover:bg-[#EEEEF0] mr-8 transition-all duration-300 mt-2 rounded-md py-2 flex items-center gap-2 p-2"
17367
+ "text-xs hover:bg-[#EEEEF0] mr-8 transition-all duration-300 mt-2 rounded-md py-2 flex items-center gap-2 p-2"
17089
17368
  ),
17090
17369
  children: [
17091
17370
  sub.icon,
@@ -17106,8 +17385,8 @@ const Sidebar = ({ children, menu }) => {
17106
17385
  "div",
17107
17386
  {
17108
17387
  className: twMerge(
17109
- collapse && openSubCollapse ? "ml-10" : "",
17110
- "flex-1 h-screen bg-[#F8F8F8] p-6 overflow-y-auto scrollbar-none"
17388
+ collapse && openSubCollapse ? "ml-18" : "",
17389
+ "flex-1 h-screen overflow-y-auto scrollbar-none"
17111
17390
  ),
17112
17391
  children
17113
17392
  }
@@ -17307,276 +17586,6 @@ const Image = (props) => {
17307
17586
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Image$1, { ...props });
17308
17587
  };
17309
17588
 
17310
- const ConfirmModal = ({
17311
- title,
17312
- content,
17313
- typeIcon,
17314
- titleCancelBtn = "Huỷ bỏ",
17315
- titleSubmitBtn = "Xác nhận",
17316
- handleCancel,
17317
- handleSubmit,
17318
- ...restProps
17319
- }) => {
17320
- //! State
17321
- const IconType = () => {
17322
- switch (typeIcon) {
17323
- case "success":
17324
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
17325
- "svg",
17326
- {
17327
- xmlns: "http://www.w3.org/2000/svg",
17328
- width: "24",
17329
- height: "24",
17330
- viewBox: "0 0 24 24",
17331
- fill: "none",
17332
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
17333
- "path",
17334
- {
17335
- d: "M12 1.5C6.20156 1.5 1.5 6.20156 1.5 12C1.5 17.7984 6.20156 22.5 12 22.5C17.7984 22.5 22.5 17.7984 22.5 12C22.5 6.20156 17.7984 1.5 12 1.5ZM16.5352 8.57109L11.5992 15.4148C11.5302 15.5111 11.4393 15.5896 11.3339 15.6437C11.2286 15.6978 11.1118 15.7261 10.9934 15.7261C10.8749 15.7261 10.7582 15.6978 10.6528 15.6437C10.5474 15.5896 10.4565 15.5111 10.3875 15.4148L7.46484 11.3648C7.37578 11.2406 7.46484 11.0672 7.61719 11.0672H8.71641C8.95547 11.0672 9.18281 11.182 9.32344 11.3789L10.9922 13.6945L14.6766 8.58516C14.8172 8.39062 15.0422 8.27344 15.2836 8.27344H16.3828C16.5352 8.27344 16.6242 8.44688 16.5352 8.57109Z",
17336
- fill: "#52C41A"
17337
- }
17338
- )
17339
- }
17340
- );
17341
- case "error":
17342
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
17343
- "svg",
17344
- {
17345
- xmlns: "http://www.w3.org/2000/svg",
17346
- width: "24",
17347
- height: "24",
17348
- viewBox: "0 0 24 24",
17349
- fill: "none",
17350
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
17351
- "path",
17352
- {
17353
- d: "M12 1.5C6.20156 1.5 1.5 6.20156 1.5 12C1.5 17.7984 6.20156 22.5 12 22.5C17.7984 22.5 22.5 17.7984 22.5 12C22.5 6.20156 17.7984 1.5 12 1.5ZM15.8766 15.9891L14.3297 15.982L12 13.2047L9.67266 15.9797L8.12344 15.9867C8.02031 15.9867 7.93594 15.9047 7.93594 15.7992C7.93594 15.7547 7.95234 15.7125 7.98047 15.6773L11.0297 12.0445L7.98047 8.41406C7.95215 8.37971 7.93643 8.3367 7.93594 8.29219C7.93594 8.18906 8.02031 8.10469 8.12344 8.10469L9.67266 8.11172L12 10.8891L14.3273 8.11406L15.8742 8.10703C15.9773 8.10703 16.0617 8.18906 16.0617 8.29453C16.0617 8.33906 16.0453 8.38125 16.0172 8.41641L12.9727 12.0469L16.0195 15.6797C16.0477 15.7148 16.0641 15.757 16.0641 15.8016C16.0641 15.9047 15.9797 15.9891 15.8766 15.9891Z",
17354
- fill: "#FF4D4F"
17355
- }
17356
- )
17357
- }
17358
- );
17359
- case "info":
17360
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
17361
- "svg",
17362
- {
17363
- xmlns: "http://www.w3.org/2000/svg",
17364
- width: "24",
17365
- height: "24",
17366
- viewBox: "0 0 24 24",
17367
- fill: "none",
17368
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
17369
- "path",
17370
- {
17371
- d: "M12 1.5C6.20156 1.5 1.5 6.20156 1.5 12C1.5 17.7984 6.20156 22.5 12 22.5C17.7984 22.5 22.5 17.7984 22.5 12C22.5 6.20156 17.7984 1.5 12 1.5ZM12.75 17.0625C12.75 17.1656 12.6656 17.25 12.5625 17.25H11.4375C11.3344 17.25 11.25 17.1656 11.25 17.0625V10.6875C11.25 10.5844 11.3344 10.5 11.4375 10.5H12.5625C12.6656 10.5 12.75 10.5844 12.75 10.6875V17.0625ZM12 9C11.7056 8.99399 11.4253 8.87282 11.2192 8.6625C11.0132 8.45218 10.8977 8.16945 10.8977 7.875C10.8977 7.58055 11.0132 7.29782 11.2192 7.0875C11.4253 6.87718 11.7056 6.75601 12 6.75C12.2944 6.75601 12.5747 6.87718 12.7808 7.0875C12.9868 7.29782 13.1023 7.58055 13.1023 7.875C13.1023 8.16945 12.9868 8.45218 12.7808 8.6625C12.5747 8.87282 12.2944 8.99399 12 9Z",
17372
- fill: "#1677FF"
17373
- }
17374
- )
17375
- }
17376
- );
17377
- case "warning":
17378
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
17379
- "svg",
17380
- {
17381
- xmlns: "http://www.w3.org/2000/svg",
17382
- width: "24",
17383
- height: "24",
17384
- viewBox: "0 0 24 24",
17385
- fill: "none",
17386
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
17387
- "path",
17388
- {
17389
- d: "M12 1.5C6.20156 1.5 1.5 6.20156 1.5 12C1.5 17.7984 6.20156 22.5 12 22.5C17.7984 22.5 22.5 17.7984 22.5 12C22.5 6.20156 17.7984 1.5 12 1.5ZM11.25 6.9375C11.25 6.83437 11.3344 6.75 11.4375 6.75H12.5625C12.6656 6.75 12.75 6.83437 12.75 6.9375V13.3125C12.75 13.4156 12.6656 13.5 12.5625 13.5H11.4375C11.3344 13.5 11.25 13.4156 11.25 13.3125V6.9375ZM12 17.25C11.7056 17.244 11.4253 17.1228 11.2192 16.9125C11.0132 16.7022 10.8977 16.4195 10.8977 16.125C10.8977 15.8305 11.0132 15.5478 11.2192 15.3375C11.4253 15.1272 11.7056 15.006 12 15C12.2944 15.006 12.5747 15.1272 12.7808 15.3375C12.9868 15.5478 13.1023 15.8305 13.1023 16.125C13.1023 16.4195 12.9868 16.7022 12.7808 16.9125C12.5747 17.1228 12.2944 17.244 12 17.25Z",
17390
- fill: "#FAAD14"
17391
- }
17392
- )
17393
- }
17394
- );
17395
- }
17396
- };
17397
- //! Function
17398
- //! Render
17399
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { ...restProps, footer: null, closeIcon: null, width: 400, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
17400
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-3", children: [
17401
- /* @__PURE__ */ jsxRuntimeExports.jsx(IconType, {}),
17402
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
17403
- /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-base font-semibold", children: title }),
17404
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm", children: content })
17405
- ] })
17406
- ] }),
17407
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 w-full justify-end items-end pt-3", children: [
17408
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { shape: "round", onClick: handleCancel, children: titleCancelBtn }),
17409
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { shape: "round", type: "primary", onClick: handleSubmit, children: titleSubmitBtn })
17410
- ] })
17411
- ] }) });
17412
- };
17413
-
17414
- var CATEGORY_LIST_ENUM = /* @__PURE__ */ ((CATEGORY_LIST_ENUM2) => {
17415
- CATEGORY_LIST_ENUM2[CATEGORY_LIST_ENUM2["DRAFT"] = 0] = "DRAFT";
17416
- CATEGORY_LIST_ENUM2[CATEGORY_LIST_ENUM2["WATING_APPROVAL"] = 1] = "WATING_APPROVAL";
17417
- CATEGORY_LIST_ENUM2[CATEGORY_LIST_ENUM2["ACTIVE"] = 2] = "ACTIVE";
17418
- CATEGORY_LIST_ENUM2[CATEGORY_LIST_ENUM2["INACTIVE"] = 3] = "INACTIVE";
17419
- CATEGORY_LIST_ENUM2[CATEGORY_LIST_ENUM2["REJECT"] = 4] = "REJECT";
17420
- CATEGORY_LIST_ENUM2[CATEGORY_LIST_ENUM2["DELETE"] = 5] = "DELETE";
17421
- return CATEGORY_LIST_ENUM2;
17422
- })(CATEGORY_LIST_ENUM || {});
17423
-
17424
- const BulkAction = ({
17425
- quantity,
17426
- handleRestore,
17427
- handleSendApproval,
17428
- handleCancelSendApproval,
17429
- handleRefuseApproval,
17430
- handleApproval,
17431
- handleCancelApproval,
17432
- handleDelete,
17433
- handleActivate,
17434
- handleInActivate,
17435
- status
17436
- }) => {
17437
- //! State
17438
- const listIcon = [
17439
- {
17440
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RestoreIcon, { stroke: "white" }),
17441
- action: handleRestore,
17442
- showConfirmModal: false,
17443
- title: "Khôi phục",
17444
- arrShow: [CATEGORY_LIST_ENUM?.DELETE, CATEGORY_LIST_ENUM?.REJECT]
17445
- },
17446
- {
17447
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(SendApprovalIcon, { stroke: "white" }),
17448
- action: handleSendApproval,
17449
- showConfirmModal: true,
17450
- typeIcon: "info",
17451
- title: "Xác nhận gửi duyệt",
17452
- content: "Bạn có chắc chắn muốn gửi duyệt mục này không?",
17453
- arrShow: [CATEGORY_LIST_ENUM?.DRAFT]
17454
- },
17455
- {
17456
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(CancelSendApprovalIcon, { stroke: "white" }),
17457
- action: handleCancelSendApproval,
17458
- showConfirmModal: true,
17459
- typeIcon: "error",
17460
- title: "Xác nhận hủy gửi duyệt",
17461
- content: "Bạn có chắc chắn muốn hủy gửi duyệt mục này không?",
17462
- arrShow: [CATEGORY_LIST_ENUM?.WATING_APPROVAL]
17463
- },
17464
- {
17465
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefuseApprovalIcon, { stroke: "white" }),
17466
- action: handleRefuseApproval,
17467
- showConfirmModal: true,
17468
- typeIcon: "error",
17469
- title: "Xác nhận từ chối duyệt",
17470
- content: "Bạn có chắc chắn muốn từ chối duyệt mục này không? Hành động này không thể hoàn tác.",
17471
- arrShow: [CATEGORY_LIST_ENUM?.WATING_APPROVAL]
17472
- },
17473
- {
17474
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(ApprovalIcon, { stroke: "white" }),
17475
- action: handleApproval,
17476
- showConfirmModal: true,
17477
- typeIcon: "info",
17478
- title: "Xác nhận duyệt",
17479
- content: "Bạn có chắc chắn muốn duyệt mục này không?",
17480
- arrShow: [CATEGORY_LIST_ENUM?.WATING_APPROVAL]
17481
- },
17482
- {
17483
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(CancelApprovalIcon, { stroke: "white" }),
17484
- action: handleCancelApproval,
17485
- showConfirmModal: true,
17486
- typeIcon: "error",
17487
- title: "Xác nhận hủy duyệt",
17488
- content: "Bạn có chắc chắn muốn hủy duyệt mục này không?",
17489
- arrShow: [CATEGORY_LIST_ENUM?.ACTIVE]
17490
- },
17491
- {
17492
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(DeleteIcon, { fill: "white" }),
17493
- action: handleDelete,
17494
- showConfirmModal: true,
17495
- typeIcon: "error",
17496
- title: "Xác nhận xóa",
17497
- content: "Bạn có chắc chắn muốn xóa mục này không? Hành động này không thể hoàn tác.",
17498
- arrShow: [
17499
- CATEGORY_LIST_ENUM?.DRAFT,
17500
- CATEGORY_LIST_ENUM?.ACTIVE,
17501
- CATEGORY_LIST_ENUM?.INACTIVE
17502
- ]
17503
- },
17504
- {
17505
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(ActivateIcon, { stroke: "white" }),
17506
- action: handleActivate,
17507
- showConfirmModal: true,
17508
- typeIcon: "info",
17509
- title: "Xác nhận kích hoạt",
17510
- content: "Bạn có chắc chắn muốn kích hoạt mục này không?",
17511
- arrShow: [CATEGORY_LIST_ENUM?.INACTIVE]
17512
- },
17513
- {
17514
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(InActiveIcon, { stroke: "white" }),
17515
- action: handleInActivate,
17516
- showConfirmModal: true,
17517
- typeIcon: "info",
17518
- title: "Xác nhận vô hiệu hóa",
17519
- content: "Bạn có chắc chắn muốn vô hiệu hóa mục này không?",
17520
- arrShow: [CATEGORY_LIST_ENUM?.ACTIVE]
17521
- }
17522
- ];
17523
- const [open, setOpen] = useState(false);
17524
- const [notifyContent, setNotifyContent] = useState({
17525
- title: "",
17526
- content: "",
17527
- typeIcon: "info",
17528
- handleCancel: () => {
17529
- },
17530
- handleSubmit: () => {
17531
- }
17532
- });
17533
- //! Function
17534
- const IsShow = (arrStatus) => {
17535
- return arrStatus.includes(status);
17536
- };
17537
- //! Render
17538
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full flex justify-center items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3 px-[10px] py-3 bg-[#2561ED] rounded-lg w-fit", children: [
17539
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-white px-3", children: [
17540
- "Đã chọn: ",
17541
- quantity
17542
- ] }),
17543
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-5 border-l border-white mx-1" }),
17544
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-3", children: listIcon.map(
17545
- (item, index) => IsShow(item?.arrShow) && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { title: item?.title, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
17546
- "button",
17547
- {
17548
- className: "p-1 rounded-sm transition duration-200 cursor-pointer hover:bg-[#1B4ACB] hover:rounded-sm",
17549
- onClick: item?.showConfirmModal ? () => {
17550
- setOpen(true);
17551
- setNotifyContent({
17552
- title: item?.title || "",
17553
- content: item?.content || "",
17554
- typeIcon: item?.typeIcon,
17555
- handleCancel: () => {
17556
- setOpen(false);
17557
- },
17558
- handleSubmit: item?.action
17559
- });
17560
- } : item?.action,
17561
- children: item.icon
17562
- },
17563
- index
17564
- ) })
17565
- ) }),
17566
- /* @__PURE__ */ jsxRuntimeExports.jsx(
17567
- ConfirmModal,
17568
- {
17569
- title: notifyContent?.title,
17570
- content: notifyContent?.content,
17571
- typeIcon: notifyContent?.typeIcon,
17572
- open,
17573
- handleCancel: notifyContent?.handleCancel,
17574
- handleSubmit: notifyContent?.handleSubmit
17575
- }
17576
- )
17577
- ] }) });
17578
- };
17579
-
17580
17589
  class ErrorBoundaryClass extends Component {
17581
17590
  constructor(props) {
17582
17591
  super(props);