sevago-sso-fe 1.0.13 → 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
  )
@@ -26264,6 +26277,48 @@ const NotFoundPage = ({}) => {
26264
26277
  /* @__PURE__ */ jsxRuntime.jsx(ButtonElement, { content: "Quay lại trang chủ", fullWidth: false, onClick: () => navigate(PAGE.AUTH.path) })
26265
26278
  ] });
26266
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
+ );
26267
26322
  const LayoutGroupContext = React.createContext({});
26268
26323
  function useConstant(init) {
26269
26324
  const ref = React.useRef(null);
@@ -33539,48 +33594,6 @@ const MotionBox = ({
33539
33594
  } : {};
33540
33595
  return /* @__PURE__ */ jsxRuntime.jsx(motion.div, { ...motionProps, ...getAnimationProps(), ...hoverProps, onClick, style: { ...sx }, children });
33541
33596
  };
33542
- const IconLeft = (props) => /* @__PURE__ */ jsxRuntime.jsx(
33543
- "svg",
33544
- {
33545
- width: "20",
33546
- height: "16",
33547
- viewBox: "0 0 20 16",
33548
- fill: "none",
33549
- xmlns: "http://www.w3.org/2000/svg",
33550
- ...props,
33551
- children: /* @__PURE__ */ jsxRuntime.jsx(
33552
- "path",
33553
- {
33554
- d: "M8 15L1 8M1 8L8 1M1 8L19 8",
33555
- stroke: "currentColor",
33556
- "stroke-width": "2",
33557
- "stroke-linecap": "round",
33558
- "stroke-linejoin": "round"
33559
- }
33560
- )
33561
- }
33562
- );
33563
- const IconRight = (props) => /* @__PURE__ */ jsxRuntime.jsx(
33564
- "svg",
33565
- {
33566
- width: "20",
33567
- height: "16",
33568
- viewBox: "0 0 20 16",
33569
- fill: "none",
33570
- xmlns: "http://www.w3.org/2000/svg",
33571
- ...props,
33572
- children: /* @__PURE__ */ jsxRuntime.jsx(
33573
- "path",
33574
- {
33575
- d: "M12 1L19 8M19 8L12 15M19 8L1 8",
33576
- stroke: "currentColor",
33577
- "stroke-width": "2",
33578
- "stroke-linecap": "round",
33579
- "stroke-linejoin": "round"
33580
- }
33581
- )
33582
- }
33583
- );
33584
33597
  const AppGrid = ({
33585
33598
  apps,
33586
33599
  onClickItem,
@@ -33780,143 +33793,6 @@ const AppGrid = ({
33780
33793
  ] })
33781
33794
  ] });
33782
33795
  };
