ui-soxo-bootstrap-core 2.4.25-dev.9 → 2.4.25

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 (31) hide show
  1. package/.github/workflows/npm-publish.yml +15 -37
  2. package/core/components/extra-info/extra-info-details.js +126 -109
  3. package/core/components/landing-api/landing-api.js +30 -22
  4. package/core/lib/Store.js +18 -20
  5. package/core/lib/components/index.js +1 -4
  6. package/core/lib/components/sidemenu/sidemenu.js +256 -153
  7. package/core/lib/components/sidemenu/sidemenu.scss +26 -39
  8. package/core/lib/elements/basic/rangepicker/rangepicker.js +29 -118
  9. package/core/lib/hooks/index.js +12 -2
  10. package/core/lib/pages/login/login.js +139 -255
  11. package/core/lib/pages/login/login.scss +32 -140
  12. package/core/models/dashboard/dashboard.js +0 -14
  13. package/core/models/menus/components/menu-add/menu-add.js +268 -230
  14. package/core/models/menus/components/menu-lists/menu-lists.js +89 -126
  15. package/core/models/menus/components/menu-lists/menu-lists.scss +0 -9
  16. package/core/models/menus/menus.js +267 -247
  17. package/core/models/roles/components/role-add/role-add.js +227 -269
  18. package/core/models/roles/components/role-list/role-list.js +6 -8
  19. package/core/models/roles/roles.js +174 -182
  20. package/core/models/users/components/user-add/user-add.js +1 -69
  21. package/core/models/users/users.js +0 -57
  22. package/core/modules/index.js +13 -23
  23. package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.js +1 -1
  24. package/package.json +2 -2
  25. package/core/lib/hooks/use-otp-timer.js +0 -99
  26. package/core/models/staff/components/staff-add/staff-add.js +0 -352
  27. package/core/models/staff/components/staff-add/staff-add.scss +0 -0
  28. package/core/modules/steps/action-buttons.js +0 -79
  29. package/core/modules/steps/steps.js +0 -553
  30. package/core/modules/steps/steps.scss +0 -158
  31. package/core/modules/steps/timeline.js +0 -49
@@ -16,272 +16,310 @@ const { Option } = Select;
16
16
 
17
17
  import './menu-add.scss';
18
18
 
