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.
Files changed (29) hide show
  1. package/build/favicon.ico +0 -0
  2. package/build/logo192.png +0 -0
  3. package/build/logo512.png +0 -0
  4. package/build/manifest.json +25 -0
  5. package/build/robots.txt +3 -0
  6. package/dist/components/index.js +671 -561
  7. package/dist/pages/index.js +58 -23
  8. package/dist/utils/index.js +67 -134
  9. package/package.json +1 -1
  10. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/columns.js +6 -5
  11. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +161 -73
  12. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/columns.js +3 -2
  13. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +26 -33
  14. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/column.js +3 -2
  15. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +2 -6
  16. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/columns.js +1 -2
  17. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +2 -6
  18. package/src/@daf/core/components/Screens/Admin/AdminTables/hook.js +0 -1
  19. package/src/@daf/core/components/Screens/Admin/adminRoutes.js +3 -1
  20. package/src/@daf/core/components/ViewForm/content.jsx +2 -0
  21. package/src/@daf/pages/Events/config.js +2 -11
  22. package/src/@daf/pages/Stakeholders/ArmedGroups/config.js +34 -5
  23. package/src/@daf/pages/View/index.jsx +1 -1
  24. package/src/constants/locales/en/translation.js +26 -10
  25. package/src/constants/locales/fr/translation.js +23 -75
  26. package/src/constants/locales/sp/translation.js +20 -61
  27. package/src/helpers/adminLevels.js +4 -0
  28. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/helper.js +0 -79
  29. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/helper.js +0 -21
