ui-soxo-bootstrap-core 2.4.25-dev.23 → 2.4.25-dev.24

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.
@@ -111,7 +111,7 @@ const MenuAdd = ({ model, callback, edit, history, formContent, match, additiona
111
111
 
112
112
  let id = formContent.id;
113
113
 
114
- //ONLY set step if it's NOT already provided
114
+ // ONLY set step if it's NOT already provided
115
115
  if (!values.step) {
116
116
  values.step = formContent.step || step;
117
117
  }
@@ -134,7 +134,17 @@ const MenuAdd = ({ model, callback, edit, history, formContent, match, additiona
134
134
  values[field] = value;
135
135
  });
136
136
 
137
- model.add({ values }).then(() => {
137
+ MenusAPI.createMenu({ formBody: values }).then((res) => {
138
+ const apiMessage = res?.result?.message;
139
+
140
+ // (duplicate)
141
+ if (apiMessage?.toLowerCase().includes('already exists')) {
142
+ message.warning(apiMessage);
143
+ setLoading(false);
144
+ return; // stop further execution
145
+ }
146
+
147
+ // Real success
138
148
  message.success('Menu Added');
139
149
  setLoading(false);
140
150
  callback();
@@ -219,9 +229,9 @@ const MenuAdd = ({ model, callback, edit, history, formContent, match, additiona
219
229
  {/* Pages Ends */}
220
230
 
221
231
  {/* Path */}
222
- {/* <Form.Item name="path" label="Path" required>
223
- <Input placeholder="Enter path" />
224
- </Form.Item> */}
232
+ <Form.Item name="path" label="Path" rules={[{ required: true, message: 'Path is required' }]}>
233
+ <Input placeholder="Enter path" />
234
+ </Form.Item>
225
235
  {/* Path Ends */}
226
236
 
227
237
  {/* Route */}
@@ -231,7 +241,7 @@ const MenuAdd = ({ model, callback, edit, history, formContent, match, additiona
231
241
  {/* Route Ends */}
232
242
 
233
243
  {/* Switch */}
234
- <Form.Item name="is_visible" label="Visible" valuePropName="checked" required>
244
+ <Form.Item name="is_visible" label="Visible" valuePropName="checked" required>
235
245
  <Switch />
236
246
  </Form.Item>
237
247
 
@@ -250,7 +260,7 @@ const MenuAdd = ({ model, callback, edit, history, formContent, match, additiona
250
260
  {/* Icon Name Ends */}
251
261
 
252
262
  {/* Step */}
253
- <Form.Item name={'step'} label="Step" rules={[{ required: true, message: 'Step is required' }]}>
263
+ <Form.Item name={'step'} label="Step" required>
254
264
  <InputNumber placeholder="Enter step" />
255
265
  </Form.Item>
256
266
  {/* Step Ends */}
@@ -474,7 +474,7 @@ function panelActions(item, model, setSelectedRecord, setDrawerTitle, setDrawerV
474
474
  </Button>
475
475
  )}
476
476
 
477
- <Button
477
+ {/* <Button
478
478
  size="small"
479
479
  type="default"
480
480
  onClick={() => {
@@ -484,7 +484,7 @@ function panelActions(item, model, setSelectedRecord, setDrawerTitle, setDrawerV
484
484
  }}
485
485
  >
486
486
  <CopyOutlined />
487
- </Button>
487
+ </Button> */}
488
488
 
489
489
  <Popconfirm title="Are you sure?" onConfirm={() => deleteRecord(item)}>
490
490
  <Button danger size="small" type="default">
@@ -160,6 +160,17 @@ class MenusAPI extends Base {
160
160
  });
161
161
  };
162
162
 
163
+ /**
164
+ * create menu
165
+ */
166
+
167
+ createMenu = ({ formBody }) => {
168
+ return ApiUtils.post({
169
+ url: `core-menus/create-menu`,
170
+ formBody,
171
+ });
172
+ };
173
+
163
174
  /**
164
175
  * load the list of menu
165
176
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui-soxo-bootstrap-core",
3
- "version": "2.4.25-dev.23",
3
+ "version": "2.4.25-dev.24",
4
4
  "description": "All the Core Components for you to start",
5
5
  "keywords": [
6
6
  "all in one"