@asaleh37/ui-base 1.2.3 → 1.2.4

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.
Files changed (157) hide show
  1. package/dist/index.d.ts +20 -13
  2. package/dist/index.js +11 -6
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +11 -6
  5. package/dist/index.mjs.map +1 -1
  6. package/package.json +8 -2
  7. package/src/components/App.tsx +1 -1
  8. package/src/components/BaseApp.tsx +2 -19
  9. package/src/components/administration/admin/OrgMemberRoleForm.tsx +83 -0
  10. package/src/components/administration/admin/OrganizationApplicationModuleGrid.tsx +131 -0
  11. package/src/components/administration/admin/OrganizationGrid.tsx +165 -0
  12. package/src/components/administration/admin/OrganizationMemberGrid.tsx +176 -0
  13. package/src/components/administration/admin/OrganizationMemberRoleGrid.tsx +87 -0
  14. package/src/components/{admin → administration/admin}/OrganizationRankGrid.tsx +49 -19
  15. package/src/components/administration/admin/OrganizationUnitGrid.tsx +139 -0
  16. package/src/components/administration/admin/OrganizationUnitTypeGrid.tsx +121 -0
  17. package/src/components/administration/admin/PersonGrid.tsx +195 -0
  18. package/src/components/{admin → administration/admin}/RoleAuthoritiesForm.tsx +30 -11
  19. package/src/components/administration/admin/SystemApplicationAuthorityGrid.tsx +142 -0
  20. package/src/components/administration/admin/SystemApplicationGrid.tsx +161 -0
  21. package/src/components/administration/admin/SystemApplicationModuleGrid.tsx +109 -0
  22. package/src/components/administration/admin/SystemApplicationRoleAuthorityGrid.tsx +67 -0
  23. package/src/components/administration/admin/SystemApplicationRoleGrid.tsx +130 -0
  24. package/src/components/administration/dev/BluePrintGrid.tsx +129 -0
  25. package/src/components/administration/dev/DashboardGrid.tsx +173 -0
  26. package/src/components/administration/dev/DashboardWidgetGrid.tsx +164 -0
  27. package/src/components/administration/dev/DataQueryGrid.tsx +206 -0
  28. package/src/components/administration/dev/DataQueryParameterGrid.tsx +191 -0
  29. package/src/components/administration/dev/DataQueryParametersForm.tsx +84 -0
  30. package/src/components/administration/dev/DatasourceConnectionGrid.tsx +150 -0
  31. package/src/components/administration/dev/EntityParameterGrid.tsx +279 -0
  32. package/src/components/administration/dev/LookupGrid.tsx +131 -0
  33. package/src/components/administration/dev/MailAttachmentGrid.tsx +155 -0
  34. package/src/components/administration/dev/MailBodyGrid.tsx +215 -0
  35. package/src/components/{admin → administration/dev}/MailNotificationQueueGrid.tsx +114 -26
  36. package/src/components/administration/dev/MailRecipientGrid.tsx +169 -0
  37. package/src/components/administration/dev/MailSenderConfigGrid.tsx +478 -0
  38. package/src/components/administration/dev/MailTemplateGrid.tsx +388 -0
  39. package/src/components/administration/dev/ReportGrid.tsx +504 -0
  40. package/src/components/administration/dev/ReportParameterGrid.tsx +186 -0
  41. package/src/components/administration/dev/ReportParametersForm.tsx +84 -0
  42. package/src/components/administration/dev/WidgetGrid.tsx +431 -0
  43. package/src/components/administration/dev/WorkflowDocumentActionGrid.tsx +264 -0
  44. package/src/components/administration/dev/WorkflowDocumentActionHistoryGrid.tsx +172 -0
  45. package/src/components/administration/dev/WorkflowDocumentActionMailGrid.tsx +161 -0
  46. package/src/components/administration/dev/WorkflowDocumentGrid.tsx +377 -0
  47. package/src/components/{admin → administration/dev}/WorkflowDocumentMailLogGrid.tsx +87 -10
  48. package/src/components/administration/dev/WorkflowDocumentStatusGrid.tsx +243 -0
  49. package/src/components/common/ChangeOrgForm.tsx +81 -0
  50. package/src/components/common/Home.tsx +28 -22
  51. package/src/components/common/LoadingMask.tsx +9 -4
  52. package/src/components/common/Login.tsx +9 -13
  53. package/src/components/templates/DataEntryTemplates/DataEntryTypes.ts +30 -6
  54. package/src/components/templates/DataEntryTemplates/DataEntryUtil.ts +46 -5
  55. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementField.tsx +64 -5
  56. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementGroup.tsx +11 -3
  57. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/CheckBox.tsx +2 -2
  58. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/ComboBox.tsx +1 -2
  59. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/HtmlEditor.tsx +144 -0
  60. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/SystemLookupCombobox.tsx +55 -0
  61. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/TemplateTextField.tsx +9 -1
  62. package/src/components/templates/DataEntryTemplates/TemplateDataForm/TemplateForm.tsx +45 -5
  63. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/DataGridColumnsUtil.tsx +8 -7
  64. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid.tsx +38 -10
  65. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridRecordAction.tsx +4 -1
  66. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridTopBar.tsx +3 -4
  67. package/src/components/templates/TransferList.tsx +16 -6
  68. package/src/components/templates/index.ts +0 -2
  69. package/src/components/templates/report/ExcelReportViewer.tsx +65 -0
  70. package/src/components/templates/report/ReportViewer.tsx +382 -0
  71. package/src/components/templates/visuals/DashboardRouteView.tsx +9 -0
  72. package/src/components/templates/visuals/DashboardViewer.tsx +148 -0
  73. package/src/components/templates/visuals/WidgetViewer.tsx +198 -0
  74. package/src/components/templates/visuals/charts/TemplateBarChart.tsx +9 -2
  75. package/src/components/templates/visuals/charts/TemplateDataCard.tsx +6 -31
  76. package/src/components/templates/visuals/charts/TemplateGauge.tsx +8 -3
  77. package/src/components/templates/visuals/charts/TemplateLineChart.tsx +8 -2
  78. package/src/components/templates/visuals/charts/TemplateLineProgress.tsx +5 -3
  79. package/src/components/templates/visuals/charts/TemplatePieChart.tsx +1 -2
  80. package/src/components/templates/workflow/WorkflowDocumentPanel.tsx +581 -0
  81. package/src/components/templates/workflow/WorkflowDocumentTimeLine.tsx +134 -0
  82. package/src/hooks/UseSession.tsx +3 -7
  83. package/src/hooks/UseWindow.tsx +2 -1
  84. package/src/hooks/useAxios.tsx +9 -27
  85. package/src/hooks/useLookupGridColumn.tsx +35 -0
  86. package/src/layout/Layout.tsx +2 -46
  87. package/src/layout/MainContent.tsx +60 -7
  88. package/src/layout/MobileDrawer.tsx +5 -5
  89. package/src/layout/NavigationTree.tsx +0 -1
  90. package/src/layout/RouteWrapper.tsx +36 -0
  91. package/src/layout/SideBar.tsx +15 -10
  92. package/src/layout/TopBar.tsx +139 -71
  93. package/src/locales/arabic/adminLocalsAr.json +81 -344
  94. package/src/locales/arabic/common.json +11 -1
  95. package/src/locales/arabic/devLocalsAr.json +280 -0
  96. package/src/locales/arabic/index.ts +2 -0
  97. package/src/locales/english/adminLocalsEn.json +86 -346
  98. package/src/locales/english/common.json +11 -1
  99. package/src/locales/english/devLocalsEn.json +281 -0
  100. package/src/locales/english/index.ts +3 -0
  101. package/src/main.tsx +5 -6
  102. package/src/navigationItems/Administration/adminNavigationItems.tsx +65 -99
  103. package/src/navigationItems/Administration/index.tsx +10 -65
  104. package/src/redux/features/administration/AdministrationStoresMetaData.ts +45 -12
  105. package/src/redux/features/common/AppLayoutSlice.ts +0 -8
  106. package/src/redux/features/common/CommonStoreSlice.ts +4 -0
  107. package/src/redux/features/common/SideBarSlice.ts +29 -0
  108. package/src/redux/features/common/UserSessionSlice.ts +15 -23
  109. package/src/redux/store.ts +1 -1
  110. package/src/routes/administration/adminRoutes.tsx +41 -222
  111. package/src/routes/administration/devRoutes.tsx +90 -0
  112. package/src/routes/administration/index.ts +5 -1
  113. package/src/routes/index.ts +1 -0
  114. package/src/styles/index.css +3 -3
  115. package/src/util/AppUtils.ts +5 -0
  116. package/vite.config.ts +14 -0
  117. package/src/components/admin/AttachmentGrid.tsx +0 -116
  118. package/src/components/admin/AuthorityGrid.tsx +0 -88
  119. package/src/components/admin/BluePrintGrid.tsx +0 -55
  120. package/src/components/admin/BluePrintPageGrid.tsx +0 -85
  121. package/src/components/admin/BluePrintPointGrid.tsx +0 -85
  122. package/src/components/admin/DashboardGrid.tsx +0 -95
  123. package/src/components/admin/DashboardWidgetGrid.tsx +0 -75
  124. package/src/components/admin/DataQueryGrid.tsx +0 -75
  125. package/src/components/admin/DataQueryParameterGrid.tsx +0 -98
  126. package/src/components/admin/DatasourceConnectionGrid.tsx +0 -98
  127. package/src/components/admin/EmployeeGrid.tsx +0 -105
  128. package/src/components/admin/EntityParameterGrid.tsx +0 -125
  129. package/src/components/admin/ExcelUploaderDetailGrid.tsx +0 -78
  130. package/src/components/admin/ExcelUploaderHeaderGrid.tsx +0 -78
  131. package/src/components/admin/LookupGrid.tsx +0 -95
  132. package/src/components/admin/MailAttachmentGrid.tsx +0 -65
  133. package/src/components/admin/MailBodyGrid.tsx +0 -105
  134. package/src/components/admin/MailRecipientGrid.tsx +0 -75
  135. package/src/components/admin/MailTemplateGrid.tsx +0 -145
  136. package/src/components/admin/NewTableGrid.tsx +0 -65
  137. package/src/components/admin/NotificationGrid.tsx +0 -115
  138. package/src/components/admin/NotificationQueueGrid.tsx +0 -125
  139. package/src/components/admin/OrganizationApplicationGrid.tsx +0 -81
  140. package/src/components/admin/OrganizationGrid.tsx +0 -65
  141. package/src/components/admin/OrganizationUnitGrid.tsx +0 -85
  142. package/src/components/admin/OrganizationUserGrid.tsx +0 -75
  143. package/src/components/admin/OrganizationUserRoleGrid.tsx +0 -98
  144. package/src/components/admin/ReportGrid.tsx +0 -155
  145. package/src/components/admin/ReportParameterGrid.tsx +0 -95
  146. package/src/components/admin/RoleAuthorityGrid.tsx +0 -65
  147. package/src/components/admin/RoleGrid.tsx +0 -132
  148. package/src/components/admin/UserAccountGrid.tsx +0 -65
  149. package/src/components/admin/UserRequestGrid.tsx +0 -145
  150. package/src/components/admin/WidgetGrid.tsx +0 -175
  151. package/src/components/admin/WorkflowDocumentActionGrid.tsx +0 -111
  152. package/src/components/admin/WorkflowDocumentActionHistoryGrid.tsx +0 -111
  153. package/src/components/admin/WorkflowDocumentActionMailGrid.tsx +0 -71
  154. package/src/components/admin/WorkflowDocumentGrid.tsx +0 -185
  155. package/src/components/admin/WorkflowDocumentStatusGrid.tsx +0 -121
  156. package/src/components/templates/visuals/TemplateDashboard.tsx +0 -126
  157. package/src/redux/features/CounterSlice.tsx +0 -13