@@ -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, _ref) => {
30834
- let {
30835
- add,
30836
- remove
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, _objectSpread2(_objectSpread2({}, values), _val));
30888
- setValues(_objectSpread2(_objectSpread2({}, values), {}, {
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 = _ref2 => {
30947
- var _form$meta;
30948
- let {
30949
- form,
30950
- values = {},
30951
- i,
30952
- formId,
30953
- excludedKeys,
30954
- getData,
30955
- setValues,
30956
- MainForm,
30957
- options,
30958
- plainForms,
30959
- setAddress,
30960
- onValuesChange,
30961
- allData,
30962
- changeInputMeta,
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 = (form === null || form === void 0 ? void 0 : form.type) === 'ajaxSubGroup' ? true : !!(form !== null && form !== void 0 && (_form$meta = form.meta) !== null && _form$meta !== void 0 && _form$meta.isSubGroup);
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
- var _form$meta2;
30975
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
30976
- children: [form !== null && form !== void 0 && (_form$meta2 = form.meta) !== null && _form$meta2 !== void 0 && _form$meta2.groupInfo ? /*#__PURE__*/jsxRuntime.jsx(GroupInfos, {
30977
- config: form.meta.groupInfo,
30978
- user: user,
30979
- t: t
30980
- }) : null, Object.keys(form.inputs || {}).filter(i => !excludedKeys.includes(i)).map((inp, ii) => {
30981
- var _ref3, _values$meta, _values$meta2, _input$meta, _inputData$rules, _input$meta2;
30982
- const isAjaxSubGroup = (form === null || form === void 0 ? void 0 : form.type) === "ajaxSubGroup";
30983
- const input = form.inputs[inp];
30984
- const inputId = input.dataId || inp;
30985
- const inputValues = notPartOfTheForm ? Array.isArray(values[formId]) ? values[formId] || {} : values[formId] || {} : values;
30986
- const value = inputValues[inputId];
30987
- const commentValue = inputValues["".concat(inputId, "Comment")];
30988
- const inputData = getData(formId, input, value, commentValue, "".concat(formId, ".").concat(inputId), "".concat(formId, ".").concat(inputId));
30989
- const subtitles = form.subtitles || null;
30990
- const inputMeta = notPartOfTheForm ? isAjaxSubGroup ? ((_ref3 = values[formId] || {}) === null || _ref3 === void 0 || (_ref3 = _ref3.meta) === null || _ref3 === void 0 || (_ref3 = _ref3.inputs) === null || _ref3 === void 0 ? void 0 : _ref3[inputId]) || {} : (((values === null || values === void 0 || (_values$meta = values.meta) === null || _values$meta === void 0 ? void 0 : _values$meta.inputs) || {})[formId] || {})[inputId] || {} : ((values === null || values === void 0 || (_values$meta2 = values.meta) === null || _values$meta2 === void 0 ? void 0 : _values$meta2.inputs) || {})[inputId] || {};
30991
- inputData.repeatIndex = undefined;
30992
- inputData.inputName = inputId;
30993
- inputData.repeatValues = inputValues;
30994
- if (inputData.groupInputs && Array.isArray(inputData.groupInputs)) {
30995
- inputData.groupInputs = inputData.groupInputs.map(gpI => {
30996
- gpI.data.inputName = gpI.data.name;
30997
- gpI.data.repeatIndex = undefined;
30998
- gpI.data.name = formId;
30999
- return gpI;
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 isRisk = isRiskComment(inputData);
31003
- const isHighlighted = highlightMandatory && (input === null || input === void 0 || (_input$meta = input.meta) === null || _input$meta === void 0 ? void 0 : _input$meta.mandatory) && inputIsEmpty(input, inputValues, inputMeta);
31004
- const btnOnClick = () => {
31005
- if (typeof inputData.commentValue === 'string') {
31006
- onValuesChange({}, _objectSpread2(_objectSpread2({}, values), {}, {
31007
- ["".concat(inputData.inputName)]: null
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["".concat(inputData.inputName, "Comment")] = typeof inputData.commentValue !== 'string' ? '' : null;
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(_objectSpread2({}, values));
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
- return showHideInput$1(input, values, undefined, inputValues, setValues) ? /*#__PURE__*/jsxRuntime.jsx(React__default["default"].Fragment, {
31050
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
31051
- style: {
31052
- position: 'relative'
31053
- },
31054
- 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, {
31055
- input: input,
31056
- inputTypeComponent: inputTypeComponent$1,
31057
- inputData: inputData,
31058
- MainForm: MainForm,
31059
- options: options,
31060
- setValues: setValues,
31061
- formId: formId,
31062
- inputId: inputId,
31063
- inputOnBlur: inputOnBlur,
31064
- values: values,
31065
- getInputLabel: getInputLabel$1,
31066
- plainForms: plainForms,
31067
- setAddress: setAddress,
31068
- btnOnClick: btnOnClick,
31069
- btnOnClick2: btnOnClick2,
31070
- locationName: (allData || {}).locationName,
31071
- subGroupTitle: (allData || {}).subGroupTitle
31072
- }) : /*#__PURE__*/jsxRuntime.jsx(GroupContentFormItem, {
31073
- values,
31074
- formId,
31075
- setValues,
31076
- MainForm,
31077
- options,
31078
- plainForms,
31079
- setAddress,
31080
- inputData,
31081
- inputId,
31082
- input,
31083
- rules,
31084
- inputMeta,
31085
- changeInputMeta,
31086
- notPartOfTheForm,
31087
- isAjaxSubGroup,
31088
- isHighlighted
31089
- })]
31090
- }, ii)
31091
- }, "".concat(i).concat(ii)) : null;
31092
- })]
31093
- });
31094
- };
31095
- const isNa = (formValues === null || formValues === void 0 ? void 0 : formValues.valuation) === 'na';
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: "".concat(form.titleClass ? form.titleClass : 'title-semibold-4', " ").concat(i ? 'mt-3 mb-1' : ''),
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: "repeatable ".concat(hasLabel ? "mb-4" : ""),
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 !== null && formValues !== void 0 && formValues.noPlanningRequired ? /*#__PURE__*/jsxRuntime.jsx(GroupInfoHOC, {
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("No ".concat((formValues === null || formValues === void 0 ? void 0 : formValues.stage) || 'planning', " required"))
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 = _ref4 => {
31124
- var _rules$find, _inputMeta$reviews, _input$meta3, _values$formId, _input$meta4, _input$meta7, _input$meta8, _input$meta9, _values$meta10, _values$meta11, _values$parent, _input$meta10, _input$meta11, _inputData$value, _input$meta12, _input$meta13, _inputMeta$comment, _lastReview$comment, _lastReview$reviewer, _lastReview$reviewer2;
31125
- let {
31126
- values,
31127
- formId,
31128
- setValues,
31129
- MainForm,
31130
- options,
31131
- plainForms,
31132
- setAddress,
31133
- inputData,
31134
- inputId,
31135
- input,
31136
- rules,
31137
- inputMeta,
31138
- changeInputMeta,
31139
- notPartOfTheForm = true,
31140
- isAjaxSubGroup,
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(!!(inputMeta !== null && inputMeta !== void 0 && inputMeta.comment));
31157
- let maxRule = (_rules$find = rules.find(rule => rule.max)) === null || _rules$find === void 0 ? void 0 : _rules$find.max;
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 = ((inputMeta === null || inputMeta === void 0 ? void 0 : inputMeta.reviews) || [])[((inputMeta === null || inputMeta === void 0 || (_inputMeta$reviews = inputMeta.reviews) === null || _inputMeta$reviews === void 0 ? void 0 : _inputMeta$reviews.length) || 0) - 1];
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
- var _values$meta5;
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]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31189
+ [formId]: {
31190
+ ..._defaultData,
31188
31191
  meta: {
31189
- inputs: _objectSpread2(_objectSpread2({}, (_defaultData === null || _defaultData === void 0 || (_defaultData$meta = _defaultData.meta) === null || _defaultData$meta === void 0 ? void 0 : _defaultData$meta.inputs) || {}), {}, {
31190
- [inputId]: _objectSpread2(_objectSpread2({}, ((_defaultData === null || _defaultData === void 0 || (_defaultData$meta2 = _defaultData.meta) === null || _defaultData$meta2 === void 0 ? void 0 : _defaultData$meta2.inputs) || {})[inputId] || {}), {}, {
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: _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31203
- [inputId]: _objectSpread2(_objectSpread2({}, _defaultMeta[inputId] || {}), {}, {
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 === null || lastReview === void 0 ? void 0 : lastReview.reviewSuccess;
31230
+ const reviewSuccess = lastReview?.reviewSuccess;
31224
31231
  if (notPartOfTheForm || isAjaxSubGroup) {
31225
- var _values$meta6;
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]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31239
+ [formId]: {
31240
+ ..._defaultData,
31235
31241
  meta: {
31236
- inputs: _objectSpread2(_objectSpread2({}, (_defaultData === null || _defaultData === void 0 || (_defaultData$meta3 = _defaultData.meta) === null || _defaultData$meta3 === void 0 ? void 0 : _defaultData$meta3.inputs) || {}), {}, {
31237
- [inputId]: _objectSpread2(_objectSpread2({}, ((_defaultData === null || _defaultData === void 0 || (_defaultData$meta4 = _defaultData.meta) === null || _defaultData$meta4 === void 0 ? void 0 : _defaultData$meta4.inputs) || {})[inputId] || {}), {}, {
31238
- reviews: reviewSuccess ? ((((_defaultData === null || _defaultData === void 0 || (_defaultData$meta5 = _defaultData.meta) === null || _defaultData$meta5 === void 0 ? void 0 : _defaultData$meta5.inputs) || {})[inputId] || {}).reviews || []).filter(v => v.createdAt !== lastReview.createdAt) : [...((((_defaultData === null || _defaultData === void 0 || (_defaultData$meta6 = _defaultData.meta) === null || _defaultData$meta6 === void 0 ? void 0 : _defaultData$meta6.inputs) || {})[inputId] || {}).reviews || []), {
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: _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31254
- [inputId]: _objectSpread2(_objectSpread2({}, _defaultMeta[inputId] || {}), {}, {
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: _objectSpread2(_objectSpread2({}, inputMeta), {}, {
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 === null || lastReview === void 0 ? void 0 : lastReview.reviewError;
31293
+ const reviewError = lastReview?.reviewError;
31283
31294
  if (notPartOfTheForm || isAjaxSubGroup) {
31284
- var _values$meta7;
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]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31302
+ [formId]: {
31303
+ ..._defaultData,
31294
31304
  meta: {
31295
- inputs: _objectSpread2(_objectSpread2({}, (_defaultData === null || _defaultData === void 0 || (_defaultData$meta7 = _defaultData.meta) === null || _defaultData$meta7 === void 0 ? void 0 : _defaultData$meta7.inputs) || {}), {}, {
31296
- [inputId]: _objectSpread2(_objectSpread2({}, ((_defaultData === null || _defaultData === void 0 || (_defaultData$meta8 = _defaultData.meta) === null || _defaultData$meta8 === void 0 ? void 0 : _defaultData$meta8.inputs) || {})[inputId] || {}), {}, {
31297
- reviews: reviewError ? ((((_defaultData === null || _defaultData === void 0 || (_defaultData$meta9 = _defaultData.meta) === null || _defaultData$meta9 === void 0 ? void 0 : _defaultData$meta9.inputs) || {})[inputId] || {}).reviews || []).filter(v => v.createdAt !== lastReview.createdAt) : [...((((_defaultData === null || _defaultData === void 0 || (_defaultData$meta10 = _defaultData.meta) === null || _defaultData$meta10 === void 0 ? void 0 : _defaultData$meta10.inputs) || {})[inputId] || {}).reviews || []), {
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: _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31314
- [inputId]: _objectSpread2(_objectSpread2({}, _defaultMeta[inputId] || {}), {}, {
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: _objectSpread2(_objectSpread2({}, inputMeta), {}, {
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 = (inputMeta === null || inputMeta === void 0 ? void 0 : inputMeta.notApplicable) && (input === null || input === void 0 || (_input$meta3 = input.meta) === null || _input$meta3 === void 0 ? void 0 : _input$meta3.requiredCommentOnNotApplicable) && (values === null || values === void 0 || (_values$formId = values[formId]) === null || _values$formId === void 0 ? void 0 : _values$formId.valuation) !== 'na';
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, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
31345
- required: inputData.rules && inputData.rules instanceof Array && inputData.rules.filter(r => r.required).length > 0 ? true : false
31346
- }, ['total100', 'group'].includes(input.type) ? {} : {
31347
- name: notPartOfTheForm ? [formId, inputId] : inputId,
31348
- fieldKey: notPartOfTheForm ? [formId, inputId] : inputId,
31349
- initialValue: notPartOfTheForm ? (values[formId] || {})[inputId] : values[inputId]
31350
- }), ['upload', 'imageUpload', 'videoUpload'].includes(input.type) ? {
31351
- valuePropName: "fileList",
31352
- getValueFromEvent: e => {
31353
- if (Array.isArray(e)) {
31354
- return e;
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
- } : {}), inputOnBlur.includes(input.type) ? {
31364
- trigger: "onBlur"
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
- }, ['switch'].includes(input.type) ? {
31370
- labelCol: {
31371
- span: 20
31372
- },
31373
- style: _objectSpread2(_objectSpread2({}, input.showOnView === false ? {
31374
- display: 'none'
31375
- } : {}), {}, {
31376
- flexDirection: 'row',
31377
- justifyContent: 'space-between'
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: (input === null || input === void 0 || (_input$meta4 = input.meta) === null || _input$meta4 === void 0 ? void 0 : _input$meta4.code) && "mr-10",
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 ? "flex-1 with-comment i-".concat(input.type) : "i-".concat(input.type, " flex-1 "), noActionsInputs.includes(input.type) && 'no-actions-input']),
31386
- "data-id": "".concat(formId, ".").concat(inputId),
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", (lastReview === null || lastReview === void 0 ? void 0 : lastReview.reviewError) && 'primary']),
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", (lastReview === null || lastReview === void 0 ? void 0 : lastReview.reviewSuccess) && 'primary']),
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 !== null && input !== void 0 && (_input$meta5 = input.meta) !== null && _input$meta5 !== void 0 && _input$meta5.requiredCommentOnNotApplicable ? {
31448
+ const commentMeta = input?.meta?.requiredCommentOnNotApplicable ? {
31432
31449
  comment: ''
31433
31450
  } : {};
31434
- if (input !== null && input !== void 0 && (_input$meta6 = input.meta) !== null && _input$meta6 !== void 0 && _input$meta6.requiredCommentOnNotApplicable) {
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 = ((values === null || values === void 0 || (_values$meta8 = values.meta) === null || _values$meta8 === void 0 ? void 0 : _values$meta8.inputs) || {})[formId] || {};
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]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31462
+ [formId]: {
31463
+ ..._defaultData,
31448
31464
  [inputId]: value,
31449
31465
  meta: {
31450
- inputs: _objectSpread2(_objectSpread2({}, (_defaultData === null || _defaultData === void 0 || (_defaultData$meta11 = _defaultData.meta) === null || _defaultData$meta11 === void 0 ? void 0 : _defaultData$meta11.inputs) || {}), {}, {
31451
- [inputId]: inputMeta.notApplicable ? _objectSpread2({
31466
+ inputs: {
31467
+ ...(_defaultData?.meta?.inputs || {}),
31468
+ [inputId]: inputMeta.notApplicable ? {
31452
31469
  notApplicable: false,
31453
- notAvailable: false
31454
- }, commentMeta) : _objectSpread2({
31470
+ notAvailable: false,
31471
+ ...commentMeta
31472
+ } : {
31455
31473
  notApplicable: true,
31456
- notAvailable: false
31457
- }, commentMeta)
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 ? _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31468
- [inputId]: _objectSpread2({
31486
+ value: inputMeta.notApplicable ? {
31487
+ ..._defaultMeta,
31488
+ [inputId]: {
31469
31489
  notApplicable: false,
31470
- notAvailable: false
31471
- }, commentMeta)
31472
- }) : _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31473
- [inputId]: _objectSpread2({
31490
+ notAvailable: false,
31491
+ ...commentMeta
31492
+ }
31493
+ } : {
31494
+ ..._defaultMeta,
31495
+ [inputId]: {
31474
31496
  notApplicable: true,
31475
- notAvailable: false
31476
- }, commentMeta)
31477
- }),
31497
+ notAvailable: false,
31498
+ ...commentMeta
31499
+ }
31500
+ },
31478
31501
  otherValues: {
31479
- [formId]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
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: !((_input$meta7 = input.meta) !== null && _input$meta7 !== void 0 && _input$meta7.notApplicable),
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: !((_input$meta8 = input.meta) !== null && _input$meta8 !== void 0 && _input$meta8.notAvailable),
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 = ((values === null || values === void 0 || (_values$meta9 = values.meta) === null || _values$meta9 === void 0 ? void 0 : _values$meta9.inputs) || {})[formId] || {};
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]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31552
+ [formId]: {
31553
+ ..._defaultData,
31531
31554
  [inputId]: value,
31532
31555
  meta: {
31533
- inputs: _objectSpread2(_objectSpread2({}, (_defaultData === null || _defaultData === void 0 || (_defaultData$meta12 = _defaultData.meta) === null || _defaultData$meta12 === void 0 ? void 0 : _defaultData$meta12.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 ? _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31575
+ value: inputMeta.notAvailable ? {
31576
+ ..._defaultMeta,
31552
31577
  [inputId]: {
31553
31578
  notApplicable: false,
31554
31579
  notAvailable: false
31555
31580
  }
31556
- }) : _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31581
+ } : {
31582
+ ..._defaultMeta,
31557
31583
  [inputId]: {
31558
31584
  notApplicable: false,
31559
31585
  notAvailable: true
31560
31586
  }
31561
- }),
31587
+ },
31562
31588
  otherValues: {
31563
- [formId]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
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, _objectSpread2(_objectSpread2({
31623
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
31597
31624
  type: "link",
31598
- disabled: !((_input$meta9 = input.meta) !== null && _input$meta9 !== void 0 && _input$meta9.comment)
31599
- }, !isShown ? {
31600
- className: 'default p-0'
31601
- } : {
31602
- className: 'p-0 primary'
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: _objectSpread2(_objectSpread2({}, values[formId] || {}), {}, {
31618
- meta: _objectSpread2(_objectSpread2({}, (values === null || values === void 0 ? void 0 : values.meta) || {}), {}, {
31619
- inputs: _objectSpread2(_objectSpread2({}, (values === null || values === void 0 || (_values$meta10 = values.meta) === null || _values$meta10 === void 0 ? void 0 : _values$meta10.inputs) || {}), ((values === null || values === void 0 || (_values$meta11 = values.meta) === null || _values$meta11 === void 0 ? void 0 : _values$meta11.inputs) || {})[formId] || {})
31620
- })
31621
- }),
31622
- linkingData: (values === null || values === void 0 ? void 0 : values.linking) || (values === null || values === void 0 || (_values$parent = values.parent) === null || _values$parent === void 0 ? void 0 : _values$parent.linking),
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](_objectSpread2(_objectSpread2({}, inputData), {}, {
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
- })), (_input$meta10 = input.meta) !== null && _input$meta10 !== void 0 && _input$meta10.code ? /*#__PURE__*/jsxRuntime.jsx("div", {
31690
+ }), input.meta?.code ? /*#__PURE__*/jsxRuntime.jsx("div", {
31658
31691
  className: "code",
31659
31692
  children: /*#__PURE__*/jsxRuntime.jsx("span", {
31660
- children: (_input$meta11 = input.meta) === null || _input$meta11 === void 0 ? void 0 : _input$meta11.code
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: (inputData === null || inputData === void 0 || (_inputData$value = inputData.value) === null || _inputData$value === void 0 ? void 0 : _inputData$value.length) || 0
31713
+ filled: inputData?.value?.length || 0
31681
31714
  })
31682
31715
  })
31683
- }) : null, (_input$meta12 = input.meta) !== null && _input$meta12 !== void 0 && _input$meta12.comment && isShown ? /*#__PURE__*/jsxRuntime.jsxs("div", {
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: (inputMeta === null || inputMeta === void 0 ? void 0 : inputMeta.comment) || '',
31720
+ initialValue: inputMeta?.comment || '',
31688
31721
  hidden: !isShown,
31689
- name: "".concat(formId, "-").concat(inputId, "-comment"),
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
- var _values$meta12;
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]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31746
+ [formId]: {
31747
+ ..._defaultData,
31716
31748
  meta: {
31717
- inputs: _objectSpread2(_objectSpread2({}, (_defaultData === null || _defaultData === void 0 || (_defaultData$meta13 = _defaultData.meta) === null || _defaultData$meta13 === void 0 ? void 0 : _defaultData$meta13.inputs) || {}), {}, {
31718
- [inputId]: _objectSpread2(_objectSpread2({}, ((_defaultData === null || _defaultData === void 0 || (_defaultData$meta14 = _defaultData.meta) === null || _defaultData$meta14 === void 0 ? void 0 : _defaultData$meta14.inputs) || {})[inputId] || {}), {}, {
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: _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31731
- [inputId]: _objectSpread2(_objectSpread2({}, _defaultMeta[inputId] || {}), {}, {
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: !((_input$meta13 = input.meta) !== null && _input$meta13 !== void 0 && _input$meta13.comment),
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: (inputMeta === null || inputMeta === void 0 ? void 0 : inputMeta.comment) || '',
31797
+ value: inputMeta?.comment || '',
31762
31798
  maxWidth,
31763
31799
  staticWidth,
31764
31800
  fullWidth,
31765
31801
  onChange: val => {
31766
31802
  if (notPartOfTheForm) {
31767
- var _values$meta13;
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]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31810
+ [formId]: {
31811
+ ..._defaultData,
31777
31812
  meta: {
31778
- inputs: _objectSpread2(_objectSpread2({}, (_defaultData === null || _defaultData === void 0 || (_defaultData$meta15 = _defaultData.meta) === null || _defaultData$meta15 === void 0 ? void 0 : _defaultData$meta15.inputs) || {}), {}, {
31779
- [inputId]: _objectSpread2(_objectSpread2({}, ((_defaultData === null || _defaultData === void 0 || (_defaultData$meta16 = _defaultData.meta) === null || _defaultData$meta16 === void 0 ? void 0 : _defaultData$meta16.inputs) || {})[inputId] || {}), {}, {
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: _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31792
- [inputId]: _objectSpread2(_objectSpread2({}, _defaultMeta[inputId] || {}), {}, {
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: (inputMeta === null || inputMeta === void 0 || (_inputMeta$comment = inputMeta.comment) === null || _inputMeta$comment === void 0 ? void 0 : _inputMeta$comment.length) || 0
31855
+ filled: inputMeta?.comment?.length || 0
31817
31856
  })
31818
31857
  })]
31819
- }) : null, lastReview !== null && lastReview !== void 0 && lastReview.reviewError ? /*#__PURE__*/jsxRuntime.jsx("div", {
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: (lastReview === null || lastReview === void 0 ? void 0 : lastReview.comment) || '',
31825
- name: "".concat(formId, "-").concat(inputId, "-reviewErrorComment"),
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: (lastReview === null || lastReview === void 0 ? void 0 : lastReview.comment) || '',
31875
+ value: lastReview?.comment || '',
31837
31876
  maxWidth,
31838
31877
  staticWidth,
31839
31878
  fullWidth,
31840
31879
  onChange: val => {
31841
31880
  if (notPartOfTheForm) {
31842
- var _values$meta14;
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]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31888
+ [formId]: {
31889
+ ..._defaultData,
31852
31890
  meta: {
31853
- inputs: _objectSpread2(_objectSpread2({}, (_defaultData === null || _defaultData === void 0 || (_defaultData$meta17 = _defaultData.meta) === null || _defaultData$meta17 === void 0 ? void 0 : _defaultData$meta17.inputs) || {}), {}, {
31854
- [inputId]: _objectSpread2(_objectSpread2({}, ((_defaultData === null || _defaultData === void 0 || (_defaultData$meta18 = _defaultData.meta) === null || _defaultData$meta18 === void 0 ? void 0 : _defaultData$meta18.inputs) || {})[inputId] || {}), {}, {
31855
- reviews: ((((_defaultData === null || _defaultData === void 0 || (_defaultData$meta19 = _defaultData.meta) === null || _defaultData$meta19 === void 0 ? void 0 : _defaultData$meta19.inputs) || {})[inputId] || {}).reviews || []).map(v => {
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 _objectSpread2(_objectSpread2({}, v), {}, {
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: _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31874
- [inputId]: _objectSpread2(_objectSpread2({}, _defaultMeta[inputId] || {}), {}, {
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 _objectSpread2(_objectSpread2({}, v), {}, {
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: _objectSpread2(_objectSpread2({}, inputMeta), {}, {
31892
- reviews: ((inputMeta === null || inputMeta === void 0 ? void 0 : inputMeta.reviews) || []).map(v => {
31935
+ value: {
31936
+ ...inputMeta,
31937
+ reviews: (inputMeta?.reviews || []).map(v => {
31893
31938
  if (v.createdAt === lastReview.createdAt) {
31894
- return _objectSpread2(_objectSpread2({}, v), {}, {
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: ((_lastReview$comment = lastReview.comment) === null || _lastReview$comment === void 0 ? void 0 : _lastReview$comment.length) || 0
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: (lastReview === null || lastReview === void 0 || (_lastReview$reviewer = lastReview.reviewer) === null || _lastReview$reviewer === void 0 ? void 0 : _lastReview$reviewer.firstName) + ' ' + (lastReview === null || lastReview === void 0 || (_lastReview$reviewer2 = lastReview.reviewer) === null || _lastReview$reviewer2 === void 0 ? void 0 : _lastReview$reviewer2.lastName) + ' - ' + moment__default["default"](lastReview.createdAt).format('DD MMM YYYY')
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, "".concat(formId, ".").concat(i));
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: "".concat(form.titleClass ? form.titleClass : 'title-semibold-4', " mb0 ").concat(i ? 'mt-3' : ''),
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: "".concat(form.titleClass ? form.titleClass : 'title-semibold-4', " mb0 ").concat(i ? 'mt-3' : ''),
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, _ref) => {
41632
- let {
41633
- add,
41634
- remove
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: "#".concat(field.name + 1)
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["".concat(inputId, "Comment")];
41709
- const inputData = getData(formId, input, value, commentValue, "".concat(formId, "[").concat(field.name, "].").concat(inputId), "".concat(formId, ".").concat(inputId));
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, "".concat(formId, "[").concat(field.name, "].").concat(inputId)) ? /*#__PURE__*/jsxRuntime.jsx(React__default["default"].Fragment, {
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 ? "inputs" : "",
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, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, field), {}, {
41735
- required: inputData.rules && inputData.rules instanceof Array && inputData.rules.filter(r => r.required).length > 0 ? true : false
41736
- }, ['total100', 'group'].includes(input.type) ? {} : {
41737
- name: [field.name, inputId],
41738
- fieldKey: [field.fieldKey, inputId],
41739
- initialValue: inputData.value
41740
- }), ['upload'].includes(input.type) ? {
41741
- valuePropName: "fileList",
41742
- getValueFromEvent: e => {
41743
- if (Array.isArray(e)) {
41744
- return e;
41745
- }
41746
- return e && e.fileList && e.fileList.map(f => {
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
- }, ['switch'].includes(input.type) ? {
41758
- labelCol: {
41759
- span: 20
41760
- },
41761
- style: _objectSpread2(_objectSpread2({}, input.showOnView === false ? {
41762
- display: 'none'
41763
- } : {}), {}, {
41764
- flexDirection: 'row',
41765
- justifyContent: 'space-between'
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 ? "with-comment i-".concat(input.type) : "i-".concat(input.type),
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["".concat(inputData.inputName, "Comment")] = !inputData.commentValue ? '' : undefined;
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(_objectSpread2({}, values));
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
- })), input.comment ? /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
41800
- name: [field.name, "".concat(inputData.inputName, "Comment")],
41801
- fieldKey: [field.fieldKey, "".concat(inputData.inputName, "Comment")],
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
- }, "".concat(i).concat(ii)) : null;
41865
+ }, `${i}${ii}`) : null;
41816
41866
  })
41817
41867
  })]
41818
- }, "".concat(formId, "-").concat(field.name))), form.repeatable ? /*#__PURE__*/jsxRuntime.jsxs(antd.Button, {
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: "".concat(form.titleClass ? form.titleClass : 'title-semibold-4', " ").concat(i ? 'mt-3 mb-1' : ''),
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["".concat(inputId, "Comment")];
41857
- const inputData = getData(formId, input, value, commentValue, "".concat(formId, ".").concat(inputId), "".concat(formId, ".").concat(inputId));
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, "".concat(formId, ".").concat(inputId)) ? /*#__PURE__*/jsxRuntime.jsx(React__default["default"].Fragment, {
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, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
41882
- required: inputData.rules && inputData.rules instanceof Array && inputData.rules.filter(r => r.required).length > 0 ? true : false
41883
- }, ['total100', 'group'].includes(input.type) ? {} : {
41884
- name: [formId, inputId],
41885
- fieldKey: [formId, inputId],
41886
- initialValue: inputData.value
41887
- }), ['upload'].includes(input.type) ? {
41888
- valuePropName: "fileList",
41889
- getValueFromEvent: e => {
41890
- if (Array.isArray(e)) {
41891
- return e;
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
- }, ['switch'].includes(input.type) ? {
41905
- labelCol: {
41906
- span: 20
41907
- },
41908
- style: _objectSpread2(_objectSpread2({}, input.showOnView === false ? {
41909
- display: 'none'
41910
- } : {}), {}, {
41911
- flexDirection: 'row',
41912
- justifyContent: 'space-between'
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 ? "with-comment i-".concat(input.type) : "i-".concat(input.type),
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["".concat(inputData.inputName, "Comment")] = !inputData.commentValue ? '' : undefined;
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(_objectSpread2({}, values));
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
- })), input.comment ? /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
41945
- name: [formId, "".concat(inputData.inputName, "Comment")],
41946
- fieldKey: [formId, "".concat(inputData.inputName, "Comment")],
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
- }, "".concat(i).concat(ii)) : null;
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 category = findOptions(value, options?.locationCategories || []) || "--";
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?.country || []) || "--";
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 label = findOptions(value, selectOptions?.category);
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?.country);
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
- setIsDisabled(prev => {
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
- return Object.keys(values).some(key => values[key] === undefined);
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: (selectOptions?.category || []).find(option => option.value === location?.category)?.label || location?.category || "-",
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: selectedLocations.map(location => {
55512
+ options: getFilteredLocations().map(location => {
55381
55513
  return {
55382
- label: (selectOptions?.country || []).find(option => option.value === location?.country)?.label || location?.country || "-",
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: selectedLocations.map(location => {
55395
- const _data = getAdminLevelName(location?.linking?.SCL, "level_1");
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: selectedLocations.map(location => {
55408
- const _data = getAdminLevelName(location?.linking?.SCL, "level_2");
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
- var _config$options, _config$options2;
55533
- return {
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
- console.log({
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
- const label = findOptions(value, selectOptions?.category);
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?.country);
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: mapToSelectOptions(selectedSubjects, "category", selectOptions, "category"),
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: mapToSelectOptions(selectedSubjects, "country", selectOptions, "country"),
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
- var _config$options, _config$options2;
56298
- return {
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, {