@visns-studio/visns-components 3.5.10 → 3.5.11
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/Field.jsx
CHANGED
|
@@ -506,6 +506,25 @@ function Field({
|
|
|
506
506
|
</div>
|
|
507
507
|
);
|
|
508
508
|
case 'dynamicdata':
|
|
509
|
+
return (
|
|
510
|
+
<div
|
|
511
|
+
className="fi__div"
|
|
512
|
+
style={
|
|
513
|
+
settings.height
|
|
514
|
+
? {
|
|
515
|
+
height: settings.height,
|
|
516
|
+
paddingTop: '10px',
|
|
517
|
+
marginLeft: '13px',
|
|
518
|
+
}
|
|
519
|
+
: {
|
|
520
|
+
paddingTop: '10px',
|
|
521
|
+
marginLeft: '13px',
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
>
|
|
525
|
+
{inputValue && inputValue !== 'null' ? inputValue : ''}
|
|
526
|
+
</div>
|
|
527
|
+
);
|
|
509
528
|
case 'plaintext':
|
|
510
529
|
return (
|
|
511
530
|
<div
|
|
@@ -25,10 +25,32 @@ const updateField = (fields, name, value) => {
|
|
|
25
25
|
}, {});
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const renderValue = (field) => {
|
|
28
|
+
const renderValue = (field, data) => {
|
|
29
29
|
switch (field.type) {
|
|
30
30
|
case 'datetime':
|
|
31
31
|
case 'date':
|
|
32
|
+
case 'dynamicdata':
|
|
33
|
+
if (field.dynamicfield && typeof field.dynamicfield === 'string') {
|
|
34
|
+
// Split the dynamicfield string into table and key parts using the "::" delimiter
|
|
35
|
+
const [table, key] = field.dynamicfield.split('::');
|
|
36
|
+
|
|
37
|
+
if (table && key) {
|
|
38
|
+
switch (table) {
|
|
39
|
+
case 'opportunities':
|
|
40
|
+
return data[table][key];
|
|
41
|
+
default:
|
|
42
|
+
return data[key];
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
console.warn(
|
|
46
|
+
`Dynamic field not found or invalid: ${field.dynamicfield}`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
console.warn('Dynamic field is missing or not a string');
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
|
|
32
54
|
case 'time':
|
|
33
55
|
return field.value && moment(field.value).isValid()
|
|
34
56
|
? moment(field.value).toDate()
|
|
@@ -373,7 +395,7 @@ const GenericDynamic = ({ data, fetchData, label, setData, setting, type }) => {
|
|
|
373
395
|
}
|
|
374
396
|
} else {
|
|
375
397
|
setActiveForm([]);
|
|
376
|
-
handleAddNewForm();
|
|
398
|
+
// handleAddNewForm();
|
|
377
399
|
}
|
|
378
400
|
}, [data, type]);
|
|
379
401
|
|
|
@@ -531,7 +553,8 @@ const GenericDynamic = ({ data, fetchData, label, setData, setting, type }) => {
|
|
|
531
553
|
formData={activeForm}
|
|
532
554
|
inputClass={''}
|
|
533
555
|
inputValue={renderValue(
|
|
534
|
-
field
|
|
556
|
+
field,
|
|
557
|
+
data
|
|
535
558
|
)}
|
|
536
559
|
onChange={handleChange}
|
|
537
560
|
onChangeCheckbox={
|
package/package.json
CHANGED