@@ -0,0 +1,243 @@
1
+ import { useState } from "react";
2
+ import TemplateGrid from "../../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
+ import { FormElementProps } from "../../templates/DataEntryTemplates/DataEntryTypes";
4
+ import { useTranslation } from "react-i18next";
5
+ import { useApiActions } from "../../../hooks";
6
+ import { useSelector } from "react-redux";
7
+
8
+ type WorkflowDocumentStatusGridProps = {
9
+ selectedRecord: any;
10
+ };
11
+
12
+ const WorkflowDocumentStatusGrid: React.FC<WorkflowDocumentStatusGridProps> = (
13
+ props
14
+ ) => {
15
+ const { t } = useTranslation();
16
+ const [data, setData] = useState([]);
17
+ const apiActions = useApiActions({
18
+ findAll: "api/v1/dev/workflowdocumentstatus/all",
19
+ deleteById: "api/v1/dev/workflowdocumentstatus",
20
+ save: "api/v1/dev/workflowdocumentstatus",
21
+ findById: "api/v1/dev/workflowdocumentstatus",
22
+ setData: setData,
23
+ });
24
+ const SystemDataQueries = useSelector(
25
+ (state: any) => state.commonStores.stores.SystemDataQueries.data
26
+ );
27
+ const formElements: Array<FormElementProps> = [
28
+ {
29
+ type: "field",
30
+ mode: "props",
31
+ props: {
32
+ fieldLabel: "id",
33
+ fieldName: "id",
34
+ fieldType: "number",
35
+ hidden: true,
36
+ gridProps: {
37
+ hidden: true,
38
+ },
39
+ },
40
+ },
41
+ {
42
+ type: "field",
43
+ mode: "props",
44
+ props: {
45
+ fieldLabel: "createTime",
46
+ fieldName: "createTime",
47
+ fieldType: "datetime",
48
+ hidden: true,
49
+ gridProps: {
50
+ hidden: true,
51
+ },
52
+ },
53
+ },
54
+ {
55
+ type: "field",
56
+ mode: "props",
57
+ props: {
58
+ fieldLabel: "createdBy",
59
+ fieldName: "createdBy",
60
+ fieldType: "text",
61
+ hidden: true,
62
+ gridProps: {
63
+ hidden: true,
64
+ },
65
+ },
66
+ },
67
+ {
68
+ type: "field",
69
+ mode: "props",
70
+ props: {
71
+ fieldLabel: "lastUpdateBy",
72
+ fieldName: "lastUpdateBy",
73
+ fieldType: "text",
74
+ hidden: true,
75
+ gridProps: {
76
+ hidden: true,
77
+ },
78
+ },
79
+ },
80
+ {
81
+ type: "field",
82
+ mode: "props",
83
+ props: {
84
+ fieldLabel: "lastUpdateTime",
85
+ fieldName: "lastUpdateTime",
86
+ fieldType: "datetime",
87
+ hidden: true,
88
+ gridProps: {
89
+ hidden: true,
90
+ },
91
+ },
92
+ },
93
+ {
94
+ type: "field",
95
+ mode: "props",
96
+ props: {
97
+ fieldLabel: "WORKFLOW_DOCUMENT_STATUS_DOCUMENT_STATUS_CODE",
98
+ fieldName: "documentStatusCode",
99
+ required: true,
100
+ fieldType: "text",
101
+ },
102
+ },
103
+ {
104
+ type: "field",
105
+ mode: "props",
106
+ props: {
107
+ fieldLabel: "Status Arabic Name",
108
+ fieldName: "documentStatusArName",
109
+ required: true,
110
+ fieldType: "text",
111
+ },
112
+ },
113
+ {
114
+ type: "field",
115
+ mode: "props",
116
+ props: {
117
+ fieldLabel: "Status English Name",
118
+ fieldName: "documentStatusEnName",
119
+ required: true,
120
+ fieldType: "text",
121
+ },
122
+ },
123
+ {
124
+ type: "field",
125
+ mode: "props",
126
+ props: {
127
+ fieldLabel: "WORKFLOW_DOCUMENT_STATUS_DOCUMENT_STATUS_ORDER",
128
+ fieldName: "documentStatusOrder",
129
+ required: false,
130
+ fieldType: "number",
131
+ },
132
+ },
133
+ {
134
+ type: "field",
135
+ mode: "props",
136
+ props: {
137
+ fieldLabel: "WORKFLOW_DOCUMENT_STATUS_IS_ZERO_STATE",
138
+ fieldName: "isZeroState",
139
+ required: false,
140
+ fieldType: "checkbox",
141
+ },
142
+ },
143
+ {
144
+ type: "field",
145
+ mode: "props",
146
+ props: {
147
+ fieldLabel:
148
+ "Next Actions Query (must return array of actions in table named workflow_document_action)",
149
+ fieldName: "nextActionsQueryId",
150
+ required: false,
151
+ fieldType: "combobox",
152
+ options: SystemDataQueries,
153
+ optionValueField: "id",
154
+ optionDisplayField: "queryName",
155
+ gridProps: { hidden: true },
156
+ },
157
+ },
158
+ {
159
+ type: "field",
160
+ mode: "props",
161
+ props: {
162
+ fieldLabel:
163
+ "Next Action Takers Query (must return array of persons in table named person)",
164
+ fieldName: "nextActionTakersQueryId",
165
+ required: false,
166
+ fieldType: "combobox",
167
+ options: SystemDataQueries,
168
+ optionValueField: "id",
169
+ optionDisplayField: "queryName",
170
+ gridProps: { hidden: true },
171
+ },
172
+ },
173
+ {
174
+ type: "field",
175
+ mode: "props",
176
+ props: {
177
+ fieldLabel: "Next Action Takers Authority",
178
+ fieldName: "nextActionTakersAuthority",
179
+ fieldType: "text",
180
+ },
181
+ },
182
+ {
183
+ type: "field",
184
+ mode: "props",
185
+ props: {
186
+ fieldLabel: "WORKFLOW_DOCUMENT_STATUS_WORKFLOW_DOCUMENT_ID",
187
+ fieldName: "workflowDocumentId",
188
+ required: false,
189
+ hidden: true,
190
+ gridProps: { hidden: true },
191
+ fieldType: "number",
192
+ },
193
+ },
194
+ {
195
+ type: "field",
196
+ mode: "props",
197
+ props: {
198
+ fieldLabel: "WORKFLOW_DOCUMENT_STATUS_ENABLED",
199
+ fieldName: "enabled",
200
+ required: false,
201
+ fieldType: "checkbox",
202
+ },
203
+ },
204
+ ];
205
+
206
+ return (
207
+ <TemplateGrid
208
+ apiActions={apiActions}
209
+ data={data}
210
+ setData={setData}
211
+ hideInfoBar={true}
212
+ gridLoadParametersValues={{
213
+ workflowDocumentId: props.selectedRecord.id,
214
+ }}
215
+ editMode={{
216
+ editMode: "modal",
217
+ specs: {
218
+ modalIcon: "tag",
219
+ modalTitle: "Workflow Document Status",
220
+ modalWidth: 600,
221
+ },
222
+ }}
223
+ formElements={formElements}
224
+ keyColumnName={"id"}
225
+ gridTitle={t("WORKFLOW_DOCUMENT_STATUS_PLURAL")}
226
+ girdIcon="tags"
227
+ editAction={{
228
+ isEnabled: true,
229
+ authority: "WORKFLOW_DOCUMENT_STATUS_EDIT",
230
+ preActionValidation: (record) => {
231
+ record.workflowDocumentId = props.selectedRecord.id;
232
+ return true;
233
+ },
234
+ }}
235
+ deleteAction={{
236
+ isEnabled: true,
237
+ authority: "WORKFLOW_DOCUMENT_STATUS_DELETE",
238
+ }}
239
+ />
240
+ );
241
+ };
242
+
243
+ export default WorkflowDocumentStatusGrid;
@@ -0,0 +1,81 @@
1
+ import { useState } from "react";
2
+ import { useAxios, useSession } from "../../hooks";
3
+ import { ComboBox } from "../templates";
4
+ import { Box, Button } from "@mui/material";
5
+ import { useDispatch, useSelector } from "react-redux";
6
+ import { UserSessionActions } from "../../redux/features/common/UserSessionSlice";
7
+
8
+ type ChangeOrgFormProps = {
9
+ successChangeCallBackFn: () => void;
10
+ };
11
+
12
+ const ChangeOrgForm: React.FC<ChangeOrgFormProps> = (props) => {
13
+ const { UserSession } = useSession();
14
+ const AppLayoutState = useSelector((state: any) => state.AppLayout);
15
+ const dispatch = useDispatch();
16
+ const { handlePostRequest } = useAxios();
17
+ const [newOrgId, setNewOrgId] = useState(
18
+ UserSession.value.currentOrganization.id
19
+ );
20
+ return (
21
+ <Box
22
+ sx={{
23
+ display: "flex",
24
+ flexDirection: "column",
25
+ width: "100%",
26
+ alignItems: "center",
27
+ justifyContent: "center",
28
+ padding: 1,
29
+ }}
30
+ >
31
+ <ComboBox
32
+ sx={{ width: "100%" }}
33
+ displayField={
34
+ AppLayoutState.appDirection === "ltr"
35
+ ? "organizationEnName"
36
+ : "organizationArName"
37
+ }
38
+ valueField="id"
39
+ label=""
40
+ options={UserSession.value.userOrganizations}
41
+ value={newOrgId}
42
+ onChangeCallBack={(value) => {
43
+ setNewOrgId(value);
44
+ }}
45
+ />
46
+ <Button
47
+ sx={{ m: 1 }}
48
+ variant="contained"
49
+ disabled={
50
+ newOrgId == null ||
51
+ newOrgId === UserSession.value.currentOrganization.id
52
+ }
53
+ onClick={async () => {
54
+ await handlePostRequest({
55
+ endPointURI: "api/auth/changeCurrentOrg",
56
+ showMask: true,
57
+ parameters: {
58
+ username: UserSession.value.username,
59
+ orgId: newOrgId,
60
+ },
61
+ data: {},
62
+ successCallBkFn: (response) => {
63
+ const UserSession = {
64
+ ...response.data,
65
+ isAuthenticated: true,
66
+ };
67
+ dispatch(UserSessionActions.setAuthenticated(UserSession));
68
+ if (props.successChangeCallBackFn) {
69
+ props.successChangeCallBackFn();
70
+ }
71
+ },
72
+ });
73
+ }}
74
+ >
75
+ Change Organization
76
+ </Button>
77
+ </Box>
78
+ );
79
+ };
80
+
81
+ export default ChangeOrgForm;
@@ -1,30 +1,36 @@
1
1
  import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
