datastake-daf 0.6.335 → 0.6.337

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.
@@ -54498,10 +54498,10 @@ function useAdminTable({
54498
54498
  } = await getData({
54499
54499
  params
54500
54500
  });
54501
- setData(data.data);
54501
+ setData(data.data || data);
54502
54502
  filter.setPagination(prev => ({
54503
54503
  ...prev,
54504
- total: data?.meta?.total || 0
54504
+ total: data?.meta?.total || data?.length || 0
54505
54505
  }));
54506
54506
  if (!initFetchDone) {
54507
54507
  setInitFetchDone(true);
@@ -55620,6 +55620,10 @@ const checkboxConfig$8 = {
55620
55620
  name: "Name",
55621
55621
  datastakeId: "ID"
55622
55622
  };
55623
+ function getNameByLevel(data, level) {
55624
+ const entry = Object.values(data).find(item => item.level === level);
55625
+ return entry ? entry.name : null;
55626
+ }
55623
55627
  const getColumns$2 = ({
55624
55628
  t,
55625
55629
  goTo = () => {},
@@ -55725,9 +55729,9 @@ const getColumns$2 = ({
55725
55729
  });
55726
55730
  }
55727
55731
  }, {
55728
- title: t("admin-level-1"),
55729
- dataIndex: "adminLevel1",
55730
- key: "adminLevel1",
55732
+ title: t("Province"),
55733
+ dataIndex: "administrativeLevel1",
55734
+ key: "administrativeLevel1",
55731
55735
  ellipsis: true,
55732
55736
  show: true,
55733
55737
  render: (value, all) => {
@@ -55736,26 +55740,33 @@ const getColumns$2 = ({
55736
55740
  className: "daf-default-cell"
55737
55741
  });
55738
55742
  }
55743
+ let label;
55744
+ if (all?.administrativeLevel1 && value === all?.administrativeLevel1) {
55745
+ label = all?.linking?.SCL?.value?.name;
55746
+ } else {
55747
+ label = getNameByLevel(all?.linking?.SCL, value);
55748
+ }
55739
55749
  return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
55740
- title: value,
55741
- children: value
55750
+ title: label,
55751
+ children: label
55742
55752
  });
55743
55753
  }
55744
55754
  }, {
55745
- title: t("admin-level-2"),
55746
- dataIndex: "adminLevel2",
55747
- key: "adminLevel2",
55755
+ title: t("Territory"),
55756
+ dataIndex: "administrativeLevel2",
55757
+ key: "administrativeLevel2",
55748
55758
  show: true,
55749
55759
  ellipsis: true,
55750
55760
  render: (value, all) => {
55751
- if (all.empty) {
55752
- return /*#__PURE__*/jsxRuntime.jsx("div", {
55753
- className: "daf-default-cell"
55754
- });
55761
+ let label;
55762
+ if (all?.administrativeLevel2 && value === all?.administrativeLevel2) {
55763
+ label = all?.linking?.SCL?.value?.name;
55764
+ } else {
55765
+ label = getNameByLevel(all?.linking?.SCL, value);
55755
55766
  }
55756
55767
  return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
55757
- title: value,
55758
- children: value
55768
+ title: label,
55769
+ children: label
55759
55770
  });
55760
55771
  }
