@pnkx-lib/ui 1.9.326 → 1.9.328
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.
- package/dist/style.css +1 -1
- package/es/chunks/index-kvqVmred.js +896 -0
- package/es/index.js +1 -2
- package/es/ui/Message.js +14 -0
- package/es/ui/UploadComponent.js +7 -5
- package/es/ui/index.js +9 -898
- package/package.json +1 -1
- package/types/components/ui/Message.d.ts +4 -0
- package/types/components/ui/UploadComponent.d.ts +2 -0
- package/types/components/ui/index.d.ts +1 -0
- package/types/ui/Message.d.ts +2 -0
|
@@ -0,0 +1,896 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useCallback, useEffect, useRef } from 'react';
|
|
3
|
+
import { Select, Input, Pagination, Table as Table$1, Tooltip as Tooltip$1 } from 'antd';
|
|
4
|
+
import { Typography } from '../ui/Typography.js';
|
|
5
|
+
import { TypeStatusTable, TypeActionRowTable, TypeBulkActions } from '../constants/index.js';
|
|
6
|
+
import { Button } from '../ui/Button.js';
|
|
7
|
+
import { Tooltip } from '../ui/Tooltip.js';
|
|
8
|
+
import { ConfirmModal } from '../ui/ConfirmModal.js';
|
|
9
|
+
import { useToggle } from '@pnkx-lib/core';
|
|
10
|
+
import { isEmpty } from 'lodash';
|
|
11
|
+
import { CATEGORY_LIST_ENUM } from '../ui/CategoryStatus.js';
|
|
12
|
+
import { t as twMerge } from './bundle-mjs-BBFHkixS.js';
|
|
13
|
+
import { Popover } from '../ui/Popover.js';
|
|
14
|
+
|
|
15
|
+
const iconTableNoData = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA7dSURBVHgB7Z1bbFTXFYb/PTO+gDFMApgQkngIvRAgwZFKlbRqPK5SqS+VjQQkSithPyQRVArQvFR5sa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k/Y0EZ5o5qStNlQqbKZ7grcZkm2n2t4tg0zSHpvq+Hh6R0WzO6Xfxs6/Pqbxx54aH3dzj07sHxFzu3yopzr5htzV9VtrbNMcUxKq2vouSP1GTZ6VRK5ZH1UyaqWny05lOUQgz5Oi8qM0kxx14YtbTUralrZkusfD096z/5OBcpzH6sVOYOkiftyU/jVcvH077urD8ps35bgWOSS79GRdNkW3fx2m4SEdY3y5e65JOxE7IAoYXYsX7E8zCKHH6/Hspqa/Vwbz9WZau+iLyyeOm1mq60ImG3pahUJzJutZ6sDOBJ5zm/CMluwvwlG8KSKaEymZILX/56iqT4jfQzNCPHXEtRSaNtEGUachaUa876pZciqg3K3L/d3UhUssha4CLDYwuev462YyU3fXswiRJ/Fgo/5o5fP5U5/Fh2QbcKXc/VkQSJrgWcxXoisBZ7luBVZCzwHcCOyFniOoCqyFngOoSKyFniO4VRkLfAcxInIWuA5SkEil+NhLfAcJq/IAi3ztmXnywB/vxR/LUK29/0ScS3wHCeHyHFYiGmB5wEssgXsmfBlKAZ/TZEXX3aimWXwt9FBo9FoNBqNRqPRaDQajUaj0Wg0Go1Go9FoNBqNRqPRaDQajXP+D0/tlZm0R8ESAAAAAElFTkSuQmCC";
|
|
16
|
+
|
|
17
|
+
const { Option } = Select;
|
|
18
|
+
const CustomPagination = ({
|
|
19
|
+
current = 1,
|
|
20
|
+
pageSize = 10,
|
|
21
|
+
total = 0,
|
|
22
|
+
pageSizeOptions = ["10", "50", "100", "150", "200"],
|
|
23
|
+
onChange,
|
|
24
|
+
onShowSizeChange,
|
|
25
|
+
size,
|
|
26
|
+
...rest
|
|
27
|
+
}) => {
|
|
28
|
+
const [jumpValue, setJumpValue] = useState("");
|
|
29
|
+
const showTotal = (total2, range) => `${range[0]}-${range[1]} trên tổng ${total2}`;
|
|
30
|
+
const totalPages = Math.ceil(total / pageSize);
|
|
31
|
+
const handleJump = () => {
|
|
32
|
+
const pageNumber = parseInt(jumpValue);
|
|
33
|
+
if (pageNumber && pageNumber >= 1 && pageNumber <= totalPages && pageNumber !== current) {
|
|
34
|
+
onChange?.(pageNumber, pageSize);
|
|
35
|
+
}
|
|
36
|
+
setJumpValue("");
|
|
37
|
+
};
|
|
38
|
+
const handleJumpKeyPress = (e) => {
|
|
39
|
+
if (e.key === "Enter") {
|
|
40
|
+
handleJump();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const handleJumpInputChange = (e) => {
|
|
44
|
+
const value = e.target.value;
|
|
45
|
+
if (value === "" || /^\d+$/.test(value) && parseInt(value) <= totalPages) {
|
|
46
|
+
setJumpValue(value);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const handleKeyDown = (e) => {
|
|
50
|
+
const allowedKeys = [
|
|
51
|
+
"Backspace",
|
|
52
|
+
"Delete",
|
|
53
|
+
"Tab",
|
|
54
|
+
"Escape",
|
|
55
|
+
"Enter",
|
|
56
|
+
"ArrowLeft",
|
|
57
|
+
"ArrowRight",
|
|
58
|
+
"ArrowUp",
|
|
59
|
+
"ArrowDown"
|
|
60
|
+
];
|
|
61
|
+
if (!allowedKeys.includes(e.key) && !/^[0-9]$/.test(e.key)) {
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between py-2", children: [
|
|
66
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
67
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 pnkx-default-select-container !w-fit !h-fit", children: /* @__PURE__ */ jsx(
|
|
68
|
+
Select,
|
|
69
|
+
{
|
|
70
|
+
value: pageSize.toString(),
|
|
71
|
+
onChange: (value) => {
|
|
72
|
+
const newSize = parseInt(value);
|
|
73
|
+
onShowSizeChange?.(current, newSize);
|
|
74
|
+
},
|
|
75
|
+
size: "small",
|
|
76
|
+
className: "min-w-16",
|
|
77
|
+
popupMatchSelectWidth: true,
|
|
78
|
+
getPopupContainer: (trigger) => trigger.parentElement,
|
|
79
|
+
children: pageSizeOptions.map((option) => /* @__PURE__ */ jsx(Option, { value: option, children: option }, option))
|
|
80
|
+
}
|
|
81
|
+
) }),
|
|
82
|
+
showTotal && /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-600", children: showTotal(total, [
|
|
83
|
+
(current - 1) * pageSize + 1,
|
|
84
|
+
Math.min(current * pageSize, total)
|
|
85
|
+
]) })
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
88
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
89
|
+
/* @__PURE__ */ jsx(Typography.Text, { className: "text-sm text-gray-600 whitespace-nowrap", children: "Xem trang" }),
|
|
90
|
+
/* @__PURE__ */ jsx(
|
|
91
|
+
Input,
|
|
92
|
+
{
|
|
93
|
+
value: jumpValue,
|
|
94
|
+
onChange: handleJumpInputChange,
|
|
95
|
+
onKeyUp: handleJumpKeyPress,
|
|
96
|
+
onKeyDown: handleKeyDown,
|
|
97
|
+
onBlur: handleJump,
|
|
98
|
+
placeholder: current.toString(),
|
|
99
|
+
size: "small",
|
|
100
|
+
className: "text-center w-10! !border-[#bde3ff]",
|
|
101
|
+
type: "text",
|
|
102
|
+
min: 1,
|
|
103
|
+
max: totalPages
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
] }),
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
Pagination,
|
|
109
|
+
{
|
|
110
|
+
current,
|
|
111
|
+
pageSize,
|
|
112
|
+
total,
|
|
113
|
+
onChange,
|
|
114
|
+
size,
|
|
115
|
+
showQuickJumper: false,
|
|
116
|
+
showSizeChanger: false,
|
|
117
|
+
...rest
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
] })
|
|
121
|
+
] });
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const useTableHeightWrapper = (options = {}) => {
|
|
125
|
+
const {
|
|
126
|
+
tableContainerId = "table_content",
|
|
127
|
+
extraOffset = 24,
|
|
128
|
+
// Layout padding bottom mặc định
|
|
129
|
+
minHeight = 200
|
|
130
|
+
} = options;
|
|
131
|
+
const [tableHeight, setTableHeight] = useState(minHeight);
|
|
132
|
+
const calculateTableHeight = useCallback(() => {
|
|
133
|
+
try {
|
|
134
|
+
const viewportHeight = window.innerHeight;
|
|
135
|
+
const layoutWrapper = document.getElementById("layout-wrapper-table");
|
|
136
|
+
if (!layoutWrapper) {
|
|
137
|
+
console.error("Layout wrapper table container not found");
|
|
138
|
+
setTableHeight(minHeight);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const wrapperRect = layoutWrapper.getBoundingClientRect();
|
|
142
|
+
const availableHeight = viewportHeight - wrapperRect.top;
|
|
143
|
+
const tableContainer = document.getElementById(tableContainerId);
|
|
144
|
+
if (!tableContainer) {
|
|
145
|
+
console.error(`Table container "${tableContainerId}" not found`);
|
|
146
|
+
setTableHeight(minHeight);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const directChildren = Array.from(layoutWrapper.children);
|
|
150
|
+
let otherElementsHeight = 0;
|
|
151
|
+
directChildren.forEach((child) => {
|
|
152
|
+
const rect = child.getBoundingClientRect();
|
|
153
|
+
const styles = window.getComputedStyle(child);
|
|
154
|
+
const marginTop = parseInt(styles.marginTop, 10) || 0;
|
|
155
|
+
const marginBottom = parseInt(styles.marginBottom, 10) || 0;
|
|
156
|
+
const totalHeight = rect.height + marginTop + marginBottom;
|
|
157
|
+
const isTableContent = child.id === tableContainerId;
|
|
158
|
+
const isBulkActionTable = child.id === "bulkaction_table";
|
|
159
|
+
if (!isTableContent && !isBulkActionTable) {
|
|
160
|
+
otherElementsHeight += totalHeight;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
const tableStyles = window.getComputedStyle(tableContainer);
|
|
164
|
+
const tablePaddingTop = parseInt(tableStyles.paddingTop, 10) || 0;
|
|
165
|
+
const tablePaddingBottom = parseInt(tableStyles.paddingBottom, 10) || 0;
|
|
166
|
+
const tableHeader = tableContainer.querySelector(".ant-table-header");
|
|
167
|
+
const headerHeight = tableHeader ? tableHeader.getBoundingClientRect().height : 0;
|
|
168
|
+
let paginationHeight = 0;
|
|
169
|
+
const paginationSelectors = [
|
|
170
|
+
".ant-pagination",
|
|
171
|
+
".ant-table-pagination",
|
|
172
|
+
".ant-pagination-mini"
|
|
173
|
+
];
|
|
174
|
+
for (const selector of paginationSelectors) {
|
|
175
|
+
const pagination = tableContainer.querySelector(selector);
|
|
176
|
+
if (pagination) {
|
|
177
|
+
const paginationRect = pagination.getBoundingClientRect();
|
|
178
|
+
const paginationStyles = window.getComputedStyle(pagination);
|
|
179
|
+
const paginationMarginTop = parseInt(paginationStyles.marginTop, 10) || 0;
|
|
180
|
+
const paginationMarginBottom = parseInt(paginationStyles.marginBottom, 10) || 0;
|
|
181
|
+
paginationHeight = paginationRect.height + paginationMarginTop + paginationMarginBottom;
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (paginationHeight === 0) {
|
|
186
|
+
paginationHeight = 44;
|
|
187
|
+
}
|
|
188
|
+
const bulkActionHeight = 0;
|
|
189
|
+
const tableBodyHeight = availableHeight - otherElementsHeight - tablePaddingTop - tablePaddingBottom - headerHeight - paginationHeight - bulkActionHeight - extraOffset;
|
|
190
|
+
const finalHeight = Math.max(tableBodyHeight, minHeight);
|
|
191
|
+
setTableHeight(finalHeight);
|
|
192
|
+
} catch (error) {
|
|
193
|
+
console.error("Error calculating table height:", error);
|
|
194
|
+
setTableHeight(minHeight);
|
|
195
|
+
}
|
|
196
|
+
}, [tableContainerId, extraOffset, minHeight]);
|
|
197
|
+
useEffect(() => {
|
|
198
|
+
const timer = setTimeout(() => {
|
|
199
|
+
calculateTableHeight();
|
|
200
|
+
}, 300);
|
|
201
|
+
const handleResize = () => {
|
|
202
|
+
calculateTableHeight();
|
|
203
|
+
};
|
|
204
|
+
window.addEventListener("resize", handleResize);
|
|
205
|
+
const observer = new MutationObserver((mutations) => {
|
|
206
|
+
let shouldRecalculate = false;
|
|
207
|
+
mutations.forEach((mutation) => {
|
|
208
|
+
if (mutation.type === "childList") {
|
|
209
|
+
shouldRecalculate = true;
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
if (shouldRecalculate) {
|
|
213
|
+
setTimeout(calculateTableHeight, 100);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
const layoutWrapper = document.getElementById("layout-wrapper-table");
|
|
217
|
+
const tableContainer = document.getElementById(tableContainerId);
|
|
218
|
+
if (layoutWrapper) {
|
|
219
|
+
observer.observe(layoutWrapper, {
|
|
220
|
+
childList: true,
|
|
221
|
+
subtree: true,
|
|
222
|
+
attributes: true,
|
|
223
|
+
attributeFilter: ["style", "class"]
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
if (tableContainer && tableContainer !== layoutWrapper) {
|
|
227
|
+
observer.observe(tableContainer, {
|
|
228
|
+
childList: true,
|
|
229
|
+
subtree: true,
|
|
230
|
+
attributes: true,
|
|
231
|
+
attributeFilter: ["style", "class"]
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
return () => {
|
|
235
|
+
clearTimeout(timer);
|
|
236
|
+
window.removeEventListener("resize", handleResize);
|
|
237
|
+
observer.disconnect();
|
|
238
|
+
};
|
|
239
|
+
}, [calculateTableHeight, tableContainerId]);
|
|
240
|
+
return {
|
|
241
|
+
tableHeight,
|
|
242
|
+
recalculate: calculateTableHeight
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
const Table = ({
|
|
247
|
+
dataSource = [],
|
|
248
|
+
columns,
|
|
249
|
+
loading = false,
|
|
250
|
+
totalItems = 100,
|
|
251
|
+
filters,
|
|
252
|
+
onChangePage,
|
|
253
|
+
onChangePageSize,
|
|
254
|
+
onSort,
|
|
255
|
+
rowsSelected,
|
|
256
|
+
onSelect,
|
|
257
|
+
onRowClick,
|
|
258
|
+
rowKey = "id",
|
|
259
|
+
showIndexColumn = true,
|
|
260
|
+
size = "small",
|
|
261
|
+
defaultEllipsis = true,
|
|
262
|
+
onDoubleClickRow,
|
|
263
|
+
handleSubmit,
|
|
264
|
+
...rest
|
|
265
|
+
}) => {
|
|
266
|
+
const status = filters?.status;
|
|
267
|
+
//! State
|
|
268
|
+
const tableContainerRef = useRef(null);
|
|
269
|
+
const rowSelection = {
|
|
270
|
+
selectedRowKeys: rowsSelected,
|
|
271
|
+
onChange: onSelect,
|
|
272
|
+
getCheckboxProps: () => ({
|
|
273
|
+
disabled: status === TypeStatusTable.ALL
|
|
274
|
+
})
|
|
275
|
+
};
|
|
276
|
+
const ellipsisColumns = columns.map((column) => ({
|
|
277
|
+
...column,
|
|
278
|
+
ellipsis: column?.ellipsis !== void 0 ? column?.ellipsis : defaultEllipsis
|
|
279
|
+
}));
|
|
280
|
+
const startIndex = (filters.page - 1) * filters.size;
|
|
281
|
+
const columnsWithIndex = showIndexColumn ? [
|
|
282
|
+
{
|
|
283
|
+
title: "STT",
|
|
284
|
+
dataIndex: "index",
|
|
285
|
+
key: "index",
|
|
286
|
+
width: 70,
|
|
287
|
+
align: "center",
|
|
288
|
+
render: (_, __, index) => startIndex + index + 1
|
|
289
|
+
},
|
|
290
|
+
...ellipsisColumns
|
|
291
|
+
] : ellipsisColumns;
|
|
292
|
+
//! Function
|
|
293
|
+
const renderSizePagination = () => {
|
|
294
|
+
switch (size) {
|
|
295
|
+
case "small":
|
|
296
|
+
return "small";
|
|
297
|
+
// Dạng nhỏ gọn
|
|
298
|
+
default:
|
|
299
|
+
return "default";
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
const handleTableChange = (_pagination, _filters, sorter) => {
|
|
303
|
+
if (sorter && onSort) {
|
|
304
|
+
onSort(sorter);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
const handleOnClickRow = (record, onRowClick2) => (e) => {
|
|
308
|
+
const target = e.target;
|
|
309
|
+
if (target.closest("input") || // ⛔ Checkbox
|
|
310
|
+
target.closest("button") || // ⛔ Button trong row
|
|
311
|
+
target.closest("svg") || // ⛔ Icon
|
|
312
|
+
target.closest(".ant-checkbox") || // ⛔ AntD checkbox
|
|
313
|
+
target.closest("a")) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
onRowClick2?.(record);
|
|
317
|
+
};
|
|
318
|
+
const handleDoubleClickRow = (record, onDoubleClickRow2) => (e) => {
|
|
319
|
+
const target = e.target;
|
|
320
|
+
if (target.closest("input") || // ⛔ Checkbox
|
|
321
|
+
target.closest("button") || // ⛔ Button trong row
|
|
322
|
+
target.closest("svg") || // ⛔ Icon
|
|
323
|
+
target.closest(".ant-checkbox") || // ⛔ AntD checkbox
|
|
324
|
+
target.closest("a")) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
onDoubleClickRow2?.(record);
|
|
328
|
+
};
|
|
329
|
+
const { tableHeight } = useTableHeightWrapper({
|
|
330
|
+
tableContainerId: "table_content",
|
|
331
|
+
// ID của table container
|
|
332
|
+
minHeight: 200
|
|
333
|
+
// chiều cao tối thiểu
|
|
334
|
+
});
|
|
335
|
+
useEffect(() => {
|
|
336
|
+
const scrollToTop = () => {
|
|
337
|
+
if (tableContainerRef.current) {
|
|
338
|
+
const tableBody = tableContainerRef.current.querySelector(".ant-table-body");
|
|
339
|
+
if (tableBody) {
|
|
340
|
+
tableBody.scrollTop = 0;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
const timeoutId = setTimeout(scrollToTop, 0);
|
|
345
|
+
return () => clearTimeout(timeoutId);
|
|
346
|
+
}, [filters.page]);
|
|
347
|
+
const tableContent = /* @__PURE__ */ jsxs(
|
|
348
|
+
"div",
|
|
349
|
+
{
|
|
350
|
+
ref: tableContainerRef,
|
|
351
|
+
id: "table_content",
|
|
352
|
+
className: "bg-[#FFFFFF] p-2 rounded-bl-lg rounded-br-lg",
|
|
353
|
+
children: [
|
|
354
|
+
/* @__PURE__ */ jsx(
|
|
355
|
+
Table$1,
|
|
356
|
+
{
|
|
357
|
+
rowKey,
|
|
358
|
+
dataSource,
|
|
359
|
+
columns: columnsWithIndex,
|
|
360
|
+
pagination: false,
|
|
361
|
+
loading,
|
|
362
|
+
rowSelection: rowsSelected ? rowSelection : void 0,
|
|
363
|
+
onChange: handleTableChange,
|
|
364
|
+
onRow: (record) => ({
|
|
365
|
+
onClick: handleOnClickRow(record, onRowClick),
|
|
366
|
+
onDoubleClick: handleDoubleClickRow(record, onDoubleClickRow)
|
|
367
|
+
}),
|
|
368
|
+
locale: {
|
|
369
|
+
emptyText: loading ? null : /* @__PURE__ */ jsx(EmptyTable, {})
|
|
370
|
+
},
|
|
371
|
+
scroll: { y: tableHeight },
|
|
372
|
+
size,
|
|
373
|
+
...rest,
|
|
374
|
+
className: "table-scroll-bar"
|
|
375
|
+
}
|
|
376
|
+
),
|
|
377
|
+
/* @__PURE__ */ jsx(
|
|
378
|
+
CustomPagination,
|
|
379
|
+
{
|
|
380
|
+
current: filters?.page,
|
|
381
|
+
pageSize: filters?.size,
|
|
382
|
+
total: totalItems,
|
|
383
|
+
onChange: (page) => onChangePage(page),
|
|
384
|
+
onShowSizeChange: (_, size2) => onChangePageSize(size2),
|
|
385
|
+
size: renderSizePagination()
|
|
386
|
+
}
|
|
387
|
+
)
|
|
388
|
+
]
|
|
389
|
+
}
|
|
390
|
+
);
|
|
391
|
+
const renderTable = () => {
|
|
392
|
+
if (handleSubmit) {
|
|
393
|
+
return /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, children: tableContent });
|
|
394
|
+
}
|
|
395
|
+
return tableContent;
|
|
396
|
+
};
|
|
397
|
+
//! Render
|
|
398
|
+
return renderTable();
|
|
399
|
+
};
|
|
400
|
+
const EmptyTable = () => {
|
|
401
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center text-center", children: [
|
|
402
|
+
/* @__PURE__ */ jsx("img", { src: iconTableNoData, alt: "no data" }),
|
|
403
|
+
/* @__PURE__ */ jsx("span", { className: "text-lg font-bold text-black", children: "Không có dữ liệu nào phù hợp" }),
|
|
404
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-500", children: "Kiểm tra lại bộ lọc hoặc thêm mới dữ liệu" })
|
|
405
|
+
] });
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
const EditIcon = ({ stroke, fill = "#007BE5" }) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 14, height: 15, fill: "none", children: /* @__PURE__ */ jsx(
|
|
409
|
+
"path",
|
|
410
|
+
{
|
|
411
|
+
fill,
|
|
412
|
+
stroke,
|
|
413
|
+
d: "m1.177 11.137.711.237-.711-.237ZM1.8 9.264l-.712-.238.712.238Zm.644-1.043.53.53-.53-.53ZM8.667 2l-.53-.53.53.53ZM12 5.333l.53.53-.53-.53Zm-6.222 6.222-.53-.53.53.53Zm-1.042.644.237.711-.237-.711Zm-1.873.624.237.712-.237-.712Zm2.574-.95-.452-.598.452.599Zm-.263.163-.333-.672.333.672Zm7.629-9.11-.672.333.672-.333Zm0 1.48-.672-.333.672.333Zm-3.21-3.21.333.673-.333-.672Zm1.48 0-.333.673.333-.672Zm-9.11 7.63.673.333-.672-.333Zm.163-.263-.599-.452.6.452Zm-1.26 4.066-.706.252.706-.252Zm.505.505-.252.706.252-.706ZM8.364 2.303a.75.75 0 0 0-1.061 1.06l1.06-1.06Zm2.272 4.394a.75.75 0 0 0 1.061-1.06l-1.06 1.06ZM7 12.917a.75.75 0 0 0 0 1.5v-1.5Zm5.833 1.5a.75.75 0 0 0 0-1.5v1.5Zm-11.656-3.28.711.237.624-1.873-.711-.237-.712-.238L.465 10.9l.712.238ZM2.445 8.22l.53.53 6.222-6.22L8.667 2l-.53-.53-6.222 6.22.53.531ZM12 5.333l-.53-.53-6.222 6.221.53.53.53.53 6.222-6.22-.53-.53ZM4.736 12.2l-.237-.712-1.873.625.237.711.237.712 1.873-.625-.237-.711Zm1.042-.644-.53-.53c-.18.18-.222.219-.263.25l.452.599.451.598c.144-.108.269-.235.42-.387l-.53-.53Zm-1.042.644.237.711c.204-.068.373-.122.535-.202l-.334-.672-.333-.672c-.047.023-.1.043-.342.123l.237.712Zm.7-.325-.451-.6a.92.92 0 0 1-.144.09l.333.672.334.672c.134-.067.261-.146.38-.236l-.451-.598ZM12 2l-.53.53c.497.497.608.622.661.73l.672-.334.672-.333c-.19-.383-.533-.712-.945-1.124L12 2Zm0 3.333.53.53c.412-.411.755-.74.945-1.124l-.672-.333-.672-.333c-.053.107-.164.233-.661.73l.53.53Zm.803-2.407-.672.333a.917.917 0 0 1 0 .814l.672.333.672.333a2.417 2.417 0 0 0 0-2.146l-.672.333ZM8.667 2l.53.53c.497-.497.622-.608.73-.661l-.334-.672L9.26.525c-.383.19-.712.533-1.124.944l.53.53ZM12 2l.53-.53c-.411-.412-.74-.755-1.124-.945l-.333.672-.333.672c.107.053.232.164.73.661L12 2Zm-2.407-.803.333.672a.917.917 0 0 1 .814 0l.333-.672.333-.672a2.417 2.417 0 0 0-2.146 0l.333.672ZM1.801 9.264l.711.237c.081-.242.1-.295.124-.342l-.672-.333-.672-.334c-.08.161-.135.33-.203.534l.712.238Zm.644-1.043-.53-.53c-.152.152-.279.276-.388.42l.6.452.598.452a2.99 2.99 0 0 1 .25-.263l-.53-.53Zm-.481.605.672.333c.025-.05.055-.1.089-.144l-.599-.452-.599-.452c-.09.12-.168.247-.235.381l.672.334Zm-.787 2.31L.465 10.9c-.13.393-.246.737-.312 1.016-.063.267-.118.617.007.966l.706-.252.706-.252c.028.078-.007.088.041-.119.046-.196.135-.463.275-.884l-.711-.237Zm1.686 1.687-.237-.711c-.421.14-.688.228-.884.274-.208.049-.197.014-.12.041l-.251.707-.252.706c.349.124.698.07.966.007.278-.066.622-.181 1.015-.312l-.237-.712ZM.866 12.63l-.706.252c.16.447.511.8.96.96l.251-.707.252-.707a.083.083 0 0 1-.05-.05l-.707.252Zm6.967-9.796-.53.53 3.333 3.334.53-.53.531-.53-3.333-3.334-.53.53ZM7 13.666v.75h5.833v-1.5H7v.75Z"
|
|
414
|
+
}
|
|
415
|
+
) });
|
|
416
|
+
|
|
417
|
+
const RestoreIcon = ({ stroke, fill }) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 22, height: 22, fill: "none", children: /* @__PURE__ */ jsx(
|
|
418
|
+
"path",
|
|
419
|
+
{
|
|
420
|
+
stroke,
|
|
421
|
+
fill,
|
|
422
|
+
strokeLinecap: "round",
|
|
423
|
+
strokeLinejoin: "round",
|
|
424
|
+
strokeWidth: 1.5,
|
|
425
|
+
d: "M3.405 6.611a8.824 8.824 0 0 1 7.64-4.388c3.701 0 6.87 2.269 8.179 5.486m-13.14 0h-4.41V3.32m16.92 12.069a8.824 8.824 0 0 1-7.64 4.388 8.822 8.822 0 0 1-8.178-5.486m13.14 0h4.41v4.389"
|
|
426
|
+
}
|
|
427
|
+
) });
|
|
428
|
+
|
|
429
|
+
const SendApprovalIcon = ({ stroke, fill }) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 22, height: 22, fill: "none", children: /* @__PURE__ */ jsx(
|
|
430
|
+
"path",
|
|
431
|
+
{
|
|
432
|
+
fill,
|
|
433
|
+
stroke,
|
|
434
|
+
strokeLinecap: "round",
|
|
435
|
+
strokeWidth: 1.714,
|
|
436
|
+
d: "M6.44 11h4.45m-4.584-.521L2.912 4.37c-.513-.922.474-1.953 1.419-1.481l14.304 7.15a1.073 1.073 0 0 1 0 1.92L4.33 19.11c-.945.472-1.932-.559-1.42-1.482l3.395-6.107c.18-.324.18-.718 0-1.042Z"
|
|
437
|
+
}
|
|
438
|
+
) });
|
|
439
|
+
|
|
440
|
+
const CancelSendApprovalIcon = ({ fill, stroke }) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 22, height: 22, fill: "none", children: /* @__PURE__ */ jsx(
|
|
441
|
+
"path",
|
|
442
|
+
{
|
|
443
|
+
fill,
|
|
444
|
+
stroke,
|
|
445
|
+
strokeLinecap: "round",
|
|
446
|
+
strokeWidth: 1.5,
|
|
447
|
+
d: "M12.829 7.343 9.17 14.657M20.143 11a9.143 9.143 0 1 1-18.286 0 9.143 9.143 0 0 1 18.286 0Z"
|
|
448
|
+
}
|
|
449
|
+
) });
|
|
450
|
+
|
|
451
|
+
const ApprovalIcon = ({ stroke, fill }) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 22, height: 22, fill: "none", children: /* @__PURE__ */ jsx(
|
|
452
|
+
"path",
|
|
453
|
+
{
|
|
454
|
+
fill,
|
|
455
|
+
stroke,
|
|
456
|
+
strokeLinecap: "round",
|
|
457
|
+
strokeWidth: 1.714,
|
|
458
|
+
d: "m15.33 6.429-8.667 8.89a.827.827 0 0 1-1.19 0L1.856 11.61m9.618 3.707 8.668-8.89"
|
|
459
|
+
}
|
|
460
|
+
) });
|
|
461
|
+
|
|
462
|
+
const CancelApprovalIcon = ({ stroke, fill }) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 22, height: 22, fill: "none", children: /* @__PURE__ */ jsx(
|
|
463
|
+
"path",
|
|
464
|
+
{
|
|
465
|
+
fill,
|
|
466
|
+
stroke,
|
|
467
|
+
strokeLinecap: "round",
|
|
468
|
+
strokeWidth: 1.5,
|
|
469
|
+
d: "M13.743 8.257 11 11m0 0-2.743 2.743M11 11l2.743 2.743M11 11 8.257 8.257M20.143 11a9.143 9.143 0 1 1-18.286 0 9.143 9.143 0 0 1 18.286 0Z"
|
|
470
|
+
}
|
|
471
|
+
) });
|
|
472
|
+
|
|
473
|
+
const RefuseApprovalIcon = ({ stroke, fill }) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: 22, height: 22, fill: "none", children: [
|
|
474
|
+
/* @__PURE__ */ jsx("mask", { id: "a", fill: "#fff", children: /* @__PURE__ */ jsx("path", { d: "M11 2.086A8.914 8.914 0 1 0 19.914 11 8.924 8.924 0 0 0 11 2.086ZM18.543 11a7.505 7.505 0 0 1-1.75 4.824L6.176 5.206A7.543 7.543 0 0 1 18.543 11ZM3.457 11a7.505 7.505 0 0 1 1.75-4.824l10.617 10.618A7.544 7.544 0 0 1 3.457 11Z" }) }),
|
|
475
|
+
/* @__PURE__ */ jsx(
|
|
476
|
+
"path",
|
|
477
|
+
{
|
|
478
|
+
fill: "#fff",
|
|
479
|
+
d: "M11 2.086A8.914 8.914 0 1 0 19.914 11 8.924 8.924 0 0 0 11 2.086ZM18.543 11a7.505 7.505 0 0 1-1.75 4.824L6.176 5.206A7.543 7.543 0 0 1 18.543 11ZM3.457 11a7.505 7.505 0 0 1 1.75-4.824l10.617 10.618A7.544 7.544 0 0 1 3.457 11Z"
|
|
480
|
+
}
|
|
481
|
+
),
|
|
482
|
+
/* @__PURE__ */ jsx(
|
|
483
|
+
"path",
|
|
484
|
+
{
|
|
485
|
+
fill,
|
|
486
|
+
stroke,
|
|
487
|
+
d: "m11 2.086.002-1.714H11v1.714ZM19.914 11h1.715v-.002L19.914 11Zm-1.371 0-1.714.001h1.714Zm-1.75 4.824-1.212 1.212 1.325 1.325 1.202-1.437-1.315-1.1ZM6.176 5.206 5.08 3.888 3.635 5.089l1.329 1.329 1.212-1.212ZM3.457 11h1.714v-.002L3.457 11Zm1.75-4.824 1.212-1.212-1.325-1.325-1.202 1.437 1.315 1.1Zm10.617 10.618 1.096 1.318 1.445-1.201-1.329-1.329-1.212 1.212ZM11 2.086V.372c-2.102 0-4.157.623-5.905 1.79l.952 1.426L7 5.014A7.2 7.2 0 0 1 11 3.8V2.086ZM6.047 3.588l-.952-1.425a10.629 10.629 0 0 0-3.915 4.77l1.584.656 1.584.656A7.2 7.2 0 0 1 7 5.014l-.953-1.426Zm-3.283 4L1.18 6.934a10.629 10.629 0 0 0-.604 6.14l1.681-.334 1.681-.334a7.2 7.2 0 0 1 .41-4.16l-1.584-.656Zm-.507 5.151-1.681.335a10.628 10.628 0 0 0 2.908 5.442l1.213-1.212 1.212-1.213a7.2 7.2 0 0 1-1.97-3.686l-1.682.334Zm2.44 4.564-1.213 1.213a10.628 10.628 0 0 0 5.442 2.908l.335-1.68.334-1.682a7.201 7.201 0 0 1-3.686-1.97l-1.212 1.212Zm4.564 2.44-.335 1.681c2.062.41 4.2.2 6.141-.604l-.656-1.584-.656-1.584a7.2 7.2 0 0 1-4.16.41l-.334 1.681Zm5.15-.507.656 1.584a10.628 10.628 0 0 0 4.77-3.915l-1.425-.952L16.987 15a7.2 7.2 0 0 1-3.232 2.652l.656 1.584Zm4-3.283 1.426.952A10.628 10.628 0 0 0 21.63 11H18.2a7.2 7.2 0 0 1-1.213 4l1.425.953ZM19.915 11l1.715-.002a10.638 10.638 0 0 0-3.116-7.51L17.3 4.7l-1.213 1.212a7.21 7.21 0 0 1 2.112 5.09L19.914 11Zm-2.613-6.3 1.212-1.213A10.638 10.638 0 0 0 11.002.372L11 2.086 10.998 3.8a7.21 7.21 0 0 1 5.09 2.112L17.301 4.7Zm1.242 6.3-1.714.002a5.79 5.79 0 0 1-1.35 3.722l1.314 1.1 1.315 1.1a9.22 9.22 0 0 0 2.15-5.926L18.542 11Zm-1.75 4.824 1.213-1.212L7.388 3.994 6.176 5.206 4.964 6.418 15.58 17.036l1.212-1.212ZM6.176 5.206l1.096 1.318a5.828 5.828 0 0 1 2.985-1.3l-.219-1.7-.219-1.701a9.257 9.257 0 0 0-4.74 2.065l1.097 1.318Zm3.862-1.683.219 1.7a5.828 5.828 0 0 1 3.216.503l.727-1.552.728-1.552a9.257 9.257 0 0 0-5.109-.8l.22 1.701Zm4.162.651-.727 1.552a5.829 5.829 0 0 1 2.445 2.15l1.446-.92 1.447-.92a9.257 9.257 0 0 0-3.883-3.414L14.2 4.174Zm3.164 2.782-1.446.92c.594.934.91 2.018.91 3.125h1.715l1.714-.002a9.257 9.257 0 0 0-1.447-4.964l-1.446.92ZM3.457 11l1.714-.002a5.79 5.79 0 0 1 1.35-3.722l-1.314-1.1-1.315-1.1a9.22 9.22 0 0 0-2.15 5.926L3.458 11Zm1.75-4.824L3.994 7.388l10.618 10.618 1.212-1.212 1.212-1.212L6.42 4.964 5.207 6.176Zm10.617 10.618-1.096-1.318a5.828 5.828 0 0 1-2.985 1.3l.219 1.701.219 1.7a9.257 9.257 0 0 0 4.74-2.065l-1.097-1.318Zm-3.862 1.683-.219-1.7a5.829 5.829 0 0 1-3.216-.503L7.8 17.826l-.728 1.552a9.257 9.257 0 0 0 5.109.8l-.22-1.7Zm-4.162-.65.727-1.553a5.83 5.83 0 0 1-2.445-2.15l-1.446.92-1.447.92a9.257 9.257 0 0 0 3.883 3.414l.728-1.552Zm-3.164-2.782 1.446-.92a5.829 5.829 0 0 1-.91-3.126L3.456 11l-1.714.001a9.257 9.257 0 0 0 1.446 4.964l1.447-.92Z",
|
|
488
|
+
mask: "url(#a)"
|
|
489
|
+
}
|
|
490
|
+
)
|
|
491
|
+
] });
|
|
492
|
+
|
|
493
|
+
const ActivateIcon = ({ stroke, fill }) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 22, height: 22, fill: "none", children: /* @__PURE__ */ jsx(
|
|
494
|
+
"path",
|
|
495
|
+
{
|
|
496
|
+
fill,
|
|
497
|
+
stroke,
|
|
498
|
+
strokeLinecap: "round",
|
|
499
|
+
strokeWidth: 1.714,
|
|
500
|
+
d: "M14.657 8.257V6.43a3.657 3.657 0 0 0-6.076-2.743M7.526 19.229h6.948c1.024 0 1.536 0 1.927-.2.345-.175.624-.455.8-.799.199-.391.199-.903.199-1.927v-5.12c0-1.024 0-1.536-.2-1.928a1.83 1.83 0 0 0-.799-.799c-.39-.199-.903-.199-1.927-.199H7.526c-1.025 0-1.537 0-1.928.2a1.829 1.829 0 0 0-.799.798c-.2.392-.2.904-.2 1.928v5.12c0 1.024 0 1.536.2 1.927.175.344.455.624.8.8.39.198.902.198 1.927.198Z"
|
|
501
|
+
}
|
|
502
|
+
) });
|
|
503
|
+
|
|
504
|
+
const DeleteIcon = ({ stroke, fill = "#DD4338" }) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 23, height: 24, fill: "none", children: /* @__PURE__ */ jsx(
|
|
505
|
+
"path",
|
|
506
|
+
{
|
|
507
|
+
fill,
|
|
508
|
+
stroke,
|
|
509
|
+
d: "m18.219 17.634.75.006-.75-.006ZM4.319 5.65a.75.75 0 1 0 0 1.5v-1.5Zm14.934 1.5a.75.75 0 0 0 0-1.5v1.5Zm-8.584 2.984a.75.75 0 1 0-1.5 0h1.5ZM9.17 17.6a.75.75 0 0 0 1.5 0h-1.5Zm5.234-7.466a.75.75 0 1 0-1.5 0h1.5Zm-1.5 7.466a.75.75 0 0 0 1.5 0h-1.5Zm5.416-11.2-.75-.006-.1 11.233.75.007.75.006.1-11.233-.75-.007Zm-3.833 14.934v-.75h-5.5v1.5h5.5v-.75ZM5.253 6.4h-.75v11.2h1.5V6.4h-.75Zm-.934 0v.75h.934v-1.5h-.934v.75Zm.934 0v.75h2.8v-1.5h-2.8v.75Zm2.8 0v.75h7.466v-1.5H8.053v.75Zm7.466 0v.75h2.8v-1.5h-2.8v.75Zm2.8 0v.75h.934v-1.5h-.934v.75ZM8.053 5.985h.75c0-1.338 1.25-2.568 2.983-2.568v-1.5c-2.39 0-4.483 1.74-4.483 4.068h.75Zm3.733-3.318v.75c1.733 0 2.983 1.23 2.983 2.568h1.5c0-2.327-2.092-4.068-4.483-4.068v.75ZM8.053 5.985h-.75V6.4h1.5v-.415h-.75Zm7.466 0h-.75V6.4h1.5v-.415h-.75ZM8.986 21.334v-.75A2.983 2.983 0 0 1 6.003 17.6h-1.5a4.483 4.483 0 0 0 4.483 4.484v-.75Zm9.233-3.7-.75-.007a2.983 2.983 0 0 1-2.983 2.957v1.5a4.483 4.483 0 0 0 4.483-4.444l-.75-.006Zm-8.3-7.5h-.75V17.6h1.5v-7.466h-.75Zm3.734 0h-.75V17.6h1.5v-7.466h-.75Z"
|
|
510
|
+
}
|
|
511
|
+
) });
|
|
512
|
+
|
|
513
|
+
const InActiveIcon = ({ stroke, fill }) => /* @__PURE__ */ jsx(
|
|
514
|
+
"svg",
|
|
515
|
+
{
|
|
516
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
517
|
+
width: 22,
|
|
518
|
+
height: 22,
|
|
519
|
+
fill: "none",
|
|
520
|
+
children: /* @__PURE__ */ jsx(
|
|
521
|
+
"path",
|
|
522
|
+
{
|
|
523
|
+
fill,
|
|
524
|
+
stroke,
|
|
525
|
+
strokeLinecap: "round",
|
|
526
|
+
strokeWidth: 1.714,
|
|
527
|
+
d: "M7.343 8.257V6.43a3.657 3.657 0 0 1 7.314 0v1.828M7.526 19.23h6.948c1.024 0 1.536 0 1.927-.2.345-.175.624-.455.8-.799.199-.391.199-.903.199-1.927v-5.12c0-1.024 0-1.536-.2-1.928a1.83 1.83 0 0 0-.799-.799c-.39-.199-.903-.199-1.927-.199H7.526c-1.025 0-1.537 0-1.928.2a1.829 1.829 0 0 0-.799.798c-.2.392-.2.904-.2 1.928v5.12c0 1.024 0 1.536.2 1.927.175.344.455.624.8.8.39.198.902.198 1.927.198Z"
|
|
528
|
+
}
|
|
529
|
+
)
|
|
530
|
+
}
|
|
531
|
+
);
|
|
532
|
+
|
|
533
|
+
const MoreIcon = ({ stroke, fill }) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 18, height: 18, fill: "none", children: /* @__PURE__ */ jsx(
|
|
534
|
+
"path",
|
|
535
|
+
{
|
|
536
|
+
fill,
|
|
537
|
+
stroke,
|
|
538
|
+
fillRule: "evenodd",
|
|
539
|
+
d: "M4 8h2v2H4V8Zm4 0h2v2H8V8Zm4 0h2v2h-2V8Z",
|
|
540
|
+
clipRule: "evenodd"
|
|
541
|
+
}
|
|
542
|
+
) });
|
|
543
|
+
|
|
544
|
+
const ActionRowTable = ({
|
|
545
|
+
type,
|
|
546
|
+
contentTooltip,
|
|
547
|
+
handleClick
|
|
548
|
+
}) => {
|
|
549
|
+
//! State
|
|
550
|
+
const {
|
|
551
|
+
shouldRender: shouldRenderDelete,
|
|
552
|
+
open: openDelete,
|
|
553
|
+
toggle: toggleDelete
|
|
554
|
+
} = useToggle();
|
|
555
|
+
//! Function
|
|
556
|
+
const handleDelete = () => {
|
|
557
|
+
handleClick?.();
|
|
558
|
+
toggleDelete();
|
|
559
|
+
};
|
|
560
|
+
const renderAction = () => {
|
|
561
|
+
switch (type) {
|
|
562
|
+
case TypeActionRowTable.EDIT:
|
|
563
|
+
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Tooltip, { title: contentTooltip, children: /* @__PURE__ */ jsx(
|
|
564
|
+
Button,
|
|
565
|
+
{
|
|
566
|
+
onClick: handleClick,
|
|
567
|
+
type: "text",
|
|
568
|
+
className: "cursor-pointer",
|
|
569
|
+
shape: "circle",
|
|
570
|
+
icon: /* @__PURE__ */ jsx(EditIcon, { fill: "#007BE5" })
|
|
571
|
+
}
|
|
572
|
+
) }) });
|
|
573
|
+
case TypeActionRowTable.DELETE:
|
|
574
|
+
return /* @__PURE__ */ jsx(Tooltip, { title: contentTooltip, children: /* @__PURE__ */ jsx(
|
|
575
|
+
Button,
|
|
576
|
+
{
|
|
577
|
+
onClick: toggleDelete,
|
|
578
|
+
type: "text",
|
|
579
|
+
className: "cursor-pointer",
|
|
580
|
+
shape: "circle",
|
|
581
|
+
icon: /* @__PURE__ */ jsx(DeleteIcon, { fill: "#DD4338" })
|
|
582
|
+
}
|
|
583
|
+
) });
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
//! Render
|
|
587
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
588
|
+
shouldRenderDelete && /* @__PURE__ */ jsx(
|
|
589
|
+
ConfirmModal,
|
|
590
|
+
{
|
|
591
|
+
title: "Xác nhận xóa",
|
|
592
|
+
content: "Bạn có chắc chắn muốn xóa không? Hành động này không thể hoàn tác.",
|
|
593
|
+
typeIcon: "error",
|
|
594
|
+
open: openDelete,
|
|
595
|
+
handleCancel: toggleDelete,
|
|
596
|
+
handleSubmit: handleDelete
|
|
597
|
+
}
|
|
598
|
+
),
|
|
599
|
+
renderAction()
|
|
600
|
+
] });
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
const BulkAction = ({
|
|
604
|
+
quantity = 0,
|
|
605
|
+
listIcon,
|
|
606
|
+
status,
|
|
607
|
+
setNotifyContent,
|
|
608
|
+
toggle
|
|
609
|
+
}) => {
|
|
610
|
+
//! State
|
|
611
|
+
//! Function
|
|
612
|
+
const IsShow = (arrStatus) => {
|
|
613
|
+
return arrStatus.includes(status);
|
|
614
|
+
};
|
|
615
|
+
//! Render
|
|
616
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full flex justify-center items-center", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-[10px] py-3 bg-[#2561ED] rounded-lg w-fit", children: [
|
|
617
|
+
/* @__PURE__ */ jsxs("div", { className: "text-white px-3", children: [
|
|
618
|
+
"Đã chọn: ",
|
|
619
|
+
quantity
|
|
620
|
+
] }),
|
|
621
|
+
/* @__PURE__ */ jsx("div", { className: "h-5 border-l border-white mx-1" }),
|
|
622
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center space-x-3", children: !isEmpty(listIcon) && listIcon?.map(
|
|
623
|
+
(item, index) => IsShow(item?.arrShow) && /* @__PURE__ */ jsx(Tooltip, { title: item?.name, children: /* @__PURE__ */ jsx(
|
|
624
|
+
"button",
|
|
625
|
+
{
|
|
626
|
+
className: "p-1 rounded-sm transition duration-200 cursor-pointer hover:bg-[#1B4ACB] hover:rounded-sm",
|
|
627
|
+
onClick: () => {
|
|
628
|
+
toggle();
|
|
629
|
+
setNotifyContent({
|
|
630
|
+
title: item?.title || "",
|
|
631
|
+
content: item?.content || "",
|
|
632
|
+
typeIcon: item?.typeIcon,
|
|
633
|
+
handleCancel: () => {
|
|
634
|
+
toggle();
|
|
635
|
+
},
|
|
636
|
+
handleSubmit: () => {
|
|
637
|
+
if (item?.action) {
|
|
638
|
+
item?.action();
|
|
639
|
+
}
|
|
640
|
+
toggle();
|
|
641
|
+
}
|
|
642
|
+
});
|
|
643
|
+
},
|
|
644
|
+
children: item.icon
|
|
645
|
+
},
|
|
646
|
+
index
|
|
647
|
+
) })
|
|
648
|
+
) })
|
|
649
|
+
] }) });
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
const DropListActions = ({
|
|
653
|
+
listIcon,
|
|
654
|
+
status,
|
|
655
|
+
setNotifyContent,
|
|
656
|
+
toggle
|
|
657
|
+
}) => {
|
|
658
|
+
//! State
|
|
659
|
+
//! Function
|
|
660
|
+
const IsShow = (arrStatus) => {
|
|
661
|
+
return arrStatus.includes(status);
|
|
662
|
+
};
|
|
663
|
+
const renderContentPopover = () => {
|
|
664
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: !isEmpty(listIcon) && listIcon?.map(
|
|
665
|
+
(item, index) => item?.showTitle && IsShow(item?.arrShow) && /* @__PURE__ */ jsxs(
|
|
666
|
+
"button",
|
|
667
|
+
{
|
|
668
|
+
className: twMerge(
|
|
669
|
+
"flex gap-4 px-3 py-2 rounded-sm transition duration-200 hover:rounded-sm",
|
|
670
|
+
IsShow(item?.arrShow) ? "hover:bg-[#F5F6F7] cursor-pointer" : "text-[#B2B7C2] cursor-not-allowed"
|
|
671
|
+
),
|
|
672
|
+
disabled: IsShow(item?.arrShow) ? false : true,
|
|
673
|
+
onClick: () => {
|
|
674
|
+
toggle();
|
|
675
|
+
setNotifyContent({
|
|
676
|
+
title: item?.title || "",
|
|
677
|
+
content: item?.content || "",
|
|
678
|
+
typeIcon: item?.typeIcon,
|
|
679
|
+
handleCancel: () => {
|
|
680
|
+
toggle();
|
|
681
|
+
},
|
|
682
|
+
handleSubmit: () => {
|
|
683
|
+
if (item?.action) {
|
|
684
|
+
item?.action();
|
|
685
|
+
}
|
|
686
|
+
toggle();
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
},
|
|
690
|
+
children: [
|
|
691
|
+
item.iconDropList,
|
|
692
|
+
/* @__PURE__ */ jsx("span", { children: item.name || "" })
|
|
693
|
+
]
|
|
694
|
+
},
|
|
695
|
+
index
|
|
696
|
+
)
|
|
697
|
+
) });
|
|
698
|
+
};
|
|
699
|
+
//! Render
|
|
700
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full flex justify-center items-center", children: /* @__PURE__ */ jsx(Tooltip$1, { title: "Thao tác khác", children: /* @__PURE__ */ jsx(
|
|
701
|
+
Popover,
|
|
702
|
+
{
|
|
703
|
+
placement: "bottom",
|
|
704
|
+
content: renderContentPopover(),
|
|
705
|
+
trigger: "click",
|
|
706
|
+
children: /* @__PURE__ */ jsx("div", { className: "p-1 border-[#BDE3FF] rounded-full border cursor-pointer", children: /* @__PURE__ */ jsx(MoreIcon, { fill: "#007BE5" }) })
|
|
707
|
+
}
|
|
708
|
+
) }) });
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
const BulkActions = ({
|
|
712
|
+
quantity = 0,
|
|
713
|
+
handleDelete,
|
|
714
|
+
handleSubmitForApproval,
|
|
715
|
+
handleCancelSubmission,
|
|
716
|
+
handleApprove,
|
|
717
|
+
handleCancelApproval,
|
|
718
|
+
handleReject,
|
|
719
|
+
handleDeactivate,
|
|
720
|
+
handleActivate,
|
|
721
|
+
handleRestore,
|
|
722
|
+
status,
|
|
723
|
+
typeBulkaction,
|
|
724
|
+
isApproved = false
|
|
725
|
+
// Chỉ sử dụng khi là danh sách icon
|
|
726
|
+
}) => {
|
|
727
|
+
//! State
|
|
728
|
+
const listIcon = [
|
|
729
|
+
{
|
|
730
|
+
icon: /* @__PURE__ */ jsx(RestoreIcon, { stroke: "white" }),
|
|
731
|
+
iconDropList: /* @__PURE__ */ jsx(RestoreIcon, { stroke: "#0F1D40" }),
|
|
732
|
+
iconDisable: /* @__PURE__ */ jsx(RestoreIcon, { stroke: "#B2B7C2" }),
|
|
733
|
+
action: handleRestore,
|
|
734
|
+
name: "Khôi phục",
|
|
735
|
+
typeIcon: "info",
|
|
736
|
+
title: "Xác nhận khôi phục",
|
|
737
|
+
content: "Bạn có chắc chắn muốn khôi phục không?",
|
|
738
|
+
arrShow: [CATEGORY_LIST_ENUM?.DELETE, CATEGORY_LIST_ENUM?.REJECT],
|
|
739
|
+
showTitle: true
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
icon: /* @__PURE__ */ jsx(SendApprovalIcon, { stroke: "white" }),
|
|
743
|
+
iconDropList: /* @__PURE__ */ jsx(SendApprovalIcon, { stroke: "#0F1D40" }),
|
|
744
|
+
iconDisable: /* @__PURE__ */ jsx(SendApprovalIcon, { stroke: "#B2B7C2" }),
|
|
745
|
+
action: handleSubmitForApproval,
|
|
746
|
+
name: "Gửi duyệt",
|
|
747
|
+
typeIcon: "info",
|
|
748
|
+
title: "Xác nhận gửi duyệt",
|
|
749
|
+
content: "Bạn có chắc chắn muốn gửi duyệt không?",
|
|
750
|
+
arrShow: [CATEGORY_LIST_ENUM?.DRAFT],
|
|
751
|
+
showTitle: true
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
icon: /* @__PURE__ */ jsx(CancelSendApprovalIcon, { stroke: "white" }),
|
|
755
|
+
iconDropList: /* @__PURE__ */ jsx(CancelSendApprovalIcon, { stroke: "#0F1D40" }),
|
|
756
|
+
iconDisable: /* @__PURE__ */ jsx(CancelSendApprovalIcon, { stroke: "#B2B7C2" }),
|
|
757
|
+
action: handleCancelSubmission,
|
|
758
|
+
name: "Huỷ gửi duyệt",
|
|
759
|
+
typeIcon: "error",
|
|
760
|
+
title: "Xác nhận hủy gửi duyệt",
|
|
761
|
+
content: "Bạn có chắc chắn muốn hủy gửi duyệt không?",
|
|
762
|
+
arrShow: [CATEGORY_LIST_ENUM?.WATING_APPROVAL],
|
|
763
|
+
showTitle: true
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
icon: /* @__PURE__ */ jsx(RefuseApprovalIcon, { stroke: "white" }),
|
|
767
|
+
iconDropList: /* @__PURE__ */ jsx(RefuseApprovalIcon, { stroke: "#0F1D40" }),
|
|
768
|
+
iconDisable: /* @__PURE__ */ jsx(RefuseApprovalIcon, { stroke: "#B2B7C2" }),
|
|
769
|
+
action: handleReject,
|
|
770
|
+
name: "Từ chối duyệt",
|
|
771
|
+
typeIcon: "error",
|
|
772
|
+
title: "Xác nhận từ chối duyệt",
|
|
773
|
+
content: "Bạn có chắc chắn muốn từ chối duyệt không? Hành động này không thể hoàn tác.",
|
|
774
|
+
arrShow: [CATEGORY_LIST_ENUM?.WATING_APPROVAL],
|
|
775
|
+
showTitle: true
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
icon: /* @__PURE__ */ jsx(ApprovalIcon, { stroke: "white" }),
|
|
779
|
+
iconDropList: /* @__PURE__ */ jsx(ApprovalIcon, { stroke: "#0F1D40" }),
|
|
780
|
+
iconDisable: /* @__PURE__ */ jsx(ApprovalIcon, { stroke: "#B2B7C2" }),
|
|
781
|
+
action: handleApprove,
|
|
782
|
+
name: "Duyệt",
|
|
783
|
+
typeIcon: "info",
|
|
784
|
+
title: "Xác nhận duyệt",
|
|
785
|
+
content: "Bạn có chắc chắn muốn duyệt không?",
|
|
786
|
+
arrShow: [CATEGORY_LIST_ENUM?.WATING_APPROVAL],
|
|
787
|
+
showTitle: true
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
icon: /* @__PURE__ */ jsx(CancelApprovalIcon, { stroke: "white" }),
|
|
791
|
+
iconDropList: /* @__PURE__ */ jsx(CancelApprovalIcon, { stroke: "#0F1D40" }),
|
|
792
|
+
iconDisable: /* @__PURE__ */ jsx(CancelApprovalIcon, { stroke: "#B2B7C2" }),
|
|
793
|
+
action: handleCancelApproval,
|
|
794
|
+
typeIcon: "error",
|
|
795
|
+
name: "Hủy duyệt",
|
|
796
|
+
title: "Xác nhận hủy duyệt",
|
|
797
|
+
content: "Bạn có chắc chắn muốn hủy duyệt không?",
|
|
798
|
+
arrShow: isApproved ? [CATEGORY_LIST_ENUM?.ACTIVE] : [],
|
|
799
|
+
showTitle: true
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
icon: /* @__PURE__ */ jsx(DeleteIcon, { fill: "white" }),
|
|
803
|
+
iconDropList: /* @__PURE__ */ jsx(DeleteIcon, { fill: "#0F1D40" }),
|
|
804
|
+
iconDisable: /* @__PURE__ */ jsx(DeleteIcon, { fill: "#B2B7C2" }),
|
|
805
|
+
action: handleDelete,
|
|
806
|
+
typeIcon: "error",
|
|
807
|
+
name: "Xoá",
|
|
808
|
+
title: "Xác nhận xóa",
|
|
809
|
+
content: "Bạn có chắc chắn muốn xóa không? Hành động này không thể hoàn tác.",
|
|
810
|
+
arrShow: [
|
|
811
|
+
CATEGORY_LIST_ENUM?.DRAFT,
|
|
812
|
+
CATEGORY_LIST_ENUM?.ACTIVE,
|
|
813
|
+
CATEGORY_LIST_ENUM?.INACTIVE
|
|
814
|
+
],
|
|
815
|
+
showTitle: false
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
icon: /* @__PURE__ */ jsx(ActivateIcon, { stroke: "white" }),
|
|
819
|
+
iconDropList: /* @__PURE__ */ jsx(ActivateIcon, { stroke: "#0F1D40" }),
|
|
820
|
+
iconDisable: /* @__PURE__ */ jsx(ActivateIcon, { stroke: "#B2B7C2" }),
|
|
821
|
+
action: handleActivate,
|
|
822
|
+
typeIcon: "info",
|
|
823
|
+
name: "Kích hoạt",
|
|
824
|
+
title: "Xác nhận kích hoạt",
|
|
825
|
+
content: "Bạn có chắc chắn muốn kích hoạt không?",
|
|
826
|
+
arrShow: [CATEGORY_LIST_ENUM?.INACTIVE],
|
|
827
|
+
showTitle: true
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
icon: /* @__PURE__ */ jsx(InActiveIcon, { stroke: "white" }),
|
|
831
|
+
iconDropList: /* @__PURE__ */ jsx(InActiveIcon, { stroke: "#0F1D40" }),
|
|
832
|
+
iconDisable: /* @__PURE__ */ jsx(InActiveIcon, { stroke: "#B2B7C2" }),
|
|
833
|
+
action: handleDeactivate,
|
|
834
|
+
name: "Vô hiệu hóa",
|
|
835
|
+
typeIcon: "error",
|
|
836
|
+
title: "Xác nhận vô hiệu hóa",
|
|
837
|
+
content: "Bạn có chắc chắn muốn vô hiệu hóa không?",
|
|
838
|
+
arrShow: [CATEGORY_LIST_ENUM?.ACTIVE],
|
|
839
|
+
showTitle: true
|
|
840
|
+
}
|
|
841
|
+
];
|
|
842
|
+
console.log("listIcon", listIcon);
|
|
843
|
+
const { open, shouldRender, toggle } = useToggle();
|
|
844
|
+
const [notifyContent, setNotifyContent] = useState({
|
|
845
|
+
title: "",
|
|
846
|
+
content: "",
|
|
847
|
+
typeIcon: "info",
|
|
848
|
+
handleCancel: () => {
|
|
849
|
+
},
|
|
850
|
+
handleSubmit: () => {
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
//! Function
|
|
854
|
+
const renderBulkActions = () => {
|
|
855
|
+
switch (typeBulkaction) {
|
|
856
|
+
case TypeBulkActions.BULKACTION:
|
|
857
|
+
return /* @__PURE__ */ jsx(
|
|
858
|
+
BulkAction,
|
|
859
|
+
{
|
|
860
|
+
listIcon,
|
|
861
|
+
quantity,
|
|
862
|
+
setNotifyContent,
|
|
863
|
+
toggle,
|
|
864
|
+
status
|
|
865
|
+
}
|
|
866
|
+
);
|
|
867
|
+
case TypeBulkActions.DROPLIST:
|
|
868
|
+
return /* @__PURE__ */ jsx(
|
|
869
|
+
DropListActions,
|
|
870
|
+
{
|
|
871
|
+
listIcon,
|
|
872
|
+
setNotifyContent,
|
|
873
|
+
toggle,
|
|
874
|
+
status
|
|
875
|
+
}
|
|
876
|
+
);
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
//! Render
|
|
880
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
881
|
+
renderBulkActions(),
|
|
882
|
+
shouldRender && /* @__PURE__ */ jsx(
|
|
883
|
+
ConfirmModal,
|
|
884
|
+
{
|
|
885
|
+
title: notifyContent?.title,
|
|
886
|
+
content: notifyContent?.content,
|
|
887
|
+
typeIcon: notifyContent?.typeIcon,
|
|
888
|
+
open,
|
|
889
|
+
handleCancel: notifyContent?.handleCancel,
|
|
890
|
+
handleSubmit: notifyContent?.handleSubmit
|
|
891
|
+
}
|
|
892
|
+
)
|
|
893
|
+
] });
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
export { ActionRowTable as A, BulkActions as B, Table as T };
|