aq-fe-framework 0.1.566 → 0.1.568

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,5 +1,6 @@
1
1
  import {
2
2
  MyDataTable,
3
+ MyFieldset,
3
4
  MyFlexColumn,
4
5
  MyFlexRow
5
6
  } from "./chunk-HETWN2YJ.mjs";
@@ -194,7 +195,6 @@ function MyButton(_a) {
194
195
  import { ActionIcon as ActionIcon2, Button as Button2, Modal, ScrollArea, Space, useMantineColorScheme as useMantineColorScheme3 } from "@mantine/core";
195
196
  import { useDisclosure } from "@mantine/hooks";
196
197
  import { IconEdit as IconEdit3, IconPlus as IconPlus3 } from "@tabler/icons-react";
197
- import { useQueryClient } from "@tanstack/react-query";
198
198
 
199
199
  // src/core/layout/MyFlexColumn.tsx
200
200
  import { Flex } from "@mantine/core";
@@ -222,13 +222,13 @@ function MyButtonCreateUpdate({
222
222
  children,
223
223
  disclosure: externalDisclosure,
224
224
  isUpdate = false,
225
- scrollAreaAutosizeProps
225
+ scrollAreaAutosizeProps,
226
+ useMyReactMutationProps
226
227
  }) {
227
228
  const theme = useMantineColorScheme3();
228
229
  const defaultDisclosure = useDisclosure();
229
230
  const disclosure = externalDisclosure != null ? externalDisclosure : defaultDisclosure;
230
- const queryClient = useQueryClient();
231
- const mutation = useMyReactMutation({
231
+ const mutation = useMyReactMutation(__spreadValues({
232
232
  axiosFn: (values) => {
233
233
  return values;
234
234
  },
@@ -247,7 +247,7 @@ function MyButtonCreateUpdate({
247
247
  onError == null ? void 0 : onError(...args);
248
248
  }
249
249
  }
250
- });
250
+ }, useMyReactMutationProps));
251
251
  return /* @__PURE__ */ jsxs(Fragment, { children: [
252
252
  isUpdate == true ? /* @__PURE__ */ jsx4(
253
253
  ActionIcon2,
@@ -328,12 +328,6 @@ import ExcelJS from "exceljs";
328
328
  import { saveAs } from "file-saver";
329
329
  import { jsx as jsx5 } from "react/jsx-runtime";
330
330
 
331
- // src/core/button/MyButtonImport.tsx
332
- import { Button as Button4, FileInput } from "@mantine/core";
333
- import { useDisclosure as useDisclosure2 } from "@mantine/hooks";
334
- import { IconFileImport as IconFileImport2 } from "@tabler/icons-react";
335
- import { useMemo } from "react";
336
-
337
331
  // src/core/button/MyButtonModal.tsx
338
332
  import { Modal as Modal2 } from "@mantine/core";
339
333
  import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
@@ -369,12 +363,9 @@ function MyButtonModal({
369
363
  ] });
370
364
  }
371
365
 
372
- // src/core/button/MyButtonImport.tsx
373
- import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
374
-
375
366
  // src/core/button/MyButtonModalForm.tsx
376
367
  import { Stack } from "@mantine/core";
377
- import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
368
+ import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
378
369
  function MyButtonModalForm(_a) {
379
370
  var _b = _a, {
380
371
  isUpdate,
@@ -391,7 +382,7 @@ function MyButtonModalForm(_a) {
391
382
  "onSubmit",
392
383
  "isLoading"
393
384
  ]);
394
- return /* @__PURE__ */ jsx8(
385
+ return /* @__PURE__ */ jsx7(
395
386
  MyButtonModal,
396
387
  __spreadProps(__spreadValues({}, rest), {
397
388
  isActionIcon: isUpdate,
@@ -399,9 +390,9 @@ function MyButtonModalForm(_a) {
399
390
  buttonProps: { actionType: "create" },
400
391
  modalProps: { title: "Chi ti\u1EBFt d\u1EEF li\u1EC7u" },
401
392
  disclosure,
402
- children: /* @__PURE__ */ jsx8("form", { onSubmit: form.onSubmit(onSubmit), children: /* @__PURE__ */ jsxs4(Stack, { children: [
393
+ children: /* @__PURE__ */ jsx7("form", { onSubmit: form.onSubmit(onSubmit), children: /* @__PURE__ */ jsxs3(Stack, { children: [
403
394
  children,
404
- /* @__PURE__ */ jsx8(
395
+ /* @__PURE__ */ jsx7(
405
396
  MyButton,
406
397
  {
407
398
  actionType: "save",
@@ -414,11 +405,11 @@ function MyButtonModalForm(_a) {
414
405
  }
415
406
 
416
407
  // src/core/button/MyButtonPrintPDF.tsx
417
- import { Button as Button5 } from "@mantine/core";
408
+ import { Button as Button4 } from "@mantine/core";
418
409
  import { IconPrinter as IconPrinter3 } from "@tabler/icons-react";
419
410
  import { useRef } from "react";
420
411
  import { useReactToPrint } from "react-to-print";
421
- import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
412
+ import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
422
413
  function MyButtonPrintPDF({
423
414
  children,
424
415
  autoPadding = true,
@@ -443,9 +434,9 @@ function MyButtonPrintPDF({
443
434
  return ``;
444
435
  }
445
436
  };
446
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
447
- /* @__PURE__ */ jsx9("style", { children: getPageSizeCSS() }),
448
- /* @__PURE__ */ jsx9("div", { style: { display: "none" }, children: /* @__PURE__ */ jsx9(
437
+ return /* @__PURE__ */ jsxs4(Fragment3, { children: [
438
+ /* @__PURE__ */ jsx8("style", { children: getPageSizeCSS() }),
439
+ /* @__PURE__ */ jsx8("div", { style: { display: "none" }, children: /* @__PURE__ */ jsx8(
449
440
  "div",
450
441
  {
451
442
  ref: printRef,
@@ -456,12 +447,12 @@ function MyButtonPrintPDF({
456
447
  children
457
448
  }
458
449
  ) }),
459
- /* @__PURE__ */ jsx9(
460
- Button5,
450
+ /* @__PURE__ */ jsx8(
451
+ Button4,
461
452
  __spreadProps(__spreadValues({
462
453
  color: "orange",
463
454
  onClick: handlePrint,
464
- leftSection: /* @__PURE__ */ jsx9(IconPrinter3, {})
455
+ leftSection: /* @__PURE__ */ jsx8(IconPrinter3, {})
465
456
  }, buttonProps), {
466
457
  children: (buttonProps == null ? void 0 : buttonProps.children) || "In"
467
458
  })
@@ -470,20 +461,20 @@ function MyButtonPrintPDF({
470
461
  }
471
462
 
472
463
  // src/core/dataDisplay/MyDataTableSelectOne.tsx
473
- import { useEffect, useMemo as useMemo2 } from "react";
474
- import { jsx as jsx10 } from "react/jsx-runtime";
464
+ import { useEffect, useMemo } from "react";
465
+ import { jsx as jsx9 } from "react/jsx-runtime";
475
466
  function MyDataTableSelectOne({
476
467
  columns,
477
468
  queryResult,
478
469
  idSelection,
479
470
  setIdSelection
480
471
  }) {
481
- const columnsState = useMemo2(() => columns, []);
472
+ const columnsState = useMemo(() => columns, []);
482
473
  useEffect(() => {
483
474
  if (!queryResult.data) return;
484
475
  setIdSelection(queryResult.data[0].id);
485
476
  }, [queryResult.data]);
486
- return /* @__PURE__ */ jsx10(
477
+ return /* @__PURE__ */ jsx9(
487
478
  MyDataTable,
488
479
  {
489
480
  columns: columnsState,
@@ -509,30 +500,30 @@ function MyDataTableSelectOne({
509
500
 
510
501
  // src/core/dataDisplay/MyFlexIconTitle.tsx
511
502
  import { Flex as Flex2, Text } from "@mantine/core";
512
- import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
503
+ import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
513
504
  function MyFlexIconTitle(props) {
514
- return /* @__PURE__ */ jsxs6(Flex2, __spreadProps(__spreadValues({ direction: "row", align: "center", gap: "xs" }, props), { children: [
505
+ return /* @__PURE__ */ jsxs5(Flex2, __spreadProps(__spreadValues({ direction: "row", align: "center", gap: "xs" }, props), { children: [
515
506
  props.icon,
516
- /* @__PURE__ */ jsx11(Text, __spreadProps(__spreadValues({ size: "lg", fw: 700 }, props.textProps), { children: props == null ? void 0 : props.children }))
507
+ /* @__PURE__ */ jsx10(Text, __spreadProps(__spreadValues({ size: "lg", fw: 700 }, props.textProps), { children: props == null ? void 0 : props.children }))
517
508
  ] }));
518
509
  }
519
510
 
520
511
  // src/core/dataDisplay/MyInfoBox.tsx
521
512
  import { Group, Paper, Stack as Stack2, Text as Text2 } from "@mantine/core";
522
- import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
513
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
523
514
  function MyInfoBox({ title, data, paperProps }) {
524
- return /* @__PURE__ */ jsx12(Paper, __spreadProps(__spreadValues({ withBorder: true, shadow: "xs", radius: "md", p: "md", bg: const_object_colors.mantineBackgroundBlueLight }, paperProps), { children: /* @__PURE__ */ jsxs7(Stack2, { children: [
525
- title && /* @__PURE__ */ jsx12(Text2, { fw: 600, size: "sm", children: title }),
526
- data.map((item, index) => /* @__PURE__ */ jsxs7(Group, { justify: "space-between", children: [
527
- /* @__PURE__ */ jsx12(Text2, { size: "sm", fw: 500, c: "dimmed", children: item.label }),
528
- /* @__PURE__ */ jsx12(Text2, { size: "sm", fw: 500, children: item.value })
515
+ return /* @__PURE__ */ jsx11(Paper, __spreadProps(__spreadValues({ withBorder: true, shadow: "xs", radius: "md", p: "md", bg: const_object_colors.mantineBackgroundBlueLight }, paperProps), { children: /* @__PURE__ */ jsxs6(Stack2, { children: [
516
+ title && /* @__PURE__ */ jsx11(Text2, { fw: 600, size: "sm", children: title }),
517
+ data.map((item, index) => /* @__PURE__ */ jsxs6(Group, { justify: "space-between", children: [
518
+ /* @__PURE__ */ jsx11(Text2, { size: "sm", fw: 500, c: "dimmed", children: item.label }),
519
+ /* @__PURE__ */ jsx11(Text2, { size: "sm", fw: 500, children: item.value })
529
520
  ] }, index))
530
521
  ] }) }));
531
522
  }
532
523
 
533
524
  // src/core/dataDisplay/MyLabelValueRow.tsx
534
525
  import { Group as Group2, Text as Text3 } from "@mantine/core";
535
- import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
526
+ import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
536
527
  function MyLabelValueRow({
537
528
  label,
538
529
  value,
@@ -540,18 +531,18 @@ function MyLabelValueRow({
540
531
  valueProps,
541
532
  groupProps
542
533
  }) {
543
- return /* @__PURE__ */ jsxs8(Group2, __spreadProps(__spreadValues({ gap: 5, wrap: "nowrap" }, groupProps), { children: [
544
- /* @__PURE__ */ jsxs8(Text3, __spreadProps(__spreadValues({ fw: 600 }, labelProps), { children: [
534
+ return /* @__PURE__ */ jsxs7(Group2, __spreadProps(__spreadValues({ gap: 5, wrap: "nowrap" }, groupProps), { children: [
535
+ /* @__PURE__ */ jsxs7(Text3, __spreadProps(__spreadValues({ fw: 600 }, labelProps), { children: [
545
536
  label,
546
537
  ":"
547
538
  ] })),
548
- /* @__PURE__ */ jsx13(Text3, __spreadProps(__spreadValues({}, valueProps), { children: value }))
539
+ /* @__PURE__ */ jsx12(Text3, __spreadProps(__spreadValues({}, valueProps), { children: value }))
549
540
  ] }));
550
541
  }
551
542
 
552
543
  // src/core/dataDisplay/MyStatsCartd.tsx
553
544
  import { Box, Card, ThemeIcon } from "@mantine/core";
554
- import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
545
+ import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
555
546
  function MyStatsCard({
556
547
  title,
557
548
  value,
@@ -560,22 +551,22 @@ function MyStatsCard({
560
551
  color,
561
552
  themeIconProps
562
553
  }) {
563
- return /* @__PURE__ */ jsxs9(Card, { children: [
564
- /* @__PURE__ */ jsx14("div", { className: `absolute inset-0 bg-gradient-to-br ${color} opacity-5` }),
565
- /* @__PURE__ */ jsx14(Box, { className: "p-6", children: /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between", children: [
566
- /* @__PURE__ */ jsxs9("div", { children: [
567
- /* @__PURE__ */ jsx14("p", { className: "text-sm font-medium text-muted-foreground", children: title }),
568
- /* @__PURE__ */ jsx14("p", { className: "text-3xl font-bold", children: value }),
569
- /* @__PURE__ */ jsx14("p", { className: "text-xs text-muted-foreground mt-1", children: subtitle })
554
+ return /* @__PURE__ */ jsxs8(Card, { children: [
555
+ /* @__PURE__ */ jsx13("div", { className: `absolute inset-0 bg-gradient-to-br ${color} opacity-5` }),
556
+ /* @__PURE__ */ jsx13(Box, { className: "p-6", children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between", children: [
557
+ /* @__PURE__ */ jsxs8("div", { children: [
558
+ /* @__PURE__ */ jsx13("p", { className: "text-sm font-medium text-muted-foreground", children: title }),
559
+ /* @__PURE__ */ jsx13("p", { className: "text-3xl font-bold", children: value }),
560
+ /* @__PURE__ */ jsx13("p", { className: "text-xs text-muted-foreground mt-1", children: subtitle })
570
561
  ] }),
571
- /* @__PURE__ */ jsx14(ThemeIcon, __spreadProps(__spreadValues({ size: "xl", radius: "xl" }, themeIconProps), { children: icon }))
562
+ /* @__PURE__ */ jsx13(ThemeIcon, __spreadProps(__spreadValues({ size: "xl", radius: "xl" }, themeIconProps), { children: icon }))
572
563
  ] }) })
573
564
  ] });
574
565
  }
575
566
 
576
567
  // src/core/input/MyDayOfWeekPicker.tsx
577
568
  import { Badge, Group as Group3 } from "@mantine/core";
578
- import { jsx as jsx15 } from "react/jsx-runtime";
569
+ import { jsx as jsx14 } from "react/jsx-runtime";
579
570
  var days = Object.entries(enum_daysOfWeek).filter(([key]) => isNaN(Number(key))).map(([label, value]) => ({ label, value }));
580
571
  function MyDayOfWeekPicker({ value = [], onChange }) {
581
572
  const toggle = (val) => {
@@ -583,7 +574,7 @@ function MyDayOfWeekPicker({ value = [], onChange }) {
583
574
  const newValue = value.includes(val) ? value.filter((v) => v !== val) : [...value, val].sort((a, b) => a - b);
584
575
  onChange(newValue);
585
576
  };
586
- return /* @__PURE__ */ jsx15(MyFlexRow, { align: "center", children: /* @__PURE__ */ jsx15(Group3, { gap: "xs", children: days.map((d) => /* @__PURE__ */ jsx15(
577
+ return /* @__PURE__ */ jsx14(MyFlexRow, { align: "center", children: /* @__PURE__ */ jsx14(Group3, { gap: "xs", children: days.map((d) => /* @__PURE__ */ jsx14(
587
578
  Badge,
588
579
  {
589
580
  variant: value.includes(d.value) ? "filled" : "outline",
@@ -611,7 +602,7 @@ import Underline from "@tiptap/extension-underline";
611
602
  import { useEditor } from "@tiptap/react";
612
603
  import StarterKit from "@tiptap/starter-kit";
613
604
  import { useEffect as useEffect2 } from "react";
614
- import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
605
+ import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
615
606
  function MyRichTextEditor(props) {
616
607
  const editor = useEditor({
617
608
  extensions: [
@@ -695,44 +686,44 @@ function MyRichTextEditor(props) {
695
686
  editor.commands.setContent(props.value || "", false);
696
687
  }
697
688
  }, [props.value, editor]);
698
- return /* @__PURE__ */ jsx16(Input.Wrapper, __spreadProps(__spreadValues({}, props.inputWrapperProps), { children: /* @__PURE__ */ jsxs10(MantineRichTextEditor, __spreadProps(__spreadValues({ editor }, props.richTextEditorProps), { children: [
699
- /* @__PURE__ */ jsxs10(MantineRichTextEditor.Toolbar, __spreadProps(__spreadValues({}, props.richTextEditorToolBarProps), { children: [
700
- /* @__PURE__ */ jsxs10(MantineRichTextEditor.ControlsGroup, { children: [
701
- /* @__PURE__ */ jsx16(MantineRichTextEditor.Bold, {}),
702
- /* @__PURE__ */ jsx16(MantineRichTextEditor.Italic, {}),
703
- /* @__PURE__ */ jsx16(MantineRichTextEditor.Underline, {}),
704
- /* @__PURE__ */ jsx16(MantineRichTextEditor.Strikethrough, {}),
705
- /* @__PURE__ */ jsx16(MantineRichTextEditor.ClearFormatting, {}),
706
- /* @__PURE__ */ jsx16(MantineRichTextEditor.Highlight, {}),
707
- /* @__PURE__ */ jsx16(MantineRichTextEditor.Code, {})
689
+ return /* @__PURE__ */ jsx15(Input.Wrapper, __spreadProps(__spreadValues({}, props.inputWrapperProps), { children: /* @__PURE__ */ jsxs9(MantineRichTextEditor, __spreadProps(__spreadValues({ editor }, props.richTextEditorProps), { children: [
690
+ /* @__PURE__ */ jsxs9(MantineRichTextEditor.Toolbar, __spreadProps(__spreadValues({}, props.richTextEditorToolBarProps), { children: [
691
+ /* @__PURE__ */ jsxs9(MantineRichTextEditor.ControlsGroup, { children: [
692
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.Bold, {}),
693
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.Italic, {}),
694
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.Underline, {}),
695
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.Strikethrough, {}),
696
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.ClearFormatting, {}),
697
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.Highlight, {}),
698
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.Code, {})
708
699
  ] }),
709
- /* @__PURE__ */ jsxs10(MantineRichTextEditor.ControlsGroup, { children: [
710
- /* @__PURE__ */ jsx16(MantineRichTextEditor.H1, {}),
711
- /* @__PURE__ */ jsx16(MantineRichTextEditor.H2, {}),
712
- /* @__PURE__ */ jsx16(MantineRichTextEditor.H3, {}),
713
- /* @__PURE__ */ jsx16(MantineRichTextEditor.H4, {})
700
+ /* @__PURE__ */ jsxs9(MantineRichTextEditor.ControlsGroup, { children: [
701
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.H1, {}),
702
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.H2, {}),
703
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.H3, {}),
704
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.H4, {})
714
705
  ] }),
715
- /* @__PURE__ */ jsxs10(MantineRichTextEditor.ControlsGroup, { children: [
716
- /* @__PURE__ */ jsx16(MantineRichTextEditor.Blockquote, {}),
717
- /* @__PURE__ */ jsx16(MantineRichTextEditor.Hr, {}),
718
- /* @__PURE__ */ jsx16(MantineRichTextEditor.BulletList, {}),
719
- /* @__PURE__ */ jsx16(MantineRichTextEditor.OrderedList, {}),
720
- /* @__PURE__ */ jsx16(MantineRichTextEditor.Subscript, {}),
721
- /* @__PURE__ */ jsx16(MantineRichTextEditor.Superscript, {})
706
+ /* @__PURE__ */ jsxs9(MantineRichTextEditor.ControlsGroup, { children: [
707
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.Blockquote, {}),
708
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.Hr, {}),
709
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.BulletList, {}),
710
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.OrderedList, {}),
711
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.Subscript, {}),
712
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.Superscript, {})
722
713
  ] }),
723
- /* @__PURE__ */ jsxs10(MantineRichTextEditor.ControlsGroup, { children: [
724
- /* @__PURE__ */ jsx16(MantineRichTextEditor.Link, {}),
725
- /* @__PURE__ */ jsx16(MantineRichTextEditor.Unlink, {})
714
+ /* @__PURE__ */ jsxs9(MantineRichTextEditor.ControlsGroup, { children: [
715
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.Link, {}),
716
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.Unlink, {})
726
717
  ] }),
727
- /* @__PURE__ */ jsxs10(MantineRichTextEditor.ControlsGroup, { children: [
728
- /* @__PURE__ */ jsx16(MantineRichTextEditor.AlignLeft, {}),
729
- /* @__PURE__ */ jsx16(MantineRichTextEditor.AlignCenter, {}),
730
- /* @__PURE__ */ jsx16(MantineRichTextEditor.AlignJustify, {}),
731
- /* @__PURE__ */ jsx16(MantineRichTextEditor.AlignRight, {})
718
+ /* @__PURE__ */ jsxs9(MantineRichTextEditor.ControlsGroup, { children: [
719
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.AlignLeft, {}),
720
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.AlignCenter, {}),
721
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.AlignJustify, {}),
722
+ /* @__PURE__ */ jsx15(MantineRichTextEditor.AlignRight, {})
732
723
  ] }),
733
724
  props.extraControlsGroup
734
725
  ] })),
735
- /* @__PURE__ */ jsx16(
726
+ /* @__PURE__ */ jsx15(
736
727
  ScrollArea2.Autosize,
737
728
  __spreadProps(__spreadValues({
738
729
  onMouseDown: () => {
@@ -741,7 +732,7 @@ function MyRichTextEditor(props) {
741
732
  mah: "200",
742
733
  style: { cursor: "text" }
743
734
  }, props.scrollAreaAutosizeProps), {
744
- children: /* @__PURE__ */ jsx16(RichTextEditor.Content, __spreadValues({ mih: "200" }, props.richTextEditorContentProps))
735
+ children: /* @__PURE__ */ jsx15(RichTextEditor.Content, __spreadValues({ mih: "200" }, props.richTextEditorContentProps))
745
736
  })
746
737
  )
747
738
  ] })) }));
@@ -750,7 +741,7 @@ function MyRichTextEditor(props) {
750
741
  // src/core/input/MySelect.tsx
751
742
  import { Loader, Select } from "@mantine/core";
752
743
  import React from "react";
753
- import { jsx as jsx17 } from "react/jsx-runtime";
744
+ import { jsx as jsx16 } from "react/jsx-runtime";
754
745
  function extractTextFromReactNode(node) {
755
746
  if (typeof node === "string" || typeof node === "number") return String(node);
756
747
  if (Array.isArray(node)) return node.map(extractTextFromReactNode).join(" ");
@@ -768,7 +759,7 @@ function MySelect(_a) {
768
759
  const plainTextLabel = extractTextFromReactNode(label).toLowerCase().trim();
769
760
  placeholder = `Ch\u1ECDn ${plainTextLabel}`;
770
761
  }
771
- return /* @__PURE__ */ jsx17(
762
+ return /* @__PURE__ */ jsx16(
772
763
  Select,
773
764
  __spreadValues({
774
765
  searchable: true,
@@ -776,7 +767,7 @@ function MySelect(_a) {
776
767
  placeholder,
777
768
  data: data != null ? data : [],
778
769
  error: isError ? true : void 0,
779
- rightSection: isLoading ? /* @__PURE__ */ jsx17(Loader, { size: "xs" }) : void 0,
770
+ rightSection: isLoading ? /* @__PURE__ */ jsx16(Loader, { size: "xs" }) : void 0,
780
771
  disabled: isLoading || isError,
781
772
  styles: (theme) => ({
782
773
  input: rest.readOnly ? {
@@ -791,8 +782,8 @@ function MySelect(_a) {
791
782
  }
792
783
 
793
784
  // src/core/input/MySelectFromAPI.tsx
794
- import { useCallback, useEffect as useEffect3, useMemo as useMemo3, useRef as useRef2 } from "react";
795
- import { jsx as jsx18 } from "react/jsx-runtime";
785
+ import { useCallback, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef2 } from "react";
786
+ import { jsx as jsx17 } from "react/jsx-runtime";
796
787
  function MySelectFromAPI(_a) {
797
788
  var _b = _a, {
798
789
  queryKey,
@@ -824,7 +815,7 @@ function MySelectFromAPI(_a) {
824
815
  },
825
816
  [getOptionLabel, labelWithCode]
826
817
  );
827
- const options = useMemo3(() => {
818
+ const options = useMemo2(() => {
828
819
  var _a2, _b2;
829
820
  return (_b2 = (_a2 = query.data) == null ? void 0 : _a2.map((item) => {
830
821
  var _a3, _b3;
@@ -856,7 +847,7 @@ function MySelectFromAPI(_a) {
856
847
  hasAutoSelected.current = true;
857
848
  }
858
849
  }, [autoSelectFirstItem, query.data, value, getLabel, onChange, setObjectData]);
859
- return /* @__PURE__ */ jsx18(
850
+ return /* @__PURE__ */ jsx17(
860
851
  MySelect,
861
852
  __spreadValues({
862
853
  isLoading: query.isLoading,
@@ -870,10 +861,10 @@ function MySelectFromAPI(_a) {
870
861
 
871
862
  // src/core/input/MyTextInput.tsx
872
863
  import { TextInput } from "@mantine/core";
873
- import { jsx as jsx19 } from "react/jsx-runtime";
864
+ import { jsx as jsx18 } from "react/jsx-runtime";
874
865
  function MyTextInput(_a) {
875
866
  var _b = _a, { label, isPhoneNumber } = _b, rest = __objRest(_b, ["label", "isPhoneNumber"]);
876
- return /* @__PURE__ */ jsx19(
867
+ return /* @__PURE__ */ jsx18(
877
868
  TextInput,
878
869
  __spreadValues({
879
870
  onKeyDown: (e) => {
@@ -912,7 +903,7 @@ function MyTextInput(_a) {
912
903
 
913
904
  // src/core/input/MyWeeklySessionSchedulerPicker.tsx
914
905
  import {
915
- Button as Button6,
906
+ Button as Button5,
916
907
  Center,
917
908
  Divider,
918
909
  Group as Group4,
@@ -923,7 +914,7 @@ import {
923
914
  } from "@mantine/core";
924
915
  import { IconPlus as IconPlus4, IconTrash as IconTrash3 } from "@tabler/icons-react";
925
916
  import { useState } from "react";
926
- import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
917
+ import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
927
918
  function MyWeeklySessionSchedulerPicker({
928
919
  value = [],
929
920
  onChange
@@ -954,8 +945,8 @@ function MyWeeklySessionSchedulerPicker({
954
945
  return acc;
955
946
  }, {});
956
947
  const getLabel = (day) => enum_daysOfWeek[day] || `Day ${day}`;
957
- return /* @__PURE__ */ jsx20(Paper2, { w: "100%", p: "md", children: /* @__PURE__ */ jsxs11(MyFlexColumn, { children: [
958
- /* @__PURE__ */ jsx20(Center, { children: /* @__PURE__ */ jsx20(
948
+ return /* @__PURE__ */ jsx19(Paper2, { w: "100%", p: "md", children: /* @__PURE__ */ jsxs10(MyFlexColumn, { children: [
949
+ /* @__PURE__ */ jsx19(Center, { children: /* @__PURE__ */ jsx19(
959
950
  MyDayOfWeekPicker,
960
951
  {
961
952
  value: selectedDays,
@@ -965,41 +956,41 @@ function MyWeeklySessionSchedulerPicker({
965
956
  }
966
957
  }
967
958
  ) }),
968
- /* @__PURE__ */ jsx20(Divider, { my: "xs" }),
969
- /* @__PURE__ */ jsx20(Center, { children: /* @__PURE__ */ jsx20(ScrollArea3.Autosize, { h: "40vh", children: /* @__PURE__ */ jsx20(MyFlexColumn, { w: { base: "100%", sm: "70%" }, children: selectedDays.map((dayOfWeek) => {
959
+ /* @__PURE__ */ jsx19(Divider, { my: "xs" }),
960
+ /* @__PURE__ */ jsx19(Center, { children: /* @__PURE__ */ jsx19(ScrollArea3.Autosize, { h: "40vh", children: /* @__PURE__ */ jsx19(MyFlexColumn, { w: { base: "100%", sm: "70%" }, children: selectedDays.map((dayOfWeek) => {
970
961
  var _a;
971
- return /* @__PURE__ */ jsxs11(
962
+ return /* @__PURE__ */ jsxs10(
972
963
  Paper2,
973
964
  {
974
965
  w: "100%",
975
966
  p: "md",
976
967
  bg: const_object_colors.mantineBackgroundBlueLight,
977
968
  children: [
978
- /* @__PURE__ */ jsxs11(Group4, { gap: "apart", children: [
979
- /* @__PURE__ */ jsx20(Text5, { w: "70px", fw: 500, children: getLabel(dayOfWeek) }),
980
- /* @__PURE__ */ jsx20(
981
- Button6,
969
+ /* @__PURE__ */ jsxs10(Group4, { gap: "apart", children: [
970
+ /* @__PURE__ */ jsx19(Text5, { w: "70px", fw: 500, children: getLabel(dayOfWeek) }),
971
+ /* @__PURE__ */ jsx19(
972
+ Button5,
982
973
  {
983
974
  color: "teal.5",
984
- leftSection: /* @__PURE__ */ jsx20(IconPlus4, { size: 14 }),
975
+ leftSection: /* @__PURE__ */ jsx19(IconPlus4, { size: 14 }),
985
976
  onClick: () => handleAddSession(dayOfWeek),
986
977
  children: "Th\xEAm bu\u1ED5i"
987
978
  }
988
979
  )
989
980
  ] }),
990
- /* @__PURE__ */ jsx20(Divider, { my: "sm" }),
981
+ /* @__PURE__ */ jsx19(Divider, { my: "sm" }),
991
982
  (_a = grouped[dayOfWeek]) == null ? void 0 : _a.map((item, indexInDay) => {
992
983
  const globalIndex = value.findIndex(
993
984
  (v) => v === item
994
985
  );
995
- return /* @__PURE__ */ jsxs11(
986
+ return /* @__PURE__ */ jsxs10(
996
987
  Group4,
997
988
  {
998
989
  mt: "xs",
999
990
  gap: "xs",
1000
991
  align: "flex-end",
1001
992
  children: [
1002
- /* @__PURE__ */ jsx20(
993
+ /* @__PURE__ */ jsx19(
1003
994
  NumberInput,
1004
995
  {
1005
996
  label: "Ti\u1EBFt b\u1EAFt \u0111\u1EA7u",
@@ -1011,7 +1002,7 @@ function MyWeeklySessionSchedulerPicker({
1011
1002
  )
1012
1003
  }
1013
1004
  ),
1014
- /* @__PURE__ */ jsx20(
1005
+ /* @__PURE__ */ jsx19(
1015
1006
  NumberInput,
1016
1007
  {
1017
1008
  label: "S\u1ED1 ti\u1EBFt",
@@ -1023,7 +1014,7 @@ function MyWeeklySessionSchedulerPicker({
1023
1014
  )
1024
1015
  }
1025
1016
  ),
1026
- /* @__PURE__ */ jsx20(
1017
+ /* @__PURE__ */ jsx19(
1027
1018
  NumberInput,
1028
1019
  {
1029
1020
  label: "S\u1ED1 ph\xFAt ",
@@ -1032,13 +1023,13 @@ function MyWeeklySessionSchedulerPicker({
1032
1023
  value: item.durationMinutes
1033
1024
  }
1034
1025
  ),
1035
- /* @__PURE__ */ jsx20(
1036
- Button6,
1026
+ /* @__PURE__ */ jsx19(
1027
+ Button5,
1037
1028
  {
1038
1029
  variant: "light",
1039
1030
  color: "red",
1040
1031
  onClick: () => handleRemove(globalIndex),
1041
- leftSection: /* @__PURE__ */ jsx20(IconTrash3, { size: 14 }),
1032
+ leftSection: /* @__PURE__ */ jsx19(IconTrash3, { size: 14 }),
1042
1033
  children: "X\xF3a bu\u1ED5i"
1043
1034
  }
1044
1035
  )
@@ -1057,14 +1048,512 @@ function MyWeeklySessionSchedulerPicker({
1057
1048
 
1058
1049
  // src/core/layout/MyFlexEnd.tsx
1059
1050
  import { Group as Group5 } from "@mantine/core";
1060
- import { jsx as jsx21 } from "react/jsx-runtime";
1061
- function MyFlexEnd2(_a) {
1051
+ import { jsx as jsx20 } from "react/jsx-runtime";
1052
+ function MyFlexEnd(_a) {
1062
1053
  var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
1063
- return /* @__PURE__ */ jsx21(Group5, __spreadProps(__spreadValues({ justify: "end", mt: "md" }, rest), { children }));
1054
+ return /* @__PURE__ */ jsx20(Group5, __spreadProps(__spreadValues({ justify: "end", mt: "md" }, rest), { children }));
1064
1055
  }
1065
1056
 
1066
1057
  // src/core/overlays/MyPrintContent.tsx
1058
+ import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
1059
+ function MyPrintContent({
1060
+ children,
1061
+ autoPadding = true,
1062
+ pageSize,
1063
+ printRef
1064
+ }) {
1065
+ const getPageSizeCSS = () => {
1066
+ switch (pageSize) {
1067
+ case "landscape":
1068
+ return `@media print {@page { size: landscape; }}`;
1069
+ case "A4-landscape":
1070
+ return `@media print {@page { size: 29.7cm 21cm; }}`;
1071
+ case "portrait":
1072
+ default:
1073
+ return ``;
1074
+ }
1075
+ };
1076
+ return /* @__PURE__ */ jsxs11("div", { children: [
1077
+ /* @__PURE__ */ jsx21("style", { children: getPageSizeCSS() }),
1078
+ /* @__PURE__ */ jsx21("div", { style: { display: "none" }, children: /* @__PURE__ */ jsx21(
1079
+ "div",
1080
+ {
1081
+ ref: printRef,
1082
+ style: {
1083
+ padding: autoPadding ? "2cm 2cm 2cm 3cm" : void 0,
1084
+ fontFamily: '"Times New Roman", Times, serif'
1085
+ },
1086
+ children
1087
+ }
1088
+ ) })
1089
+ ] });
1090
+ }
1091
+
1092
+ // src/core/overlays/MyModalStackImport/Usecase/Usecase_FileFieldMappingModal.tsx
1093
+ import {
1094
+ Button as Button6,
1095
+ Group as Group6,
1096
+ Modal as Modal3,
1097
+ Select as Select2,
1098
+ Stack as Stack3,
1099
+ Table,
1100
+ Title
1101
+ } from "@mantine/core";
1102
+ import { IconChevronLeft, IconChevronRight, IconPlus as IconPlus5, IconRowRemove } from "@tabler/icons-react";
1103
+ import { useMemo as useMemo3, useState as useState2 } from "react";
1067
1104
  import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
1105
+ function Usecase_FileFieldMappingModal(_a) {
1106
+ var _b = _a, {
1107
+ jsonData,
1108
+ fieldDefinitions,
1109
+ onContinute,
1110
+ handleBack,
1111
+ onCloseAll
1112
+ } = _b, rest = __objRest(_b, [
1113
+ "jsonData",
1114
+ "fieldDefinitions",
1115
+ "onContinute",
1116
+ "handleBack",
1117
+ "onCloseAll"
1118
+ ]);
1119
+ const [selectedFields, setSelectedFields] = useState2([]);
1120
+ const [columnMapping, setColumnMapping] = useState2({});
1121
+ const excelColumns = useMemo3(() => {
1122
+ if (jsonData.length === 0) return [];
1123
+ return Object.keys(jsonData[0]);
1124
+ }, [jsonData]);
1125
+ const unselectedFields = useMemo3(
1126
+ () => fieldDefinitions.filter(
1127
+ (f) => !selectedFields.some((s) => s.key === f.key)
1128
+ ),
1129
+ [fieldDefinitions, selectedFields]
1130
+ );
1131
+ const handleAddField = (field) => {
1132
+ setSelectedFields((prev) => [...prev, field]);
1133
+ const matchingColumn = excelColumns.find(
1134
+ (col) => col.toLowerCase() === field.key.toLowerCase()
1135
+ );
1136
+ if (matchingColumn) {
1137
+ setColumnMapping((prev) => __spreadProps(__spreadValues({}, prev), {
1138
+ [field.key]: matchingColumn
1139
+ }));
1140
+ }
1141
+ };
1142
+ const handleRemoveField = (field) => {
1143
+ setSelectedFields((prev) => prev.filter((f) => f.key !== field.key));
1144
+ setColumnMapping((prev) => {
1145
+ const newMap = __spreadValues({}, prev);
1146
+ delete newMap[field.key];
1147
+ return newMap;
1148
+ });
1149
+ };
1150
+ const handleContinute = () => {
1151
+ const mapped = jsonData.map((row) => {
1152
+ const mappedRow = {};
1153
+ selectedFields.forEach((field) => {
1154
+ const colKey = columnMapping[field.key];
1155
+ if (colKey) {
1156
+ mappedRow[field.key] = row[colKey];
1157
+ }
1158
+ });
1159
+ return mappedRow;
1160
+ });
1161
+ onContinute(mapped);
1162
+ };
1163
+ return /* @__PURE__ */ jsxs12(
1164
+ Modal3,
1165
+ __spreadProps(__spreadValues({
1166
+ title: "Mapping d\u1EEF li\u1EC7u",
1167
+ size: "80%"
1168
+ }, rest), {
1169
+ children: [
1170
+ /* @__PURE__ */ jsxs12(Group6, { align: "start", grow: true, children: [
1171
+ /* @__PURE__ */ jsxs12(Stack3, { w: "45%", children: [
1172
+ /* @__PURE__ */ jsx22(Title, { order: 5, children: "Danh s\xE1ch tr\u01B0\u1EDDng th\xF4ng tin" }),
1173
+ /* @__PURE__ */ jsxs12(Table, { striped: true, children: [
1174
+ /* @__PURE__ */ jsx22(Table.Thead, { children: /* @__PURE__ */ jsxs12(Table.Tr, { children: [
1175
+ /* @__PURE__ */ jsx22(Table.Th, { children: "M\xE3 field" }),
1176
+ /* @__PURE__ */ jsx22(Table.Th, { children: "T\xEAn field" }),
1177
+ /* @__PURE__ */ jsx22(Table.Th, { children: /* @__PURE__ */ jsx22(
1178
+ Button6,
1179
+ {
1180
+ size: "xs",
1181
+ leftSection: /* @__PURE__ */ jsx22(IconPlus5, {}),
1182
+ onClick: () => {
1183
+ const newlyAdded = unselectedFields;
1184
+ setSelectedFields((prev) => [...prev, ...newlyAdded]);
1185
+ const newMappings = {};
1186
+ newlyAdded.forEach((field) => {
1187
+ const match = excelColumns.find(
1188
+ (col) => col.toLowerCase() === field.key.toLowerCase()
1189
+ );
1190
+ if (match) {
1191
+ newMappings[field.key] = match;
1192
+ }
1193
+ });
1194
+ setColumnMapping((prev) => __spreadValues(__spreadValues({}, prev), newMappings));
1195
+ },
1196
+ children: "Th\xEAm t\u1EA5t c\u1EA3"
1197
+ }
1198
+ ) })
1199
+ ] }) }),
1200
+ /* @__PURE__ */ jsx22(Table.Tbody, { children: unselectedFields.map((field) => /* @__PURE__ */ jsxs12(Table.Tr, { children: [
1201
+ /* @__PURE__ */ jsx22(Table.Td, { children: field.key }),
1202
+ /* @__PURE__ */ jsx22(Table.Td, { children: field.label }),
1203
+ /* @__PURE__ */ jsx22(Table.Td, { children: /* @__PURE__ */ jsx22(
1204
+ Button6,
1205
+ {
1206
+ variant: "light",
1207
+ onClick: () => handleAddField(field),
1208
+ leftSection: /* @__PURE__ */ jsx22(IconChevronRight, { size: 14 }),
1209
+ children: "Th\xEAm"
1210
+ }
1211
+ ) })
1212
+ ] }, field.key)) })
1213
+ ] })
1214
+ ] }),
1215
+ /* @__PURE__ */ jsxs12(Stack3, { w: "55%", children: [
1216
+ /* @__PURE__ */ jsx22(Title, { order: 5, children: "Tr\u01B0\u1EDDng \u0111\xE3 ch\u1ECDn & c\u1ED9t map" }),
1217
+ /* @__PURE__ */ jsxs12(Table, { striped: true, children: [
1218
+ /* @__PURE__ */ jsx22(Table.Thead, { children: /* @__PURE__ */ jsxs12(Table.Tr, { children: [
1219
+ /* @__PURE__ */ jsx22(Table.Th, { children: "M\xE3 field" }),
1220
+ /* @__PURE__ */ jsx22(Table.Th, { children: "T\xEAn field" }),
1221
+ /* @__PURE__ */ jsx22(Table.Th, { children: "C\u1ED9t map" }),
1222
+ /* @__PURE__ */ jsx22(Table.Th, { children: /* @__PURE__ */ jsx22(
1223
+ Button6,
1224
+ {
1225
+ size: "xs",
1226
+ leftSection: /* @__PURE__ */ jsx22(IconRowRemove, {}),
1227
+ color: "red",
1228
+ onClick: () => {
1229
+ setSelectedFields([]);
1230
+ setColumnMapping({});
1231
+ },
1232
+ children: "B\u1ECF t\u1EA5t c\u1EA3"
1233
+ }
1234
+ ) })
1235
+ ] }) }),
1236
+ /* @__PURE__ */ jsx22(Table.Tbody, { children: selectedFields.map((field) => /* @__PURE__ */ jsxs12(Table.Tr, { children: [
1237
+ /* @__PURE__ */ jsx22(Table.Td, { children: field.key }),
1238
+ /* @__PURE__ */ jsx22(Table.Td, { children: field.label }),
1239
+ /* @__PURE__ */ jsx22(Table.Td, { children: /* @__PURE__ */ jsx22(
1240
+ Select2,
1241
+ {
1242
+ placeholder: "Ch\u1ECDn c\u1ED9t",
1243
+ data: excelColumns,
1244
+ value: columnMapping[field.key] || null,
1245
+ onChange: (val) => setColumnMapping((prev) => __spreadProps(__spreadValues({}, prev), {
1246
+ [field.key]: val || ""
1247
+ })),
1248
+ searchable: true
1249
+ }
1250
+ ) }),
1251
+ /* @__PURE__ */ jsx22(Table.Td, { children: /* @__PURE__ */ jsx22(
1252
+ Button6,
1253
+ {
1254
+ variant: "light",
1255
+ onClick: () => handleRemoveField(field),
1256
+ leftSection: /* @__PURE__ */ jsx22(IconChevronLeft, { size: 14 }),
1257
+ children: "B\u1ECF"
1258
+ }
1259
+ ) })
1260
+ ] }, field.key)) })
1261
+ ] })
1262
+ ] })
1263
+ ] }),
1264
+ /* @__PURE__ */ jsxs12(Group6, { justify: "end", mt: "md", children: [
1265
+ /* @__PURE__ */ jsx22(Button6, { onClick: handleBack, children: "Quay l\u1EA1i" }),
1266
+ /* @__PURE__ */ jsx22(Button6, { onClick: handleContinute, children: "Ti\u1EBFp t\u1EE5c" }),
1267
+ /* @__PURE__ */ jsx22(Button6, { variant: "outline", onClick: onCloseAll, children: "\u0110\xF3ng" })
1268
+ ] })
1269
+ ]
1270
+ })
1271
+ );
1272
+ }
1273
+
1274
+ // src/core/overlays/MyModalStackImport/Usecase/Usecase_FileImportConfigModal.tsx
1275
+ import {
1276
+ Button as Button7,
1277
+ FileInput,
1278
+ Grid,
1279
+ Group as Group7,
1280
+ Modal as Modal4,
1281
+ Select as Select3,
1282
+ Stack as Stack4
1283
+ } from "@mantine/core";
1284
+ import { IconCopy } from "@tabler/icons-react";
1285
+ import { useEffect as useEffect4, useMemo as useMemo4, useState as useState3 } from "react";
1286
+ import * as XLSX from "xlsx";
1287
+ import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
1288
+ function Usecase_FileImportConfigModal(_a) {
1289
+ var _b = _a, {
1290
+ onChange,
1291
+ onContinute,
1292
+ onExportStructure
1293
+ } = _b, rest = __objRest(_b, [
1294
+ "onChange",
1295
+ "onContinute",
1296
+ "onExportStructure"
1297
+ ]);
1298
+ const [file, setFile] = useState3(null);
1299
+ const [rawData, setRawData] = useState3([]);
1300
+ const [parsedValueOnly, setParsedValueOnly] = useState3([]);
1301
+ const [titleIndex, setTitleIndex] = useState3("2");
1302
+ const [dataStartIndex, setDataStartIndex] = useState3("3");
1303
+ const parseExcel = async (file2) => {
1304
+ const data = await file2.arrayBuffer();
1305
+ const workbook = XLSX.read(data);
1306
+ const sheet = workbook.Sheets[workbook.SheetNames[0]];
1307
+ const json = XLSX.utils.sheet_to_json(sheet, { header: 1 });
1308
+ setRawData(json);
1309
+ };
1310
+ const handleSelectFile = (file2) => {
1311
+ setFile(file2);
1312
+ setRawData([]);
1313
+ setParsedValueOnly([]);
1314
+ setTitleIndex("2");
1315
+ setDataStartIndex("3");
1316
+ if (file2) parseExcel(file2);
1317
+ };
1318
+ useEffect4(() => {
1319
+ const headerRowIndex = titleIndex ? parseInt(titleIndex) - 1 : null;
1320
+ const dataRowIndex = dataStartIndex ? parseInt(dataStartIndex) - 1 : null;
1321
+ if (!rawData || headerRowIndex === null || dataRowIndex === null || dataRowIndex >= rawData.length || headerRowIndex >= rawData.length) {
1322
+ setParsedValueOnly([]);
1323
+ onChange([]);
1324
+ return;
1325
+ }
1326
+ const headers = rawData[headerRowIndex];
1327
+ const result = rawData.slice(dataRowIndex).map((row) => {
1328
+ const rowObj = {};
1329
+ headers.forEach((key, idx) => {
1330
+ rowObj[key || `col_${idx}`] = row[idx];
1331
+ });
1332
+ return rowObj;
1333
+ });
1334
+ setParsedValueOnly(result);
1335
+ onChange(result);
1336
+ }, [rawData, titleIndex, dataStartIndex]);
1337
+ const columns = useMemo4(() => {
1338
+ if (!rawData || rawData.length === 0) return [];
1339
+ const maxColLength = Math.max(...rawData.map((row) => row.length));
1340
+ return Array.from({ length: maxColLength }, (_, idx) => ({
1341
+ accessorKey: `col_${idx}`,
1342
+ header: `C\u1ED9t ${idx + 1}`
1343
+ }));
1344
+ }, [rawData]);
1345
+ const tableDisplayData = useMemo4(() => {
1346
+ return rawData.map((row) => {
1347
+ const obj = {};
1348
+ row.forEach((cell, idx) => {
1349
+ obj[`col_${idx}`] = cell;
1350
+ });
1351
+ return obj;
1352
+ });
1353
+ }, [rawData]);
1354
+ return /* @__PURE__ */ jsx23(
1355
+ Modal4,
1356
+ __spreadProps(__spreadValues({
1357
+ title: "Import",
1358
+ size: "80%"
1359
+ }, rest), {
1360
+ children: /* @__PURE__ */ jsxs13(Stack4, { children: [
1361
+ /* @__PURE__ */ jsxs13(Grid, { children: [
1362
+ /* @__PURE__ */ jsx23(Grid.Col, { span: 8, children: /* @__PURE__ */ jsx23(
1363
+ FileInput,
1364
+ {
1365
+ clearable: true,
1366
+ label: "Ch\u1ECDn t\u1EADp tin",
1367
+ placeholder: "Ch\u1ECDn file d\u1EEF li\u1EC7u",
1368
+ value: file,
1369
+ onChange: handleSelectFile
1370
+ }
1371
+ ) }),
1372
+ /* @__PURE__ */ jsx23(Grid.Col, { span: 4, children: /* @__PURE__ */ jsx23(Group7, { align: "end", h: "100%", children: /* @__PURE__ */ jsx23(Button7, { leftSection: /* @__PURE__ */ jsx23(IconCopy, {}), w: "100%", children: "D\xE1n t\u1EEB b\u1ED9 nh\u1EDB" }) }) }),
1373
+ /* @__PURE__ */ jsx23(Grid.Col, { span: { base: 12, md: 6 }, children: /* @__PURE__ */ jsx23(
1374
+ Select3,
1375
+ {
1376
+ value: titleIndex,
1377
+ onChange: setTitleIndex,
1378
+ label: "D\xF2ng ti\xEAu \u0111\u1EC1 b\u1EAFt \u0111\u1EA7u t\u1EEB",
1379
+ data: rawData.map((_, i) => (i + 1).toString()),
1380
+ disabled: !file
1381
+ }
1382
+ ) }),
1383
+ /* @__PURE__ */ jsx23(Grid.Col, { span: { base: 12, md: 6 }, children: /* @__PURE__ */ jsx23(
1384
+ Select3,
1385
+ {
1386
+ value: dataStartIndex,
1387
+ onChange: setDataStartIndex,
1388
+ label: "D\xF2ng d\u1EEF li\u1EC7u b\u1EAFt \u0111\u1EA7u t\u1EEB",
1389
+ data: rawData.map((_, i) => (i + 1).toString()),
1390
+ disabled: !file
1391
+ }
1392
+ ) })
1393
+ ] }),
1394
+ /* @__PURE__ */ jsx23(MyFieldset, { title: "Danh s\xE1ch tr\u01B0\u1EDDng th\xF4ng tin trong file d\u1EEF li\u1EC7u", children: /* @__PURE__ */ jsx23(MyDataTable, { columns, data: tableDisplayData }) }),
1395
+ /* @__PURE__ */ jsxs13(Group7, { justify: "end", children: [
1396
+ /* @__PURE__ */ jsx23(
1397
+ Button7,
1398
+ {
1399
+ onClick: onExportStructure,
1400
+ children: "Xu\u1EA5t file c\u1EA5u tr\xFAc"
1401
+ }
1402
+ ),
1403
+ /* @__PURE__ */ jsx23(Button7, { onClick: () => {
1404
+ onContinute == null ? void 0 : onContinute();
1405
+ }, children: "Ti\u1EBFp t\u1EE5c" }),
1406
+ /* @__PURE__ */ jsx23(Button7, { variant: "outline", onClick: rest.onClose, children: "\u0110\xF3ng" })
1407
+ ] })
1408
+ ] })
1409
+ })
1410
+ );
1411
+ }
1412
+
1413
+ // src/core/overlays/MyModalStackImport/MyModalStackImport.tsx
1414
+ import { Modal as Modal7 } from "@mantine/core";
1415
+ import { useState as useState4 } from "react";
1416
+
1417
+ // src/core/overlays/MyModalStackImport/Usecase/Usecase_FileImportValidationDetailModal.tsx
1418
+ import { Modal as Modal5, Table as Table2, Text as Text6 } from "@mantine/core";
1419
+ import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
1420
+ function Usecase_FileImportValidationDetailModal(_a) {
1421
+ var _b = _a, {
1422
+ data
1423
+ } = _b, props = __objRest(_b, [
1424
+ "data"
1425
+ ]);
1426
+ if (!data || data.length === 0) {
1427
+ return /* @__PURE__ */ jsx24(Modal5, __spreadProps(__spreadValues({}, props), { title: "Chi ti\u1EBFt l\u1ED7i", children: /* @__PURE__ */ jsx24(Text6, { children: "Kh\xF4ng c\xF3 d\u1EEF li\u1EC7u." }) }));
1428
+ }
1429
+ const columns = Object.keys(data[0].values || {});
1430
+ return /* @__PURE__ */ jsx24(Modal5, __spreadProps(__spreadValues({}, props), { title: "Chi ti\u1EBFt l\u1ED7i", size: "70%", zIndex: 1e3, children: /* @__PURE__ */ jsxs14(Table2, { withTableBorder: true, striped: true, children: [
1431
+ /* @__PURE__ */ jsx24(Table2.Thead, { children: /* @__PURE__ */ jsxs14(Table2.Tr, { children: [
1432
+ columns.map((col) => /* @__PURE__ */ jsx24(Table2.Th, { children: col }, col)),
1433
+ /* @__PURE__ */ jsx24(Table2.Th, { children: "L\u1ED7i" })
1434
+ ] }) }),
1435
+ /* @__PURE__ */ jsx24(Table2.Tbody, { children: data.map((row, i) => {
1436
+ var _a2;
1437
+ return /* @__PURE__ */ jsxs14(Table2.Tr, { children: [
1438
+ columns.map((col) => /* @__PURE__ */ jsx24(Table2.Td, { children: row.values[col] }, col)),
1439
+ /* @__PURE__ */ jsx24(Table2.Td, { children: (_a2 = row.error) != null ? _a2 : "" })
1440
+ ] }, i);
1441
+ }) })
1442
+ ] }) }));
1443
+ }
1444
+
1445
+ // src/core/overlays/MyModalStackImport/Usecase/Usecase_FileImportValidationModal.tsx
1446
+ import {
1447
+ Button as Button8,
1448
+ Group as Group8,
1449
+ Modal as Modal6,
1450
+ Table as Table3
1451
+ } from "@mantine/core";
1452
+ import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
1453
+ function Usecase_FileImportValidationModal(_a) {
1454
+ var _b = _a, {
1455
+ data,
1456
+ onExecute,
1457
+ onBack,
1458
+ onCloseAll,
1459
+ onOpenDetail
1460
+ } = _b, modalProps = __objRest(_b, [
1461
+ "data",
1462
+ "onExecute",
1463
+ "onBack",
1464
+ "onCloseAll",
1465
+ "onOpenDetail"
1466
+ ]);
1467
+ return /* @__PURE__ */ jsxs15(Modal6, __spreadProps(__spreadValues({}, modalProps), { title: "K\u1EBFt qu\u1EA3 ki\u1EC3m tra", children: [
1468
+ /* @__PURE__ */ jsxs15(Table3, { withTableBorder: true, striped: true, children: [
1469
+ /* @__PURE__ */ jsx25(Table3.Thead, { children: /* @__PURE__ */ jsxs15(Table3.Tr, { children: [
1470
+ /* @__PURE__ */ jsx25(Table3.Th, { children: "K\u1EBFt qu\u1EA3" }),
1471
+ /* @__PURE__ */ jsx25(Table3.Th, { children: "S\u1ED1 l\u01B0\u1EE3ng" }),
1472
+ /* @__PURE__ */ jsx25(Table3.Th, {})
1473
+ ] }) }),
1474
+ /* @__PURE__ */ jsx25(Table3.Tbody, { children: data.map((item, i) => /* @__PURE__ */ jsxs15(Table3.Tr, { children: [
1475
+ /* @__PURE__ */ jsx25(Table3.Td, { children: item.result }),
1476
+ /* @__PURE__ */ jsx25(Table3.Td, { children: item.count }),
1477
+ /* @__PURE__ */ jsx25(Table3.Td, { children: item.rows && item.rows.length > 0 && /* @__PURE__ */ jsx25(Button8, { variant: "light", onClick: () => onOpenDetail(item.rows), children: "Xem chi ti\u1EBFt" }) })
1478
+ ] }, i)) })
1479
+ ] }),
1480
+ /* @__PURE__ */ jsxs15(Group8, { justify: "space-between", mt: "md", children: [
1481
+ /* @__PURE__ */ jsx25(Button8, { variant: "default", onClick: onBack, children: "Quay l\u1EA1i" }),
1482
+ /* @__PURE__ */ jsx25(Button8, { onClick: onExecute, children: "Th\u1EF1c hi\u1EC7n import" })
1483
+ ] })
1484
+ ] }));
1485
+ }
1486
+
1487
+ // src/core/overlays/MyModalStackImport/MyModalStackImport.tsx
1488
+ import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
1489
+ function MyModalImport({
1490
+ fieldDefinition = [],
1491
+ stack,
1492
+ onExecute
1493
+ }) {
1494
+ const value = useState4([]);
1495
+ const valueMapping = useState4([]);
1496
+ const [detailRows, setDetailRows] = useState4([]);
1497
+ return /* @__PURE__ */ jsxs16(Modal7.Stack, { children: [
1498
+ /* @__PURE__ */ jsx26(
1499
+ Usecase_FileImportConfigModal,
1500
+ __spreadValues({
1501
+ value: value[0],
1502
+ onChange: (val) => {
1503
+ value[1](val);
1504
+ },
1505
+ onContinute: () => {
1506
+ stack.open("FileFieldMapping");
1507
+ },
1508
+ onExportStructure: () => {
1509
+ }
1510
+ }, stack.register("FileImportConfig"))
1511
+ ),
1512
+ /* @__PURE__ */ jsx26(
1513
+ Usecase_FileFieldMappingModal,
1514
+ __spreadValues({
1515
+ jsonData: value[0],
1516
+ handleBack: () => {
1517
+ stack.close("FileFieldMapping");
1518
+ },
1519
+ fieldDefinitions: fieldDefinition,
1520
+ onContinute: (mappedData) => {
1521
+ valueMapping[1](mappedData);
1522
+ stack.open("FileImportValidation");
1523
+ console.log(mappedData);
1524
+ onExecute(mappedData);
1525
+ },
1526
+ onCloseAll: () => {
1527
+ stack.closeAll();
1528
+ }
1529
+ }, stack.register("FileFieldMapping"))
1530
+ ),
1531
+ /* @__PURE__ */ jsx26(
1532
+ Usecase_FileImportValidationModal,
1533
+ __spreadValues({
1534
+ data: value[0],
1535
+ onExecute: () => {
1536
+ },
1537
+ onBack: () => {
1538
+ stack.close("FileImportValidation");
1539
+ },
1540
+ onCloseAll: () => {
1541
+ stack.closeAll();
1542
+ },
1543
+ onOpenDetail: (rows) => {
1544
+ setDetailRows(rows);
1545
+ stack.open("FileImportValidationDetail");
1546
+ }
1547
+ }, stack.register("FileImportValidation"))
1548
+ ),
1549
+ /* @__PURE__ */ jsx26(
1550
+ Usecase_FileImportValidationDetailModal,
1551
+ __spreadValues({
1552
+ data: detailRows
1553
+ }, stack.register("FileImportValidationDetail"))
1554
+ )
1555
+ ] });
1556
+ }
1068
1557
 
1069
1558
  export {
1070
1559
  MyActionIcon,
@@ -1085,5 +1574,7 @@ export {
1085
1574
  MySelectFromAPI,
1086
1575
  MyTextInput,
1087
1576
  MyWeeklySessionSchedulerPicker,
1088
- MyFlexEnd2 as MyFlexEnd
1577
+ MyFlexEnd,
1578
+ MyPrintContent,
1579
+ MyModalImport
1089
1580
  };
@@ -6,6 +6,7 @@ import { UseFormReturnType } from '@mantine/form';
6
6
  import { AxiosResponse } from 'axios';
7
7
  import { M as MyApiResponse } from '../createBaseApi-75GHCO22.mjs';
8
8
  import { useDisclosure } from '@mantine/hooks';
9
+ import { M as MyReactMutationProps } from '../useMyReactMutation-Db7UOVxL.mjs';
9
10
  import { UseReactToPrintOptions } from 'react-to-print';
10
11
  import { UseQueryResult, QueryKey, UseQueryOptions } from '@tanstack/react-query';
11
12
  import { MRT_RowData, MRT_ColumnDef } from 'mantine-react-table';
@@ -42,8 +43,9 @@ interface CoreButtonCreateUpdateProps<IReq, IRes> {
42
43
  resetFormWhenSubmit?: boolean;
43
44
  disclosure?: ReturnType<typeof useDisclosure>;
44
45
  children?: ReactNode;
46
+ useMyReactMutationProps?: Omit<MyReactMutationProps<Promise<AxiosResponse<MyApiResponse<IRes>, any>>, IRes>, "axiosFn">;
45
47
  }
46
- declare function MyButtonCreateUpdate<IReq, IRes>({ modalProps, actionIconProps, buttonProps, submitButtonProps, form, onSubmit, onSuccess, onError, ignoreDefaultOnError, ignoreDefaultOnSuccess, closeModalWhenSubmit, resetFormWhenSubmit, children, disclosure: externalDisclosure, isUpdate, scrollAreaAutosizeProps, }: CoreButtonCreateUpdateProps<IReq, IRes>): react_jsx_runtime.JSX.Element;
48
+ declare function MyButtonCreateUpdate<IReq, IRes>({ modalProps, actionIconProps, buttonProps, submitButtonProps, form, onSubmit, onSuccess, onError, ignoreDefaultOnError, ignoreDefaultOnSuccess, closeModalWhenSubmit, resetFormWhenSubmit, children, disclosure: externalDisclosure, isUpdate, scrollAreaAutosizeProps, useMyReactMutationProps }: CoreButtonCreateUpdateProps<IReq, IRes>): react_jsx_runtime.JSX.Element;
47
49
 
48
50
  interface IFieldStructure {
49
51
  fieldCode?: string;
@@ -205,5 +207,42 @@ interface MyPrintContentProps {
205
207
  pageSize?: PageSizeOption;
206
208
  printRef: React.RefObject<HTMLDivElement>;
207
209
  }
210
+ declare function MyPrintContent({ children, autoPadding, pageSize, printRef }: MyPrintContentProps): react_jsx_runtime.JSX.Element;
208
211
 
209
- export { type IWeeklySession, MyActionIcon, type MyActionIconProps, MyButton, MyButtonCreateUpdate, type MyButtonExportStructureProps, MyButtonModal, MyButtonModalForm, type MyButtonModalFormProps, type MyButtonModalProps, MyButtonPrintPDF, type MyButtonPrintPDFProps, type MyButtonProps$1 as MyButtonProps, MyDataTableSelectOne, MyDayOfWeekPicker, MyFlexColumn, MyFlexEnd, MyFlexIconTitle, MyInfoBox, type MyInfoBoxItem, type MyInfoBoxProps, MyLabelValueRow, type MyPrintContentProps, MyRichTextEditor, MySelect, MySelectFromAPI, type MySelectFromAPIProps, type MySelectProps, MyStatsCard, MyTextInput, MyWeeklySessionSchedulerPicker, type WeeklySessionSchedulerProps };
212
+ interface FieldDefinition {
213
+ key: string;
214
+ label: string;
215
+ }
216
+
217
+ type ModalImportId = "FileImportConfig" | "FileFieldMapping" | "FileImportValidation" | "FileImportValidationDetail";
218
+ interface ModalStackReturnType<T extends string> {
219
+ state: Record<T, boolean>;
220
+ open: (id: T) => void;
221
+ close: (id: T) => void;
222
+ toggle: (id: T) => void;
223
+ closeAll: () => void;
224
+ register: (id: T) => {
225
+ opened: boolean;
226
+ onClose: () => void;
227
+ stackId: T;
228
+ };
229
+ }
230
+ interface MyButtonImportProps {
231
+ fieldDefinition: FieldDefinition[];
232
+ stack: ModalStackReturnType<ModalImportId>;
233
+ onExecute: (values: any) => void;
234
+ }
235
+ declare function MyModalImport({ fieldDefinition, stack, onExecute }: MyButtonImportProps): react_jsx_runtime.JSX.Element;
236
+
237
+ interface RowDetail {
238
+ values: Record<string, string>;
239
+ error?: string;
240
+ }
241
+ interface ValidationResult {
242
+ result: string;
243
+ count: number;
244
+ detail?: string;
245
+ rows?: RowDetail[];
246
+ }
247
+
248
+ export { type FieldDefinition, type IWeeklySession, type ModalImportId, MyActionIcon, type MyActionIconProps, MyButton, MyButtonCreateUpdate, type MyButtonExportStructureProps, MyButtonModal, MyButtonModalForm, type MyButtonModalFormProps, type MyButtonModalProps, MyButtonPrintPDF, type MyButtonPrintPDFProps, type MyButtonProps$1 as MyButtonProps, MyDataTableSelectOne, MyDayOfWeekPicker, MyFlexColumn, MyFlexEnd, MyFlexIconTitle, MyInfoBox, type MyInfoBoxItem, type MyInfoBoxProps, MyLabelValueRow, MyModalImport, MyPrintContent, type MyPrintContentProps, MyRichTextEditor, MySelect, MySelectFromAPI, type MySelectFromAPIProps, type MySelectProps, MyStatsCard, MyTextInput, MyWeeklySessionSchedulerPicker, type RowDetail, type ValidationResult, type WeeklySessionSchedulerProps };
@@ -12,13 +12,15 @@ import {
12
12
  MyFlexIconTitle,
13
13
  MyInfoBox,
14
14
  MyLabelValueRow,
15
+ MyModalImport,
16
+ MyPrintContent,
15
17
  MyRichTextEditor,
16
18
  MySelect,
17
19
  MySelectFromAPI,
18
20
  MyStatsCard,
19
21
  MyTextInput,
20
22
  MyWeeklySessionSchedulerPicker
21
- } from "../chunk-74LBTATC.mjs";
23
+ } from "../chunk-JGU5ZCJ6.mjs";
22
24
  import "../chunk-GFEMKKFH.mjs";
23
25
  import {
24
26
  MyModalDelete
@@ -46,6 +48,8 @@ export {
46
48
  MyInfoBox,
47
49
  MyLabelValueRow,
48
50
  MyModalDelete,
51
+ MyModalImport,
52
+ MyPrintContent,
49
53
  MyRichTextEditor,
50
54
  MySelect,
51
55
  MySelectFromAPI,
@@ -15,7 +15,7 @@ import {
15
15
  MyButton as MyButton2,
16
16
  MyDataTableSelectOne,
17
17
  MyTextInput as MyTextInput2
18
- } from "../chunk-74LBTATC.mjs";
18
+ } from "../chunk-JGU5ZCJ6.mjs";
19
19
  import {
20
20
  const_object_documentTypes
21
21
  } from "../chunk-GFEMKKFH.mjs";
package/package.json CHANGED
@@ -46,7 +46,7 @@
46
46
  "types": "./dist/coreService/index.d.mts"
47
47
  }
48
48
  },
49
- "version": "0.1.566",
49
+ "version": "0.1.568",
50
50
  "private": false,
51
51
  "files": [
52
52
  "dist"