55761
55772
  }, {
@@ -56020,7 +56031,7 @@ function CombineLocationModal({
56020
56031
  className: "flex-1",
56021
56032
  name: "adminLevel1",
56022
56033
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
56023
- placeholder: t("admin::admin-level-1"),
56034
+ placeholder: t("Province"),
56024
56035
  options: selectedLocations.map(location => {
56025
56036
  return {
56026
56037
  label: location?.adminLevel1 || "--",
@@ -56032,7 +56043,7 @@ function CombineLocationModal({
56032
56043
  className: "flex-1",
56033
56044
  name: "adminLevel2",
56034
56045
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
56035
- placeholder: t("admin::admin-level-2"),
56046
+ placeholder: t("Territory"),
56036
56047
  options: selectedLocations.map(location => {
56037
56048
  return {
56038
56049
  label: location?.adminLevel2 || "--",
@@ -7414,7 +7414,10 @@ const en = {
7414
7414
  FB00006: "Account successfully activated",
7415
7415
  FB00007: "Make sure that this has been properly communicated, as the account admin holds critical user management privileges.",
7416
7416
  admin: {
7417
- locations: "Locations",
7417
+ "events": "Events",
7418
+ "documents": "Documents",
7419
+ "stakeholders": "Stakeholders",
7420
+ "locations": "Locations",
7418
7421
  "review-requests": "Review Requests",
7419
7422
  "create-account": "Create Account",
7420
7423
  "manage-users": "Manage Users",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.335",
3
+ "version": "0.6.337",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -152,7 +152,7 @@ export default function CombineLocationModal({
152
152
 
153
153
  <Form.Item className="flex-1" name="adminLevel1">
154
154
  <Select
155
- placeholder={t("admin::admin-level-1")}
155
+ placeholder={t("Province")}
156
156
  options={selectedLocations.map((location) => {
157
157
  return {
158
158
  label: location?.adminLevel1 || "--",
@@ -164,7 +164,7 @@ export default function CombineLocationModal({
164
164
 
165
165
  <Form.Item className="flex-1" name="adminLevel2">
166
166
  <Select
167
- placeholder={t("admin::admin-level-2")}
167
+ placeholder={t("Territory")}
168
168
  options={selectedLocations.map((location) => {
169
169
  return {
170
170
  label: location?.adminLevel2 || "--",
@@ -63,6 +63,11 @@ export const checkboxConfig = {
63
63
  datastakeId: "ID",
64
64
  };
65
65
 
66
+ function getNameByLevel(data, level) {
67
+ const entry = Object.values(data).find(item => item.level === level);
68
+ return entry ? entry.name : null;
69
+ }
70
+
66
71
  export const getColumns = ({
67
72
  t,
68
73
  goTo = () => {},
@@ -164,9 +169,9 @@ export const getColumns = ({
164
169
  },
165
170
  },
166
171
  {
167
- title: t("admin-level-1"),
168
- dataIndex: "adminLevel1",
169
- key: "adminLevel1",
172
+ title: t("Province"),
173
+ dataIndex: "administrativeLevel1",
174
+ key: "administrativeLevel1",
170
175
  ellipsis: true,
171
176
  show: true,
172
177
  render: (value, all) => {
@@ -174,21 +179,31 @@ export const getColumns = ({
174
179
  return <div className="daf-default-cell" />;
175
180
  }
176
181
 
177
- return <Tooltip title={value}>{value}</Tooltip>;
182
+ let label;
183
+ if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
184
+ label = all?.linking?.SCL?.value?.name
185
+ } else {
186
+ label = getNameByLevel(all?.linking?.SCL, value, "level_1")
187
+ }
188
+
189
+ return <Tooltip title={label}>{label}</Tooltip>;
178
190
  },
179
191
  },
180
192
  {
181
- title: t("admin-level-2"),
182
- dataIndex: "adminLevel2",
183
- key: "adminLevel2",
193
+ title: t("Territory"),
194
+ dataIndex: "administrativeLevel2",
195
+ key: "administrativeLevel2",
184
196
  show: true,
185
197
  ellipsis: true,
186
198
  render: (value, all) => {
187
- if (all.empty) {
188
- return <div className="daf-default-cell" />;
199
+ let label;
200
+ if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
201
+ label = all?.linking?.SCL?.value?.name
202
+ } else {
203
+ label = getNameByLevel(all?.linking?.SCL, value, "level_2")
189
204
  }
190
205
 
191
- return <Tooltip title={value}>{value}</Tooltip>;
206
+ return <Tooltip title={label}>{label}</Tooltip>;
192
207
  },
193
208
  },
194
209
  {
@@ -65,8 +65,8 @@ export function useAdminTable({
65
65
  activeFilters: filter.activeFilters,
66
66
  });
67
67
  const { data } = await getData({ params });
68
- setData(data.data);
69
- filter.setPagination((prev) => ({ ...prev, total: data?.meta?.total || 0 }));
68
+ setData(data.data || data);
69
+ filter.setPagination((prev) => ({ ...prev, total: data?.meta?.total || data?.length || 0 }));
70
70
  if (!initFetchDone) {
71
71
  setInitFetchDone(true);
72
72
  }
@@ -1304,7 +1304,10 @@ const en = {
1304
1304
  FB00007:
1305
1305
  "Make sure that this has been properly communicated, as the account admin holds critical user management privileges.",
1306
1306
  admin: {
1307
- locations: "Locations",
1307
+ "events": "Events",
1308
+ "documents": "Documents",
1309
+ "stakeholders": "Stakeholders",
1310
+ "locations": "Locations",
1308
1311
  "review-requests": "Review Requests",
1309
1312
  "create-account": "Create Account",
1310
1313
  "manage-users": "Manage Users",