datastake-daf 0.6.820 → 0.6.822
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/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +25 -0
- package/build/robots.txt +3 -0
- package/dist/components/index.js +671 -561
- package/dist/pages/index.js +58 -23
- package/dist/utils/index.js +67 -134
- package/package.json +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/columns.js +6 -5
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +161 -73
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/columns.js +3 -2
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +26 -33
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/column.js +3 -2
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +2 -6
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/columns.js +1 -2
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +2 -6
- package/src/@daf/core/components/Screens/Admin/AdminTables/hook.js +0 -1
- package/src/@daf/core/components/Screens/Admin/adminRoutes.js +3 -1
- package/src/@daf/core/components/ViewForm/content.jsx +2 -0
- package/src/@daf/pages/Events/config.js +2 -11
- package/src/@daf/pages/Stakeholders/ArmedGroups/config.js +34 -5
- package/src/@daf/pages/View/index.jsx +1 -1
- package/src/constants/locales/en/translation.js +26 -10
- package/src/constants/locales/fr/translation.js +23 -75
- package/src/constants/locales/sp/translation.js +20 -61
- package/src/helpers/adminLevels.js +4 -0
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/helper.js +0 -79
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/helper.js +0 -21
package/dist/components/index.js
CHANGED
|
@@ -25049,6 +25049,13 @@ const Content$1 = _ref => {
|
|
|
25049
25049
|
}
|
|
25050
25050
|
return all;
|
|
25051
25051
|
}, {});
|
|
25052
|
+
console.log({
|
|
25053
|
+
groups,
|
|
25054
|
+
singleGroupsKeys,
|
|
25055
|
+
addedContent,
|
|
25056
|
+
_length,
|
|
25057
|
+
groupped
|
|
25058
|
+
});
|
|
25052
25059
|
return Object.keys(groupped).map(key => {
|
|
25053
25060
|
const groups = groupped[key];
|
|
25054
25061
|
return /*#__PURE__*/jsxRuntime.jsx(React__default["default"].Fragment, {
|
|
@@ -30787,6 +30794,7 @@ function Repeatable({
|
|
|
30787
30794
|
});
|
|
30788
30795
|
}
|
|
30789
30796
|
|
|
30797
|
+
/* eslint-disable no-eval */
|
|
30790
30798
|
const isRiskComment = inputData => {
|
|
30791
30799
|
if (inputData) {
|
|
30792
30800
|
if (inputData.name === 'assessment') {
|
|
@@ -30799,10 +30807,7 @@ const isRiskComment = inputData => {
|
|
|
30799
30807
|
};
|
|
30800
30808
|
|
|
30801
30809
|
// options, k, setValues, values, excludedKeys, i, formTitles, getData, MainForm, plainForms, setAddress, onValuesChange, data, allData, changeLinking, changeInputMeta, t, highlightMandatory
|
|
30802
|
-
function renderNestedInputs$1(options, k) {
|
|
30803
|
-
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
30804
|
-
args[_key - 2] = arguments[_key];
|
|
30805
|
-
}
|
|
30810
|
+
function renderNestedInputs$1(options, k, ...args) {
|
|
30806
30811
|
if (options[k].repeatable) {
|
|
30807
30812
|
return renderRepeatable$1(options, k, ...args);
|
|
30808
30813
|
} else {
|
|
@@ -30830,11 +30835,10 @@ function renderRepeatable$1(options, k, setValues, values, excludedKeys, i, form
|
|
|
30830
30835
|
children: [getFormTitles$1(formTitles, formId, i), ['h2', 'h3', 'h4', 'h5', 'h6'].includes(form.type) ? getInputHeadLines$1(form.type, i, form, values) : /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
30831
30836
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Form.List, {
|
|
30832
30837
|
name: formId,
|
|
30833
|
-
children: (fields,
|
|
30834
|
-
|
|
30835
|
-
|
|
30836
|
-
|
|
30837
|
-
} = _ref;
|
|
30838
|
+
children: (fields, {
|
|
30839
|
+
add,
|
|
30840
|
+
remove
|
|
30841
|
+
}) => {
|
|
30838
30842
|
const formData = form.repeatable ? values[formId] || [] : values[formId] ? [values[formId]] : [];
|
|
30839
30843
|
if (fields.length === 0) {
|
|
30840
30844
|
const formInputs = form.inputs;
|
|
@@ -30884,10 +30888,14 @@ function renderRepeatable$1(options, k, setValues, values, excludedKeys, i, form
|
|
|
30884
30888
|
const _val = {
|
|
30885
30889
|
[formId]: formData.map((d, j) => i === j ? val : d)
|
|
30886
30890
|
};
|
|
30887
|
-
onValuesChange(_val,
|
|
30888
|
-
|
|
30891
|
+
onValuesChange(_val, {
|
|
30892
|
+
...values,
|
|
30893
|
+
..._val
|
|
30894
|
+
});
|
|
30895
|
+
setValues({
|
|
30896
|
+
...values,
|
|
30889
30897
|
[formId]: formData.map((d, j) => i === j ? val : d)
|
|
30890
|
-
})
|
|
30898
|
+
});
|
|
30891
30899
|
};
|
|
30892
30900
|
return /*#__PURE__*/jsxRuntime.jsx(Repeatable, {
|
|
30893
30901
|
form: form,
|
|
@@ -30943,156 +30951,154 @@ const getGroupContent = (form, values, i, formId, excludedKeys, getData, setValu
|
|
|
30943
30951
|
highlightMandatory
|
|
30944
30952
|
});
|
|
30945
30953
|
};
|
|
30946
|
-
const GroupContent =
|
|
30947
|
-
|
|
30948
|
-
|
|
30949
|
-
|
|
30950
|
-
|
|
30951
|
-
|
|
30952
|
-
|
|
30953
|
-
|
|
30954
|
-
|
|
30955
|
-
|
|
30956
|
-
|
|
30957
|
-
|
|
30958
|
-
|
|
30959
|
-
|
|
30960
|
-
|
|
30961
|
-
|
|
30962
|
-
|
|
30963
|
-
highlightMandatory
|
|
30964
|
-
} = _ref2;
|
|
30954
|
+
const GroupContent = ({
|
|
30955
|
+
form,
|
|
30956
|
+
values = {},
|
|
30957
|
+
i,
|
|
30958
|
+
formId,
|
|
30959
|
+
excludedKeys,
|
|
30960
|
+
getData,
|
|
30961
|
+
setValues,
|
|
30962
|
+
MainForm,
|
|
30963
|
+
options,
|
|
30964
|
+
plainForms,
|
|
30965
|
+
setAddress,
|
|
30966
|
+
onValuesChange,
|
|
30967
|
+
allData,
|
|
30968
|
+
changeInputMeta,
|
|
30969
|
+
highlightMandatory
|
|
30970
|
+
}) => {
|
|
30965
30971
|
const {
|
|
30966
30972
|
user,
|
|
30967
30973
|
t
|
|
30968
30974
|
} = useEditContext();
|
|
30969
30975
|
const label = getInputLabel$1(form, values);
|
|
30970
|
-
const notPartOfTheForm =
|
|
30976
|
+
const notPartOfTheForm = form?.type === 'ajaxSubGroup' ? true : !!form?.meta?.isSubGroup;
|
|
30971
30977
|
const hasLabel = label && (typeof label === 'string' && (label || '').trim() !== '' || typeof label === 'object') ? true : false;
|
|
30972
30978
|
const formValues = values[form.dataId];
|
|
30973
|
-
const renderInputs = () => {
|
|
30974
|
-
|
|
30975
|
-
|
|
30976
|
-
|
|
30977
|
-
|
|
30978
|
-
|
|
30979
|
-
|
|
30980
|
-
|
|
30981
|
-
|
|
30982
|
-
|
|
30983
|
-
|
|
30984
|
-
|
|
30985
|
-
|
|
30986
|
-
|
|
30987
|
-
|
|
30988
|
-
|
|
30989
|
-
|
|
30990
|
-
|
|
30991
|
-
|
|
30992
|
-
inputData.
|
|
30993
|
-
|
|
30994
|
-
|
|
30995
|
-
|
|
30996
|
-
|
|
30997
|
-
|
|
30998
|
-
|
|
30999
|
-
|
|
30979
|
+
const renderInputs = () => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
30980
|
+
children: [form?.meta?.groupInfo ? /*#__PURE__*/jsxRuntime.jsx(GroupInfos, {
|
|
30981
|
+
config: form.meta.groupInfo,
|
|
30982
|
+
user: user,
|
|
30983
|
+
t: t
|
|
30984
|
+
}) : null, Object.keys(form.inputs || {}).filter(i => !excludedKeys.includes(i)).map((inp, ii) => {
|
|
30985
|
+
const isAjaxSubGroup = form?.type === "ajaxSubGroup";
|
|
30986
|
+
const input = form.inputs[inp];
|
|
30987
|
+
const inputId = input.dataId || inp;
|
|
30988
|
+
const inputValues = notPartOfTheForm ? Array.isArray(values[formId]) ? values[formId] || {} : values[formId] || {} : values;
|
|
30989
|
+
const value = inputValues[inputId];
|
|
30990
|
+
const commentValue = inputValues[`${inputId}Comment`];
|
|
30991
|
+
const inputData = getData(formId, input, value, commentValue, `${formId}.${inputId}`, `${formId}.${inputId}`);
|
|
30992
|
+
const subtitles = form.subtitles || null;
|
|
30993
|
+
const inputMeta = notPartOfTheForm ? isAjaxSubGroup ? (values[formId] || {})?.meta?.inputs?.[inputId] || {} : ((values?.meta?.inputs || {})[formId] || {})[inputId] || {} : (values?.meta?.inputs || {})[inputId] || {};
|
|
30994
|
+
inputData.repeatIndex = undefined;
|
|
30995
|
+
inputData.inputName = inputId;
|
|
30996
|
+
inputData.repeatValues = inputValues;
|
|
30997
|
+
if (inputData.groupInputs && Array.isArray(inputData.groupInputs)) {
|
|
30998
|
+
inputData.groupInputs = inputData.groupInputs.map(gpI => {
|
|
30999
|
+
gpI.data.inputName = gpI.data.name;
|
|
31000
|
+
gpI.data.repeatIndex = undefined;
|
|
31001
|
+
gpI.data.name = formId;
|
|
31002
|
+
return gpI;
|
|
31003
|
+
});
|
|
31004
|
+
}
|
|
31005
|
+
const isRisk = isRiskComment(inputData);
|
|
31006
|
+
const isHighlighted = highlightMandatory && input?.meta?.mandatory && inputIsEmpty(input, inputValues, inputMeta);
|
|
31007
|
+
const btnOnClick = () => {
|
|
31008
|
+
if (typeof inputData.commentValue === 'string') {
|
|
31009
|
+
onValuesChange({}, {
|
|
31010
|
+
...values,
|
|
31011
|
+
[`${inputData.inputName}`]: null
|
|
31000
31012
|
});
|
|
31001
31013
|
}
|
|
31002
|
-
const
|
|
31003
|
-
|
|
31004
|
-
|
|
31005
|
-
|
|
31006
|
-
|
|
31007
|
-
|
|
31008
|
-
|
|
31009
|
-
|
|
31014
|
+
const inputValues = Array.isArray(values[formId]) ? values[formId] || {} : values[formId] || {};
|
|
31015
|
+
inputValues[`${inputData.inputName}Comment`] = typeof inputData.commentValue !== 'string' ? '' : null;
|
|
31016
|
+
if (Array.isArray(values[formId])) {
|
|
31017
|
+
values[formId] = inputValues;
|
|
31018
|
+
} else {
|
|
31019
|
+
values[formId] = inputValues;
|
|
31020
|
+
}
|
|
31021
|
+
setValues({
|
|
31022
|
+
...values
|
|
31023
|
+
});
|
|
31024
|
+
};
|
|
31025
|
+
const btnOnClick2 = () => {
|
|
31026
|
+
if (typeof inputData.commentValue !== 'string') {
|
|
31010
31027
|
const inputValues = Array.isArray(values[formId]) ? values[formId] || {} : values[formId] || {};
|
|
31011
|
-
inputValues[
|
|
31028
|
+
inputValues[`${inputData.inputName}Comment`] = typeof inputData.commentValue !== 'string' ? '' : null;
|
|
31012
31029
|
if (Array.isArray(values[formId])) {
|
|
31013
31030
|
values[formId] = inputValues;
|
|
31014
31031
|
} else {
|
|
31015
31032
|
values[formId] = inputValues;
|
|
31016
31033
|
}
|
|
31017
|
-
setValues(
|
|
31018
|
-
|
|
31019
|
-
const btnOnClick2 = () => {
|
|
31020
|
-
if (typeof inputData.commentValue !== 'string') {
|
|
31021
|
-
const inputValues = Array.isArray(values[formId]) ? values[formId] || {} : values[formId] || {};
|
|
31022
|
-
inputValues["".concat(inputData.inputName, "Comment")] = typeof inputData.commentValue !== 'string' ? '' : null;
|
|
31023
|
-
if (Array.isArray(values[formId])) {
|
|
31024
|
-
values[formId] = inputValues;
|
|
31025
|
-
} else {
|
|
31026
|
-
values[formId] = inputValues;
|
|
31027
|
-
}
|
|
31028
|
-
setValues(_objectSpread2({}, values));
|
|
31029
|
-
}
|
|
31030
|
-
};
|
|
31031
|
-
const rules = inputData !== null && inputData !== void 0 && (_inputData$rules = inputData.rules) !== null && _inputData$rules !== void 0 && _inputData$rules.length ? inputData.rules.filter(rule => !Object.keys(rule || {}).includes('accept') && !Object.keys(rule || {}).includes('max')) : ((input === null || input === void 0 || (_input$meta2 = input.meta) === null || _input$meta2 === void 0 ? void 0 : _input$meta2.rules) || []).filter(rule => {
|
|
31032
|
-
if (rule.metaIf && typeof rule.metaIf === 'string') {
|
|
31033
|
-
var _values$meta3, _values$meta4;
|
|
31034
|
-
const [name, cond, value] = rule.metaIf.split(' ');
|
|
31035
|
-
const val = name.includes('./') ? values === null || values === void 0 || (_values$meta3 = values.meta) === null || _values$meta3 === void 0 || (_values$meta3 = _values$meta3.inputs) === null || _values$meta3 === void 0 || (_values$meta3 = _values$meta3[formId]) === null || _values$meta3 === void 0 ? void 0 : _values$meta3[name.split('./')[1]] : values === null || values === void 0 || (_values$meta4 = values.meta) === null || _values$meta4 === void 0 || (_values$meta4 = _values$meta4.inputs) === null || _values$meta4 === void 0 ? void 0 : _values$meta4[name.split('./')[1]];
|
|
31036
|
-
if (cond === 'is') {
|
|
31037
|
-
return !!(val !== null && val !== void 0 && val[value]);
|
|
31038
|
-
}
|
|
31039
|
-
}
|
|
31040
|
-
return !Object.keys(rule || {}).includes('accept') && !Object.keys(rule || {}).includes('max');
|
|
31041
|
-
});
|
|
31042
|
-
const requiredRule = rules.find(r => r.required);
|
|
31043
|
-
if (requiredRule && input.type === 'text') {
|
|
31044
|
-
rules.push({
|
|
31045
|
-
whitespace: true,
|
|
31046
|
-
message: requiredRule.message || ''
|
|
31034
|
+
setValues({
|
|
31035
|
+
...values
|
|
31047
31036
|
});
|
|
31048
31037
|
}
|
|
31049
|
-
|
|
31050
|
-
|
|
31051
|
-
|
|
31052
|
-
|
|
31053
|
-
|
|
31054
|
-
|
|
31055
|
-
|
|
31056
|
-
|
|
31057
|
-
|
|
31058
|
-
|
|
31059
|
-
|
|
31060
|
-
|
|
31061
|
-
|
|
31062
|
-
|
|
31063
|
-
|
|
31064
|
-
|
|
31065
|
-
|
|
31066
|
-
|
|
31067
|
-
|
|
31068
|
-
|
|
31069
|
-
|
|
31070
|
-
|
|
31071
|
-
|
|
31072
|
-
|
|
31073
|
-
|
|
31074
|
-
|
|
31075
|
-
|
|
31076
|
-
|
|
31077
|
-
|
|
31078
|
-
|
|
31079
|
-
|
|
31080
|
-
|
|
31081
|
-
|
|
31082
|
-
|
|
31083
|
-
|
|
31084
|
-
|
|
31085
|
-
|
|
31086
|
-
|
|
31087
|
-
|
|
31088
|
-
|
|
31089
|
-
})
|
|
31090
|
-
},
|
|
31091
|
-
|
|
31092
|
-
|
|
31093
|
-
|
|
31094
|
-
|
|
31095
|
-
|
|
31038
|
+
};
|
|
31039
|
+
const rules = inputData?.rules?.length ? inputData.rules.filter(rule => !Object.keys(rule || {}).includes('accept') && !Object.keys(rule || {}).includes('max')) : (input?.meta?.rules || []).filter(rule => {
|
|
31040
|
+
if (rule.metaIf && typeof rule.metaIf === 'string') {
|
|
31041
|
+
const [name, cond, value] = rule.metaIf.split(' ');
|
|
31042
|
+
const val = name.includes('./') ? values?.meta?.inputs?.[formId]?.[name.split('./')[1]] : values?.meta?.inputs?.[name.split('./')[1]];
|
|
31043
|
+
if (cond === 'is') {
|
|
31044
|
+
return !!val?.[value];
|
|
31045
|
+
}
|
|
31046
|
+
}
|
|
31047
|
+
return !Object.keys(rule || {}).includes('accept') && !Object.keys(rule || {}).includes('max');
|
|
31048
|
+
});
|
|
31049
|
+
const requiredRule = rules.find(r => r.required);
|
|
31050
|
+
if (requiredRule && input.type === 'text') {
|
|
31051
|
+
rules.push({
|
|
31052
|
+
whitespace: true,
|
|
31053
|
+
message: requiredRule.message || ''
|
|
31054
|
+
});
|
|
31055
|
+
}
|
|
31056
|
+
return showHideInput$1(input, values, undefined, inputValues, setValues) ? /*#__PURE__*/jsxRuntime.jsx(React__default["default"].Fragment, {
|
|
31057
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
31058
|
+
style: {
|
|
31059
|
+
position: 'relative'
|
|
31060
|
+
},
|
|
31061
|
+
children: [getSubtitles$1(subtitles, input.position, values, undefined, inputValues), ['h2', 'h3', 'h4', 'h5', 'h6'].includes(input.type) ? getInputHeadLines$1(input.type, i, input, values) : isRisk ? /*#__PURE__*/jsxRuntime.jsx(RiskGroup, {
|
|
31062
|
+
input: input,
|
|
31063
|
+
inputTypeComponent: inputTypeComponent$1,
|
|
31064
|
+
inputData: inputData,
|
|
31065
|
+
MainForm: MainForm,
|
|
31066
|
+
options: options,
|
|
31067
|
+
setValues: setValues,
|
|
31068
|
+
formId: formId,
|
|
31069
|
+
inputId: inputId,
|
|
31070
|
+
inputOnBlur: inputOnBlur,
|
|
31071
|
+
values: values,
|
|
31072
|
+
getInputLabel: getInputLabel$1,
|
|
31073
|
+
plainForms: plainForms,
|
|
31074
|
+
setAddress: setAddress,
|
|
31075
|
+
btnOnClick: btnOnClick,
|
|
31076
|
+
btnOnClick2: btnOnClick2,
|
|
31077
|
+
locationName: (allData || {}).locationName,
|
|
31078
|
+
subGroupTitle: (allData || {}).subGroupTitle
|
|
31079
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(GroupContentFormItem, {
|
|
31080
|
+
values,
|
|
31081
|
+
formId,
|
|
31082
|
+
setValues,
|
|
31083
|
+
MainForm,
|
|
31084
|
+
options,
|
|
31085
|
+
plainForms,
|
|
31086
|
+
setAddress,
|
|
31087
|
+
inputData,
|
|
31088
|
+
inputId,
|
|
31089
|
+
input,
|
|
31090
|
+
rules,
|
|
31091
|
+
inputMeta,
|
|
31092
|
+
changeInputMeta,
|
|
31093
|
+
notPartOfTheForm,
|
|
31094
|
+
isAjaxSubGroup,
|
|
31095
|
+
isHighlighted
|
|
31096
|
+
})]
|
|
31097
|
+
}, ii)
|
|
31098
|
+
}, `${i}${ii}`) : null;
|
|
31099
|
+
})]
|
|
31100
|
+
});
|
|
31101
|
+
const isNa = formValues?.valuation === 'na';
|
|
31096
31102
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
31097
31103
|
children: [hasLabel ? options.isRisk && options.dontShowTitle ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31098
31104
|
className: "risk-header",
|
|
@@ -31100,46 +31106,44 @@ const GroupContent = _ref2 => {
|
|
|
31100
31106
|
children: label
|
|
31101
31107
|
})
|
|
31102
31108
|
}) : /*#__PURE__*/jsxRuntime.jsx("h3", {
|
|
31103
|
-
className:
|
|
31109
|
+
className: `${form.titleClass ? form.titleClass : 'title-semibold-4'} ${i ? 'mt-3 mb-1' : ''}`,
|
|
31104
31110
|
children: label
|
|
31105
31111
|
}) : null, /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
31106
|
-
className:
|
|
31112
|
+
className: `repeatable ${hasLabel ? "mb-4" : ""}`,
|
|
31107
31113
|
children: [form.titleLabel ? /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
31108
31114
|
children: getInputProp(form.titleLabel, values)
|
|
31109
|
-
}) : null, formValues
|
|
31115
|
+
}) : null, formValues?.noPlanningRequired ? /*#__PURE__*/jsxRuntime.jsx(GroupInfoHOC, {
|
|
31110
31116
|
t: t,
|
|
31111
31117
|
isNa: isNa,
|
|
31112
31118
|
isSuccess: !isNa
|
|
31113
31119
|
// TODO: translate
|
|
31114
31120
|
,
|
|
31115
31121
|
config: {
|
|
31116
|
-
title: t(
|
|
31122
|
+
title: t(`No ${formValues?.stage || 'planning'} required`)
|
|
31117
31123
|
},
|
|
31118
31124
|
children: renderInputs()
|
|
31119
31125
|
}) : renderInputs()]
|
|
31120
31126
|
})]
|
|
31121
31127
|
});
|
|
31122
31128
|
};
|
|
31123
|
-
const GroupContentFormItem =
|
|
31124
|
-
|
|
31125
|
-
|
|
31126
|
-
|
|
31127
|
-
|
|
31128
|
-
|
|
31129
|
-
|
|
31130
|
-
|
|
31131
|
-
|
|
31132
|
-
|
|
31133
|
-
|
|
31134
|
-
|
|
31135
|
-
|
|
31136
|
-
|
|
31137
|
-
|
|
31138
|
-
|
|
31139
|
-
|
|
31140
|
-
|
|
31141
|
-
isHighlighted
|
|
31142
|
-
} = _ref4;
|
|
31129
|
+
const GroupContentFormItem = ({
|
|
31130
|
+
values,
|
|
31131
|
+
formId,
|
|
31132
|
+
setValues,
|
|
31133
|
+
MainForm,
|
|
31134
|
+
options,
|
|
31135
|
+
plainForms,
|
|
31136
|
+
setAddress,
|
|
31137
|
+
inputData,
|
|
31138
|
+
inputId,
|
|
31139
|
+
input,
|
|
31140
|
+
rules,
|
|
31141
|
+
inputMeta,
|
|
31142
|
+
changeInputMeta,
|
|
31143
|
+
notPartOfTheForm = true,
|
|
31144
|
+
isAjaxSubGroup,
|
|
31145
|
+
isHighlighted
|
|
31146
|
+
}) => {
|
|
31143
31147
|
const {
|
|
31144
31148
|
t,
|
|
31145
31149
|
user,
|
|
@@ -31153,10 +31157,10 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31153
31157
|
staticWidth,
|
|
31154
31158
|
fullWidth
|
|
31155
31159
|
} = useEditContext();
|
|
31156
|
-
const [isShown, setIsShown] = React.useState(!!
|
|
31157
|
-
let maxRule =
|
|
31160
|
+
const [isShown, setIsShown] = React.useState(!!inputMeta?.comment);
|
|
31161
|
+
let maxRule = rules.find(rule => rule.max)?.max;
|
|
31158
31162
|
const requiredRule = rules.find(r => r.required);
|
|
31159
|
-
const lastReview = (
|
|
31163
|
+
const lastReview = (inputMeta?.reviews || [])[(inputMeta?.reviews?.length || 0) - 1];
|
|
31160
31164
|
if (!maxRule && input.type === 'textarea') {
|
|
31161
31165
|
maxRule = MAX_TEXT_AREA_LENGTH;
|
|
31162
31166
|
}
|
|
@@ -31175,35 +31179,38 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31175
31179
|
}
|
|
31176
31180
|
setIsShown(true);
|
|
31177
31181
|
if (notPartOfTheForm || isAjaxSubGroup) {
|
|
31178
|
-
|
|
31179
|
-
const _defaultMeta = ((values === null || values === void 0 || (_values$meta5 = values.meta) === null || _values$meta5 === void 0 ? void 0 : _values$meta5.inputs) || {})[formId] || {};
|
|
31182
|
+
const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
|
|
31180
31183
|
const _defaultData = MainForm.getFieldValue(formId);
|
|
31181
31184
|
if (isAjaxSubGroup) {
|
|
31182
|
-
var _defaultData$meta, _defaultData$meta2;
|
|
31183
31185
|
changeInputMeta({
|
|
31184
31186
|
key: formId,
|
|
31185
31187
|
type: input.type,
|
|
31186
31188
|
otherValues: {
|
|
31187
|
-
[formId]:
|
|
31189
|
+
[formId]: {
|
|
31190
|
+
..._defaultData,
|
|
31188
31191
|
meta: {
|
|
31189
|
-
inputs:
|
|
31190
|
-
|
|
31192
|
+
inputs: {
|
|
31193
|
+
...(_defaultData?.meta?.inputs || {}),
|
|
31194
|
+
[inputId]: {
|
|
31195
|
+
...((_defaultData?.meta?.inputs || {})[inputId] || {}),
|
|
31191
31196
|
comment: ''
|
|
31192
|
-
}
|
|
31193
|
-
}
|
|
31197
|
+
}
|
|
31198
|
+
}
|
|
31194
31199
|
}
|
|
31195
|
-
}
|
|
31200
|
+
}
|
|
31196
31201
|
}
|
|
31197
31202
|
});
|
|
31198
31203
|
} else {
|
|
31199
31204
|
changeInputMeta({
|
|
31200
31205
|
key: formId,
|
|
31201
31206
|
type: input.type,
|
|
31202
|
-
value:
|
|
31203
|
-
|
|
31207
|
+
value: {
|
|
31208
|
+
..._defaultMeta,
|
|
31209
|
+
[inputId]: {
|
|
31210
|
+
...(_defaultMeta[inputId] || {}),
|
|
31204
31211
|
comment: ''
|
|
31205
|
-
}
|
|
31206
|
-
}
|
|
31212
|
+
}
|
|
31213
|
+
}
|
|
31207
31214
|
});
|
|
31208
31215
|
}
|
|
31209
31216
|
} else {
|
|
@@ -31220,58 +31227,62 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31220
31227
|
if (!isReview) {
|
|
31221
31228
|
return;
|
|
31222
31229
|
}
|
|
31223
|
-
const reviewSuccess = lastReview
|
|
31230
|
+
const reviewSuccess = lastReview?.reviewSuccess;
|
|
31224
31231
|
if (notPartOfTheForm || isAjaxSubGroup) {
|
|
31225
|
-
|
|
31226
|
-
const _defaultMeta = ((values === null || values === void 0 || (_values$meta6 = values.meta) === null || _values$meta6 === void 0 ? void 0 : _values$meta6.inputs) || {})[formId] || {};
|
|
31232
|
+
const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
|
|
31227
31233
|
const _defaultData = MainForm.getFieldValue(formId);
|
|
31228
31234
|
if (isAjaxSubGroup) {
|
|
31229
|
-
var _defaultData$meta3, _defaultData$meta4, _defaultData$meta5, _defaultData$meta6;
|
|
31230
31235
|
changeInputMeta({
|
|
31231
31236
|
key: formId,
|
|
31232
31237
|
type: input.type,
|
|
31233
31238
|
otherValues: {
|
|
31234
|
-
[formId]:
|
|
31239
|
+
[formId]: {
|
|
31240
|
+
..._defaultData,
|
|
31235
31241
|
meta: {
|
|
31236
|
-
inputs:
|
|
31237
|
-
|
|
31238
|
-
|
|
31242
|
+
inputs: {
|
|
31243
|
+
...(_defaultData?.meta?.inputs || {}),
|
|
31244
|
+
[inputId]: {
|
|
31245
|
+
...((_defaultData?.meta?.inputs || {})[inputId] || {}),
|
|
31246
|
+
reviews: reviewSuccess ? (((_defaultData?.meta?.inputs || {})[inputId] || {}).reviews || []).filter(v => v.createdAt !== lastReview.createdAt) : [...(((_defaultData?.meta?.inputs || {})[inputId] || {}).reviews || []), {
|
|
31239
31247
|
reviewer: user,
|
|
31240
31248
|
createdAt: new Date().toISOString(),
|
|
31241
31249
|
reviewSuccess: true
|
|
31242
31250
|
}]
|
|
31243
|
-
}
|
|
31244
|
-
}
|
|
31251
|
+
}
|
|
31252
|
+
}
|
|
31245
31253
|
}
|
|
31246
|
-
}
|
|
31254
|
+
}
|
|
31247
31255
|
}
|
|
31248
31256
|
});
|
|
31249
31257
|
} else {
|
|
31250
31258
|
changeInputMeta({
|
|
31251
31259
|
key: formId,
|
|
31252
31260
|
type: input.type,
|
|
31253
|
-
value:
|
|
31254
|
-
|
|
31261
|
+
value: {
|
|
31262
|
+
..._defaultMeta,
|
|
31263
|
+
[inputId]: {
|
|
31264
|
+
...(_defaultMeta[inputId] || {}),
|
|
31255
31265
|
reviews: reviewSuccess ? ((_defaultMeta[inputId] || {}).reviews || []).filter(v => v.createdAt !== lastReview.createdAt) : [...((_defaultMeta[inputId] || {}).reviews || []), {
|
|
31256
31266
|
reviewer: user,
|
|
31257
31267
|
createdAt: new Date().toISOString(),
|
|
31258
31268
|
reviewSuccess: true
|
|
31259
31269
|
}]
|
|
31260
|
-
}
|
|
31261
|
-
}
|
|
31270
|
+
}
|
|
31271
|
+
}
|
|
31262
31272
|
});
|
|
31263
31273
|
}
|
|
31264
31274
|
} else {
|
|
31265
31275
|
changeInputMeta({
|
|
31266
31276
|
key: inputId,
|
|
31267
31277
|
type: input.type,
|
|
31268
|
-
value:
|
|
31278
|
+
value: {
|
|
31279
|
+
...inputMeta,
|
|
31269
31280
|
reviews: reviewSuccess ? (inputMeta.reviews || []).filter(v => v.createdAt !== lastReview.createdAt) : [...(inputMeta.reviews || []), {
|
|
31270
31281
|
reviewer: user,
|
|
31271
31282
|
createdAt: new Date().toISOString(),
|
|
31272
31283
|
reviewSuccess: true
|
|
31273
31284
|
}]
|
|
31274
|
-
}
|
|
31285
|
+
}
|
|
31275
31286
|
});
|
|
31276
31287
|
}
|
|
31277
31288
|
};
|
|
@@ -31279,111 +31290,118 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31279
31290
|
if (!isReview) {
|
|
31280
31291
|
return;
|
|
31281
31292
|
}
|
|
31282
|
-
const reviewError = lastReview
|
|
31293
|
+
const reviewError = lastReview?.reviewError;
|
|
31283
31294
|
if (notPartOfTheForm || isAjaxSubGroup) {
|
|
31284
|
-
|
|
31285
|
-
const _defaultMeta = ((values === null || values === void 0 || (_values$meta7 = values.meta) === null || _values$meta7 === void 0 ? void 0 : _values$meta7.inputs) || {})[formId] || {};
|
|
31295
|
+
const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
|
|
31286
31296
|
const _defaultData = MainForm.getFieldValue(formId);
|
|
31287
31297
|
if (isAjaxSubGroup) {
|
|
31288
|
-
var _defaultData$meta7, _defaultData$meta8, _defaultData$meta9, _defaultData$meta10;
|
|
31289
31298
|
changeInputMeta({
|
|
31290
31299
|
key: formId,
|
|
31291
31300
|
type: input.type,
|
|
31292
31301
|
otherValues: {
|
|
31293
|
-
[formId]:
|
|
31302
|
+
[formId]: {
|
|
31303
|
+
..._defaultData,
|
|
31294
31304
|
meta: {
|
|
31295
|
-
inputs:
|
|
31296
|
-
|
|
31297
|
-
|
|
31305
|
+
inputs: {
|
|
31306
|
+
...(_defaultData?.meta?.inputs || {}),
|
|
31307
|
+
[inputId]: {
|
|
31308
|
+
...((_defaultData?.meta?.inputs || {})[inputId] || {}),
|
|
31309
|
+
reviews: reviewError ? (((_defaultData?.meta?.inputs || {})[inputId] || {}).reviews || []).filter(v => v.createdAt !== lastReview.createdAt) : [...(((_defaultData?.meta?.inputs || {})[inputId] || {}).reviews || []), {
|
|
31298
31310
|
reviewer: user,
|
|
31299
31311
|
createdAt: new Date().toISOString(),
|
|
31300
31312
|
reviewError: true,
|
|
31301
31313
|
comment: ''
|
|
31302
31314
|
}]
|
|
31303
|
-
}
|
|
31304
|
-
}
|
|
31315
|
+
}
|
|
31316
|
+
}
|
|
31305
31317
|
}
|
|
31306
|
-
}
|
|
31318
|
+
}
|
|
31307
31319
|
}
|
|
31308
31320
|
});
|
|
31309
31321
|
} else {
|
|
31310
31322
|
changeInputMeta({
|
|
31311
31323
|
key: formId,
|
|
31312
31324
|
type: input.type,
|
|
31313
|
-
value:
|
|
31314
|
-
|
|
31325
|
+
value: {
|
|
31326
|
+
..._defaultMeta,
|
|
31327
|
+
[inputId]: {
|
|
31328
|
+
...(_defaultMeta[inputId] || {}),
|
|
31315
31329
|
reviews: reviewError ? ((_defaultMeta[inputId] || {}).reviews || []).filter(v => v.createdAt !== lastReview.createdAt) : [...((_defaultMeta[inputId] || {}).reviews || []), {
|
|
31316
31330
|
reviewer: user,
|
|
31317
31331
|
createdAt: new Date().toISOString(),
|
|
31318
31332
|
reviewError: true,
|
|
31319
31333
|
comment: ''
|
|
31320
31334
|
}]
|
|
31321
|
-
}
|
|
31322
|
-
}
|
|
31335
|
+
}
|
|
31336
|
+
}
|
|
31323
31337
|
});
|
|
31324
31338
|
}
|
|
31325
31339
|
} else {
|
|
31326
31340
|
changeInputMeta({
|
|
31327
31341
|
key: inputId,
|
|
31328
31342
|
type: input.type,
|
|
31329
|
-
value:
|
|
31343
|
+
value: {
|
|
31344
|
+
...inputMeta,
|
|
31330
31345
|
reviews: reviewError ? (inputMeta.reviews || []).filter(v => v.createdAt !== lastReview.createdAt) : [...(inputMeta.reviews || []), {
|
|
31331
31346
|
reviewer: user,
|
|
31332
31347
|
createdAt: new Date().toISOString(),
|
|
31333
31348
|
reviewError: true,
|
|
31334
31349
|
comment: ''
|
|
31335
31350
|
}]
|
|
31336
|
-
}
|
|
31351
|
+
}
|
|
31337
31352
|
});
|
|
31338
31353
|
}
|
|
31339
31354
|
};
|
|
31340
|
-
const requiredComment =
|
|
31355
|
+
const requiredComment = inputMeta?.notApplicable && input?.meta?.requiredCommentOnNotApplicable && values?.[formId]?.valuation !== 'na';
|
|
31341
31356
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
31342
31357
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
31343
31358
|
className: "flex input-cont",
|
|
31344
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item,
|
|
31345
|
-
required: inputData.rules && inputData.rules instanceof Array && inputData.rules.filter(r => r.required).length > 0 ? true : false
|
|
31346
|
-
|
|
31347
|
-
|
|
31348
|
-
|
|
31349
|
-
|
|
31350
|
-
|
|
31351
|
-
|
|
31352
|
-
|
|
31353
|
-
|
|
31354
|
-
|
|
31355
|
-
|
|
31356
|
-
return e && e.fileList && e.fileList.map(f => {
|
|
31357
|
-
if (f.response) {
|
|
31358
|
-
return f.response;
|
|
31359
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
31360
|
+
required: inputData.rules && inputData.rules instanceof Array && inputData.rules.filter(r => r.required).length > 0 ? true : false,
|
|
31361
|
+
...(['total100', 'group'].includes(input.type) ? {} : {
|
|
31362
|
+
name: notPartOfTheForm ? [formId, inputId] : inputId,
|
|
31363
|
+
fieldKey: notPartOfTheForm ? [formId, inputId] : inputId,
|
|
31364
|
+
initialValue: notPartOfTheForm ? (values[formId] || {})[inputId] : values[inputId]
|
|
31365
|
+
}),
|
|
31366
|
+
...(['upload', 'imageUpload', 'videoUpload'].includes(input.type) ? {
|
|
31367
|
+
valuePropName: "fileList",
|
|
31368
|
+
getValueFromEvent: e => {
|
|
31369
|
+
if (Array.isArray(e)) {
|
|
31370
|
+
return e;
|
|
31359
31371
|
}
|
|
31360
|
-
return f
|
|
31361
|
-
|
|
31362
|
-
|
|
31363
|
-
|
|
31364
|
-
|
|
31365
|
-
|
|
31372
|
+
return e && e.fileList && e.fileList.map(f => {
|
|
31373
|
+
if (f.response) {
|
|
31374
|
+
return f.response;
|
|
31375
|
+
}
|
|
31376
|
+
return f;
|
|
31377
|
+
});
|
|
31378
|
+
}
|
|
31379
|
+
} : {}),
|
|
31380
|
+
...(inputOnBlur.includes(input.type) ? {
|
|
31381
|
+
trigger: "onBlur"
|
|
31382
|
+
} : {}),
|
|
31366
31383
|
style: input.showOnView === false ? {
|
|
31367
31384
|
display: 'none'
|
|
31368
|
-
} : {}
|
|
31369
|
-
|
|
31370
|
-
|
|
31371
|
-
|
|
31372
|
-
|
|
31373
|
-
|
|
31374
|
-
|
|
31375
|
-
|
|
31376
|
-
|
|
31377
|
-
|
|
31378
|
-
|
|
31379
|
-
|
|
31385
|
+
} : {},
|
|
31386
|
+
...(['switch'].includes(input.type) ? {
|
|
31387
|
+
labelCol: {
|
|
31388
|
+
span: 20
|
|
31389
|
+
},
|
|
31390
|
+
style: {
|
|
31391
|
+
...(input.showOnView === false ? {
|
|
31392
|
+
display: 'none'
|
|
31393
|
+
} : {}),
|
|
31394
|
+
flexDirection: 'row',
|
|
31395
|
+
justifyContent: 'space-between'
|
|
31396
|
+
}
|
|
31397
|
+
} : {}),
|
|
31380
31398
|
label: !noActionsInputs.includes(input.type) ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31381
|
-
className:
|
|
31399
|
+
className: input?.meta?.code && "mr-10",
|
|
31382
31400
|
children: getInputLabel$1(input, values)
|
|
31383
31401
|
}) : null,
|
|
31384
31402
|
rules: rules,
|
|
31385
|
-
className: formatClassname([input.comment ?
|
|
31386
|
-
"data-id":
|
|
31403
|
+
className: formatClassname([input.comment ? `flex-1 with-comment i-${input.type}` : `i-${input.type} flex-1 `, noActionsInputs.includes(input.type) && 'no-actions-input']),
|
|
31404
|
+
"data-id": `${formId}.${inputId}`,
|
|
31387
31405
|
extra: /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
31388
31406
|
children: !noActionsInputs.includes(input.type) ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
31389
31407
|
className: formatClassname(["ml-4 input-actions"]),
|
|
@@ -31393,7 +31411,7 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31393
31411
|
title: t('Add review note'),
|
|
31394
31412
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31395
31413
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31396
|
-
className: formatClassname(["review-btn review-error-btn",
|
|
31414
|
+
className: formatClassname(["review-btn review-error-btn", lastReview?.reviewError && 'primary']),
|
|
31397
31415
|
type: "link",
|
|
31398
31416
|
onClick: onClickReviewError,
|
|
31399
31417
|
children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
@@ -31409,7 +31427,7 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31409
31427
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31410
31428
|
type: "link",
|
|
31411
31429
|
onClick: onClickReviewSuccess,
|
|
31412
|
-
className: formatClassname(["review-btn review-success-btn",
|
|
31430
|
+
className: formatClassname(["review-btn review-success-btn", lastReview?.reviewSuccess && 'primary']),
|
|
31413
31431
|
children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
31414
31432
|
name: "CheckSquare",
|
|
31415
31433
|
width: 16,
|
|
@@ -31426,59 +31444,65 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31426
31444
|
className: formatClassname(["default p-0", inputMeta.notApplicable && 'primary']),
|
|
31427
31445
|
type: "link",
|
|
31428
31446
|
onClick: () => {
|
|
31429
|
-
var _input$meta5, _input$meta6;
|
|
31430
31447
|
const value = getDefaultInputValue(input);
|
|
31431
|
-
const commentMeta = input
|
|
31448
|
+
const commentMeta = input?.meta?.requiredCommentOnNotApplicable ? {
|
|
31432
31449
|
comment: ''
|
|
31433
31450
|
} : {};
|
|
31434
|
-
if (input
|
|
31451
|
+
if (input?.meta?.requiredCommentOnNotApplicable) {
|
|
31435
31452
|
setIsShown(true);
|
|
31436
31453
|
}
|
|
31437
31454
|
if (notPartOfTheForm || isAjaxSubGroup) {
|
|
31438
|
-
var _values$meta8;
|
|
31439
31455
|
const _defaultData = MainForm.getFieldValue(formId);
|
|
31440
|
-
const _defaultMeta = (
|
|
31456
|
+
const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
|
|
31441
31457
|
if (isAjaxSubGroup) {
|
|
31442
|
-
var _defaultData$meta11;
|
|
31443
31458
|
changeInputMeta({
|
|
31444
31459
|
key: formId,
|
|
31445
31460
|
type: input.type,
|
|
31446
31461
|
otherValues: {
|
|
31447
|
-
[formId]:
|
|
31462
|
+
[formId]: {
|
|
31463
|
+
..._defaultData,
|
|
31448
31464
|
[inputId]: value,
|
|
31449
31465
|
meta: {
|
|
31450
|
-
inputs:
|
|
31451
|
-
|
|
31466
|
+
inputs: {
|
|
31467
|
+
...(_defaultData?.meta?.inputs || {}),
|
|
31468
|
+
[inputId]: inputMeta.notApplicable ? {
|
|
31452
31469
|
notApplicable: false,
|
|
31453
|
-
notAvailable: false
|
|
31454
|
-
|
|
31470
|
+
notAvailable: false,
|
|
31471
|
+
...commentMeta
|
|
31472
|
+
} : {
|
|
31455
31473
|
notApplicable: true,
|
|
31456
|
-
notAvailable: false
|
|
31457
|
-
|
|
31458
|
-
|
|
31474
|
+
notAvailable: false,
|
|
31475
|
+
...commentMeta
|
|
31476
|
+
}
|
|
31477
|
+
}
|
|
31459
31478
|
}
|
|
31460
|
-
}
|
|
31479
|
+
}
|
|
31461
31480
|
}
|
|
31462
31481
|
});
|
|
31463
31482
|
} else {
|
|
31464
31483
|
changeInputMeta({
|
|
31465
31484
|
key: formId,
|
|
31466
31485
|
type: input.type,
|
|
31467
|
-
value: inputMeta.notApplicable ?
|
|
31468
|
-
|
|
31486
|
+
value: inputMeta.notApplicable ? {
|
|
31487
|
+
..._defaultMeta,
|
|
31488
|
+
[inputId]: {
|
|
31469
31489
|
notApplicable: false,
|
|
31470
|
-
notAvailable: false
|
|
31471
|
-
|
|
31472
|
-
|
|
31473
|
-
|
|
31490
|
+
notAvailable: false,
|
|
31491
|
+
...commentMeta
|
|
31492
|
+
}
|
|
31493
|
+
} : {
|
|
31494
|
+
..._defaultMeta,
|
|
31495
|
+
[inputId]: {
|
|
31474
31496
|
notApplicable: true,
|
|
31475
|
-
notAvailable: false
|
|
31476
|
-
|
|
31477
|
-
|
|
31497
|
+
notAvailable: false,
|
|
31498
|
+
...commentMeta
|
|
31499
|
+
}
|
|
31500
|
+
},
|
|
31478
31501
|
otherValues: {
|
|
31479
|
-
[formId]:
|
|
31502
|
+
[formId]: {
|
|
31503
|
+
..._defaultData,
|
|
31480
31504
|
[inputId]: value
|
|
31481
|
-
}
|
|
31505
|
+
}
|
|
31482
31506
|
}
|
|
31483
31507
|
});
|
|
31484
31508
|
}
|
|
@@ -31499,7 +31523,7 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31499
31523
|
});
|
|
31500
31524
|
}
|
|
31501
31525
|
},
|
|
31502
|
-
disabled: !
|
|
31526
|
+
disabled: !input.meta?.notApplicable,
|
|
31503
31527
|
children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
31504
31528
|
name: "NotApplicable",
|
|
31505
31529
|
width: 16,
|
|
@@ -31513,24 +31537,24 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31513
31537
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
31514
31538
|
className: formatClassname(["default p-0", inputMeta.notAvailable && 'primary']),
|
|
31515
31539
|
type: "link",
|
|
31516
|
-
disabled: !
|
|
31540
|
+
disabled: !input.meta?.notAvailable,
|
|
31517
31541
|
onClick: () => {
|
|
31518
31542
|
const value = getDefaultInputValue(input);
|
|
31519
31543
|
if (notPartOfTheForm || isAjaxSubGroup) {
|
|
31520
|
-
var _values$meta9;
|
|
31521
31544
|
const _defaultData = MainForm.getFieldValue(formId);
|
|
31522
|
-
const _defaultMeta = (
|
|
31545
|
+
const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
|
|
31523
31546
|
if (isAjaxSubGroup) {
|
|
31524
31547
|
if (isAjaxSubGroup) {
|
|
31525
|
-
var _defaultData$meta12;
|
|
31526
31548
|
changeInputMeta({
|
|
31527
31549
|
key: formId,
|
|
31528
31550
|
type: input.type,
|
|
31529
31551
|
otherValues: {
|
|
31530
|
-
[formId]:
|
|
31552
|
+
[formId]: {
|
|
31553
|
+
..._defaultData,
|
|
31531
31554
|
[inputId]: value,
|
|
31532
31555
|
meta: {
|
|
31533
|
-
inputs:
|
|
31556
|
+
inputs: {
|
|
31557
|
+
...(_defaultData?.meta?.inputs || {}),
|
|
31534
31558
|
[inputId]: inputMeta.notAvailable ? {
|
|
31535
31559
|
notApplicable: false,
|
|
31536
31560
|
notAvailable: false
|
|
@@ -31538,9 +31562,9 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31538
31562
|
notApplicable: false,
|
|
31539
31563
|
notAvailable: true
|
|
31540
31564
|
}
|
|
31541
|
-
}
|
|
31565
|
+
}
|
|
31542
31566
|
}
|
|
31543
|
-
}
|
|
31567
|
+
}
|
|
31544
31568
|
}
|
|
31545
31569
|
});
|
|
31546
31570
|
}
|
|
@@ -31548,21 +31572,24 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31548
31572
|
changeInputMeta({
|
|
31549
31573
|
key: formId,
|
|
31550
31574
|
type: input.type,
|
|
31551
|
-
value: inputMeta.notAvailable ?
|
|
31575
|
+
value: inputMeta.notAvailable ? {
|
|
31576
|
+
..._defaultMeta,
|
|
31552
31577
|
[inputId]: {
|
|
31553
31578
|
notApplicable: false,
|
|
31554
31579
|
notAvailable: false
|
|
31555
31580
|
}
|
|
31556
|
-
}
|
|
31581
|
+
} : {
|
|
31582
|
+
..._defaultMeta,
|
|
31557
31583
|
[inputId]: {
|
|
31558
31584
|
notApplicable: false,
|
|
31559
31585
|
notAvailable: true
|
|
31560
31586
|
}
|
|
31561
|
-
}
|
|
31587
|
+
},
|
|
31562
31588
|
otherValues: {
|
|
31563
|
-
[formId]:
|
|
31589
|
+
[formId]: {
|
|
31590
|
+
..._defaultData,
|
|
31564
31591
|
[inputId]: value
|
|
31565
|
-
}
|
|
31592
|
+
}
|
|
31566
31593
|
}
|
|
31567
31594
|
});
|
|
31568
31595
|
}
|
|
@@ -31593,33 +31620,38 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31593
31620
|
}), /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
31594
31621
|
title: t('Add comment'),
|
|
31595
31622
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31596
|
-
children: /*#__PURE__*/jsxRuntime.jsx(antd.Button,
|
|
31623
|
+
children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
31597
31624
|
type: "link",
|
|
31598
|
-
disabled: !
|
|
31599
|
-
|
|
31600
|
-
|
|
31601
|
-
|
|
31602
|
-
|
|
31603
|
-
|
|
31625
|
+
disabled: !input.meta?.comment,
|
|
31626
|
+
...(!isShown ? {
|
|
31627
|
+
className: 'default p-0'
|
|
31628
|
+
} : {
|
|
31629
|
+
className: 'p-0 primary'
|
|
31630
|
+
}),
|
|
31604
31631
|
onClick: onClickComment,
|
|
31605
31632
|
children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
31606
31633
|
name: "AddComment",
|
|
31607
31634
|
width: 16,
|
|
31608
31635
|
height: 16
|
|
31609
31636
|
})
|
|
31610
|
-
})
|
|
31637
|
+
})
|
|
31611
31638
|
})
|
|
31612
31639
|
})]
|
|
31613
31640
|
}) : null]
|
|
31614
31641
|
}) : null
|
|
31615
31642
|
}),
|
|
31616
31643
|
children: isReview ? /*#__PURE__*/jsxRuntime.jsx(BasicInput, {
|
|
31617
|
-
data:
|
|
31618
|
-
|
|
31619
|
-
|
|
31620
|
-
|
|
31621
|
-
|
|
31622
|
-
|
|
31644
|
+
data: {
|
|
31645
|
+
...(values[formId] || {}),
|
|
31646
|
+
meta: {
|
|
31647
|
+
...(values?.meta || {}),
|
|
31648
|
+
inputs: {
|
|
31649
|
+
...(values?.meta?.inputs || {}),
|
|
31650
|
+
...((values?.meta?.inputs || {})[formId] || {})
|
|
31651
|
+
}
|
|
31652
|
+
}
|
|
31653
|
+
},
|
|
31654
|
+
linkingData: values?.linking || values?.parent?.linking,
|
|
31623
31655
|
name: input.dataId,
|
|
31624
31656
|
config: input,
|
|
31625
31657
|
t: t,
|
|
@@ -31631,12 +31663,13 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31631
31663
|
getToken: getToken,
|
|
31632
31664
|
app: app,
|
|
31633
31665
|
valueOnlyString: true
|
|
31634
|
-
}) : inputTypeComponent$1[input.type] ? inputTypeComponent$1[input.type](
|
|
31666
|
+
}) : inputTypeComponent$1[input.type] ? inputTypeComponent$1[input.type]({
|
|
31667
|
+
...inputData,
|
|
31635
31668
|
name: inputId,
|
|
31636
31669
|
maxWidth,
|
|
31637
31670
|
staticWidth,
|
|
31638
31671
|
fullWidth
|
|
31639
|
-
}
|
|
31672
|
+
}, {
|
|
31640
31673
|
form: MainForm,
|
|
31641
31674
|
forms: options,
|
|
31642
31675
|
allForms: plainForms,
|
|
@@ -31654,10 +31687,10 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31654
31687
|
staticWidth,
|
|
31655
31688
|
fullWidth
|
|
31656
31689
|
}) : console.log(input)
|
|
31657
|
-
})
|
|
31690
|
+
}), input.meta?.code ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31658
31691
|
className: "code",
|
|
31659
31692
|
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
31660
|
-
children:
|
|
31693
|
+
children: input.meta?.code
|
|
31661
31694
|
})
|
|
31662
31695
|
}) : null]
|
|
31663
31696
|
}), maxRule ? ['imageUpload', 'videoUpload', 'upload'].includes(input.type) ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -31677,16 +31710,16 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31677
31710
|
className: "max-char-span",
|
|
31678
31711
|
children: t('max-char', {
|
|
31679
31712
|
chars: maxRule,
|
|
31680
|
-
filled:
|
|
31713
|
+
filled: inputData?.value?.length || 0
|
|
31681
31714
|
})
|
|
31682
31715
|
})
|
|
31683
|
-
}) : null,
|
|
31716
|
+
}) : null, input.meta?.comment && isShown ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
31684
31717
|
className: "input-content",
|
|
31685
31718
|
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
31686
31719
|
className: "comment-textarea",
|
|
31687
|
-
initialValue:
|
|
31720
|
+
initialValue: inputMeta?.comment || '',
|
|
31688
31721
|
hidden: !isShown,
|
|
31689
|
-
name:
|
|
31722
|
+
name: `${formId}-${inputId}-comment`,
|
|
31690
31723
|
required: requiredComment,
|
|
31691
31724
|
rules: requiredComment ? [{
|
|
31692
31725
|
required: true,
|
|
@@ -31703,35 +31736,38 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31703
31736
|
onConfirm: () => {
|
|
31704
31737
|
setIsShown(false);
|
|
31705
31738
|
if (notPartOfTheForm) {
|
|
31706
|
-
|
|
31707
|
-
const _defaultMeta = ((values === null || values === void 0 || (_values$meta12 = values.meta) === null || _values$meta12 === void 0 ? void 0 : _values$meta12.inputs) || {})[formId] || {};
|
|
31739
|
+
const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
|
|
31708
31740
|
const _defaultData = MainForm.getFieldValue(formId);
|
|
31709
31741
|
if (isAjaxSubGroup) {
|
|
31710
|
-
var _defaultData$meta13, _defaultData$meta14;
|
|
31711
31742
|
changeInputMeta({
|
|
31712
31743
|
key: formId,
|
|
31713
31744
|
type: input.type,
|
|
31714
31745
|
otherValues: {
|
|
31715
|
-
[formId]:
|
|
31746
|
+
[formId]: {
|
|
31747
|
+
..._defaultData,
|
|
31716
31748
|
meta: {
|
|
31717
|
-
inputs:
|
|
31718
|
-
|
|
31749
|
+
inputs: {
|
|
31750
|
+
...(_defaultData?.meta?.inputs || {}),
|
|
31751
|
+
[inputId]: {
|
|
31752
|
+
...((_defaultData?.meta?.inputs || {})[inputId] || {}),
|
|
31719
31753
|
comment: null
|
|
31720
|
-
}
|
|
31721
|
-
}
|
|
31754
|
+
}
|
|
31755
|
+
}
|
|
31722
31756
|
}
|
|
31723
|
-
}
|
|
31757
|
+
}
|
|
31724
31758
|
}
|
|
31725
31759
|
});
|
|
31726
31760
|
} else {
|
|
31727
31761
|
changeInputMeta({
|
|
31728
31762
|
key: formId,
|
|
31729
31763
|
type: input.type,
|
|
31730
|
-
value:
|
|
31731
|
-
|
|
31764
|
+
value: {
|
|
31765
|
+
..._defaultMeta,
|
|
31766
|
+
[inputId]: {
|
|
31767
|
+
...(_defaultMeta[inputId] || {}),
|
|
31732
31768
|
comment: null
|
|
31733
|
-
}
|
|
31734
|
-
}
|
|
31769
|
+
}
|
|
31770
|
+
}
|
|
31735
31771
|
});
|
|
31736
31772
|
}
|
|
31737
31773
|
} else {
|
|
@@ -31746,7 +31782,7 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31746
31782
|
},
|
|
31747
31783
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
31748
31784
|
type: "link",
|
|
31749
|
-
disabled: !
|
|
31785
|
+
disabled: !input.meta?.comment,
|
|
31750
31786
|
className: "p-0",
|
|
31751
31787
|
children: /*#__PURE__*/jsxRuntime.jsx(Icons.DeleteOutlined, {
|
|
31752
31788
|
width: 16,
|
|
@@ -31758,41 +31794,44 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31758
31794
|
children: inputTypeComponent$1.comment(inputData, {
|
|
31759
31795
|
form: MainForm,
|
|
31760
31796
|
forms: options,
|
|
31761
|
-
value:
|
|
31797
|
+
value: inputMeta?.comment || '',
|
|
31762
31798
|
maxWidth,
|
|
31763
31799
|
staticWidth,
|
|
31764
31800
|
fullWidth,
|
|
31765
31801
|
onChange: val => {
|
|
31766
31802
|
if (notPartOfTheForm) {
|
|
31767
|
-
|
|
31768
|
-
const _defaultMeta = ((values === null || values === void 0 || (_values$meta13 = values.meta) === null || _values$meta13 === void 0 ? void 0 : _values$meta13.inputs) || {})[formId] || {};
|
|
31803
|
+
const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
|
|
31769
31804
|
const _defaultData = MainForm.getFieldValue(formId);
|
|
31770
31805
|
if (isAjaxSubGroup) {
|
|
31771
|
-
var _defaultData$meta15, _defaultData$meta16;
|
|
31772
31806
|
changeInputMeta({
|
|
31773
31807
|
key: formId,
|
|
31774
31808
|
type: input.type,
|
|
31775
31809
|
otherValues: {
|
|
31776
|
-
[formId]:
|
|
31810
|
+
[formId]: {
|
|
31811
|
+
..._defaultData,
|
|
31777
31812
|
meta: {
|
|
31778
|
-
inputs:
|
|
31779
|
-
|
|
31813
|
+
inputs: {
|
|
31814
|
+
...(_defaultData?.meta?.inputs || {}),
|
|
31815
|
+
[inputId]: {
|
|
31816
|
+
...((_defaultData?.meta?.inputs || {})[inputId] || {}),
|
|
31780
31817
|
comment: val
|
|
31781
|
-
}
|
|
31782
|
-
}
|
|
31818
|
+
}
|
|
31819
|
+
}
|
|
31783
31820
|
}
|
|
31784
|
-
}
|
|
31821
|
+
}
|
|
31785
31822
|
}
|
|
31786
31823
|
});
|
|
31787
31824
|
} else {
|
|
31788
31825
|
changeInputMeta({
|
|
31789
31826
|
key: formId,
|
|
31790
31827
|
type: input.type,
|
|
31791
|
-
value:
|
|
31792
|
-
|
|
31828
|
+
value: {
|
|
31829
|
+
..._defaultMeta,
|
|
31830
|
+
[inputId]: {
|
|
31831
|
+
...(_defaultMeta[inputId] || {}),
|
|
31793
31832
|
comment: val
|
|
31794
|
-
}
|
|
31795
|
-
}
|
|
31833
|
+
}
|
|
31834
|
+
}
|
|
31796
31835
|
});
|
|
31797
31836
|
}
|
|
31798
31837
|
} else {
|
|
@@ -31813,16 +31852,16 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31813
31852
|
className: "max-char-span",
|
|
31814
31853
|
children: t('max-char', {
|
|
31815
31854
|
chars: MAX_COMMENTS_LENGTH,
|
|
31816
|
-
filled:
|
|
31855
|
+
filled: inputMeta?.comment?.length || 0
|
|
31817
31856
|
})
|
|
31818
31857
|
})]
|
|
31819
|
-
}) : null, lastReview
|
|
31858
|
+
}) : null, lastReview?.reviewError ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31820
31859
|
className: "input-content",
|
|
31821
31860
|
children: isReview ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
31822
31861
|
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
31823
31862
|
className: "comment-textarea",
|
|
31824
|
-
initialValue:
|
|
31825
|
-
name:
|
|
31863
|
+
initialValue: lastReview?.comment || '',
|
|
31864
|
+
name: `${formId}-${inputId}-reviewErrorComment`,
|
|
31826
31865
|
label: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31827
31866
|
className: "flex w-100",
|
|
31828
31867
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -31833,71 +31872,78 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31833
31872
|
children: inputTypeComponent$1.comment(inputData, {
|
|
31834
31873
|
form: MainForm,
|
|
31835
31874
|
forms: options,
|
|
31836
|
-
value:
|
|
31875
|
+
value: lastReview?.comment || '',
|
|
31837
31876
|
maxWidth,
|
|
31838
31877
|
staticWidth,
|
|
31839
31878
|
fullWidth,
|
|
31840
31879
|
onChange: val => {
|
|
31841
31880
|
if (notPartOfTheForm) {
|
|
31842
|
-
|
|
31843
|
-
const _defaultMeta = ((values === null || values === void 0 || (_values$meta14 = values.meta) === null || _values$meta14 === void 0 ? void 0 : _values$meta14.inputs) || {})[formId] || {};
|
|
31881
|
+
const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
|
|
31844
31882
|
const _defaultData = MainForm.getFieldValue(formId);
|
|
31845
31883
|
if (isAjaxSubGroup) {
|
|
31846
|
-
var _defaultData$meta17, _defaultData$meta18, _defaultData$meta19;
|
|
31847
31884
|
changeInputMeta({
|
|
31848
31885
|
key: formId,
|
|
31849
31886
|
type: input.type,
|
|
31850
31887
|
otherValues: {
|
|
31851
|
-
[formId]:
|
|
31888
|
+
[formId]: {
|
|
31889
|
+
..._defaultData,
|
|
31852
31890
|
meta: {
|
|
31853
|
-
inputs:
|
|
31854
|
-
|
|
31855
|
-
|
|
31891
|
+
inputs: {
|
|
31892
|
+
...(_defaultData?.meta?.inputs || {}),
|
|
31893
|
+
[inputId]: {
|
|
31894
|
+
...((_defaultData?.meta?.inputs || {})[inputId] || {}),
|
|
31895
|
+
reviews: (((_defaultData?.meta?.inputs || {})[inputId] || {}).reviews || []).map(v => {
|
|
31856
31896
|
if (v.createdAt === lastReview.createdAt) {
|
|
31857
|
-
return
|
|
31897
|
+
return {
|
|
31898
|
+
...v,
|
|
31858
31899
|
comment: val
|
|
31859
|
-
}
|
|
31900
|
+
};
|
|
31860
31901
|
}
|
|
31861
31902
|
return v;
|
|
31862
31903
|
})
|
|
31863
|
-
}
|
|
31864
|
-
}
|
|
31904
|
+
}
|
|
31905
|
+
}
|
|
31865
31906
|
}
|
|
31866
|
-
}
|
|
31907
|
+
}
|
|
31867
31908
|
}
|
|
31868
31909
|
});
|
|
31869
31910
|
} else {
|
|
31870
31911
|
changeInputMeta({
|
|
31871
31912
|
key: formId,
|
|
31872
31913
|
type: input.type,
|
|
31873
|
-
value:
|
|
31874
|
-
|
|
31914
|
+
value: {
|
|
31915
|
+
..._defaultMeta,
|
|
31916
|
+
[inputId]: {
|
|
31917
|
+
...(_defaultMeta[inputId] || {}),
|
|
31875
31918
|
reviews: ((_defaultMeta[inputId] || {}).reviews || []).map(v => {
|
|
31876
31919
|
if (v.createdAt === lastReview.createdAt) {
|
|
31877
|
-
return
|
|
31920
|
+
return {
|
|
31921
|
+
...v,
|
|
31878
31922
|
comment: val
|
|
31879
|
-
}
|
|
31923
|
+
};
|
|
31880
31924
|
}
|
|
31881
31925
|
return v;
|
|
31882
31926
|
})
|
|
31883
|
-
}
|
|
31884
|
-
}
|
|
31927
|
+
}
|
|
31928
|
+
}
|
|
31885
31929
|
});
|
|
31886
31930
|
}
|
|
31887
31931
|
} else {
|
|
31888
31932
|
changeInputMeta({
|
|
31889
31933
|
key: inputId,
|
|
31890
31934
|
type: input.type,
|
|
31891
|
-
value:
|
|
31892
|
-
|
|
31935
|
+
value: {
|
|
31936
|
+
...inputMeta,
|
|
31937
|
+
reviews: (inputMeta?.reviews || []).map(v => {
|
|
31893
31938
|
if (v.createdAt === lastReview.createdAt) {
|
|
31894
|
-
return
|
|
31939
|
+
return {
|
|
31940
|
+
...v,
|
|
31895
31941
|
comment: val
|
|
31896
|
-
}
|
|
31942
|
+
};
|
|
31897
31943
|
}
|
|
31898
31944
|
return v;
|
|
31899
31945
|
})
|
|
31900
|
-
}
|
|
31946
|
+
}
|
|
31901
31947
|
});
|
|
31902
31948
|
}
|
|
31903
31949
|
},
|
|
@@ -31909,7 +31955,7 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31909
31955
|
className: "max-char-span",
|
|
31910
31956
|
children: t('max-char', {
|
|
31911
31957
|
chars: MAX_COMMENTS_LENGTH,
|
|
31912
|
-
filled:
|
|
31958
|
+
filled: lastReview.comment?.length || 0
|
|
31913
31959
|
})
|
|
31914
31960
|
})]
|
|
31915
31961
|
}) : /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -31930,7 +31976,7 @@ const GroupContentFormItem = _ref4 => {
|
|
|
31930
31976
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31931
31977
|
className: "flex flex-column justify-center mr-1",
|
|
31932
31978
|
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
31933
|
-
children:
|
|
31979
|
+
children: lastReview?.reviewer?.firstName + ' ' + lastReview?.reviewer?.lastName + ' - ' + moment__default["default"](lastReview.createdAt).format('DD MMM YYYY')
|
|
31934
31980
|
})
|
|
31935
31981
|
})]
|
|
31936
31982
|
})]
|
|
@@ -41616,23 +41662,22 @@ function renderRepeatable(options, k, setValues, values, excludedKeys, i, formTi
|
|
|
41616
41662
|
const formId = form.dataId || k;
|
|
41617
41663
|
const allInputs = Object.keys(form.inputs).filter(i => {
|
|
41618
41664
|
const input = form.inputs[i];
|
|
41619
|
-
return !excludedKeys.includes(i) && !input.excludeFromEdit && showHideInput(input, values, undefined, undefined, setValues,
|
|
41665
|
+
return !excludedKeys.includes(i) && !input.excludeFromEdit && showHideInput(input, values, undefined, undefined, setValues, `${formId}.${i}`);
|
|
41620
41666
|
});
|
|
41621
41667
|
return allInputs.length ? /*#__PURE__*/jsxRuntime.jsxs(React__default["default"].Fragment, {
|
|
41622
41668
|
children: [getFormTitles(formTitles, formId, i), ['h2', 'h3', 'h4', 'h5', 'h6'].includes(form.type) ? getInputHeadLines(form.type, i, form, values) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
41623
41669
|
children: [!form.repeatable ? /*#__PURE__*/jsxRuntime.jsx("h3", {
|
|
41624
|
-
className:
|
|
41670
|
+
className: `${form.titleClass ? form.titleClass : 'title-semibold-4'} mb0 ${i ? 'mt-3' : ''}`,
|
|
41625
41671
|
children: getInputLabel(form, values)
|
|
41626
41672
|
}) : !form.hideSectionLabel ? /*#__PURE__*/jsxRuntime.jsx("h3", {
|
|
41627
|
-
className:
|
|
41673
|
+
className: `${form.titleClass ? form.titleClass : 'title-semibold-4'} mb0 ${i ? 'mt-3' : ''}`,
|
|
41628
41674
|
children: form.sectionLabel ? getSectionLabel(form.sectionLabel, values) : form.label ? getInputLabel(form, values) : camelCaseToTitle(k)
|
|
41629
41675
|
}) : null, /*#__PURE__*/jsxRuntime.jsx(antd.Form.List, {
|
|
41630
41676
|
name: formId,
|
|
41631
|
-
children: (fields,
|
|
41632
|
-
|
|
41633
|
-
|
|
41634
|
-
|
|
41635
|
-
} = _ref;
|
|
41677
|
+
children: (fields, {
|
|
41678
|
+
add,
|
|
41679
|
+
remove
|
|
41680
|
+
}) => {
|
|
41636
41681
|
const formData = form.repeatable ? values[formId] || [] : values[formId] ? [values[formId]] : [];
|
|
41637
41682
|
if (fields.length === 0) {
|
|
41638
41683
|
const formInputs = form.inputs;
|
|
@@ -41683,7 +41728,7 @@ function renderRepeatable(options, k, setValues, values, excludedKeys, i, formTi
|
|
|
41683
41728
|
padding: '0px 5px',
|
|
41684
41729
|
color: '#2E90FA'
|
|
41685
41730
|
},
|
|
41686
|
-
children:
|
|
41731
|
+
children: `#${field.name + 1}`
|
|
41687
41732
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
41688
41733
|
className: "remove-button-for-repeatable",
|
|
41689
41734
|
children: (formData.filter(k => Object.keys(k).length > 0).length >= 1 || fields.length > 1) && (typeof form.canDelete !== 'function' || form.canDelete(Array.isArray(values[formId]) ? values[formId][field.name] || {} : values[formId] || {})) ? /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
@@ -41705,8 +41750,8 @@ function renderRepeatable(options, k, setValues, values, excludedKeys, i, formTi
|
|
|
41705
41750
|
const inputId = input.dataId || inp;
|
|
41706
41751
|
const inputValues = Array.isArray(values[formId]) ? values[formId][field.name] || {} : values[formId] || {};
|
|
41707
41752
|
const value = inputValues[inputId];
|
|
41708
|
-
const commentValue = inputValues[
|
|
41709
|
-
const inputData = getData(formId, input, value, commentValue,
|
|
41753
|
+
const commentValue = inputValues[`${inputId}Comment`];
|
|
41754
|
+
const inputData = getData(formId, input, value, commentValue, `${formId}[${field.name}].${inputId}`, `${formId}.${inputId}`);
|
|
41710
41755
|
const subtitles = form.subtitles || null;
|
|
41711
41756
|
inputData.repeatIndex = field.name;
|
|
41712
41757
|
inputData.inputName = inputId;
|
|
@@ -41727,59 +41772,64 @@ function renderRepeatable(options, k, setValues, values, excludedKeys, i, formTi
|
|
|
41727
41772
|
message: requiredRule.message || ''
|
|
41728
41773
|
});
|
|
41729
41774
|
}
|
|
41730
|
-
return showHideInput(input, values, field.name, inputValues, setValues,
|
|
41775
|
+
return showHideInput(input, values, field.name, inputValues, setValues, `${formId}[${field.name}].${inputId}`) ? /*#__PURE__*/jsxRuntime.jsx(React__default["default"].Fragment, {
|
|
41731
41776
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
41732
|
-
className: form.repeatable ?
|
|
41777
|
+
className: form.repeatable ? `inputs` : "",
|
|
41733
41778
|
children: [getSubtitles(subtitles, input.position, values, field.name, inputValues), ['h2', 'h3', 'h4', 'h5', 'h6'].includes(input.type) ? getInputHeadLines(input.type, i, input, values) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
41734
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item,
|
|
41735
|
-
|
|
41736
|
-
|
|
41737
|
-
|
|
41738
|
-
|
|
41739
|
-
|
|
41740
|
-
|
|
41741
|
-
|
|
41742
|
-
|
|
41743
|
-
|
|
41744
|
-
|
|
41745
|
-
|
|
41746
|
-
|
|
41747
|
-
if (f.response) {
|
|
41748
|
-
return f.response;
|
|
41779
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
41780
|
+
...field,
|
|
41781
|
+
required: inputData.rules && inputData.rules instanceof Array && inputData.rules.filter(r => r.required).length > 0 ? true : false,
|
|
41782
|
+
...(['total100', 'group'].includes(input.type) ? {} : {
|
|
41783
|
+
name: [field.name, inputId],
|
|
41784
|
+
fieldKey: [field.fieldKey, inputId],
|
|
41785
|
+
initialValue: inputData.value
|
|
41786
|
+
}),
|
|
41787
|
+
...(['upload'].includes(input.type) ? {
|
|
41788
|
+
valuePropName: "fileList",
|
|
41789
|
+
getValueFromEvent: e => {
|
|
41790
|
+
if (Array.isArray(e)) {
|
|
41791
|
+
return e;
|
|
41749
41792
|
}
|
|
41750
|
-
return f
|
|
41751
|
-
|
|
41752
|
-
|
|
41753
|
-
|
|
41793
|
+
return e && e.fileList && e.fileList.map(f => {
|
|
41794
|
+
if (f.response) {
|
|
41795
|
+
return f.response;
|
|
41796
|
+
}
|
|
41797
|
+
return f;
|
|
41798
|
+
});
|
|
41799
|
+
}
|
|
41800
|
+
} : {}),
|
|
41754
41801
|
style: input.showOnView === false ? {
|
|
41755
41802
|
display: 'none'
|
|
41756
|
-
} : {}
|
|
41757
|
-
|
|
41758
|
-
|
|
41759
|
-
|
|
41760
|
-
|
|
41761
|
-
|
|
41762
|
-
|
|
41763
|
-
|
|
41764
|
-
|
|
41765
|
-
|
|
41766
|
-
|
|
41767
|
-
|
|
41803
|
+
} : {},
|
|
41804
|
+
...(['switch'].includes(input.type) ? {
|
|
41805
|
+
labelCol: {
|
|
41806
|
+
span: 20
|
|
41807
|
+
},
|
|
41808
|
+
style: {
|
|
41809
|
+
...(input.showOnView === false ? {
|
|
41810
|
+
display: 'none'
|
|
41811
|
+
} : {}),
|
|
41812
|
+
flexDirection: 'row',
|
|
41813
|
+
justifyContent: 'space-between'
|
|
41814
|
+
}
|
|
41815
|
+
} : {}),
|
|
41768
41816
|
label: getInputLabel(input, values),
|
|
41769
41817
|
rules: rules,
|
|
41770
|
-
className: input.comment ?
|
|
41818
|
+
className: input.comment ? `with-comment i-${input.type}` : `i-${input.type}`,
|
|
41771
41819
|
extra: input.comment ? /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
41772
41820
|
disabled: inputData.props.disabled,
|
|
41773
41821
|
type: "link",
|
|
41774
41822
|
onClick: () => {
|
|
41775
41823
|
const inputValues = Array.isArray(values[formId]) ? values[formId][field.name] || {} : values[formId] || {};
|
|
41776
|
-
inputValues[
|
|
41824
|
+
inputValues[`${inputData.inputName}Comment`] = !inputData.commentValue ? '' : undefined;
|
|
41777
41825
|
if (Array.isArray(values[formId])) {
|
|
41778
41826
|
values[formId][field.name] = inputValues;
|
|
41779
41827
|
} else {
|
|
41780
41828
|
values[formId] = inputValues;
|
|
41781
41829
|
}
|
|
41782
|
-
setValues(
|
|
41830
|
+
setValues({
|
|
41831
|
+
...values
|
|
41832
|
+
});
|
|
41783
41833
|
},
|
|
41784
41834
|
children: t(!inputData.commentValue ? 'Add Comment' : 'Remove Comment')
|
|
41785
41835
|
}) : null,
|
|
@@ -41796,9 +41846,9 @@ function renderRepeatable(options, k, setValues, values, excludedKeys, i, formTi
|
|
|
41796
41846
|
getAppHeader,
|
|
41797
41847
|
getApiBaseUrl
|
|
41798
41848
|
}) : console.log(input)
|
|
41799
|
-
})
|
|
41800
|
-
name: [field.name,
|
|
41801
|
-
fieldKey: [field.fieldKey,
|
|
41849
|
+
}), input.comment ? /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
41850
|
+
name: [field.name, `${inputData.inputName}Comment`],
|
|
41851
|
+
fieldKey: [field.fieldKey, `${inputData.inputName}Comment`],
|
|
41802
41852
|
initialValue: inputData.commentValue,
|
|
41803
41853
|
hidden: !inputData.commentValue,
|
|
41804
41854
|
children: inputTypeComponent.comment(inputData, {
|
|
@@ -41812,10 +41862,10 @@ function renderRepeatable(options, k, setValues, values, excludedKeys, i, formTi
|
|
|
41812
41862
|
}) : null]
|
|
41813
41863
|
})]
|
|
41814
41864
|
}, ii)
|
|
41815
|
-
},
|
|
41865
|
+
}, `${i}${ii}`) : null;
|
|
41816
41866
|
})
|
|
41817
41867
|
})]
|
|
41818
|
-
},
|
|
41868
|
+
}, `${formId}-${field.name}`)), form.repeatable ? /*#__PURE__*/jsxRuntime.jsxs(antd.Button, {
|
|
41819
41869
|
type: "dashed",
|
|
41820
41870
|
style: {
|
|
41821
41871
|
margin: '10px 0px 30px',
|
|
@@ -41844,7 +41894,7 @@ const getGrouContent = (form, values, i, formId, excludedKeys, getData, setValue
|
|
|
41844
41894
|
const hasLabel = label && (typeof label === 'string' && (label || '').trim() !== '' || typeof label === 'object') ? true : false;
|
|
41845
41895
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
41846
41896
|
children: [hasLabel ? /*#__PURE__*/jsxRuntime.jsx("h3", {
|
|
41847
|
-
className:
|
|
41897
|
+
className: `${form.titleClass ? form.titleClass : 'title-semibold-4'} ${i ? 'mt-3 mb-1' : ''}`,
|
|
41848
41898
|
children: label
|
|
41849
41899
|
}) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
41850
41900
|
className: hasLabel ? "mb-4" : "",
|
|
@@ -41853,8 +41903,8 @@ const getGrouContent = (form, values, i, formId, excludedKeys, getData, setValue
|
|
|
41853
41903
|
const inputId = input.dataId || inp;
|
|
41854
41904
|
const inputValues = Array.isArray(values[formId]) ? values[formId] || {} : values[formId] || {};
|
|
41855
41905
|
const value = inputValues[inputId];
|
|
41856
|
-
const commentValue = inputValues[
|
|
41857
|
-
const inputData = getData(formId, input, value, commentValue,
|
|
41906
|
+
const commentValue = inputValues[`${inputId}Comment`];
|
|
41907
|
+
const inputData = getData(formId, input, value, commentValue, `${formId}.${inputId}`, `${formId}.${inputId}`);
|
|
41858
41908
|
const subtitles = form.subtitles || null;
|
|
41859
41909
|
inputData.repeatIndex = undefined;
|
|
41860
41910
|
inputData.inputName = inputId;
|
|
@@ -41875,58 +41925,62 @@ const getGrouContent = (form, values, i, formId, excludedKeys, getData, setValue
|
|
|
41875
41925
|
message: requiredRule.message || ''
|
|
41876
41926
|
});
|
|
41877
41927
|
}
|
|
41878
|
-
return showHideInput(input, values, undefined, inputValues, setValues,
|
|
41928
|
+
return showHideInput(input, values, undefined, inputValues, setValues, `${formId}.${inputId}`) ? /*#__PURE__*/jsxRuntime.jsx(React__default["default"].Fragment, {
|
|
41879
41929
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
41880
41930
|
children: [getSubtitles(subtitles, input.position, values, undefined, inputValues), ['h2', 'h3', 'h4', 'h5', 'h6'].includes(input.type) ? getInputHeadLines(input.type, i, input, values) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
41881
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item,
|
|
41882
|
-
required: inputData.rules && inputData.rules instanceof Array && inputData.rules.filter(r => r.required).length > 0 ? true : false
|
|
41883
|
-
|
|
41884
|
-
|
|
41885
|
-
|
|
41886
|
-
|
|
41887
|
-
|
|
41888
|
-
|
|
41889
|
-
|
|
41890
|
-
|
|
41891
|
-
|
|
41892
|
-
|
|
41893
|
-
return e && e.fileList && e.fileList.map(f => {
|
|
41894
|
-
if (f.response) {
|
|
41895
|
-
return f.response;
|
|
41931
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
41932
|
+
required: inputData.rules && inputData.rules instanceof Array && inputData.rules.filter(r => r.required).length > 0 ? true : false,
|
|
41933
|
+
...(['total100', 'group'].includes(input.type) ? {} : {
|
|
41934
|
+
name: [formId, inputId],
|
|
41935
|
+
fieldKey: [formId, inputId],
|
|
41936
|
+
initialValue: inputData.value
|
|
41937
|
+
}),
|
|
41938
|
+
...(['upload'].includes(input.type) ? {
|
|
41939
|
+
valuePropName: "fileList",
|
|
41940
|
+
getValueFromEvent: e => {
|
|
41941
|
+
if (Array.isArray(e)) {
|
|
41942
|
+
return e;
|
|
41896
41943
|
}
|
|
41897
|
-
return f
|
|
41898
|
-
|
|
41899
|
-
|
|
41900
|
-
|
|
41944
|
+
return e && e.fileList && e.fileList.map(f => {
|
|
41945
|
+
if (f.response) {
|
|
41946
|
+
return f.response;
|
|
41947
|
+
}
|
|
41948
|
+
return f;
|
|
41949
|
+
});
|
|
41950
|
+
}
|
|
41951
|
+
} : {}),
|
|
41901
41952
|
style: input.showOnView === false ? {
|
|
41902
41953
|
display: 'none'
|
|
41903
|
-
} : {}
|
|
41904
|
-
|
|
41905
|
-
|
|
41906
|
-
|
|
41907
|
-
|
|
41908
|
-
|
|
41909
|
-
|
|
41910
|
-
|
|
41911
|
-
|
|
41912
|
-
|
|
41913
|
-
|
|
41914
|
-
|
|
41954
|
+
} : {},
|
|
41955
|
+
...(['switch'].includes(input.type) ? {
|
|
41956
|
+
labelCol: {
|
|
41957
|
+
span: 20
|
|
41958
|
+
},
|
|
41959
|
+
style: {
|
|
41960
|
+
...(input.showOnView === false ? {
|
|
41961
|
+
display: 'none'
|
|
41962
|
+
} : {}),
|
|
41963
|
+
flexDirection: 'row',
|
|
41964
|
+
justifyContent: 'space-between'
|
|
41965
|
+
}
|
|
41966
|
+
} : {}),
|
|
41915
41967
|
label: getInputLabel(input, values),
|
|
41916
41968
|
rules: rules,
|
|
41917
|
-
className: input.comment ?
|
|
41969
|
+
className: input.comment ? `with-comment i-${input.type}` : `i-${input.type}`,
|
|
41918
41970
|
extra: input.comment ? /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
41919
41971
|
disabled: inputData.props.disabled,
|
|
41920
41972
|
type: "link",
|
|
41921
41973
|
onClick: () => {
|
|
41922
41974
|
const inputValues = Array.isArray(values[formId]) ? values[formId] || {} : values[formId] || {};
|
|
41923
|
-
inputValues[
|
|
41975
|
+
inputValues[`${inputData.inputName}Comment`] = !inputData.commentValue ? '' : undefined;
|
|
41924
41976
|
if (Array.isArray(values[formId])) {
|
|
41925
41977
|
values[formId] = inputValues;
|
|
41926
41978
|
} else {
|
|
41927
41979
|
values[formId] = inputValues;
|
|
41928
41980
|
}
|
|
41929
|
-
setValues(
|
|
41981
|
+
setValues({
|
|
41982
|
+
...values
|
|
41983
|
+
});
|
|
41930
41984
|
},
|
|
41931
41985
|
children: t(!inputData.commentValue ? 'Add Comment' : 'Remove Comment')
|
|
41932
41986
|
}) : null,
|
|
@@ -41941,9 +41995,9 @@ const getGrouContent = (form, values, i, formId, excludedKeys, getData, setValue
|
|
|
41941
41995
|
getAppHeader,
|
|
41942
41996
|
getApiBaseUrl
|
|
41943
41997
|
}) : console.log(input)
|
|
41944
|
-
})
|
|
41945
|
-
name: [formId,
|
|
41946
|
-
fieldKey: [formId,
|
|
41998
|
+
}), input.comment ? /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
41999
|
+
name: [formId, `${inputData.inputName}Comment`],
|
|
42000
|
+
fieldKey: [formId, `${inputData.inputName}Comment`],
|
|
41947
42001
|
initialValue: inputData.commentValue,
|
|
41948
42002
|
hidden: !inputData.commentValue,
|
|
41949
42003
|
children: inputTypeComponent.comment(inputData, {
|
|
@@ -41957,7 +42011,7 @@ const getGrouContent = (form, values, i, formId, excludedKeys, getData, setValue
|
|
|
41957
42011
|
}) : null]
|
|
41958
42012
|
})]
|
|
41959
42013
|
}, ii)
|
|
41960
|
-
},
|
|
42014
|
+
}, `${i}${ii}`) : null;
|
|
41961
42015
|
})
|
|
41962
42016
|
})]
|
|
41963
42017
|
});
|
|
@@ -53859,7 +53913,6 @@ function useAdminTable({
|
|
|
53859
53913
|
defaultPageSize: defaultPageSize || 20,
|
|
53860
53914
|
getRedirectLink
|
|
53861
53915
|
});
|
|
53862
|
-
console.log(filter, "filter.activeFilters");
|
|
53863
53916
|
const activeTab = React.useMemo(() => filter.activeFilters.activeTab, [filter.activeFilters]);
|
|
53864
53917
|
const canClearSearch = React.useMemo(() => {
|
|
53865
53918
|
return !!filter.activeFilters.search;
|
|
@@ -54939,6 +54992,9 @@ const getAdminLevelName = (data, level) => {
|
|
|
54939
54992
|
const entry = Object.values(data || {}).find(item => item.level === level);
|
|
54940
54993
|
return entry?.name || "-";
|
|
54941
54994
|
};
|
|
54995
|
+
const getAdminLevel = (data, level) => {
|
|
54996
|
+
return Object.values(data || {})?.find(item => item.level === level);
|
|
54997
|
+
};
|
|
54942
54998
|
|
|
54943
54999
|
const getColumns$6 = ({
|
|
54944
55000
|
t,
|
|
@@ -55023,7 +55079,8 @@ const getColumns$6 = ({
|
|
|
55023
55079
|
className: "daf-default-cell"
|
|
55024
55080
|
});
|
|
55025
55081
|
}
|
|
55026
|
-
const
|
|
55082
|
+
const categories = [...(options?.locationCategories || []), ...(options?.productionSiteCategories || [])];
|
|
55083
|
+
const category = findOptions(value, categories) || "-";
|
|
55027
55084
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
55028
55085
|
title: category,
|
|
55029
55086
|
children: category
|
|
@@ -55041,7 +55098,7 @@ const getColumns$6 = ({
|
|
|
55041
55098
|
className: "daf-default-cell"
|
|
55042
55099
|
});
|
|
55043
55100
|
}
|
|
55044
|
-
const country = findOptions(value, selectOptions?.
|
|
55101
|
+
const country = findOptions(value, selectOptions?.countries || []) || "-";
|
|
55045
55102
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
55046
55103
|
title: country,
|
|
55047
55104
|
children: country
|
|
@@ -55197,7 +55254,8 @@ const getColumns$5 = ({
|
|
|
55197
55254
|
key: "category",
|
|
55198
55255
|
show: true,
|
|
55199
55256
|
render: (value, all) => {
|
|
55200
|
-
const
|
|
55257
|
+
const categories = [...(selectOptions?.locationCategories || []), ...(selectOptions?.productionSiteCategories || [])];
|
|
55258
|
+
const label = findOptions(value, categories);
|
|
55201
55259
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
55202
55260
|
title: label,
|
|
55203
55261
|
children: label
|
|
@@ -55209,7 +55267,7 @@ const getColumns$5 = ({
|
|
|
55209
55267
|
key: "country",
|
|
55210
55268
|
show: true,
|
|
55211
55269
|
render: (value, all) => {
|
|
55212
|
-
const label = findOptions(value, selectOptions?.
|
|
55270
|
+
const label = findOptions(value, selectOptions?.countries);
|
|
55213
55271
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
55214
55272
|
title: label,
|
|
55215
55273
|
children: label
|
|
@@ -55271,6 +55329,11 @@ function CombineLocationModal({
|
|
|
55271
55329
|
} = useToken$5();
|
|
55272
55330
|
const [MainForm] = antd.Form.useForm();
|
|
55273
55331
|
const [isDisabled, setIsDisabled] = React.useState(true);
|
|
55332
|
+
|
|
55333
|
+
// Watch form values for cross-filtering
|
|
55334
|
+
const selectedCountry = antd.Form.useWatch('country', MainForm);
|
|
55335
|
+
const selectedProvince = antd.Form.useWatch('administrativeLevel1', MainForm);
|
|
55336
|
+
const selectedTerritory = antd.Form.useWatch('administrativeLevel2', MainForm);
|
|
55274
55337
|
const columns = React.useMemo(() => {
|
|
55275
55338
|
return getColumns$5({
|
|
55276
55339
|
t,
|
|
@@ -55280,6 +55343,29 @@ function CombineLocationModal({
|
|
|
55280
55343
|
entity
|
|
55281
55344
|
});
|
|
55282
55345
|
}, [selectedLocations, t, selectOptions, module, entity]);
|
|
55346
|
+
const categories = [...(selectOptions?.locationCategories || []), ...(selectOptions?.productionSiteCategories || [])];
|
|
55347
|
+
const getFilteredLocations = () => {
|
|
55348
|
+
return selectedLocations.filter(location => {
|
|
55349
|
+
if (selectedCountry && location.country !== selectedCountry) {
|
|
55350
|
+
return false;
|
|
55351
|
+
}
|
|
55352
|
+
if (selectedProvince) {
|
|
55353
|
+
const provinceData = getAdminLevel(location?.linking?.SCL, "level_1") || location?.linking?.SCL?.[location?.administrativeLevel1];
|
|
55354
|
+
const provinceCountry = provinceData?.country || location.country;
|
|
55355
|
+
if (provinceData?.id !== selectedProvince || selectedCountry && provinceCountry !== selectedCountry) {
|
|
55356
|
+
return false;
|
|
55357
|
+
}
|
|
55358
|
+
}
|
|
55359
|
+
if (selectedTerritory) {
|
|
55360
|
+
const territoryData = getAdminLevel(location?.linking?.SCL, "level_2") || location?.linking?.SCL?.[location?.administrativeLevel2];
|
|
55361
|
+
const territoryCountry = territoryData?.country || location.country;
|
|
55362
|
+
if (territoryData?.id !== selectedTerritory || selectedCountry && territoryCountry !== selectedCountry) {
|
|
55363
|
+
return false;
|
|
55364
|
+
}
|
|
55365
|
+
}
|
|
55366
|
+
return true;
|
|
55367
|
+
});
|
|
55368
|
+
};
|
|
55283
55369
|
const onSubmit = () => {
|
|
55284
55370
|
MainForm.validateFields().then(data => {
|
|
55285
55371
|
const ids = selectedLocations.map(location => location.id);
|
|
@@ -55334,10 +55420,54 @@ function CombineLocationModal({
|
|
|
55334
55420
|
form: MainForm,
|
|
55335
55421
|
clearOnDestroy: true,
|
|
55336
55422
|
className: "select-container",
|
|
55337
|
-
onValuesChange:
|
|
55338
|
-
|
|
55423
|
+
onValuesChange: changedValues => {
|
|
55424
|
+
if (changedValues.country !== undefined) {
|
|
55425
|
+
const currentValues = MainForm.getFieldsValue();
|
|
55426
|
+
const newCountry = changedValues.country;
|
|
55427
|
+
if (currentValues.administrativeLevel1) {
|
|
55428
|
+
const isProvinceValid = selectedLocations.some(location => {
|
|
55429
|
+
const provinceData = location?.linking?.SCL?.[location?.administrativeLevel1];
|
|
55430
|
+
return location.country === newCountry && provinceData?.id === currentValues.administrativeLevel1;
|
|
55431
|
+
});
|
|
55432
|
+
if (!isProvinceValid) {
|
|
55433
|
+
MainForm.setFieldsValue({
|
|
55434
|
+
administrativeLevel1: undefined,
|
|
55435
|
+
administrativeLevel2: undefined
|
|
55436
|
+
});
|
|
55437
|
+
}
|
|
55438
|
+
}
|
|
55439
|
+
if (currentValues.administrativeLevel2) {
|
|
55440
|
+
const isTerritoryValid = selectedLocations.some(location => {
|
|
55441
|
+
const territoryData = getAdminLevel(location?.linking?.SCL, "level_2") || location?.linking?.SCL?.[location?.administrativeLevel2];
|
|
55442
|
+
return location.country === newCountry && territoryData?.id === currentValues.administrativeLevel2;
|
|
55443
|
+
});
|
|
55444
|
+
if (!isTerritoryValid) {
|
|
55445
|
+
MainForm.setFieldsValue({
|
|
55446
|
+
administrativeLevel2: undefined
|
|
55447
|
+
});
|
|
55448
|
+
}
|
|
55449
|
+
}
|
|
55450
|
+
}
|
|
55451
|
+
if (changedValues.administrativeLevel1 !== undefined) {
|
|
55452
|
+
const currentValues = MainForm.getFieldsValue();
|
|
55453
|
+
const newProvince = changedValues.administrativeLevel1;
|
|
55454
|
+
if (currentValues.administrativeLevel2) {
|
|
55455
|
+
const isTerritoryValid = selectedLocations.some(location => {
|
|
55456
|
+
const provinceData = location?.linking?.SCL?.[location?.administrativeLevel1];
|
|
55457
|
+
const territoryData = getAdminLevel(location?.linking?.SCL, "level_2") || location?.linking?.SCL?.[location?.administrativeLevel2];
|
|
55458
|
+
return provinceData?.id === newProvince && territoryData?.id === currentValues.administrativeLevel2;
|
|
55459
|
+
});
|
|
55460
|
+
if (!isTerritoryValid) {
|
|
55461
|
+
MainForm.setFieldsValue({
|
|
55462
|
+
administrativeLevel2: undefined
|
|
55463
|
+
});
|
|
55464
|
+
}
|
|
55465
|
+
}
|
|
55466
|
+
}
|
|
55467
|
+
setIsDisabled(() => {
|
|
55339
55468
|
const values = MainForm.getFieldsValue();
|
|
55340
|
-
|
|
55469
|
+
const requiredFields = entity?.includes("location") ? ["id", "name", "category", "country", "administrativeLevel1", "administrativeLevel2"] : ["id", "name", "category", "country"];
|
|
55470
|
+
return requiredFields.some(field => values[field] === undefined);
|
|
55341
55471
|
});
|
|
55342
55472
|
},
|
|
55343
55473
|
style: {
|
|
@@ -55353,7 +55483,8 @@ function CombineLocationModal({
|
|
|
55353
55483
|
value: location?.id || "-"
|
|
55354
55484
|
};
|
|
55355
55485
|
}),
|
|
55356
|
-
placeholder: t("ID")
|
|
55486
|
+
placeholder: t("ID"),
|
|
55487
|
+
allowClear: true
|
|
55357
55488
|
})
|
|
55358
55489
|
}), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
55359
55490
|
className: "flex-1",
|
|
@@ -55367,23 +55498,25 @@ function CombineLocationModal({
|
|
|
55367
55498
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
55368
55499
|
options: selectedLocations.map(location => {
|
|
55369
55500
|
return {
|
|
55370
|
-
label: (
|
|
55501
|
+
label: (categories || []).find(option => option.value === location?.category)?.label || location?.category || "-",
|
|
55371
55502
|
value: location?.category || "-"
|
|
55372
55503
|
};
|
|
55373
55504
|
}).filter((option, index, self) => index === self.findIndex(o => o.value === option.value)),
|
|
55374
|
-
placeholder: t("Category")
|
|
55505
|
+
placeholder: t("Category"),
|
|
55506
|
+
allowClear: true
|
|
55375
55507
|
})
|
|
55376
55508
|
}), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
55377
55509
|
className: "flex-1",
|
|
55378
55510
|
name: "country",
|
|
55379
55511
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
55380
|
-
options:
|
|
55512
|
+
options: getFilteredLocations().map(location => {
|
|
55381
55513
|
return {
|
|
55382
|
-
label: (selectOptions?.
|
|
55514
|
+
label: (selectOptions?.countries || []).find(option => option.value === location?.country)?.label || location?.country || "-",
|
|
55383
55515
|
value: location?.country || "-"
|
|
55384
55516
|
};
|
|
55385
55517
|
}).filter((option, index, self) => index === self.findIndex(o => o.value === option.value)),
|
|
55386
|
-
placeholder: t("admin::country")
|
|
55518
|
+
placeholder: t("admin::country"),
|
|
55519
|
+
allowClear: true
|
|
55387
55520
|
})
|
|
55388
55521
|
}), entity?.includes("location") && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
55389
55522
|
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
@@ -55391,26 +55524,28 @@ function CombineLocationModal({
|
|
|
55391
55524
|
name: "administrativeLevel1",
|
|
55392
55525
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
55393
55526
|
placeholder: t("Province"),
|
|
55394
|
-
options:
|
|
55395
|
-
const _data =
|
|
55527
|
+
options: getFilteredLocations().map(location => {
|
|
55528
|
+
const _data = getAdminLevel(location?.linking?.SCL, "level_1") || location?.linking?.SCL?.[location?.administrativeLevel1];
|
|
55396
55529
|
return {
|
|
55397
55530
|
label: _data?.name || "-",
|
|
55398
55531
|
value: _data?.id || "-"
|
|
55399
55532
|
};
|
|
55400
|
-
}).filter((option, index, self) => index === self.findIndex(o => o.value === option.value))
|
|
55533
|
+
}).filter((option, index, self) => index === self.findIndex(o => o.value === option.value) && option.value !== "-"),
|
|
55534
|
+
allowClear: true
|
|
55401
55535
|
})
|
|
55402
55536
|
}), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
55403
55537
|
className: "flex-1",
|
|
55404
55538
|
name: "administrativeLevel2",
|
|
55405
55539
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
55406
55540
|
placeholder: t("Territory"),
|
|
55407
|
-
options:
|
|
55408
|
-
const _data =
|
|
55541
|
+
options: getFilteredLocations().map(location => {
|
|
55542
|
+
const _data = getAdminLevel(location?.linking?.SCL, "level_2") || location?.linking?.SCL?.[location?.administrativeLevel2];
|
|
55409
55543
|
return {
|
|
55410
55544
|
label: _data?.name || "-",
|
|
55411
55545
|
value: _data?.id || "-"
|
|
55412
55546
|
};
|
|
55413
|
-
}).filter((option, index, self) => index === self.findIndex(o => o.value === option.value))
|
|
55547
|
+
}).filter((option, index, self) => index === self.findIndex(o => o.value === option.value) && option.value !== "-"),
|
|
55548
|
+
allowClear: true
|
|
55414
55549
|
})
|
|
55415
55550
|
})]
|
|
55416
55551
|
})]
|
|
@@ -55529,13 +55664,8 @@ function LocationTable(_ref) {
|
|
|
55529
55664
|
refetchTrigger
|
|
55530
55665
|
});
|
|
55531
55666
|
const selectOptions = React.useMemo(() => {
|
|
55532
|
-
|
|
55533
|
-
|
|
55534
|
-
category: (_config$options = config.options) === null || _config$options === void 0 ? void 0 : _config$options.category,
|
|
55535
|
-
country: (_config$options2 = config.options) === null || _config$options2 === void 0 ? void 0 : _config$options2.countries,
|
|
55536
|
-
sources: []
|
|
55537
|
-
};
|
|
55538
|
-
}, [config.options]);
|
|
55667
|
+
return options;
|
|
55668
|
+
}, [options]);
|
|
55539
55669
|
const columns = React.useMemo(() => {
|
|
55540
55670
|
return getColumns$6({
|
|
55541
55671
|
t,
|
|
@@ -55781,11 +55911,7 @@ const getColumns$4 = ({
|
|
|
55781
55911
|
className: "daf-default-cell"
|
|
55782
55912
|
});
|
|
55783
55913
|
}
|
|
55784
|
-
|
|
55785
|
-
value,
|
|
55786
|
-
options
|
|
55787
|
-
});
|
|
55788
|
-
const category = findOptions(value, options?.categoriesOptions || []) || "-";
|
|
55914
|
+
const category = findOptions(value, options?.categoriesOptions || options?.category || []) || "-";
|
|
55789
55915
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
55790
55916
|
title: category,
|
|
55791
55917
|
children: category
|
|
@@ -55925,21 +56051,6 @@ const getColumns$4 = ({
|
|
|
55925
56051
|
return cols.filter(c => c[show]);
|
|
55926
56052
|
};
|
|
55927
56053
|
|
|
55928
|
-
const mapToSelectOptions = (items, valueKey, selectOptions, optionKey, customMapper = null) => {
|
|
55929
|
-
return items.map(item => {
|
|
55930
|
-
if (customMapper) {
|
|
55931
|
-
return customMapper(item);
|
|
55932
|
-
}
|
|
55933
|
-
const value = item?.[valueKey] || "-";
|
|
55934
|
-
const optionsList = selectOptions?.[optionKey] || [];
|
|
55935
|
-
const foundOption = optionsList.find(option => option.value === value);
|
|
55936
|
-
return {
|
|
55937
|
-
label: foundOption?.label || value,
|
|
55938
|
-
value: value
|
|
55939
|
-
};
|
|
55940
|
-
}).filter((option, index, self) => index === self.findIndex(o => o.value === option.value));
|
|
55941
|
-
};
|
|
55942
|
-
|
|
55943
56054
|
const getColumns$3 = ({
|
|
55944
56055
|
t,
|
|
55945
56056
|
selectOptions,
|
|
@@ -55974,7 +56085,11 @@ const getColumns$3 = ({
|
|
|
55974
56085
|
key: "category",
|
|
55975
56086
|
show: true,
|
|
55976
56087
|
render: (value, all) => {
|
|
55977
|
-
|
|
56088
|
+
console.log({
|
|
56089
|
+
value,
|
|
56090
|
+
selectOptions
|
|
56091
|
+
});
|
|
56092
|
+
const label = findOptions(value, selectOptions?.categoriesOptions || selectOptions?.category || []);
|
|
55978
56093
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
55979
56094
|
title: label,
|
|
55980
56095
|
children: label
|
|
@@ -55986,7 +56101,7 @@ const getColumns$3 = ({
|
|
|
55986
56101
|
key: "country",
|
|
55987
56102
|
show: true,
|
|
55988
56103
|
render: (value, all) => {
|
|
55989
|
-
const label = findOptions(value, selectOptions?.
|
|
56104
|
+
const label = findOptions(value, selectOptions?.countries || []);
|
|
55990
56105
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
55991
56106
|
title: label,
|
|
55992
56107
|
children: label
|
|
@@ -56057,6 +56172,28 @@ function CombineSubjectsModal({
|
|
|
56057
56172
|
entity
|
|
56058
56173
|
});
|
|
56059
56174
|
}, [selectedSubjects, t, selectOptions, module, entity]);
|
|
56175
|
+
const countryOptions = React.useMemo(() => {
|
|
56176
|
+
return [...new Set(selectedSubjects.map(subject => subject?.country))].map(country => {
|
|
56177
|
+
console.log({
|
|
56178
|
+
country
|
|
56179
|
+
});
|
|
56180
|
+
return {
|
|
56181
|
+
label: findOptions(country, selectOptions?.countries || []),
|
|
56182
|
+
value: country || "-"
|
|
56183
|
+
};
|
|
56184
|
+
});
|
|
56185
|
+
}, [selectedSubjects, selectOptions]);
|
|
56186
|
+
const categoriesOptions = React.useMemo(() => {
|
|
56187
|
+
return [...new Set(selectedSubjects.map(subject => subject?.category))].map(country => {
|
|
56188
|
+
console.log({
|
|
56189
|
+
country
|
|
56190
|
+
});
|
|
56191
|
+
return {
|
|
56192
|
+
label: findOptions(country, selectOptions?.categoriesOptions || selectOptions?.category || []),
|
|
56193
|
+
value: country || "-"
|
|
56194
|
+
};
|
|
56195
|
+
});
|
|
56196
|
+
}, [selectedSubjects, selectOptions]);
|
|
56060
56197
|
const onSubmit = () => {
|
|
56061
56198
|
MainForm.validateFields().then(data => {
|
|
56062
56199
|
const ids = selectedSubjects.map(subject => subject.id);
|
|
@@ -56128,7 +56265,8 @@ function CombineSubjectsModal({
|
|
|
56128
56265
|
label: s?.datastakeId || "-",
|
|
56129
56266
|
value: s?.id || "-"
|
|
56130
56267
|
})),
|
|
56131
|
-
placeholder: t("ID")
|
|
56268
|
+
placeholder: t("ID"),
|
|
56269
|
+
allowClear: true
|
|
56132
56270
|
})
|
|
56133
56271
|
}), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
56134
56272
|
className: "flex-1",
|
|
@@ -56140,44 +56278,18 @@ function CombineSubjectsModal({
|
|
|
56140
56278
|
className: "flex-1",
|
|
56141
56279
|
name: "category",
|
|
56142
56280
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
56143
|
-
options:
|
|
56144
|
-
placeholder: t("Category")
|
|
56281
|
+
options: categoriesOptions,
|
|
56282
|
+
placeholder: t("Category"),
|
|
56283
|
+
allowClear: true
|
|
56145
56284
|
})
|
|
56146
56285
|
}), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
56147
56286
|
className: "flex-1",
|
|
56148
56287
|
name: "country",
|
|
56149
56288
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
56150
|
-
options:
|
|
56151
|
-
placeholder: t("admin::country")
|
|
56289
|
+
options: countryOptions,
|
|
56290
|
+
placeholder: t("admin::country"),
|
|
56291
|
+
allowClear: true
|
|
56152
56292
|
})
|
|
56153
|
-
}), entity.includes("location") && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
56154
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
56155
|
-
className: "flex-1",
|
|
56156
|
-
name: "administrativeLevel1",
|
|
56157
|
-
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
56158
|
-
placeholder: t("Province"),
|
|
56159
|
-
options: mapToSelectOptions(selectedSubjects, null, selectOptions, null, subject => {
|
|
56160
|
-
const _data = getAdminLevelName(subject?.linking?.SCL, "level_1");
|
|
56161
|
-
return {
|
|
56162
|
-
label: _data?.name || "-",
|
|
56163
|
-
value: _data?.id || "-"
|
|
56164
|
-
};
|
|
56165
|
-
})
|
|
56166
|
-
})
|
|
56167
|
-
}), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
56168
|
-
className: "flex-1",
|
|
56169
|
-
name: "administrativeLevel2",
|
|
56170
|
-
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
56171
|
-
placeholder: t("Territory"),
|
|
56172
|
-
options: mapToSelectOptions(selectedSubjects, null, selectOptions, null, subject => {
|
|
56173
|
-
const _data = getAdminLevelName(subject?.linking?.SCL, "level_2");
|
|
56174
|
-
return {
|
|
56175
|
-
label: _data?.name || "-",
|
|
56176
|
-
value: _data?.id || "-"
|
|
56177
|
-
};
|
|
56178
|
-
})
|
|
56179
|
-
})
|
|
56180
|
-
})]
|
|
56181
56293
|
})]
|
|
56182
56294
|
})]
|
|
56183
56295
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -56294,13 +56406,8 @@ function SubjectsTable(_ref) {
|
|
|
56294
56406
|
refetchTrigger
|
|
56295
56407
|
});
|
|
56296
56408
|
const selectOptions = React.useMemo(() => {
|
|
56297
|
-
|
|
56298
|
-
|
|
56299
|
-
category: (_config$options = config.options) === null || _config$options === void 0 ? void 0 : _config$options.category,
|
|
56300
|
-
country: (_config$options2 = config.options) === null || _config$options2 === void 0 ? void 0 : _config$options2.countries,
|
|
56301
|
-
sources: []
|
|
56302
|
-
};
|
|
56303
|
-
}, [config.options]);
|
|
56409
|
+
return options;
|
|
56410
|
+
}, [options]);
|
|
56304
56411
|
const columns = React.useMemo(() => {
|
|
56305
56412
|
return getColumns$4({
|
|
56306
56413
|
t,
|
|
@@ -59184,6 +59291,9 @@ function getAdminRoutes(config) {
|
|
|
59184
59291
|
userIsAdmin
|
|
59185
59292
|
} = config;
|
|
59186
59293
|
const APP_PREFIX = "APP_".concat(appName.toUpperCase());
|
|
59294
|
+
console.log({
|
|
59295
|
+
useAdminEventsConfig
|
|
59296
|
+
});
|
|
59187
59297
|
function DashboardWrapper() {
|
|
59188
59298
|
const dashboardConfig = useAdminDashboardConfig();
|
|
59189
59299
|
return /*#__PURE__*/jsxRuntime.jsx(AdminDashboardScreen, {
|