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.esm.js CHANGED
@@ -20694,7 +20694,9 @@ const LoadingComponent = ({ color: color2, size = "medium", sx = {} }) => {
20694
20694
  };
20695
20695
  const BellComponent = ({}) => {
20696
20696
  const isSystemMonitor = useIsSystemMonitor();
20697
- const { notificationCount } = useSelector((state) => state.account);
20697
+ const { notificationCount } = useSelector(
20698
+ (state) => state.account
20699
+ );
20698
20700
  const account = useSelector((state) => state.account);
20699
20701
  const dispatch = useAppDispatch();
20700
20702
  const navigate = useNavigate();
@@ -20714,7 +20716,10 @@ const BellComponent = ({}) => {
20714
20716
  setList(res.list);
20715
20717
  dispatch(ACTION_ACCOUNT.changeNotificationCount(res.total));
20716
20718
  } catch (error) {
20717
- showSnackbar({ message: getErrorMessage(error), type: SnackbarType.ERROR });
20719
+ showSnackbar({
20720
+ message: getErrorMessage(error),
20721
+ type: SnackbarType.ERROR
20722
+ });
20718
20723
  } finally {
20719
20724
  setLoading(false);
20720
20725
  }
@@ -20737,7 +20742,10 @@ const BellComponent = ({}) => {
20737
20742
  }
20738
20743
  });
20739
20744
  } catch (error) {
20740
- showSnackbar({ message: getErrorMessage(error), type: SnackbarType.ERROR });
20745
+ showSnackbar({
20746
+ message: getErrorMessage(error),
20747
+ type: SnackbarType.ERROR
20748
+ });
20741
20749
  }
20742
20750
  };
20743
20751
  return /* @__PURE__ */ jsx(
@@ -20789,7 +20797,10 @@ const BellComponent = ({}) => {
20789
20797
  });
20790
20798
  dispatch(ACTION_ACCOUNT.changeNotificationCount(0));
20791
20799
  } catch (error) {
20792
- showSnackbar({ message: getErrorMessage(error), type: SnackbarType.ERROR });
20800
+ showSnackbar({
20801
+ message: getErrorMessage(error),
20802
+ type: SnackbarType.ERROR
20803
+ });
20793
20804
  }
20794
20805
  }
20795
20806
  }
@@ -20860,7 +20871,9 @@ const BellComponent = ({}) => {
20860
20871
  size: "large",
20861
20872
  sx: {
20862
20873
  color: isSystemMonitor ? palette.background.default : palette.primary.main,
20863
- "&:hover": { color: isSystemMonitor ? palette.background.default : palette.primary.main }
20874
+ "&:hover": {
20875
+ color: isSystemMonitor ? palette.background.default : palette.primary.main
20876
+ }
20864
20877
  }
20865
20878
  }
20866
20879
  )
@@ -26246,6 +26259,48 @@ const NotFoundPage = ({}) => {
26246
26259
  /* @__PURE__ */ jsx(ButtonElement, { content: "Quay lại trang chủ", fullWidth: false, onClick: () => navigate(PAGE.AUTH.path) })
26247
26260
  ] });
26248
26261
  };
26262
+ const IconLeft = (props) => /* @__PURE__ */ jsx(
26263
+ "svg",
26264
+ {
26265
+ width: "20",
26266
+ height: "16",
26267
+ viewBox: "0 0 20 16",
26268
+ fill: "none",
26269
+ xmlns: "http://www.w3.org/2000/svg",
26270
+ ...props,
26271
+ children: /* @__PURE__ */ jsx(
26272
+ "path",
26273
+ {
26274
+ d: "M8 15L1 8M1 8L8 1M1 8L19 8",
26275
+ stroke: "currentColor",
26276
+ "stroke-width": "2",
26277
+ "stroke-linecap": "round",
26278
+ "stroke-linejoin": "round"
26279
+ }
26280
+ )
26281
+ }
26282
+ );
26283
+ const IconRight = (props) => /* @__PURE__ */ jsx(
26284
+ "svg",
26285
+ {
26286
+ width: "20",
26287
+ height: "16",
26288
+ viewBox: "0 0 20 16",
26289
+ fill: "none",
26290
+ xmlns: "http://www.w3.org/2000/svg",
26291
+ ...props,
26292
+ children: /* @__PURE__ */ jsx(
26293
+ "path",
26294
+ {
26295
+ d: "M12 1L19 8M19 8L12 15M19 8L1 8",
26296
+ stroke: "currentColor",
26297
+ "stroke-width": "2",
26298
+ "stroke-linecap": "round",
26299
+ "stroke-linejoin": "round"
26300
+ }
26301
+ )
26302
+ }
26303
+ );
26249
26304
  const LayoutGroupContext = createContext({});
