datastake-daf 0.6.338 → 0.6.340
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 +75 -48
- package/package.json +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/helper.js +28 -11
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +31 -18
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/LocationTable.stories.js +140 -35
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +45 -41
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +6 -3
package/dist/components/index.js
CHANGED
|
@@ -55620,10 +55620,10 @@ const checkboxConfig$8 = {
|
|
|
55620
55620
|
name: "Name",
|
|
55621
55621
|
datastakeId: "ID"
|
|
55622
55622
|
};
|
|
55623
|
-
|
|
55623
|
+
const getNameByLevel = (data, level) => {
|
|
55624
55624
|
const entry = Object.values(data || {}).find(item => item.level === level);
|
|
55625
|
-
return entry
|
|
55626
|
-
}
|
|
55625
|
+
return entry;
|
|
55626
|
+
};
|
|
55627
55627
|
const getColumns$2 = ({
|
|
55628
55628
|
t,
|
|
55629
55629
|
goTo = () => {},
|
|
@@ -55655,13 +55655,13 @@ const getColumns$2 = ({
|
|
|
55655
55655
|
return [...prev, all];
|
|
55656
55656
|
}),
|
|
55657
55657
|
checked: selectedLocations.some(p => p.id === all.id),
|
|
55658
|
-
disabled: selectedLocations
|
|
55658
|
+
disabled: selectedLocations?.length >= 3 && !selectedLocations.some(p => p.id === all.id)
|
|
55659
55659
|
});
|
|
55660
55660
|
}
|
|
55661
55661
|
}, {
|
|
55662
55662
|
title: t("ID"),
|
|
55663
|
-
dataIndex: "
|
|
55664
|
-
key: "
|
|
55663
|
+
dataIndex: "datastakeId",
|
|
55664
|
+
key: "datastakeId",
|
|
55665
55665
|
ellipsis: true,
|
|
55666
55666
|
show: true,
|
|
55667
55667
|
render: (value, all) => {
|
|
@@ -55744,11 +55744,11 @@ const getColumns$2 = ({
|
|
|
55744
55744
|
if (all?.administrativeLevel1 && value === all?.administrativeLevel1) {
|
|
55745
55745
|
label = all?.linking?.SCL?.value?.name;
|
|
55746
55746
|
} else {
|
|
55747
|
-
label = getNameByLevel(all?.linking?.SCL,
|
|
55747
|
+
label = getNameByLevel(all?.linking?.SCL, "level_1")?.name;
|
|
55748
55748
|
}
|
|
55749
55749
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
55750
|
-
title: label,
|
|
55751
|
-
children: label
|
|
55750
|
+
title: label || '-',
|
|
55751
|
+
children: label || '-'
|
|
55752
55752
|
});
|
|
55753
55753
|
}
|
|
55754
55754
|
}, {
|
|
@@ -55758,15 +55758,20 @@ const getColumns$2 = ({
|
|
|
55758
55758
|
show: true,
|
|
55759
55759
|
ellipsis: true,
|
|
55760
55760
|
render: (value, all) => {
|
|
55761
|
+
if (all.empty) {
|
|
55762
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
55763
|
+
className: "daf-default-cell"
|
|
55764
|
+
});
|
|
55765
|
+
}
|
|
55761
55766
|
let label;
|
|
55762
55767
|
if (all?.administrativeLevel2 && value === all?.administrativeLevel2) {
|
|
55763
55768
|
label = all?.linking?.SCL?.value?.name;
|
|
55764
55769
|
} else {
|
|
55765
|
-
label = getNameByLevel(all?.linking?.SCL,
|
|
55770
|
+
label = getNameByLevel(all?.linking?.SCL, "level_2")?.name;
|
|
55766
55771
|
}
|
|
55767
55772
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
55768
|
-
title: label,
|
|
55769
|
-
children: label
|
|
55773
|
+
title: label || '-',
|
|
55774
|
+
children: label || '-'
|
|
55770
55775
|
});
|
|
55771
55776
|
}
|
|
55772
55777
|
}, {
|
|
@@ -55781,8 +55786,8 @@ const getColumns$2 = ({
|
|
|
55781
55786
|
});
|
|
55782
55787
|
}
|
|
55783
55788
|
const MAX_SOURCES = 3;
|
|
55784
|
-
const count = value
|
|
55785
|
-
return /*#__PURE__*/jsxRuntime.jsx(antd.Avatar.Group, {
|
|
55789
|
+
const count = value?.length === MAX_SOURCES + 1 ? value?.length : MAX_SOURCES;
|
|
55790
|
+
return Array.isArray(value) && value?.length > 0 ? /*#__PURE__*/jsxRuntime.jsx(antd.Avatar.Group, {
|
|
55786
55791
|
max: {
|
|
55787
55792
|
count: count,
|
|
55788
55793
|
style: {
|
|
@@ -55809,7 +55814,7 @@ const getColumns$2 = ({
|
|
|
55809
55814
|
color: token.baseGray90
|
|
55810
55815
|
})
|
|
55811
55816
|
}, i))
|
|
55812
|
-
});
|
|
55817
|
+
}) : '-';
|
|
55813
55818
|
}
|
|
55814
55819
|
}, {
|
|
55815
55820
|
title: "",
|
|
@@ -55846,8 +55851,8 @@ const getColumns$1 = ({
|
|
|
55846
55851
|
}) => {
|
|
55847
55852
|
return [{
|
|
55848
55853
|
title: t("admin::organisation_id"),
|
|
55849
|
-
dataIndex: "
|
|
55850
|
-
key: "
|
|
55854
|
+
dataIndex: "datastakeId",
|
|
55855
|
+
key: "datastakeId",
|
|
55851
55856
|
render: (value, all) => {
|
|
55852
55857
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
55853
55858
|
title: value,
|
|
@@ -55855,7 +55860,7 @@ const getColumns$1 = ({
|
|
|
55855
55860
|
});
|
|
55856
55861
|
}
|
|
55857
55862
|
}, {
|
|
55858
|
-
title: t("
|
|
55863
|
+
title: t("Name"),
|
|
55859
55864
|
dataIndex: "name",
|
|
55860
55865
|
key: "name",
|
|
55861
55866
|
render: (value, all) => {
|
|
@@ -55887,23 +55892,37 @@ const getColumns$1 = ({
|
|
|
55887
55892
|
});
|
|
55888
55893
|
}
|
|
55889
55894
|
}, {
|
|
55890
|
-
title: t("
|
|
55891
|
-
dataIndex: "
|
|
55892
|
-
key: "
|
|
55895
|
+
title: t("Province"),
|
|
55896
|
+
dataIndex: "administrativeLevel1",
|
|
55897
|
+
key: "administrativeLevel1",
|
|
55898
|
+
ellipsis: true,
|
|
55899
|
+
show: true,
|
|
55893
55900
|
render: (value, all) => {
|
|
55901
|
+
let label;
|
|
55902
|
+
if (all?.administrativeLevel1 && value === all?.administrativeLevel1) {
|
|
55903
|
+
label = all?.linking?.SCL?.value?.name;
|
|
55904
|
+
} else {
|
|
55905
|
+
label = getNameByLevel(all?.linking?.SCL, "level_1")?.name;
|
|
55906
|
+
}
|
|
55894
55907
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
55895
|
-
title:
|
|
55896
|
-
children:
|
|
55908
|
+
title: label || '-',
|
|
55909
|
+
children: label || '-'
|
|
55897
55910
|
});
|
|
55898
55911
|
}
|
|
55899
55912
|
}, {
|
|
55900
|
-
title: t("
|
|
55901
|
-
dataIndex: "
|
|
55902
|
-
key: "
|
|
55913
|
+
title: t("Territory"),
|
|
55914
|
+
dataIndex: "administrativeLevel2",
|
|
55915
|
+
key: "administrativeLevel2",
|
|
55903
55916
|
render: (value, all) => {
|
|
55917
|
+
let label;
|
|
55918
|
+
if (all?.administrativeLevel2 && value === all?.administrativeLevel2) {
|
|
55919
|
+
label = all?.linking?.SCL?.value?.name;
|
|
55920
|
+
} else {
|
|
55921
|
+
label = getNameByLevel(all?.linking?.SCL, "level_2")?.name;
|
|
55922
|
+
}
|
|
55904
55923
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
55905
|
-
title:
|
|
55906
|
-
children:
|
|
55924
|
+
title: label || '-',
|
|
55925
|
+
children: label || '-'
|
|
55907
55926
|
});
|
|
55908
55927
|
}
|
|
55909
55928
|
}];
|
|
@@ -55936,8 +55955,11 @@ function CombineLocationModal({
|
|
|
55936
55955
|
}, [selectedLocations, t, selectOptions, module]);
|
|
55937
55956
|
const onSubmit = () => {
|
|
55938
55957
|
MainForm.validateFields().then(data => {
|
|
55939
|
-
|
|
55940
|
-
onSuccess(
|
|
55958
|
+
const ids = selectedLocations.map(location => location._id);
|
|
55959
|
+
onSuccess({
|
|
55960
|
+
ids,
|
|
55961
|
+
data
|
|
55962
|
+
});
|
|
55941
55963
|
});
|
|
55942
55964
|
};
|
|
55943
55965
|
return /*#__PURE__*/jsxRuntime.jsxs(Modal, {
|
|
@@ -55991,8 +56013,8 @@ function CombineLocationModal({
|
|
|
55991
56013
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
55992
56014
|
options: selectedLocations.map(location => {
|
|
55993
56015
|
return {
|
|
55994
|
-
label: location?.
|
|
55995
|
-
value: location?.
|
|
56016
|
+
label: location?.datastakeId || "-",
|
|
56017
|
+
value: location?.datastakeId || "-"
|
|
55996
56018
|
};
|
|
55997
56019
|
}),
|
|
55998
56020
|
placeholder: t("ID")
|
|
@@ -56009,8 +56031,8 @@ function CombineLocationModal({
|
|
|
56009
56031
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
56010
56032
|
options: selectedLocations.map(location => {
|
|
56011
56033
|
return {
|
|
56012
|
-
label: (selectOptions?.category || []).find(option => option.value === location?.category)?.label || location?.category || "
|
|
56013
|
-
value: location?.category || "
|
|
56034
|
+
label: (selectOptions?.category || []).find(option => option.value === location?.category)?.label || location?.category || "-",
|
|
56035
|
+
value: location?.category || "-"
|
|
56014
56036
|
};
|
|
56015
56037
|
}).filter((option, index, self) => index === self.findIndex(o => o.value === option.value)),
|
|
56016
56038
|
placeholder: t("category")
|
|
@@ -56021,35 +56043,37 @@ function CombineLocationModal({
|
|
|
56021
56043
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
56022
56044
|
options: selectedLocations.map(location => {
|
|
56023
56045
|
return {
|
|
56024
|
-
label: (selectOptions?.country || []).find(option => option.value === location?.country)?.label || location?.country || "
|
|
56025
|
-
value: location?.country || "
|
|
56046
|
+
label: (selectOptions?.country || []).find(option => option.value === location?.country)?.label || location?.country || "-",
|
|
56047
|
+
value: location?.country || "-"
|
|
56026
56048
|
};
|
|
56027
56049
|
}).filter((option, index, self) => index === self.findIndex(o => o.value === option.value)),
|
|
56028
56050
|
placeholder: t("admin::country")
|
|
56029
56051
|
})
|
|
56030
56052
|
}), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
56031
56053
|
className: "flex-1",
|
|
56032
|
-
name: "
|
|
56054
|
+
name: "administrativeLevel1",
|
|
56033
56055
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
56034
56056
|
placeholder: t("Province"),
|
|
56035
56057
|
options: selectedLocations.map(location => {
|
|
56058
|
+
const _data = getNameByLevel(location?.linking?.SCL, "level_1");
|
|
56036
56059
|
return {
|
|
56037
|
-
label:
|
|
56038
|
-
value:
|
|
56060
|
+
label: _data?.name || "-",
|
|
56061
|
+
value: _data?.id || "-"
|
|
56039
56062
|
};
|
|
56040
|
-
})
|
|
56063
|
+
}).filter((option, index, self) => index === self.findIndex(o => o.value === option.value))
|
|
56041
56064
|
})
|
|
56042
56065
|
}), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
56043
56066
|
className: "flex-1",
|
|
56044
|
-
name: "
|
|
56067
|
+
name: "administrativeLevel2",
|
|
56045
56068
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
56046
56069
|
placeholder: t("Territory"),
|
|
56047
56070
|
options: selectedLocations.map(location => {
|
|
56071
|
+
const _data = getNameByLevel(location?.linking?.SCL, "level_2");
|
|
56048
56072
|
return {
|
|
56049
|
-
label:
|
|
56050
|
-
value:
|
|
56073
|
+
label: _data?.name || "-",
|
|
56074
|
+
value: _data?.id || "-"
|
|
56051
56075
|
};
|
|
56052
|
-
})
|
|
56076
|
+
}).filter((option, index, self) => index === self.findIndex(o => o.value === option.value))
|
|
56053
56077
|
})
|
|
56054
56078
|
})]
|
|
56055
56079
|
})]
|
|
@@ -56077,7 +56101,8 @@ function LocationTable(_ref) {
|
|
|
56077
56101
|
defaultPageSize = 20,
|
|
56078
56102
|
view,
|
|
56079
56103
|
headerTitle,
|
|
56080
|
-
breadcrumbs
|
|
56104
|
+
breadcrumbs,
|
|
56105
|
+
mergeSubjectsFunction
|
|
56081
56106
|
} = _ref;
|
|
56082
56107
|
const [showFilters, setShowFilters] = React.useState(false);
|
|
56083
56108
|
const [hasError, setHasError] = React.useState(false);
|
|
@@ -56161,12 +56186,12 @@ function LocationTable(_ref) {
|
|
|
56161
56186
|
},
|
|
56162
56187
|
children: selectedLocations.map(account => /*#__PURE__*/jsxRuntime.jsxs(antd.Tag, {
|
|
56163
56188
|
className: "flex flex-row gap-2 items-center",
|
|
56164
|
-
onClick: () => setSelectedLocations(prev => prev.filter(a => a.
|
|
56189
|
+
onClick: () => setSelectedLocations(prev => prev.filter(a => a.datastakeId !== account.datastakeId)),
|
|
56165
56190
|
style: {
|
|
56166
56191
|
cursor: "pointer"
|
|
56167
56192
|
},
|
|
56168
56193
|
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
56169
|
-
children: account.
|
|
56194
|
+
children: account.datastakeId
|
|
56170
56195
|
}), /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
56171
56196
|
name: "Close",
|
|
56172
56197
|
size: 10
|
|
@@ -56194,8 +56219,10 @@ function LocationTable(_ref) {
|
|
|
56194
56219
|
onClose: () => {
|
|
56195
56220
|
setCombineLocationVisible(false);
|
|
56196
56221
|
},
|
|
56197
|
-
onSuccess:
|
|
56222
|
+
onSuccess: data => {
|
|
56223
|
+
console.log(data, "success data");
|
|
56198
56224
|
setCombineLocationVisible(false);
|
|
56225
|
+
// mergeSubjectsFunction(data);
|
|
56199
56226
|
},
|
|
56200
56227
|
selectedLocations: selectedLocations,
|
|
56201
56228
|
selectOptions: selectOptions || {},
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
2
2
|
import { Tooltip } from "antd";
|
|
3
|
+
import { getNameByLevel } from "../../AdminTables/LocationTable/helper.js";
|
|
3
4
|
|
|
4
5
|
export const getColumns = ({ t, selectOptions, module }) => {
|
|
5
6
|
return [
|
|
6
7
|
{
|
|
7
8
|
title: t("admin::organisation_id"),
|
|
8
|
-
dataIndex: "
|
|
9
|
-
key: "
|
|
9
|
+
dataIndex: "datastakeId",
|
|
10
|
+
key: "datastakeId",
|
|
10
11
|
render: (value, all) => {
|
|
11
12
|
return <Tooltip title={value}>{value}</Tooltip>;
|
|
12
13
|
},
|
|
13
14
|
},
|
|
14
15
|
{
|
|
15
|
-
title: t("
|
|
16
|
+
title: t("Name"),
|
|
16
17
|
dataIndex: "name",
|
|
17
18
|
key: "name",
|
|
18
19
|
render: (value, all) => {
|
|
@@ -38,19 +39,35 @@ export const getColumns = ({ t, selectOptions, module }) => {
|
|
|
38
39
|
},
|
|
39
40
|
},
|
|
40
41
|
{
|
|
41
|
-
title: t("
|
|
42
|
-
dataIndex: "
|
|
43
|
-
key: "
|
|
42
|
+
title: t("Province"),
|
|
43
|
+
dataIndex: "administrativeLevel1",
|
|
44
|
+
key: "administrativeLevel1",
|
|
45
|
+
ellipsis: true,
|
|
46
|
+
show: true,
|
|
44
47
|
render: (value, all) => {
|
|
45
|
-
|
|
48
|
+
let label;
|
|
49
|
+
if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
|
|
50
|
+
label = all?.linking?.SCL?.value?.name
|
|
51
|
+
} else {
|
|
52
|
+
label = getNameByLevel(all?.linking?.SCL, "level_1")?.name
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
46
56
|
},
|
|
47
57
|
},
|
|
48
58
|
{
|
|
49
|
-
title: t("
|
|
50
|
-
dataIndex: "
|
|
51
|
-
key: "
|
|
59
|
+
title: t("Territory"),
|
|
60
|
+
dataIndex: "administrativeLevel2",
|
|
61
|
+
key: "administrativeLevel2",
|
|
52
62
|
render: (value, all) => {
|
|
53
|
-
|
|
63
|
+
let label;
|
|
64
|
+
if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
|
|
65
|
+
label = all?.linking?.SCL?.value?.name
|
|
66
|
+
} else {
|
|
67
|
+
label = getNameByLevel(all?.linking?.SCL, "level_2")?.name
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
54
71
|
},
|
|
55
72
|
},
|
|
56
73
|
];
|
|
@@ -5,6 +5,8 @@ import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
|
5
5
|
import DAFTable from "../../../../Table/index.jsx";
|
|
6
6
|
import { useMemo, useState } from "react";
|
|
7
7
|
import { getColumns } from "./helper.js";
|
|
8
|
+
import { getNameByLevel } from "../../AdminTables/LocationTable/helper.js";
|
|
9
|
+
|
|
8
10
|
const { useToken } = theme;
|
|
9
11
|
|
|
10
12
|
export default function CombineLocationModal({
|
|
@@ -31,8 +33,11 @@ export default function CombineLocationModal({
|
|
|
31
33
|
|
|
32
34
|
const onSubmit = () => {
|
|
33
35
|
MainForm.validateFields().then((data) => {
|
|
34
|
-
|
|
35
|
-
onSuccess(
|
|
36
|
+
const ids = selectedLocations.map((location) => location._id);
|
|
37
|
+
onSuccess({
|
|
38
|
+
ids,
|
|
39
|
+
data,
|
|
40
|
+
});
|
|
36
41
|
});
|
|
37
42
|
};
|
|
38
43
|
|
|
@@ -94,8 +99,8 @@ export default function CombineLocationModal({
|
|
|
94
99
|
<Select
|
|
95
100
|
options={selectedLocations.map((location) => {
|
|
96
101
|
return {
|
|
97
|
-
label: location?.
|
|
98
|
-
value: location?.
|
|
102
|
+
label: location?.datastakeId || "-",
|
|
103
|
+
value: location?.datastakeId || "-",
|
|
99
104
|
};
|
|
100
105
|
})}
|
|
101
106
|
placeholder={t("ID")}
|
|
@@ -116,8 +121,8 @@ export default function CombineLocationModal({
|
|
|
116
121
|
(option) => option.value === location?.category,
|
|
117
122
|
)?.label ||
|
|
118
123
|
location?.category ||
|
|
119
|
-
"
|
|
120
|
-
value: location?.category || "
|
|
124
|
+
"-",
|
|
125
|
+
value: location?.category || "-",
|
|
121
126
|
};
|
|
122
127
|
})
|
|
123
128
|
.filter(
|
|
@@ -138,8 +143,8 @@ export default function CombineLocationModal({
|
|
|
138
143
|
(option) => option.value === location?.country,
|
|
139
144
|
)?.label ||
|
|
140
145
|
location?.country ||
|
|
141
|
-
"
|
|
142
|
-
value: location?.country || "
|
|
146
|
+
"-",
|
|
147
|
+
value: location?.country || "-",
|
|
143
148
|
};
|
|
144
149
|
})
|
|
145
150
|
.filter(
|
|
@@ -150,27 +155,35 @@ export default function CombineLocationModal({
|
|
|
150
155
|
></Select>
|
|
151
156
|
</Form.Item>
|
|
152
157
|
|
|
153
|
-
<Form.Item className="flex-1" name="
|
|
158
|
+
<Form.Item className="flex-1" name="administrativeLevel1">
|
|
154
159
|
<Select
|
|
155
160
|
placeholder={t("Province")}
|
|
156
161
|
options={selectedLocations.map((location) => {
|
|
162
|
+
const _data = getNameByLevel(location?.linking?.SCL, "level_1");
|
|
157
163
|
return {
|
|
158
|
-
label:
|
|
159
|
-
value:
|
|
160
|
-
}
|
|
161
|
-
})
|
|
164
|
+
label: _data?.name || "-",
|
|
165
|
+
value: _data?.id || "-",
|
|
166
|
+
}
|
|
167
|
+
}).filter(
|
|
168
|
+
(option, index, self) =>
|
|
169
|
+
index === self.findIndex((o) => o.value === option.value),
|
|
170
|
+
)}
|
|
162
171
|
></Select>
|
|
163
172
|
</Form.Item>
|
|
164
173
|
|
|
165
|
-
<Form.Item className="flex-1" name="
|
|
174
|
+
<Form.Item className="flex-1" name="administrativeLevel2">
|
|
166
175
|
<Select
|
|
167
176
|
placeholder={t("Territory")}
|
|
168
177
|
options={selectedLocations.map((location) => {
|
|
178
|
+
const _data = getNameByLevel(location?.linking?.SCL, "level_2");
|
|
169
179
|
return {
|
|
170
|
-
label:
|
|
171
|
-
value:
|
|
172
|
-
}
|
|
173
|
-
})
|
|
180
|
+
label: _data?.name || "-",
|
|
181
|
+
value: _data?.id || "-",
|
|
182
|
+
}
|
|
183
|
+
}).filter(
|
|
184
|
+
(option, index, self) =>
|
|
185
|
+
index === self.findIndex((o) => o.value === option.value),
|
|
186
|
+
)}
|
|
174
187
|
></Select>
|
|
175
188
|
</Form.Item>
|
|
176
189
|
</Form>
|
package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/LocationTable.stories.js
CHANGED
|
@@ -27,50 +27,155 @@ export const Primary = {
|
|
|
27
27
|
data: {
|
|
28
28
|
data: [
|
|
29
29
|
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
"_id": "68d15dff5c53c03e613a978b",
|
|
31
|
+
"createdAt": "2025-09-22T14:32:31.513Z",
|
|
32
|
+
"updatedAt": "2025-09-22T14:32:31.513Z",
|
|
33
|
+
"id": "937b8b13-947d-4ee0-accf-961cbc63c663",
|
|
34
|
+
"name": "Armed Group",
|
|
35
|
+
"authorId": "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
|
|
36
|
+
"collectId": "5d0ba2c7110a07ae97fa63e06b1041fe76367e2b",
|
|
37
|
+
"country": "AL",
|
|
38
|
+
"category": "nonStateArmedGroup",
|
|
39
|
+
"sources": [],
|
|
40
|
+
"subCategory": "militia",
|
|
41
|
+
"datastakeId": "STK-00000000452",
|
|
42
|
+
"linking": {
|
|
43
|
+
"SCL": {
|
|
44
|
+
"6839cb26-5af4-44a3-b136-a0f0a0bcecc6": {
|
|
45
|
+
"_id": {},
|
|
46
|
+
"createdAt": "2023-02-19T17:25:34.444Z",
|
|
47
|
+
"updatedAt": "2023-02-19T17:25:34.444Z",
|
|
48
|
+
"id": "6839cb26-5af4-44a3-b136-a0f0a0bcecc6",
|
|
49
|
+
"level": "level_1",
|
|
50
|
+
"country": "AL",
|
|
51
|
+
"collectId": "1e29d64aee47553eba7e89bf04d43cc7c1c1a017",
|
|
52
|
+
"name": "Berat",
|
|
53
|
+
"__v": 0
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"__v": 0
|
|
37
58
|
},
|
|
38
59
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
60
|
+
"_id": "68d26bad5c53c03e613a9fef",
|
|
61
|
+
"createdAt": "2025-09-23T09:43:09.055Z",
|
|
62
|
+
"updatedAt": "2025-09-23T09:43:09.055Z",
|
|
63
|
+
"id": "e3d4b71c-63b2-4a57-8833-ea4cfa519a67",
|
|
64
|
+
"name": "Test",
|
|
65
|
+
"authorId": "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
|
|
66
|
+
"collectId": "cc1e6e29bb85f01ec835687b607f8179d7ea3ff3",
|
|
67
|
+
"country": "AL",
|
|
68
|
+
"category": "nonStateArmedGroup",
|
|
69
|
+
"sources": [],
|
|
70
|
+
"subCategory": "militia",
|
|
71
|
+
"datastakeId": "STK-00000000453",
|
|
72
|
+
"linking": {
|
|
73
|
+
"SCL": {
|
|
74
|
+
"6839cb26-5af4-44a3-b136-a0f0a0bcecc6": {
|
|
75
|
+
"_id": {},
|
|
76
|
+
"createdAt": "2023-02-19T17:25:34.444Z",
|
|
77
|
+
"updatedAt": "2023-02-19T17:25:34.444Z",
|
|
78
|
+
"id": "6839cb26-5af4-44a3-b136-a0f0a0bcecc6",
|
|
79
|
+
"level": "level_1",
|
|
80
|
+
"country": "AL",
|
|
81
|
+
"collectId": "1e29d64aee47553eba7e89bf04d43cc7c1c1a017",
|
|
82
|
+
"name": "Berat",
|
|
83
|
+
"__v": 0
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"__v": 0
|
|
46
88
|
},
|
|
47
89
|
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
90
|
+
"_id": "68d519355c53c03e613ad03a",
|
|
91
|
+
"createdAt": "2025-09-25T10:28:05.989Z",
|
|
92
|
+
"updatedAt": "2025-09-25T10:28:05.989Z",
|
|
93
|
+
"id": "1f5ac021-c82d-46ce-817a-c4045392b13d",
|
|
94
|
+
"name": "This operator will have a name so ridiculously long that every other name will sulk in jealousy, rushing to hand over their daughters just like in the medieval days, hoping his children will inherit even half the glory of that absurdly oversized title.",
|
|
95
|
+
"authorId": "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
|
|
96
|
+
"collectId": "203f6b80dac93e506d50073b0a8e365a727aceae",
|
|
97
|
+
"country": "AX",
|
|
98
|
+
"category": "corporation",
|
|
99
|
+
"sources": [],
|
|
100
|
+
"subCategory": "publicCompany",
|
|
101
|
+
"datastakeId": "STK-00000000454",
|
|
102
|
+
"__v": 0
|
|
55
103
|
},
|
|
56
104
|
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
105
|
+
"_id": "68d687408a2a09b08388b0e8",
|
|
106
|
+
"createdAt": "2025-09-26T12:29:52.120Z",
|
|
107
|
+
"updatedAt": "2025-09-26T12:29:52.120Z",
|
|
108
|
+
"id": "9fe2475c-98a6-4a72-a9c7-0b459f44c0ed",
|
|
109
|
+
"name": "ANOTHER OP",
|
|
110
|
+
"authorId": "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
|
|
111
|
+
"collectId": "d77e36a69838047cc627933b935a93dcedb1ee06",
|
|
112
|
+
"country": "AL",
|
|
113
|
+
"category": "corporation",
|
|
114
|
+
"sources": [],
|
|
115
|
+
"subCategory": "publicCompany",
|
|
116
|
+
"datastakeId": "STK-00000000455",
|
|
117
|
+
"__v": 0
|
|
64
118
|
},
|
|
65
119
|
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
120
|
+
"_id": "68d6881b5b4566f0cabcbff2",
|
|
121
|
+
"createdAt": "2025-09-26T12:33:31.263Z",
|
|
122
|
+
"updatedAt": "2025-09-26T12:33:31.263Z",
|
|
123
|
+
"id": "9c561b78-452a-468a-9c71-a8380d1bdc1d",
|
|
124
|
+
"name": "SOME GUY",
|
|
125
|
+
"authorId": "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
|
|
126
|
+
"collectId": "a94ffae8f0f46dcde6d9c5f21eab16b041051209",
|
|
127
|
+
"country": "AL",
|
|
128
|
+
"category": "corporation",
|
|
129
|
+
"sources": [],
|
|
130
|
+
"subCategory": "publicCompany",
|
|
131
|
+
"datastakeId": "STK-00000000456",
|
|
132
|
+
"__v": 0
|
|
73
133
|
},
|
|
134
|
+
{
|
|
135
|
+
"_id": "68d6946a84cca23fe8a6abe4",
|
|
136
|
+
"createdAt": "2025-09-26T13:26:02.415Z",
|
|
137
|
+
"updatedAt": "2025-09-26T13:26:02.415Z",
|
|
138
|
+
"id": "bb2a2497-eae6-47a4-b903-9f0663dc8b0c",
|
|
139
|
+
"name": "THIS SOWULD BE THE 4-th OP FOR THIS MS",
|
|
140
|
+
"authorId": "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
|
|
141
|
+
"collectId": "da9d2cb826b1ffb51f3acc97a3bc2d2110bad033",
|
|
142
|
+
"country": "AL",
|
|
143
|
+
"category": "corporation",
|
|
144
|
+
"sources": [],
|
|
145
|
+
"subCategory": "privateCompany",
|
|
146
|
+
"datastakeId": "STK-00000000457",
|
|
147
|
+
"__v": 0
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"_id": "68d6963009b07d172ba0ed25",
|
|
151
|
+
"createdAt": "2025-09-26T13:33:36.403Z",
|
|
152
|
+
"updatedAt": "2025-09-26T13:33:36.403Z",
|
|
153
|
+
"id": "058894d7-22a8-4804-b4a8-98be5003f310",
|
|
154
|
+
"name": "THE BES OP EVER",
|
|
155
|
+
"authorId": "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
|
|
156
|
+
"collectId": "6d8b56767a7edc6fc605d9c669ce0878d4918630",
|
|
157
|
+
"country": "AX",
|
|
158
|
+
"category": "corporation",
|
|
159
|
+
"sources": [],
|
|
160
|
+
"subCategory": "stockCompany",
|
|
161
|
+
"datastakeId": "STK-00000000458",
|
|
162
|
+
"__v": 0
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"_id": "68d6999991fe77d8e0113b0b",
|
|
166
|
+
"createdAt": "2025-09-26T13:48:09.933Z",
|
|
167
|
+
"updatedAt": "2025-09-26T13:48:09.933Z",
|
|
168
|
+
"id": "0777e572-6f47-4d54-a58c-7a43ef26d3c1",
|
|
169
|
+
"name": "Grupim i armatosur",
|
|
170
|
+
"authorId": "fc4ca5c6-f46d-424f-a948-d66b031a82c3",
|
|
171
|
+
"collectId": "8c26f08b914b23459e52e3506e30caf508d9679d",
|
|
172
|
+
"country": "AL",
|
|
173
|
+
"category": "nonStateArmedGroup",
|
|
174
|
+
"sources": [],
|
|
175
|
+
"subCategory": "militia",
|
|
176
|
+
"datastakeId": "STK-00000000459",
|
|
177
|
+
"__v": 0
|
|
178
|
+
}
|
|
74
179
|
],
|
|
75
180
|
meta: {
|
|
76
181
|
total: 0,
|
|
@@ -63,9 +63,9 @@ export const checkboxConfig = {
|
|
|
63
63
|
datastakeId: "ID",
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
export const getNameByLevel = (data, level) => {
|
|
67
67
|
const entry = Object.values(data || {}).find(item => item.level === level);
|
|
68
|
-
return entry
|
|
68
|
+
return entry;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
export const getColumns = ({
|
|
@@ -102,7 +102,7 @@ export const getColumns = ({
|
|
|
102
102
|
}
|
|
103
103
|
checked={selectedLocations.some((p) => p.id === all.id)}
|
|
104
104
|
disabled={
|
|
105
|
-
selectedLocations
|
|
105
|
+
selectedLocations?.length >= 3 &&
|
|
106
106
|
!selectedLocations.some((p) => p.id === all.id)
|
|
107
107
|
}
|
|
108
108
|
/>
|
|
@@ -111,8 +111,8 @@ export const getColumns = ({
|
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
title: t("ID"),
|
|
114
|
-
dataIndex: "
|
|
115
|
-
key: "
|
|
114
|
+
dataIndex: "datastakeId",
|
|
115
|
+
key: "datastakeId",
|
|
116
116
|
ellipsis: true,
|
|
117
117
|
show: true,
|
|
118
118
|
render: (value, all) => {
|
|
@@ -183,10 +183,10 @@ export const getColumns = ({
|
|
|
183
183
|
if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
|
|
184
184
|
label = all?.linking?.SCL?.value?.name
|
|
185
185
|
} else {
|
|
186
|
-
label = getNameByLevel(all?.linking?.SCL,
|
|
186
|
+
label = getNameByLevel(all?.linking?.SCL, "level_1")?.name
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
return <Tooltip title={label}>{label}</Tooltip>;
|
|
189
|
+
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
190
190
|
},
|
|
191
191
|
},
|
|
192
192
|
{
|
|
@@ -196,14 +196,18 @@ export const getColumns = ({
|
|
|
196
196
|
show: true,
|
|
197
197
|
ellipsis: true,
|
|
198
198
|
render: (value, all) => {
|
|
199
|
+
if (all.empty) {
|
|
200
|
+
return <div className="daf-default-cell" />;
|
|
201
|
+
}
|
|
202
|
+
|
|
199
203
|
let label;
|
|
200
204
|
if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
|
|
201
205
|
label = all?.linking?.SCL?.value?.name
|
|
202
206
|
} else {
|
|
203
|
-
label = getNameByLevel(all?.linking?.SCL,
|
|
207
|
+
label = getNameByLevel(all?.linking?.SCL, "level_2")?.name
|
|
204
208
|
}
|
|
205
209
|
|
|
206
|
-
return <Tooltip title={label}>{label}</Tooltip>;
|
|
210
|
+
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
207
211
|
},
|
|
208
212
|
},
|
|
209
213
|
{
|
|
@@ -217,41 +221,41 @@ export const getColumns = ({
|
|
|
217
221
|
}
|
|
218
222
|
|
|
219
223
|
const MAX_SOURCES = 3;
|
|
220
|
-
const count = value
|
|
224
|
+
const count = value?.length === MAX_SOURCES + 1 ? value?.length : MAX_SOURCES;
|
|
221
225
|
return (
|
|
222
|
-
<Avatar.Group
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
226
|
+
Array.isArray(value) && value?.length > 0 ? <Avatar.Group
|
|
227
|
+
max={{
|
|
228
|
+
count: count,
|
|
229
|
+
style: {
|
|
230
|
+
color: token.baseGray90,
|
|
231
|
+
backgroundColor: token.baseGray20,
|
|
232
|
+
border: `1px solid ${token.baseGray40}`,
|
|
233
|
+
},
|
|
234
|
+
}}
|
|
235
|
+
size={"small"}
|
|
236
|
+
>
|
|
237
|
+
{value.map((v, i) => (
|
|
238
|
+
<Avatar
|
|
239
|
+
key={i}
|
|
240
|
+
size={"small"}
|
|
241
|
+
style={{
|
|
227
242
|
backgroundColor: token.baseGray20,
|
|
243
|
+
color: token.baseGray90,
|
|
228
244
|
border: `1px solid ${token.baseGray40}`,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
<
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
justifyContent: "center",
|
|
244
|
-
}}
|
|
245
|
-
>
|
|
246
|
-
<CustomIcon
|
|
247
|
-
name="Organisation02"
|
|
248
|
-
width={18}
|
|
249
|
-
height={18}
|
|
250
|
-
color={token.baseGray90}
|
|
251
|
-
/>
|
|
252
|
-
</Avatar>
|
|
253
|
-
))}
|
|
254
|
-
</Avatar.Group>
|
|
245
|
+
display: "flex",
|
|
246
|
+
alignItems: "center",
|
|
247
|
+
justifyContent: "center",
|
|
248
|
+
}}
|
|
249
|
+
>
|
|
250
|
+
<CustomIcon
|
|
251
|
+
name="Organisation02"
|
|
252
|
+
width={18}
|
|
253
|
+
height={18}
|
|
254
|
+
color={token.baseGray90}
|
|
255
|
+
/>
|
|
256
|
+
</Avatar>
|
|
257
|
+
))}
|
|
258
|
+
</Avatar.Group> : '-'
|
|
255
259
|
);
|
|
256
260
|
},
|
|
257
261
|
},
|
|
@@ -28,6 +28,7 @@ export default function LocationTable({
|
|
|
28
28
|
view,
|
|
29
29
|
headerTitle,
|
|
30
30
|
breadcrumbs,
|
|
31
|
+
mergeSubjectsFunction,
|
|
31
32
|
}) {
|
|
32
33
|
const [showFilters, setShowFilters] = useState(false);
|
|
33
34
|
const [hasError, setHasError] = useState(false);
|
|
@@ -120,14 +121,14 @@ export default function LocationTable({
|
|
|
120
121
|
className="flex flex-row gap-2 items-center"
|
|
121
122
|
onClick={() =>
|
|
122
123
|
setSelectedLocations((prev) =>
|
|
123
|
-
prev.filter((a) => a.
|
|
124
|
+
prev.filter((a) => a.datastakeId !== account.datastakeId),
|
|
124
125
|
)
|
|
125
126
|
}
|
|
126
127
|
style={{
|
|
127
128
|
cursor: "pointer",
|
|
128
129
|
}}
|
|
129
130
|
>
|
|
130
|
-
<span>{account.
|
|
131
|
+
<span>{account.datastakeId}</span>
|
|
131
132
|
<CustomIcon name="Close" size={10} />
|
|
132
133
|
</Tag>
|
|
133
134
|
))}
|
|
@@ -157,8 +158,10 @@ export default function LocationTable({
|
|
|
157
158
|
onClose={() => {
|
|
158
159
|
setCombineLocationVisible(false);
|
|
159
160
|
}}
|
|
160
|
-
onSuccess={() => {
|
|
161
|
+
onSuccess={(data) => {
|
|
162
|
+
console.log(data, "success data");
|
|
161
163
|
setCombineLocationVisible(false);
|
|
164
|
+
// mergeSubjectsFunction(data);
|
|
162
165
|
}}
|
|
163
166
|
selectedLocations={selectedLocations}
|
|
164
167
|
selectOptions={selectOptions || {}}
|