2
2
  import { Box } from "@mui/material";
3
+ import { TemplateForm } from "../templates";
4
+ import ReportViewer from "../templates/report/ReportViewer";
5
+ import WorkflowDocumentPanel from "../templates/workflow/WorkflowDocumentPanel";
6
+ import ExampleDashboard from "../templates/visuals/ExampleDashboard";
7
+ import DashboardViewer from "../templates/visuals/DashboardViewer";
3
8
 
4
9
  const Home: React.FC = () => {
5
10
  return (
6
- <Box
7
- sx={{
8
- display: "flex",
9
- flexDirection: "column",
10
- alignItems: "center",
11
- justifyContent: "center",
12
- flex: 1,
13
- fontSize: 24,
14
- fontWeight: "bold",
15
- }}
16
- >
17
- <img src="logo.png" style={{ margin: 5 }} />
18
- <div>Welcome to Ezzsteel Flat Product Management System</div>
19
- <div style={{ fontSize: 16 }}>
20
- Use side menu [
21
- <FontAwesomeIcon
22
- icon="bars"
23
- style={{ marginLeft: 10, marginRight: 10 }}
24
- />
25
- ] to navigate to your authorized system modules
26
- </div>
27
- </Box>
11
+ <DashboardViewer dashboardCode="XX_TEMPLATE_DASHBOARD" />
12
+ // <Box
13
+ // sx={{
14
+ // display: "flex",
15
+ // flexDirection: "column",
16
+ // alignItems: "center",
17
+ // justifyContent: "center",
18
+ // flex: 1,
19
+ // fontSize: 24,
20
+ // fontWeight: "bold",
21
+ // }}
22
+ // >
23
+ // <img src="logo.png" style={{ margin: 5 }} />
24
+ // <div>Welcome to Ezzsteel Flat Product Management System</div>
25
+ // <div style={{ fontSize: 16 }}>
26
+ // Use side menu [
27
+ // <FontAwesomeIcon
28
+ // icon="bars"
29
+ // style={{ marginLeft: 10, marginRight: 10 }}
30
+ // />
31
+ // ] to navigate to your authorized system modules
32
+ // </div>
33
+ // </Box>
28
34
  );
29
35
  };