26250
26305
  function useConstant(init) {
26251
26306
  const ref = useRef(null);
@@ -33521,48 +33576,6 @@ const MotionBox = ({
33521
33576
  } : {};
33522
33577
  return /* @__PURE__ */ jsx(motion.div, { ...motionProps, ...getAnimationProps(), ...hoverProps, onClick, style: { ...sx }, children });
33523
33578
  };
33524
- const IconLeft = (props) => /* @__PURE__ */ jsx(
33525
- "svg",
33526
- {
33527
- width: "20",
33528
- height: "16",
33529
- viewBox: "0 0 20 16",
33530
- fill: "none",
33531
- xmlns: "http://www.w3.org/2000/svg",
33532
- ...props,
33533
- children: /* @__PURE__ */ jsx(
33534
- "path",
33535
- {
33536
- d: "M8 15L1 8M1 8L8 1M1 8L19 8",
33537
- stroke: "currentColor",
33538
- "stroke-width": "2",
33539
- "stroke-linecap": "round",
33540
- "stroke-linejoin": "round"
33541
- }
33542
- )
33543
- }
33544
- );
33545
- const IconRight = (props) => /* @__PURE__ */ jsx(
33546
- "svg",
33547
- {
33548
- width: "20",
33549
- height: "16",
33550
- viewBox: "0 0 20 16",
33551
- fill: "none",
33552
- xmlns: "http://www.w3.org/2000/svg",
33553
- ...props,
33554
- children: /* @__PURE__ */ jsx(
33555
- "path",
33556
- {
33557
- d: "M12 1L19 8M19 8L12 15M19 8L1 8",
33558
- stroke: "currentColor",
33559
- "stroke-width": "2",
33560
- "stroke-linecap": "round",
33561
- "stroke-linejoin": "round"
33562
- }
33563
- )
33564
- }
33565
- );
33566
33579
  const AppGrid = ({
33567
33580
  apps,
33568
33581
  onClickItem,
@@ -33762,143 +33775,6 @@ const AppGrid = ({
33762
33775
  ] })
33763
33776
  ] });
33764
33777
  };
