@visns-studio/visns-components 3.4.1 → 3.4.2
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/components/crm/Form.jsx +25 -1
- package/package.json +1 -1
package/components/crm/Form.jsx
CHANGED
|
@@ -621,7 +621,31 @@ function Form({
|
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
623
|
|
|
624
|
-
const
|
|
624
|
+
const fieldMap = formSettings.fields.reduce((acc, field) => {
|
|
625
|
+
acc[field.id] = field;
|
|
626
|
+
return acc;
|
|
627
|
+
}, {});
|
|
628
|
+
|
|
629
|
+
let payload = { ...formData };
|
|
630
|
+
|
|
631
|
+
Object.keys(formData).forEach((key) => {
|
|
632
|
+
const value = formData[key];
|
|
633
|
+
const field = fieldMap[key];
|
|
634
|
+
|
|
635
|
+
// Check if the field exists and is of type 'multi-dropdown-ajax'
|
|
636
|
+
if (field && field.type === 'multi-dropdown-ajax') {
|
|
637
|
+
// Check if 'value' and 'label' exist
|
|
638
|
+
if (value && 'value' in value && 'label' in value) {
|
|
639
|
+
console.info(
|
|
640
|
+
`Updating payload for key ${key}:`,
|
|
641
|
+
value
|
|
642
|
+
);
|
|
643
|
+
payload[key] = value.value;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
const res = await CustomFetch(url, method, payload);
|
|
625
649
|
|
|
626
650
|
if (res.data.error === '') {
|
|
627
651
|
if (fetchTable) {
|
package/package.json
CHANGED