ui-soxo-bootstrap-core 2.4.25-dev.40 → 2.4.25-dev.41

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.
@@ -465,6 +465,7 @@ function UserInput({ field, onUpload, selectedInformation, onChange, onFieldUpda
465
465
  {...field}
466
466
  onChange={(value) => onChange(field, value)}
467
467
  defaultValue={field.default}
468
+ allowClear={true}
468
469
  // defaultValue={'1'}
469
470
  />
470
471
  );
@@ -423,13 +423,15 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
423
423
 
424
424
  // add new model
425
425
  UsersAPI.create(values).then((result) => {
426
- // callback();
427
- if (result.success) message.success(result.message);
428
- else message.error(result.message);
429
-
430
426
  setLoading(false);
431
427
 
432
- callback();
428
+ if (result.success) {
429
+ message.success(result.message);
430
+ // close modal
431
+ callback();
432
+ } else {
433
+ message.error(result.message);
434
+ }
433
435
  });
434
436
  }
435
437
  };
@@ -605,8 +607,26 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
605
607
 
606
608
  <Col span={8}>
607
609
  {/* Mobile */}
608
- <Form.Item name="mobile" label="Mobile" rules={[{ required: true, message: 'Please enter your mobile number' }]}>
609
- <Input placeholder="Enter Mobile" maxLength={10} />
610
+ <Form.Item
611
+ name="mobile"
612
+ label="Mobile"
613
+ rules={[
614
+ { required: true, message: 'Please enter your mobile number' },
615
+ {
616
+ pattern: /^[0-9]{10}$/,
617
+ message: 'Mobile number must be exactly 10 digits',
618
+ },
619
+ ]}
620
+ >
621
+ <Input
622
+ placeholder="Enter Mobile"
623
+ maxLength={10}
624
+ onKeyPress={(e) => {
625
+ if (!/[0-9]/.test(e.key)) {
626
+ e.preventDefault();
627
+ }
628
+ }}
629
+ />
610
630
  </Form.Item>
611
631
  </Col>
612
632
  <Col span={8}>
@@ -651,7 +671,7 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
651
671
  <Form.Item label="Default Branch" name="defaultBranch" rules={[{ required: true, message: 'Please select default branch' }]}>
652
672
  <Select placeholder="Select Default Branch" onChange={setDefaultBranch}>
653
673
  {branchOptions
654
- .filter((opt) => selectedBranches.includes(Number(opt.value)))
674
+ .filter((opt) => selectedBranches.includes(Number(opt.value)))
655
675
  .map((opt) => (
656
676
  <Option key={opt.value} value={Number(opt.value)}>
657
677
  {opt.label}
@@ -365,7 +365,7 @@ const UserList = ({ model, match, relativeAdd = false, additional_queries = [],
365
365
  )}
366
366
 
367
367
  {/* Add Modal */}
368
- <Modal destroyOnClose confirmLoading={loading} visible={visible} onCancel={closeModal} footer={null}>
368
+ <Modal destroyOnClose={false} confirmLoading={loading} visible={visible} onCancel={closeModal} footer={null}>
369
369
  <model.ModalAddComponent
370
370
  match={match}
371
371
  model={model}
@@ -261,7 +261,7 @@ export default function ReportingDashboard({
261
261
  getPatientDetails();
262
262
  }
263
263
 
264
- const fetchReportData = async (id, values, dbPtr, pagination) => {
264
+ const fetchReportData = async (id, values, dbPtr, pagination, paramsString) => {
265
265
  const { current, pageSize } = pagination || {};
266
266
  // If card script id is exist load that id otherwise load id
267
267
  const coreScriptId = scriptId.current ? scriptId.current : id;
@@ -270,22 +270,23 @@ export default function ReportingDashboard({
270
270
  try {
271
271
  // Prepare payload for backend: format only here
272
272
  const formattedValues = {};
273
- const inputParams = JSON.parse(config.input_parameters);
274
- // Extract only allowed field names from input parameters
275
-
276
- const allowedFields = inputParams.map((p) => p.field);
273
+ let inputParams = [];
274
+ inputParams = JSON.parse(paramsString);
277
275
  // Iterate through all keys in the values object
278
276
 
279
- Object.keys(values).forEach((key) => {
280
- // Skip keys that are not in the allowed fields list
277
+ inputParams.forEach(({ field }) => {
278
+ const val = values[field];
281
279
 
282
- if (!allowedFields.includes(key)) {
283
- return;
280
+ // field exists in values → format & assign
281
+ if (val !== undefined) {
282
+ formattedValues[field] = moment.isMoment(val) ? val.format('YYYY-MM-DD') : val;
283
+ }
284
+ // field missing in values → set null
285
+ else {
286
+ formattedValues[field] = null;
284
287
  }
285
-
286
- const val = values[key];
287
- formattedValues[key] = moment.isMoment(val) ? val.format('YYYY-MM-DD') : val;
288
288
  });
289
+ // });
289
290
  // Pagination Data
290
291
  const paginationData = {
291
292
  page: pagination.current || 1,
@@ -436,7 +437,7 @@ export default function ReportingDashboard({
436
437
 
437
438
  // Call API
438
439
  try {
439
- await fetchReportData(id, values, dbPtr, paginationData);
440
+ await fetchReportData(id, values, dbPtr, paginationData, paramsString);
440
441
  } finally {
441
442
  setLoading(false);
442
443
  setCardLoading(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui-soxo-bootstrap-core",
3
- "version": "2.4.25-dev.40",
3
+ "version": "2.4.25-dev.41",
4
4
  "description": "All the Core Components for you to start",
5
5
  "keywords": [
6
6
  "all in one"