30
36
 
@@ -1,17 +1,22 @@
1
1
  import { useSelector } from "react-redux";
2
- import { RootState } from "../../redux/store";
3
2
  import { Backdrop, CircularProgress } from "@mui/material";
3
+ import { useTranslation } from "react-i18next";
4
4
 
5
5
  const LoadingMask: React.FC = () => {
6
- const loadingMask = useSelector(
7
- (state: RootState) => state.loadingMask.value
8
- );
6
+ const { t } = useTranslation();
7
+ const loadingMask = useSelector((state: any) => state.loadingMask.value);
8
+ const AppLayoutState = useSelector((state: any) => state.AppLayout);
9
+
9
10
  return (
10
11
  <Backdrop
12
+ dir={AppLayoutState.appDirection}
11
13
  sx={{ color: "#fff", zIndex: (theme) => theme.zIndex.drawer + 1 }}
12
14
  open={loadingMask.isOpened}
13
15
  >
14
16
  <CircularProgress color="inherit" />
17
+ <div style={{ marginRight: 10, marginLeft: 10 }}>
18
+ {loadingMask?.message || t("DEFAULT_LOADING_MESSAGE")}
19
+ </div>
15
20
  </Backdrop>
16
21
  );
17
22
  };
@@ -12,18 +12,18 @@ import { ThemeProvider } from "@emotion/react";
12
12
  import { useEffect, useState } from "react";
