@asaleh37/ui-base 25.9.19 → 25.9.24-2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asaleh37/ui-base",
3
- "version": "25.9.19",
3
+ "version": "25.9.24-2",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "Ahmed Saleh Mohamed",
@@ -49,15 +49,6 @@ const ReportViewer: React.FC<ReportViewerProps> = (props) => {
49
49
  parameters: { reportCode: props.reportCode },
50
50
  successCallBkFn: (response: any) => {
51
51
  setReportInfo(response.data);
52
- if (
53
- props?.byPassParameterEntry === true ||
54
- response.data.reportParameters.length == 0
55
- ) {
56
- runReport(parametersValues);
57
- setReportViewerState("WAITING_RESULT");
58
- } else {
59
- setReportViewerState("WAITING_PARAMETER_INPUT");
60
- }
61
52
  },
62
53
  failureCallBkFn: (response) => {
63
54
  setErrorMessage(
@@ -68,6 +59,20 @@ const ReportViewer: React.FC<ReportViewerProps> = (props) => {
68
59
  });
69
60
  };
70
61
 
62
+ useEffect(() => {
63
+ if (reportInfo) {
64
+ if (
65
+ props?.byPassParameterEntry === true ||
66
+ reportInfo.reportParameters.length == 0
67
+ ) {
68
+ runReport(parametersValues);
69
+ setReportViewerState("WAITING_RESULT");
70
+ } else {
71
+ setReportViewerState("WAITING_PARAMETER_INPUT");
72
+ }
73
+ }
74
+ }, [reportInfo]);
75
+
71
76
  const runReport = async (params) => {
72
77
  setReportViewerState("WAITING_RESULT");
73
78
  if (reportInfo?.reportType === "Excel") {
@@ -98,7 +103,6 @@ const ReportViewer: React.FC<ReportViewerProps> = (props) => {
98
103
  successCallBkFn: (response: any) => {
99
104
  setReportViewerState("SHOWING_RESULT");
100
105
  const contentDisposition = response.headers["content-disposition"];
101
- debugger;
102
106
  let filename = "downloaded_file";
103
107
  if (
104
108
  contentDisposition &&
@@ -64,22 +64,13 @@ interface UseParameterPanelProps {
64
64
  }
65
65
 
66
66
  export const useParameterPanel = (props: UseParameterPanelProps) => {
67
- console.log("useParameterPanel", "useParameterPanel called");
68
67
  const [parametersValues, setParametersValues] = useState<any>({
69
68
  ...props?.initialParameterValues,
70
69
  });
71
- // const [panelElements, setPanelElements] = useState<Array<FormElementProps>>(
72
- // []
73
- // );
74
70
  const panelElements = getFormElementsFromParameters(
75
71
  props.parameters,
76
72
  parametersValues
77
73
  );
78
- // useEffect(() => {
79
- // setPanelElements(
80
- // getFormElementsFromParameters(props.parameters, parametersValues)
81
- // );
82
- // }, [props.parameters]);
83
74
 
84
75
  const ParameterPanel: React.FC<{
85
76
  searchBtnClickCallBk: (params: any) => Promise<void>;
@@ -146,7 +137,7 @@ export const useParameterPanel = (props: UseParameterPanelProps) => {
146
137
  setParametersValues({});
147
138
  }
148
139
  if (searchBtnClickCallBk) {
149
- await searchBtnClickCallBk(parametersValues);
140
+ await searchBtnClickCallBk(params);
150
141
  }
151
142
  },
152
143
  reloadData: async () => {},
@@ -6,7 +6,7 @@ import { cacheLtr, cacheRtl } from "../components/common/LayoutHandlers";
6
6
  import { SYSTEM_ROUTES } from "../routes";
7
7
  import { SystemRoute } from "../routes/types";
8
8
  import RouteWrapper from "./RouteWrapper";
9
- import { useAxios, useLoadingMask, useSession } from "../hooks";
9
+ import { useAxios, useIsMobile, useLoadingMask, useSession } from "../hooks";
10
10
  import { useEffect, useState } from "react";
11
11
  import { setStoreData } from "../redux/features/common/CommonStoreSlice";
12
12
 
@@ -57,6 +57,7 @@ const MainContent: React.FC = () => {
57
57
  loadCommonStores();
58
58
  }
59
59
  }, [commonStores.storeKeys, UserInfo?.currentOrganization]);
60
+ const isMobile = useIsMobile();
60
61
  return (
61
62
  <CacheProvider
62
63
  value={AppLayoutState.appDirection === "ltr" ? cacheLtr : cacheRtl}
@@ -70,7 +71,7 @@ const MainContent: React.FC = () => {
70
71
  justifyContent: "flex-start",
71
72
  flex: 1,
72
73
  overflow: "hidden",
73
- padding: 3,
74
+ padding: isMobile ? 1 : 3,
74
75
  }}
75
76
  >
76
77
  <Routes>
@@ -31,6 +31,7 @@ import { useIsMobile } from "../hooks/UseMobile";
31
31
  import useSession from "../hooks/UseSession";
32
32
  import { findNavigationItemById, NavigationItems } from "../navigationItems";
33
33
  import { DRAWER_WIDTH } from "../redux/features/common/AppLayoutSlice";
34
+ import { toggleSideBarState } from "../redux/features/common/SideBarSlice";
34
35
 
35
36
  function DotIcon() {
36
37
  return (
@@ -234,6 +235,9 @@ export default function NavigationTree() {
234
235
  const AppInfo = useSelector((state: any) => state.AppInfo.value);
235
236
  const dispatch = useDispatch();
236
237
  const isMobile = useIsMobile();
238
+ const toggleSideBar = () => {
239
+ dispatch(toggleSideBarState());
240
+ };
237
241
  const { isUserAuthorized, isCurrentOrganizationAuthorizedToModule } =
238
242
  useSession();
239
243
  const filterData = (data) => {
@@ -281,6 +285,9 @@ export default function NavigationTree() {
281
285
  navigationItem.children.length == 0)
282
286
  ) {
283
287
  navigate(navigationItem?.actionPayload?.path || "");
288
+ if (isMobile) {
289
+ toggleSideBar();
290
+ }
284
291
  }
285
292
  }}
286
293
  sx={{
@@ -167,20 +167,21 @@ const TopBar: React.FC = () => {
167
167
  >
168
168
  <FontAwesomeIcon icon="bars" />
169
169
  </IconButton>
170
- <AttachmentImageViewer
171
- showAsAvatar={true}
172
- attachmentCode="ORGANIZATION_LOGOS"
173
- refKey={UserSession?.value?.currentOrganization?.id + ""}
174
- onErrorImage="/logo.png"
175
- style={{
176
- marginRight: 1,
177
- marginLeft: 1,
178
- }}
179
- />
180
- {/* <Avatar
181
- src={AppInfo.appLogo}
182
- sx={{ marginRight: 1, marginLeft: 1 }}
183
- /> */}
170
+ {!isMobile ? (
171
+ <AttachmentImageViewer
172
+ showAsAvatar={true}
173
+ attachmentCode="ORGANIZATION_LOGOS"
174
+ refKey={UserSession?.value?.currentOrganization?.id + ""}
175
+ onErrorImage="/logo.png"
176
+ style={{
177
+ marginRight: 1,
178
+ marginLeft: 1,
179
+ }}
180
+ />
181
+ ) : (
182
+ <></>
183
+ )}
184
+
184
185
  <Typography variant="h6" noWrap component="div" sx={{ flex: 1 }}>
185
186
  {isMobile
186
187
  ? ""
@@ -260,14 +261,18 @@ const TopBar: React.FC = () => {
260
261
  ) : (
261
262
  <></>
262
263
  )}
263
- <div onClick={handleOpenUserMenu} style={{ cursor: "pointer" }}>
264
- <AttachmentImageViewer
265
- showAsAvatar={true}
266
- onErrorImage="/no_user.png"
267
- attachmentCode="EMPLOYEE_PHOTOS"
268
- refKey={UserSession.value?.id + ""}
269
- />
270
- </div>
264
+ {!isMobile ? (
265
+ <div onClick={handleOpenUserMenu} style={{ cursor: "pointer" }}>
266
+ <AttachmentImageViewer
267
+ showAsAvatar={true}
268
+ onErrorImage="/no_user.png"
269
+ attachmentCode="EMPLOYEE_PHOTOS"
270
+ refKey={UserSession.value?.id + ""}
271
+ />
272
+ </div>
273
+ ) : (
274
+ <></>
275
+ )}
271
276
 
272
277
  <div
273
278
  style={{ marginLeft: 5, marginRight: 5, cursor: "pointer" }}
package/src/main.tsx CHANGED
@@ -3,7 +3,7 @@ import { BaseApp } from "./components";
3
3
 
4
4
  createRoot(document.getElementById("root")!).render(
5
5
  <BaseApp
6
- apiBaseUrl="http://10.14.22.13:8080/api-base"
6
+ apiBaseUrl="http://localhost:8080/api-base"
7
7
  enableUINotifications={false}
8
8
  appLogo={"/logo.png"}
9
9
  appName="UI Base Library"
@@ -28,6 +28,7 @@ export const ADMINISTRATION_STORES: CommonStores = {
28
28
  SystemWorkflows: {
29
29
  autoLoad: true,
30
30
  url: "api/v1/dev/workflowdocument/all",
31
+ authority: "DEVELOPMENT_ADMIN",
31
32
  data: [],
32
33
  },
33
34
  SystemWidgetTypes: {
@@ -67,26 +68,31 @@ export const ADMINISTRATION_STORES: CommonStores = {
67
68
  },
68
69
  SystemOrganizationRanks: {
69
70
  autoLoad: true,
71
+ authority: "SYSTEM_ADMIN",
70
72
  url: "api/v1/public/organization/ranks/all",
71
73
  data: [],
72
74
  },
73
75
  CurrentOrganizationRanks: {
74
76
  autoLoad: true,
77
+ authority: "SYSTEM_ADMIN",
75
78
  url: "api/v1/public/organizationrank/all",
76
79
  data: [],
77
80
  },
78
81
  SystemOrganizationUnits: {
79
82
  autoLoad: true,
83
+ authority: "SYSTEM_ADMIN",
80
84
  url: "api/v1/public/organization/units/all",
81
85
  data: [],
82
86
  },
83
87
  CurrentOrganizationUnits: {
84
88
  autoLoad: true,
89
+ authority: "SYSTEM_ADMIN",
85
90
  url: "api/v1/public/organizationunit/all",
86
91
  data: [],
87
92
  },
88
93
  SystemOrganizationUnitType: {
89
94
  autoLoad: true,
95
+ authority: "SYSTEM_ADMIN",
90
96
  url: "api/v1/public/organizationunittype/all",
91
97
  data: [],
92
98
  },
@@ -153,6 +159,7 @@ export const ADMINISTRATION_STORES: CommonStores = {
153
159
  persons: {
154
160
  autoLoad: true,
155
161
  data: [],
162
+ authority: "SYSTEM_ADMIN",
156
163
  url: "api/v1/public/person/all",
157
164
  },
158
165
  };
package/vite.config.ts CHANGED
@@ -19,6 +19,6 @@ export default defineConfig({
19
19
  },
20
20
  },
21
21
  server: {
22
- port: 8082,
22
+ port: 3000,
23
23
  },
24
24
  });