datastake-daf 0.6.785 → 0.6.787

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/components/index.js +674 -399
  2. package/dist/hooks/index.js +9 -1
  3. package/dist/pages/index.js +24 -16
  4. package/dist/services/index.js +10 -1
  5. package/dist/utils/index.js +28 -12
  6. package/package.json +1 -1
  7. package/src/@daf/core/components/Dashboard/Map/hook.js +1 -1
  8. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/hook.js +0 -1
  9. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +1 -1
  10. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +1 -1
  11. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -1
  12. package/src/@daf/core/components/Screens/Admin/AdminModals/AddUser/index.jsx +0 -1
  13. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +1 -1
  14. package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +1 -1
  15. package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
  16. package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +5 -5
  17. package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +2 -2
  18. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/column.js +224 -0
  19. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +65 -0
  20. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +23 -5
  21. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/columns.js +36 -36
  22. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +12 -21
  23. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +13 -8
  24. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +2 -2
  25. package/src/@daf/core/components/Screens/Admin/adminRoutes.js +2 -2
  26. package/src/@daf/hooks/useGetQueryParams.js +3 -1
  27. package/src/@daf/pages/Events/Activities/columns.js +2 -2
  28. package/src/@daf/pages/Events/Activities/config.js +2 -2
  29. package/src/@daf/pages/Events/Incidents/columns.js +2 -2
  30. package/src/@daf/pages/Events/Incidents/config.js +2 -2
  31. package/src/@daf/pages/Locations/MineSite/columns.js +2 -2
  32. package/src/@daf/pages/Locations/columns.js +2 -2
  33. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/columns.js +180 -0
  34. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/config.js +0 -0
  35. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/index.jsx +27 -0
  36. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/columns.js +157 -0
  37. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/config.js +31 -0
  38. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/index.js +77 -0
  39. package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/columns.js +117 -0
  40. package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/index.jsx +54 -0
  41. package/src/@daf/pages/SelfAssesment/index.jsx +0 -0
  42. package/src/@daf/pages/Stakeholders/Operators/columns.js +2 -2
  43. package/src/@daf/services/AdminService.js +12 -3
  44. package/src/@daf/services/DashboardService.js +2 -1
  45. package/src/@daf/utils/filters.js +89 -89
  46. package/src/constants/locales/en/translation.js +3 -0
  47. package/src/constants/locales/fr/translation.js +1 -1
  48. package/src/constants/locales/sp/translation.js +1 -1
  49. package/build/favicon.ico +0 -0
  50. package/build/logo192.png +0 -0
  51. package/build/logo512.png +0 -0
  52. package/build/manifest.json +0 -25
  53. package/build/robots.txt +0 -3
  54. package/dist/style/datastake/mapbox-gl.css +0 -330