33765
- const SystemMonitorScreen = () => {
33766
- const theme = useTheme();
33767
- useNavigate();
33768
- const dispatch = useAppDispatch();
33769
- const [tab, setTab] = useState(AppCategory.ALL);
33770
- const listApp = useApps(tab);
33771
- const currentApp = useActiveSidebar();
33772
- return /* @__PURE__ */ jsx(
33773
- MotionBox,
33774
- {
33775
- preset: "fadeInUp",
33776
- sx: {
33777
- display: "flex",
33778
- flexDirection: "column",
33779
- alignItems: "center",
33780
- position: "relative",
33781
- top: 150
33782
- },
33783
- children: /* @__PURE__ */ jsxs(
33784
- Box,
33785
- {
33786
- sx: {
33787
- width: 865,
33788
- gap: 6.25,
33789
- display: "flex",
33790
- flexDirection: "column",
33791
- justifyContent: "flex-start"
33792
- },
33793
- children: [
33794
- /* @__PURE__ */ jsx(
33795
- Box,
33796
- {
33797
- sx: {
33798
- display: "flex",
33799
- gap: PADDING_GAP_TAB,
33800
- width: "100%",
33801
- justifyContent: "flex-start"
33802
- },
33803
- children: [
33804
- { key: AppCategory.ALL, label: "Tất Cả" },
33805
- { key: AppCategory.HRM, label: "HRM" },
33806
- { key: AppCategory.WORKFLOW, label: "Workflow Engine" },
33807
- { key: AppCategory.PLATFORM_INFO, label: "Platform & Info" }
33808
- ].map((t) => /* @__PURE__ */ jsxs(
33809
- MotionBox,
33810
- {
33811
- sx: { position: "relative" },
33812
- preset: "tabUnderline",
33813
- children: [
33814
- /* @__PURE__ */ jsx(
33815
- Typography,
33816
- {
33817
- onClick: () => setTab(t.key),
33818
- sx: {
33819
- cursor: "pointer",
33820
- color: tab === t.key ? theme.palette.common.white : theme.palette.grey[300]
33821
- },
33822
- children: t.label
33823
- }
33824
- ),
33825
- tab === t.key && /* @__PURE__ */ jsx(
33826
- MotionBox,
33827
- {
33828
- preset: "tabUnderline",
33829
- sx: {
33830
- position: "absolute",
33831
- left: 0,
33832
- right: 0,
33833
- height: 2,
33834
- backgroundColor: theme.palette.common.white,
33835
- transformOrigin: "left"
33836
- },
33837
- children: /* @__PURE__ */ jsx("div", {})
33838
- }
33839
- )
33840
- ]
33841
- },
33842
- t.key
33843
- ))
33844
- }
33845
- ),
33846
- /* @__PURE__ */ jsx(MotionBox, { preset: "tabContent", children: /* @__PURE__ */ jsx(
33847
- AppGrid,
33848
- {
33849
- apps: listApp,
33850
- columns: 5,
33851
- iconSize: 80,
33852
- iconRadius: 7,
33853
- gap: PADDING_GAP_TAB,
33854
- selectedAppId: currentApp?.key,
33855
- onClickItem: async (app2) => {
33856
- await dispatch(
33857
- ACTION_ACCOUNT.updateCurrentAccess(app2.key)
33858
- ).unwrap();
33859
- }
33860
- }
33861
- ) }, tab)
33862
- ]
33863
- }
33864
- )
33865
- }
33866
- );
33867
- };
33868
- const renderRoutes = (routes2, account) => routes2.map((route) => {
33869
- const { path, layout: layout2, element, type, allowUserTypes = [], children } = route;
33870
- const Layout = layout2 || React__default.Fragment;
33871
- let Element2 = element;
33872
- if (path === PAGE.AUTH.path && account.isLogin) Element2 = () => /* @__PURE__ */ jsx(Navigate, { to: PAGE.DASHBOARD.path });
33873
- if (type === RouteType.PROTECTED) {
33874
- if (!account.isLogin) Element2 = () => /* @__PURE__ */ jsx(Navigate, { to: PAGE.AUTH.path });
33875
- else if (allowUserTypes.length && !allowUserTypes.includes(account.user.type) && account.user.type !== UserType.ROOT)
33876
- Element2 = () => /* @__PURE__ */ jsx(Navigate, { to: PAGE.ERROR.path });
33877
- }
33878
- return /* @__PURE__ */ jsx(
33879
- Route,
33880
- {
33881
- path,
33882
- element: /* @__PURE__ */ jsx(Layout, { children: /* @__PURE__ */ jsx(Element2, {}) }),
33883
- children: children && renderRoutes(children, account)
33884
- },
33885
- path
33886
- );
33887
- });
33888
- const routes = [
33889
- { ...PAGE.AUTH, element: AuthPage, layout: AuthLayout },
33890
- { ...PAGE.NOT_FOUND, element: NotFoundPage, layout: DefaultLayout },
33891
- { ...PAGE.ERROR, element: ErrorPage, layout: DefaultLayout },
33892
- // PROTECTED
33893
- {
33894
- ...PAGE.DASHBOARD,
33895
- element: DashboardPage,
33896
- layout: DashboardLayout,
33897
- children: [
33898
- { ...PAGE.DASHBOARD, element: SystemMonitorScreen }
33899
- ]
33900
- }
33901
- ];
33902
33778
  const AppsSidebar = ({
33903
33779
  isOpen,
33904
33780
  onClose
@@ -34141,6 +34017,217 @@ const TypographyFilter = styled$2(Typography)(({ theme }) => ({
34141
34017
  textWrap: "nowrap",
34142
34018
  padding: `0px ${STYLE.PADDING_GAP_LAYOUT}`
34143
34019
  }));
34020
+ const SystemMonitorScreen = () => {
34021
+ const theme = useTheme();
34022
+ const dispatch = useAppDispatch();
34023
+ const [tab, setTab] = useState(AppCategory.ALL);
34024
+ const user = useSelector((state) => state.account?.user);
34025
+ const listApp = useApps(tab);
34026
+ const currentApp = useActiveSidebar();
34027
+ const checkUserNotOrg = useMemo(
34028
+ () => !user?.userOrgUnitPositions?.length || user.userOrgUnitPositions.some((pos) => !pos.orgUnit || !pos.position),
34029
+ [user]
34030
+ );
34031
+ if (checkUserNotOrg) {
34032
+ return /* @__PURE__ */ jsx(
34033
+ MotionBox,
34034
+ {
34035
+ preset: "fadeInUp",
34036
+ sx: {
34037
+ display: "flex",
34038
+ flexDirection: "column",
34039
+ alignItems: "center",
34040
+ justifyContent: "center",
34041
+ position: "relative",
34042
+ top: 150,
34043
+ minHeight: "400px"
34044
+ },
34045
+ children: /* @__PURE__ */ jsxs(
34046
+ Box,
34047
+ {
34048
+ sx: {
34049
+ display: "flex",
34050
+ flexDirection: "column",
34051
+ alignItems: "center",
34052
+ justifyContent: "center",
34053
+ textAlign: "center",
34054
+ padding: 4,
34055
+ borderRadius: 2,
34056
+ backgroundColor: theme.palette.background.paper,
34057
+ boxShadow: theme.shadows[4],
34058
+ maxWidth: 500
34059
+ },
34060
+ children: [
34061
+ /* @__PURE__ */ jsx(
34062
+ Typography,
34063
+ {
34064
+ variant: "h6",
34065
+ sx: {
34066
+ color: theme.palette.error.main,
34067
+ marginBottom: 2,
34068
+ fontWeight: 600
34069
+ },
34070
+ children: "Thông báo"
34071
+ }
34072
+ ),
34073
+ /* @__PURE__ */ jsx(
34074
+ Typography,
34075
+ {
34076
+ sx: {
34077
+ color: theme.palette.text.secondary,
34078
+ lineHeight: 1.6,
34079
+ marginBottom: 3
34080
+ },
34081
+ 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ợ."
34082
+ }
34083
+ ),
34084
+ /* @__PURE__ */ jsx(
34085
+ Typography,
34086
+ {
34087
+ variant: "body2",
34088
+ sx: {
34089
+ color: theme.palette.text.disabled,
34090
+ fontStyle: "italic"
34091
+ },
34092
+ children: "Hệ thống sẽ tự động cập nhật khi bạn được phân quyền."
34093
+ }
34094
+ )
34095
+ ]
34096
+ }
34097
+ )
34098
+ }
34099
+ );
34100
+ }
34101
+ return /* @__PURE__ */ jsx(
34102
+ MotionBox,
34103
+ {
34104
+ preset: "fadeInUp",
34105
+ sx: {
34106
+ display: "flex",
34107
+ flexDirection: "column",
34108
+ alignItems: "center",
34109
+ position: "relative",
34110
+ top: 150
34111
+ },
34112
+ children: /* @__PURE__ */ jsxs(
34113
+ Box,
34114
+ {
34115
+ sx: {
34116
+ width: 865,
34117
+ gap: 6.25,
34118
+ display: "flex",
34119
+ flexDirection: "column",
34120
+ justifyContent: "flex-start"
34121
+ },
34122
+ children: [
34123
+ /* @__PURE__ */ jsx(
34124
+ Box,
34125
+ {
34126
+ sx: {
34127
+ display: "flex",
34128
+ gap: PADDING_GAP_TAB,
34129
+ width: "100%",
34130
+ justifyContent: "flex-start"
34131
+ },
34132
+ children: [
34133
+ { key: AppCategory.ALL, label: "Tất Cả" },
34134
+ { key: AppCategory.HRM, label: "HRM" },
34135
+ { key: AppCategory.WORKFLOW, label: "Workflow Engine" },
34136
+ { key: AppCategory.PLATFORM_INFO, label: "Platform & Info" }
34137
+ ].map((t) => /* @__PURE__ */ jsxs(
34138
+ MotionBox,
34139
+ {
34140
+ sx: { position: "relative" },
34141
+ preset: "tabUnderline",
34142
+ children: [
34143
+ /* @__PURE__ */ jsx(
34144
+ Typography,
34145
+ {
34146
+ onClick: () => setTab(t.key),
34147
+ sx: {
34148
+ cursor: "pointer",
34149
+ color: tab === t.key ? theme.palette.common.white : theme.palette.grey[300]
34150
+ },
34151
+ children: t.label
34152
+ }
34153
+ ),
34154
+ tab === t.key && /* @__PURE__ */ jsx(
34155
+ MotionBox,
34156
+ {
34157
+ preset: "tabUnderline",
34158
+ sx: {
34159
+ position: "absolute",
34160
+ left: 0,
34161
+ right: 0,
34162
+ height: 2,
34163
+ backgroundColor: theme.palette.common.white,
34164
+ transformOrigin: "left"
34165
+ },
34166
+ children: /* @__PURE__ */ jsx("div", {})
34167
+ }
34168
+ )
34169
+ ]
34170
+ },
34171
+ t.key
34172
+ ))
34173
+ }
34174
+ ),
34175
+ /* @__PURE__ */ jsx(MotionBox, { preset: "tabContent", children: /* @__PURE__ */ jsx(
34176
+ AppGrid,
34177
+ {
34178
+ apps: listApp,
34179
+ columns: 5,
34180
+ iconSize: 80,
34181
+ iconRadius: 7,
34182
+ gap: PADDING_GAP_TAB,
34183
+ selectedAppId: currentApp?.key,
34184
+ onClickItem: async (app2) => {
34185
+ await dispatch(
34186
+ ACTION_ACCOUNT.updateCurrentAccess(app2.key)
34187
+ ).unwrap();
34188
+ }
34189
+ }
34190
+ ) }, tab)
34191
+ ]
34192
+ }
34193
+ )
34194
+ }
34195
+ );
34196
+ };
34197
+ const renderRoutes = (routes2, account) => routes2.map((route) => {
34198
+ const { path, layout: layout2, element, type, allowUserTypes = [], children } = route;
34199
+ const Layout = layout2 || React__default.Fragment;
34200
+ let Element2 = element;
34201
+ if (path === PAGE.AUTH.path && account.isLogin) Element2 = () => /* @__PURE__ */ jsx(Navigate, { to: PAGE.DASHBOARD.path });
34202
+ if (type === RouteType.PROTECTED) {
34203
+ if (!account.isLogin) Element2 = () => /* @__PURE__ */ jsx(Navigate, { to: PAGE.AUTH.path });
34204
+ else if (allowUserTypes.length && !allowUserTypes.includes(account.user.type) && account.user.type !== UserType.ROOT)
34205
+ Element2 = () => /* @__PURE__ */ jsx(Navigate, { to: PAGE.ERROR.path });
34206
+ }
34207
+ return /* @__PURE__ */ jsx(
34208
+ Route,
34209
+ {
34210
+ path,
34211
+ element: /* @__PURE__ */ jsx(Layout, { children: /* @__PURE__ */ jsx(Element2, {}) }),
34212
+ children: children && renderRoutes(children, account)
34213
+ },
34214
+ path
34215
+ );
34216
+ });
34217
+ const routes = [
34218
+ { ...PAGE.AUTH, element: AuthPage, layout: AuthLayout },
34219
+ { ...PAGE.NOT_FOUND, element: NotFoundPage, layout: DefaultLayout },
34220
+ { ...PAGE.ERROR, element: ErrorPage, layout: DefaultLayout },
34221
+ // PROTECTED
34222
+ {
34223
+ ...PAGE.DASHBOARD,
34224
+ element: DashboardPage,
34225
+ layout: DashboardLayout,
34226
+ children: [
34227
+ { ...PAGE.DASHBOARD, element: SystemMonitorScreen }
34228
+ ]
34229
+ }
34230
+ ];
34144
34231
  export {
34145
34232
  ALLOW_USER_TYPES,
34146
34233
  ANIMATION_TIME,