datastake-daf 0.6.753 → 0.6.755
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 +103 -97
- package/dist/pages/index.js +849 -282
- package/package.json +1 -1
- package/src/@daf/core/components/DynamicForm/index.jsx +46 -31
- package/src/@daf/core/components/Screens/Users/columns.js +216 -0
- package/src/@daf/core/components/Screens/Users/config.js +174 -0
- package/src/@daf/core/components/Screens/Users/create.jsx +63 -0
- package/src/@daf/core/components/Screens/Users/index.jsx +173 -0
- package/src/@daf/core/components/TableScreen/TablePageWithTabs/index.jsx +4 -4
- package/src/@daf/pages/Summary/Activities/Restoration/helper.js +0 -89
- package/src/@daf/pages/Summary/Activities/Restoration/index.jsx +55 -34
- package/src/pages.js +1 -1
- package/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
- package/dist/style/datastake/mapbox-gl.css +0 -330
package/dist/pages/index.js
CHANGED
|
@@ -13282,7 +13282,7 @@ const getTabs = t => {
|
|
|
13282
13282
|
label: t("Events")
|
|
13283
13283
|
}];
|
|
13284
13284
|
};
|
|
13285
|
-
const getFiltersConfig$
|
|
13285
|
+
const getFiltersConfig$a = (t, filters, locationCategories) => {
|
|
13286
13286
|
const value = filters.type ? {
|
|
13287
13287
|
value: filters.type
|
|
13288
13288
|
} : {};
|
|
@@ -13485,7 +13485,7 @@ function MineSites({
|
|
|
13485
13485
|
config: dataFetchConfig
|
|
13486
13486
|
});
|
|
13487
13487
|
const tabs = React.useMemo(() => getTabs(t), [t]);
|
|
13488
|
-
const filtersConfig = React.useMemo(() => getFiltersConfig$
|
|
13488
|
+
const filtersConfig = React.useMemo(() => getFiltersConfig$a(t, filters, locationCategories), [activeTab, filters, t, locationCategories]);
|
|
13489
13489
|
const onFilterChange = filters => {
|
|
13490
13490
|
setFilters(p => ({
|
|
13491
13491
|
...p,
|
|
@@ -16039,7 +16039,7 @@ const getLinkValue$4 = (value, linkingObject) => {
|
|
|
16039
16039
|
}
|
|
16040
16040
|
return null;
|
|
16041
16041
|
};
|
|
16042
|
-
const getColumns$
|
|
16042
|
+
const getColumns$9 = ({
|
|
16043
16043
|
t,
|
|
16044
16044
|
goTo,
|
|
16045
16045
|
user,
|
|
@@ -16242,11 +16242,11 @@ const getColumns$8 = ({
|
|
|
16242
16242
|
}
|
|
16243
16243
|
}].filter(column => column.show !== false);
|
|
16244
16244
|
|
|
16245
|
-
const checkboxConfig$
|
|
16245
|
+
const checkboxConfig$9 = {
|
|
16246
16246
|
name: 'Name',
|
|
16247
16247
|
datastakeId: 'ID'
|
|
16248
16248
|
};
|
|
16249
|
-
const getFiltersConfig$
|
|
16249
|
+
const getFiltersConfig$9 = ({
|
|
16250
16250
|
t
|
|
16251
16251
|
}) => {
|
|
16252
16252
|
return {
|
|
@@ -16414,11 +16414,11 @@ const getFiltersConfig$8 = ({
|
|
|
16414
16414
|
}
|
|
16415
16415
|
};
|
|
16416
16416
|
};
|
|
16417
|
-
const filtersConfig$
|
|
16417
|
+
const filtersConfig$9 = {
|
|
16418
16418
|
name: '',
|
|
16419
16419
|
datastakeId: ''
|
|
16420
16420
|
};
|
|
16421
|
-
const getFilterOptions$
|
|
16421
|
+
const getFilterOptions$9 = (options, t) => {
|
|
16422
16422
|
const {
|
|
16423
16423
|
statusOptions = [],
|
|
16424
16424
|
categoryOptions = [],
|
|
@@ -29371,43 +29371,56 @@ function DynamicForm({
|
|
|
29371
29371
|
// setOriginalData({});
|
|
29372
29372
|
// setValues({});
|
|
29373
29373
|
// MainForm.resetFields();
|
|
29374
|
+
} else if (isCreate) {
|
|
29375
|
+
// Reset form when data is empty in create mode (e.g., when switching contexts)
|
|
29376
|
+
setOriginalData({});
|
|
29377
|
+
setValues({});
|
|
29378
|
+
MainForm.resetFields();
|
|
29374
29379
|
}
|
|
29375
|
-
}, [data]);
|
|
29380
|
+
}, [data, isCreate]);
|
|
29376
29381
|
|
|
29377
29382
|
// Initialize default values for hidden and disabled fields
|
|
29378
29383
|
React.useEffect(() => {
|
|
29379
29384
|
if (Object.keys(form).length > 0) {
|
|
29380
|
-
|
|
29381
|
-
|
|
29382
|
-
|
|
29383
|
-
|
|
29384
|
-
|
|
29385
|
-
|
|
29386
|
-
|
|
29387
|
-
|
|
29388
|
-
|
|
29389
|
-
|
|
29390
|
-
|
|
29391
|
-
|
|
29392
|
-
|
|
29393
|
-
|
|
29394
|
-
|
|
29395
|
-
|
|
29396
|
-
|
|
29397
|
-
|
|
29398
|
-
|
|
29399
|
-
|
|
29385
|
+
setValues(prevValues => {
|
|
29386
|
+
// Use data prop as base, or current values if data is empty
|
|
29387
|
+
const baseValues = Object.keys(data).length > 0 ? data : prevValues;
|
|
29388
|
+
const updatedValues = {
|
|
29389
|
+
...baseValues
|
|
29390
|
+
};
|
|
29391
|
+
let hasChanges = false;
|
|
29392
|
+
const isEditMode = data && (data.id || data._id);
|
|
29393
|
+
|
|
29394
|
+
// Process all form fields to set default values for hidden and disabled fields
|
|
29395
|
+
Object.keys(form).forEach(formKey => {
|
|
29396
|
+
Object.keys(form[formKey]).forEach(fieldKey => {
|
|
29397
|
+
const field = form[formKey][fieldKey];
|
|
29398
|
+
const fieldId = field.dataId || fieldKey;
|
|
29399
|
+
|
|
29400
|
+
// Check if field is disabled
|
|
29401
|
+
const isDisabled = field?.meta?.disableEdit && typeof field?.meta?.disableEdit === 'object' ? isModal ? field.meta.disableEdit.create || field.meta.disableEdit.modal || field?.meta?.disableEdit?.edit && isEditMode : field.meta.disableEdit.create || field.meta.disableEdit.drawer || field?.meta?.disableEdit?.edit && isEditMode : field?.meta?.disableEdit;
|
|
29402
|
+
|
|
29403
|
+
// Set default value for hidden fields or disabled fields with default values
|
|
29404
|
+
if (field?.meta?.defaultValue !== undefined) {
|
|
29405
|
+
// In create mode, always update disabled/hidden fields with default values when form config changes
|
|
29406
|
+
// This ensures context switching (Operation -> Restoration) updates the field correctly
|
|
29407
|
+
const shouldUpdate = !propHasValue(updatedValues[fieldId]) || isCreate && !isEditMode && (field?.meta?.hidden === true || isDisabled);
|
|
29408
|
+
if (shouldUpdate && (field?.meta?.hidden === true || isDisabled)) {
|
|
29409
|
+
updatedValues[fieldId] = field.meta.defaultValue;
|
|
29410
|
+
hasChanges = true;
|
|
29411
|
+
}
|
|
29400
29412
|
}
|
|
29401
|
-
}
|
|
29413
|
+
});
|
|
29402
29414
|
});
|
|
29415
|
+
if (hasChanges) {
|
|
29416
|
+
// Also set the values in the Ant Design form
|
|
29417
|
+
MainForm.setFieldsValue(updatedValues);
|
|
29418
|
+
return updatedValues;
|
|
29419
|
+
}
|
|
29420
|
+
return prevValues;
|
|
29403
29421
|
});
|
|
29404
|
-
if (hasChanges) {
|
|
29405
|
-
setValues(updatedValues);
|
|
29406
|
-
// Also set the values in the Ant Design form
|
|
29407
|
-
MainForm.setFieldsValue(updatedValues);
|
|
29408
|
-
}
|
|
29409
29422
|
}
|
|
29410
|
-
}, [form, data, isModal]);
|
|
29423
|
+
}, [form, data, isModal, isCreate]);
|
|
29411
29424
|
const setSelectedForm = id => {
|
|
29412
29425
|
setForms(Forms.map(form => {
|
|
29413
29426
|
id === form.id ? form.selected = true : form.selected = false;
|
|
@@ -30015,7 +30028,7 @@ const OperatorsTable = ({
|
|
|
30015
30028
|
}) => {
|
|
30016
30029
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
30017
30030
|
const [activeTab, setActiveTab] = React.useState('own');
|
|
30018
|
-
const columns = React.useMemo(() => getColumns$
|
|
30031
|
+
const columns = React.useMemo(() => getColumns$9({
|
|
30019
30032
|
t,
|
|
30020
30033
|
goTo,
|
|
30021
30034
|
user,
|
|
@@ -30058,14 +30071,14 @@ const OperatorsTable = ({
|
|
|
30058
30071
|
}, 'operators');
|
|
30059
30072
|
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
30060
30073
|
const selectFiltersConfig = React.useMemo(() => {
|
|
30061
|
-
return getFiltersConfig$
|
|
30074
|
+
return getFiltersConfig$9({
|
|
30062
30075
|
t
|
|
30063
30076
|
});
|
|
30064
30077
|
}, [t]);
|
|
30065
30078
|
React.useEffect(() => {
|
|
30066
30079
|
setSelectOptions(prev => ({
|
|
30067
30080
|
...prev,
|
|
30068
|
-
...getFilterOptions$
|
|
30081
|
+
...getFilterOptions$9(options)
|
|
30069
30082
|
}));
|
|
30070
30083
|
}, [options, t]);
|
|
30071
30084
|
const handleActiveTabChange = React.useCallback(value => {
|
|
@@ -30081,13 +30094,13 @@ const OperatorsTable = ({
|
|
|
30081
30094
|
defaultActiveTab: "own",
|
|
30082
30095
|
columns: columns,
|
|
30083
30096
|
data: data,
|
|
30084
|
-
checkboxConfig: checkboxConfig$
|
|
30097
|
+
checkboxConfig: checkboxConfig$9,
|
|
30085
30098
|
APP: APP,
|
|
30086
30099
|
getApiBaseUrl: getApiBaseUrl,
|
|
30087
30100
|
selectOptions: selectOptions,
|
|
30088
30101
|
selectFiltersConfig: selectFiltersConfig,
|
|
30089
30102
|
getRedirectLink: getRedirectLink,
|
|
30090
|
-
filtersConfig: filtersConfig$
|
|
30103
|
+
filtersConfig: filtersConfig$9,
|
|
30091
30104
|
isMobile: isMobile,
|
|
30092
30105
|
view: "operators",
|
|
30093
30106
|
getActiveTab: handleActiveTabChange,
|
|
@@ -30134,7 +30147,7 @@ const getLinkValue$3 = (value, linkingObject) => {
|
|
|
30134
30147
|
}
|
|
30135
30148
|
return null;
|
|
30136
30149
|
};
|
|
30137
|
-
const getColumns$
|
|
30150
|
+
const getColumns$8 = ({
|
|
30138
30151
|
t,
|
|
30139
30152
|
goTo,
|
|
30140
30153
|
user,
|
|
@@ -30320,11 +30333,11 @@ const getColumns$7 = ({
|
|
|
30320
30333
|
}
|
|
30321
30334
|
}].filter(column => column.show !== false);
|
|
30322
30335
|
|
|
30323
|
-
const checkboxConfig$
|
|
30336
|
+
const checkboxConfig$8 = {
|
|
30324
30337
|
name: 'Name',
|
|
30325
30338
|
datastakeId: 'ID'
|
|
30326
30339
|
};
|
|
30327
|
-
const getFiltersConfig$
|
|
30340
|
+
const getFiltersConfig$8 = ({
|
|
30328
30341
|
t
|
|
30329
30342
|
}) => {
|
|
30330
30343
|
return {
|
|
@@ -30355,11 +30368,11 @@ const getFiltersConfig$7 = ({
|
|
|
30355
30368
|
}
|
|
30356
30369
|
};
|
|
30357
30370
|
};
|
|
30358
|
-
const filtersConfig$
|
|
30371
|
+
const filtersConfig$8 = {
|
|
30359
30372
|
name: '',
|
|
30360
30373
|
datastakeId: ''
|
|
30361
30374
|
};
|
|
30362
|
-
const getFilterOptions$
|
|
30375
|
+
const getFilterOptions$8 = (options, t) => {
|
|
30363
30376
|
const {
|
|
30364
30377
|
countries = [],
|
|
30365
30378
|
category = []
|
|
@@ -30502,7 +30515,7 @@ const LocationsTable = ({
|
|
|
30502
30515
|
}) => {
|
|
30503
30516
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
30504
30517
|
const [activeTab, setActiveTab] = React.useState("own");
|
|
30505
|
-
const columns = React.useMemo(() => getColumns$
|
|
30518
|
+
const columns = React.useMemo(() => getColumns$8({
|
|
30506
30519
|
t,
|
|
30507
30520
|
goTo,
|
|
30508
30521
|
user,
|
|
@@ -30538,14 +30551,14 @@ const LocationsTable = ({
|
|
|
30538
30551
|
data
|
|
30539
30552
|
});
|
|
30540
30553
|
const selectFiltersConfig = React.useMemo(() => {
|
|
30541
|
-
return getFiltersConfig$
|
|
30554
|
+
return getFiltersConfig$8({
|
|
30542
30555
|
t
|
|
30543
30556
|
});
|
|
30544
30557
|
}, [t]);
|
|
30545
30558
|
React.useEffect(() => {
|
|
30546
30559
|
setSelectOptions(prev => ({
|
|
30547
30560
|
...prev,
|
|
30548
|
-
...getFilterOptions$
|
|
30561
|
+
...getFilterOptions$8(options)
|
|
30549
30562
|
}));
|
|
30550
30563
|
}, [options, t]);
|
|
30551
30564
|
const handleActiveTabChange = React.useCallback(value => {
|
|
@@ -30564,13 +30577,13 @@ const LocationsTable = ({
|
|
|
30564
30577
|
defaultActiveTab: "own",
|
|
30565
30578
|
columns: columns,
|
|
30566
30579
|
data: data,
|
|
30567
|
-
checkboxConfig: checkboxConfig$
|
|
30580
|
+
checkboxConfig: checkboxConfig$8,
|
|
30568
30581
|
APP: APP,
|
|
30569
30582
|
getApiBaseUrl: getApiBaseUrl,
|
|
30570
30583
|
selectOptions: selectOptions,
|
|
30571
30584
|
selectFiltersConfig: selectFiltersConfig,
|
|
30572
30585
|
getRedirectLink: getRedirectLink,
|
|
30573
|
-
filtersConfig: filtersConfig$
|
|
30586
|
+
filtersConfig: filtersConfig$8,
|
|
30574
30587
|
isMobile: isMobile,
|
|
30575
30588
|
view: "locations",
|
|
30576
30589
|
getActiveTab: handleActiveTabChange,
|
|
@@ -30609,7 +30622,7 @@ const LocationsTable = ({
|
|
|
30609
30622
|
});
|
|
30610
30623
|
};
|
|
30611
30624
|
|
|
30612
|
-
const getColumns$
|
|
30625
|
+
const getColumns$7 = ({
|
|
30613
30626
|
t,
|
|
30614
30627
|
goTo,
|
|
30615
30628
|
user,
|
|
@@ -30780,11 +30793,11 @@ const getColumns$6 = ({
|
|
|
30780
30793
|
}
|
|
30781
30794
|
}].filter(column => column.show !== false);
|
|
30782
30795
|
|
|
30783
|
-
const checkboxConfig$
|
|
30796
|
+
const checkboxConfig$7 = {
|
|
30784
30797
|
name: 'Name',
|
|
30785
30798
|
datastakeId: 'ID'
|
|
30786
30799
|
};
|
|
30787
|
-
const getFiltersConfig$
|
|
30800
|
+
const getFiltersConfig$7 = ({
|
|
30788
30801
|
t
|
|
30789
30802
|
}) => {
|
|
30790
30803
|
return {
|
|
@@ -30815,11 +30828,11 @@ const getFiltersConfig$6 = ({
|
|
|
30815
30828
|
}
|
|
30816
30829
|
};
|
|
30817
30830
|
};
|
|
30818
|
-
const filtersConfig$
|
|
30831
|
+
const filtersConfig$7 = {
|
|
30819
30832
|
name: '',
|
|
30820
30833
|
datastakeId: ''
|
|
30821
30834
|
};
|
|
30822
|
-
const getFilterOptions$
|
|
30835
|
+
const getFilterOptions$7 = (options, t) => {
|
|
30823
30836
|
const {
|
|
30824
30837
|
countries = [],
|
|
30825
30838
|
category = []
|
|
@@ -30962,7 +30975,7 @@ const StakeholdersTable = ({
|
|
|
30962
30975
|
}) => {
|
|
30963
30976
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
30964
30977
|
const [activeTab, setActiveTab] = React.useState("own");
|
|
30965
|
-
const columns = React.useMemo(() => getColumns$
|
|
30978
|
+
const columns = React.useMemo(() => getColumns$7({
|
|
30966
30979
|
t,
|
|
30967
30980
|
goTo,
|
|
30968
30981
|
user,
|
|
@@ -30994,14 +31007,14 @@ const StakeholdersTable = ({
|
|
|
30994
31007
|
}, 'stakeholders');
|
|
30995
31008
|
}, [paginationQuery, otherParams, searchParams, activeTab]);
|
|
30996
31009
|
const selectFiltersConfig = React.useMemo(() => {
|
|
30997
|
-
return getFiltersConfig$
|
|
31010
|
+
return getFiltersConfig$7({
|
|
30998
31011
|
t
|
|
30999
31012
|
});
|
|
31000
31013
|
}, [t]);
|
|
31001
31014
|
React.useEffect(() => {
|
|
31002
31015
|
setSelectOptions(prev => ({
|
|
31003
31016
|
...prev,
|
|
31004
|
-
...getFilterOptions$
|
|
31017
|
+
...getFilterOptions$7(options)
|
|
31005
31018
|
}));
|
|
31006
31019
|
}, [options, t]);
|
|
31007
31020
|
const handleActiveTabChange = React.useCallback(value => {
|
|
@@ -31020,13 +31033,13 @@ const StakeholdersTable = ({
|
|
|
31020
31033
|
defaultActiveTab: "own",
|
|
31021
31034
|
columns: columns,
|
|
31022
31035
|
data: data,
|
|
31023
|
-
checkboxConfig: checkboxConfig$
|
|
31036
|
+
checkboxConfig: checkboxConfig$7,
|
|
31024
31037
|
APP: APP,
|
|
31025
31038
|
getApiBaseUrl: getApiBaseUrl,
|
|
31026
31039
|
selectOptions: selectOptions,
|
|
31027
31040
|
selectFiltersConfig: selectFiltersConfig,
|
|
31028
31041
|
getRedirectLink: getRedirectLink,
|
|
31029
|
-
filtersConfig: filtersConfig$
|
|
31042
|
+
filtersConfig: filtersConfig$7,
|
|
31030
31043
|
isMobile: isMobile,
|
|
31031
31044
|
view: "stakeholders",
|
|
31032
31045
|
getActiveTab: handleActiveTabChange,
|
|
@@ -31208,7 +31221,7 @@ const renderEventStatusTag = ({
|
|
|
31208
31221
|
});
|
|
31209
31222
|
}
|
|
31210
31223
|
};
|
|
31211
|
-
const getColumns$
|
|
31224
|
+
const getColumns$6 = ({
|
|
31212
31225
|
t,
|
|
31213
31226
|
goTo,
|
|
31214
31227
|
user,
|
|
@@ -31442,11 +31455,11 @@ const getColumns$5 = ({
|
|
|
31442
31455
|
}
|
|
31443
31456
|
}].filter(column => column.show !== false);
|
|
31444
31457
|
|
|
31445
|
-
const checkboxConfig$
|
|
31458
|
+
const checkboxConfig$6 = {
|
|
31446
31459
|
name: 'Name',
|
|
31447
31460
|
datastakeId: 'ID'
|
|
31448
31461
|
};
|
|
31449
|
-
const getFiltersConfig$
|
|
31462
|
+
const getFiltersConfig$6 = ({
|
|
31450
31463
|
t
|
|
31451
31464
|
}) => {
|
|
31452
31465
|
return {
|
|
@@ -31634,11 +31647,11 @@ const getFiltersConfig$5 = ({
|
|
|
31634
31647
|
}
|
|
31635
31648
|
};
|
|
31636
31649
|
};
|
|
31637
|
-
const filtersConfig$
|
|
31650
|
+
const filtersConfig$6 = {
|
|
31638
31651
|
name: '',
|
|
31639
31652
|
datastakeId: ''
|
|
31640
31653
|
};
|
|
31641
|
-
const getFilterOptions$
|
|
31654
|
+
const getFilterOptions$6 = (options, t) => {
|
|
31642
31655
|
const {
|
|
31643
31656
|
timeframe = [],
|
|
31644
31657
|
status = [],
|
|
@@ -31796,7 +31809,7 @@ const EventsTable = ({
|
|
|
31796
31809
|
}) => {
|
|
31797
31810
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
31798
31811
|
const [activeTab, setActiveTab] = React.useState("own");
|
|
31799
|
-
const columns = React.useMemo(() => getColumns$
|
|
31812
|
+
const columns = React.useMemo(() => getColumns$6({
|
|
31800
31813
|
t,
|
|
31801
31814
|
goTo,
|
|
31802
31815
|
user,
|
|
@@ -31840,14 +31853,14 @@ const EventsTable = ({
|
|
|
31840
31853
|
}, 'events');
|
|
31841
31854
|
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
31842
31855
|
const selectFiltersConfig = React.useMemo(() => {
|
|
31843
|
-
return getFiltersConfig$
|
|
31856
|
+
return getFiltersConfig$6({
|
|
31844
31857
|
t
|
|
31845
31858
|
});
|
|
31846
31859
|
}, [t]);
|
|
31847
31860
|
React.useEffect(() => {
|
|
31848
31861
|
setSelectOptions(prev => ({
|
|
31849
31862
|
...prev,
|
|
31850
|
-
...getFilterOptions$
|
|
31863
|
+
...getFilterOptions$6(options)
|
|
31851
31864
|
}));
|
|
31852
31865
|
}, [options, t]);
|
|
31853
31866
|
const handleActiveTabChange = React.useCallback(value => {
|
|
@@ -31866,13 +31879,13 @@ const EventsTable = ({
|
|
|
31866
31879
|
defaultActiveTab: "own",
|
|
31867
31880
|
columns: columns,
|
|
31868
31881
|
data: data,
|
|
31869
|
-
checkboxConfig: checkboxConfig$
|
|
31882
|
+
checkboxConfig: checkboxConfig$6,
|
|
31870
31883
|
APP: APP,
|
|
31871
31884
|
getApiBaseUrl: getApiBaseUrl,
|
|
31872
31885
|
selectOptions: selectOptions,
|
|
31873
31886
|
selectFiltersConfig: selectFiltersConfig,
|
|
31874
31887
|
getRedirectLink: getRedirectLink,
|
|
31875
|
-
filtersConfig: filtersConfig$
|
|
31888
|
+
filtersConfig: filtersConfig$6,
|
|
31876
31889
|
isMobile: isMobile,
|
|
31877
31890
|
view: "events",
|
|
31878
31891
|
getActiveTab: handleActiveTabChange,
|
|
@@ -31912,7 +31925,7 @@ const EventsTable = ({
|
|
|
31912
31925
|
});
|
|
31913
31926
|
};
|
|
31914
31927
|
|
|
31915
|
-
const getColumns$
|
|
31928
|
+
const getColumns$5 = ({
|
|
31916
31929
|
t,
|
|
31917
31930
|
goTo,
|
|
31918
31931
|
user,
|
|
@@ -32046,11 +32059,11 @@ const getColumns$4 = ({
|
|
|
32046
32059
|
}
|
|
32047
32060
|
}].filter(column => column.show !== false);
|
|
32048
32061
|
|
|
32049
|
-
const checkboxConfig$
|
|
32062
|
+
const checkboxConfig$5 = {
|
|
32050
32063
|
name: 'Name',
|
|
32051
32064
|
datastakeId: 'ID'
|
|
32052
32065
|
};
|
|
32053
|
-
const getFiltersConfig$
|
|
32066
|
+
const getFiltersConfig$5 = ({
|
|
32054
32067
|
t
|
|
32055
32068
|
}) => {
|
|
32056
32069
|
return {
|
|
@@ -32063,11 +32076,11 @@ const getFiltersConfig$4 = ({
|
|
|
32063
32076
|
}
|
|
32064
32077
|
};
|
|
32065
32078
|
};
|
|
32066
|
-
const filtersConfig$
|
|
32079
|
+
const filtersConfig$5 = {
|
|
32067
32080
|
name: '',
|
|
32068
32081
|
datastakeId: ''
|
|
32069
32082
|
};
|
|
32070
|
-
const getFilterOptions$
|
|
32083
|
+
const getFilterOptions$5 = (options, t) => {
|
|
32071
32084
|
const {
|
|
32072
32085
|
timeframe = []
|
|
32073
32086
|
} = options || {};
|
|
@@ -32208,7 +32221,7 @@ const DocumentsTable = ({
|
|
|
32208
32221
|
}) => {
|
|
32209
32222
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
32210
32223
|
const [activeTab, setActiveTab] = React.useState("own");
|
|
32211
|
-
const columns = React.useMemo(() => getColumns$
|
|
32224
|
+
const columns = React.useMemo(() => getColumns$5({
|
|
32212
32225
|
t,
|
|
32213
32226
|
goTo,
|
|
32214
32227
|
user,
|
|
@@ -32245,14 +32258,14 @@ const DocumentsTable = ({
|
|
|
32245
32258
|
}, 'documents');
|
|
32246
32259
|
}, [paginationQuery, otherParams, searchParams, activeTab]);
|
|
32247
32260
|
const selectFiltersConfig = React.useMemo(() => {
|
|
32248
|
-
return getFiltersConfig$
|
|
32261
|
+
return getFiltersConfig$5({
|
|
32249
32262
|
t
|
|
32250
32263
|
});
|
|
32251
32264
|
}, [t]);
|
|
32252
32265
|
React.useEffect(() => {
|
|
32253
32266
|
setSelectOptions(prev => ({
|
|
32254
32267
|
...prev,
|
|
32255
|
-
...getFilterOptions$
|
|
32268
|
+
...getFilterOptions$5(options)
|
|
32256
32269
|
}));
|
|
32257
32270
|
}, [options, t]);
|
|
32258
32271
|
const handleActiveTabChange = React.useCallback(value => {
|
|
@@ -32271,13 +32284,13 @@ const DocumentsTable = ({
|
|
|
32271
32284
|
defaultActiveTab: "own",
|
|
32272
32285
|
columns: columns,
|
|
32273
32286
|
data: data,
|
|
32274
|
-
checkboxConfig: checkboxConfig$
|
|
32287
|
+
checkboxConfig: checkboxConfig$5,
|
|
32275
32288
|
APP: APP,
|
|
32276
32289
|
getApiBaseUrl: getApiBaseUrl,
|
|
32277
32290
|
selectOptions: selectOptions,
|
|
32278
32291
|
selectFiltersConfig: selectFiltersConfig,
|
|
32279
32292
|
getRedirectLink: getRedirectLink,
|
|
32280
|
-
filtersConfig: filtersConfig$
|
|
32293
|
+
filtersConfig: filtersConfig$5,
|
|
32281
32294
|
isMobile: isMobile,
|
|
32282
32295
|
view: "documents",
|
|
32283
32296
|
getActiveTab: handleActiveTabChange,
|
|
@@ -32351,7 +32364,7 @@ const renderStatusTag$2 = ({
|
|
|
32351
32364
|
});
|
|
32352
32365
|
}
|
|
32353
32366
|
};
|
|
32354
|
-
const getColumns$
|
|
32367
|
+
const getColumns$4 = ({
|
|
32355
32368
|
t,
|
|
32356
32369
|
goTo,
|
|
32357
32370
|
user,
|
|
@@ -32523,11 +32536,11 @@ const getColumns$3 = ({
|
|
|
32523
32536
|
}
|
|
32524
32537
|
}].filter(column => column.show !== false);
|
|
32525
32538
|
|
|
32526
|
-
const checkboxConfig$
|
|
32539
|
+
const checkboxConfig$4 = {
|
|
32527
32540
|
name: 'Name',
|
|
32528
32541
|
datastakeId: 'ID'
|
|
32529
32542
|
};
|
|
32530
|
-
const getFiltersConfig$
|
|
32543
|
+
const getFiltersConfig$4 = ({
|
|
32531
32544
|
t
|
|
32532
32545
|
}) => {
|
|
32533
32546
|
return {
|
|
@@ -32695,11 +32708,11 @@ const getFiltersConfig$3 = ({
|
|
|
32695
32708
|
}
|
|
32696
32709
|
};
|
|
32697
32710
|
};
|
|
32698
|
-
const filtersConfig$
|
|
32711
|
+
const filtersConfig$4 = {
|
|
32699
32712
|
name: '',
|
|
32700
32713
|
datastakeId: ''
|
|
32701
32714
|
};
|
|
32702
|
-
const getFilterOptions$
|
|
32715
|
+
const getFilterOptions$4 = (options, t) => {
|
|
32703
32716
|
const {
|
|
32704
32717
|
statusOptions = [],
|
|
32705
32718
|
categoryOptions = [],
|
|
@@ -32867,7 +32880,7 @@ const WorkersTable = ({
|
|
|
32867
32880
|
}) => {
|
|
32868
32881
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
32869
32882
|
const [activeTab, setActiveTab] = React.useState('own');
|
|
32870
|
-
const columns = React.useMemo(() => getColumns$
|
|
32883
|
+
const columns = React.useMemo(() => getColumns$4({
|
|
32871
32884
|
t,
|
|
32872
32885
|
goTo,
|
|
32873
32886
|
user,
|
|
@@ -32910,14 +32923,14 @@ const WorkersTable = ({
|
|
|
32910
32923
|
}, 'workers');
|
|
32911
32924
|
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
32912
32925
|
const selectFiltersConfig = React.useMemo(() => {
|
|
32913
|
-
return getFiltersConfig$
|
|
32926
|
+
return getFiltersConfig$4({
|
|
32914
32927
|
t
|
|
32915
32928
|
});
|
|
32916
32929
|
}, [t]);
|
|
32917
32930
|
React.useEffect(() => {
|
|
32918
32931
|
setSelectOptions(prev => ({
|
|
32919
32932
|
...prev,
|
|
32920
|
-
...getFilterOptions$
|
|
32933
|
+
...getFilterOptions$4(options)
|
|
32921
32934
|
}));
|
|
32922
32935
|
}, [options, t]);
|
|
32923
32936
|
const handleActiveTabChange = React.useCallback(value => {
|
|
@@ -32933,13 +32946,13 @@ const WorkersTable = ({
|
|
|
32933
32946
|
defaultActiveTab: "own",
|
|
32934
32947
|
columns: columns,
|
|
32935
32948
|
data: data,
|
|
32936
|
-
checkboxConfig: checkboxConfig$
|
|
32949
|
+
checkboxConfig: checkboxConfig$4,
|
|
32937
32950
|
APP: APP,
|
|
32938
32951
|
getApiBaseUrl: getApiBaseUrl,
|
|
32939
32952
|
selectOptions: selectOptions,
|
|
32940
32953
|
selectFiltersConfig: selectFiltersConfig,
|
|
32941
32954
|
getRedirectLink: getRedirectLink,
|
|
32942
|
-
filtersConfig: filtersConfig$
|
|
32955
|
+
filtersConfig: filtersConfig$4,
|
|
32943
32956
|
isMobile: isMobile,
|
|
32944
32957
|
view: "workers",
|
|
32945
32958
|
getActiveTab: handleActiveTabChange,
|
|
@@ -33029,7 +33042,7 @@ const renderStatusTag$1 = ({
|
|
|
33029
33042
|
});
|
|
33030
33043
|
}
|
|
33031
33044
|
};
|
|
33032
|
-
const getColumns$
|
|
33045
|
+
const getColumns$3 = ({
|
|
33033
33046
|
t,
|
|
33034
33047
|
goTo,
|
|
33035
33048
|
user,
|
|
@@ -33249,11 +33262,11 @@ const getColumns$2 = ({
|
|
|
33249
33262
|
}
|
|
33250
33263
|
}].filter(column => column.show !== false);
|
|
33251
33264
|
|
|
33252
|
-
const checkboxConfig$
|
|
33265
|
+
const checkboxConfig$3 = {
|
|
33253
33266
|
name: 'Name',
|
|
33254
33267
|
datastakeId: 'ID'
|
|
33255
33268
|
};
|
|
33256
|
-
const getFiltersConfig$
|
|
33269
|
+
const getFiltersConfig$3 = ({
|
|
33257
33270
|
t
|
|
33258
33271
|
}) => {
|
|
33259
33272
|
return {
|
|
@@ -33428,11 +33441,11 @@ const getFiltersConfig$2 = ({
|
|
|
33428
33441
|
}
|
|
33429
33442
|
};
|
|
33430
33443
|
};
|
|
33431
|
-
const filtersConfig$
|
|
33444
|
+
const filtersConfig$3 = {
|
|
33432
33445
|
name: '',
|
|
33433
33446
|
datastakeId: ''
|
|
33434
33447
|
};
|
|
33435
|
-
const getFilterOptions$
|
|
33448
|
+
const getFilterOptions$3 = (options, t) => {
|
|
33436
33449
|
const {
|
|
33437
33450
|
timeframe = [],
|
|
33438
33451
|
statusOptions = [],
|
|
@@ -33602,7 +33615,7 @@ const ActivitiesTable = ({
|
|
|
33602
33615
|
}) => {
|
|
33603
33616
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
33604
33617
|
const [activeTab, setActiveTab] = React.useState("own");
|
|
33605
|
-
const columns = React.useMemo(() => getColumns$
|
|
33618
|
+
const columns = React.useMemo(() => getColumns$3({
|
|
33606
33619
|
t,
|
|
33607
33620
|
goTo,
|
|
33608
33621
|
user,
|
|
@@ -33645,14 +33658,14 @@ const ActivitiesTable = ({
|
|
|
33645
33658
|
}, 'activities');
|
|
33646
33659
|
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
33647
33660
|
const selectFiltersConfig = React.useMemo(() => {
|
|
33648
|
-
return getFiltersConfig$
|
|
33661
|
+
return getFiltersConfig$3({
|
|
33649
33662
|
t
|
|
33650
33663
|
});
|
|
33651
33664
|
}, [t]);
|
|
33652
33665
|
React.useEffect(() => {
|
|
33653
33666
|
setSelectOptions(prev => ({
|
|
33654
33667
|
...prev,
|
|
33655
|
-
...getFilterOptions$
|
|
33668
|
+
...getFilterOptions$3(options)
|
|
33656
33669
|
}));
|
|
33657
33670
|
}, [options, t]);
|
|
33658
33671
|
const handleActiveTabChange = React.useCallback(value => {
|
|
@@ -33668,13 +33681,13 @@ const ActivitiesTable = ({
|
|
|
33668
33681
|
defaultActiveTab: "own",
|
|
33669
33682
|
columns: columns,
|
|
33670
33683
|
data: data,
|
|
33671
|
-
checkboxConfig: checkboxConfig$
|
|
33684
|
+
checkboxConfig: checkboxConfig$3,
|
|
33672
33685
|
APP: APP,
|
|
33673
33686
|
getApiBaseUrl: getApiBaseUrl,
|
|
33674
33687
|
selectOptions: selectOptions,
|
|
33675
33688
|
selectFiltersConfig: selectFiltersConfig,
|
|
33676
33689
|
getRedirectLink: getRedirectLink,
|
|
33677
|
-
filtersConfig: filtersConfig$
|
|
33690
|
+
filtersConfig: filtersConfig$3,
|
|
33678
33691
|
isMobile: isMobile,
|
|
33679
33692
|
view: "activities",
|
|
33680
33693
|
getActiveTab: handleActiveTabChange,
|
|
@@ -33764,7 +33777,7 @@ const renderStatusTag = ({
|
|
|
33764
33777
|
});
|
|
33765
33778
|
}
|
|
33766
33779
|
};
|
|
33767
|
-
const getColumns$
|
|
33780
|
+
const getColumns$2 = ({
|
|
33768
33781
|
t,
|
|
33769
33782
|
goTo,
|
|
33770
33783
|
user,
|
|
@@ -33975,11 +33988,11 @@ const getColumns$1 = ({
|
|
|
33975
33988
|
}
|
|
33976
33989
|
}].filter(column => column.show !== false);
|
|
33977
33990
|
|
|
33978
|
-
const checkboxConfig$
|
|
33991
|
+
const checkboxConfig$2 = {
|
|
33979
33992
|
name: 'Name',
|
|
33980
33993
|
datastakeId: 'ID'
|
|
33981
33994
|
};
|
|
33982
|
-
const getFiltersConfig$
|
|
33995
|
+
const getFiltersConfig$2 = ({
|
|
33983
33996
|
t
|
|
33984
33997
|
}) => {
|
|
33985
33998
|
return {
|
|
@@ -34154,11 +34167,11 @@ const getFiltersConfig$1 = ({
|
|
|
34154
34167
|
}
|
|
34155
34168
|
};
|
|
34156
34169
|
};
|
|
34157
|
-
const filtersConfig$
|
|
34170
|
+
const filtersConfig$2 = {
|
|
34158
34171
|
name: '',
|
|
34159
34172
|
datastakeId: ''
|
|
34160
34173
|
};
|
|
34161
|
-
const getFilterOptions$
|
|
34174
|
+
const getFilterOptions$2 = (options, t) => {
|
|
34162
34175
|
const {
|
|
34163
34176
|
timeframe = [],
|
|
34164
34177
|
statusOptions = [],
|
|
@@ -34328,7 +34341,7 @@ const IncidentsTable = ({
|
|
|
34328
34341
|
}) => {
|
|
34329
34342
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
34330
34343
|
const [activeTab, setActiveTab] = React.useState("own");
|
|
34331
|
-
const columns = React.useMemo(() => getColumns$
|
|
34344
|
+
const columns = React.useMemo(() => getColumns$2({
|
|
34332
34345
|
t,
|
|
34333
34346
|
goTo,
|
|
34334
34347
|
user,
|
|
@@ -34371,14 +34384,14 @@ const IncidentsTable = ({
|
|
|
34371
34384
|
}, 'incidents');
|
|
34372
34385
|
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
34373
34386
|
const selectFiltersConfig = React.useMemo(() => {
|
|
34374
|
-
return getFiltersConfig$
|
|
34387
|
+
return getFiltersConfig$2({
|
|
34375
34388
|
t
|
|
34376
34389
|
});
|
|
34377
34390
|
}, [t]);
|
|
34378
34391
|
React.useEffect(() => {
|
|
34379
34392
|
setSelectOptions(prev => ({
|
|
34380
34393
|
...prev,
|
|
34381
|
-
...getFilterOptions$
|
|
34394
|
+
...getFilterOptions$2(options)
|
|
34382
34395
|
}));
|
|
34383
34396
|
}, [options, t]);
|
|
34384
34397
|
const handleActiveTabChange = React.useCallback(value => {
|
|
@@ -34394,13 +34407,13 @@ const IncidentsTable = ({
|
|
|
34394
34407
|
defaultActiveTab: "own",
|
|
34395
34408
|
columns: columns,
|
|
34396
34409
|
data: data,
|
|
34397
|
-
checkboxConfig: checkboxConfig$
|
|
34410
|
+
checkboxConfig: checkboxConfig$2,
|
|
34398
34411
|
APP: APP,
|
|
34399
34412
|
getApiBaseUrl: getApiBaseUrl,
|
|
34400
34413
|
selectOptions: selectOptions,
|
|
34401
34414
|
selectFiltersConfig: selectFiltersConfig,
|
|
34402
34415
|
getRedirectLink: getRedirectLink,
|
|
34403
|
-
filtersConfig: filtersConfig$
|
|
34416
|
+
filtersConfig: filtersConfig$2,
|
|
34404
34417
|
isMobile: isMobile,
|
|
34405
34418
|
view: "incidents",
|
|
34406
34419
|
getActiveTab: handleActiveTabChange,
|
|
@@ -34447,7 +34460,7 @@ const getLinkValue = (value, linkingObject) => {
|
|
|
34447
34460
|
}
|
|
34448
34461
|
return null;
|
|
34449
34462
|
};
|
|
34450
|
-
const getColumns = ({
|
|
34463
|
+
const getColumns$1 = ({
|
|
34451
34464
|
t,
|
|
34452
34465
|
goTo,
|
|
34453
34466
|
user,
|
|
@@ -34652,11 +34665,11 @@ const getColumns = ({
|
|
|
34652
34665
|
}
|
|
34653
34666
|
}].filter(column => column.show !== false);
|
|
34654
34667
|
|
|
34655
|
-
const checkboxConfig = {
|
|
34668
|
+
const checkboxConfig$1 = {
|
|
34656
34669
|
name: 'Name',
|
|
34657
34670
|
datastakeId: 'ID'
|
|
34658
34671
|
};
|
|
34659
|
-
const getFiltersConfig = ({
|
|
34672
|
+
const getFiltersConfig$1 = ({
|
|
34660
34673
|
t
|
|
34661
34674
|
}) => {
|
|
34662
34675
|
return {
|
|
@@ -34824,11 +34837,11 @@ const getFiltersConfig = ({
|
|
|
34824
34837
|
}
|
|
34825
34838
|
};
|
|
34826
34839
|
};
|
|
34827
|
-
const filtersConfig = {
|
|
34840
|
+
const filtersConfig$1 = {
|
|
34828
34841
|
name: '',
|
|
34829
34842
|
datastakeId: ''
|
|
34830
34843
|
};
|
|
34831
|
-
const getFilterOptions = (options, t) => {
|
|
34844
|
+
const getFilterOptions$1 = (options, t) => {
|
|
34832
34845
|
const {
|
|
34833
34846
|
statusOptions = [],
|
|
34834
34847
|
categoryOptions = [],
|
|
@@ -34996,7 +35009,7 @@ const ProductionSitesTable = ({
|
|
|
34996
35009
|
}) => {
|
|
34997
35010
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
34998
35011
|
const [activeTab, setActiveTab] = React.useState('own');
|
|
34999
|
-
const columns = React.useMemo(() => getColumns({
|
|
35012
|
+
const columns = React.useMemo(() => getColumns$1({
|
|
35000
35013
|
t,
|
|
35001
35014
|
goTo,
|
|
35002
35015
|
user,
|
|
@@ -35038,14 +35051,14 @@ const ProductionSitesTable = ({
|
|
|
35038
35051
|
}, 'production-sites');
|
|
35039
35052
|
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
35040
35053
|
const selectFiltersConfig = React.useMemo(() => {
|
|
35041
|
-
return getFiltersConfig({
|
|
35054
|
+
return getFiltersConfig$1({
|
|
35042
35055
|
t
|
|
35043
35056
|
});
|
|
35044
35057
|
}, [t]);
|
|
35045
35058
|
React.useEffect(() => {
|
|
35046
35059
|
setSelectOptions(prev => ({
|
|
35047
35060
|
...prev,
|
|
35048
|
-
...getFilterOptions(options)
|
|
35061
|
+
...getFilterOptions$1(options)
|
|
35049
35062
|
}));
|
|
35050
35063
|
}, [options, t]);
|
|
35051
35064
|
const handleActiveTabChange = React.useCallback(value => {
|
|
@@ -35061,13 +35074,13 @@ const ProductionSitesTable = ({
|
|
|
35061
35074
|
defaultActiveTab: "own",
|
|
35062
35075
|
columns: columns,
|
|
35063
35076
|
data: data?.data,
|
|
35064
|
-
checkboxConfig: checkboxConfig,
|
|
35077
|
+
checkboxConfig: checkboxConfig$1,
|
|
35065
35078
|
APP: APP,
|
|
35066
35079
|
getApiBaseUrl: getApiBaseUrl,
|
|
35067
35080
|
selectOptions: selectOptions,
|
|
35068
35081
|
selectFiltersConfig: selectFiltersConfig,
|
|
35069
35082
|
getRedirectLink: getRedirectLink,
|
|
35070
|
-
filtersConfig: filtersConfig,
|
|
35083
|
+
filtersConfig: filtersConfig$1,
|
|
35071
35084
|
isMobile: isMobile,
|
|
35072
35085
|
view: "production-sites",
|
|
35073
35086
|
getActiveTab: handleActiveTabChange,
|
|
@@ -35108,60 +35121,669 @@ const ProductionSitesTable = ({
|
|
|
35108
35121
|
});
|
|
35109
35122
|
};
|
|
35110
35123
|
|
|
35111
|
-
const
|
|
35112
|
-
getOne,
|
|
35113
|
-
getMultiple,
|
|
35114
|
-
id,
|
|
35115
|
-
hasSelect = false,
|
|
35116
|
-
storageKey,
|
|
35117
|
-
data,
|
|
35118
|
-
isPdf,
|
|
35119
|
-
params,
|
|
35120
|
-
partners,
|
|
35121
|
-
selectedPartners,
|
|
35122
|
-
user,
|
|
35124
|
+
const getColumns = ({
|
|
35123
35125
|
t,
|
|
35124
|
-
|
|
35125
|
-
|
|
35126
|
-
|
|
35127
|
-
|
|
35128
|
-
|
|
35129
|
-
|
|
35130
|
-
|
|
35131
|
-
|
|
35132
|
-
|
|
35133
|
-
|
|
35134
|
-
|
|
35135
|
-
|
|
35136
|
-
|
|
35137
|
-
|
|
35138
|
-
|
|
35139
|
-
|
|
35140
|
-
|
|
35141
|
-
|
|
35142
|
-
|
|
35143
|
-
|
|
35144
|
-
|
|
35145
|
-
|
|
35146
|
-
|
|
35147
|
-
|
|
35148
|
-
|
|
35149
|
-
|
|
35150
|
-
|
|
35151
|
-
|
|
35152
|
-
|
|
35153
|
-
|
|
35126
|
+
goTo,
|
|
35127
|
+
user,
|
|
35128
|
+
removeUser = () => {},
|
|
35129
|
+
resendInvite = () => {},
|
|
35130
|
+
setUserToEdit = () => {},
|
|
35131
|
+
userRoles = [],
|
|
35132
|
+
company = {},
|
|
35133
|
+
canCreate = false,
|
|
35134
|
+
app
|
|
35135
|
+
}) => [
|
|
35136
|
+
// {
|
|
35137
|
+
// dataIndex: 'datastakeId',
|
|
35138
|
+
// title: t('ID'),
|
|
35139
|
+
// ellipsis: true,
|
|
35140
|
+
// show: true,
|
|
35141
|
+
// render: (v, all) => {
|
|
35142
|
+
// if (all.empty) {
|
|
35143
|
+
// return <div className="daf-default-cell" />
|
|
35144
|
+
// }
|
|
35145
|
+
|
|
35146
|
+
// return <Tooltip title={v}>{v}</Tooltip>;
|
|
35147
|
+
// },
|
|
35148
|
+
// },
|
|
35149
|
+
{
|
|
35150
|
+
dataIndex: 'firstName',
|
|
35151
|
+
title: t('Name'),
|
|
35152
|
+
ellipsis: true,
|
|
35153
|
+
show: true,
|
|
35154
|
+
render: (v, all) => {
|
|
35155
|
+
if (all.empty) {
|
|
35156
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
35157
|
+
className: "daf-default-cell"
|
|
35158
|
+
});
|
|
35154
35159
|
}
|
|
35155
|
-
|
|
35156
|
-
|
|
35157
|
-
|
|
35158
|
-
|
|
35159
|
-
|
|
35160
|
-
|
|
35161
|
-
|
|
35162
|
-
|
|
35163
|
-
|
|
35164
|
-
|
|
35160
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
35161
|
+
title: v,
|
|
35162
|
+
children: v
|
|
35163
|
+
});
|
|
35164
|
+
}
|
|
35165
|
+
}, {
|
|
35166
|
+
dataIndex: 'lastName',
|
|
35167
|
+
title: t('Last Name'),
|
|
35168
|
+
ellipsis: true,
|
|
35169
|
+
show: true,
|
|
35170
|
+
render: (v, all) => {
|
|
35171
|
+
if (all.empty) {
|
|
35172
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
35173
|
+
className: "daf-default-cell"
|
|
35174
|
+
});
|
|
35175
|
+
}
|
|
35176
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
35177
|
+
title: v,
|
|
35178
|
+
children: v
|
|
35179
|
+
});
|
|
35180
|
+
}
|
|
35181
|
+
}, {
|
|
35182
|
+
dataIndex: 'email',
|
|
35183
|
+
title: t('Email'),
|
|
35184
|
+
ellipsis: true,
|
|
35185
|
+
show: true,
|
|
35186
|
+
render: (v, all) => {
|
|
35187
|
+
if (all.empty) {
|
|
35188
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
35189
|
+
className: "daf-default-cell"
|
|
35190
|
+
});
|
|
35191
|
+
}
|
|
35192
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
35193
|
+
title: v,
|
|
35194
|
+
children: v
|
|
35195
|
+
});
|
|
35196
|
+
}
|
|
35197
|
+
}, {
|
|
35198
|
+
title: t("Status"),
|
|
35199
|
+
dataIndex: "status",
|
|
35200
|
+
key: "status",
|
|
35201
|
+
width: 150,
|
|
35202
|
+
ellipsis: false,
|
|
35203
|
+
show: true,
|
|
35204
|
+
render: (status, users) => {
|
|
35205
|
+
if (users.empty) {
|
|
35206
|
+
return null;
|
|
35207
|
+
}
|
|
35208
|
+
if (status === "inactive") {
|
|
35209
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
|
|
35210
|
+
color: "red",
|
|
35211
|
+
style: {
|
|
35212
|
+
width: 100,
|
|
35213
|
+
textAlign: "center"
|
|
35214
|
+
},
|
|
35215
|
+
children: t("Blocked")
|
|
35216
|
+
});
|
|
35217
|
+
}
|
|
35218
|
+
if (status === "active") {
|
|
35219
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
|
|
35220
|
+
color: "green",
|
|
35221
|
+
style: {
|
|
35222
|
+
width: 100,
|
|
35223
|
+
textAlign: "center"
|
|
35224
|
+
},
|
|
35225
|
+
children: t("Active")
|
|
35226
|
+
});
|
|
35227
|
+
}
|
|
35228
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
|
|
35229
|
+
color: "orange",
|
|
35230
|
+
style: {
|
|
35231
|
+
width: 100,
|
|
35232
|
+
textAlign: "center"
|
|
35233
|
+
},
|
|
35234
|
+
children: t("Pending")
|
|
35235
|
+
});
|
|
35236
|
+
}
|
|
35237
|
+
}, {
|
|
35238
|
+
title: t("Last Login"),
|
|
35239
|
+
dataIndex: "lastLogin",
|
|
35240
|
+
key: "lastLogin",
|
|
35241
|
+
width: 125,
|
|
35242
|
+
render: (date, all) => {
|
|
35243
|
+
if (all.empty) {
|
|
35244
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
35245
|
+
className: "daf-default-cell"
|
|
35246
|
+
});
|
|
35247
|
+
}
|
|
35248
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
35249
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
35250
|
+
title: _date,
|
|
35251
|
+
children: _date
|
|
35252
|
+
});
|
|
35253
|
+
},
|
|
35254
|
+
ellipsis: true
|
|
35255
|
+
}, {
|
|
35256
|
+
title: t("User Role"),
|
|
35257
|
+
dataIndex: "roleName",
|
|
35258
|
+
key: "role",
|
|
35259
|
+
show: true,
|
|
35260
|
+
render: (val, all) => {
|
|
35261
|
+
if (all.empty) {
|
|
35262
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
35263
|
+
className: "daf-default-cell"
|
|
35264
|
+
});
|
|
35265
|
+
}
|
|
35266
|
+
|
|
35267
|
+
// Display role name if available, fallback to role ID
|
|
35268
|
+
const displayValue = val || all.role;
|
|
35269
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
35270
|
+
title: displayValue,
|
|
35271
|
+
children: displayValue
|
|
35272
|
+
});
|
|
35273
|
+
}
|
|
35274
|
+
}, {
|
|
35275
|
+
title: t(""),
|
|
35276
|
+
key: "actions",
|
|
35277
|
+
width: 60,
|
|
35278
|
+
show: removeUser || setUserToEdit,
|
|
35279
|
+
render: (row, all) => {
|
|
35280
|
+
if (all.empty) {
|
|
35281
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
35282
|
+
className: "daf-default-cell"
|
|
35283
|
+
});
|
|
35284
|
+
}
|
|
35285
|
+
const _v = userRoles?.find(r => r.value === all.role);
|
|
35286
|
+
const items = [removeUser ? {
|
|
35287
|
+
key: "removeUser",
|
|
35288
|
+
onClick: () => {
|
|
35289
|
+
antd.Modal.confirm({
|
|
35290
|
+
title: t("Are you sure you want to remove this user from your organisation?"),
|
|
35291
|
+
onOk: () => removeUser(all.id),
|
|
35292
|
+
cancelText: t("No"),
|
|
35293
|
+
okText: "Yes",
|
|
35294
|
+
closable: true
|
|
35295
|
+
});
|
|
35296
|
+
},
|
|
35297
|
+
label: t("Remove User")
|
|
35298
|
+
} : null, setUserToEdit ? {
|
|
35299
|
+
key: "editPermission",
|
|
35300
|
+
onClick: () => setUserToEdit(all),
|
|
35301
|
+
disabled: all.isAdmin || _v?.isForAppAdmin,
|
|
35302
|
+
label: t("Edit Permissions")
|
|
35303
|
+
} : null, all.invitationToken && canCreate ? {
|
|
35304
|
+
key: "copyLink",
|
|
35305
|
+
onClick: () => {
|
|
35306
|
+
if (location.pathname.includes(`/${APP}`)) {
|
|
35307
|
+
navigator.clipboard.writeText(`${window.location.host}/${app}/r/${company.inviteToken}/${all.invitationToken}`);
|
|
35308
|
+
} else {
|
|
35309
|
+
navigator.clipboard.writeText(`${window.location.host}/r/${company.inviteToken}/${all.invitationToken}`);
|
|
35310
|
+
}
|
|
35311
|
+
antd.message.info({
|
|
35312
|
+
content: t("Invitation link copied")
|
|
35313
|
+
});
|
|
35314
|
+
},
|
|
35315
|
+
label: t("Copy Invitation Link")
|
|
35316
|
+
} : null, all.invitationToken && canCreate ? {
|
|
35317
|
+
key: "resendInvite",
|
|
35318
|
+
onClick: () => {
|
|
35319
|
+
antd.Modal.confirm({
|
|
35320
|
+
title: t("Are you sure you want to invite this user again? This user will receive a new notification"),
|
|
35321
|
+
onOk: () => resendInvite(all.id),
|
|
35322
|
+
cancelText: t("No"),
|
|
35323
|
+
okText: "Yes",
|
|
35324
|
+
closable: true
|
|
35325
|
+
});
|
|
35326
|
+
},
|
|
35327
|
+
label: t("Resend Invite")
|
|
35328
|
+
} : null];
|
|
35329
|
+
return /*#__PURE__*/jsxRuntime.jsx(MoreMenu, {
|
|
35330
|
+
items: items
|
|
35331
|
+
});
|
|
35332
|
+
},
|
|
35333
|
+
client: false
|
|
35334
|
+
}].filter(column => column.show !== false);
|
|
35335
|
+
|
|
35336
|
+
const checkboxConfig = {
|
|
35337
|
+
name: 'Name',
|
|
35338
|
+
datastakeId: 'ID'
|
|
35339
|
+
};
|
|
35340
|
+
const getFiltersConfig = ({
|
|
35341
|
+
t
|
|
35342
|
+
}) => {
|
|
35343
|
+
return {
|
|
35344
|
+
email: {
|
|
35345
|
+
type: 'text',
|
|
35346
|
+
label: 'Email',
|
|
35347
|
+
placeholder: t => `${t('Filter by')} ${t('Email').toLowerCase()}`,
|
|
35348
|
+
style: {
|
|
35349
|
+
flex: 1
|
|
35350
|
+
},
|
|
35351
|
+
labelStyle: {
|
|
35352
|
+
flex: 1
|
|
35353
|
+
},
|
|
35354
|
+
getLabel: option => option.label,
|
|
35355
|
+
getValue: option => option.value
|
|
35356
|
+
},
|
|
35357
|
+
status: {
|
|
35358
|
+
type: "select",
|
|
35359
|
+
label: "Status",
|
|
35360
|
+
placeholder: t => `${t("Filter by")} ${t("Status").toLowerCase()}`,
|
|
35361
|
+
style: {
|
|
35362
|
+
flex: 1
|
|
35363
|
+
},
|
|
35364
|
+
labelStyle: {
|
|
35365
|
+
fley: 1
|
|
35366
|
+
},
|
|
35367
|
+
getLabel: option => option.label,
|
|
35368
|
+
getValue: option => option.value
|
|
35369
|
+
},
|
|
35370
|
+
timeframe: {
|
|
35371
|
+
type: "timeframe",
|
|
35372
|
+
label: "Timeframe",
|
|
35373
|
+
placeholder: t => `${t("Filter by")} ${t("Timeframe").toLowerCase()}`,
|
|
35374
|
+
style: {
|
|
35375
|
+
flex: 1
|
|
35376
|
+
},
|
|
35377
|
+
labelStyle: {
|
|
35378
|
+
flex: 1
|
|
35379
|
+
}
|
|
35380
|
+
},
|
|
35381
|
+
userRole: {
|
|
35382
|
+
type: "select",
|
|
35383
|
+
label: "User Role",
|
|
35384
|
+
placeholder: t => `${t("Filter by")} ${t("User Role").toLowerCase()}`,
|
|
35385
|
+
style: {
|
|
35386
|
+
flex: 1
|
|
35387
|
+
},
|
|
35388
|
+
labelStyle: {
|
|
35389
|
+
flex: 1
|
|
35390
|
+
}
|
|
35391
|
+
}
|
|
35392
|
+
};
|
|
35393
|
+
};
|
|
35394
|
+
const filtersConfig = {
|
|
35395
|
+
name: '',
|
|
35396
|
+
datastakeId: ''
|
|
35397
|
+
};
|
|
35398
|
+
const getFilterOptions = (options, t) => {
|
|
35399
|
+
const {
|
|
35400
|
+
emailOptions = [],
|
|
35401
|
+
statusOptions = [],
|
|
35402
|
+
timeframeOptions = [],
|
|
35403
|
+
userRoleOptions = []
|
|
35404
|
+
} = options || {};
|
|
35405
|
+
console.log({
|
|
35406
|
+
options
|
|
35407
|
+
});
|
|
35408
|
+
const _default = {
|
|
35409
|
+
timeframe: timeframeOptions,
|
|
35410
|
+
email: emailOptions,
|
|
35411
|
+
status: statusOptions,
|
|
35412
|
+
userRole: userRoleOptions,
|
|
35413
|
+
status: [{
|
|
35414
|
+
value: "active",
|
|
35415
|
+
label: "Active"
|
|
35416
|
+
}, {
|
|
35417
|
+
value: "pending",
|
|
35418
|
+
label: "Pending"
|
|
35419
|
+
}]
|
|
35420
|
+
};
|
|
35421
|
+
return _default;
|
|
35422
|
+
};
|
|
35423
|
+
const getUserForm = ({
|
|
35424
|
+
t,
|
|
35425
|
+
userRoles = [],
|
|
35426
|
+
APP
|
|
35427
|
+
}) => {
|
|
35428
|
+
return {
|
|
35429
|
+
user: {
|
|
35430
|
+
position: 0,
|
|
35431
|
+
firstName: {
|
|
35432
|
+
group: "user",
|
|
35433
|
+
section: "user",
|
|
35434
|
+
moduleScope: {
|
|
35435
|
+
cadd: ["scoping", "new", "linking-extra"],
|
|
35436
|
+
pme: ["scoping", "new", "linking-extra"]
|
|
35437
|
+
},
|
|
35438
|
+
label: t("First Name"),
|
|
35439
|
+
comment: false,
|
|
35440
|
+
type: "text",
|
|
35441
|
+
rules: [{
|
|
35442
|
+
required: true,
|
|
35443
|
+
message: "This field is required"
|
|
35444
|
+
}],
|
|
35445
|
+
mergeStrategy: "simple",
|
|
35446
|
+
position: 1
|
|
35447
|
+
},
|
|
35448
|
+
lastName: {
|
|
35449
|
+
group: "user",
|
|
35450
|
+
section: "user",
|
|
35451
|
+
moduleScope: {
|
|
35452
|
+
cadd: ["scoping", "new", "linking-extra"],
|
|
35453
|
+
pme: ["scoping", "new", "linking-extra"]
|
|
35454
|
+
},
|
|
35455
|
+
label: t("Last Name"),
|
|
35456
|
+
comment: false,
|
|
35457
|
+
type: "text",
|
|
35458
|
+
rules: [{
|
|
35459
|
+
required: true,
|
|
35460
|
+
message: "This field is required"
|
|
35461
|
+
}],
|
|
35462
|
+
mergeStrategy: "simple",
|
|
35463
|
+
position: 2
|
|
35464
|
+
},
|
|
35465
|
+
email: {
|
|
35466
|
+
group: "user",
|
|
35467
|
+
section: "user",
|
|
35468
|
+
moduleScope: {
|
|
35469
|
+
cadd: ["scoping", "new", "linking-extra"],
|
|
35470
|
+
pme: ["scoping", "new", "linking-extra"]
|
|
35471
|
+
},
|
|
35472
|
+
label: t("Email"),
|
|
35473
|
+
comment: false,
|
|
35474
|
+
type: "text",
|
|
35475
|
+
rules: [{
|
|
35476
|
+
required: true,
|
|
35477
|
+
message: "This field is required"
|
|
35478
|
+
}, {
|
|
35479
|
+
type: "email",
|
|
35480
|
+
message: "errors::field must be email"
|
|
35481
|
+
}],
|
|
35482
|
+
mergeStrategy: "simple",
|
|
35483
|
+
position: 3
|
|
35484
|
+
},
|
|
35485
|
+
role: {
|
|
35486
|
+
group: "user",
|
|
35487
|
+
section: "user",
|
|
35488
|
+
moduleScope: {
|
|
35489
|
+
cadd: ["scoping", "new", "linking", "linking-extra", "admin"],
|
|
35490
|
+
pme: ["scoping", "new", "linking", "linking-extra", "admin"]
|
|
35491
|
+
},
|
|
35492
|
+
label: t("User Role"),
|
|
35493
|
+
placeholder: t("User Role"),
|
|
35494
|
+
comment: false,
|
|
35495
|
+
type: "select",
|
|
35496
|
+
options: userRoles.filter(r => r.canBeAssignedToSubUsers && r.app === APP).map(v => ({
|
|
35497
|
+
label: t(v.label),
|
|
35498
|
+
value: v.value
|
|
35499
|
+
})),
|
|
35500
|
+
optionsName: "userRoles",
|
|
35501
|
+
// tooltip: <UserRolePopover t={t} />,
|
|
35502
|
+
sortOptions: true,
|
|
35503
|
+
rules: [{
|
|
35504
|
+
required: true,
|
|
35505
|
+
message: "This field is required"
|
|
35506
|
+
}],
|
|
35507
|
+
position: 4
|
|
35508
|
+
}
|
|
35509
|
+
}
|
|
35510
|
+
};
|
|
35511
|
+
};
|
|
35512
|
+
|
|
35513
|
+
const UsersCreate = ({
|
|
35514
|
+
onSubmitted = () => {},
|
|
35515
|
+
onCancel = () => {},
|
|
35516
|
+
user = {},
|
|
35517
|
+
APP,
|
|
35518
|
+
query,
|
|
35519
|
+
goTo = () => {},
|
|
35520
|
+
t = () => {},
|
|
35521
|
+
ajaxForms = {},
|
|
35522
|
+
changeAjaxForms = () => {},
|
|
35523
|
+
ajaxOptions = {},
|
|
35524
|
+
changeAjaxOptions = () => {},
|
|
35525
|
+
getAppHeader = () => {},
|
|
35526
|
+
getApiBaseUrl = () => {},
|
|
35527
|
+
userToEdit = null,
|
|
35528
|
+
userRoles = []
|
|
35529
|
+
}) => {
|
|
35530
|
+
const disabledInputs = React.useMemo(() => !userToEdit ? [] : ['firstName', 'lastName', 'email'], [userToEdit]);
|
|
35531
|
+
const data = React.useMemo(() => ({
|
|
35532
|
+
...(userToEdit || {}),
|
|
35533
|
+
userRole: userToEdit?.role
|
|
35534
|
+
}), [userToEdit]);
|
|
35535
|
+
const form = React.useMemo(() => getUserForm({
|
|
35536
|
+
t,
|
|
35537
|
+
userRoles,
|
|
35538
|
+
APP
|
|
35539
|
+
}), [t, userRoles, APP]);
|
|
35540
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
35541
|
+
className: "daf-create-form",
|
|
35542
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DynamicForm, {
|
|
35543
|
+
form: form,
|
|
35544
|
+
data: data,
|
|
35545
|
+
showSaveAndNext: false,
|
|
35546
|
+
module: APP,
|
|
35547
|
+
onCancel: onCancel,
|
|
35548
|
+
isCreate: true,
|
|
35549
|
+
t: t,
|
|
35550
|
+
user: user,
|
|
35551
|
+
ajaxForms: ajaxForms,
|
|
35552
|
+
ajaxOptions: ajaxOptions,
|
|
35553
|
+
getAppHeader: getAppHeader,
|
|
35554
|
+
getApiBaseUrl: getApiBaseUrl,
|
|
35555
|
+
changeAjaxOptions: changeAjaxOptions,
|
|
35556
|
+
app: APP,
|
|
35557
|
+
query: query,
|
|
35558
|
+
goTo: goTo,
|
|
35559
|
+
changeAjaxForms: changeAjaxForms,
|
|
35560
|
+
disabledInputs: disabledInputs,
|
|
35561
|
+
submit: payload => {
|
|
35562
|
+
onSubmitted({
|
|
35563
|
+
...payload,
|
|
35564
|
+
apps: {
|
|
35565
|
+
[APP]: {
|
|
35566
|
+
...((userToEdit?.apps || {})[APP] || {}),
|
|
35567
|
+
role: payload.role
|
|
35568
|
+
}
|
|
35569
|
+
}
|
|
35570
|
+
});
|
|
35571
|
+
}
|
|
35572
|
+
})
|
|
35573
|
+
});
|
|
35574
|
+
};
|
|
35575
|
+
|
|
35576
|
+
const UsersTable = ({
|
|
35577
|
+
t = () => {},
|
|
35578
|
+
goTo = () => {},
|
|
35579
|
+
user = {},
|
|
35580
|
+
options = {},
|
|
35581
|
+
getRedirectLink = () => {},
|
|
35582
|
+
theme = {},
|
|
35583
|
+
loading = false,
|
|
35584
|
+
data = {},
|
|
35585
|
+
isMobile,
|
|
35586
|
+
APP,
|
|
35587
|
+
location,
|
|
35588
|
+
getData = () => {},
|
|
35589
|
+
getApiBaseUrl = () => {},
|
|
35590
|
+
getAppHeader = () => {},
|
|
35591
|
+
onInviteUser = () => {},
|
|
35592
|
+
onEditUser = () => {},
|
|
35593
|
+
query = {},
|
|
35594
|
+
ajaxForms = {},
|
|
35595
|
+
changeAjaxForms = () => {},
|
|
35596
|
+
ajaxOptions = {},
|
|
35597
|
+
changeAjaxOptions = () => {},
|
|
35598
|
+
extendingFilters = {},
|
|
35599
|
+
userRoles = []
|
|
35600
|
+
}) => {
|
|
35601
|
+
const [selectOptions, setSelectOptions] = React.useState();
|
|
35602
|
+
const params = new URLSearchParams(location?.search);
|
|
35603
|
+
const [openCreateModal, setOpenCreateModal] = React.useState(params.has("create"));
|
|
35604
|
+
const [userToEdit, setUserToEdit] = React.useState(null);
|
|
35605
|
+
const columns = React.useMemo(() => getColumns({
|
|
35606
|
+
t,
|
|
35607
|
+
goTo,
|
|
35608
|
+
user,
|
|
35609
|
+
options,
|
|
35610
|
+
getRedirectLink,
|
|
35611
|
+
theme,
|
|
35612
|
+
subject: 'user',
|
|
35613
|
+
data,
|
|
35614
|
+
setUserToEdit
|
|
35615
|
+
}), [t, goTo, user, options, getRedirectLink, theme, data]);
|
|
35616
|
+
const breadCrumbs = [];
|
|
35617
|
+
const {
|
|
35618
|
+
paginationQuery,
|
|
35619
|
+
searchParams,
|
|
35620
|
+
otherParams,
|
|
35621
|
+
sortBy,
|
|
35622
|
+
sortDir
|
|
35623
|
+
} = useGetQueryParams({
|
|
35624
|
+
location
|
|
35625
|
+
});
|
|
35626
|
+
React.useMemo(() => ({
|
|
35627
|
+
...otherParams,
|
|
35628
|
+
...extendingFilters
|
|
35629
|
+
}), [otherParams, extendingFilters]);
|
|
35630
|
+
React.useEffect(() => {
|
|
35631
|
+
getData({
|
|
35632
|
+
pagination: paginationQuery,
|
|
35633
|
+
...(Object.keys(searchParams).length > 0 && {
|
|
35634
|
+
search: searchParams
|
|
35635
|
+
}),
|
|
35636
|
+
...otherParams,
|
|
35637
|
+
sortBy: {
|
|
35638
|
+
[sortBy || 'updatedAt']: sortDir ? sortDir === 'ascend' ? 1 : -1 : -1
|
|
35639
|
+
},
|
|
35640
|
+
...extendingFilters
|
|
35641
|
+
}, 'users');
|
|
35642
|
+
}, [location.search, JSON.stringify(extendingFilters)]);
|
|
35643
|
+
const selectFiltersConfig = React.useMemo(() => getFiltersConfig({
|
|
35644
|
+
t
|
|
35645
|
+
}), [t]);
|
|
35646
|
+
React.useEffect(() => {
|
|
35647
|
+
setSelectOptions(prev => ({
|
|
35648
|
+
...prev,
|
|
35649
|
+
...getFilterOptions(options)
|
|
35650
|
+
}));
|
|
35651
|
+
}, [options, t]);
|
|
35652
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
35653
|
+
className: "semibold form-input-output daf-create-view",
|
|
35654
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
|
|
35655
|
+
title: t("users"),
|
|
35656
|
+
breadcrumbs: breadCrumbs,
|
|
35657
|
+
actionButtons: [{
|
|
35658
|
+
type: "primary",
|
|
35659
|
+
onClick: () => setOpenCreateModal(true),
|
|
35660
|
+
tooltip: t("New"),
|
|
35661
|
+
icon: "Add"
|
|
35662
|
+
}]
|
|
35663
|
+
// onDownload={() => {
|
|
35664
|
+
// console.log("download");
|
|
35665
|
+
// }}
|
|
35666
|
+
// downloadDisabled={false}
|
|
35667
|
+
}), /*#__PURE__*/jsxRuntime.jsx(BaseScreen, {
|
|
35668
|
+
t: t,
|
|
35669
|
+
checkboxConfig: checkboxConfig,
|
|
35670
|
+
defaultTableFilters: {},
|
|
35671
|
+
columns: columns,
|
|
35672
|
+
data: data,
|
|
35673
|
+
loading: loading,
|
|
35674
|
+
location: location,
|
|
35675
|
+
goTo: goTo,
|
|
35676
|
+
APP: APP,
|
|
35677
|
+
getApiBaseUrl: getApiBaseUrl,
|
|
35678
|
+
selectOptions: selectOptions,
|
|
35679
|
+
selectFilters: selectFiltersConfig,
|
|
35680
|
+
view: "users",
|
|
35681
|
+
getRedirectLink: getRedirectLink,
|
|
35682
|
+
defaultUrlParams: {},
|
|
35683
|
+
module: APP,
|
|
35684
|
+
filtersConfig: filtersConfig,
|
|
35685
|
+
isMobile: isMobile
|
|
35686
|
+
}), (openCreateModal || !!userToEdit) && /*#__PURE__*/jsxRuntime.jsx(antd.Drawer, {
|
|
35687
|
+
destroyOnClose: true,
|
|
35688
|
+
title: /*#__PURE__*/jsxRuntime.jsx(DrawerHeader, {
|
|
35689
|
+
title: t(userToEdit ? "Edit User" : "New User")
|
|
35690
|
+
}),
|
|
35691
|
+
open: openCreateModal || !!userToEdit,
|
|
35692
|
+
onClose: () => {
|
|
35693
|
+
setOpenCreateModal(false);
|
|
35694
|
+
setUserToEdit(null);
|
|
35695
|
+
},
|
|
35696
|
+
width: CREATE_DRAWER_WIDTH,
|
|
35697
|
+
bodyStyle: {
|
|
35698
|
+
padding: 0
|
|
35699
|
+
},
|
|
35700
|
+
maskClosable: false,
|
|
35701
|
+
children: /*#__PURE__*/jsxRuntime.jsx(UsersCreate, {
|
|
35702
|
+
t: t,
|
|
35703
|
+
goTo: goTo,
|
|
35704
|
+
user: user,
|
|
35705
|
+
APP: APP,
|
|
35706
|
+
getApiBaseUrl: getApiBaseUrl,
|
|
35707
|
+
getAppHeader: getAppHeader,
|
|
35708
|
+
onSubmitted: payload => {
|
|
35709
|
+
if (userToEdit) {
|
|
35710
|
+
onEditUser(payload);
|
|
35711
|
+
} else {
|
|
35712
|
+
onInviteUser(payload);
|
|
35713
|
+
}
|
|
35714
|
+
setOpenCreateModal(false);
|
|
35715
|
+
setUserToEdit(null);
|
|
35716
|
+
},
|
|
35717
|
+
onCancel: () => {
|
|
35718
|
+
setOpenCreateModal(false);
|
|
35719
|
+
setUserToEdit(null);
|
|
35720
|
+
},
|
|
35721
|
+
query: query,
|
|
35722
|
+
ajaxForms: ajaxForms,
|
|
35723
|
+
changeAjaxForms: changeAjaxForms,
|
|
35724
|
+
ajaxOptions: ajaxOptions,
|
|
35725
|
+
changeAjaxOptions: changeAjaxOptions,
|
|
35726
|
+
userRoles: userRoles,
|
|
35727
|
+
userToEdit: userToEdit
|
|
35728
|
+
})
|
|
35729
|
+
})]
|
|
35730
|
+
});
|
|
35731
|
+
};
|
|
35732
|
+
|
|
35733
|
+
const useSummary = ({
|
|
35734
|
+
getOne,
|
|
35735
|
+
getMultiple,
|
|
35736
|
+
id,
|
|
35737
|
+
hasSelect = false,
|
|
35738
|
+
storageKey,
|
|
35739
|
+
data,
|
|
35740
|
+
isPdf,
|
|
35741
|
+
params,
|
|
35742
|
+
partners,
|
|
35743
|
+
selectedPartners,
|
|
35744
|
+
user,
|
|
35745
|
+
t,
|
|
35746
|
+
theme = {},
|
|
35747
|
+
service,
|
|
35748
|
+
onIdChange = () => {}
|
|
35749
|
+
}) => {
|
|
35750
|
+
const [search, setSearch] = React.useState("");
|
|
35751
|
+
const [debouncedSearch, setDebouncedSearch] = React.useState("");
|
|
35752
|
+
const [hasInitialized, setHasInitialized] = React.useState(false);
|
|
35753
|
+
const [singleItemData, setSingleItemData] = React.useState();
|
|
35754
|
+
const [loading, setLoading] = React.useState(false);
|
|
35755
|
+
const [_partners, _setPartners] = React.useState();
|
|
35756
|
+
const [selectedItem, setSelectedItem] = React.useState(undefined);
|
|
35757
|
+
const dataOptions = React.useMemo(() => {
|
|
35758
|
+
if (hasSelect) {
|
|
35759
|
+
const mappedData = Array.isArray(data) ? data.map(item => ({
|
|
35760
|
+
label: item?.name,
|
|
35761
|
+
value: item?.datastakeId
|
|
35762
|
+
})) : [];
|
|
35763
|
+
const storedData = StorageManager$1.get(storageKey);
|
|
35764
|
+
if (storedData) {
|
|
35765
|
+
try {
|
|
35766
|
+
const parsedStoredData = JSON.parse(storedData);
|
|
35767
|
+
const existsInData = mappedData?.find(item => item.value === parsedStoredData.value);
|
|
35768
|
+
if (!existsInData) {
|
|
35769
|
+
return [...mappedData, parsedStoredData];
|
|
35770
|
+
}
|
|
35771
|
+
} catch (error) {
|
|
35772
|
+
console.log('Error parsing stored data:', error);
|
|
35773
|
+
}
|
|
35774
|
+
}
|
|
35775
|
+
return mappedData;
|
|
35776
|
+
}
|
|
35777
|
+
}, [data, hasSelect, storageKey]);
|
|
35778
|
+
React.useEffect(() => {
|
|
35779
|
+
if (hasSelect && dataOptions && dataOptions.length > 0 && !debouncedSearch && !hasInitialized) {
|
|
35780
|
+
let selectedValue;
|
|
35781
|
+
if (isPdf) {
|
|
35782
|
+
selectedValue = id;
|
|
35783
|
+
} else {
|
|
35784
|
+
const storedData = StorageManager$1.get(storageKey);
|
|
35785
|
+
if (storedData) {
|
|
35786
|
+
try {
|
|
35165
35787
|
const parsedData = JSON.parse(storedData);
|
|
35166
35788
|
const existsInOptions = dataOptions?.find(item => item?.value === parsedData?.value);
|
|
35167
35789
|
selectedValue = existsInOptions ? parsedData?.value : Array.isArray(dataOptions) ? dataOptions[0]?.value : undefined;
|
|
@@ -40813,6 +41435,13 @@ const getKeyIndicatorsRowConfig = ({
|
|
|
40813
41435
|
})
|
|
40814
41436
|
}];
|
|
40815
41437
|
|
|
41438
|
+
// ============================================================================
|
|
41439
|
+
// REGION: Photo/Image Extraction
|
|
41440
|
+
// ============================================================================
|
|
41441
|
+
|
|
41442
|
+
/**
|
|
41443
|
+
* Normalize URL by removing trailing colon if present
|
|
41444
|
+
*/
|
|
40816
41445
|
const normalizeUrl = url => url?.endsWith(':') ? url.slice(0, -1) : url;
|
|
40817
41446
|
|
|
40818
41447
|
/**
|
|
@@ -40925,88 +41554,6 @@ const getGenderTooltipChildren = (item, isEmpty, genderDistributionData, t, rend
|
|
|
40925
41554
|
});
|
|
40926
41555
|
};
|
|
40927
41556
|
|
|
40928
|
-
// ============================================================================
|
|
40929
|
-
// REGION: Multiselect Options
|
|
40930
|
-
// ============================================================================
|
|
40931
|
-
|
|
40932
|
-
/**
|
|
40933
|
-
* Get filtered options for multiselect based on activityData.origin
|
|
40934
|
-
* Filters options based on whether origin contains 'kobo', 'straatos', or both
|
|
40935
|
-
*
|
|
40936
|
-
* @param {Object} activityData - Activity data object containing origin array
|
|
40937
|
-
* @param {React.Component} CustomIcon - CustomIcon component for rendering Monitor option avatar
|
|
40938
|
-
* @returns {Array} - Filtered array of option objects
|
|
40939
|
-
*/
|
|
40940
|
-
const getFilteredOptions = (activityData, CustomIcon) => {
|
|
40941
|
-
const allOptions = [{
|
|
40942
|
-
label: "Own Data",
|
|
40943
|
-
value: "own",
|
|
40944
|
-
avatar: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
40945
|
-
children: "OWN"
|
|
40946
|
-
}),
|
|
40947
|
-
background: "#016C6E",
|
|
40948
|
-
color: "white"
|
|
40949
|
-
}, {
|
|
40950
|
-
label: "Monitor",
|
|
40951
|
-
value: "other",
|
|
40952
|
-
avatar: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
40953
|
-
name: "Search02",
|
|
40954
|
-
size: 14
|
|
40955
|
-
})
|
|
40956
|
-
}];
|
|
40957
|
-
if (!activityData?.origin || !Array.isArray(activityData.origin)) {
|
|
40958
|
-
return allOptions;
|
|
40959
|
-
}
|
|
40960
|
-
|
|
40961
|
-
// Extract origin names from the array
|
|
40962
|
-
const originNames = activityData.origin.map(item => item?.name?.toLowerCase()).filter(Boolean);
|
|
40963
|
-
const hasKobo = originNames.includes('kobo');
|
|
40964
|
-
const hasStraatos = originNames.includes('straatos');
|
|
40965
|
-
|
|
40966
|
-
// If contains kobo only, show only Monitor
|
|
40967
|
-
if (hasKobo && !hasStraatos) {
|
|
40968
|
-
return allOptions.filter(option => option.value === 'other');
|
|
40969
|
-
}
|
|
40970
|
-
|
|
40971
|
-
// If contains straatos only, show only Own Data
|
|
40972
|
-
if (hasStraatos && !hasKobo) {
|
|
40973
|
-
return allOptions.filter(option => option.value === 'own');
|
|
40974
|
-
}
|
|
40975
|
-
|
|
40976
|
-
// If contains both or neither, show both
|
|
40977
|
-
return allOptions;
|
|
40978
|
-
};
|
|
40979
|
-
|
|
40980
|
-
/**
|
|
40981
|
-
* Get default selected value for multiselect based on activityData.origin
|
|
40982
|
-
*
|
|
40983
|
-
* @param {Object} activityData - Activity data object containing origin array
|
|
40984
|
-
* @returns {Array} - Array of default selected values
|
|
40985
|
-
*/
|
|
40986
|
-
const getDefaultSelected = activityData => {
|
|
40987
|
-
if (!activityData?.origin || !Array.isArray(activityData.origin)) {
|
|
40988
|
-
return ['own'];
|
|
40989
|
-
}
|
|
40990
|
-
|
|
40991
|
-
// Extract origin names from the array
|
|
40992
|
-
const originNames = activityData.origin.map(item => item?.name?.toLowerCase()).filter(Boolean);
|
|
40993
|
-
const hasKobo = originNames.includes('kobo');
|
|
40994
|
-
const hasStraatos = originNames.includes('straatos');
|
|
40995
|
-
|
|
40996
|
-
// If contains kobo only, default to monitor (other)
|
|
40997
|
-
if (hasKobo && !hasStraatos) {
|
|
40998
|
-
return ['other'];
|
|
40999
|
-
}
|
|
41000
|
-
|
|
41001
|
-
// If contains straatos only, default to own
|
|
41002
|
-
if (hasStraatos && !hasKobo) {
|
|
41003
|
-
return ['own'];
|
|
41004
|
-
}
|
|
41005
|
-
|
|
41006
|
-
// If contains both or neither, default to own
|
|
41007
|
-
return ['own'];
|
|
41008
|
-
};
|
|
41009
|
-
|
|
41010
41557
|
// ============================================================================
|
|
41011
41558
|
// REGION: Activity Indicators
|
|
41012
41559
|
// ============================================================================
|
|
@@ -41344,12 +41891,6 @@ const RestorationActivitySummary = ({
|
|
|
41344
41891
|
|
|
41345
41892
|
// Activity Indicators Config - mapped from activityData
|
|
41346
41893
|
const activityIndicatorsConfig = React.useMemo(() => getActivityIndicatorsConfig(activityData, t), [activityData, t]);
|
|
41347
|
-
|
|
41348
|
-
// Filter options based on activityData.origin
|
|
41349
|
-
const filteredOptions = React.useMemo(() => getFilteredOptions(activityData, CustomIcon), [activityData]);
|
|
41350
|
-
|
|
41351
|
-
// Get default selected based on activityData.origin
|
|
41352
|
-
const defaultSelected = React.useMemo(() => getDefaultSelected(activityData), [activityData]);
|
|
41353
41894
|
return /*#__PURE__*/jsxRuntime.jsxs(DashboardLayout, {
|
|
41354
41895
|
header: /*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
|
|
41355
41896
|
title: 'Restoration Activity Summary',
|
|
@@ -41359,25 +41900,7 @@ const RestorationActivitySummary = ({
|
|
|
41359
41900
|
actionButtons: actionButtons,
|
|
41360
41901
|
breadcrumbs: breadcrumbs,
|
|
41361
41902
|
goBackTo: goBackTo,
|
|
41362
|
-
loading: loading
|
|
41363
|
-
addedHeaderFirst: true,
|
|
41364
|
-
addedHeader: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
41365
|
-
style: {
|
|
41366
|
-
marginRight: 0
|
|
41367
|
-
},
|
|
41368
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Multiselect, {
|
|
41369
|
-
canUnselectLast: false,
|
|
41370
|
-
options: filteredOptions,
|
|
41371
|
-
isAvatarGroup: true,
|
|
41372
|
-
selectionType: "checkbox",
|
|
41373
|
-
onChange: selected => {
|
|
41374
|
-
console.log(selected);
|
|
41375
|
-
},
|
|
41376
|
-
dropDownWidth: 200,
|
|
41377
|
-
defaultSelected: defaultSelected,
|
|
41378
|
-
placeholder: "Select partners..."
|
|
41379
|
-
})
|
|
41380
|
-
})
|
|
41903
|
+
loading: loading
|
|
41381
41904
|
}),
|
|
41382
41905
|
children: [/*#__PURE__*/jsxRuntime.jsx("section", {
|
|
41383
41906
|
children: /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorsWidget, {
|
|
@@ -41406,6 +41929,50 @@ const RestorationActivitySummary = ({
|
|
|
41406
41929
|
app: "straatos",
|
|
41407
41930
|
showSider: false,
|
|
41408
41931
|
user: null,
|
|
41932
|
+
data: [{
|
|
41933
|
+
_id: {},
|
|
41934
|
+
id: "7f2aaed4-4b2e-406c-8e0a-6659c5c8367b",
|
|
41935
|
+
color: "#6698E4",
|
|
41936
|
+
parent: {
|
|
41937
|
+
_id: {},
|
|
41938
|
+
createdAt: "2024-06-13T14:51:55.296Z",
|
|
41939
|
+
updatedAt: "2024-06-13T14:51:55.296Z",
|
|
41940
|
+
id: "a5340bf1-2c7d-413f-a2a5-ccd7dc8f7a7c",
|
|
41941
|
+
name: "New Mine",
|
|
41942
|
+
authorId: "4e6066e9-00d8-423a-94ec-c7c9d3432fec",
|
|
41943
|
+
collectId: "f8a2b6a9cc935ef3e5844427f49aade34e152eca",
|
|
41944
|
+
country: "AL",
|
|
41945
|
+
category: "mineSite",
|
|
41946
|
+
datastakeId: "LOC-00000000141",
|
|
41947
|
+
__v: 0
|
|
41948
|
+
},
|
|
41949
|
+
administrativeLevel1: "6839cb26-5af4-44a3-b136-a0f0a0bcecc6",
|
|
41950
|
+
administrativeLevel2: "f849835d-5640-4bee-ae98-9f1c810c1abe",
|
|
41951
|
+
// "name": "New Mine",
|
|
41952
|
+
country: "AL",
|
|
41953
|
+
category: "mineSite",
|
|
41954
|
+
authorId: "4e6066e9-00d8-423a-94ec-c7c9d3432fec",
|
|
41955
|
+
gps: {
|
|
41956
|
+
latitude: 7,
|
|
41957
|
+
longitude: 1
|
|
41958
|
+
},
|
|
41959
|
+
area: [[6, 5], [7, 1], [9, 2]],
|
|
41960
|
+
associatedSubjects: [{
|
|
41961
|
+
entity: "Event",
|
|
41962
|
+
_id: {},
|
|
41963
|
+
nature: ""
|
|
41964
|
+
}],
|
|
41965
|
+
published: false,
|
|
41966
|
+
version: 1,
|
|
41967
|
+
createdAt: "2024-06-13T14:51:55.296Z",
|
|
41968
|
+
updatedAt: "2024-06-13T14:51:55.296Z",
|
|
41969
|
+
name: "Name",
|
|
41970
|
+
type: "Loc Type",
|
|
41971
|
+
__v: 0,
|
|
41972
|
+
datastakeId: "LOC-00000000141"
|
|
41973
|
+
}]
|
|
41974
|
+
// tooltipAsText: true,
|
|
41975
|
+
,
|
|
41409
41976
|
primaryLink: true,
|
|
41410
41977
|
renderTooltip: () => {
|
|
41411
41978
|
return [{
|
|
@@ -41413,10 +41980,9 @@ const RestorationActivitySummary = ({
|
|
|
41413
41980
|
value: "Name"
|
|
41414
41981
|
}];
|
|
41415
41982
|
},
|
|
41983
|
+
center: [13, -15],
|
|
41416
41984
|
mapConfig: {
|
|
41417
|
-
maxZoom: 18
|
|
41418
|
-
zoom: 5,
|
|
41419
|
-
center: [14, -14]
|
|
41985
|
+
maxZoom: 18
|
|
41420
41986
|
},
|
|
41421
41987
|
type: 'territory',
|
|
41422
41988
|
link: true,
|
|
@@ -41953,4 +42519,5 @@ exports.RestorationActivitySummary = RestorationActivitySummary;
|
|
|
41953
42519
|
exports.StakeholdersTable = StakeholdersTable;
|
|
41954
42520
|
exports.SupplyChainDashboard = SupplyChain;
|
|
41955
42521
|
exports.UserDashboard = UserDashboard;
|
|
42522
|
+
exports.UsersTable = UsersTable;
|
|
41956
42523
|
exports.WorkersTable = WorkersTable;
|