33783
- const SystemMonitorScreen = () => {
33784
- const theme = useTheme();
33785
- reactRouterDom.useNavigate();
33786
- const dispatch = useAppDispatch();
33787
- const [tab, setTab] = React.useState(AppCategory.ALL);
33788
- const listApp = useApps(tab);
33789
- const currentApp = useActiveSidebar();
33790
- return /* @__PURE__ */ jsxRuntime.jsx(
33791
- MotionBox,
33792
- {
33793
- preset: "fadeInUp",
33794
- sx: {
33795
- display: "flex",
33796
- flexDirection: "column",
33797
- alignItems: "center",
33798
- position: "relative",
33799
- top: 150
33800
- },
33801
- children: /* @__PURE__ */ jsxRuntime.jsxs(
33802
- material.Box,
33803
- {
33804
- sx: {
33805
- width: 865,
33806
- gap: 6.25,
33807
- display: "flex",
33808
- flexDirection: "column",
33809
- justifyContent: "flex-start"
33810
- },
33811
- children: [
33812
- /* @__PURE__ */ jsxRuntime.jsx(
33813
- material.Box,
33814
- {
33815
- sx: {
33816
- display: "flex",
33817
- gap: PADDING_GAP_TAB,
33818
- width: "100%",
33819
- justifyContent: "flex-start"
33820
- },
33821
- children: [
33822
- { key: AppCategory.ALL, label: "Tất Cả" },
33823
- { key: AppCategory.HRM, label: "HRM" },
33824
- { key: AppCategory.WORKFLOW, label: "Workflow Engine" },
33825
- { key: AppCategory.PLATFORM_INFO, label: "Platform & Info" }
33826
- ].map((t) => /* @__PURE__ */ jsxRuntime.jsxs(
33827
- MotionBox,
33828
- {
33829
- sx: { position: "relative" },
33830
- preset: "tabUnderline",
33831
- children: [
33832
- /* @__PURE__ */ jsxRuntime.jsx(
33833
- material.Typography,
33834
- {
33835
- onClick: () => setTab(t.key),
33836
- sx: {
33837
- cursor: "pointer",
33838
- color: tab === t.key ? theme.palette.common.white : theme.palette.grey[300]
33839
- },
33840
- children: t.label
33841
- }
33842
- ),
33843
- tab === t.key && /* @__PURE__ */ jsxRuntime.jsx(
33844
- MotionBox,
33845
- {
33846
- preset: "tabUnderline",
33847
- sx: {
33848
- position: "absolute",
33849
- left: 0,
33850
- right: 0,
33851
- height: 2,
33852
- backgroundColor: theme.palette.common.white,
33853
- transformOrigin: "left"
33854
- },
33855
- children: /* @__PURE__ */ jsxRuntime.jsx("div", {})
33856
- }
33857
- )
33858
- ]
33859
- },
33860
- t.key
33861
- ))
33862
- }
33863
- ),
33864
- /* @__PURE__ */ jsxRuntime.jsx(MotionBox, { preset: "tabContent", children: /* @__PURE__ */ jsxRuntime.jsx(
33865
- AppGrid,
33866
- {
33867
- apps: listApp,
33868
- columns: 5,
33869
- iconSize: 80,
33870
- iconRadius: 7,
33871
- gap: PADDING_GAP_TAB,
33872
- selectedAppId: currentApp?.key,
33873
- onClickItem: async (app2) => {
33874
- await dispatch(
33875
- ACTION_ACCOUNT.updateCurrentAccess(app2.key)
33876
- ).unwrap();
33877
- }
33878
- }
33879
- ) }, tab)
33880
- ]
33881
- }
33882
- )
33883
- }
33884
- );
33885
- };
33886
- const renderRoutes = (routes2, account) => routes2.map((route) => {
33887
- const { path, layout: layout2, element, type, allowUserTypes = [], children } = route;
33888
- const Layout = layout2 || React.Fragment;
33889
- let Element2 = element;
33890
- if (path === PAGE.AUTH.path && account.isLogin) Element2 = () => /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: PAGE.DASHBOARD.path });
33891
- if (type === RouteType.PROTECTED) {
33892
- if (!account.isLogin) Element2 = () => /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: PAGE.AUTH.path });
33893
- else if (allowUserTypes.length && !allowUserTypes.includes(account.user.type) && account.user.type !== UserType.ROOT)
33894
- Element2 = () => /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: PAGE.ERROR.path });
33895
- }
33896
- return /* @__PURE__ */ jsxRuntime.jsx(
33897
- reactRouterDom.Route,
33898
- {
33899
- path,
33900
- element: /* @__PURE__ */ jsxRuntime.jsx(Layout, { children: /* @__PURE__ */ jsxRuntime.jsx(Element2, {}) }),
33901
- children: children && renderRoutes(children, account)
33902
- },
33903
- path
33904
- );
33905
- });
33906
- const routes = [
33907
- { ...PAGE.AUTH, element: AuthPage, layout: AuthLayout },
33908
- { ...PAGE.NOT_FOUND, element: NotFoundPage, layout: DefaultLayout },
33909
- { ...PAGE.ERROR, element: ErrorPage, layout: DefaultLayout },
33910
- // PROTECTED
33911
- {
33912
- ...PAGE.DASHBOARD,
33913
- element: DashboardPage,
33914
- layout: DashboardLayout,
33915
- children: [
33916
- { ...PAGE.DASHBOARD, element: SystemMonitorScreen }
33917
- ]
33918
- }
33919
- ];
33920
33796
  const AppsSidebar = ({
33921
33797
  isOpen,
33922
33798
  onClose
@@ -34159,6 +34035,217 @@ const TypographyFilter = material.styled(material.Typography)(({ theme }) => ({
34159
34035
  textWrap: "nowrap",
34160
34036
  padding: `0px ${STYLE.PADDING_GAP_LAYOUT}`
34161
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
+ ];
34162
34249
  exports.ALLOW_USER_TYPES = ALLOW_USER_TYPES;
34163
34250
  exports.ANIMATION_TIME = ANIMATION_TIME;
34164
34251
  exports.AppCategory = AppCategory;