@pnkx-lib/ui 1.9.536 → 1.9.539

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.
@@ -1,928 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import React__default, { useState } from 'react';
3
- import { CATEGORY_LIST_ENUM, COUNT_LEVEL, CATEGORY_PRICE_LIST_ENUM } from '../CategoryStatus.js';
4
- import { isBoolean, isEmpty } from 'lodash';
5
- import { R as RestoreIcon, S as SendApprovalIcon, C as CancelSendApprovalIcon, a as RefuseApprovalIcon, b as RefuseApprovalDropListIcon, A as ApprovalIcon, c as CancelApprovalIcon, D as DeleteIcon, d as ActivateIcon, I as InActiveIcon, M as MoreIcon } from '../../chunks/RefuseApprovalDropListIcon-DkyYANWt.js';
6
- import { useToggle } from '@pnkx-lib/core';
7
- import { ConfirmModal } from '../ConfirmModal.js';
8
- import { t as twMerge } from '../../chunks/bundle-mjs-BME7zF0Z.js';
9
- import { Popover } from '../Popover.js';
10
- import { Tooltip } from 'antd';
11
- import { Tooltip as Tooltip$1 } from '../Tooltip.js';
12
-
13
- const CategoryIcon = ({
14
- size = 24,
15
- color = "currentColor",
16
- className,
17
- style,
18
- onClick,
19
- "aria-label": ariaLabel,
20
- title,
21
- ...props
22
- }) => /* @__PURE__ */ jsx(
23
- "div",
24
- {
25
- className,
26
- style: {
27
- width: size,
28
- height: size,
29
- cursor: onClick ? "pointer" : "default",
30
- ...style
31
- },
32
- onClick,
33
- role: onClick ? "button" : void 0,
34
- "aria-label": ariaLabel,
35
- title,
36
- ...props,
37
- children: /* @__PURE__ */ jsx(
38
- "svg",
39
- {
40
- width: "100%",
41
- height: "100%",
42
- viewBox: "0 0 24 24",
43
- fill: "none",
44
- xmlns: "http://www.w3.org/2000/svg",
45
- children: /* @__PURE__ */ jsx(
46
- "path",
47
- {
48
- d: "M20.0306 6.21938L16.2806 2.46938C16.2109 2.39975 16.1282 2.34454 16.0371 2.3069C15.9461 2.26926 15.8485 2.24992 15.75 2.25H8.25C7.85218 2.25 7.47064 2.40804 7.18934 2.68934C6.90804 2.97064 6.75 3.35218 6.75 3.75V5.25H5.25C4.85218 5.25 4.47064 5.40804 4.18934 5.68934C3.90804 5.97064 3.75 6.35218 3.75 6.75V20.25C3.75 20.6478 3.90804 21.0294 4.18934 21.3107C4.47064 21.592 4.85218 21.75 5.25 21.75H15.75C16.1478 21.75 16.5294 21.592 16.8107 21.3107C17.092 21.0294 17.25 20.6478 17.25 20.25V18.75H18.75C19.1478 18.75 19.5294 18.592 19.8107 18.3107C20.092 18.0294 20.25 17.6478 20.25 17.25V6.75C20.2501 6.65148 20.2307 6.55391 20.1931 6.46286C20.1555 6.37182 20.1003 6.28908 20.0306 6.21938ZM15.75 20.25H5.25V6.75H12.4397L15.75 10.0603V17.985C15.75 17.9906 15.75 17.9953 15.75 18C15.75 18.0047 15.75 18.0094 15.75 18.015V20.25ZM18.75 17.25H17.25V9.75C17.2501 9.65148 17.2307 9.55391 17.1931 9.46286C17.1555 9.37182 17.1003 9.28908 17.0306 9.21937L13.2806 5.46938C13.2109 5.39975 13.1282 5.34454 13.0371 5.3069C12.9461 5.26926 12.8485 5.24992 12.75 5.25H8.25V3.75H15.4397L18.75 7.06031V17.25ZM13.5 14.25C13.5 14.4489 13.421 14.6397 13.2803 14.7803C13.1397 14.921 12.9489 15 12.75 15H8.25C8.05109 15 7.86032 14.921 7.71967 14.7803C7.57902 14.6397 7.5 14.4489 7.5 14.25C7.5 14.0511 7.57902 13.8603 7.71967 13.7197C7.86032 13.579 8.05109 13.5 8.25 13.5H12.75C12.9489 13.5 13.1397 13.579 13.2803 13.7197C13.421 13.8603 13.5 14.0511 13.5 14.25ZM13.5 17.25C13.5 17.4489 13.421 17.6397 13.2803 17.7803C13.1397 17.921 12.9489 18 12.75 18H8.25C8.05109 18 7.86032 17.921 7.71967 17.7803C7.57902 17.6397 7.5 17.4489 7.5 17.25C7.5 17.0511 7.57902 16.8603 7.71967 16.7197C7.86032 16.579 8.05109 16.5 8.25 16.5H12.75C12.9489 16.5 13.1397 16.579 13.2803 16.7197C13.421 16.8603 13.5 17.0511 13.5 17.25Z",
49
- fill: color
50
- }
51
- )
52
- }
53
- )
54
- }
55
- );
56
-
57
- const CancelSendConfirmIcon = ({
58
- size = 16,
59
- color = "currentColor",
60
- className,
61
- style,
62
- onClick,
63
- "aria-label": ariaLabel,
64
- title,
65
- ...props
66
- }) => /* @__PURE__ */ jsx(
67
- "div",
68
- {
69
- className,
70
- style: {
71
- width: size,
72
- height: size,
73
- cursor: onClick ? "pointer" : "default",
74
- ...style
75
- },
76
- onClick,
77
- role: onClick ? "button" : void 0,
78
- "aria-label": ariaLabel,
79
- title,
80
- ...props,
81
- children: /* @__PURE__ */ jsx(
82
- "svg",
83
- {
84
- width: "100%",
85
- height: "100%",
86
- viewBox: "0 0 16 16",
87
- fill: "none",
88
- xmlns: "http://www.w3.org/2000/svg",
89
- children: /* @__PURE__ */ jsx(
90
- "path",
91
- {
92
- d: "M13.3327 7.96046V4.53301C13.3327 3.4129 13.3327 2.85285 13.1147 2.42503C12.923 2.0487 12.617 1.74274 12.2407 1.55099C11.8128 1.33301 11.2528 1.33301 10.1327 1.33301H5.86602C4.74591 1.33301 4.18586 1.33301 3.75803 1.55099C3.38171 1.74274 3.07575 2.0487 2.884 2.42503C2.66602 2.85285 2.66602 3.4129 2.66602 4.53301V11.4663C2.66602 12.5864 2.66602 13.1465 2.884 13.5743C3.07575 13.9506 3.38171 14.2566 3.75803 14.4484C4.18586 14.6663 4.74591 14.6663 5.86602 14.6663H9.33268M9.33268 7.33301H5.33268M6.66602 9.99968H5.33268M10.666 4.66634H7.99935H5.33268M9.99935 11.333H13.9994",
93
- stroke: color,
94
- "stroke-linecap": "round",
95
- "stroke-linejoin": "round"
96
- }
97
- )
98
- }
99
- )
100
- }
101
- );
102
-
103
- const ConfirmIcon = ({
104
- size = 16,
105
- color = "currentColor",
106
- className,
107
- style,
108
- onClick,
109
- "aria-label": ariaLabel,
110
- title,
111
- ...props
112
- }) => /* @__PURE__ */ jsx(
113
- "div",
114
- {
115
- className,
116
- style: {
117
- width: size,
118
- height: size,
119
- cursor: onClick ? "pointer" : "default",
120
- ...style
121
- },
122
- onClick,
123
- role: onClick ? "button" : void 0,
124
- "aria-label": ariaLabel,
125
- title,
126
- ...props,
127
- children: /* @__PURE__ */ jsx(
128
- "svg",
129
- {
130
- width: "100%",
131
- height: "100%",
132
- viewBox: "0 0 16 16",
133
- fill: "none",
134
- xmlns: "http://www.w3.org/2000/svg",
135
- children: /* @__PURE__ */ jsx(
136
- "path",
137
- {
138
- d: "M13.3327 8.33301V4.53301C13.3327 3.4129 13.3327 2.85285 13.1147 2.42503C12.9229 2.0487 12.617 1.74274 12.2407 1.55099C11.8128 1.33301 11.2528 1.33301 10.1327 1.33301H5.86602C4.74591 1.33301 4.18586 1.33301 3.75803 1.55099C3.38171 1.74274 3.07575 2.0487 2.884 2.42503C2.66602 2.85285 2.66602 3.4129 2.66602 4.53301V11.4663C2.66602 12.5864 2.66602 13.1465 2.884 13.5743C3.07575 13.9506 3.38171 14.2566 3.75803 14.4484C4.18586 14.6663 4.74591 14.6663 5.86602 14.6663H7.99935M9.33268 7.33301H5.33268M6.66602 9.99967H5.33268M10.666 4.66634H5.33268M9.66602 12.6663L10.9993 13.9997L13.9993 10.9997",
139
- stroke: color,
140
- "stroke-linecap": "round",
141
- "stroke-linejoin": "round"
142
- }
143
- )
144
- }
145
- )
146
- }
147
- );
148
-
149
- const SendConfirmIcon = ({
150
- size = 14,
151
- color = "currentColor",
152
- className,
153
- style,
154
- onClick,
155
- "aria-label": ariaLabel,
156
- title,
157
- ...props
158
- }) => /* @__PURE__ */ jsx(
159
- "div",
160
- {
161
- className,
162
- style: {
163
- width: size,
164
- height: Number(size) + 2,
165
- cursor: onClick ? "pointer" : "default",
166
- ...style
167
- },
168
- onClick,
169
- role: onClick ? "button" : void 0,
170
- "aria-label": ariaLabel,
171
- title,
172
- ...props,
173
- children: /* @__PURE__ */ jsxs(
174
- "svg",
175
- {
176
- width: "100%",
177
- height: "100%",
178
- viewBox: "0 0 14 16",
179
- fill: "none",
180
- xmlns: "http://www.w3.org/2000/svg",
181
- children: [
182
- /* @__PURE__ */ jsx(
183
- "path",
184
- {
185
- d: "M9.9703 8.58203C8.16858 8.58203 6.70312 10.0322 6.70312 11.815C6.70312 13.5979 8.16858 15.048 9.9703 15.048C11.772 15.048 13.2375 13.5979 13.2375 11.815C13.2375 10.0322 11.772 8.58203 9.9703 8.58203ZM9.9703 14.2196C8.63041 14.2196 7.54026 13.1409 7.54026 11.815C7.54026 10.4891 8.63041 9.41041 9.9703 9.41041C11.3102 9.41041 12.4003 10.4891 12.4003 11.815C12.4003 13.1409 11.3102 14.2196 9.9703 14.2196Z",
186
- fill: color
187
- }
188
- ),
189
- /* @__PURE__ */ jsx(
190
- "path",
191
- {
192
- d: "M10.2817 10.4653C10.2021 10.3783 10.0891 10.3281 9.97053 10.3281C9.85193 10.3281 9.73892 10.3778 9.65939 10.4653L8.95527 11.2389C8.80039 11.4087 8.81435 11.6706 8.98643 11.8238C9.14967 11.9692 9.39523 11.9591 9.55196 11.8118V12.8878C9.55196 13.1165 9.73939 13.302 9.97053 13.302C10.2017 13.302 10.3891 13.1165 10.3891 12.8878V11.8114C10.4691 11.8869 10.57 11.9301 10.6747 11.9301C10.7742 11.9301 10.8746 11.8951 10.9546 11.8238C11.1267 11.6706 11.1402 11.4092 10.9858 11.2389L10.2817 10.4653Z",
193
- fill: color
194
- }
195
- ),
196
- /* @__PURE__ */ jsx(
197
- "path",
198
- {
199
- d: "M6.00028 14.5716H2.07171C1.40109 14.5716 0.857422 14.0729 0.857422 13.4578V2.54251C0.857422 1.92739 1.40109 1.42871 2.07171 1.42871H8.14314C9.48441 1.42871 10.5717 2.42604 10.5717 3.65631V6.8057",
200
- stroke: color,
201
- "stroke-miterlimit": "10",
202
- "stroke-linecap": "round",
203
- "stroke-linejoin": "round"
204
- }
205
- ),
206
- /* @__PURE__ */ jsx(
207
- "path",
208
- {
209
- d: "M3.14258 4.57129H7.71401",
210
- stroke: color,
211
- "stroke-miterlimit": "10",
212
- "stroke-linecap": "round",
213
- "stroke-linejoin": "round"
214
- }
215
- ),
216
- /* @__PURE__ */ jsx(
217
- "path",
218
- {
219
- d: "M3.14258 7.42871L6.57115 7.42871",
220
- stroke: color,
221
- "stroke-miterlimit": "10",
222
- "stroke-linecap": "round",
223
- "stroke-linejoin": "round"
224
- }
225
- ),
226
- /* @__PURE__ */ jsx(
227
- "path",
228
- {
229
- d: "M3.14258 9.94629H4.85687",
230
- stroke: color,
231
- "stroke-miterlimit": "10",
232
- "stroke-linecap": "round",
233
- "stroke-linejoin": "round"
234
- }
235
- )
236
- ]
237
- }
238
- )
239
- }
240
- );
241
-
242
- const SendApproveIcon = ({
243
- size = 16,
244
- color = "currentColor",
245
- className,
246
- style,
247
- onClick,
248
- "aria-label": ariaLabel,
249
- title,
250
- ...props
251
- }) => /* @__PURE__ */ jsx(
252
- "div",
253
- {
254
- className,
255
- style: {
256
- width: size,
257
- height: size,
258
- cursor: onClick ? "pointer" : "default",
259
- ...style
260
- },
261
- onClick,
262
- role: onClick ? "button" : void 0,
263
- "aria-label": ariaLabel,
264
- title,
265
- ...props,
266
- children: /* @__PURE__ */ jsx(
267
- "svg",
268
- {
269
- width: "100%",
270
- height: "100%",
271
- viewBox: "0 0 16 16",
272
- fill: "none",
273
- xmlns: "http://www.w3.org/2000/svg",
274
- children: /* @__PURE__ */ jsx(
275
- "path",
276
- {
277
- d: "M4.67562 8L7.92052 8M4.57708 7.61983L2.10237 3.16666C1.72848 2.49386 2.44846 1.74212 3.13706 2.08632L13.5671 7.29983C14.1443 7.58832 14.1443 8.41168 13.5671 8.70017L3.13706 13.9137C2.44845 14.2579 1.72848 13.5061 2.10237 12.8333L4.57708 8.38017C4.70847 8.14374 4.70847 7.85626 4.57708 7.61983Z",
278
- stroke: color,
279
- "stroke-linecap": "round"
280
- }
281
- )
282
- }
283
- )
284
- }
285
- );
286
-
287
- const CancelSendApproveIcon = ({
288
- size = 16,
289
- color = "currentColor",
290
- className,
291
- style,
292
- onClick,
293
- "aria-label": ariaLabel,
294
- title,
295
- ...props
296
- }) => /* @__PURE__ */ jsx(
297
- "div",
298
- {
299
- className,
300
- style: {
301
- width: size,
302
- height: size,
303
- cursor: onClick ? "pointer" : "default",
304
- ...style
305
- },
306
- onClick,
307
- role: onClick ? "button" : void 0,
308
- "aria-label": ariaLabel,
309
- title,
310
- ...props,
311
- children: /* @__PURE__ */ jsx(
312
- "svg",
313
- {
314
- width: "100%",
315
- height: "100%",
316
- viewBox: "0 0 16 16",
317
- fill: "none",
318
- xmlns: "http://www.w3.org/2000/svg",
319
- children: /* @__PURE__ */ jsx(
320
- "path",
321
- {
322
- d: "M9.33398 5.33301L6.66732 10.6663M14.6673 7.99967C14.6673 11.6816 11.6825 14.6663 8.00065 14.6663C4.31875 14.6663 1.33398 11.6816 1.33398 7.99967C1.33398 4.31778 4.31875 1.33301 8.00065 1.33301C11.6825 1.33301 14.6673 4.31778 14.6673 7.99967Z",
323
- stroke: color,
324
- "stroke-linecap": "round"
325
- }
326
- )
327
- }
328
- )
329
- }
330
- );
331
-
332
- const RejectApproveIcon = ({
333
- size = 16,
334
- color = "currentColor",
335
- className,
336
- style,
337
- onClick,
338
- "aria-label": ariaLabel,
339
- title,
340
- ...props
341
- }) => /* @__PURE__ */ jsx(
342
- "div",
343
- {
344
- className,
345
- style: {
346
- width: size,
347
- height: size,
348
- cursor: onClick ? "pointer" : "default",
349
- ...style
350
- },
351
- onClick,
352
- role: onClick ? "button" : void 0,
353
- "aria-label": ariaLabel,
354
- title,
355
- ...props,
356
- children: /* @__PURE__ */ jsxs(
357
- "svg",
358
- {
359
- width: "100%",
360
- height: "100%",
361
- viewBox: "0 0 16 16",
362
- fill: "none",
363
- xmlns: "http://www.w3.org/2000/svg",
364
- children: [
365
- /* @__PURE__ */ jsx(
366
- "path",
367
- {
368
- d: "M8.00065 14.6663C11.6807 14.6663 14.6673 11.6797 14.6673 7.99967C14.6673 4.31967 11.6807 1.33301 8.00065 1.33301C4.32065 1.33301 1.33398 4.31967 1.33398 7.99967C1.33398 11.6797 4.32065 14.6663 8.00065 14.6663Z",
369
- stroke: color,
370
- "stroke-miterlimit": "10",
371
- "stroke-linecap": "round",
372
- "stroke-linejoin": "round"
373
- }
374
- ),
375
- /* @__PURE__ */ jsx(
376
- "path",
377
- {
378
- d: "M12.599 3.33301L3.26562 12.6663",
379
- stroke: color,
380
- "stroke-miterlimit": "10",
381
- "stroke-linecap": "round",
382
- "stroke-linejoin": "round"
383
- }
384
- )
385
- ]
386
- }
387
- )
388
- }
389
- );
390
-
391
- const ApproveIcon = ({
392
- size = 16,
393
- color = "currentColor",
394
- className,
395
- style,
396
- onClick,
397
- "aria-label": ariaLabel,
398
- title,
399
- ...props
400
- }) => /* @__PURE__ */ jsx(
401
- "div",
402
- {
403
- className,
404
- style: {
405
- width: size,
406
- height: size,
407
- cursor: onClick ? "pointer" : "default",
408
- ...style
409
- },
410
- onClick,
411
- role: onClick ? "button" : void 0,
412
- "aria-label": ariaLabel,
413
- title,
414
- ...props,
415
- children: /* @__PURE__ */ jsx(
416
- "svg",
417
- {
418
- width: "100%",
419
- height: "100%",
420
- viewBox: "0 0 16 16",
421
- fill: "none",
422
- xmlns: "http://www.w3.org/2000/svg",
423
- children: /* @__PURE__ */ jsx(
424
- "path",
425
- {
426
- d: "M11.1583 4.66699L4.83827 11.1492C4.59848 11.3951 4.2097 11.3951 3.96991 11.1492L1.33398 8.44564M8.34726 11.1492L14.6673 4.66699",
427
- stroke: color,
428
- "stroke-linecap": "round"
429
- }
430
- )
431
- }
432
- )
433
- }
434
- );
435
-
436
- var TypeBulkActions = /* @__PURE__ */ ((TypeBulkActions2) => {
437
- TypeBulkActions2["BULKACTION"] = "bulkaction";
438
- TypeBulkActions2["DROPLIST"] = "droplist";
439
- return TypeBulkActions2;
440
- })(TypeBulkActions || {});
441
- var TypeCategoryBulkActions = /* @__PURE__ */ ((TypeCategoryBulkActions2) => {
442
- TypeCategoryBulkActions2[TypeCategoryBulkActions2["CATEGORY"] = 0] = "CATEGORY";
443
- TypeCategoryBulkActions2[TypeCategoryBulkActions2["PRICE_SERVICE"] = 1] = "PRICE_SERVICE";
444
- return TypeCategoryBulkActions2;
445
- })(TypeCategoryBulkActions || {});
446
-
447
- const ListDataConvert = ({
448
- isApproved,
449
- typeService,
450
- handleBulkAction,
451
- handleBulkActionPrice
452
- }) => {
453
- const dataBulkActionCategory = [
454
- {
455
- icon: /* @__PURE__ */ jsx(RestoreIcon, { stroke: "white" }),
456
- iconDropList: /* @__PURE__ */ jsx(RestoreIcon, { stroke: "#0F1D40" }),
457
- iconDisable: /* @__PURE__ */ jsx(RestoreIcon, { stroke: "#B2B7C2" }),
458
- action: handleBulkAction?.handleRestore,
459
- name: "Khôi phục",
460
- typeIcon: "info",
461
- title: "Xác nhận khôi phục",
462
- content: "Bạn có chắc chắn muốn khôi phục không?",
463
- arrShow: [CATEGORY_LIST_ENUM?.DELETE, CATEGORY_LIST_ENUM?.REJECT],
464
- showTitle: true
465
- },
466
- {
467
- icon: /* @__PURE__ */ jsx(SendApprovalIcon, { stroke: "white" }),
468
- iconDropList: /* @__PURE__ */ jsx(SendApprovalIcon, { stroke: "#0F1D40" }),
469
- iconDisable: /* @__PURE__ */ jsx(SendApprovalIcon, { stroke: "#B2B7C2" }),
470
- action: handleBulkAction?.handleSubmitForApproval,
471
- name: "Gửi duyệt",
472
- typeIcon: "info",
473
- title: "Xác nhận gửi duyệt",
474
- content: "Bạn có chắc chắn muốn gửi duyệt không?",
475
- arrShow: [CATEGORY_LIST_ENUM?.DRAFT],
476
- showTitle: true
477
- },
478
- {
479
- icon: /* @__PURE__ */ jsx(CancelSendApprovalIcon, { stroke: "white" }),
480
- iconDropList: /* @__PURE__ */ jsx(CancelSendApprovalIcon, { stroke: "#0F1D40" }),
481
- iconDisable: /* @__PURE__ */ jsx(CancelSendApprovalIcon, { stroke: "#B2B7C2" }),
482
- action: handleBulkAction?.handleCancelSubmission,
483
- name: "Huỷ gửi duyệt",
484
- typeIcon: "error",
485
- title: "Xác nhận hủy gửi duyệt",
486
- content: "Bạn có chắc chắn muốn hủy gửi duyệt không?",
487
- arrShow: [CATEGORY_LIST_ENUM?.WATING_APPROVAL],
488
- showTitle: true
489
- },
490
- {
491
- icon: /* @__PURE__ */ jsx(RefuseApprovalIcon, { stroke: "white" }),
492
- iconDropList: /* @__PURE__ */ jsx(RefuseApprovalDropListIcon, {}),
493
- iconDisable: /* @__PURE__ */ jsx(RefuseApprovalIcon, { stroke: "#B2B7C2" }),
494
- action: handleBulkAction?.handleReject,
495
- name: "Từ chối duyệt",
496
- typeIcon: "error",
497
- title: "Xác nhận từ chối duyệt",
498
- 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.",
499
- arrShow: [CATEGORY_LIST_ENUM?.WATING_APPROVAL],
500
- showTitle: true
501
- },
502
- {
503
- icon: /* @__PURE__ */ jsx(ApprovalIcon, { stroke: "white" }),
504
- iconDropList: /* @__PURE__ */ jsx(ApprovalIcon, { stroke: "#0F1D40" }),
505
- iconDisable: /* @__PURE__ */ jsx(ApprovalIcon, { stroke: "#B2B7C2" }),
506
- action: handleBulkAction?.handleApprove,
507
- name: "Duyệt",
508
- typeIcon: "info",
509
- title: "Xác nhận duyệt",
510
- content: "Bạn có chắc chắn muốn duyệt không?",
511
- arrShow: [CATEGORY_LIST_ENUM?.WATING_APPROVAL],
512
- showTitle: true
513
- },
514
- {
515
- icon: /* @__PURE__ */ jsx(CancelApprovalIcon, { stroke: "white" }),
516
- iconDropList: /* @__PURE__ */ jsx(CancelApprovalIcon, { stroke: "#0F1D40" }),
517
- iconDisable: /* @__PURE__ */ jsx(CancelApprovalIcon, { stroke: "#B2B7C2" }),
518
- action: handleBulkAction?.handleCancelApproval,
519
- typeIcon: "error",
520
- name: "Hủy duyệt",
521
- title: "Xác nhận hủy duyệt",
522
- content: "Bạn có chắc chắn muốn hủy duyệt không?",
523
- arrShow: isBoolean(isApproved) && !isApproved ? [] : [CATEGORY_LIST_ENUM?.ACTIVE],
524
- showTitle: true
525
- },
526
- {
527
- icon: /* @__PURE__ */ jsx(DeleteIcon, { fill: "white" }),
528
- iconDropList: /* @__PURE__ */ jsx(DeleteIcon, { fill: "#0F1D40" }),
529
- iconDisable: /* @__PURE__ */ jsx(DeleteIcon, { fill: "#B2B7C2" }),
530
- action: handleBulkAction?.handleDelete,
531
- typeIcon: "error",
532
- name: "Xoá",
533
- title: "Xác nhận xóa",
534
- 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.",
535
- arrShow: isBoolean(isApproved) && !isApproved ? [
536
- CATEGORY_LIST_ENUM?.DRAFT,
537
- CATEGORY_LIST_ENUM?.ACTIVE,
538
- CATEGORY_LIST_ENUM?.INACTIVE
539
- ] : [CATEGORY_LIST_ENUM?.DRAFT]
540
- },
541
- {
542
- icon: /* @__PURE__ */ jsx(ActivateIcon, { stroke: "white" }),
543
- iconDropList: /* @__PURE__ */ jsx(ActivateIcon, { stroke: "#0F1D40" }),
544
- iconDisable: /* @__PURE__ */ jsx(ActivateIcon, { stroke: "#B2B7C2" }),
545
- action: handleBulkAction?.handleActivate,
546
- typeIcon: "info",
547
- name: "Kích hoạt",
548
- title: "Xác nhận kích hoạt",
549
- content: "Bạn có chắc chắn muốn kích hoạt không?",
550
- arrShow: [CATEGORY_LIST_ENUM?.INACTIVE]
551
- },
552
- {
553
- icon: /* @__PURE__ */ jsx(InActiveIcon, { stroke: "white" }),
554
- iconDropList: /* @__PURE__ */ jsx(InActiveIcon, { stroke: "#0F1D40" }),
555
- iconDisable: /* @__PURE__ */ jsx(InActiveIcon, { stroke: "#B2B7C2" }),
556
- action: handleBulkAction?.handleDeactivate,
557
- name: "Vô hiệu hóa",
558
- typeIcon: "error",
559
- title: "Xác nhận vô hiệu hóa",
560
- content: "Bạn có chắc chắn muốn vô hiệu hóa không?",
561
- arrShow: [CATEGORY_LIST_ENUM?.ACTIVE]
562
- }
563
- ];
564
- const dataBulkActionPrice = [
565
- {
566
- icon: /* @__PURE__ */ jsx(CategoryIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
567
- iconDropList: /* @__PURE__ */ jsx(CategoryIcon, { className: "w-6 -h-6", size: 22, color: "#0F1D40" }),
568
- iconDisable: /* @__PURE__ */ jsx(CategoryIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
569
- action: handleBulkActionPrice?.handleRejectConfirm,
570
- name: "Từ chối xác nhận",
571
- typeIcon: "error",
572
- title: "Xác nhận từ chối xác nhận",
573
- content: "Bạn có chắc chắn muốn từ chối xác nhận không?",
574
- arrShow: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
575
- showTitle: true,
576
- countLevel: [COUNT_LEVEL.TWO_LEVEL],
577
- arrShows: [
578
- {
579
- status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
580
- level: [COUNT_LEVEL.TWO_LEVEL]
581
- }
582
- ]
583
- },
584
- {
585
- icon: /* @__PURE__ */ jsx(CancelSendConfirmIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
586
- iconDropList: /* @__PURE__ */ jsx(CancelSendConfirmIcon, { className: "w-6 -h-6", size: 22, color: "#0F1D40" }),
587
- iconDisable: /* @__PURE__ */ jsx(CancelSendConfirmIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
588
- action: handleBulkActionPrice?.handleCancelSendConfirm,
589
- name: "Huỷ gửi xác nhận",
590
- typeIcon: "error",
591
- title: "Xác nhận huỷ gửi xác nhận",
592
- content: "Bạn có chắc chắn muốn huỷ gửi xác nhận không?",
593
- arrShow: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
594
- showTitle: true,
595
- countLevel: [COUNT_LEVEL.TWO_LEVEL],
596
- arrShows: [
597
- {
598
- status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
599
- level: [COUNT_LEVEL.TWO_LEVEL]
600
- }
601
- ]
602
- },
603
- {
604
- icon: /* @__PURE__ */ jsx(ConfirmIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
605
- iconDropList: /* @__PURE__ */ jsx(ConfirmIcon, { className: "w-6 -h-6", size: 22, color: "#0F1D40" }),
606
- iconDisable: /* @__PURE__ */ jsx(ConfirmIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
607
- action: handleBulkActionPrice?.handleConfirm,
608
- name: "Xác nhận",
609
- typeIcon: "info",
610
- title: "Xác nhận",
611
- content: "Bạn có chắc chắn muốn xác nhận không?",
612
- arrShow: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
613
- showTitle: true,
614
- countLevel: [COUNT_LEVEL.TWO_LEVEL],
615
- arrShows: [
616
- {
617
- status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
618
- level: [COUNT_LEVEL.TWO_LEVEL]
619
- }
620
- ]
621
- },
622
- {
623
- icon: /* @__PURE__ */ jsx(SendConfirmIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
624
- iconDropList: /* @__PURE__ */ jsx(SendConfirmIcon, { className: "w-6 -h-6", size: 22, color: "#0F1D40" }),
625
- iconDisable: /* @__PURE__ */ jsx(SendConfirmIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
626
- action: handleBulkActionPrice?.handleSendConfirm,
627
- name: "Gửi xác nhận",
628
- typeIcon: "info",
629
- title: "Gửi xác nhận",
630
- content: "Bạn có chắc chắn muốn gửi xác nhận không?",
631
- arrShow: [CATEGORY_PRICE_LIST_ENUM?.CREATED],
632
- showTitle: true,
633
- countLevel: [COUNT_LEVEL.TWO_LEVEL],
634
- arrShows: [
635
- {
636
- status: [CATEGORY_PRICE_LIST_ENUM?.CREATED],
637
- level: [COUNT_LEVEL.TWO_LEVEL]
638
- }
639
- ]
640
- },
641
- {
642
- icon: /* @__PURE__ */ jsx(SendApproveIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
643
- iconDropList: /* @__PURE__ */ jsx(SendApproveIcon, { className: "w-6 -h-6", size: 22, color: "#0F1D40" }),
644
- iconDisable: /* @__PURE__ */ jsx(SendApproveIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
645
- action: handleBulkActionPrice?.handleSendApprove,
646
- name: "Gửi duyệt",
647
- typeIcon: "info",
648
- title: "Xác nhận gửi duyệt",
649
- content: "Bạn có chắc chắn muốn gửi duyệt không?",
650
- arrShow: [CATEGORY_PRICE_LIST_ENUM?.CREATED],
651
- showTitle: true,
652
- countLevel: [COUNT_LEVEL.ONE_LEVEL],
653
- arrShows: [
654
- {
655
- status: [CATEGORY_PRICE_LIST_ENUM?.CREATED],
656
- level: [COUNT_LEVEL.ONE_LEVEL]
657
- }
658
- ]
659
- },
660
- {
661
- icon: /* @__PURE__ */ jsx(CancelSendApproveIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
662
- iconDropList: /* @__PURE__ */ jsx(CancelSendApproveIcon, { className: "w-6 -h-6", size: 22, color: "#0F1D40" }),
663
- iconDisable: /* @__PURE__ */ jsx(CancelSendApproveIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
664
- action: handleBulkActionPrice?.handleCancelSendApprove,
665
- name: "Huỷ gửi duyệt",
666
- typeIcon: "error",
667
- title: "Xác nhận hủy gửi duyệt",
668
- content: "Bạn có chắc chắn muốn hủy gửi duyệt không?",
669
- arrShow: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
670
- showTitle: true,
671
- countLevel: [COUNT_LEVEL.ONE_LEVEL, COUNT_LEVEL.TWO_LEVEL],
672
- arrShows: [
673
- {
674
- status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_APPROVAL],
675
- level: [COUNT_LEVEL.TWO_LEVEL]
676
- },
677
- {
678
- status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
679
- level: [COUNT_LEVEL.ONE_LEVEL]
680
- }
681
- ]
682
- },
683
- {
684
- icon: /* @__PURE__ */ jsx(RejectApproveIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
685
- iconDropList: /* @__PURE__ */ jsx(RejectApproveIcon, { className: "w-6 -h-6", size: 22, color: "#0F1D40" }),
686
- iconDisable: /* @__PURE__ */ jsx(RejectApproveIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
687
- action: handleBulkActionPrice?.handleRejectApprove,
688
- name: "Từ chối duyệt",
689
- typeIcon: "error",
690
- title: "Xác nhận từ chối duyệt",
691
- 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.",
692
- arrShow: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
693
- showTitle: true,
694
- countLevel: [COUNT_LEVEL.ONE_LEVEL, COUNT_LEVEL.TWO_LEVEL],
695
- arrShows: [
696
- {
697
- status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_APPROVAL],
698
- level: [COUNT_LEVEL.ONE_LEVEL, COUNT_LEVEL.TWO_LEVEL]
699
- },
700
- {
701
- status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
702
- level: [COUNT_LEVEL.ONE_LEVEL]
703
- }
704
- ]
705
- },
706
- {
707
- icon: /* @__PURE__ */ jsx(ApproveIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
708
- iconDropList: /* @__PURE__ */ jsx(ApproveIcon, { className: "w-6 -h-6", size: 22, color: "#0F1D40" }),
709
- iconDisable: /* @__PURE__ */ jsx(ApproveIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
710
- action: handleBulkActionPrice?.handleApprove,
711
- name: "Duyệt",
712
- typeIcon: "info",
713
- title: "Xác nhận duyệt",
714
- content: "Bạn có chắc chắn muốn duyệt không?",
715
- arrShow: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
716
- showTitle: true,
717
- countLevel: [COUNT_LEVEL.TWO_LEVEL, COUNT_LEVEL.ONE_LEVEL],
718
- arrShows: [
719
- {
720
- status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_APPROVAL],
721
- level: [COUNT_LEVEL.ONE_LEVEL, COUNT_LEVEL.TWO_LEVEL]
722
- },
723
- {
724
- status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
725
- level: [COUNT_LEVEL.ONE_LEVEL]
726
- }
727
- ]
728
- }
729
- ];
730
- if (typeService === TypeCategoryBulkActions.CATEGORY) {
731
- return dataBulkActionCategory;
732
- } else if (typeService === TypeCategoryBulkActions.PRICE_SERVICE) {
733
- return dataBulkActionPrice;
734
- }
735
- return [];
736
- };
737
-
738
- const DropListActions = ({
739
- listIcon,
740
- status,
741
- setNotifyContent,
742
- toggle,
743
- contentDropList,
744
- countLevel
745
- }) => {
746
- //! State
747
- //! Function
748
- const IsShow = (arrShows) => {
749
- if (!arrShows || arrShows.length === 0) return false;
750
- return arrShows.some((cond) => {
751
- const okStatus = !cond.status || cond.status.length === 0 || cond.status.includes(status);
752
- const okLevel = !cond.level || cond.level.length === 0 || cond.level.includes(countLevel);
753
- return okStatus && okLevel;
754
- });
755
- };
756
- const renderContentPopover = () => {
757
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: !isEmpty(listIcon) && listIcon?.map(
758
- (item, index) => item?.showTitle && IsShow(item?.arrShows) && /* @__PURE__ */ jsxs(
759
- "button",
760
- {
761
- className: twMerge(
762
- "flex gap-4 px-3 py-2 rounded-sm transition duration-200 hover:rounded-sm",
763
- IsShow(item?.arrShows) ? "hover:bg-[#F5F6F7] cursor-pointer" : "text-[#B2B7C2] cursor-not-allowed"
764
- ),
765
- disabled: IsShow(item?.arrShows) ? false : true,
766
- onClick: () => {
767
- toggle();
768
- setNotifyContent({
769
- title: item?.title || "",
770
- content: item?.content || "",
771
- typeIcon: item?.typeIcon,
772
- handleCancel: () => {
773
- toggle();
774
- },
775
- handleSubmit: () => {
776
- if (item?.action) {
777
- item?.action();
778
- }
779
- toggle();
780
- }
781
- });
782
- },
783
- children: [
784
- item.iconDropList,
785
- /* @__PURE__ */ jsx("span", { children: item.name || "" })
786
- ]
787
- },
788
- index
789
- )
790
- ) });
791
- };
792
- //! Render
793
- return /* @__PURE__ */ jsx("div", { className: "w-full flex justify-center items-center", children: /* @__PURE__ */ jsx(Tooltip, { title: "Thao tác khác", children: /* @__PURE__ */ jsx(
794
- Popover,
795
- {
796
- placement: "bottom",
797
- content: renderContentPopover(),
798
- trigger: "click",
799
- children: contentDropList ? contentDropList : /* @__PURE__ */ jsx("div", { className: "p-1 border-[#BDE3FF] rounded-full border cursor-pointer", children: /* @__PURE__ */ jsx(MoreIcon, { fill: "#007BE5" }) })
800
- }
801
- ) }) });
802
- };
803
-
804
- const BulkAction = ({
805
- quantity = 0,
806
- listIcon,
807
- status,
808
- setNotifyContent,
809
- toggle
810
- }) => {
811
- //! State
812
- //! Function
813
- const IsShow = (arrStatus) => {
814
- return arrStatus.includes(status);
815
- };
816
- //! Render
817
- 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: [
818
- /* @__PURE__ */ jsxs("div", { className: "text-white px-3", children: [
819
- "Đã chọn: ",
820
- quantity
821
- ] }),
822
- /* @__PURE__ */ jsx("div", { className: "h-5 border-l border-white mx-1" }),
823
- /* @__PURE__ */ jsx("div", { className: "flex items-center space-x-3", children: !isEmpty(listIcon) && listIcon?.map(
824
- (item, index) => IsShow(item?.arrShow) && /* @__PURE__ */ jsx(Tooltip$1, { title: item?.name, children: /* @__PURE__ */ jsx(
825
- "button",
826
- {
827
- className: "p-1 rounded-sm transition duration-200 cursor-pointer hover:bg-[#1B4ACB] hover:rounded-sm",
828
- onClick: () => {
829
- toggle();
830
- setNotifyContent({
831
- title: item?.title || "",
832
- content: item?.content || "",
833
- typeIcon: item?.typeIcon,
834
- handleCancel: () => {
835
- toggle();
836
- },
837
- handleSubmit: () => {
838
- if (item?.action) {
839
- item?.action();
840
- }
841
- toggle();
842
- }
843
- });
844
- },
845
- children: item.icon
846
- },
847
- index
848
- ) })
849
- ) })
850
- ] }) });
851
- };
852
-
853
- const CustomeBulkActions = ({
854
- quantity = 0,
855
- status,
856
- isApproved = false,
857
- typeBulkaction,
858
- typeService,
859
- handleBulkAction,
860
- handleBulkActionPrice,
861
- contentDropList,
862
- countLevel
863
- }) => {
864
- //! State
865
- const data = ListDataConvert({
866
- isApproved,
867
- typeService,
868
- handleBulkAction,
869
- handleBulkActionPrice
870
- }) || [];
871
- //! Function
872
- const { open, shouldRender, toggle } = useToggle();
873
- const [notifyContent, setNotifyContent] = useState({
874
- title: "",
875
- content: "",
876
- typeIcon: "info",
877
- handleCancel: () => {
878
- },
879
- handleSubmit: () => {
880
- }
881
- });
882
- //! Function
883
- const renderBulkActions = () => {
884
- switch (typeBulkaction) {
885
- case TypeBulkActions.BULKACTION:
886
- return /* @__PURE__ */ jsx(
887
- BulkAction,
888
- {
889
- listIcon: data,
890
- quantity,
891
- setNotifyContent,
892
- toggle,
893
- status
894
- }
895
- );
896
- case TypeBulkActions.DROPLIST:
897
- return /* @__PURE__ */ jsx(
898
- DropListActions,
899
- {
900
- listIcon: data,
901
- setNotifyContent,
902
- toggle,
903
- status,
904
- contentDropList,
905
- countLevel
906
- }
907
- );
908
- }
909
- };
910
- //! Render
911
- return /* @__PURE__ */ jsxs("div", { children: [
912
- renderBulkActions(),
913
- shouldRender && /* @__PURE__ */ jsx(
914
- ConfirmModal,
915
- {
916
- title: notifyContent?.title,
917
- content: notifyContent?.content,
918
- typeIcon: notifyContent?.typeIcon,
919
- open,
920
- handleCancel: notifyContent?.handleCancel,
921
- handleSubmit: notifyContent?.handleSubmit
922
- }
923
- )
924
- ] });
925
- };
926
- const index = React__default.memo(CustomeBulkActions);
927
-
928
- export { CustomeBulkActions, index as default };