13
13
  import axios from "axios";
14
14
  import { toast } from "react-toastify";
15
- import { RootState } from "../../redux/store";
16
15
  import { UserSessionActions } from "../../redux/features/common/UserSessionSlice";
17
- import { DARK_THEME_INITIAL_MAIN_COLOR, DARK_THEME_INITIAL_SECANDARY_COLOR } from "../../util";
16
+ import {
17
+ DARK_THEME_INITIAL_MAIN_COLOR,
18
+ DARK_THEME_INITIAL_SECANDARY_COLOR,
19
+ } from "../../util";
18
20
 
19
21
  const Login: React.FC = () => {
20
- const appInfo = useSelector((state: RootState) => state.AppInfo.value);
22
+ const appInfo = useSelector((state: any) => state.AppInfo.value);
21
23
  const [username, setUsername] = useState("");
22
24
  const [password, setPassword] = useState("");
23
25
  const [isLoginInProcess, setIsLoginInProcess] = useState(false);
24
- const UserSessionState = useSelector(
25
- (state: RootState) => state.UserSession.value
26
- );
26
+ const UserSessionState = useSelector((state: any) => state.UserSession.value);
27
27
  const dispatch = useDispatch();
28
28
  const handleLogin = async () => {
29
29
  if (username == null || username == "") {
@@ -50,9 +50,8 @@ const Login: React.FC = () => {
50
50
  if (response.data != null && response.data !== "") {
51
51
  setIsLoginInProcess(false);
52
52
  const UserSession = {
53
+ ...response.data,
53
54
  isAuthenticated: true,
54
- authorities: response.data.authorities,
55
- userProfile: response.data,
56
55
  };
57
56
  dispatch(UserSessionActions.setAuthenticated(UserSession));
58
57
  }
@@ -64,9 +63,7 @@ const Login: React.FC = () => {
64
63
  );
65
64
  }
66
65
  };
67
- const userSession = useSelector(
68
- (state: RootState) => state.UserSession.value
69
- );
66
+ const userSession = useSelector((state: any) => state.UserSession.value);
70
67
  const loginTheme = createTheme({
71
68
  components: {
72
69
  MuiCssBaseline: {
@@ -113,9 +110,8 @@ const Login: React.FC = () => {
113
110
  );
114
111
  if (response != null && response.data != null) {
115
112
  const UserSession = {
113
+ ...response.data,
116
114
  isAuthenticated: true,
117
- authorities: response.data.authorities,
118
- userProfile: response.data,
119
115
  };
120
116
  dispatch(UserSessionActions.setAuthenticated(UserSession));
121
117
  } else {
@@ -7,7 +7,7 @@ import {
7
7
  ToolbarPropsOverrides,
8
8
  } from "@mui/x-data-grid-premium";
9
9
  import { UseFormReturn } from "react-hook-form";
10
- import { SxProps } from "@mui/material";
10
+ import { SxProps, TextFieldProps } from "@mui/material";
11
11
  import { ApiActions } from "../../../hooks/useApiActions";
12
12
  export type MakeOptional<T, K extends keyof T> = Omit<T, K> &
13
13
  Partial<Pick<T, K>>;
@@ -31,6 +31,7 @@ export type RecordAction = {
31
31
  gridActionProps?: {
32
32
  showInMenu?: boolean;
33
33
  multiRecord?: boolean;
34
+ reloadGridAfterAction?: boolean;
34
35
  };
35
36
  formActionProps?: {
36
37
  enabled?: boolean;
@@ -87,6 +88,7 @@ export type TemplateGridColumnProps = {
87
88
  };
88
89
 
89
90
  export type TemplateGridColDef = GridColDef & {
91
+ lookupType?: string;
90
92
  hidden?: boolean;
91
93
  searchable?: boolean;
92
94
  options?: Array<object>;
@@ -121,6 +123,11 @@ export type TemplateGridProps = {
121
123
  setRowSelectionModel?: any;
122
124
  setSelectedRecord?: any;
123
125
  setSelectedRecordIds?: any;
126
+ formLoadCallBk?: (
127
+ formActions: FormActionProps,
128
+ formManager: UseFormReturn,
129
+ record: any
130
+ ) => void;
124
131
  editMode:
125
132
  | { editMode: "none" }
126
133
  | {
@@ -163,19 +170,31 @@ export type FormElementSize = {
163
170
  export type RecordFieldProps = {
164
171
  fieldName: string;
165
172
  fieldLabel: string;
166
- fieldType: "text" | "number" | "date" | "datetime" | "combobox" | "checkbox";
173
+ fieldType:
174
+ | "text"
175
+ | "number"
176
+ | "date"
177
+ | "datetime"
178
+ | "combobox"
179
+ | "checkbox"
180
+ | "html"
181
+ | "lookup";
182
+ lookupType?: string;
167
183
  required?: boolean;
168
184
  disabled?: boolean;
169
185
  hidden?: boolean;
170
186
  dateFormat?: string;
187
+ defaultValue?: any;
171
188
  options?: Array<any>;
172
189
  optionValueField?: string;
173
190
  optionDisplayField?: string;
174
191
  checkedValue?: any;
175
192
  unCheckedValue?: any;
193
+ muiTextFieldProps?: TextFieldProps;
176
194
  gridProps?: TemplateGridColumnProps;
177
195
  formProps?: {
178
196
  fieldSize?: FormElementSize;
197
+ fieldHeight?: number;
179
198
  style?: SxProps;
180
199
  onValueChangeCallBack?: (
181
200
  value: any,
@@ -195,8 +214,8 @@ export type FormElementGroupProps = {
195
214
  formManager?: UseFormReturn;
196
215
  formValues?: any;
197
216
  formActions?: any;
198
- hiddenFields: string[];
199
- disabledFields: string[];
217
+ hiddenFields?: string[];
218
+ disabledFields?: string[];
200
219
  };
201
220
 
202
221
  export type FormElementFieldProps = {
@@ -204,8 +223,8 @@ export type FormElementFieldProps = {
204
223
  formManager?: UseFormReturn;
205
224
  formValues?: any;
206
225
  formActions?: any;
207
- hiddenFields: string[];
208
- disabledFields: string[];
226
+ hiddenFields?: string[];
227
+ disabledFields?: string[];
209
228
  };
210
229
 
211
230
  export type FormElementNodeProps = {
@@ -249,6 +268,11 @@ export type TemplateFormProps = {
249
268
  apiActions: ApiActions;
250
269
  preSaveValidation?: (record: any) => boolean | Promise<boolean>;
251
270
  formSavedSuccessfullyCallBk?: (response: any) => void;
271
+ formLoadCallBk?: (
272
+ formActions: FormActionProps,
273
+ formManager: UseFormReturn,
274
+ record: any
275
+ ) => void;
252
276
  formCloseCallBk?: () => void;
253
277
  saveButtonSpecs?: {
254
278
  label?: string;
@@ -47,6 +47,7 @@ export const constructGridColumnsFromFields: (
47
47
  t: TFunction<"translation", undefined>
48
48
  ) => Array<TemplateGridColDef> = (fields, isDefaultEditable, t) => {
49
49
  const columns: Array<TemplateGridColDef> = [];
50
+
50
51
  for (const tableField of fields) {
51
52
  if (
52
53
  tableField?.fieldType === "text" ||
@@ -55,7 +56,9 @@ export const constructGridColumnsFromFields: (
55
56
  const column: TemplateGridColDef = {
56
57
  ...tableField?.gridProps?.muiProps,
57
58
  editable:
58
- tableField?.gridProps?.muiProps?.editable || isDefaultEditable,
59
+ tableField?.gridProps?.muiProps?.editable != undefined
60
+ ? tableField?.gridProps?.muiProps?.editable
61
+ : isDefaultEditable,
59
62
  type: tableField?.fieldType == "number" ? "number" : "string",
60
63
  field: tableField?.fieldName,
61
64
  headerName: t(tableField?.fieldLabel || tableField?.fieldName),
@@ -66,12 +69,15 @@ export const constructGridColumnsFromFields: (
66
69
  flex: 1,
67
70
  minWidth: 200,
68
71
  };
72
+
69
73
  columns.push(column);
70
74
  } else if (tableField?.fieldType === "date") {
71
75
  const column: TemplateGridColDef = generateDateColumn({
72
76
  ...tableField?.gridProps?.muiProps,
73
77
  editable:
74
- tableField?.gridProps?.muiProps?.editable || isDefaultEditable,
78
+ tableField?.gridProps?.muiProps?.editable != undefined
79
+ ? tableField?.gridProps?.muiProps?.editable
80
+ : isDefaultEditable,
75
81
  field: tableField?.fieldName,
76
82
  headerName: t(tableField?.fieldLabel || tableField?.fieldName),
77
83
  headerAlign: "center",
@@ -86,7 +92,9 @@ export const constructGridColumnsFromFields: (
86
92
  const column: TemplateGridColDef = generateDateTimeColumn({
87
93
  ...tableField?.gridProps?.muiProps,
88
94
  editable:
89
- tableField?.gridProps?.muiProps?.editable || isDefaultEditable,
95
+ tableField?.gridProps?.muiProps?.editable != undefined
96
+ ? tableField?.gridProps?.muiProps?.editable
97
+ : isDefaultEditable,
90
98
  field: tableField?.fieldName,
91
99
  headerName: t(tableField?.fieldLabel || tableField?.fieldName),
92
100
  headerAlign: "center",
@@ -101,7 +109,9 @@ export const constructGridColumnsFromFields: (
101
109
  const column = generateCheckBoxColumn({
102
110
  ...tableField?.gridProps?.muiProps,
103
111
  editable:
104
- tableField?.gridProps?.muiProps?.editable || isDefaultEditable,
112
+ tableField?.gridProps?.muiProps?.editable != undefined
113
+ ? tableField?.gridProps?.muiProps?.editable
114
+ : isDefaultEditable,
105
115
  field: tableField?.fieldName,
106
116
  headerName: t(tableField?.fieldLabel || tableField?.fieldName),
107
117
  headerAlign: "center",
@@ -117,7 +127,30 @@ export const constructGridColumnsFromFields: (
117
127
  const column: TemplateGridColDef = generateComboColumn({
118
128
  ...tableField?.gridProps?.muiProps,
119
129
  editable:
120
- tableField?.gridProps?.muiProps?.editable || isDefaultEditable,
130
+ tableField?.gridProps?.muiProps?.editable != undefined
131
+ ? tableField?.gridProps?.muiProps?.editable
132
+ : isDefaultEditable,
133
+ field: tableField?.fieldName,
134
+ headerName: t(tableField?.fieldLabel || tableField?.fieldName),
135
+ headerAlign: "center",
136
+ align: "center",
137
+ hidden: tableField?.hidden,
138
+ searchable: tableField?.gridProps?.searchable,
139
+ valueField: tableField?.optionValueField || "value",
140
+ displayField: tableField?.optionDisplayField || "display",
141
+ options: tableField?.options || [],
142
+ flex: 1,
143
+ minWidth: 200,
144
+ });
145
+ columns.push(column);
146
+ } else if (tableField?.fieldType === "lookup") {
147
+ const column: TemplateGridColDef = generateComboColumn({
148
+ ...tableField?.gridProps?.muiProps,
149
+ editable:
150
+ tableField?.gridProps?.muiProps?.editable != undefined
151
+ ? tableField?.gridProps?.muiProps?.editable
152
+ : isDefaultEditable,
153
+ lookupType: tableField?.lookupType,
121
154
  field: tableField?.fieldName,
122
155
  headerName: t(tableField?.fieldLabel || tableField?.fieldName),
123
156
  headerAlign: "center",
@@ -150,6 +183,14 @@ export const constructValidationSchema = (fields: Array<RecordFieldProps>) => {
150
183
  } else {
151
184
  validationSchemaObj[fieldName] = z.number().optional().nullable();
152
185
  }
186
+ } else if (field.fieldType === "checkbox") {
187
+ if (field?.required === true) {
188
+ validationSchemaObj[fieldName] = z.boolean({
189
+ required_error: "This field is required",
190
+ });
191
+ } else {
192
+ validationSchemaObj[fieldName] = z.boolean().optional().nullable();
193
+ }
153
194
  } else {
154
195
  if (field?.required === true) {
155
196
  validationSchemaObj[fieldName] = z