ui-soxo-bootstrap-core 2.4.25-dev.23 → 2.4.25-dev.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.
@@ -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
  *
@@ -106,8 +106,17 @@ export default function ReportingDashboard({
106
106
  setPatients([]);
107
107
  const fetchId = idOverride || id;
108
108
  await CoreScripts.getRecord({ id: fetchId, dbPtr }).then(async ({ result }) => {
109
+ // Check if display columns are provided from backend
110
+ if (result.display_columns) {
111
+ // Parse and set columns from stored JSON
112
+
113
+ setColumns(JSON.parse(result.display_columns));
114
+ } else {
115
+ // Reset columns if no display columns exist
116
+
117
+ setColumns([]);
118
+ }
109
119
  await prepareInputParameters(result);
110
- setColumns(JSON.parse(result.display_columns));
111
120
 
112
121
  if (result.summary_columns) {
113
122
  setSummaryColumns(JSON.parse(result.summary_columns));
@@ -160,11 +169,12 @@ export default function ReportingDashboard({
160
169
  if (urlParams.script_id) scriptId.current = urlParams.script_id;
161
170
 
162
171
  let otherDetails = record.other_details1 ? JSON.parse(record.other_details1) : null;
163
- parameters = JSON.parse(record.input_parameters);
172
+
173
+ parameters = record.input_parameters ? JSON.parse(record.input_parameters) : null;
164
174
 
165
175
  let formContent = {};
166
176
 
167
- parameters = await parameters.map((record) => {
177
+ parameters = await parameters?.map((record) => {
168
178
  // Only if the url params does have a matching value ,
169
179
  // we should not consider the default value
170
180
 
@@ -210,7 +220,7 @@ export default function ReportingDashboard({
210
220
  if (['reference-select', 'reference-search', 'select'].indexOf(record.type) !== -1) {
211
221
  // let model = "";
212
222
  let model = CustomModels[record.modelName];
213
-
223
+
214
224
  return {
215
225
  ...record,
216
226
  model,
@@ -289,6 +299,17 @@ export default function ReportingDashboard({
289
299
  }
290
300
  // Update patients
291
301
  setPatients(resultDetails || []);
302
+ // Check if columns are not yet defined
303
+ if (columns.length === 0 && resultDetails.length > 0) {
304
+ // Create columns dynamically from resultDetails keys
305
+ setColumns((prev) => {
306
+ if (prev.length > 0) return prev;
307
+ return Object.keys(resultDetails[0]).map((key) => ({
308
+ title: key,
309
+ field: key,
310
+ }));
311
+ });
312
+ }
292
313
 
293
314
  if (result.length) {
294
315
  // Set Pgination data into URL
@@ -739,7 +760,7 @@ function GuestList({
739
760
 
740
761
  // If the column type is 'span', render the field inside a <span> with inline color style
741
762
  } else if (entry.columnType === 'span') {
742
- return <span style={{ color: record.color_code }}>{record[entry.field]}</span>;
763
+ return <span style={{ color: record.color_code, overflowWrap: 'break-word', WebkitLineClamp: 3 }}>{record[entry.field]}</span>;
743
764
  }
744
765
  } else {
745
766
  /**
@@ -771,7 +792,7 @@ function GuestList({
771
792
  }
772
793
  } else {
773
794
  //If the value is neither 'Y' nor 'N', return the actual field value
774
- return <span style={{ color: textColor }}>{record[entry.field]}</span>;
795
+ return <span style={{ color: textColor, whiteSpace: 'pre-wrap', overflowWrap: 'break-word' }}>{record[entry.field]}</span>;
775
796
  }
776
797
  }
777
798
  }
@@ -1168,3 +1189,5 @@ function GuestList({
1168
1189
  // </Card>
1169
1190
  // );
1170
1191
  // }
1192
+ // );
1193
+ // }
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.25",
4
4
  "description": "All the Core Components for you to start",
5
5
  "keywords": [
6
6
  "all in one"