feat: implement AddPolicyEngine component with dynamic rule and action configuration logic

This commit is contained in:
azeeee05
2026-08-20 16:12:50 +05:30
parent 4e8084da21
commit 5a1ad8e7ba
@@ -598,13 +598,13 @@ export default function AddPolicyEngine() {
valObj.booleanValue = !!val;
} else if (fieldType === 'number' || fieldType === 'decimal' || fieldType === 'percentage') {
valObj.numberValue = parseFloat(val) || 0;
} else if (Array.isArray(val)) {
valObj.textValue = JSON.stringify(val);
} else if (fieldType === 'dropdown' || fieldType === 'select' || fieldDef?.lookupSource) {
valObj.selectedValueId = String(val ?? '');
const lookupOpts = fieldLookupOptionsMap[fieldDef?.lookupSource || ''] || [];
const matchedOpt = lookupOpts.find((o) => o.value === val || o.id === val || o.code === val);
valObj.textValue = matchedOpt ? matchedOpt.label : String(val ?? '');
} else if (Array.isArray(val)) {
valObj.textValue = JSON.stringify(val);
} else {
valObj.textValue = String(val ?? '');
}