datastake-daf 0.6.847 → 0.6.849

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 (56) hide show
  1. package/dist/components/index.js +191 -57
  2. package/dist/hooks/index.js +9 -8
  3. package/dist/pages/index.js +5216 -5489
  4. package/dist/services/index.js +11 -11
  5. package/dist/utils/index.js +23 -12
  6. package/package.json +1 -1
  7. package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +1 -1
  8. package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/helper.js +59 -77
  9. package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +1 -8
  10. package/src/@daf/core/components/Screens/TableScreen/StandardTablePage/index.jsx +108 -0
  11. package/src/@daf/core/components/Screens/TableScreen/TablePageWithTabs/index.jsx +9 -2
  12. package/src/@daf/core/components/TableScreen/TablePageWithTabs/index.jsx +13 -3
  13. package/src/@daf/hooks/useSources.js +6 -4
  14. package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/IncidentsTime/config.js +3 -0
  15. package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/IncidentsTime/hook.js +69 -4
  16. package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/IncidentsTime/index.js +29 -92
  17. package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/ProblemSolver/hook.js +59 -34
  18. package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/ProblemSolver/index.js +36 -69
  19. package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/TerritorialDistribution/hook.js +56 -0
  20. package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/TerritorialDistribution/index.js +50 -75
  21. package/src/@daf/pages/Dashboards/ConflictManagement/index.js +14 -14
  22. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +46 -51
  23. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Identification/hook.js +20 -20
  24. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Identification/index.js +26 -2
  25. package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +0 -1
  26. package/src/@daf/pages/Dashboards/UserDashboard/components/DataChainOfCustody/index.jsx +2 -1
  27. package/src/@daf/pages/Dashboards/UserDashboard/index.jsx +1 -0
  28. package/src/@daf/pages/Dashboards/helper.js +25 -20
  29. package/src/@daf/pages/Edit/index.jsx +3 -0
  30. package/src/@daf/pages/Partners/columns.js +2 -2
  31. package/src/@daf/pages/Partners/config.js +22 -0
  32. package/src/@daf/pages/Partners/hook.js +7 -11
  33. package/src/@daf/pages/Partners/index.jsx +128 -140
  34. package/src/@daf/pages/ResetPassword/index.jsx +2 -3
  35. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/columns.js +3 -2
  36. package/src/@daf/pages/TablePage/hook.js +51 -42
  37. package/src/@daf/pages/TablePage/index.jsx +95 -61
  38. package/src/@daf/{core/components/Screens → pages}/Users/columns.js +15 -10
  39. package/src/@daf/{core/components/Screens → pages}/Users/config.js +6 -16
  40. package/src/@daf/{core/components/Screens → pages}/Users/create.jsx +1 -1
  41. package/src/@daf/pages/Users/index.jsx +129 -0
  42. package/src/@daf/pages/View/hooks/useCallToGetData.js +5 -1
  43. package/src/@daf/pages/View/index.jsx +6 -3
  44. package/src/@daf/pages/hook.js +26 -7
  45. package/src/@daf/services/EventsService.js +2 -2
  46. package/src/@daf/services/MineSiteService.js +2 -2
  47. package/src/@daf/services/OperatorService.js +2 -2
  48. package/src/@daf/services/PartnerService.js +2 -2
  49. package/src/@daf/services/SourceService.js +1 -1
  50. package/src/@daf/services/WorkersService.js +2 -2
  51. package/src/constants/locales/fr/translation.js +23 -11
  52. package/src/constants/locales/sp/translation.js +1 -0
  53. package/src/index.js +1 -1
  54. package/src/pages.js +1 -1
  55. package/dist/style/datastake/mapbox-gl.css +0 -330
  56. package/src/@daf/core/components/Screens/Users/index.jsx +0 -173
@@ -3,88 +3,37 @@ import PropTypes from 'prop-types';
3
3
  import { renderTooltipJsx } from '../../../../../../../utils/tooltip.js';
4
4
  import Widget from '../../../../../../../core/components/Dashboard/Widget/index.jsx';
5
5
  import Chart from '../../../../../../../core/components/Charts/PieChart/chart.jsx';
