datastake-daf 0.6.804 → 0.6.805
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.js +1481 -1167
- package/dist/layouts/index.js +2 -2
- package/dist/pages/index.js +316 -66
- package/dist/utils/index.js +6 -0
- package/package.json +1 -1
- package/src/@daf/core/components/EditForm/RenderForm.js +13 -1
- package/src/@daf/core/components/EditForm/_index.scss +4 -3
- package/src/@daf/core/components/EditForm/components/DataLink/flat.js +9 -2
- package/src/@daf/core/components/EditForm/components/DataLink/index.js +8 -1
- package/src/@daf/core/components/EditForm/components/DataLinkGroup/index.js +8 -1
- package/src/@daf/core/components/EditForm/components/Repeatable/index.js +11 -1
- package/src/@daf/core/components/EditForm/context/index.js +9 -0
- package/src/@daf/core/components/EditForm/form.jsx +5 -1
- package/src/@daf/core/components/EditForm/helper.js +25 -3
- package/src/@daf/core/components/Header/hook.js +4 -4
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/columns.js +3 -3
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/helper.js +3 -3
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +3 -3
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/columns.js +3 -3
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +3 -3
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/column.js +3 -3
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +1 -8
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/columns.js +3 -3
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/helper.js +1 -8
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/helpers.js +3 -6
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/index.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/index.jsx +2 -1
- package/src/@daf/core/components/ViewForm/components/DataLink/flat.js +11 -1
- package/src/@daf/core/components/ViewForm/components/DataLink/index.js +11 -1
- package/src/@daf/core/components/ViewForm/components/DataLinkGroup/index.js +11 -1
- package/src/@daf/core/components/ViewForm/content.jsx +51 -28
- package/src/@daf/core/components/ViewForm/context/index.js +80 -0
- package/src/@daf/pages/Dashboards/SelfAssesment/components/AssociatedInformation/columns.js +9 -5
- package/src/@daf/pages/Dashboards/SelfAssesment/components/AssociatedInformation/index.jsx +15 -3
- package/src/@daf/pages/Dashboards/SelfAssesment/components/OrganisationInformation/columns.js +2 -2
- package/src/@daf/pages/Dashboards/SelfAssesment/components/OrganisationInformation/index.jsx +9 -5
- package/src/@daf/pages/Dashboards/SelfAssesment/index.jsx +1 -1
- package/src/@daf/pages/Edit/index.jsx +1 -0
- package/src/@daf/pages/Locations/MineSite/columns.js +5 -5
- package/src/@daf/pages/Stakeholders/Operators/columns.js +6 -8
- package/src/@daf/pages/View/index.jsx +1 -0
- package/src/helpers/adminLevels.js +4 -0
- package/src/utils.js +3 -1
- package/dist/style/datastake/mapbox-gl.css +0 -330
package/dist/utils/index.js
CHANGED
|
@@ -15005,6 +15005,11 @@ const copyToClipboard = id => {
|
|
|
15005
15005
|
|
|
15006
15006
|
const isArrayOfObjects = arr => Array.isArray(arr) && arr.map(i => typeof i === "object").every(i => i);
|
|
15007
15007
|
|
|
15008
|
+
const getAdminLevelName = (data, level) => {
|
|
15009
|
+
const entry = Object.values(data || {}).find(item => item.level === level);
|
|
15010
|
+
return entry?.name || "-";
|
|
15011
|
+
};
|
|
15012
|
+
|
|
15008
15013
|
exports.ErrorFormat = ErrorFormat;
|
|
15009
15014
|
exports.MessageTypes = MessageTypes;
|
|
15010
15015
|
exports.StorageManager = StorageManager;
|
|
@@ -15045,6 +15050,7 @@ exports.filterString = filterString;
|
|
|
15045
15050
|
exports.findOptions = findOptions;
|
|
15046
15051
|
exports.formatErrors = formatErrors;
|
|
15047
15052
|
exports.formatToKebabCase = formatToKebabCase$1;
|
|
15053
|
+
exports.getAdminLevelName = getAdminLevelName;
|
|
15048
15054
|
exports.getDefaultActiveFilters = getDefaultActiveFilters;
|
|
15049
15055
|
exports.getDivergenceOrEqual = getDivergenceOrEqual;
|
|
15050
15056
|
exports.getImageUploadViewValue = getImageUploadViewValue;
|
package/package.json
CHANGED
|
@@ -382,6 +382,9 @@ export const GroupContentFormItem = ({
|
|
|
382
382
|
getApiBaseUrl,
|
|
383
383
|
getAppHeader,
|
|
384
384
|
isReview,
|
|
385
|
+
maxWidth,
|
|
386
|
+
staticWidth,
|
|
387
|
+
fullWidth,
|
|
385
388
|
} = useEditContext();
|
|
386
389
|
const [isShown, setIsShown] = useState(!!inputMeta?.comment);
|
|
387
390
|
let maxRule = rules.find((rule) => rule.max)?.max;
|
|
@@ -886,7 +889,7 @@ export const GroupContentFormItem = ({
|
|
|
886
889
|
/>
|
|
887
890
|
) :
|
|
888
891
|
inputTypeComponent[input.type]
|
|
889
|
-
? inputTypeComponent[input.type]({ ...inputData, name: inputId }, {
|
|
892
|
+
? inputTypeComponent[input.type]({ ...inputData, name: inputId, maxWidth, staticWidth, fullWidth }, {
|
|
890
893
|
form: MainForm,
|
|
891
894
|
forms: options,
|
|
892
895
|
allForms: plainForms,
|
|
@@ -900,6 +903,9 @@ export const GroupContentFormItem = ({
|
|
|
900
903
|
getApiBaseUrl,
|
|
901
904
|
getAppHeader,
|
|
902
905
|
isHighlighted,
|
|
906
|
+
maxWidth,
|
|
907
|
+
staticWidth,
|
|
908
|
+
fullWidth,
|
|
903
909
|
}) : console.log(input)}
|
|
904
910
|
</Form.Item>
|
|
905
911
|
|
|
@@ -1008,6 +1014,9 @@ export const GroupContentFormItem = ({
|
|
|
1008
1014
|
form: MainForm,
|
|
1009
1015
|
forms: options,
|
|
1010
1016
|
value: inputMeta?.comment || '',
|
|
1017
|
+
maxWidth,
|
|
1018
|
+
staticWidth,
|
|
1019
|
+
fullWidth,
|
|
1011
1020
|
onChange: (val) => {
|
|
1012
1021
|
if (notPartOfTheForm) {
|
|
1013
1022
|
const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
|
|
@@ -1084,6 +1093,9 @@ export const GroupContentFormItem = ({
|
|
|
1084
1093
|
form: MainForm,
|
|
1085
1094
|
forms: options,
|
|
1086
1095
|
value: lastReview?.comment || '',
|
|
1096
|
+
maxWidth,
|
|
1097
|
+
staticWidth,
|
|
1098
|
+
fullWidth,
|
|
1087
1099
|
onChange: (val) => {
|
|
1088
1100
|
if (notPartOfTheForm) {
|
|
1089
1101
|
const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
|
|
@@ -1957,9 +1957,10 @@
|
|
|
1957
1957
|
width: var(--static-width, 614px) !important;
|
|
1958
1958
|
}
|
|
1959
1959
|
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1960
|
+
// MIGHT BE PROBLEMATIC
|
|
1961
|
+
// .ant-select-selector {
|
|
1962
|
+
// width: var(--static-width) !important;
|
|
1963
|
+
// }
|
|
1963
1964
|
|
|
1964
1965
|
.ant-upload-list-item-container {
|
|
1965
1966
|
position: relative;
|
|
@@ -36,6 +36,9 @@ export default function DataLinkFlat({
|
|
|
36
36
|
getApiBaseUrl,
|
|
37
37
|
getAppHeader,
|
|
38
38
|
app,
|
|
39
|
+
maxWidth,
|
|
40
|
+
staticWidth,
|
|
41
|
+
fullWidth,
|
|
39
42
|
...rest
|
|
40
43
|
} = useEditContext();
|
|
41
44
|
const [rowToEdit, setRowToEdit] = useState();
|
|
@@ -534,7 +537,11 @@ export default function DataLinkFlat({
|
|
|
534
537
|
: [...(form?.meta?.disabledKeysCreate || []), ...(form?.meta?.disabledKeys || [])];
|
|
535
538
|
|
|
536
539
|
return (
|
|
537
|
-
<div className={formatClassname(['data-link-cont mt-2', noBody && 'no-body', isHighlighted && 'highlighted'])} style={
|
|
540
|
+
<div className={formatClassname(['data-link-cont mt-2', noBody && 'no-body', isHighlighted && 'highlighted'])} style={{
|
|
541
|
+
...form?.meta?.style,
|
|
542
|
+
maxWidth: fullWidth ? "unset" : maxWidth,
|
|
543
|
+
width: fullWidth ? "100%" : staticWidth,
|
|
544
|
+
}}>
|
|
538
545
|
<div className="daf-table-wrapper no-padding repeatable-form-table no-pagination">
|
|
539
546
|
<ConfigProvider renderEmpty={() => notApplicable ? t('Not applicable') : t('No information available')}>
|
|
540
547
|
<Table
|
|
@@ -544,7 +551,7 @@ export default function DataLinkFlat({
|
|
|
544
551
|
columns={columns}
|
|
545
552
|
dataSource={dataSource}
|
|
546
553
|
rowKey="key"
|
|
547
|
-
scroll={noBody
|
|
554
|
+
scroll={noBody}
|
|
548
555
|
/>
|
|
549
556
|
</ConfigProvider>
|
|
550
557
|
</div>
|
|
@@ -39,6 +39,9 @@ export default function DataLink({
|
|
|
39
39
|
getApiBaseUrl,
|
|
40
40
|
getAppHeader,
|
|
41
41
|
app,
|
|
42
|
+
maxWidth,
|
|
43
|
+
staticWidth,
|
|
44
|
+
fullWidth,
|
|
42
45
|
...rest
|
|
43
46
|
} = useEditContext();
|
|
44
47
|
const [rowToEdit, setRowToEdit] = useState();
|
|
@@ -527,7 +530,11 @@ export default function DataLink({
|
|
|
527
530
|
|
|
528
531
|
|
|
529
532
|
return (
|
|
530
|
-
<div className={formatClassname(['data-link-cont mt-2', noBody && 'no-body', isHighlighted && 'highlighted'])} style={
|
|
533
|
+
<div className={formatClassname(['data-link-cont mt-2', noBody && 'no-body', isHighlighted && 'highlighted'])} style={{
|
|
534
|
+
...form?.meta?.style,
|
|
535
|
+
maxWidth: fullWidth ? "unset" : maxWidth,
|
|
536
|
+
width: fullWidth ? "100%" : maxWidth,
|
|
537
|
+
}}>
|
|
531
538
|
<div className="daf-table-wrapper no-padding repeatable-form-table no-pagination">
|
|
532
539
|
<ConfigProvider renderEmpty={() => notApplicable ? t('Not applicable') : t('No information available')}>
|
|
533
540
|
<Table
|
|
@@ -39,6 +39,9 @@ export default function DataLinkGroup({
|
|
|
39
39
|
getApiBaseUrl,
|
|
40
40
|
getAppHeader,
|
|
41
41
|
app,
|
|
42
|
+
maxWidth,
|
|
43
|
+
staticWidth,
|
|
44
|
+
fullWidth,
|
|
42
45
|
...rest
|
|
43
46
|
} = useEditContext();
|
|
44
47
|
const [rowToEdit, setRowToEdit] = useState();
|
|
@@ -519,7 +522,11 @@ export default function DataLinkGroup({
|
|
|
519
522
|
}, {});
|
|
520
523
|
|
|
521
524
|
return (
|
|
522
|
-
<div className={formatClassname(['data-link-cont mt-2', noBody && 'no-body', isHighlighted && 'highlighted'])} style={
|
|
525
|
+
<div className={formatClassname(['data-link-cont mt-2', noBody && 'no-body', isHighlighted && 'highlighted'])} style={{
|
|
526
|
+
...form?.meta?.style,
|
|
527
|
+
maxWidth: fullWidth ? "unset" : maxWidth,
|
|
528
|
+
width: fullWidth ? "100%" : staticWidth,
|
|
529
|
+
}}>
|
|
523
530
|
<div className="daf-table-wrapper no-padding repeatable-form-table no-pagination">
|
|
524
531
|
<ConfigProvider renderEmpty={() => notApplicable ? t('Not applicable') : t('No information available')}>
|
|
525
532
|
<Table
|
|
@@ -49,6 +49,9 @@ export default function Repeatable({
|
|
|
49
49
|
getAppHeader,
|
|
50
50
|
app,
|
|
51
51
|
highlightMandatory,
|
|
52
|
+
maxWidth,
|
|
53
|
+
staticWidth,
|
|
54
|
+
fullWidth,
|
|
52
55
|
...rest
|
|
53
56
|
} = useEditContext();
|
|
54
57
|
const inputId = form?.dataId;
|
|
@@ -329,7 +332,11 @@ export default function Repeatable({
|
|
|
329
332
|
|
|
330
333
|
return (
|
|
331
334
|
<div
|
|
332
|
-
style={
|
|
335
|
+
style={{
|
|
336
|
+
...form?.meta?.style,
|
|
337
|
+
maxWidth: fullWidth ? "unset" : maxWidth,
|
|
338
|
+
width: fullWidth ? "100%" : staticWidth,
|
|
339
|
+
}}
|
|
333
340
|
className={formatClassname([
|
|
334
341
|
form.repeatable ? "repeatable-section data-link-cont mb-6 pb-3" : '',
|
|
335
342
|
noBody && 'no-body',
|
|
@@ -513,6 +520,9 @@ export default function Repeatable({
|
|
|
513
520
|
// form: MainForm,
|
|
514
521
|
// forms: options,
|
|
515
522
|
// setFormValues: setValues,
|
|
523
|
+
maxWidth,
|
|
524
|
+
staticWidth,
|
|
525
|
+
fullWidth,
|
|
516
526
|
value: inputMeta.comment || '',
|
|
517
527
|
onChange: (val) => {
|
|
518
528
|
changeInputMeta({
|
|
@@ -16,6 +16,9 @@ const EditContext = createContext({
|
|
|
16
16
|
ajaxForms: {},
|
|
17
17
|
query: null,
|
|
18
18
|
goTo: () => { },
|
|
19
|
+
maxWidth: "75%",
|
|
20
|
+
staticWidth: "614px",
|
|
21
|
+
fullWidth: false,
|
|
19
22
|
});
|
|
20
23
|
|
|
21
24
|
export const EditProvider = ({
|
|
@@ -37,6 +40,9 @@ export const EditProvider = ({
|
|
|
37
40
|
changeErrors,
|
|
38
41
|
changeAjaxForms,
|
|
39
42
|
evaluationConfig,
|
|
43
|
+
maxWidth,
|
|
44
|
+
staticWidth,
|
|
45
|
+
fullWidth,
|
|
40
46
|
}) => {
|
|
41
47
|
const values = {
|
|
42
48
|
t,
|
|
@@ -56,6 +62,9 @@ export const EditProvider = ({
|
|
|
56
62
|
query,
|
|
57
63
|
evaluationConfig,
|
|
58
64
|
goTo,
|
|
65
|
+
maxWidth,
|
|
66
|
+
staticWidth,
|
|
67
|
+
fullWidth,
|
|
59
68
|
};
|
|
60
69
|
|
|
61
70
|
return (
|
|
@@ -57,6 +57,7 @@ export const EditForm = ({
|
|
|
57
57
|
staticWidth = "614px",
|
|
58
58
|
fullWidth = false,
|
|
59
59
|
noConvert = false,
|
|
60
|
+
maxWidth = "75%",
|
|
60
61
|
}) => {
|
|
61
62
|
const [isSubmitting] = useState(false);
|
|
62
63
|
const formData = JSON.parse(JSON.stringify(convertUndefinedToNull(data) || {}));
|
|
@@ -345,7 +346,7 @@ export const EditForm = ({
|
|
|
345
346
|
key={id}
|
|
346
347
|
name={id}
|
|
347
348
|
layout="vertical"
|
|
348
|
-
style={{ maxWidth: fullWidth ? "unset" : 700 }}
|
|
349
|
+
style={{ maxWidth: maxWidth || (fullWidth ? "unset" : 700) || 700 }}
|
|
349
350
|
className={`main-form${formClass ? ` ${formClass}` : ""} `}
|
|
350
351
|
onValuesChange={(_changedValue, _allValues) => {
|
|
351
352
|
const changedValue = { ..._changedValue };
|
|
@@ -565,6 +566,9 @@ export const EditForm = ({
|
|
|
565
566
|
|
|
566
567
|
return (
|
|
567
568
|
<EditProvider
|
|
569
|
+
maxWidth={maxWidth}
|
|
570
|
+
staticWidth={staticWidth}
|
|
571
|
+
fullWidth={fullWidth}
|
|
568
572
|
t={t}
|
|
569
573
|
isReview={isReview}
|
|
570
574
|
user={user}
|
|
@@ -904,6 +904,9 @@ export const inputTypeComponent = {
|
|
|
904
904
|
inputName,
|
|
905
905
|
name,
|
|
906
906
|
tags,
|
|
907
|
+
maxWidth,
|
|
908
|
+
staticWidth,
|
|
909
|
+
fullWidth,
|
|
907
910
|
},
|
|
908
911
|
{ forms, form, inputMeta = {}, t, isHighlighted },
|
|
909
912
|
) => {
|
|
@@ -982,6 +985,8 @@ export const inputTypeComponent = {
|
|
|
982
985
|
opts = groupOptions;
|
|
983
986
|
}
|
|
984
987
|
|
|
988
|
+
console.log({maxWidth, staticWidth, fullWidth});
|
|
989
|
+
|
|
985
990
|
return (
|
|
986
991
|
<Select
|
|
987
992
|
size="medium"
|
|
@@ -999,6 +1004,11 @@ export const inputTypeComponent = {
|
|
|
999
1004
|
getInputProp(props.placeholder, formsValue) ||
|
|
1000
1005
|
t("Select all relevant options")
|
|
1001
1006
|
}
|
|
1007
|
+
styles={{
|
|
1008
|
+
selector: {
|
|
1009
|
+
width: "100%" ,
|
|
1010
|
+
}
|
|
1011
|
+
}}
|
|
1002
1012
|
>
|
|
1003
1013
|
{(opts || []).map((option, i) => {
|
|
1004
1014
|
const otherProps = {};
|
|
@@ -2669,6 +2679,9 @@ export const GetFormItem = ({
|
|
|
2669
2679
|
changeAjaxForms,
|
|
2670
2680
|
app,
|
|
2671
2681
|
isReview,
|
|
2682
|
+
maxWidth,
|
|
2683
|
+
staticWidth,
|
|
2684
|
+
fullWidth,
|
|
2672
2685
|
} = useEditContext();
|
|
2673
2686
|
const lastReview = (inputMeta?.reviews || [])[(inputMeta?.reviews?.length || 0) - 1];
|
|
2674
2687
|
const [isShown, setIsShown] = useState(!!inputData.commentValue);
|
|
@@ -3165,7 +3178,7 @@ export const GetFormItem = ({
|
|
|
3165
3178
|
valueOnlyString
|
|
3166
3179
|
/>
|
|
3167
3180
|
) : inputTypeComponent[input.type] ? (
|
|
3168
|
-
inputTypeComponent[input.type](inputData, {
|
|
3181
|
+
inputTypeComponent[input.type]({ ...inputData, maxWidth, staticWidth, fullWidth }, {
|
|
3169
3182
|
form: MainForm,
|
|
3170
3183
|
forms: options,
|
|
3171
3184
|
allForms: plainForms,
|
|
@@ -3182,6 +3195,9 @@ export const GetFormItem = ({
|
|
|
3182
3195
|
getApiBaseUrl,
|
|
3183
3196
|
getAppHeader,
|
|
3184
3197
|
isHighlighted,
|
|
3198
|
+
maxWidth,
|
|
3199
|
+
staticWidth,
|
|
3200
|
+
fullWidth,
|
|
3185
3201
|
})
|
|
3186
3202
|
) : (
|
|
3187
3203
|
console.log(input)
|
|
@@ -3250,7 +3266,7 @@ export const GetFormItem = ({
|
|
|
3250
3266
|
</div>
|
|
3251
3267
|
}
|
|
3252
3268
|
>
|
|
3253
|
-
{inputTypeComponent.comment(inputData, {
|
|
3269
|
+
{inputTypeComponent.comment({ ...inputData, maxWidth, staticWidth, fullWidth }, {
|
|
3254
3270
|
form: MainForm,
|
|
3255
3271
|
forms: options,
|
|
3256
3272
|
setFormValues: setValues,
|
|
@@ -3265,6 +3281,9 @@ export const GetFormItem = ({
|
|
|
3265
3281
|
t,
|
|
3266
3282
|
getApiBaseUrl,
|
|
3267
3283
|
getAppHeader,
|
|
3284
|
+
maxWidth,
|
|
3285
|
+
staticWidth,
|
|
3286
|
+
fullWidth,
|
|
3268
3287
|
})}
|
|
3269
3288
|
</Form.Item>
|
|
3270
3289
|
<span className="max-char-span">
|
|
@@ -3290,7 +3309,7 @@ export const GetFormItem = ({
|
|
|
3290
3309
|
</div>
|
|
3291
3310
|
}
|
|
3292
3311
|
>
|
|
3293
|
-
{inputTypeComponent.comment(inputData, {
|
|
3312
|
+
{inputTypeComponent.comment({ ...inputData, maxWidth, staticWidth, fullWidth }, {
|
|
3294
3313
|
form: MainForm,
|
|
3295
3314
|
forms: options,
|
|
3296
3315
|
value: lastReview?.comment || "",
|
|
@@ -3321,6 +3340,9 @@ export const GetFormItem = ({
|
|
|
3321
3340
|
t,
|
|
3322
3341
|
getApiBaseUrl,
|
|
3323
3342
|
getAppHeader,
|
|
3343
|
+
maxWidth,
|
|
3344
|
+
staticWidth,
|
|
3345
|
+
fullWidth,
|
|
3324
3346
|
})}
|
|
3325
3347
|
</Form.Item>
|
|
3326
3348
|
<span className="max-char-span">
|
|
@@ -91,12 +91,12 @@ export const useHeader = ({
|
|
|
91
91
|
];
|
|
92
92
|
|
|
93
93
|
const actionButtons =
|
|
94
|
-
onDownload && _actionButtons
|
|
95
|
-
? [..._actionButtons, ...(hasFilters ? filterButton : []), downloadButton]
|
|
96
|
-
: [..._actionButtons, ...(hasFilters ? filterButton : [])];
|
|
94
|
+
onDownload && _actionButtons?.length < 3
|
|
95
|
+
? [...(_actionButtons?.length ? _actionButtons : []), ...(hasFilters ? filterButton : []), downloadButton]
|
|
96
|
+
: [...(_actionButtons?.length ? _actionButtons : []), ...(hasFilters ? filterButton : [])];
|
|
97
97
|
|
|
98
98
|
const extraButtons =
|
|
99
|
-
onDownload && _actionButtons
|
|
99
|
+
onDownload && _actionButtons?.length >= 3
|
|
100
100
|
? [..._extraButtons, downloadButtonAction]
|
|
101
101
|
: [..._extraButtons];
|
|
102
102
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
2
2
|
import { Tooltip } from "antd";
|
|
3
|
-
import {
|
|
3
|
+
import { getAdminLevelName } from "../../../../../../../helpers/adminLevels.js";
|
|
4
4
|
|
|
5
5
|
export const getColumns = ({ t, selectOptions, module, entity }) => {
|
|
6
6
|
return [
|
|
@@ -53,7 +53,7 @@ export const getColumns = ({ t, selectOptions, module, entity }) => {
|
|
|
53
53
|
if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
|
|
54
54
|
label = all?.linking?.SCL?.[value]?.name
|
|
55
55
|
} else {
|
|
56
|
-
label =
|
|
56
|
+
label = getAdminLevelName(all?.linking?.SCL, "level_1")
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
@@ -69,7 +69,7 @@ export const getColumns = ({ t, selectOptions, module, entity }) => {
|
|
|
69
69
|
if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
|
|
70
70
|
label = all?.linking?.SCL?.[value]?.name
|
|
71
71
|
} else {
|
|
72
|
-
label =
|
|
72
|
+
label = getAdminLevelName(all?.linking?.SCL, "level_2")
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
2
2
|
import { Tooltip } from "antd";
|
|
3
|
-
import {
|
|
3
|
+
import { getAdminLevelName } from "../../../../../../../helpers/adminLevels.js";
|
|
4
4
|
|
|
5
5
|
export const getColumns = ({ t, selectOptions, module, entity }) => {
|
|
6
6
|
return [
|
|
@@ -53,7 +53,7 @@ export const getColumns = ({ t, selectOptions, module, entity }) => {
|
|
|
53
53
|
if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
|
|
54
54
|
label = all?.linking?.SCL?.[value]?.name
|
|
55
55
|
} else {
|
|
56
|
-
label =
|
|
56
|
+
label = getAdminLevelName(all?.linking?.SCL, "level_1")
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
@@ -69,7 +69,7 @@ export const getColumns = ({ t, selectOptions, module, entity }) => {
|
|
|
69
69
|
if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
|
|
70
70
|
label = all?.linking?.SCL?.[value]?.name
|
|
71
71
|
} else {
|
|
72
|
-
label =
|
|
72
|
+
label = getAdminLevelName(all?.linking?.SCL, "level_2")
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
@@ -3,7 +3,7 @@ import { Form, Input, Select, theme } from "antd";
|
|
|
3
3
|
import { Container } from "../CombineModalStyle.js";
|
|
4
4
|
import DAFTable from "../../../../Table/index.jsx";
|
|
5
5
|
import { useMemo, useState } from "react";
|
|
6
|
-
import {
|
|
6
|
+
import { getAdminLevelName } from "../../../../../../../helpers/adminLevels.js";
|
|
7
7
|
import { getColumns } from "./helper.js";
|
|
8
8
|
|
|
9
9
|
const { useToken } = theme;
|
|
@@ -186,7 +186,7 @@ export default function CombineLocationModal({
|
|
|
186
186
|
placeholder={t("Province")}
|
|
187
187
|
options={selectedLocations
|
|
188
188
|
.map((location) => {
|
|
189
|
-
const _data =
|
|
189
|
+
const _data = getAdminLevelName(location?.linking?.SCL, "level_1");
|
|
190
190
|
return {
|
|
191
191
|
label: _data?.name || "-",
|
|
192
192
|
value: _data?.id || "-",
|
|
@@ -204,7 +204,7 @@ export default function CombineLocationModal({
|
|
|
204
204
|
placeholder={t("Territory")}
|
|
205
205
|
options={selectedLocations
|
|
206
206
|
.map((location) => {
|
|
207
|
-
const _data =
|
|
207
|
+
const _data = getAdminLevelName(location?.linking?.SCL, "level_2");
|
|
208
208
|
return {
|
|
209
209
|
label: _data?.name || "-",
|
|
210
210
|
value: _data?.id || "-",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
2
2
|
import { Tooltip } from "antd";
|
|
3
|
-
import {
|
|
3
|
+
import { getAdminLevelName } from "../../../../../../../helpers/adminLevels.js";
|
|
4
4
|
|
|
5
5
|
export const getColumns = ({ t, selectOptions, module, entity }) => {
|
|
6
6
|
return [
|
|
@@ -53,7 +53,7 @@ export const getColumns = ({ t, selectOptions, module, entity }) => {
|
|
|
53
53
|
if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
|
|
54
54
|
label = all?.linking?.SCL?.[value]?.name
|
|
55
55
|
} else {
|
|
56
|
-
label =
|
|
56
|
+
label = getAdminLevelName(all?.linking?.SCL, "level_1")
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
@@ -69,7 +69,7 @@ export const getColumns = ({ t, selectOptions, module, entity }) => {
|
|
|
69
69
|
if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
|
|
70
70
|
label = all?.linking?.SCL?.[value]?.name
|
|
71
71
|
} else {
|
|
72
|
-
label =
|
|
72
|
+
label = getAdminLevelName(all?.linking?.SCL, "level_2")
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
@@ -6,7 +6,7 @@ import DAFTable from "../../../../Table/index.jsx";
|
|
|
6
6
|
import { useMemo, useState } from "react";
|
|
7
7
|
import { mapToSelectOptions } from "./helper.js";
|
|
8
8
|
import { getColumns } from "./columns.js";
|
|
9
|
-
import {
|
|
9
|
+
import { getAdminLevelName } from "../../../../../../../helpers/adminLevels.js";
|
|
10
10
|
|
|
11
11
|
const { useToken } = theme;
|
|
12
12
|
|
|
@@ -141,7 +141,7 @@ export default function CombineSubjectsModal({
|
|
|
141
141
|
<Select
|
|
142
142
|
placeholder={t("Province")}
|
|
143
143
|
options={mapToSelectOptions(selectedSubjects, null, selectOptions, null, (subject) => {
|
|
144
|
-
const _data =
|
|
144
|
+
const _data = getAdminLevelName(subject?.linking?.SCL, "level_1");
|
|
145
145
|
return {
|
|
146
146
|
label: _data?.name || "-",
|
|
147
147
|
value: _data?.id || "-",
|
|
@@ -154,7 +154,7 @@ export default function CombineSubjectsModal({
|
|
|
154
154
|
<Select
|
|
155
155
|
placeholder={t("Territory")}
|
|
156
156
|
options={mapToSelectOptions(selectedSubjects, null, selectOptions, null, (subject) => {
|
|
157
|
-
const _data =
|
|
157
|
+
const _data = getAdminLevelName(subject?.linking?.SCL, "level_2");
|
|
158
158
|
return {
|
|
159
159
|
label: _data?.name || "-",
|
|
160
160
|
value: _data?.id || "-",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Checkbox, Tooltip, Avatar } from "antd";
|
|
2
2
|
import CustomIcon from "../../../../Icon/CustomIcon.jsx";
|
|
3
3
|
import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
4
|
-
import {
|
|
4
|
+
import { getAdminLevelName } from "../../../../../../../helpers/adminLevels.js";
|
|
5
5
|
|
|
6
6
|
export const getColumns = ({
|
|
7
7
|
t,
|
|
@@ -121,7 +121,7 @@ export const getColumns = ({
|
|
|
121
121
|
if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
|
|
122
122
|
label = all?.linking?.SCL?.[value]?.name
|
|
123
123
|
} else {
|
|
124
|
-
label =
|
|
124
|
+
label = getAdminLevelName(all?.linking?.SCL, "level_1")
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
@@ -142,7 +142,7 @@ export const getColumns = ({
|
|
|
142
142
|
if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
|
|
143
143
|
label = all?.linking?.SCL?.[value]?.name
|
|
144
144
|
} else {
|
|
145
|
-
label =
|
|
145
|
+
label = getAdminLevelName(all?.linking?.SCL, "level_2")
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
@@ -55,11 +55,4 @@ export const defaultUrlParams = { activeTab: "active" };
|
|
|
55
55
|
export const checkboxConfig = {
|
|
56
56
|
name: "Name",
|
|
57
57
|
datastakeId: "ID",
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const getNameByLevel = (data, level) => {
|
|
61
|
-
const entry = Object.values(data || {}).find(item => item.level === level);
|
|
62
|
-
return entry;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Checkbox, Tooltip, Avatar } from "antd";
|
|
2
2
|
import CustomIcon from "../../../../Icon/CustomIcon.jsx";
|
|
3
3
|
import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
4
|
-
import {
|
|
4
|
+
import { getAdminLevelName } from "../../../../../../../helpers/adminLevels.js";
|
|
5
5
|
|
|
6
6
|
export const getColumns = ({
|
|
7
7
|
t,
|
|
@@ -121,7 +121,7 @@ export const getColumns = ({
|
|
|
121
121
|
if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
|
|
122
122
|
label = all?.linking?.SCL?.[value]?.name
|
|
123
123
|
} else {
|
|
124
|
-
label =
|
|
124
|
+
label = getAdminLevelName(all?.linking?.SCL, "level_1")
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
@@ -142,7 +142,7 @@ export const getColumns = ({
|
|
|
142
142
|
if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
|
|
143
143
|
label = all?.linking?.SCL?.[value]?.name
|
|
144
144
|
} else {
|
|
145
|
-
label =
|
|
145
|
+
label = getAdminLevelName(all?.linking?.SCL, "level_2")
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
@@ -55,11 +55,4 @@ export const defaultUrlParams = { activeTab: "active" };
|
|
|
55
55
|
export const checkboxConfig = {
|
|
56
56
|
name: "Name",
|
|
57
57
|
datastakeId: "ID",
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const getNameByLevel = (data, level) => {
|
|
61
|
-
const entry = Object.values(data || {}).find(item => item.level === level);
|
|
62
|
-
return entry;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
const entry = Object.values(data || {}).find(item => item.level === level);
|
|
3
|
-
return entry?.name || "-";
|
|
4
|
-
};
|
|
1
|
+
import { getAdminLevelName } from "../../../../../../../helpers/adminLevels.js";
|
|
5
2
|
|
|
6
3
|
export const getAdministrativeLevel1 = (location) => {
|
|
7
|
-
return
|
|
4
|
+
return getAdminLevelName(location?.linking?.SCL, "level_1");
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
export const getAdministrativeLevel2 = (location) => {
|
|
11
|
-
return
|
|
8
|
+
return getAdminLevelName(location?.linking?.SCL, "level_2");
|
|
12
9
|
};
|
|
13
10
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
2
|
-
import {
|
|
2
|
+
import { getAdminLevelName } from "../../../../../../../helpers/adminLevels.js";
|
|
3
3
|
import LocationTable from "../../AdminTables/LocationTable/index.jsx";
|
|
4
4
|
|
|
5
5
|
const isView = true;
|
|
@@ -43,7 +43,7 @@ export default function View({
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (item.type === "administrative") {
|
|
46
|
-
return
|
|
46
|
+
return getAdminLevelName(data?.linking?.SCL, item.level) || "-";
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
return val ?? "-";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
2
2
|
import StakeholderTable from "../../AdminTables/SubjectsTable/index.jsx";
|
|
3
|
+
import { getAdminLevelName } from "../../../../../../../helpers/adminLevels.js";
|
|
3
4
|
const isView = true;
|
|
4
5
|
|
|
5
6
|
export default function View({
|
|
@@ -41,7 +42,7 @@ export default function View({
|
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
if (item.type === "administrative") {
|
|
44
|
-
return
|
|
45
|
+
return getAdminLevelName(data?.linking?.SCL, item.level) || "-";
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
return val ?? "-";
|