@@ -2384,6 +2384,8 @@ const useGetQueryParams = ({
2384
2384
  searchParams: rawSearchParams,
2385
2385
  sortBy,
2386
2386
  sortDir,
2387
+ status,
2388
+ product,
2387
2389
  ...rest
2388
2390
  } = queryParams;
2389
2391
  return {
@@ -2396,7 +2398,13 @@ const useGetQueryParams = ({
2396
2398
  fields: safeJsonParse(rawSearchParams)
2397
2399
  },
2398
2400
  otherParams: {
2399
- ...rest
2401
+ ...rest,
2402
+ ...(product && {
2403
+ "products.typeOfProduct": product
2404
+ }),
2405
+ ...(status && {
2406
+ published: status === "submitted" ? true : false
2407
+ })
2400
2408
  },
2401
2409
  sortBy,
2402
2410
  sortDir
@@ -9963,7 +9963,7 @@ const useMap = ({
9963
9963
  });
9964
9964
  function handleSelectMarker(clickedMarker) {
9965
9965
  setSelectedMarkersId(prev => {
9966
- if (prev.includes(clickedMarker.datastakeId)) {
9966
+ if (openPopupIdRef.current === clickedMarker.datastakeId) {
9967
9967
  // Deselecting - clear polylines
9968
9968
  openPopupIdRef.current = null;
9969
9969
  setMarkerWithPopup(null);
@@ -15380,7 +15380,7 @@ const getColumns$d = ({
15380
15380
  }
15381
15381
  }, {
15382
15382
  dataIndex: 'province',
15383
- title: t('Province'),
15383
+ title: findOptions(user?.company?.country, options?.administrativeLevel1) || t("Province"),
15384
15384
  ellipsis: true,
15385
15385
  show: true,
15386
15386
  render: (v, all) => {
@@ -15397,7 +15397,7 @@ const getColumns$d = ({
15397
15397
  }
15398
15398
  }, {
15399
15399
  dataIndex: 'territory',
15400
- title: t('Territory'),
15400
+ title: findOptions(user?.company?.country, options?.administrativeLevel2) || t("Territory"),
15401
15401
  ellipsis: true,
15402
15402
  show: true,
15403
15403
  render: (v, all) => {
@@ -30172,6 +30172,8 @@ const useGetQueryParams = ({
30172
30172
  searchParams: rawSearchParams,
30173
30173
  sortBy,
30174
30174
  sortDir,
30175
+ status,
30176
+ product,
30175
30177
  ...rest
30176
30178
  } = queryParams;
30177
30179
  return {
@@ -30184,7 +30186,13 @@ const useGetQueryParams = ({
30184
30186
  fields: safeJsonParse(rawSearchParams)
30185
30187
  },
30186
30188
  otherParams: {
30187
- ...rest
30189
+ ...rest,
30190
+ ...(product && {
30191
+ "products.typeOfProduct": product
30192
+ }),
30193
+ ...(status && {
30194
+ published: status === "submitted" ? true : false
30195
+ })
30188
30196
  },
30189
30197
  sortBy,
30190
30198
  sortDir
@@ -31654,7 +31662,7 @@ const getFiltersConfig$6 = ({
31654
31662
  flex: 1
31655
31663
  }
31656
31664
  },
31657
- category: {
31665
+ eventCategory: {
31658
31666
  type: 'select',
31659
31667
  label: 'Category',
31660
31668
  placeholder: () => `${t('Filter by')} ${t('Category').toLowerCase()}`,
@@ -31747,7 +31755,7 @@ const getFilterOptions$6 = (options, t) => {
31747
31755
  value: "private",
31748
31756
  label: t("Private")
31749
31757
  }],
31750
- category: _categoryOptions,
31758
+ eventCategory: _categoryOptions,
31751
31759
  country: countries,
31752
31760
  subCategory: subCategoriesOptions,
31753
31761
  // category: category,
@@ -31863,7 +31871,7 @@ const getColumns$9 = ({
31863
31871
  }
31864
31872
  }, {
31865
31873
  dataIndex: 'province',
31866
- title: t('Province'),
31874
+ title: findOptions(user?.company?.country, options?.administrativeLevel1) || t("Province"),
31867
31875
  ellipsis: true,
31868
31876
  show: true,
31869
31877
  render: (v, all) => {
@@ -31880,7 +31888,7 @@ const getColumns$9 = ({
31880
31888
  }
31881
31889
  }, {
31882
31890
  dataIndex: 'territory',
31883
- title: t('Territory'),
31891
+ title: findOptions(user?.company?.country, options?.administrativeLevel2) || t("Territory"),
31884
31892
  ellipsis: true,
31885
31893
  show: true,
31886
31894
  render: (v, all) => {
@@ -32098,7 +32106,7 @@ const getFiltersConfig$5 = ({
32098
32106
  flex: 1
32099
32107
  }
32100
32108
  },
32101
- category: {
32109
+ eventCategory: {
32102
32110
  type: 'select',
32103
32111
  label: 'Category',
32104
32112
  placeholder: t => `${t('Filter by')} ${t('Category').toLowerCase()}`,
@@ -32191,7 +32199,7 @@ const getFilterOptions$5 = (options, t) => {
32191
32199
  value: "private",
32192
32200
  label: t("Private")
32193
32201
  }],
32194
- category: _categoryOptions,
32202
+ eventCategory: _categoryOptions,
32195
32203
  country: countries,
32196
32204
  subCategory: subCategoriesOptions,
32197
32205
  // category: category,
@@ -32298,7 +32306,7 @@ const getColumns$8 = ({
32298
32306
  }
32299
32307
  }, {
32300
32308
  dataIndex: 'province',
32301
- title: t('Province'),
32309
+ title: findOptions(user?.company?.country, options?.administrativeLevel1) || t("Province"),
32302
32310
  ellipsis: true,
32303
32311
  show: true,
32304
32312
  render: (v, all) => {
@@ -32315,7 +32323,7 @@ const getColumns$8 = ({
32315
32323
  }
32316
32324
  }, {
32317
32325
  dataIndex: 'territory',
32318
- title: t('Territory'),
32326
+ title: findOptions(user?.company?.country, options?.administrativeLevel2) || t("Territory"),
32319
32327
  ellipsis: true,
32320
32328
  show: true,
32321
32329
  render: (v, all) => {
@@ -32554,7 +32562,7 @@ const getColumns$7 = ({
32554
32562
  }
32555
32563
  }, {
32556
32564
  dataIndex: 'province',
32557
- title: t('Province'),
32565
+ title: findOptions(user?.company?.country, options?.administrativeLevel1) || t("Province"),
32558
32566
  ellipsis: true,
32559
32567
  show: true,
32560
32568
  render: (v, all) => {
@@ -32571,7 +32579,7 @@ const getColumns$7 = ({
32571
32579
  }
32572
32580
  }, {
32573
32581
  dataIndex: 'territory',
32574
- title: t('Territory'),
32582
+ title: findOptions(user?.company?.country, options?.administrativeLevel2) || t("Territory"),
32575
32583
  ellipsis: true,
32576
32584
  show: true,
32577
32585
  render: (v, all) => {
@@ -32931,7 +32939,7 @@ const getColumns$6 = ({
32931
32939
  }
32932
32940
  }, {
32933
32941
  dataIndex: 'region',
32934
- title: t('Region'),
32942
+ title: findOptions(user?.company?.country, options?.administrativeLevel1) || t("Province"),
32935
32943
  ellipsis: true,
32936
32944
  show: true,
32937
32945
  render: (v, all) => {
@@ -32948,7 +32956,7 @@ const getColumns$6 = ({
32948
32956
  }
32949
32957
  }, {
32950
32958
  dataIndex: 'territory',
32951
- title: t('Territory'),
32959
+ title: findOptions(user?.company?.country, options?.administrativeLevel2) || t("Territory"),
32952
32960
  ellipsis: true,
32953
32961
  show: true,
32954
32962
  render: (v, all) => {
@@ -765,7 +765,7 @@ class AdminService extends BaseService {
765
765
  params
766
766
  }) {
767
767
  return this.apiGet({
768
- url: `${subject}`,
768
+ url: `/management/subjects/${subject}`,
769
769
  params
770
770
  });
771
771
  }
@@ -778,6 +778,15 @@ class AdminService extends BaseService {
778
778
  data
779
779
  });
780
780
  }
781
+ getUserGrowth(activeFilter) {
782
+ return this.apiGet({
783
+ url: `/accounts/dashboard/user-growth`,
784
+ isUserManager: true,
785
+ params: {
786
+ activeFilter
787
+ }
788
+ });
789
+ }
781
790
  }
782
791
  var AdminService$1 = createLazyService(AdminService);
783
792
 
@@ -7506,7 +7506,6 @@ const getDefaultActiveFilters = (params, selectFiltersConfig, defaultPageSize, d
7506
7506
  });
7507
7507
  return o;
7508
7508
  };
7509
- const NEW_PAGINATION_APPS = ["nashiriki"];
7510
7509
  const filterParams = (value, module) => {
7511
7510
  const {
7512
7511
  activeFilters,
@@ -7522,10 +7521,12 @@ const filterParams = (value, module) => {
7522
7521
  ...filters
7523
7522
  } = activeFilters || {};
7524
7523
  const params = {};
7525
- params.pagination = JSON.stringify({
7526
- [NEW_PAGINATION_APPS.includes(module) ? "skip" : "page"]: page,
7527
- [NEW_PAGINATION_APPS.includes(module) ? "take" : "pageSize"]: pageSize
7528
- });
7524
+ // Use skip and take inside pagination object
7525
+ // Calculate skip from page number (page 1 = skip 1, page 2 = skip 21, etc.)
7526
+ params.pagination = {
7527
+ skip: page ? (page - 1) * (pageSize || 20) + 1 : 1,
7528
+ take: pageSize || 20
7529
+ };
7529
7530
  if (search && searchParams) {
7530
7531
  params.search = JSON.stringify({
7531
7532
  qs: search,
@@ -7540,12 +7541,24 @@ const filterParams = (value, module) => {
7540
7541
  }
7541
7542
  if (Object.keys(filters).length) {
7542
7543
  if (value.sourceId && value.sourceId === "overview") {
7543
- params.filters = JSON.stringify(filters);
7544
+ const {
7545
+ activeTab,
7546
+ ...restFilters
7547
+ } = filters;
7548
+ Object.assign(params, restFilters);
7549
+ if (activeTab !== undefined) {
7550
+ params.tab = activeTab;
7551
+ }
7544
7552
  } else {
7545
- params.filters = JSON.stringify({
7546
- ...filters,
7547
- authorId: undefined
7548
- });
7553
+ const {
7554
+ authorId,
7555
+ activeTab,
7556
+ ...restFilters
7557
+ } = filters;
7558
+ Object.assign(params, restFilters);
7559
+ if (activeTab !== undefined) {
7560
+ params.tab = activeTab;
7561
+ }
7549
7562
  }
7550
7563
  }
7551
7564
  return {
@@ -7752,6 +7765,9 @@ function getRedirectPath(user, fallback = '', app, isDatastake) {
7752
7765
  }
7753
7766
 
7754
7767
  const en = {
7768
+ "sbg-admin::remove-user-title": "Remove User Title",
7769
+ "sbg-admin::remove-user-body": "Remove User Body",
7770
+ "add-account": "Add Account",
7755
7771
  "Site": "Site",
7756
7772
  "Production Sites": "Production Sites",
7757
7773
  "Type of account": "Type of account",
@@ -9451,7 +9467,7 @@ const fr = {
9451
9467
  Documentation: "Documents",
9452
9468
  "Edit project": "Modifier le projet",
9453
9469
  Name: "Nom",
9454
- Type: "Tapez",
9470
+ Type: "Type",
9455
9471
  type: "Type",
9456
9472
  Province: "Province",
9457
9473
  Territory: "Territoire",
@@ -11262,7 +11278,7 @@ const sp = {
11262
11278
  "Documentation": "Documentos",
11263
11279
  "Edit project": "Modificar proyecto",
11264
11280
  "Name": "Nombre",
11265
- "Type": "Escribe",
11281
+ "Type": "Tipo",
11266
11282
  "type": "Tipo",
11267
11283
  "Province": "Provincia",
11268
11284
  "Territory": "Territorio",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.785",
3
+ "version": "0.6.787",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -162,7 +162,7 @@ export const useMap = ({
162
162
  function handleSelectMarker(clickedMarker) {
163
163
  destroyAllPopovers();
164
164
  setSelectedMarkersId((prev) => {
165
- if (prev.includes(clickedMarker.datastakeId)) {
165
+ if (openPopupIdRef.current === clickedMarker.datastakeId) {
166
166
  // Deselecting - clear polylines
167
167
  openPopupIdRef.current = null;
168
168
  setMarkerWithPopup(null);
@@ -10,7 +10,6 @@ const { useToken } = theme;
10
10
  export default function useTopContributors({ container, data = [], t }) {
11
11
  const [mainGraph, setMainGraph] = useState(null);
12
12
  const { token } = useToken();
13
-
14
13
  useEffect(() => {
15
14
  if (container.current) {
16
15
  if (mainGraph) {
@@ -8,7 +8,7 @@ export default function TopContributors({ data, loading, t }) {
8
8
  const container = useRef(null);
9
9
 
10
10
  useTopContributors({ container, data, t });
11
-
11
+ console.log("topcontributorshhhh", data);
12
12
  return (
13
13
  <Widget
14
14
  title={t(`admin::top-contributors`)}
@@ -12,7 +12,7 @@ export default function useUserGrowth({ container, data: mainData = {}, t, trans
12
12
  const [mainGraph, setMainGraph] = useState(null);
13
13
  const [data, setData] = useState([]);
14
14
  const { token } = useToken();
15
-
15
+ console.log("mainData", mainData);
16
16
  const fetchData = () => {
17
17
  const { dates = [] } = mainData;
18
18
  const _data = [];
@@ -9,7 +9,7 @@ export default function UserGrowth({ loading, data = [], t, translationKeys, fet
9
9
  const [selectValue, setSelectValue] = useState(selectOptions[0]?.value);
10
10
 
11
11
  useUserGrowth({ container, data, t, translationKeys });
12
-
12
+ console.log("usergrowthhhhh", data);
13
13
 
14
14
  useEffect(() => {
15
15
  if (typeof fetchUserGrowth === "function") {
@@ -24,7 +24,6 @@ export default function AddUserModal({ isOpen, defaultData = {}, userRoles = [],
24
24
  .catch(() => {});
25
25
  };
26
26
 
27
- console.log("hellooooooooooooooooooooooooo");
28
27
 
29
28
  return (
30
29
  <Modal
@@ -1,7 +1,7 @@
1
1
  import Modal from "../../../../Modal/index.jsx";
2
2
  import { Form, Input, Select, theme } from "antd";
3
3
  import { Container } from "../CombineModalStyle.js";
4
- import { findOptions } from "../../../../../../../helpers/StringHelper.js";
4
+ // 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";
@@ -47,7 +47,7 @@ export default function NewAccount({
47
47
  return (
48
48
  <Modal
49
49
  t={t}
50
- title={t(isEdit ? "admin::edit-account" : "admin::add-account")}
50
+ title={t(isEdit ? "edit-account" : "add-account")}
51
51
  open={isOpen}
52
52
  onClose={onClose}
53
53
  onSuccess={onSubmit}
@@ -20,7 +20,7 @@ export default function AdminDashboardScreen({ config }) {
20
20
  userGrowthDataLoading,
21
21
  } = useWidgetFetch();
22
22
 
23
- console.log({userGrowthData});
23
+ // console.log({userGrowthData});
24
24
 
25
25
  const actionsWidgetsConfig = useMemo(
26
26
  () => getActionWidgetsConfig({ getRedirectLink }),
@@ -39,7 +39,7 @@ export default function AdminDashboardScreen({ config }) {
39
39
  const safeUserActivity = Array.isArray(data?.data?.userActivity) ? data.data.userActivity : [];
40
40
  const safeTopContributors = Array.isArray(data?.topContributors) ? data.topContributors : [];
41
41
  const safeUserGrowth = Array.isArray(data?.userGrowthData) ? data.userGrowthData : [];
42
-
42
+ console.log("safeUserGrowth", safeUserGrowth);
43
43
 
44
44
  return (
45
45
  <AdminDashboard
@@ -47,11 +47,11 @@ export default function AdminLocationScreen({ config }) {
47
47
  const handleMergeLocations = useCallback(
48
48
  async (mergeData) => {
49
49
  try {
50
- if (AdminService.mergeLocations) {
51
- await AdminService.mergeLocations(mergeData);
50
+ if (AdminService.mergeSubjects) {
51
+ await AdminService.mergeSubjects({ subject: 'location', ...mergeData });
52
52
  message.success(t("Locations merged successfully"));
53
53
  } else {
54
- console.warn("AdminService.mergeLocations is not implemented");
54
+ console.warn("AdminService.mergeSubjects is not implemented");
55
55
  message.success(t("Locations merged successfully"));
56
56
  }
57
57
  } catch (err) {
@@ -61,12 +61,12 @@ export default function AdminLocationScreen({ config }) {
61
61
  [AdminService, t, handleError]
62
62
  );
63
63
 
64
- // Use custom getData if provided, otherwise use default AdminService.getLocations
64
+ // Use custom getData if provided, otherwise use default AdminService.getSubjects
65
65
  const getLocations = useCallback((params) => {
66
66
  if (getData) {
67
67
  return getData(params);
68
68
  }
69
- return AdminService.getLocations(params);
69
+ return AdminService.getSubjects({ subject: 'location', params });
70
70
  }, [getData, AdminService]);
71
71
 
72
72
  return (
@@ -48,7 +48,7 @@ export default function AdminSubjectsScreen({ config }) {
48
48
  async (mergeData) => {
49
49
  try {
50
50
  if (AdminService.mergeSubjects) {
51
- await AdminService.mergeSubjects(mergeData);
51
+ await AdminService.mergeSubjects({ subject: 'stakeholder', ...mergeData });
52
52
  message.success(t("Subjects merged successfully"));
53
53
  } else {
54
54
  console.warn("AdminService.mergeSubjects is not implemented");
@@ -66,7 +66,7 @@ export default function AdminSubjectsScreen({ config }) {
66
66
  if (getData) {
67
67
  return getData(params);
68
68
  }
69
- return AdminService.getSubjects(params);
69
+ return AdminService.getSubjects({ subject: 'stakeholder', params });
70
70
  }, [getData, AdminService]);
71
71
 
72
72
  return (
@@ -0,0 +1,224 @@
1
+ import { Checkbox, Tooltip, Avatar } from "antd";
2
+ import CustomIcon from "../../../../Icon/CustomIcon.jsx";
3
+ import { findOptions } from "../../../../../../../helpers/StringHelper.js";
4
+ import { getNameByLevel } from "./helper.js";
5
+
6
+ export const getColumns = ({
7
+ t,
8
+ goTo = () => {},
9
+ show = "show",
10
+ getRedirectLink = () => {},
11
+ token,
12
+ selectedLocations,
13
+ setSelectedLocations,
14
+ selectOptions,
15
+ entity,
16
+ }) => {
17
+ const cols = [
18
+ {
19
+ title: "",
20
+ dataIndex: "select",
21
+ key: "select",
22
+ width: 50,
23
+ show: true,
24
+ render: (v, all) => {
25
+ if (all.empty) {
26
+ return <div className="daf-default-cell" />;
27
+ }
28
+ return (
29
+ <Checkbox
30
+ onChange={() =>
31
+ setSelectedLocations((prev) => {
32
+ const isSelected = prev.some((p) => p.id === all.id);
33
+ if (isSelected) {
34
+ return prev.filter((p) => p.id !== all.id);
35
+ }
36
+ return [...prev, all];
37
+ })
38
+ }
39
+ checked={selectedLocations.some((p) => p.id === all.id)}
40
+ disabled={
41
+ selectedLocations?.length >= 3 &&
42
+ !selectedLocations.some((p) => p.id === all.id)
43
+ }
44
+ />
45
+ );
46
+ },
47
+ },
48
+ {
49
+ title: t("ID"),
50
+ dataIndex: "datastakeId",
51
+ key: "datastakeId",
52
+ ellipsis: true,
53
+ show: true,
54
+ render: (value, all) => {
55
+ if (all.empty) {
56
+ return <div className="daf-default-cell" />;
57
+ }
58
+
59
+ return <Tooltip title={value}>{value}</Tooltip>;
60
+ },
61
+ },
62
+ {
63
+ title: t("Name"),
64
+ dataIndex: "name",
65
+ key: "name",
66
+ ellipsis: true,
67
+ show: true,
68
+ render: (value, all) => {
69
+ if (all.empty) {
70
+ return <div className="daf-default-cell" />;
71
+ }
72
+
73
+ return <Tooltip title={value}>{value}</Tooltip>;
74
+ },
75
+ },
76
+ {
77
+ title: t("Category"),
78
+ dataIndex: "category",
79
+ key: "category",
80
+ ellipsis: true,
81
+ show: true,
82
+ render: (value, all) => {
83
+ if (all.empty) {
84
+ return <div className="daf-default-cell" />;
85
+ }
86
+
87
+ const category = findOptions(value, selectOptions?.category || []) || "--";
88
+
89
+ return <Tooltip title={category}>{category}</Tooltip>;
90
+ },
91
+ },
92
+ {
93
+ title: t("Country"),
94
+ dataIndex: "country",
95
+ key: "country",
96
+ ellipsis: true,
97
+ show: true,
98
+ render: (value, all) => {
99
+ if (all.empty) {
100
+ return <div className="daf-default-cell" />;
101
+ }
102
+ const country = findOptions(value, selectOptions?.country || []) || "--";
103
+
104
+ return <Tooltip title={country}>{country}</Tooltip>;
105
+ },
106
+ },
107
+ {
108
+ title: t("Admin Level 1"),
109
+ dataIndex: "administrativeLevel1",
110
+ key: "administrativeLevel1",
111
+ ellipsis: true,
112
+ show: entity.includes("location"),
113
+ render: (value, all) => {
114
+ if (all.empty) {
115
+ return <div className="daf-default-cell" />;
116
+ }
117
+
118
+ let label;
119
+ if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
120
+ label = all?.linking?.SCL?.[value]?.name
121
+ } else {
122
+ label = getNameByLevel(all?.linking?.SCL, "level_1")?.name
123
+ }
124
+
125
+ return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
126
+ },
127
+ },
128
+ {
129
+ title: t("Admin Level 2"),
130
+ dataIndex: "administrativeLevel2",
131
+ key: "administrativeLevel2",
132
+ show: entity.includes("location"),
133
+ ellipsis: true,
134
+ render: (value, all) => {
135
+ if (all.empty) {
136
+ return <div className="daf-default-cell" />;
137
+ }
138
+
139
+ let label;
140
+ if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
141
+ label = all?.linking?.SCL?.[value]?.name
142
+ } else {
143
+ label = getNameByLevel(all?.linking?.SCL, "level_2")?.name
144
+ }
145
+
146
+ return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
147
+ },
148
+ },
149
+ {
150
+ title: t("Sources"),
151
+ dataIndex: "sources",
152
+ key: "sources",
153
+ show: true,
154
+ render: (value, all) => {
155
+ if (all.empty) {
156
+ return <div className="daf-default-cell" />;
157
+ }
158
+
159
+ const MAX_SOURCES = 3;
160
+ const count = value?.length === MAX_SOURCES + 1 ? value?.length : MAX_SOURCES;
161
+ return (
162
+ Array.isArray(value) && value?.length > 0 ? <Avatar.Group
163
+ max={{
164
+ count: count,
165
+ style: {
166
+ color: token.baseGray90,
167
+ backgroundColor: token.baseGray20,
168
+ border: `1px solid ${token.baseGray40}`,
169
+ },
170
+ }}
171
+ size={"small"}
172
+ >
173
+ {value.map((v, i) => (
174
+ <Avatar
175
+ key={i}
176
+ size={"small"}
177
+ style={{
178
+ backgroundColor: token.baseGray20,
179
+ color: token.baseGray90,
180
+ border: `1px solid ${token.baseGray40}`,
181
+ display: "flex",
182
+ alignItems: "center",
183
+ justifyContent: "center",
184
+ }}
185
+ >
186
+ <CustomIcon
187
+ name="Organisation02"
188
+ width={18}
189
+ height={18}
190
+ color={token.baseGray90}
191
+ />
192
+ </Avatar>
193
+ ))}
194
+ </Avatar.Group> : '-'
195
+ );
196
+ },
197
+ },
198
+ {
199
+ title: "",
200
+ dataIndex: "actions",
201
+ key: "actions",
202
+ width: 60,
203
+ show: true,
204
+ render: (value, all) => {
205
+ if (all.empty) {
206
+ return <div className="daf-default-cell" />;
207
+ }
208
+
209
+ return (
210
+ <div
211
+ className="cursor-pointer"
212
+ onClick={() => {
213
+ goTo(getRedirectLink(`/app/accounts/view/${all.id}/details`));
214
+ }}
215
+ >
216
+ <CustomIcon name="Link" width={18} height={18} />
217
+ </div>
218
+ );
219
+ },
220
+ },
221
+ ];
222
+
223
+ return cols.filter((c) => c[show]);
224
+ };