19
+
19
20
  const MenuAdd = ({ model, callback, edit, history, formContent, match, additional_queries, ...props }) => {
20
- let mode = 'Add';
21
-
22
- if (formContent.id) {
23
- mode = 'Edit';
24
- } else if (formContent.copy) {
25
- mode = 'copy';
26
- }
27
-
28
- if (formContent.attributes) {
29
- if (typeof formContent.attributes === 'string') {
30
- if (formContent.attributes !== '') {
31
- formContent.attributes = JSON.parse(formContent.attributes);
32
- } else {
33
- formContent.attributes = {};
34
- }
35
- }
36
- } else {
37
- formContent.attributes = {};
38
- }
39
21
 
40
- const [loading, setLoading] = useState(true);
22
+ let mode = 'Add';
41
23
 
42
- const [form] = Form.useForm();
24
+ if (formContent.id) {
25
+ mode = 'Edit'
26
+ } else if (formContent.copy) {
27
+ mode = 'copy'
28
+ }
43
29
 
44
- const [pages, setPages] = useState([]);
30
+ if (formContent.attributes) {
45
31
 
46
- const [models, setModels] = useState([]);
32
+ if (typeof formContent.attributes === 'string') {
47
33
 
48
- const [menus, setMenus] = useState([]);
34
+ if (formContent.attributes !== '') {
49
35
 
50
- const [body, setBody] = useState(formContent);
36
+ formContent.attributes = JSON.parse(formContent.attributes);
51
37
 
52
- const { params } = match;
38
+ } else {
53
39
 
54
- let location = useLocation();
40
+ formContent.attributes = {};
55
41
 
56
- const query = new URLSearchParams(location.search);
42
+ }
43
+ }
44
+ } else {
45
+ formContent.attributes = {}
46
+ }
57
47
 
58
- let step = parseInt(query.get('step')) || 1;
59
48
 
60
- console.log(step);
49
+ const [loading, setLoading] = useState(true);
61
50
 
62
- useEffect(() => {
63
- // loadModelColumns();
64
- getPages();
51
+ const [form] = Form.useForm();
65
52
 
66
- getModels();
53
+ const [pages, setPages] = useState([]);
67
54
 
68
- setLoading(false);
55
+ const [models, setModels] = useState([]);
69
56
 
70
- getMenus();
71
- }, []);
57
+ const [menus, setMenus] = useState([])
72
58
 
73
- /**
74
- * Load the Staffs
75
- */
76
- const getPages = () => {
77
- PagesAPI.getPages().then((result) => {
78
- if (Array.isArray(result.result)) {
79
- setPages(result.result);
80
- }
81
- });
82
- };
59
+ const [body, setBody] = useState(formContent);
83
60
 
84
- /**
85
- * Load the Models
86
- */
87
- const getModels = () => {
88
- ModelsAPI.get().then((result) => {
89
- // console.log(result);
61
+ const { params } = match;
90
62
 
91
- setModels(result.result);
92
- });
93
- };
63
+ let location = useLocation();
94
64
 
95
- /**
96
- * Load the Models
97
- */
98
- const getMenus = () => {
99
- MenusAPI.get().then((result) => {
100
- // console.log(result);
65
+ const query = new URLSearchParams(location.search);
101
66
 
102
- setMenus(result.result);
103
- });
104
- };
67
+ console.log(query.get('step'));
105
68
 
106
- /**
107
- * Submit values
108
- */
109
- const onSubmit = (values) => {
110
- // console.log(values);
111
- setLoading(true);
69
+ let step = parseInt(query.get('step')) || 1;
112
70
 
113
- let id = formContent.id;
71
+ console.log(step);
114
72
 
115
- // Add the step to form content
116
- // values.step = step;
73
+ useEffect(() => {
117
74
 
118
- if (values.attributes && typeof values === 'object') {
119
- values = {
120
- ...values,
121
- attributes: JSON.stringify(values.attributes),
122
- };
123
- }
75
+ // loadModelColumns();
76
+ getPages();
124
77
 
125
- if (id) {
126
- // Update of model
127
- model.update({ id, values }).then(() => {
128
- // callback();
129
- message.success('Menu Updated');
78
+ getModels();
130
79
 
131
80
  setLoading(false);
132
81
 
133
- callback();
134
- });
135
- } else {
136
- values.step = step;
82
+ getMenus();
137
83
 
138
- // Append the additional queries to the object
139
- additional_queries.forEach(({ field, value }) => {
140
- values[field] = value;
141
- });
84
+ }, []);
142
85
 
143
- // add new model
144
- model.add({ values }).then(() => {
145
- // callback();
146
- message.success('Menu Added');
147
86
 
148
- setLoading(false);
87
+ /**
88
+ * Load the Staffs
89
+ */
90
+ const getPages = () => {
91
+ PagesAPI.getPages().then((result) => {
149
92
 
150
- callback();
151
- });
152
- }
153
- };
154
-
155
- return (
156
- <section className="collection-add menu-add">
157
- <Title level={4}>{mode} Menu</Title>
158
-
159
- {loading ? (
160
- <Skeleton />
161
- ) : (
162
- <Form initialValues={{ ...body }} form={form} layout="vertical" onFinish={onSubmit}>
163
- <div className="form-container">
164
- <div className="left-container">
165
- {/* Caption */}
166
- <Form.Item name={'caption'} label="Caption" required>
167
- <Input placeholder="Enter caption" />
168
- </Form.Item>
169
- {/* Caption Ends */}
170
-
171
- {/* Name */}
172
- <Form.Item name={'name'} label="Name" required>
173
- <Input placeholder="Enter name" />
174
- </Form.Item>
175
- {/* Name Ends */}
176
-
177
- {/* Description */}
178
- <Form.Item name={'description'} label="Description">
179
- <TextArea placeholder="Enter Description" />
180
- </Form.Item>
181
- {/* Description Ends */}
182
-
183
- {/* Model */}
184
- <Form.Item label="Models" name={'model_id'}>
185
- {/* <ReferenceSelect value={model.id} label={model.name} model={Models} /> */}
186
- <Select showSearch style={{ width: '100%' }} placeholder="Select a Page" optionFilterProp="label">
187
- {models.map((model, key) => (
188
- <Option key={key} label={model.name} value={model.id}>
189
- {model.name}
190
- </Option>
191
- ))}
192
- </Select>
193
- </Form.Item>
194
- {/* Model Ends
93
+ if (Array.isArray(result.result)) {
94
+ setPages(result.result);
95
+ }
96
+ });
97
+ };
98
+
99
+ /**
100
+ * Load the Models
101
+ */
102
+ const getModels = () => {
103
+ ModelsAPI.get().then((result) => {
104
+ // console.log(result);
105
+
106
+ setModels(result.result);
107
+ });
108
+ };
109
+
110
+
111
+ /**
112
+ * Load the Models
113
+ */
114
+ const getMenus = () => {
115
+ MenusAPI.get().then((result) => {
116
+ // console.log(result);
117
+
118
+ setMenus(result.result);
119
+ });
120
+ };
121
+
122
+
123
+ /**
124
+ * Submit values
125
+ */
126
+ const onSubmit = (values) => {
127
+ // console.log(values);
128
+ setLoading(true);
129
+
130
+ let id = formContent.id;
131
+
132
+ // Add the step to form content
133
+ // values.step = step;
134
+
135
+ if (values.attributes && typeof values === 'object') {
136
+
137
+ values = {
138
+ ...values,
139
+ attributes: JSON.stringify(values.attributes)
140
+ }
141
+ }
142
+
143
+ if (id) {
144
+ // Update of model
145
+ model.update({ id, values }).then(() => {
146
+
147
+ // callback();
148
+ message.success('Menu Updated');
149
+
150
+ setLoading(false);
151
+
152
+ callback();
153
+
154
+ });
155
+
156
+ } else {
157
+
158
+ values.step = step;
159
+
160
+ // Append the additional queries to the object
161
+ additional_queries.forEach(({ field, value }) => {
162
+
163
+ values[field] = value;
164
+
165
+ })
166
+
167
+ // add new model
168
+ model.add({ values }).then(() => {
169
+
170
+ // callback();
171
+ message.success('Menu Added');
172
+
173
+ setLoading(false);
174
+
175
+ callback();
176
+
177
+ });
178
+ }
179
+ };
180
+
181
+ return (
182
+ <section className="collection-add menu-add">
183
+ {/* <Title level={4}>{mode} Menu</Title> */}
184
+
185
+ {loading ? (
186
+ <Skeleton />
187
+ ) : (
188
+ <Form initialValues={{ ...body }} form={form} layout="vertical" onFinish={onSubmit}>
189
+
190
+ <div className='form-container'>
191
+ <div className='left-container'>
192
+
193
+
194
+ {/* Caption */}
195
+ <Form.Item name={"caption"} label="Caption" required>
196
+ <Input placeholder="Enter caption" />
197
+ </Form.Item>
198
+ {/* Caption Ends */}
199
+
200
+ {/* Name */}
201
+ <Form.Item name={"name"} label="Name" required>
202
+ <Input placeholder="Enter name" />
203
+ </Form.Item>
204
+ {/* Name Ends */}
205
+
206
+ {/* Description */}
207
+ <Form.Item name={"description"} label="Description">
208
+ <TextArea placeholder="Enter Description" />
209
+ </Form.Item>
210
+ {/* Description Ends */}
211
+
212
+ {/* Model */}
213
+ <Form.Item label="Models" name={'model_id'}>
214
+
215
+ {/* <ReferenceSelect value={model.id} label={model.name} model={Models} /> */}
216
+ <Select showSearch style={{ width: '100%' }}
217
+ placeholder="Select a Page"
218
+ optionFilterProp="label"
219
+ >
220
+ {models.map((model, key) => (
221
+ <Option key={key} label={model.name} value={model.id}>{model.name}</Option>
222
+ ))}
223
+ </Select>
224
+
225
+ </Form.Item>
226
+ {/* Model Ends
195
227
 
196
228
 
197
229
  {/* Pages */}
198
- <Form.Item label="Pages" name={'page_id'}>
199
- {/* <ReferenceSelect value={pages.id} label={pages.name} model={Pages} /> */}
200
-
201
- <Select showSearch optionFilterProp="children" style={{ width: '100%' }}>
202
- {pages.map((model, key) => (
203
- <Option key={key} value={model.id}>
204
- {model.name}
205
- </Option>
206
- ))}
207
- </Select>
208
- </Form.Item>
209
- {/* Pages Ends */}
210
-
211
- {/* Pages */}
212
- <Form.Item label="Header" name={'header_id'}>
213
- {/* <ReferenceSelect value={pages.id} label={pages.name} model={Pages} /> */}
214
-
215
- <Select
216
- showSearch
217
- style={{ width: '100%' }}
218
- placeholder="Select header"
219
- optionFilterProp="children"
220
- filterOption={(input, option) => option.children.toLowerCase().includes(input.toLowerCase())}
221
- >
222
- {menus.map((menu) => (
223
- <Option key={menu.id} value={menu.id}>
224
- {menu.name}
225
- </Option>
226
- ))}
227
- </Select>
228
- </Form.Item>
229
- {/* Pages Ends */}
230
-
231
- {/* Path */}
232
- <Form.Item name="path" label="Path" required>
233
- <Input placeholder="Enter path" />
234
- </Form.Item>
235
- {/* Path Ends */}
236
-
237
- {/* Route */}
238
- <Form.Item name="route" label="Route" required>
239
- <Input placeholder="Enter route" />
240
- </Form.Item>
241
- {/* Route Ends */}
242
-
243
- {/* Switch */}
244
- <Form.Item name="is_visible" label="Visible" required>
245
- <Switch defaultChecked={body.is_visible} />
246
- </Form.Item>
247
- {/* Switch Ends */}
248
-
249
- {/* Step */}
250
- <Form.Item name={'order'} label="Order" required>
251
- <InputNumber placeholder="Enter order" />
252
- </Form.Item>
253
- {/* Step Ends */}
254
-
255
- {/* Icon Name*/}
256
- <Form.Item name="icon_name" label="Icon Name" required>
257
- <Input placeholder="Enter icon name" />
258
- </Form.Item>
259
- {/* Icon Name Ends */}
260
-
261
- {/* Step */}
262
- <Form.Item name={'step'} label="Step" required>
263
- <InputNumber placeholder="Enter step" />
264
- </Form.Item>
265
- {/* Step Ends */}
266
-
267
- <Form.Item>
268
- <Button loading={loading} htmlType={'submit'} type="primary">
269
- Submit
270
- </Button>
271
- </Form.Item>
272
- </div>
273
- <div className="right-container">
274
- {/* Description */}
275
- <Form.Item name={'attributes'} label="Attributes">
276
- <JSONInput />
277
- </Form.Item>
278
- {/* Description Ends */}
279
- </div>
280
- </div>
281
- </Form>
282
- )}
283
- </section>
284
- );
230
+ <Form.Item label="Pages" name={'page_id'}>
231
+
232
+ {/* <ReferenceSelect value={pages.id} label={pages.name} model={Pages} /> */}
233
+
234
+ <Select showSearch optionFilterProp="children" style={{ width: '100%' }}>
235
+ {pages.map((model, key) => (
236
+ <Option key={key} value={model.id}>{model.name}</Option>
237
+ ))}
238
+ </Select>
239
+
240
+ </Form.Item>
241
+ {/* Pages Ends */}
242
+
243
+
244
+
245
+ {/* Pages */}
246
+ <Form.Item label="Header" name={'header_id'}>
247
+
248
+ {/* <ReferenceSelect value={pages.id} label={pages.name} model={Pages} /> */}
249
+
250
+ <Select showSearch style={{ width: '100%' }}>
251
+ {menus.map((menu, key) => (
252
+ <Option key={key} value={menu.id}>{menu.name}</Option>
253
+ ))}
254
+ </Select>
255
+
256
+ </Form.Item>
257
+ {/* Pages Ends */}
258
+
259
+
260
+ {/* Path */}
261
+ <Form.Item name="path" label="Path" required>
262
+ <Input placeholder="Enter path" />
263
+ </Form.Item>
264
+ {/* Path Ends */}
265
+
266
+ {/* Route */}
267
+ <Form.Item name="route" label="Route" required>
268
+ <Input placeholder="Enter route" />
269
+ </Form.Item>
270
+ {/* Route Ends */}
271
+
272
+ {/* Switch */}
273
+ <Form.Item name="is_visible" label="Visible" required>
274
+ <Switch defaultChecked={body.is_visible} />
275
+ </Form.Item>
276
+ {/* Switch Ends */}
277
+
278
+ {/* Step */}
279
+ <Form.Item name={"order"} label="Order" required>
280
+ <InputNumber placeholder="Enter order" />
281
+ </Form.Item>
282
+ {/* Step Ends */}
283
+
284
+ {/* Icon Name*/}
285
+ <Form.Item name="icon_name" label="Icon Name" required>
286
+ <Input placeholder="Enter icon name" />
287
+ </Form.Item>
288
+ {/* Icon Name Ends */}
289
+
290
+ {/* Step */}
291
+ <Form.Item name={"step"} label="Step" required>
292
+ <InputNumber placeholder="Enter step" />
293
+ </Form.Item>
294
+ {/* Step Ends */}
295
+
296
+
297
+ <Form.Item>
298
+ <Button loading={loading} htmlType={'submit'} type="primary">
299
+ Submit
300
+ </Button>
301
+ </Form.Item>
302
+
303
+ </div>
304
+ <div className='right-container'>
305
+
306
+
307
+ {/* Description */}
308
+ <Form.Item name={"attributes"} label="Attributes">
309
+
310
+ <JSONInput />
311
+
312
+ </Form.Item>
313
+ {/* Description Ends */}
314
+
315
+ </div>
316
+
317
+ </div>
318
+
319
+ </Form>
320
+ )}
321
+ </section>
322
+ );
285
323
  };
286
324
 
287
325
  export default MenuAdd;