aq-fe-framework 0.1.308 → 0.1.310
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/chunk-HHJFKKE7.mjs +26 -0
- package/dist/{chunk-NRFQDAYS.mjs → chunk-M6B6SXA3.mjs} +5 -5
- package/dist/chunk-MK2W26FZ.mjs +518 -0
- package/dist/{chunk-KKJ3OEEW.mjs → chunk-OPVLK7PA.mjs} +48 -5
- package/dist/{chunk-IMCUF52C.mjs → chunk-RYZTACZ4.mjs} +168 -310
- package/dist/components/index.d.mts +7 -15
- package/dist/components/index.mjs +4 -7
- package/dist/core/index.d.mts +20 -8
- package/dist/core/index.mjs +20 -336
- package/dist/{createBaseApi-BAYnbGVT.d.mts → createBaseApi-BayOeFCy.d.mts} +12 -3
- package/dist/hooks/index.d.mts +20 -3
- package/dist/hooks/index.mjs +5 -1
- package/dist/interfaces/index.d.mts +6 -2
- package/dist/modules-features/index.d.mts +102 -35
- package/dist/modules-features/index.mjs +1460 -877
- package/dist/utils/index.mjs +1 -1
- package/package.json +1 -2
- package/dist/chunk-DRLKXVYU.mjs +0 -55
@@ -0,0 +1,26 @@
|
|
1
|
+
import {
|
2
|
+
__objRest,
|
3
|
+
__spreadProps,
|
4
|
+
__spreadValues
|
5
|
+
} from "./chunk-FWCSY2DS.mjs";
|
6
|
+
|
7
|
+
// src/components/Layouts/FlexColumn/MyFlexColumn.tsx
|
8
|
+
import { Flex } from "@mantine/core";
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
10
|
+
function MyFlexColumn(_a) {
|
11
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
12
|
+
return /* @__PURE__ */ jsx(Flex, __spreadProps(__spreadValues({ direction: "column", gap: "md" }, rest), { children }));
|
13
|
+
}
|
14
|
+
|
15
|
+
// src/components/Layouts/FlexRow/MyFlexRow.tsx
|
16
|
+
import { Flex as Flex2 } from "@mantine/core";
|
17
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
18
|
+
function MyFlexRow(_a) {
|
19
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
20
|
+
return /* @__PURE__ */ jsx2(Flex2, __spreadProps(__spreadValues({ gap: "md", align: "center" }, rest), { children }));
|
21
|
+
}
|
22
|
+
|
23
|
+
export {
|
24
|
+
MyFlexColumn,
|
25
|
+
MyFlexRow
|
26
|
+
};
|
@@ -304,6 +304,10 @@ var utils_validator_validateCode = (value) => {
|
|
304
304
|
};
|
305
305
|
|
306
306
|
export {
|
307
|
+
U0MyValidateEmpty,
|
308
|
+
U0MyValidateEmail,
|
309
|
+
utils_validator_validateCode,
|
310
|
+
updateEnableList,
|
307
311
|
U0DateToDDMMYYYString,
|
308
312
|
utils_date_dateToDDMMYYYString,
|
309
313
|
utils_date_formatToDateTimeStartEnd,
|
@@ -318,11 +322,7 @@ export {
|
|
318
322
|
utils_currency_formatWithSuffix,
|
319
323
|
utils_excel_exportExcel,
|
320
324
|
utils_excel_download,
|
321
|
-
updateEnableList,
|
322
325
|
utils_reactQuery_updateListItemInQuery,
|
323
326
|
utils_time_convertTimeStringToSeconds,
|
324
|
-
utils_time_getCurrentTimeString
|
325
|
-
U0MyValidateEmpty,
|
326
|
-
U0MyValidateEmail,
|
327
|
-
utils_validator_validateCode
|
327
|
+
utils_time_getCurrentTimeString
|
328
328
|
};
|
@@ -0,0 +1,518 @@
|
|
1
|
+
import {
|
2
|
+
MyFlexColumn,
|
3
|
+
MyFlexRow
|
4
|
+
} from "./chunk-HHJFKKE7.mjs";
|
5
|
+
import {
|
6
|
+
const_object_colors
|
7
|
+
} from "./chunk-NWBLJ3W3.mjs";
|
8
|
+
import {
|
9
|
+
enum_daysOfWeek
|
10
|
+
} from "./chunk-K6S7R6LU.mjs";
|
11
|
+
import {
|
12
|
+
useMyReactMutation
|
13
|
+
} from "./chunk-OPVLK7PA.mjs";
|
14
|
+
import {
|
15
|
+
utils_notification_show
|
16
|
+
} from "./chunk-7ZCOFATU.mjs";
|
17
|
+
import {
|
18
|
+
__objRest,
|
19
|
+
__spreadProps,
|
20
|
+
__spreadValues
|
21
|
+
} from "./chunk-FWCSY2DS.mjs";
|
22
|
+
|
23
|
+
// src/core/button/MyActionIcon.tsx
|
24
|
+
import { ActionIcon } from "@mantine/core";
|
25
|
+
import {
|
26
|
+
IconDeviceFloppy,
|
27
|
+
IconEdit,
|
28
|
+
IconFileExport,
|
29
|
+
IconFileImport,
|
30
|
+
IconPlus,
|
31
|
+
IconPrinter,
|
32
|
+
IconTrash,
|
33
|
+
IconX
|
34
|
+
} from "@tabler/icons-react";
|
35
|
+
import { jsx } from "react/jsx-runtime";
|
36
|
+
var actionConfig = {
|
37
|
+
default: {},
|
38
|
+
create: {
|
39
|
+
color: "indigo",
|
40
|
+
type: "submit",
|
41
|
+
icon: /* @__PURE__ */ jsx(IconPlus, {})
|
42
|
+
},
|
43
|
+
createMultiple: {
|
44
|
+
color: "green",
|
45
|
+
type: "submit",
|
46
|
+
icon: /* @__PURE__ */ jsx(IconPlus, {})
|
47
|
+
},
|
48
|
+
delete: {
|
49
|
+
color: "red",
|
50
|
+
icon: /* @__PURE__ */ jsx(IconTrash, {})
|
51
|
+
},
|
52
|
+
update: {
|
53
|
+
color: "yellow",
|
54
|
+
type: "submit",
|
55
|
+
icon: /* @__PURE__ */ jsx(IconEdit, {})
|
56
|
+
},
|
57
|
+
save: {
|
58
|
+
color: "blue",
|
59
|
+
type: "submit",
|
60
|
+
icon: /* @__PURE__ */ jsx(IconDeviceFloppy, {})
|
61
|
+
},
|
62
|
+
import: {
|
63
|
+
color: "green.8",
|
64
|
+
icon: /* @__PURE__ */ jsx(IconFileImport, {})
|
65
|
+
},
|
66
|
+
print: {
|
67
|
+
color: "orange.7",
|
68
|
+
icon: /* @__PURE__ */ jsx(IconPrinter, {})
|
69
|
+
},
|
70
|
+
export: {
|
71
|
+
color: "green.8",
|
72
|
+
icon: /* @__PURE__ */ jsx(IconFileExport, {})
|
73
|
+
},
|
74
|
+
cancel: {
|
75
|
+
color: "gray",
|
76
|
+
icon: /* @__PURE__ */ jsx(IconX, {})
|
77
|
+
},
|
78
|
+
select: {},
|
79
|
+
check: {}
|
80
|
+
};
|
81
|
+
function MyActionIcon(_a) {
|
82
|
+
var _b = _a, { children, actionType } = _b, rest = __objRest(_b, ["children", "actionType"]);
|
83
|
+
if (!actionType) {
|
84
|
+
return /* @__PURE__ */ jsx(ActionIcon, __spreadProps(__spreadValues({}, rest), { children }));
|
85
|
+
}
|
86
|
+
const config = actionConfig[actionType];
|
87
|
+
return /* @__PURE__ */ jsx(
|
88
|
+
ActionIcon,
|
89
|
+
__spreadProps(__spreadValues({
|
90
|
+
color: config.color,
|
91
|
+
type: config.type
|
92
|
+
}, rest), {
|
93
|
+
children: config.icon
|
94
|
+
})
|
95
|
+
);
|
96
|
+
}
|
97
|
+
|
98
|
+
// src/core/button/MyButton.tsx
|
99
|
+
import { Button as Button2 } from "@mantine/core";
|
100
|
+
import {
|
101
|
+
IconDeviceFloppy as IconDeviceFloppy2,
|
102
|
+
IconEdit as IconEdit2,
|
103
|
+
IconFileExport as IconFileExport2,
|
104
|
+
IconFileImport as IconFileImport2,
|
105
|
+
IconPlus as IconPlus2,
|
106
|
+
IconPrinter as IconPrinter2,
|
107
|
+
IconTrash as IconTrash2,
|
108
|
+
IconX as IconX2
|
109
|
+
} from "@tabler/icons-react";
|
110
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
111
|
+
var actionConfig2 = {
|
112
|
+
default: {
|
113
|
+
defaultText: ""
|
114
|
+
},
|
115
|
+
create: {
|
116
|
+
color: "blue",
|
117
|
+
type: "submit",
|
118
|
+
icon: /* @__PURE__ */ jsx2(IconDeviceFloppy2, {}),
|
119
|
+
defaultText: "L\u01B0u"
|
120
|
+
},
|
121
|
+
createMultiple: {
|
122
|
+
color: "green",
|
123
|
+
type: "submit",
|
124
|
+
icon: /* @__PURE__ */ jsx2(IconPlus2, {}),
|
125
|
+
defaultText: "Th\xEAm danh s\xE1ch"
|
126
|
+
},
|
127
|
+
delete: {
|
128
|
+
color: "red",
|
129
|
+
icon: /* @__PURE__ */ jsx2(IconTrash2, {}),
|
130
|
+
defaultText: "X\xF3a"
|
131
|
+
},
|
132
|
+
update: {
|
133
|
+
color: "yellow",
|
134
|
+
type: "submit",
|
135
|
+
icon: /* @__PURE__ */ jsx2(IconEdit2, {}),
|
136
|
+
defaultText: "Ch\u1EC9nh s\u1EEDa"
|
137
|
+
},
|
138
|
+
save: {
|
139
|
+
color: "blue",
|
140
|
+
type: "submit",
|
141
|
+
icon: /* @__PURE__ */ jsx2(IconDeviceFloppy2, {}),
|
142
|
+
defaultText: "L\u01B0u"
|
143
|
+
},
|
144
|
+
import: {
|
145
|
+
color: "green.8",
|
146
|
+
icon: /* @__PURE__ */ jsx2(IconFileImport2, {}),
|
147
|
+
defaultText: "Import"
|
148
|
+
},
|
149
|
+
print: {
|
150
|
+
color: "orange.7",
|
151
|
+
icon: /* @__PURE__ */ jsx2(IconPrinter2, {}),
|
152
|
+
defaultText: "In"
|
153
|
+
},
|
154
|
+
export: {
|
155
|
+
color: "green.8",
|
156
|
+
icon: /* @__PURE__ */ jsx2(IconFileExport2, {}),
|
157
|
+
defaultText: "Export"
|
158
|
+
},
|
159
|
+
cancel: {
|
160
|
+
color: "gray",
|
161
|
+
icon: /* @__PURE__ */ jsx2(IconX2, {}),
|
162
|
+
defaultText: "H\u1EE7y thao t\xE1c"
|
163
|
+
},
|
164
|
+
select: {
|
165
|
+
defaultText: "Ch\u1ECDn"
|
166
|
+
},
|
167
|
+
check: {
|
168
|
+
defaultText: "Ch\u1ECDn"
|
169
|
+
}
|
170
|
+
};
|
171
|
+
function MyButton(_a) {
|
172
|
+
var _b = _a, { children, actionType } = _b, rest = __objRest(_b, ["children", "actionType"]);
|
173
|
+
if (!actionType) {
|
174
|
+
return /* @__PURE__ */ jsx2(Button2, __spreadProps(__spreadValues({}, rest), { children }));
|
175
|
+
}
|
176
|
+
const config = actionConfig2[actionType];
|
177
|
+
return /* @__PURE__ */ jsx2(
|
178
|
+
Button2,
|
179
|
+
__spreadProps(__spreadValues({
|
180
|
+
color: config.color,
|
181
|
+
type: config.type,
|
182
|
+
leftSection: config.icon
|
183
|
+
}, rest), {
|
184
|
+
children: children != null ? children : config.defaultText
|
185
|
+
})
|
186
|
+
);
|
187
|
+
}
|
188
|
+
|
189
|
+
// src/core/button/MyButtonCreateUpdate.tsx
|
190
|
+
import { useDisclosure } from "@mantine/hooks";
|
191
|
+
import { useQueryClient } from "@tanstack/react-query";
|
192
|
+
import { ActionIcon as ActionIcon2, Button as Button3, Modal } from "@mantine/core";
|
193
|
+
import { IconEdit as IconEdit3, IconPlus as IconPlus3 } from "@tabler/icons-react";
|
194
|
+
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
195
|
+
function MyButtonCreateUpdate({
|
196
|
+
modalProps,
|
197
|
+
actionIconProps,
|
198
|
+
buttonProps,
|
199
|
+
form,
|
200
|
+
onSubmit,
|
201
|
+
onSuccess,
|
202
|
+
onError,
|
203
|
+
closeModalWhenSubmit = true,
|
204
|
+
resetFormWhenSubmit = true,
|
205
|
+
children,
|
206
|
+
disclosure: externalDisclosure,
|
207
|
+
isUpdate = false
|
208
|
+
}) {
|
209
|
+
const defaultDisclosure = useDisclosure();
|
210
|
+
const disclosure = externalDisclosure != null ? externalDisclosure : defaultDisclosure;
|
211
|
+
const queryClient = useQueryClient();
|
212
|
+
const mutation = useMyReactMutation({
|
213
|
+
axiosFn: (values) => {
|
214
|
+
const result = onSubmit(values);
|
215
|
+
if (result === void 0) {
|
216
|
+
return Promise.resolve({
|
217
|
+
data: {
|
218
|
+
message: "T\u1EA1o th\xE0nh c\xF4ng (gi\u1EA3 l\u1EADp)",
|
219
|
+
data: {},
|
220
|
+
isSuccess: 1
|
221
|
+
},
|
222
|
+
status: 200,
|
223
|
+
statusText: "OK",
|
224
|
+
headers: {},
|
225
|
+
config: {}
|
226
|
+
});
|
227
|
+
}
|
228
|
+
return result;
|
229
|
+
},
|
230
|
+
options: __spreadValues(__spreadValues({
|
231
|
+
onSuccess: () => {
|
232
|
+
queryClient.invalidateQueries();
|
233
|
+
utils_notification_show({ crudType: isUpdate ? "update" : "create" });
|
234
|
+
disclosure[1].close();
|
235
|
+
if (closeModalWhenSubmit) disclosure[1].close();
|
236
|
+
if (resetFormWhenSubmit) form.reset();
|
237
|
+
}
|
238
|
+
}, onSuccess && {
|
239
|
+
onSuccess: () => {
|
240
|
+
onSuccess();
|
241
|
+
}
|
242
|
+
}), onError && {
|
243
|
+
onError: () => {
|
244
|
+
onError();
|
245
|
+
}
|
246
|
+
})
|
247
|
+
});
|
248
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
249
|
+
isUpdate == true ? /* @__PURE__ */ jsx3(
|
250
|
+
ActionIcon2,
|
251
|
+
__spreadProps(__spreadValues({
|
252
|
+
color: "yellow",
|
253
|
+
onClick: disclosure[1].open
|
254
|
+
}, actionIconProps), {
|
255
|
+
children: /* @__PURE__ */ jsx3(IconEdit3, {})
|
256
|
+
})
|
257
|
+
) : /* @__PURE__ */ jsx3(
|
258
|
+
Button3,
|
259
|
+
__spreadProps(__spreadValues({
|
260
|
+
onClick: disclosure[1].open,
|
261
|
+
leftSection: /* @__PURE__ */ jsx3(IconPlus3, {})
|
262
|
+
}, buttonProps), {
|
263
|
+
children: "Th\xEAm"
|
264
|
+
})
|
265
|
+
),
|
266
|
+
/* @__PURE__ */ jsx3(
|
267
|
+
Modal,
|
268
|
+
__spreadProps(__spreadValues({
|
269
|
+
title: isUpdate ? "S\u1EEDa d\u1EEF li\u1EC7u" : "Th\xEAm d\u1EEF li\u1EC7u",
|
270
|
+
opened: disclosure[0],
|
271
|
+
onClose: disclosure[1].close
|
272
|
+
}, modalProps), {
|
273
|
+
children: /* @__PURE__ */ jsx3("form", { onSubmit: form.onSubmit((values) => {
|
274
|
+
mutation.mutate(values);
|
275
|
+
}), children: /* @__PURE__ */ jsxs(MyFlexColumn, { children: [
|
276
|
+
children,
|
277
|
+
/* @__PURE__ */ jsx3(MyButton, { actionType: "create" })
|
278
|
+
] }) })
|
279
|
+
})
|
280
|
+
)
|
281
|
+
] });
|
282
|
+
}
|
283
|
+
|
284
|
+
// src/core/button/MyButtonModal.tsx
|
285
|
+
import { Button as Button4, Modal as Modal2 } from "@mantine/core";
|
286
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
287
|
+
function MyButtonModal({
|
288
|
+
disclosure,
|
289
|
+
children,
|
290
|
+
buttonProps,
|
291
|
+
modalProps
|
292
|
+
}) {
|
293
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
294
|
+
/* @__PURE__ */ jsx4(Button4, __spreadValues({ onClick: disclosure == null ? void 0 : disclosure[1].open, color: "indigo" }, buttonProps)),
|
295
|
+
/* @__PURE__ */ jsx4(
|
296
|
+
Modal2,
|
297
|
+
__spreadProps(__spreadValues({
|
298
|
+
opened: disclosure == null ? void 0 : disclosure[0],
|
299
|
+
onClose: disclosure[1].close
|
300
|
+
}, modalProps), {
|
301
|
+
children: /* @__PURE__ */ jsx4(MyFlexColumn, { children })
|
302
|
+
})
|
303
|
+
)
|
304
|
+
] });
|
305
|
+
}
|
306
|
+
|
307
|
+
// src/core/input/MyDayOfWeekPicker.tsx
|
308
|
+
import { Badge, Group } from "@mantine/core";
|
309
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
310
|
+
var days = Object.entries(enum_daysOfWeek).filter(([key]) => isNaN(Number(key))).map(([label, value]) => ({ label, value }));
|
311
|
+
function MyDayOfWeekPicker({ value = [], onChange }) {
|
312
|
+
const toggle = (val) => {
|
313
|
+
if (!onChange) return;
|
314
|
+
const newValue = value.includes(val) ? value.filter((v) => v !== val) : [...value, val].sort((a, b) => a - b);
|
315
|
+
onChange(newValue);
|
316
|
+
};
|
317
|
+
return /* @__PURE__ */ jsx5(MyFlexRow, { align: "center", children: /* @__PURE__ */ jsx5(Group, { gap: "xs", children: days.map((d) => /* @__PURE__ */ jsx5(
|
318
|
+
Badge,
|
319
|
+
{
|
320
|
+
variant: value.includes(d.value) ? "filled" : "outline",
|
321
|
+
color: "blue",
|
322
|
+
radius: "sm",
|
323
|
+
size: "lg",
|
324
|
+
onClick: () => toggle(d.value),
|
325
|
+
style: { cursor: onChange ? "pointer" : "default", userSelect: "none" },
|
326
|
+
children: d.label
|
327
|
+
},
|
328
|
+
d.value
|
329
|
+
)) }) });
|
330
|
+
}
|
331
|
+
|
332
|
+
// src/core/input/MyTextInput.tsx
|
333
|
+
import { TextInput } from "@mantine/core";
|
334
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
335
|
+
function MyTextInput(_a) {
|
336
|
+
var _b = _a, { label, isPhoneNumber } = _b, rest = __objRest(_b, ["label", "isPhoneNumber"]);
|
337
|
+
return /* @__PURE__ */ jsx6(
|
338
|
+
TextInput,
|
339
|
+
__spreadValues({
|
340
|
+
onKeyDown: (e) => {
|
341
|
+
if (!isPhoneNumber) return;
|
342
|
+
const allowedKeys = [
|
343
|
+
"Backspace",
|
344
|
+
"Tab",
|
345
|
+
"ArrowLeft",
|
346
|
+
"ArrowRight",
|
347
|
+
"Delete",
|
348
|
+
"+",
|
349
|
+
"-",
|
350
|
+
"(",
|
351
|
+
")",
|
352
|
+
" "
|
353
|
+
// các ký tự đặc biệt cho số điện thoại
|
354
|
+
];
|
355
|
+
if (!/[0-9]/.test(e.key) && !allowedKeys.includes(e.key)) {
|
356
|
+
e.preventDefault();
|
357
|
+
}
|
358
|
+
},
|
359
|
+
placeholder: label ? `Nh\u1EADp ${label == null ? void 0 : label.toLowerCase()}` : "",
|
360
|
+
label
|
361
|
+
}, rest)
|
362
|
+
);
|
363
|
+
}
|
364
|
+
|
365
|
+
// src/core/input/MyWeeklySessionSchedulerPicker.tsx
|
366
|
+
import {
|
367
|
+
Button as Button5,
|
368
|
+
Center,
|
369
|
+
Divider,
|
370
|
+
Group as Group2,
|
371
|
+
NumberInput,
|
372
|
+
Paper,
|
373
|
+
ScrollArea,
|
374
|
+
Text as Text2
|
375
|
+
} from "@mantine/core";
|
376
|
+
import { IconPlus as IconPlus4, IconTrash as IconTrash3 } from "@tabler/icons-react";
|
377
|
+
import { useState } from "react";
|
378
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
379
|
+
function MyWeeklySessionSchedulerPicker({
|
380
|
+
value = [],
|
381
|
+
onChange
|
382
|
+
}) {
|
383
|
+
const [selectedDays, setSelectedDays] = useState([]);
|
384
|
+
const handleAddSession = (dayOfWeek) => {
|
385
|
+
const newSession = {
|
386
|
+
dayOfWeek,
|
387
|
+
startPeriod: 1,
|
388
|
+
numberOfPeriods: 1,
|
389
|
+
durationMinutes: 90
|
390
|
+
};
|
391
|
+
onChange == null ? void 0 : onChange([...value, newSession]);
|
392
|
+
};
|
393
|
+
const handleRemove = (index) => {
|
394
|
+
const newData = [...value];
|
395
|
+
newData.splice(index, 1);
|
396
|
+
onChange == null ? void 0 : onChange(newData);
|
397
|
+
};
|
398
|
+
const handleUpdate = (index, key, val) => {
|
399
|
+
const newData = [...value];
|
400
|
+
newData[index][key] = val;
|
401
|
+
onChange == null ? void 0 : onChange(newData);
|
402
|
+
};
|
403
|
+
const grouped = value.reduce((acc, curr) => {
|
404
|
+
acc[curr.dayOfWeek] = acc[curr.dayOfWeek] || [];
|
405
|
+
acc[curr.dayOfWeek].push(curr);
|
406
|
+
return acc;
|
407
|
+
}, {});
|
408
|
+
const getLabel = (day) => enum_daysOfWeek[day] || `Day ${day}`;
|
409
|
+
return /* @__PURE__ */ jsx7(Paper, { w: "100%", p: "md", children: /* @__PURE__ */ jsxs3(MyFlexColumn, { children: [
|
410
|
+
/* @__PURE__ */ jsx7(Center, { children: /* @__PURE__ */ jsx7(
|
411
|
+
MyDayOfWeekPicker,
|
412
|
+
{
|
413
|
+
value: selectedDays,
|
414
|
+
onChange: (days2) => {
|
415
|
+
const sorted = [...days2].sort((a, b) => a - b);
|
416
|
+
setSelectedDays(sorted);
|
417
|
+
}
|
418
|
+
}
|
419
|
+
) }),
|
420
|
+
/* @__PURE__ */ jsx7(Divider, { my: "xs" }),
|
421
|
+
/* @__PURE__ */ jsx7(Center, { children: /* @__PURE__ */ jsx7(ScrollArea.Autosize, { h: "40vh", children: /* @__PURE__ */ jsx7(MyFlexColumn, { w: { base: "100%", sm: "70%" }, children: selectedDays.map((dayOfWeek) => {
|
422
|
+
var _a;
|
423
|
+
return /* @__PURE__ */ jsxs3(
|
424
|
+
Paper,
|
425
|
+
{
|
426
|
+
w: "100%",
|
427
|
+
p: "md",
|
428
|
+
bg: const_object_colors.mantineBackgroundBlueLight,
|
429
|
+
children: [
|
430
|
+
/* @__PURE__ */ jsxs3(Group2, { gap: "apart", children: [
|
431
|
+
/* @__PURE__ */ jsx7(Text2, { w: "70px", fw: 500, children: getLabel(dayOfWeek) }),
|
432
|
+
/* @__PURE__ */ jsx7(
|
433
|
+
Button5,
|
434
|
+
{
|
435
|
+
color: "teal.5",
|
436
|
+
leftSection: /* @__PURE__ */ jsx7(IconPlus4, { size: 14 }),
|
437
|
+
onClick: () => handleAddSession(dayOfWeek),
|
438
|
+
children: "Th\xEAm bu\u1ED5i"
|
439
|
+
}
|
440
|
+
)
|
441
|
+
] }),
|
442
|
+
/* @__PURE__ */ jsx7(Divider, { my: "sm" }),
|
443
|
+
(_a = grouped[dayOfWeek]) == null ? void 0 : _a.map((item, indexInDay) => {
|
444
|
+
const globalIndex = value.findIndex(
|
445
|
+
(v) => v === item
|
446
|
+
);
|
447
|
+
return /* @__PURE__ */ jsxs3(
|
448
|
+
Group2,
|
449
|
+
{
|
450
|
+
mt: "xs",
|
451
|
+
gap: "xs",
|
452
|
+
align: "flex-end",
|
453
|
+
children: [
|
454
|
+
/* @__PURE__ */ jsx7(
|
455
|
+
NumberInput,
|
456
|
+
{
|
457
|
+
label: "Ti\u1EBFt b\u1EAFt \u0111\u1EA7u",
|
458
|
+
value: item.startPeriod,
|
459
|
+
onChange: (val) => handleUpdate(
|
460
|
+
globalIndex,
|
461
|
+
"startPeriod",
|
462
|
+
val
|
463
|
+
)
|
464
|
+
}
|
465
|
+
),
|
466
|
+
/* @__PURE__ */ jsx7(
|
467
|
+
NumberInput,
|
468
|
+
{
|
469
|
+
label: "S\u1ED1 ti\u1EBFt",
|
470
|
+
value: item.numberOfPeriods,
|
471
|
+
onChange: (val) => handleUpdate(
|
472
|
+
globalIndex,
|
473
|
+
"numberOfPeriods",
|
474
|
+
val
|
475
|
+
)
|
476
|
+
}
|
477
|
+
),
|
478
|
+
/* @__PURE__ */ jsx7(
|
479
|
+
NumberInput,
|
480
|
+
{
|
481
|
+
label: "S\u1ED1 ph\xFAt ",
|
482
|
+
readOnly: true,
|
483
|
+
variant: "filled",
|
484
|
+
value: item.durationMinutes
|
485
|
+
}
|
486
|
+
),
|
487
|
+
/* @__PURE__ */ jsx7(
|
488
|
+
Button5,
|
489
|
+
{
|
490
|
+
variant: "light",
|
491
|
+
color: "red",
|
492
|
+
onClick: () => handleRemove(globalIndex),
|
493
|
+
leftSection: /* @__PURE__ */ jsx7(IconTrash3, { size: 14 }),
|
494
|
+
children: "X\xF3a bu\u1ED5i"
|
495
|
+
}
|
496
|
+
)
|
497
|
+
]
|
498
|
+
},
|
499
|
+
globalIndex
|
500
|
+
);
|
501
|
+
})
|
502
|
+
]
|
503
|
+
},
|
504
|
+
dayOfWeek
|
505
|
+
);
|
506
|
+
}) }) }) })
|
507
|
+
] }) });
|
508
|
+
}
|
509
|
+
|
510
|
+
export {
|
511
|
+
MyActionIcon,
|
512
|
+
MyButton,
|
513
|
+
MyButtonCreateUpdate,
|
514
|
+
MyButtonModal,
|
515
|
+
MyDayOfWeekPicker,
|
516
|
+
MyTextInput,
|
517
|
+
MyWeeklySessionSchedulerPicker
|
518
|
+
};
|
@@ -3,14 +3,53 @@ import {
|
|
3
3
|
__spreadValues
|
4
4
|
} from "./chunk-FWCSY2DS.mjs";
|
5
5
|
|
6
|
+
// src/hooks/useMyDevice.ts
|
7
|
+
import { useMediaQuery } from "@mantine/hooks";
|
8
|
+
function useMyDevice() {
|
9
|
+
const isMobile = useMediaQuery("(max-width: 768px)");
|
10
|
+
const isTablet = useMediaQuery("(max-width: 1024px)");
|
11
|
+
const isPc = !isTablet;
|
12
|
+
return {
|
13
|
+
isMobile,
|
14
|
+
isTablet: isTablet && !isMobile,
|
15
|
+
// từ 769px đến 1024px
|
16
|
+
isPc
|
17
|
+
};
|
18
|
+
}
|
19
|
+
|
20
|
+
// src/hooks/useMyRouter.tsx
|
21
|
+
import { usePathname, useRouter } from "next/navigation";
|
22
|
+
function useMyRouter() {
|
23
|
+
const pathName = usePathname();
|
24
|
+
const router = useRouter();
|
25
|
+
function pushUrl(url) {
|
26
|
+
router.push(pathName + url);
|
27
|
+
}
|
28
|
+
return __spreadProps(__spreadValues({}, router), {
|
29
|
+
pushUrl
|
30
|
+
});
|
31
|
+
}
|
32
|
+
|
6
33
|
// src/hooks/custom-hooks/createBaseApi.ts
|
7
34
|
function createBaseApi(baseUrl, axiosInstance) {
|
8
35
|
return {
|
9
|
-
get: ({
|
10
|
-
|
36
|
+
get: ({
|
37
|
+
params = "",
|
38
|
+
id,
|
39
|
+
paging
|
40
|
+
} = {}) => {
|
41
|
+
return axiosInstance.get(`${baseUrl}/get` + params, { params: __spreadProps(__spreadValues({}, paging), { id }) });
|
11
42
|
},
|
12
|
-
getAll: ({
|
13
|
-
|
43
|
+
getAll: ({
|
44
|
+
params = "",
|
45
|
+
cols,
|
46
|
+
paging
|
47
|
+
} = {}) => {
|
48
|
+
return axiosInstance.get(`${baseUrl}/GetAll` + params, {
|
49
|
+
params: __spreadValues({
|
50
|
+
cols: cols == null ? void 0 : cols.join(",")
|
51
|
+
}, paging)
|
52
|
+
});
|
14
53
|
},
|
15
54
|
create: (data) => {
|
16
55
|
return axiosInstance.post(`${baseUrl}/create`, __spreadProps(__spreadValues({}, data), {
|
@@ -22,6 +61,9 @@ function createBaseApi(baseUrl, axiosInstance) {
|
|
22
61
|
update: (data) => {
|
23
62
|
return axiosInstance.post(`${baseUrl}/update`, data);
|
24
63
|
},
|
64
|
+
updateList: (data) => {
|
65
|
+
return axiosInstance.post(`${baseUrl}/updateList`, data);
|
66
|
+
},
|
25
67
|
createOrUpdate: (data) => {
|
26
68
|
return axiosInstance.post(`${baseUrl}/createOrUpdate`, data);
|
27
69
|
},
|
@@ -99,7 +141,6 @@ function useMyReactMutation({
|
|
99
141
|
return res.data.data;
|
100
142
|
},
|
101
143
|
onError: (e) => {
|
102
|
-
console.log();
|
103
144
|
if (e.message === null || e.message === "null") {
|
104
145
|
notifications.show({
|
105
146
|
message: "Kh\xF4ng th\u1EC3 thao t\xE1c, l\u1ED7i ch\u01B0a x\xE1c \u0111\u1ECBnh!",
|
@@ -160,6 +201,8 @@ function useQ_SkillCenter_GetAll() {
|
|
160
201
|
}
|
161
202
|
|
162
203
|
export {
|
204
|
+
useMyDevice,
|
205
|
+
useMyRouter,
|
163
206
|
createBaseApi,
|
164
207
|
baseAxios_default,
|
165
208
|
useLoadAxiosConfig,
|