sevago-sso-fe 1.0.12 → 1.0.14

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/index.cjs.js CHANGED
@@ -20712,7 +20712,9 @@ const LoadingComponent = ({ color: color2, size = "medium", sx = {} }) => {
20712
20712
  };
20713
20713
  const BellComponent = ({}) => {
20714
20714
  const isSystemMonitor = useIsSystemMonitor();
20715
- const { notificationCount } = reactRedux.useSelector((state) => state.account);
20715
+ const { notificationCount } = reactRedux.useSelector(
20716
+ (state) => state.account
20717
+ );
20716
20718
  const account = reactRedux.useSelector((state) => state.account);
20717
20719
  const dispatch = useAppDispatch();
20718
20720
  const navigate = reactRouterDom.useNavigate();
@@ -20732,7 +20734,10 @@ const BellComponent = ({}) => {
20732
20734
  setList(res.list);
20733
20735
  dispatch(ACTION_ACCOUNT.changeNotificationCount(res.total));
20734
20736
  } catch (error) {
20735
- showSnackbar({ message: getErrorMessage(error), type: SnackbarType.ERROR });
20737
+ showSnackbar({
20738
+ message: getErrorMessage(error),
20739
+ type: SnackbarType.ERROR
20740
+ });
20736
20741
  } finally {
20737
20742
  setLoading(false);
20738
20743
  }
@@ -20755,7 +20760,10 @@ const BellComponent = ({}) => {
20755
20760
  }
20756
20761
  });
20757
20762
  } catch (error) {
20758
- showSnackbar({ message: getErrorMessage(error), type: SnackbarType.ERROR });
20763
+ showSnackbar({
20764
+ message: getErrorMessage(error),
20765
+ type: SnackbarType.ERROR
20766
+ });
20759
20767
  }
20760
20768
  };
20761
20769
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -20807,7 +20815,10 @@ const BellComponent = ({}) => {
20807
20815
  });
20808
20816
  dispatch(ACTION_ACCOUNT.changeNotificationCount(0));
20809
20817
  } catch (error) {
20810
- showSnackbar({ message: getErrorMessage(error), type: SnackbarType.ERROR });
20818
+ showSnackbar({
20819
+ message: getErrorMessage(error),
20820
+ type: SnackbarType.ERROR
20821
+ });
20811
20822
  }
20812
20823
  }
20813
20824
  }
@@ -20878,7 +20889,9 @@ const BellComponent = ({}) => {
20878
20889
  size: "large",
20879
20890
  sx: {
20880
20891
  color: isSystemMonitor ? palette.background.default : palette.primary.main,
20881
- "&:hover": { color: isSystemMonitor ? palette.background.default : palette.primary.main }
20892
+ "&:hover": {
20893
+ color: isSystemMonitor ? palette.background.default : palette.primary.main
20894
+ }
20882
20895
  }
20883
20896
  }
20884
20897
  )
@@ -21262,8 +21275,32 @@ const MonitorPart = ({
21262
21275
  const DashboardLayout = ({
21263
21276
  children
21264
21277
  }) => {
21265
- useUpdateCurrentAccess();
21266
- return /* @__PURE__ */ jsxRuntime.jsx(MonitorPart, { children });
21278
+ const isSystemMonitor = useIsSystemMonitor();
21279
+ const { sidebarWidth } = useSidebar();
21280
+ if (isSystemMonitor) return /* @__PURE__ */ jsxRuntime.jsx(MonitorPart, { children });
21281
+ return /* @__PURE__ */ jsxRuntime.jsx(
21282
+ material.Stack,
21283
+ {
21284
+ sx: {
21285
+ minHeight: "100vh",
21286
+ width: "100%"
21287
+ },
21288
+ children: /* @__PURE__ */ jsxRuntime.jsx(material.Stack, { p: 0, gap: 0, children: /* @__PURE__ */ jsxRuntime.jsx(StackRow, { children: /* @__PURE__ */ jsxRuntime.jsx(
21289
+ material.Stack,
21290
+ {
21291
+ sx: {
21292
+ overflowY: "auto",
21293
+ marginLeft: sidebarWidth,
21294
+ width: "100%",
21295
+ transition: "margin-left 0.3s ease",
21296
+ background: "#F5F6F8",
21297
+ minHeight: `calc(100vh - ${STYLE.HEIGHT_HEADER}px)`
21298
+ },
21299
+ children
21300
+ }
21301
+ ) }) })
21302
+ }
21303
+ );
21267
21304
  };
21268
21305
  const DefaultLayout = ({ children }) => {
21269
21306
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -26240,6 +26277,48 @@ const NotFoundPage = ({}) => {
26240
26277
  /* @__PURE__ */ jsxRuntime.jsx(ButtonElement, { content: "Quay lại trang chủ", fullWidth: false, onClick: () => navigate(PAGE.AUTH.path) })
26241
26278
  ] });
26242
26279
  };