6
- import {useWidgetFetch} from '../../../../../../../hooks/useWidgetFetch.js';
7
- import DashboardService from '../../../../../../../services/DashboardService.js';
8
- import { getColors } from './config.js';
6
+ import { buildQueryString } from '../../../../../../../../helpers/urlHelpers.js';
7
+ import { useTerritorialDistribution } from './hook.js';
9
8
 
10
- function TerritorialDistribution({ selectedPartners = {}, loading: parentLoading = false, t = (s) => s, theme = {}, category = "conflict", selectedRange ,goTo = () => {}, getRedirectLink = () => {}}) {
11
- const colors = getColors(theme);
12
-
13
- const defaultFetchConfig = useMemo(
14
- () => ({
15
- url: "/territorial-distribution",
16
- basepath: "dashboard/conflict-management",
17
- filters: {
18
- category,
19
- period: selectedRange,
20
- sources: selectedPartners?.partners || [],
21
- },
22
- defaultData: {},
23
- stop: selectedPartners?.loading,
24
- }),
25
- [category, selectedRange, selectedPartners],
26
- );
27
-
28
- const getData = useCallback(({ url, filters, basepath }) => {
29
- return DashboardService.getWidgetConflictManagement(url, filters, basepath);
30
- }, []);
31
-
32
- const { data, loading } = useWidgetFetch({
33
- config: defaultFetchConfig,
34
- getData
9
+ function TerritorialDistribution({
10
+ selectedPartners = {},
11
+ loading: parentLoading = false,
12
+ t = (s) => s, theme = {},
13
+ category = "conflict",
14
+ selectedRange,
15
+ goTo = () => {},
16
+ getRedirectLink = () => {}
17
+ }) {
18
+ const {
19
+ pieData,
20
+ loading,
21
+ isEmpty
22
+ } = useTerritorialDistribution({
23
+ category,
24
+ selectedRange,
25
+ selectedPartners,
26
+ theme,
35
27
  });
36
28
 
37
- const pieData = useMemo(() => {
38
- if (!data || Array.isArray(data)) return [];
39
- const all = Object.keys(data);
40
- const totalEvents = all.reduce((acc, key) => acc + (data[key]?.events?.length || 0), 0);
41
-
42
- return all
43
- .sort((a, b) => (data[b]?.events?.length || 0) - (data[a]?.events?.length || 0))
44
- .map((key, index) => {
45
- const item = data[key];
46
- return {
47
- value: item?.events?.length,
48
- label: item?.locationData?.name,
49
- locationData: item?.locationData,
50
- color: colors[index % colors.length],
51
- percent: totalEvents ? (item?.events?.length / totalEvents) : 0,
52
- }
53
- });
54
- }, [data, colors]);
55
-
56
- const isEmpty = !pieData.length;
57
-
58
- const getTooltipChildren = useCallback((items) => {
59
- const item = Array.isArray(items) ? items[0] : items;
60
-
61
- return renderTooltipJsx({
62
- title: item?.label || t("Undetermined"),
63
- link: true,
64
- onClickLink: () => {
65
- if (item?.label) {
66
- goTo(
67
- `/app/incidents?administrativeLevel1=${item?.locationData?.administrativeLevel1}&administrativeLevel2=${item?.locationData?.administrativeLevel2}&country=${item?.locationData?.country}`,
68
- );
69
- } else {
70
- goTo("/app/incident");
71
- }
72
- },
73
- items: [
74
- {
75
- label: t("Number of incidents"),
76
- value: item?.value,
77
- },
78
- ],
79
- });
80
- }, [t, goTo]);
81
-
82
29
  return (
83
30
  <Widget
84
31
  loading={loading || parentLoading}
85
32
  title={t("Territorial Distribution")}
86
- className="with-border-header"
33
+
34
+ className="with-border-header h-w-btn-header"
87
35
  >
36
+
88
37
  <Chart
89
38
  mouseXOffset={10}
90
39
  mouseYOffset={10}
@@ -94,8 +43,34 @@ function TerritorialDistribution({ selectedPartners = {}, loading: parentLoading
94
43
  isPie
95
44
  t={t}
96
45
  isEmpty={isEmpty}
97
- getTooltipChildren={getTooltipChildren}
46
+ getTooltipChildren={(items) => {
47
+ const item = Array.isArray(items) ? items[0] : items;
48
+
49
+ return renderTooltipJsx({
50
+ title: item?.label || t("Undetermined"),
51
+ link: true,
52
+ onClickLink: () => {
53
+ if (item?.label) {
54
+ const queryString = buildQueryString({
55
+ administrativeLevel1: item?.locationData?.administrativeLevel1,
56
+ administrativeLevel2: item?.locationData?.administrativeLevel2,
57
+ country: item?.locationData?.country,
58
+ });
59
+ goTo(`/app/incidents${queryString}`);
60
+ } else {
61
+ goTo("/app/incidents");
62
+ }
63
+ },
64
+ items: [
65
+ {
66
+ label: t("Number of incidents"),
67
+ value: item?.value,
68
+ },
69
+ ],
70
+ });
71
+ }}
98
72
  />
73
+
99
74
  </Widget>
100
75
  );
101
76
  }
@@ -2,8 +2,6 @@ import React, { useMemo, useEffect } from "react";
2
2
  import KeyIndicators from "./components/KeyIndicators/index.js";
3
3
  import MineSites from "./components/MineSite/index.js";
4
4
  import RisksWidget from "./components/RisksWidget/index.js";
5
- import { useSources } from "../../../hooks/useSources.js";
6
- import { renderBreadCrumbs } from "../../../../helpers/breadCrumbs.js";
7
5
  import CustomIcon from "../../../core/components/Icon/CustomIcon.jsx";
8
6
  import { Header, Multiselect } from "../../../../index.js";
9
7
  import DashboardLayout from '../../../core/components/Dashboard/DashboardLayout/index.jsx';
@@ -16,24 +14,26 @@ export default function ConflictManagement({
16
14
  getRedirectLink = (s) => s,
17
15
  theme = {},
18
16
  options = {},
19
- breadcrumbs = [],
20
-
17
+ breadcrumbs = [],
18
+ partners,
19
+ selectedPartners,
20
+ setSelectedPartners,
21
+ informationSources
21
22
  }) {
22
- const { partners, selectedPartners, setSelectedPartners, informationSources } =
23
- useSources({ user, t });
24
-
25
23
  // const { pushPath } = useHistory();
26
24
 
27
25
  // useEffect(() => {
28
26
  // pushPath(`/app/conflict-management`);
29
27
  // }, []);
30
28
 
31
- const breadCrumbs = useMemo(() => {
32
- return renderBreadCrumbs({ t, view: "conflict-management", mod: APP, goTo });
33
- }, [t, APP, goTo]);
29
+ console.log(partners, "partners");
30
+
31
+ // const breadCrumbs = useMemo(() => {
32
+ // return renderBreadCrumbs({ t, view: "conflict-management", mod: APP, goTo });
33
+ // }, [t, APP, goTo]);
34
34
 
35
35
  const sourceOptions = useMemo(() => {
36
- return partners.map((partner) => {
36
+ return partners?.map((partner) => {
37
37
  const isOwnData = partner.id === user?.company?.id;
38
38
 
39
39
  return {
@@ -53,7 +53,7 @@ export default function ConflictManagement({
53
53
  header={
54
54
  <Header
55
55
  title={t("conflict-management")}
56
- breadcrumbs={breadCrumbs}
56
+ breadcrumbs={breadcrumbs}
57
57
  supportText={
58
58
  <>
59
59
  {t("Supported by")}{" "}
@@ -69,7 +69,7 @@ export default function ConflictManagement({
69
69
  addedHeader={
70
70
  <div>
71
71
  <Multiselect
72
- options={[...sourceOptions]}
72
+ options={[...(Array.isArray(sourceOptions) ? sourceOptions : [])]}
73
73
  isAvatarGroup
74
74
  canUnselectLast={false}
75
75
  key={partners?.length}
@@ -82,7 +82,7 @@ export default function ConflictManagement({
82
82
  }}
83
83
  dropDownWidth={200}
84
84
  selectionType="checkbox"
85
- defaultSelected={partners.map((p) => p.id) || []}
85
+ defaultSelected={partners?.map((p) => p.id) || []}
86
86
  />
87
87
  </div>
88
88
  }
@@ -39,56 +39,6 @@ function GenderDistribution({
39
39
 
40
40
  const isEmpty = useMemo(() => Object.keys(data).filter((k) => !!data[k]).length === 0, [data]);
41
41
 
42
- const getTooltipChildren = useCallback(
43
- (item) => {
44
- if (isTradeActions) {
45
- if (isEmpty) {
46
- return;
47
- }
48
-
49
- return renderTooltipJsx({
50
- title: t("Role"),
51
- items: [
52
- {
53
- label:
54
- (options?.optionPositionSupplyChain || options?.positionSupplyChainOptions || [])?.find((o) => {
55
- return o.value === item.key;
56
- }).label || item.key,
57
- value: data[item.key] || 0,
58
- },
59
- ],
60
- });
61
- } else {
62
- if (isEmpty) {
63
- return renderTooltipJsx({
64
- title: t("Gender"),
65
- items: config.map((conf) => ({
66
- label: t(conf.label),
67
- value: 0,
68
- })),
69
- });
70
- }
71
-
72
- const _config = config?.find((c) => c.key === item.key);
73
-
74
- if (_config) {
75
- return renderTooltipJsx({
76
- title: t("Gender"),
77
- items: [
78
- {
79
- label: t(_config.label),
80
- value: `${Math.round(item.percent * 100)}%`,
81
- },
82
- ],
83
- });
84
- }
85
-
86
- return null;
87
- }
88
- },
89
- [t, data, isTradeActions],
90
- );
91
-
92
42
  return (
93
43
  <Widget
94
44
  loading={loading}
@@ -110,7 +60,52 @@ function GenderDistribution({
110
60
  isPie
111
61
  t={t}
112
62
  isEmpty={isEmpty}
113
- getTooltipChildren={getTooltipChildren}
63
+ getTooltipChildren={ (item) => {
64
+ if (isTradeActions) {
65
+ if (isEmpty) {
66
+ return;
67
+ }
68
+
69
+ return renderTooltipJsx({
70
+ title: t("Role"),
71
+ items: [
72
+ {
73
+ label:
74
+ (options?.optionPositionSupplyChain || options?.positionSupplyChainOptions || [])?.find((o) => {
75
+ return o.value === item.key;
76
+ }).label || item.key,
77
+ value: data[item.key] || 0,
78
+ },
79
+ ],
80
+ });
81
+ } else {
82
+ if (isEmpty) {
83
+ return renderTooltipJsx({
84
+ title: t("Gender"),
85
+ items: config.map((conf) => ({
86
+ label: t(conf.label),
87
+ value: 0,
88
+ })),
89
+ });
90
+ }
91
+
92
+ const _config = config?.find((c) => c.key === item.key);
93
+
94
+ if (_config) {
95
+ return renderTooltipJsx({
96
+ title: t("Gender"),
97
+ items: [
98
+ {
99
+ label: t(_config.label),
100
+ value: `${Math.round(item.percent * 100)}%`,
101
+ },
102
+ ],
103
+ });
104
+ }
105
+
106
+ return null;
107
+ }
108
+ }}
114
109
  />
115
110
  </div>
116
111
  </Widget>
@@ -53,27 +53,27 @@ export function useIdentification({ data, theme = {}, options = {} }) {
53
53
  yFieldKey: "value",
54
54
  seriesField: "typeOfProduct",
55
55
  color: allSeenProducts.map((_, index) => colors[index % colors.length]),
56
- renderTooltipContent: (title, items) => {
57
- if (Array.isArray(items) && items[0]) {
58
- const title = items[0].title;
59
- const values = graphData.filter((d) => d.date === title);
60
- return {
61
- title: "Products",
62
- items: values.map((val) => {
63
- return{
64
- label: findOptions(val.typeOfProduct, options?.mineralOptions) || val.typeOfProduct,
65
- color: colors[
66
- allSeenProducts.indexOf(val.typeOfProduct) % colors.length
67
- ],
68
- value: val.value.toLocaleString(),
69
- }
70
- }),
71
- };
72
- }
73
- return { title: "", items: [] };
74
- },
56
+ // renderTooltipContent: (title, items) => {
57
+ // if (Array.isArray(items) && items[0]) {
58
+ // const title = items[0].title;
59
+ // const values = graphData.filter((d) => d.date === title);
60
+ // return {
61
+ // title: "Products",
62
+ // items: values.map((val) => {
63
+ // return{
64
+ // label: findOptions(val.typeOfProduct, options?.mineralOptions) || val.typeOfProduct,
65
+ // color: colors[
66
+ // allSeenProducts.indexOf(val.typeOfProduct) % colors.length
67
+ // ],
68
+ // value: val.value.toLocaleString(),
69
+ // }
70
+ // }),
71
+ // };
72
+ // }
73
+ // return { title: "", items: [] };
74
+ // },
75
75
  };
76
76
  }, [graphData, allSeenProducts, options.minerals]);
77
77
 
78
- return chartConfig;
78
+ return { chartConfig, colors, allSeenProducts, graphData};
79
79
  }
@@ -4,6 +4,7 @@ import LineChart from '../../../../../../../core/components/Charts/LineChart/ind
4
4
  import { Select } from 'antd';
5
5
  import { useIdentification } from './hook';
6
6
  import PropTypes from 'prop-types';
7
+ import { findOptions } from '../../../../../../../../helpers/StringHelper.js';
7
8
 
8
9
  function Identification({
9
10
  selectedSources = {},
@@ -25,7 +26,7 @@ function Identification({
25
26
  [t],
26
27
  );
27
28
 
28
- const chartConfig = useIdentification({ data, theme, options });
29
+ const { chartConfig, colors, allSeenProducts, graphData } = useIdentification({ data, theme, options });
29
30
 
30
31
  return (
31
32
  <Widget
@@ -45,7 +46,30 @@ function Identification({
45
46
  </>
46
47
  }
47
48
  >
48
- <LineChart {...chartConfig} height="400px" t={t} />
49
+ <LineChart
50
+ {...chartConfig}
51
+ height="400px"
52
+ t={t}
53
+ renderTooltipContent={(title, items) => {
54
+ if (Array.isArray(items) && items[0]) {
55
+ const title = items[0].title;
56
+ const values = graphData.filter((d) => d.date === title);
57
+ return {
58
+ title: "Products",
59
+ items: values.map((val) => {
60
+ return{
61
+ label: findOptions(val.typeOfProduct, options?.mineralOptions) || val.typeOfProduct,
62
+ color: colors[
63
+ allSeenProducts.indexOf(val.typeOfProduct) % colors.length
64
+ ],
65
+ value: val.value.toLocaleString(),
66
+ }
67
+ }),
68
+ };
69
+ }
70
+ return { title: "", items: [] };
71
+ }}
72
+ />
49
73
  </Widget>
50
74
  )
51
75
  }
@@ -5,7 +5,6 @@ import Header from '../../../core/components/Header/index.jsx';
5
5
  import Multiselect from '../../../core/components/Select/MultiSelect/index.jsx';
6
6
  import KeyIndicators from './components/KeyIndicators';
7
7
  import SupplyChainMap from './components/SupplyChainMap';
8
- import TradeRelationships from './components/TradeRelationships';
9
8
  import ChartsContainer from './components/ChartsContainer';
10
9
 
11
10
  function SupplyChain({
@@ -18,13 +18,14 @@ function DataChainOfCustody({
18
18
  goTo = () => {},
19
19
  options = {},
20
20
  hardcodedData = [],
21
+ APP
21
22
  }) {
22
23
  const fetchConfig = useMemo(() => ({
23
24
  ...defaultFetchConfig,}),[],
24
25
  );
25
26
  const { data, loading } = useWidgetFetch({config: fetchConfig});
26
27
 
27
- const mappedData = mapDataForChainOfCustody(Object.keys(data)?.length > 0 ? data : hardcodedData, options, goTo);
28
+ const mappedData = mapDataForChainOfCustody(Object.keys(data)?.length > 0 ? data : hardcodedData, options, goTo, APP);
28
29
 
29
30
  return (
30
31
  <Widget
@@ -104,6 +104,7 @@ function UserDashboard({
104
104
  goTo={goTo}
105
105
  options={options}
106
106
  hardcodedData={hardcodedData}
107
+ APP={APP}
107
108
  />
108
109
  </section>
109
110
  </DashboardLayout>
@@ -9,24 +9,29 @@ const kycIcon = <CustomIcon name="KYC" color="#6C737F" width={18} height={18} />
9
9
  const buildingIcon = <CustomIcon name="Building" color="#6C737F" width={18} height={18} />;
10
10
  const individualIcon = <CustomIcon name="UserCircle" color="#6C737F" width={18} height={18} />;
11
11
  const csIcon = <CustomIcon name="CivilSociety" color="#6C737F" width={18} height={18} />;
12
- const leftIcon = (
13
- <CustomIcon
14
- name="WaziDarkIcon"
15
- color={theme.colorPrimary8}
16
- width={16}
17
- height={16}
18
- />
19
- );
20
- const middleIcon = (
21
- <CustomIcon
22
- name="WaziDarkIcon"
23
- color={theme.colorPrimary2}
24
- width={16}
25
- height={16}
26
- />
27
- );
28
12
 
29
- const rightIcon = <CustomIcon name="WaziDarkIcon" color="white" width={16} height={16} />;
13
+ const directionIcons = {
14
+ nashiriki: {
15
+ left: "NashirikiSmallLogo",
16
+ right: "NashirikiSmallLogo",
17
+ middle: "NashirikiSmallLogo",
18
+ },
19
+ wazi: {
20
+ left: "WaziDarkIcon",
21
+ right: "WaziDarkIcon",
22
+ middle: "WaziDarkIcon",
23
+ },
24
+ }
25
+
26
+ const directionColors = {
27
+ left: theme.colorPrimary8,
28
+ right: "white",
29
+ middle: theme.colorPrimary2,
30
+ }
31
+
32
+ const getDirectionIcon = (APP, direction) => {
33
+ return <CustomIcon name={directionIcons[APP][direction]} color={directionColors[direction]} width={16} height={16} />;
34
+ }
30
35
 
31
36
  const mapIcon = (category) => {
32
37
  switch (category) {
@@ -45,7 +50,7 @@ const mapIcon = (category) => {
45
50
  const leftBackground = theme.colorPrimary3;
46
51
  const rightBackground = theme.colorPrimary6;
47
52
 
48
- export const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {}) => {
53
+ export const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {}, APP) => {
49
54
  const mapChildren = (items, type, parentId, isDirect = true) => {
50
55
  return (items ?? []).map((item) => {
51
56
  return {
@@ -54,7 +59,7 @@ export const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {
54
59
  name: item.name,
55
60
  sources: parentId ? [parentId] : [],
56
61
  subTitle: findOptions(item?.category, options?.categoriesOptions || options?.category || []),
57
- leftIcon: type === "client" ? rightIcon : leftIcon,
62
+ leftIcon: getDirectionIcon(APP, type === "client" ? "right" : "left"),
58
63
  leftBackground: type === "client" ? rightBackground : leftBackground,
59
64
  topIcon: mapIcon(item.category),
60
65
  children: mapChildren(item.sources ?? item.clients ?? [], type, item.id, false),
@@ -71,7 +76,7 @@ export const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {
71
76
  number: 0,
72
77
  name: data.name,
73
78
  subTitle: findOptions(data?.category, options?.categoriesOptions || options?.category || []),
74
- leftIcon: middleIcon,
79
+ leftIcon: getDirectionIcon(APP, "middle"),
75
80
  leftBackground: theme.colorPrimary10,
76
81
  topIcon: mapIcon(data.category),
77
82
  left: mapChildren(data.sources, "source", data.id),
@@ -33,6 +33,7 @@ const Edit = ({
33
33
  params,
34
34
  clear,
35
35
  getRedirectLink,
36
+ selectedPartners,
36
37
  pathname,
37
38
  search,
38
39
  viewConfig,
@@ -153,6 +154,7 @@ const Edit = ({
153
154
  view: namespaceConfig?.view,
154
155
  ...(namespaceConfig?.scope && { scope: namespaceConfig.scope }),
155
156
  datastakeId: id ? id : 'user',
157
+ sources: selectedPartners?.partners,
156
158
  })
157
159
  }
158
160
  }
@@ -169,6 +171,7 @@ const Edit = ({
169
171
  user,
170
172
  setLoading,
171
173
  APP,
174
+ selectedPartners,
172
175
  })
173
176
 
174
177
  const callback = (type, m) => {
@@ -17,6 +17,7 @@ export const getColumns = ({
17
17
  activeTab,
18
18
  setOpen,
19
19
  block,
20
+ options,
20
21
  }) => [
21
22
  {
22
23
  title: t("ID"),
@@ -27,7 +28,6 @@ export const getColumns = ({
27
28
  if (all.empty) {
28
29
  return <div className="daf-default-cell" />;
29
30
  }
30
- // THE FALLBACK WAS DEPENDS BEFORE
31
31
  return v || "-";
32
32
  },
33
33
  },
@@ -116,7 +116,7 @@ export const getColumns = ({
116
116
  if (all.empty) {
117
117
  return <div className="daf-default-cell" />;
118
118
  }
119
- return v ? findOptions(v, selectOptions?.category || []) : "-";
119
+ return v ? findOptions(v, options?.categoriesOptions || []) : "-";
120
120
  },
121
121
  },
122
122
  {
@@ -15,6 +15,28 @@ export const selectFiltersConfig = {
15
15
  },
16
16
  };
17
17
 
18
+ export const getSelectFiltersConfig = ({t}) => {
19
+ return {
20
+ category: {
21
+ type: "select",
22
+ label: "Category",
23
+ placeholder: (t) => `${t("Filter by")} ${t("Category").toLowerCase()}`,
24
+ style: { flex: 1 },
25
+ labelStyle: { flex: 1 },
26
+ getLabel: (option) => option.label,
27
+ getValue: (option) => option.value,
28
+ },
29
+ }
30
+ }
31
+
32
+ export const getFilterOptions = (options, t) => {
33
+ const { countries, category, categoriesOptions } = options || {};
34
+ return {
35
+ country: countries || [],
36
+ category: categoriesOptions || category || [],
37
+ }
38
+ }
39
+
18
40
  export const checkboxConfig = {
19
41
  name: "Name",
20
42
  datastakeId: "ID",
@@ -3,8 +3,6 @@ import PartnerService from "../../services/PartnerService.js";
3
3
  import { message } from "antd";
4
4
 
5
5
  export const usePartnersActions = ({
6
- activeTab,
7
- filters,
8
6
  setTotalRequests,
9
7
  t = () => {},
10
8
  }) => {
@@ -13,14 +11,14 @@ export const usePartnersActions = ({
13
11
  const [requestDataFetch, setRequestDataFetch] = useState(false);
14
12
  const [initFetchDone, setInitFetchDone] = useState(false);
15
13
 
16
- const fetchData = useCallback(async () => {
14
+ const fetchData = useCallback(async (params) => {
17
15
  setLoading(true);
18
16
  setData([]);
19
17
 
20
18
  try {
21
- const { data } = await PartnerService.get(activeTab, {
22
- ...filters,
23
- type: activeTab,
19
+ const { data } = await PartnerService.get({
20
+ ...params,
21
+ type: params?.tab,
24
22
  });
25
23
  setData(data);
26
24
  setTotalRequests(data?.meta?.total || 0);
@@ -33,7 +31,7 @@ export const usePartnersActions = ({
33
31
  if (!initFetchDone) {
34
32
  setInitFetchDone(true);
35
33
  }
36
- }, [activeTab, filters, initFetchDone, setLoading, setTotalRequests, setData, setInitFetchDone]);
34
+ }, [initFetchDone, setLoading, setTotalRequests, setData, setInitFetchDone]);
37
35
 
38
36
  const accept = useCallback(
39
37
  async (id) => {
@@ -106,14 +104,13 @@ export const usePartnersActions = ({
106
104
 
107
105
  try {
108
106
  await PartnerService.resendInvite(id);
109
- await fetchData();
110
107
  } catch (err) {
111
108
  console.log(err);
112
109
  }
113
110
 
114
111
  setLoading(false);
115
112
  },
116
- [fetchData, setLoading],
113
+ [setLoading],
117
114
  );
118
115
 
119
116
  const block = useCallback(
@@ -122,14 +119,13 @@ export const usePartnersActions = ({
122
119
 
123
120
  try {
124
121
  await PartnerService.block(id);
125
- await fetchData();
126
122
  } catch (err) {
127
123
  console.log(err);
128
124
  }
129
125
 
130
126
  setLoading(false);
131
127
  },
132
- [fetchData, setLoading],
128
+ [setLoading],
133
129
  );
134
130
 
135
131
  return {