@asaleh37/ui-base 1.2.19 → 1.2.21

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": "1.2.19",
3
+ "version": "1.2.21",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "Ahmed Saleh Mohamed",
@@ -0,0 +1,432 @@
1
+ import { useEffect, 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
+ import { Box } from "@mui/material";
8
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
9
+ import useInterval from "../../../hooks/useInterval";
10
+
11
+ const NotificationGrid: React.FC = () => {
12
+ const { t } = useTranslation();
13
+ const [data, setData] = useState([]);
14
+ const SystemTimeIntervals = useSelector(
15
+ (state: any) => state.commonStores.stores.SystemTimeIntervals.data
16
+ );
17
+ const SystemDataQueries = useSelector(
18
+ (state: any) => state.commonStores.stores.SystemDataQueries.data
19
+ );
20
+ const apiActions = useApiActions({
21
+ findAll: "api/v1/dev/notification/all",
22
+ deleteById: "api/v1/dev/notification",
23
+ save: "api/v1/dev/notification",
24
+ findById: "api/v1/dev/notification",
25
+ setData: setData,
26
+ });
27
+
28
+ const formElements: Array<FormElementProps> = [
29
+ {
30
+ type: "field",
31
+ mode: "props",
32
+ props: {
33
+ fieldLabel: "id",
34
+ fieldName: "id",
35
+ fieldType: "number",
36
+ hidden: true,
37
+ gridProps: {
38
+ hidden: true,
39
+ },
40
+ },
41
+ },
42
+ {
43
+ type: "field",
44
+ mode: "props",
45
+ props: {
46
+ fieldLabel: "createTime",
47
+ fieldName: "createTime",
48
+ fieldType: "datetime",
49
+ hidden: true,
50
+ gridProps: {
51
+ hidden: true,
52
+ },
53
+ },
54
+ },
55
+ {
56
+ type: "field",
57
+ mode: "props",
58
+ props: {
59
+ fieldLabel: "createdBy",
60
+ fieldName: "createdBy",
61
+ fieldType: "text",
62
+ hidden: true,
63
+ gridProps: {
64
+ hidden: true,
65
+ },
66
+ },
67
+ },
68
+ {
69
+ type: "field",
70
+ mode: "props",
71
+ props: {
72
+ fieldLabel: "lastUpdateBy",
73
+ fieldName: "lastUpdateBy",
74
+ fieldType: "text",
75
+ hidden: true,
76
+ gridProps: {
77
+ hidden: true,
78
+ },
79
+ },
80
+ },
81
+ {
82
+ type: "field",
83
+ mode: "props",
84
+ props: {
85
+ fieldLabel: "lastUpdateTime",
86
+ fieldName: "lastUpdateTime",
87
+ fieldType: "datetime",
88
+ hidden: true,
89
+ gridProps: {
90
+ hidden: true,
91
+ },
92
+ },
93
+ },
94
+
95
+ {
96
+ type: "field",
97
+ mode: "props",
98
+ props: {
99
+ fieldLabel: "NOTIFICATION_NOTIFICATION_CODE",
100
+ fieldName: "notificationCode",
101
+ required: true,
102
+ fieldType: "text",
103
+ },
104
+ },
105
+
106
+ {
107
+ type: "field",
108
+ mode: "props",
109
+ props: {
110
+ fieldLabel: "Notification Data Query ( will be passed a parameter call last_run_time represents last check time)",
111
+ fieldName: "notificationQueryId",
112
+ required: true,
113
+ fieldType: "combobox",
114
+ options: SystemDataQueries,
115
+ optionDisplayField: "queryName",
116
+ gridProps: {
117
+ hidden: true,
118
+ },
119
+ optionValueField: "id",
120
+ },
121
+ },
122
+ {
123
+ type: "field",
124
+ mode: "props",
125
+ props: {
126
+ fieldLabel:
127
+ "Users to notify Query (must have username property in the result set)",
128
+ fieldName: "usersToNotifyQueryId",
129
+ required: false,
130
+ fieldType: "combobox",
131
+ options: SystemDataQueries,
132
+ optionDisplayField: "queryName",
133
+ gridProps: {
134
+ hidden: true,
135
+ },
136
+ optionValueField: "id",
137
+ },
138
+ },
139
+ {
140
+ type: "field",
141
+ mode: "props",
142
+ props: {
143
+ fieldLabel: "NOTIFICATION_AUTHORITY_TO_NOTIFY",
144
+ fieldName: "authorityToNotify",
145
+ required: false,
146
+ gridProps: {
147
+ hidden: true,
148
+ },
149
+ fieldType: "text",
150
+ },
151
+ },
152
+ {
153
+ type: "field",
154
+ mode: "props",
155
+ props: {
156
+ fieldLabel: "Interval Type",
157
+ fieldName: "intervalType",
158
+ fieldType: "combobox",
159
+ options: SystemTimeIntervals,
160
+ gridProps: {
161
+ hidden: true,
162
+ },
163
+ optionDisplayField: "value",
164
+ optionValueField: "value",
165
+ },
166
+ },
167
+ {
168
+ type: "field",
169
+ mode: "props",
170
+ props: {
171
+ fieldLabel: "Interval Value (minmum value 20 seconds)",
172
+ fieldName: "intervalValue",
173
+ gridProps: {
174
+ hidden: true,
175
+ },
176
+ fieldType: "number",
177
+ },
178
+ },
179
+ {
180
+ type: "field",
181
+ mode: "props",
182
+ props: {
183
+ fieldLabel: "Start Notifing Date",
184
+ fieldName: "startNotificationFrom",
185
+ gridProps: {
186
+ hidden: true,
187
+ },
188
+ fieldType: "datetime",
189
+ },
190
+ },
191
+
192
+ {
193
+ type: "field",
194
+ mode: "props",
195
+ props: {
196
+ fieldLabel: "NOTIFICATION_SYSTEM_APPLICATION_ID",
197
+ fieldName: "systemApplicationId",
198
+ hidden: true,
199
+ gridProps: { hidden: true },
200
+ required: false,
201
+ fieldType: "number",
202
+ },
203
+ },
204
+ {
205
+ type: "field",
206
+ mode: "props",
207
+ props: {
208
+ fieldLabel: "NOTIFICATION_NOTIFICATION_ICON",
209
+ fieldName: "notificationIcon",
210
+ required: true,
211
+ fieldType: "text",
212
+ gridProps: {
213
+ muiProps: {
214
+ renderCell: (params: any) => {
215
+ return (
216
+ <Box
217
+ sx={{
218
+ display: "flex",
219
+ alignItems: "center",
220
+ color: params?.row?.notificationIconColor,
221
+ justifyContent: "center",
222
+ height: "100%",
223
+ }}
224
+ >
225
+ {params?.row?.notificationIcon ? (
226
+ <FontAwesomeIcon icon={params.row.notificationIcon} />
227
+ ) : (
228
+ <></>
229
+ )}
230
+ </Box>
231
+ );
232
+ },
233
+ },
234
+ },
235
+ },
236
+ },
237
+ {
238
+ type: "field",
239
+ mode: "props",
240
+ props: {
241
+ fieldLabel: "NOTIFICATION_NOTIFICATION_AR_TEXT",
242
+ fieldName: "notificationArText",
243
+ required: true,
244
+ fieldType: "text",
245
+ gridProps: {
246
+ muiProps: {
247
+ renderCell: (params: any) => {
248
+ return (
249
+ <Box
250
+ sx={{
251
+ display: "flex",
252
+ alignItems: "center",
253
+ color: params?.row?.notificationTextColor,
254
+ justifyContent: "center",
255
+ height: "100%",
256
+ }}
257
+ >
258
+ {params?.row?.notificationArText}
259
+ </Box>
260
+ );
261
+ },
262
+ },
263
+ },
264
+ },
265
+ },
266
+ {
267
+ type: "field",
268
+ mode: "props",
269
+ props: {
270
+ fieldLabel: "NOTIFICATION_NOTIFICATION_EN_TEXT",
271
+ fieldName: "notificationEnText",
272
+ required: true,
273
+ fieldType: "text",
274
+ gridProps: {
275
+ muiProps: {
276
+ renderCell: (params: any) => {
277
+ return (
278
+ <Box
279
+ sx={{
280
+ display: "flex",
281
+ alignItems: "center",
282
+ color: params?.row?.notificationTextColor,
283
+ justifyContent: "center",
284
+ height: "100%",
285
+ }}
286
+ >
287
+ {params?.row?.notificationEnText}
288
+ </Box>
289
+ );
290
+ },
291
+ },
292
+ },
293
+ },
294
+ },
295
+ {
296
+ type: "field",
297
+ mode: "props",
298
+ props: {
299
+ fieldLabel: "Last Runtime",
300
+ disabled: true,
301
+ fieldName: "lastIntervalRun",
302
+ fieldType: "datetime",
303
+ },
304
+ },
305
+ {
306
+ type: "field",
307
+ mode: "props",
308
+ props: {
309
+ fieldLabel: "Last Successful Runtime",
310
+ fieldName: "lastSuccessfulRun",
311
+ disabled: true,
312
+ fieldType: "datetime",
313
+ },
314
+ },
315
+ {
316
+ type: "field",
317
+ mode: "props",
318
+ props: {
319
+ fieldLabel: "Last Run Message",
320
+ fieldName: "lastRunMessage",
321
+ disabled: true,
322
+ fieldType: "text",
323
+ },
324
+ },
325
+ {
326
+ type: "field",
327
+ mode: "props",
328
+ props: {
329
+ fieldLabel: "NOTIFICATION_NOTIFICATION_TEXT_COLOR",
330
+ fieldName: "notificationTextColor",
331
+ required: false,
332
+ gridProps: {
333
+ hidden: true,
334
+ },
335
+ fieldType: "text",
336
+ },
337
+ },
338
+
339
+ {
340
+ type: "field",
341
+ mode: "props",
342
+ props: {
343
+ fieldLabel: "NOTIFICATION_NOTIFICATION_ICON_COLOR",
344
+ fieldName: "notificationIconColor",
345
+ required: false,
346
+ gridProps: {
347
+ hidden: true,
348
+ },
349
+ fieldType: "text",
350
+ },
351
+ },
352
+ {
353
+ type: "field",
354
+ mode: "props",
355
+ props: {
356
+ fieldLabel: "NOTIFICATION_NOTIFICATION_ACTION",
357
+ fieldName: "notificationAction",
358
+ required: false,
359
+ fieldType: "combobox",
360
+ options: [{ value: "NAVIGATION" }],
361
+ optionDisplayField: "value",
362
+ optionValueField: "value",
363
+ gridProps: {
364
+ hidden: true,
365
+ },
366
+ },
367
+ },
368
+ {
369
+ type: "field",
370
+ mode: "props",
371
+ props: {
372
+ fieldLabel:
373
+ "Action Payload (must be a rout in case of NAVIGATION with parameter values betweem @@)",
374
+ fieldName: "notificationActionPayload",
375
+ required: false,
376
+ fieldType: "text",
377
+ gridProps: {
378
+ hidden: true,
379
+ },
380
+ },
381
+ },
382
+
383
+ {
384
+ type: "field",
385
+ mode: "props",
386
+ props: {
387
+ fieldLabel:
388
+ "Organization Id Field on the Notification Query result set if it supports it",
389
+ fieldName: "organizationIdField",
390
+ required: false,
391
+ fieldType: "text",
392
+ gridProps: {
393
+ hidden: true,
394
+ },
395
+ },
396
+ },
397
+ {
398
+ type: "field",
399
+ mode: "props",
400
+ props: {
401
+ fieldLabel: "NOTIFICATION_IS_ACTIVE",
402
+ fieldName: "isActive",
403
+ required: false,
404
+ fieldType: "checkbox",
405
+ },
406
+ },
407
+ ];
408
+
409
+ return (
410
+ <TemplateGrid
411
+ apiActions={apiActions}
412
+ data={data}
413
+ setData={setData}
414
+ editMode={{
415
+ editMode: "modal",
416
+ specs: {
417
+ modalIcon: "bell",
418
+ modalTitle: "System Notification",
419
+ modalWidth: "300",
420
+ },
421
+ }}
422
+ formElements={formElements}
423
+ keyColumnName={"id"}
424
+ gridTitle={t("NOTIFICATION_PLURAL")}
425
+ girdIcon="bell"
426
+ editAction={{ isEnabled: true, authority: "NOTIFICATION_EDIT" }}
427
+ deleteAction={{ isEnabled: true, authority: "NOTIFICATION_DELETE" }}
428
+ />
429
+ );
430
+ };
431
+
432
+ export default NotificationGrid;
@@ -0,0 +1,222 @@
1
+ import { useState } from "react";
2
+ import TemplateGrid from "../../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
+ import useApiActions from "../../templates/DataEntryTemplates/useApiActions";
4
+ import { FormElementProps } from "../../templates/DataEntryTemplates/DataEntryTypes";
5
+ import { useTranslation } from "react-i18next";
6
+
7
+ const NotificationQueueGrid: React.FC = () => {
8
+ const { t } = useTranslation();
9
+ const [data, setData] = useState([]);
10
+ const apiActions = useApiActions({
11
+ findAll: "api/v1/dev/notificationqueue/all",
12
+ deleteById: "api/v1/dev/notificationqueue",
13
+ save: "api/v1/dev/notificationqueue",
14
+ findById: "api/v1/dev/notificationqueue",
15
+ setData: setData,
16
+ });
17
+
18
+ const formElements: Array<FormElementProps> = [
19
+ {
20
+ type: "field",
21
+ mode: "props",
22
+ props: {
23
+ fieldLabel: "id",
24
+ fieldName: "id",
25
+ fieldType: "number",
26
+ hidden: true,
27
+ gridProps: {
28
+ hidden: true,
29
+ },
30
+ },
31
+ },
32
+ {
33
+ type: "field",
34
+ mode: "props",
35
+ props: {
36
+ fieldLabel: "createTime",
37
+ fieldName: "createTime",
38
+ fieldType: "datetime",
39
+ hidden: true,
40
+ gridProps: {
41
+ hidden: true,
42
+ },
43
+ },
44
+ },
45
+ {
46
+ type: "field",
47
+ mode: "props",
48
+ props: {
49
+ fieldLabel: "createdBy",
50
+ fieldName: "createdBy",
51
+ fieldType: "text",
52
+ hidden: true,
53
+ gridProps: {
54
+ hidden: true,
55
+ },
56
+ },
57
+ },
58
+ {
59
+ type: "field",
60
+ mode: "props",
61
+ props: {
62
+ fieldLabel: "lastUpdateBy",
63
+ fieldName: "lastUpdateBy",
64
+ fieldType: "text",
65
+ hidden: true,
66
+ gridProps: {
67
+ hidden: true,
68
+ },
69
+ },
70
+ },
71
+ {
72
+ type: "field",
73
+ mode: "props",
74
+ props: {
75
+ fieldLabel: "lastUpdateTime",
76
+ fieldName: "lastUpdateTime",
77
+ fieldType: "datetime",
78
+ hidden: true,
79
+ gridProps: {
80
+ hidden: true,
81
+ },
82
+ },
83
+ },
84
+ {
85
+ type: "field",
86
+ mode: "props",
87
+ props: {
88
+ fieldLabel: "NOTIFICATION_QUEUE_IS_NOTIFIED",
89
+ fieldName: "isNotified",
90
+ required: false,
91
+ fieldType: "checkbox",
92
+ },
93
+ },
94
+ {
95
+ type: "field",
96
+ mode: "props",
97
+ props: {
98
+ fieldLabel: "NOTIFICATION_QUEUE_NOTIFIED_TIME",
99
+ fieldName: "notifiedTime",
100
+ required: false,
101
+ fieldType: "datetime",
102
+ },
103
+ },
104
+ {
105
+ type: "field",
106
+ mode: "props",
107
+ props: {
108
+ fieldLabel: "NOTIFICATION_QUEUE_SYSTEM_APPLICATION_ID",
109
+ fieldName: "systemApplicationId",
110
+ required: false,
111
+ fieldType: "number",
112
+ },
113
+ },
114
+ {
115
+ type: "field",
116
+ mode: "props",
117
+ props: {
118
+ fieldLabel: "NOTIFICATION_QUEUE_USERNAME",
119
+ fieldName: "username",
120
+ required: false,
121
+ fieldType: "text",
122
+ },
123
+ },
124
+ {
125
+ type: "field",
126
+ mode: "props",
127
+ props: {
128
+ fieldLabel: "NOTIFICATION_QUEUE_NOTIFICATION_ACTION",
129
+ fieldName: "notificationAction",
130
+ required: false,
131
+ fieldType: "text",
132
+ },
133
+ },
134
+ {
135
+ type: "field",
136
+ mode: "props",
137
+ props: {
138
+ fieldLabel: "NOTIFICATION_QUEUE_NOTIFICATION_ACTION_PAYLOAD",
139
+ fieldName: "notificationActionPayload",
140
+ required: false,
141
+ fieldType: "text",
142
+ },
143
+ },
144
+ {
145
+ type: "field",
146
+ mode: "props",
147
+ props: {
148
+ fieldLabel: "NOTIFICATION_QUEUE_NOTIFICATION_AR_TEXT",
149
+ fieldName: "notificationArText",
150
+ required: false,
151
+ fieldType: "text",
152
+ },
153
+ },
154
+ {
155
+ type: "field",
156
+ mode: "props",
157
+ props: {
158
+ fieldLabel: "NOTIFICATION_QUEUE_NOTIFICATION_EN_TEXT",
159
+ fieldName: "notificationEnText",
160
+ required: false,
161
+ fieldType: "text",
162
+ },
163
+ },
164
+ {
165
+ type: "field",
166
+ mode: "props",
167
+ props: {
168
+ fieldLabel: "NOTIFICATION_QUEUE_NOTIFICATION_ICON",
169
+ fieldName: "notificationIcon",
170
+ required: false,
171
+ fieldType: "text",
172
+ },
173
+ },
174
+ {
175
+ type: "field",
176
+ mode: "props",
177
+ props: {
178
+ fieldLabel: "NOTIFICATION_QUEUE_NOTIFICATION_ICON_COLOR",
179
+ fieldName: "notificationIconColor",
180
+ required: false,
181
+ fieldType: "text",
182
+ },
183
+ },
184
+ {
185
+ type: "field",
186
+ mode: "props",
187
+ props: {
188
+ fieldLabel: "NOTIFICATION_QUEUE_NOTIFICATION_ID",
189
+ fieldName: "notificationId",
190
+ required: false,
191
+ fieldType: "number",
192
+ },
193
+ },
194
+ {
195
+ type: "field",
196
+ mode: "props",
197
+ props: {
198
+ fieldLabel: "NOTIFICATION_QUEUE_NOTIFICATION_TEXT_COLOR",
199
+ fieldName: "notificationTextColor",
200
+ required: false,
201
+ fieldType: "text",
202
+ },
203
+ },
204
+ ];
205
+
206
+ return (
207
+ <TemplateGrid
208
+ apiActions={apiActions}
209
+ data={data}
210
+ setData={setData}
211
+ editMode={{ editMode: "row"}}
212
+ formElements={formElements}
213
+ keyColumnName={"id"}
214
+ gridTitle={t("NOTIFICATION_QUEUE_PLURAL")}
215
+ girdIcon="table-cells"
216
+ editAction={{ isEnabled: true, authority: "NOTIFICATION_QUEUE_EDIT" }}
217
+ deleteAction={{ isEnabled: true, authority: "NOTIFICATION_QUEUE_DELETE" }}
218
+ />
219
+ );
220
+ };
221
+
222
+ export default NotificationQueueGrid;
@@ -8,30 +8,28 @@ import AttachmentPanel from "../templates/attachment/AttachmentPanel";
8
8
 
9
9
  const Home: React.FC = () => {
10
10
  return (
11
- // <DashboardViewer dashboardCode="XX_TEMPLATE_DASHBOARD" />
12
- <AttachmentPanel attachmentCode="DOC" refKey="1"/>
13
- // <Box
14
- // sx={{
15
- // display: "flex",
16
- // flexDirection: "column",
17
- // alignItems: "center",
18
- // justifyContent: "center",
19
- // flex: 1,
20
- // fontSize: 24,
21
- // fontWeight: "bold",
22
- // }}
23
- // >
24
- // <img src="logo.png" style={{ margin: 5 }} />
25
- // <div>Welcome to Ezzsteel Flat Product Management System</div>
26
- // <div style={{ fontSize: 16 }}>
27
- // Use side menu [
28
- // <FontAwesomeIcon
29
- // icon="bars"
30
- // style={{ marginLeft: 10, marginRight: 10 }}
31
- // />
32
- // ] to navigate to your authorized system modules
33
- // </div>
34
- // </Box>
11
+ <Box
12
+ sx={{
13
+ display: "flex",
14
+ flexDirection: "column",
15
+ alignItems: "center",
16
+ justifyContent: "center",
17
+ flex: 1,
18
+ fontSize: 24,
19
+ fontWeight: "bold",
20
+ }}
21
+ >
22
+ <img src="logo.png" style={{ margin: 5 }} />
23
+ <div>Welcome to Ezzsteel Flat Product Management System</div>
24
+ <div style={{ fontSize: 16 }}>
25
+ Use side menu [
26
+ <FontAwesomeIcon
27
+ icon="bars"
28
+ style={{ marginLeft: 10, marginRight: 10 }}
29
+ />
30
+ ] to navigate to your authorized system modules
31
+ </div>
32
+ </Box>
35
33
  );
36
34
  };
37
35