26280
+ const IconLeft = (props) => /* @__PURE__ */ jsxRuntime.jsx(
26281
+ "svg",
26282
+ {
26283
+ width: "20",
26284
+ height: "16",
26285
+ viewBox: "0 0 20 16",
26286
+ fill: "none",
26287
+ xmlns: "http://www.w3.org/2000/svg",
26288
+ ...props,
26289
+ children: /* @__PURE__ */ jsxRuntime.jsx(
26290
+ "path",
26291
+ {
26292
+ d: "M8 15L1 8M1 8L8 1M1 8L19 8",
26293
+ stroke: "currentColor",
26294
+ "stroke-width": "2",
26295
+ "stroke-linecap": "round",
26296
+ "stroke-linejoin": "round"
26297
+ }
26298
+ )
26299
+ }
26300
+ );
26301
+ const IconRight = (props) => /* @__PURE__ */ jsxRuntime.jsx(
26302
+ "svg",
26303
+ {
26304
+ width: "20",
26305
+ height: "16",
26306
+ viewBox: "0 0 20 16",
26307
+ fill: "none",
26308
+ xmlns: "http://www.w3.org/2000/svg",
26309
+ ...props,
26310
+ children: /* @__PURE__ */ jsxRuntime.jsx(
26311
+ "path",
26312
+ {
26313
+ d: "M12 1L19 8M19 8L12 15M19 8L1 8",
26314
+ stroke: "currentColor",
26315
+ "stroke-width": "2",
26316
+ "stroke-linecap": "round",
26317
+ "stroke-linejoin": "round"
26318
+ }
26319
+ )
26320
+ }
26321
+ );
26243
26322
  const LayoutGroupContext = React.createContext({});
26244
26323
  function useConstant(init) {
26245
26324
  const ref = React.useRef(null);
@@ -33515,48 +33594,6 @@ const MotionBox = ({
33515
33594
  } : {};
33516
33595
  return /* @__PURE__ */ jsxRuntime.jsx(motion.div, { ...motionProps, ...getAnimationProps(), ...hoverProps, onClick, style: { ...sx }, children });
33517
33596
  };
33518
- const IconRight = (props) => /* @__PURE__ */ jsxRuntime.jsx(
33519
- "svg",
33520
- {
33521
- width: "20",
33522
- height: "16",
33523
- viewBox: "0 0 20 16",
33524
- fill: "none",
33525
- xmlns: "http://www.w3.org/2000/svg",
33526
- ...props,
33527
- children: /* @__PURE__ */ jsxRuntime.jsx(
33528
- "path",
33529
- {
33530
- d: "M12 1L19 8M19 8L12 15M19 8L1 8",
33531
- stroke: "currentColor",
33532
- "stroke-width": "2",
33533
- "stroke-linecap": "round",
33534
- "stroke-linejoin": "round"
33535
- }
33536
- )
33537
- }
33538
- );
33539
- const IconLeft = (props) => /* @__PURE__ */ jsxRuntime.jsx(
33540
- "svg",
33541
- {
33542
- width: "20",
33543
- height: "16",
33544
- viewBox: "0 0 20 16",
33545
- fill: "none",
33546
- xmlns: "http://www.w3.org/2000/svg",
33547
- ...props,
33548
- children: /* @__PURE__ */ jsxRuntime.jsx(
33549
- "path",
33550
- {
33551
- d: "M8 15L1 8M1 8L8 1M1 8L19 8",
33552
- stroke: "currentColor",
33553
- "stroke-width": "2",
33554
- "stroke-linecap": "round",
33555
- "stroke-linejoin": "round"
33556
- }
33557
- )
33558
- }
33559
- );
33560
33597
  const AppGrid = ({
33561
33598
  apps,
33562
33599
  onClickItem,
@@ -33577,12 +33614,25 @@ const AppGrid = ({
33577
33614
  const pageSize = Math.max(1, columns * Math.max(1, rows));
33578
33615
  const totalPages = Math.max(1, Math.ceil(apps.length / pageSize));
33579
33616
  const [page, setPage] = React.useState(0);
33617
+ const { user } = reactRedux.useSelector((state) => state.account);
33580
33618
  React.useEffect(() => {
33581
33619
  setPage((prev) => prev >= totalPages ? totalPages - 1 : prev);
33582
33620
  }, [totalPages, columns, rows, apps.length]);
33583
33621
  const start = page * pageSize;
33584
33622
  const end = start + pageSize;
33585
33623
  const visibleApps = totalPages > 1 ? apps.slice(start, end) : apps;
33624
+ const findLink = (app2) => {
33625
+ if (!app2.children?.length) {
33626
+ return app2.path;
33627
+ }
33628
+ for (const i of app2.children || []) {
33629
+ if (user?.type && i.allowUserTypes.includes(user?.type)) {
33630
+ if (i.path) {
33631
+ return `${i.path}`;
33632
+ }
33633
+ }
33634
+ }
33635
+ };
33586
33636
  return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { position: "relative" }, children: [
33587
33637
  /* @__PURE__ */ jsxRuntime.jsx(
33588
33638
  material.Box,
@@ -33594,62 +33644,73 @@ const AppGrid = ({
33594
33644
  },
33595
33645
  children: visibleApps.map((app2, index) => {
33596
33646
  const isSelected = selectedAppId === app2.key;
33597
- return /* @__PURE__ */ jsxRuntime.jsxs(
33598
- MotionBox,
33647
+ return /* @__PURE__ */ jsxRuntime.jsx(
33648
+ reactRouterDom.Link,
33599
33649
  {
33600
- preset: "staggerItem",
33601
- index,
33602
- hover: true,
33603
- onClick: () => onClickItem?.(app2),
33604
- sx: {
33605
- cursor: "pointer",
33606
- display: "flex",
33607
- flex: 1,
33608
- alignItems: "center",
33609
- flexDirection: "column"
33650
+ to: findLink(app2) || "#",
33651
+ style: {
33652
+ textDecoration: "none",
33653
+ color: "inherit",
33654
+ width: "100%"
33610
33655
  },
33611
- children: [
33612
- /* @__PURE__ */ jsxRuntime.jsx(
33613
- material.Box,
33614
- {
33615
- sx: {
33616
- width: iconSize,
33617
- height: iconSize,
33618
- borderRadius: iconRadius,
33619
- mb: 1.5,
33620
- display: "flex",
33621
- alignItems: "center",
33622
- justifyContent: "center",
33623
- background: getAppColor(app2.category),
33624
- boxShadow: isSelected ? `0 0 0 1px ${theme.palette.primary.main}, ${iconShadow}` : iconShadow
33625
- },
33626
- children: app2.icon.startsWith("/") && /* @__PURE__ */ jsxRuntime.jsx(
33627
- ImageElement,
33656
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
33657
+ MotionBox,
33658
+ {
33659
+ preset: "staggerItem",
33660
+ index,
33661
+ hover: true,
33662
+ onClick: () => onClickItem?.(app2),
33663
+ sx: {
33664
+ cursor: "pointer",
33665
+ display: "flex",
33666
+ flex: 1,
33667
+ alignItems: "center",
33668
+ flexDirection: "column"
33669
+ },
33670
+ children: [
33671
+ /* @__PURE__ */ jsxRuntime.jsx(
33672
+ material.Box,
33673
+ {
33674
+ sx: {
33675
+ width: iconSize,
33676
+ height: iconSize,
33677
+ borderRadius: iconRadius,
33678
+ mb: 1.5,
33679
+ display: "flex",
33680
+ alignItems: "center",
33681
+ justifyContent: "center",
33682
+ background: getAppColor(app2.category),
33683
+ boxShadow: isSelected ? `0 0 0 1px ${theme.palette.primary.main}, ${iconShadow}` : iconShadow
33684
+ },
33685
+ children: app2.icon.startsWith("/") && /* @__PURE__ */ jsxRuntime.jsx(
33686
+ ImageElement,
33687
+ {
33688
+ sx: { width: iconSize * 0.56, height: iconSize * 0.56 },
33689
+ url: app2.icon,
33690
+ sizeType: ImageSizeType.SQUARE
33691
+ }
33692
+ )
33693
+ }
33694
+ ),
33695
+ /* @__PURE__ */ jsxRuntime.jsx(
33696
+ material.Typography,
33628
33697
  {
33629
- sx: { width: iconSize * 0.56, height: iconSize * 0.56 },
33630
- url: app2.icon,
33631
- sizeType: ImageSizeType.SQUARE
33698
+ variant: titleVariant,
33699
+ sx: { color: titleColor ?? theme.palette.common.white },
33700
+ children: app2.title
33701
+ }
33702
+ ),
33703
+ /* @__PURE__ */ jsxRuntime.jsx(
33704
+ material.Typography,
33705
+ {
33706
+ variant: captionVariant,
33707
+ sx: { color: captionColor ?? theme.palette.common.white },
33708
+ children: app2.caption
33632
33709
  }
33633
33710
  )
33634
- }
33635
- ),
33636
- /* @__PURE__ */ jsxRuntime.jsx(
33637
- material.Typography,
33638
- {
33639
- variant: titleVariant,
33640
- sx: { color: titleColor ?? theme.palette.common.white },
33641
- children: app2.title
33642
- }
33643
- ),
33644
- /* @__PURE__ */ jsxRuntime.jsx(
33645
- material.Typography,
33646
- {
33647
- variant: captionVariant,
33648
- sx: { color: captionColor ?? theme.palette.common.white },
33649
- children: app2.caption
33650
- }
33651
- )
33652
- ]
33711
+ ]
33712
+ }
33713
+ )
33653
33714
  },
33654
33715
  app2.key
33655
33716
  );
@@ -33732,143 +33793,6 @@ const AppGrid = ({
33732
33793
  ] })
33733
33794
  ] });
33734
33795
  };
33735
- const SystemMonitorScreen = () => {
33736
- const theme = useTheme();
33737
- reactRouterDom.useNavigate();
33738
- const dispatch = useAppDispatch();
33739
- const [tab, setTab] = React.useState(AppCategory.ALL);
33740
- const listApp = useApps(tab);
33741
- const currentApp = useActiveSidebar();
33742
- return /* @__PURE__ */ jsxRuntime.jsx(
33743
- MotionBox,
33744
- {
33745
- preset: "fadeInUp",
33746
- sx: {
33747
- display: "flex",
33748
- flexDirection: "column",
33749
- alignItems: "center",
33750
- position: "relative",
33751
- top: 150
33752
- },
33753
- children: /* @__PURE__ */ jsxRuntime.jsxs(
33754
- material.Box,
33755
- {
33756
- sx: {
33757
- width: 865,
33758
- gap: 6.25,
33759
- display: "flex",
33760
- flexDirection: "column",
33761
- justifyContent: "flex-start"
33762
- },
33763
- children: [
33764
- /* @__PURE__ */ jsxRuntime.jsx(
33765
- material.Box,
33766
- {
33767
- sx: {
33768
- display: "flex",
33769
- gap: PADDING_GAP_TAB,
33770
- width: "100%",
33771
- justifyContent: "flex-start"
33772
- },
33773
- children: [
33774
- { key: AppCategory.ALL, label: "Tất Cả" },
33775
- { key: AppCategory.HRM, label: "HRM" },
33776
- { key: AppCategory.WORKFLOW, label: "Workflow Engine" },
33777
- { key: AppCategory.PLATFORM_INFO, label: "Platform & Info" }
33778
- ].map((t) => /* @__PURE__ */ jsxRuntime.jsxs(
33779
- MotionBox,
33780
- {
33781
- sx: { position: "relative" },
33782
- preset: "tabUnderline",
33783
- children: [
33784
- /* @__PURE__ */ jsxRuntime.jsx(
33785
- material.Typography,
33786
- {
33787
- onClick: () => setTab(t.key),
33788
- sx: {
33789
- cursor: "pointer",
33790
- color: tab === t.key ? theme.palette.common.white : theme.palette.grey[300]
33791
- },
33792
- children: t.label
33793
- }
33794
- ),
33795
- tab === t.key && /* @__PURE__ */ jsxRuntime.jsx(
33796
- MotionBox,
33797
- {
33798
- preset: "tabUnderline",
33799
- sx: {
33800
- position: "absolute",
33801
- left: 0,
33802
- right: 0,
33803
- height: 2,
33804
- backgroundColor: theme.palette.common.white,
33805
- transformOrigin: "left"
33806
- },
33807
- children: /* @__PURE__ */ jsxRuntime.jsx("div", {})
33808
- }
33809
- )
33810
- ]
33811
- },
33812
- t.key
33813
- ))
33814
- }
33815
- ),
33816
- /* @__PURE__ */ jsxRuntime.jsx(MotionBox, { preset: "tabContent", children: /* @__PURE__ */ jsxRuntime.jsx(
33817
- AppGrid,
33818
- {
33819
- apps: listApp,
33820
- columns: 5,
33821
- iconSize: 80,
33822
- iconRadius: 7,
33823
- gap: PADDING_GAP_TAB,
33824
- selectedAppId: currentApp?.key,
33825
- onClickItem: async (app2) => {
33826
- await dispatch(
33827
- ACTION_ACCOUNT.updateCurrentAccess(app2.key)
33828
- ).unwrap();
33829
- }
33830
- }
33831
- ) }, tab)
33832
- ]
33833
- }
33834
- )
33835
- }
33836
- );
33837
- };
33838
- const renderRoutes = (routes2, account) => routes2.map((route) => {
33839
- const { path, layout: layout2, element, type, allowUserTypes = [], children } = route;
33840
- const Layout = layout2 || React.Fragment;
33841
- let Element2 = element;
33842
- if (path === PAGE.AUTH.path && account.isLogin) Element2 = () => /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: PAGE.DASHBOARD.path });
33843
- if (type === RouteType.PROTECTED) {
33844
- if (!account.isLogin) Element2 = () => /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: PAGE.AUTH.path });
33845
- else if (allowUserTypes.length && !allowUserTypes.includes(account.user.type) && account.user.type !== UserType.ROOT)
33846
- Element2 = () => /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: PAGE.ERROR.path });
33847
- }
33848
- return /* @__PURE__ */ jsxRuntime.jsx(
33849
- reactRouterDom.Route,
33850
- {
33851
- path,
33852
- element: /* @__PURE__ */ jsxRuntime.jsx(Layout, { children: /* @__PURE__ */ jsxRuntime.jsx(Element2, {}) }),
33853
- children: children && renderRoutes(children, account)
33854
- },
33855
- path
33856
- );
33857
- });
33858
- const routes = [
33859
- { ...PAGE.AUTH, element: AuthPage, layout: AuthLayout },
33860
- { ...PAGE.NOT_FOUND, element: NotFoundPage, layout: DefaultLayout },
33861
- { ...PAGE.ERROR, element: ErrorPage, layout: DefaultLayout },
33862
- // PROTECTED
33863
- {
33864
- ...PAGE.DASHBOARD,
33865
- element: DashboardPage,
33866
- layout: DashboardLayout,
33867
- children: [
33868
- { ...PAGE.DASHBOARD, element: SystemMonitorScreen }
33869
- ]
33870
- }
33871
- ];
33872
33796
  const AppsSidebar = ({
33873
33797
  isOpen,
33874
33798
  onClose
@@ -34111,6 +34035,217 @@ const TypographyFilter = material.styled(material.Typography)(({ theme }) => ({
34111
34035
  textWrap: "nowrap",
34112
34036
  padding: `0px ${STYLE.PADDING_GAP_LAYOUT}`
34113
34037
  }));
34038
+ const SystemMonitorScreen = () => {
34039
+ const theme = useTheme();
34040
+ const dispatch = useAppDispatch();
34041
+ const [tab, setTab] = React.useState(AppCategory.ALL);
34042
+ const user = reactRedux.useSelector((state) => state.account?.user);
34043
+ const listApp = useApps(tab);
34044
+ const currentApp = useActiveSidebar();
34045
+ const checkUserNotOrg = React.useMemo(
34046
+ () => !user?.userOrgUnitPositions?.length || user.userOrgUnitPositions.some((pos) => !pos.orgUnit || !pos.position),
34047
+ [user]
34048
+ );
34049
+ if (checkUserNotOrg) {
34050
+ return /* @__PURE__ */ jsxRuntime.jsx(
34051
+ MotionBox,
34052
+ {
34053
+ preset: "fadeInUp",
34054
+ sx: {
34055
+ display: "flex",
34056
+ flexDirection: "column",
34057
+ alignItems: "center",
34058
+ justifyContent: "center",
34059
+ position: "relative",
34060
+ top: 150,
34061
+ minHeight: "400px"
34062
+ },
34063
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
34064
+ material.Box,
34065
+ {
34066
+ sx: {
34067
+ display: "flex",
34068
+ flexDirection: "column",
34069
+ alignItems: "center",
34070
+ justifyContent: "center",
34071
+ textAlign: "center",
34072
+ padding: 4,
34073
+ borderRadius: 2,
34074
+ backgroundColor: theme.palette.background.paper,
34075
+ boxShadow: theme.shadows[4],
34076
+ maxWidth: 500
34077
+ },
34078
+ children: [
34079
+ /* @__PURE__ */ jsxRuntime.jsx(
34080
+ material.Typography,
34081
+ {
34082
+ variant: "h6",
34083
+ sx: {
34084
+ color: theme.palette.error.main,
34085
+ marginBottom: 2,
34086
+ fontWeight: 600
34087
+ },
34088
+ children: "Thông báo"
34089
+ }
34090
+ ),
34091
+ /* @__PURE__ */ jsxRuntime.jsx(
34092
+ material.Typography,
34093
+ {
34094
+ sx: {
34095
+ color: theme.palette.text.secondary,
34096
+ lineHeight: 1.6,
34097
+ marginBottom: 3
34098
+ },
34099
+ children: "Bạn chưa có người quản lý trực tiếp. Vui lòng liên hệ quản trị viên để được hỗ trợ."
34100
+ }
34101
+ ),
34102
+ /* @__PURE__ */ jsxRuntime.jsx(
34103
+ material.Typography,
34104
+ {
34105
+ variant: "body2",
34106
+ sx: {
34107
+ color: theme.palette.text.disabled,
34108
+ fontStyle: "italic"
34109
+ },
34110
+ children: "Hệ thống sẽ tự động cập nhật khi bạn được phân quyền."
34111
+ }
34112
+ )
34113
+ ]
34114
+ }
34115
+ )
34116
+ }
34117
+ );
34118
+ }
34119
+ return /* @__PURE__ */ jsxRuntime.jsx(
34120
+ MotionBox,
34121
+ {
34122
+ preset: "fadeInUp",
34123
+ sx: {
34124
+ display: "flex",
34125
+ flexDirection: "column",
34126
+ alignItems: "center",
34127
+ position: "relative",
34128
+ top: 150
34129
+ },
34130
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
34131
+ material.Box,
34132
+ {
34133
+ sx: {
34134
+ width: 865,
34135
+ gap: 6.25,
34136
+ display: "flex",
34137
+ flexDirection: "column",
34138
+ justifyContent: "flex-start"
34139
+ },
34140
+ children: [
34141
+ /* @__PURE__ */ jsxRuntime.jsx(
34142
+ material.Box,
34143
+ {
34144
+ sx: {
34145
+ display: "flex",
34146
+ gap: PADDING_GAP_TAB,
34147
+ width: "100%",
34148
+ justifyContent: "flex-start"
34149
+ },
34150
+ children: [
34151
+ { key: AppCategory.ALL, label: "Tất Cả" },
34152
+ { key: AppCategory.HRM, label: "HRM" },
34153
+ { key: AppCategory.WORKFLOW, label: "Workflow Engine" },
34154
+ { key: AppCategory.PLATFORM_INFO, label: "Platform & Info" }
34155
+ ].map((t) => /* @__PURE__ */ jsxRuntime.jsxs(
34156
+ MotionBox,
34157
+ {
34158
+ sx: { position: "relative" },
34159
+ preset: "tabUnderline",
34160
+ children: [
34161
+ /* @__PURE__ */ jsxRuntime.jsx(
34162
+ material.Typography,
34163
+ {
34164
+ onClick: () => setTab(t.key),
34165
+ sx: {
34166
+ cursor: "pointer",
34167
+ color: tab === t.key ? theme.palette.common.white : theme.palette.grey[300]
34168
+ },
34169
+ children: t.label
34170
+ }
34171
+ ),
34172
+ tab === t.key && /* @__PURE__ */ jsxRuntime.jsx(
34173
+ MotionBox,
34174
+ {
34175
+ preset: "tabUnderline",
34176
+ sx: {
34177
+ position: "absolute",
34178
+ left: 0,
34179
+ right: 0,
34180
+ height: 2,
34181
+ backgroundColor: theme.palette.common.white,
34182
+ transformOrigin: "left"
34183
+ },
34184
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", {})
34185
+ }
34186
+ )
34187
+ ]
34188
+ },
34189
+ t.key
34190
+ ))
34191
+ }
34192
+ ),
34193
+ /* @__PURE__ */ jsxRuntime.jsx(MotionBox, { preset: "tabContent", children: /* @__PURE__ */ jsxRuntime.jsx(
34194
+ AppGrid,
34195
+ {
34196
+ apps: listApp,
34197
+ columns: 5,
34198
+ iconSize: 80,
34199
+ iconRadius: 7,
34200
+ gap: PADDING_GAP_TAB,
34201
+ selectedAppId: currentApp?.key,
34202
+ onClickItem: async (app2) => {
34203
+ await dispatch(
34204
+ ACTION_ACCOUNT.updateCurrentAccess(app2.key)
34205
+ ).unwrap();
34206
+ }
34207
+ }
34208
+ ) }, tab)
34209
+ ]
34210
+ }
34211
+ )
34212
+ }
34213
+ );
34214
+ };
34215
+ const renderRoutes = (routes2, account) => routes2.map((route) => {
34216
+ const { path, layout: layout2, element, type, allowUserTypes = [], children } = route;
34217
+ const Layout = layout2 || React.Fragment;
34218
+ let Element2 = element;
34219
+ if (path === PAGE.AUTH.path && account.isLogin) Element2 = () => /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: PAGE.DASHBOARD.path });
34220
+ if (type === RouteType.PROTECTED) {
34221
+ if (!account.isLogin) Element2 = () => /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: PAGE.AUTH.path });
34222
+ else if (allowUserTypes.length && !allowUserTypes.includes(account.user.type) && account.user.type !== UserType.ROOT)
34223
+ Element2 = () => /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: PAGE.ERROR.path });
34224
+ }
34225
+ return /* @__PURE__ */ jsxRuntime.jsx(
34226
+ reactRouterDom.Route,
34227
+ {
34228
+ path,
34229
+ element: /* @__PURE__ */ jsxRuntime.jsx(Layout, { children: /* @__PURE__ */ jsxRuntime.jsx(Element2, {}) }),
34230
+ children: children && renderRoutes(children, account)
34231
+ },
34232
+ path
34233
+ );
34234
+ });
34235
+ const routes = [
34236
+ { ...PAGE.AUTH, element: AuthPage, layout: AuthLayout },
34237
+ { ...PAGE.NOT_FOUND, element: NotFoundPage, layout: DefaultLayout },
34238
+ { ...PAGE.ERROR, element: ErrorPage, layout: DefaultLayout },
34239
+ // PROTECTED
34240
+ {
34241
+ ...PAGE.DASHBOARD,
34242
+ element: DashboardPage,
34243
+ layout: DashboardLayout,
34244
+ children: [
34245
+ { ...PAGE.DASHBOARD, element: SystemMonitorScreen }
34246
+ ]
34247
+ }
34248
+ ];
34114
34249
  exports.ALLOW_USER_TYPES = ALLOW_USER_TYPES;
34115
34250
  exports.ANIMATION_TIME = ANIMATION_TIME;
34116
34251
  exports.AppCategory = AppCategory;