datastake-daf 0.6.818 → 0.6.819

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.
@@ -7523,14 +7523,15 @@ const getRowConfig$1 = ({
7523
7523
  data = {},
7524
7524
  goTo,
7525
7525
  getRedirectLink,
7526
- theme = {}
7526
+ theme = {},
7527
+ APP
7527
7528
  }) => [{
7528
7529
  label: /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorNavigateLabel, {
7529
7530
  t: t,
7530
7531
  getRedirectLink: getRedirectLink,
7531
7532
  theme: theme,
7532
7533
  label: "Identified Mine Sites",
7533
- link: "/app/production-sites"
7534
+ link: APP === 'nashiriki' ? '/app/scl' : '/app/production-sites'
7534
7535
  }),
7535
7536
  render: () => {
7536
7537
  return /*#__PURE__*/jsxRuntime.jsx("span", {
@@ -8137,7 +8138,8 @@ function KeyIndicators$1({
8137
8138
  theme = {},
8138
8139
  getRedirectLink = () => {},
8139
8140
  t = () => {},
8140
- goTo = () => {}
8141
+ goTo = () => {},
8142
+ APP
8141
8143
  }) {
8142
8144
  const fetchConfig = React.useMemo(() => ({
8143
8145
  ...defaultFetchConfig$6,
@@ -8161,9 +8163,10 @@ function KeyIndicators$1({
8161
8163
  },
8162
8164
  goTo,
8163
8165
  getRedirectLink,
8164
- theme
8166
+ theme,
8167
+ APP
8165
8168
  });
8166
- }, [t, data, goTo, getRedirectLink, theme]);
8169
+ }, [t, data, goTo, getRedirectLink, theme, APP]);
8167
8170
  return /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorsWidget, {
8168
8171
  t: t,
8169
8172
  config: config,
@@ -12732,7 +12735,7 @@ const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {}) => {
12732
12735
  number: 0,
12733
12736
  name: item.name,
12734
12737
  sources: parentId ? [parentId] : [],
12735
- subTitle: findOptions(item?.category, options?.categoriesOptions),
12738
+ subTitle: findOptions(item?.category, options?.categoriesOptions || options?.category || []),
12736
12739
  leftIcon: type === "client" ? rightIcon : leftIcon,
12737
12740
  leftBackground: type === "client" ? rightBackground : leftBackground,
12738
12741
  topIcon: mapIcon(item.category),
@@ -12749,7 +12752,7 @@ const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {}) => {
12749
12752
  id: data.id,
12750
12753
  number: 0,
12751
12754
  name: data.name,
12752
- subTitle: findOptions(data?.category, options?.categoriesOptions),
12755
+ subTitle: findOptions(data?.category, options?.categoriesOptions || options?.category || []),
12753
12756
  leftIcon: middleIcon,
12754
12757
  leftBackground: theme.colorPrimary10,
12755
12758
  topIcon: mapIcon(data.category),
@@ -13907,7 +13910,9 @@ function SupplyChain({
13907
13910
  setSelectedPartners,
13908
13911
  informationSources,
13909
13912
  hardcodedData,
13910
- breadcrumbs = []
13913
+ breadcrumbs = [],
13914
+ supportText,
13915
+ APP
13911
13916
  }) {
13912
13917
  const sourceOptions = React.useMemo(() => {
13913
13918
  if (!partners?.length) return [];
@@ -13950,6 +13955,7 @@ function SupplyChain({
13950
13955
  defaultSelected: partners?.map(p => p.id) || []
13951
13956
  }, partners?.length)
13952
13957
  }),
13958
+ supportText: supportText,
13953
13959
  breadcrumbs: breadcrumbs
13954
13960
  }),
13955
13961
  children: [/*#__PURE__*/jsxRuntime.jsx("section", {
@@ -13958,7 +13964,8 @@ function SupplyChain({
13958
13964
  theme: theme,
13959
13965
  t: t,
13960
13966
  goTo: goTo,
13961
- getRedirectLink: getRedirectLink
13967
+ getRedirectLink: getRedirectLink,
13968
+ APP: APP
13962
13969
  })
13963
13970
  }), /*#__PURE__*/jsxRuntime.jsx("section", {
13964
13971
  children: /*#__PURE__*/jsxRuntime.jsx(SupplyChainMap, {
@@ -13995,11 +14002,11 @@ const getActionWidgetsConfig = ({
13995
14002
  }) => [{
13996
14003
  icon: "MineSite",
13997
14004
  title: t("Create Mine Site"),
13998
- onClick: () => goTo(getRedirectLink("/app/production-sites?create=true"))
14005
+ onClick: () => goTo(getRedirectLink(`/app/${APP === 'nashiriki' ? 'scl' : 'production-sites'}?create=true`))
13999
14006
  }, {
14000
14007
  icon: "FileEdit",
14001
14008
  title: "Report Activity",
14002
- onClick: () => goTo(getRedirectLink("/app/activities?create=true"))
14009
+ onClick: () => goTo(getRedirectLink(`/app/${APP === 'nashiriki' ? 'corrective-actions' : 'activities'}?create=true`))
14003
14010
  }, {
14004
14011
  icon: "ReportIncidents",
14005
14012
  title: "Report Incident",
@@ -14060,7 +14067,8 @@ const getRowConfig = ({
14060
14067
  data = {},
14061
14068
  goTo,
14062
14069
  getRedirectLink,
14063
- theme = {}
14070
+ theme = {},
14071
+ APP
14064
14072
  }) => [{
14065
14073
  label: /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorNavigateLabel, {
14066
14074
  t: t,
@@ -14090,8 +14098,8 @@ const getRowConfig = ({
14090
14098
  t: t,
14091
14099
  getRedirectLink: getRedirectLink,
14092
14100
  theme: theme,
14093
- label: "Activities",
14094
- link: "/app/activities"
14101
+ label: APP === 'nashiriki' ? 'Corrective Actions' : 'Activities',
14102
+ link: APP === 'nashiriki' ? '/app/corrective-actions' : '/app/activities'
14095
14103
  }),
14096
14104
  render: () => {
14097
14105
  return /*#__PURE__*/jsxRuntime.jsx("span", {
@@ -14134,7 +14142,8 @@ function KeyIndicators({
14134
14142
  goTo = () => {},
14135
14143
  getRedirectLink = () => {},
14136
14144
  theme = {},
14137
- partners = []
14145
+ partners = [],
14146
+ APP
14138
14147
  }) {
14139
14148
  const fetchConfig = React.useMemo(() => ({
14140
14149
  ...defaultFetchConfig$5
@@ -14153,8 +14162,9 @@ function KeyIndicators({
14153
14162
  },
14154
14163
  goTo,
14155
14164
  getRedirectLink,
14156
- theme
14157
- }), [t, data, goTo, getRedirectLink, partners, theme]);
14165
+ theme,
14166
+ APP
14167
+ }), [t, data, goTo, getRedirectLink, partners, theme, APP]);
14158
14168
  return /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorsWidget, {
14159
14169
  t: t,
14160
14170
  config: config,
@@ -14185,7 +14195,7 @@ const getFiltersConfig$e = ({
14185
14195
  const value = filters.type ? {
14186
14196
  value: filters.type
14187
14197
  } : {};
14188
- const eventCategoryOptions = (options?.eventCategoryOptions || [])?.map(item => ({
14198
+ const eventCategoryOptions = (options?.eventCategoryOptions || options?.categoryOptions || [])?.map(item => ({
14189
14199
  value: item.value,
14190
14200
  label: typeof item.label === 'object' ? Object.values(item.label)[1] : item.label
14191
14201
  }));
@@ -14196,7 +14206,7 @@ const getFiltersConfig$e = ({
14196
14206
  key: "category",
14197
14207
  type: "select",
14198
14208
  ...value,
14199
- options: options?.categoriesOptions ?? []
14209
+ options: options?.categoriesOptions || options?.category || []
14200
14210
  }];
14201
14211
  }
14202
14212
  if (activeTab === 'event') {
@@ -15487,7 +15497,8 @@ function UserDashboard({
15487
15497
  partners: informationSourcesCount,
15488
15498
  t: t,
15489
15499
  goTo: goTo,
15490
- getRedirectLink: getRedirectLink
15500
+ getRedirectLink: getRedirectLink,
15501
+ APP: APP
15491
15502
  })
15492
15503
  }), /*#__PURE__*/jsxRuntime.jsx("section", {
15493
15504
  children: /*#__PURE__*/jsxRuntime.jsx(MineSites, {
@@ -41038,6 +41049,10 @@ const Create = ({
41038
41049
  ...payloadData,
41039
41050
  form: formType
41040
41051
  };
41052
+ const {
41053
+ datastakeId,
41054
+ ...finalPayload
41055
+ } = newPayload;
41041
41056
  const callback = (type, m, data) => {
41042
41057
  if (setSelectedFormNext) {
41043
41058
  setSelectedFormNext();
@@ -41048,7 +41063,7 @@ const Create = ({
41048
41063
  antd.message.error(m);
41049
41064
  }
41050
41065
  };
41051
- saveData(!data && !data.id ? newPayload : Object.assign(newPayload, {
41066
+ saveData(!data && !data.id ? finalPayload : Object.assign(finalPayload, {
41052
41067
  id: data.id
41053
41068
  }), callback);
41054
41069
  },
@@ -42487,7 +42502,7 @@ const getFilterOptions$9 = (options, t) => {
42487
42502
  category,
42488
42503
  eventCategoryOptions
42489
42504
  } = options || {};
42490
- const catOptions = eventCategoryOptions?.map(item => ({
42505
+ const catOptions = (eventCategoryOptions || categoryOptions || [])?.map(item => ({
42491
42506
  value: item.value,
42492
42507
  label: typeof item.label === 'object' ? Object.values(item.label)[1] : item.label
42493
42508
  }));
@@ -44834,7 +44849,7 @@ const getColumns$6 = ({
44834
44849
  label: t("Summary"),
44835
44850
  value: "Summary",
44836
44851
  onClick: () => {
44837
- let link = `/app/${subject === 'scl' ? 'summary/scl' : 'mine-summary'}/${all.datastakeId}`;
44852
+ let link = `/app/mine-summary/${all.datastakeId}`;
44838
44853
  if (activeTab === "shared") {
44839
44854
  link += `?sourceId=${all?.authorId?.id}`;
44840
44855
  }
@@ -45464,6 +45479,9 @@ const useTablePage = ({
45464
45479
  t,
45465
45480
  subject
45466
45481
  }), [t, subject, getFiltersConfig$1]);
45482
+ console.log({
45483
+ options
45484
+ });
45467
45485
  React.useEffect(() => {
45468
45486
  setSelectOptions(prev => ({
45469
45487
  ...prev,
@@ -50912,6 +50930,7 @@ const getSourcesType = subject => {
50912
50930
  locations: "location",
50913
50931
  location: "location",
50914
50932
  "production-sites": "location",
50933
+ scl: "location",
50915
50934
  stakeholders: "stakeholder",
50916
50935
  stakeholder: "stakeholder",
50917
50936
  workers: "stakeholder",
@@ -50969,9 +50988,6 @@ const Records = ({
50969
50988
  source: selectedSource
50970
50989
  }
50971
50990
  });
50972
- console.log({
50973
- data
50974
- });
50975
50991
  setVersions(data);
50976
50992
  } catch (error) {
50977
50993
  console.error('Error fetching versions:', error);
@@ -61529,11 +61545,6 @@ class LinkedSubjectsService extends BaseService {
61529
61545
  getForm({
61530
61546
  namespace
61531
61547
  }, language = "en", scope) {
61532
- console.log({
61533
- namespace,
61534
- language,
61535
- scope
61536
- });
61537
61548
  return this.apiGet({
61538
61549
  url: `forms/${namespace === "documents" ? namespace : getNamespace(namespace)}`,
61539
61550
  isApp: true,
@@ -1458,11 +1458,6 @@ class LinkedSubjectsService extends BaseService {
1458
1458
  getForm({
1459
1459
  namespace
1460
1460
  }, language = "en", scope) {
1461
- console.log({
1462
- namespace,
1463
- language,
1464
- scope
1465
- });
1466
1461
  return this.apiGet({
1467
1462
  url: `forms/${namespace === "documents" ? namespace : getNamespace(namespace)}`,
1468
1463
  isApp: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.818",
3
+ "version": "0.6.819",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -4,6 +4,7 @@ export const getSourcesType = (subject) => {
4
4
  locations: "location",
5
5
  location: "location",
6
6
  "production-sites": "location",
7
+ scl: "location",
7
8
 
8
9
  stakeholders: "stakeholder",
9
10
  stakeholder: "stakeholder",
@@ -39,7 +39,6 @@ const Records = ({
39
39
  const { data } = await VersionService.getSources({ type, id, params: {
40
40
  source: selectedSource,
41
41
  } });
42
- console.log({data})
43
42
  setVersions(data);
44
43
  } catch (error) {
45
44
  console.error('Error fetching versions:', error);
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import CustomIcon from '../../../../../core/components/Icon/CustomIcon.jsx';
3
3
  import KeyIndicatorNavigateLabel from '../../../../../core/components/UI/KeyIndicatorNavigateLabel/index.jsx';
4
4
 
5
- export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }) => [
5
+ export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {}, APP }) => [
6
6
  {
7
7
  label: (
8
8
  <KeyIndicatorNavigateLabel
@@ -10,7 +10,7 @@ export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }
10
10
  getRedirectLink={getRedirectLink}
11
11
  theme={theme}
12
12
  label="Identified Mine Sites"
13
- link="/app/production-sites"
13
+ link={APP === 'nashiriki' ? '/app/scl' : '/app/production-sites'}
14
14
  />
15
15
  ),
16
16
  render: () => {
@@ -13,7 +13,7 @@ const defaultFetchConfig = {
13
13
  },
14
14
  };
15
15
 
16
- function KeyIndicators({selectedSources = {}, theme = {}, getRedirectLink = () => {}, t = () => {}, goTo = () => {} }) {
16
+ function KeyIndicators({selectedSources = {}, theme = {}, getRedirectLink = () => {}, t = () => {}, goTo = () => {}, APP }) {
17
17
  const fetchConfig = useMemo(() => ({
18
18
  ...defaultFetchConfig,
19
19
  filters: { ...defaultFetchConfig.filters, sources: selectedSources?.partners || [] },
@@ -29,8 +29,9 @@ function KeyIndicators({selectedSources = {}, theme = {}, getRedirectLink = () =
29
29
  goTo,
30
30
  getRedirectLink,
31
31
  theme,
32
+ APP
32
33
  })
33
- }, [t, data, goTo, getRedirectLink, theme])
34
+ }, [t, data, goTo, getRedirectLink, theme, APP])
34
35
 
35
36
  return (
36
37
  <KeyIndicatorsWidget
@@ -21,6 +21,8 @@ function SupplyChain({
21
21
  informationSources,
22
22
  hardcodedData,
23
23
  breadcrumbs = [],
24
+ supportText,
25
+ APP,
24
26
  }) {
25
27
 
26
28
  const sourceOptions = useMemo(() => {
@@ -69,12 +71,13 @@ function SupplyChain({
69
71
  />
70
72
  </div>
71
73
  }
74
+ supportText={supportText}
72
75
  breadcrumbs={breadcrumbs}
73
76
  />
74
77
  }
75
78
  >
76
79
  <section>
77
- <KeyIndicators selectedSources={selectedPartners} theme={theme} t={t} goTo={goTo} getRedirectLink={getRedirectLink} />
80
+ <KeyIndicators selectedSources={selectedPartners} theme={theme} t={t} goTo={goTo} getRedirectLink={getRedirectLink} APP={APP} />
78
81
  </section>
79
82
  <section>
80
83
  <SupplyChainMap selectedSources={selectedPartners} t={t} goTo={goTo} options={options} getRedirectLink={getRedirectLink} />
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import CustomIcon from '../../../../../core/components/Icon/CustomIcon.jsx';
3
3
  import KeyIndicatorNavigateLabel from '../../../../../core/components/UI/KeyIndicatorNavigateLabel/index.jsx';
4
4
 
5
- export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }) => [
5
+ export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {}, APP }) => [
6
6
  {
7
7
  label: (
8
8
  <KeyIndicatorNavigateLabel
@@ -35,8 +35,8 @@ export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }
35
35
  t={t}
36
36
  getRedirectLink={getRedirectLink}
37
37
  theme={theme}
38
- label="Activities"
39
- link="/app/activities"
38
+ label={APP === 'nashiriki' ? 'Corrective Actions' : 'Activities'}
39
+ link={APP === 'nashiriki' ? '/app/corrective-actions' : '/app/activities'}
40
40
  />
41
41
  ),
42
42
  render: () => {
@@ -17,6 +17,7 @@ function KeyIndicators({
17
17
  getRedirectLink = () => {},
18
18
  theme = {},
19
19
  partners = [],
20
+ APP,
20
21
  }) {
21
22
  const fetchConfig = useMemo(
22
23
  () => ({
@@ -33,9 +34,10 @@ function KeyIndicators({
33
34
  data: { ...data, partners },
34
35
  goTo,
35
36
  getRedirectLink,
36
- theme
37
+ theme,
38
+ APP
37
39
  }),
38
- [t, data, goTo, getRedirectLink, partners, theme],
40
+ [t, data, goTo, getRedirectLink, partners, theme, APP],
39
41
  );
40
42
 
41
43
  return (
@@ -9,7 +9,7 @@ export const getTabs = (t) => {
9
9
  export const getFiltersConfig = ({t, filters, activeTab, options}) => {
10
10
  const value = filters.type ? { value: filters.type } : {};
11
11
 
12
- const eventCategoryOptions = (options?.eventCategoryOptions || [])?.map((item) => ({
12
+ const eventCategoryOptions = (options?.eventCategoryOptions || options?.categoryOptions || [])?.map((item) => ({
13
13
  value: item.value,
14
14
  label: typeof item.label === 'object' ? Object.values(item.label)[1] : item.label,
15
15
  }))
@@ -22,7 +22,7 @@ export const getFiltersConfig = ({t, filters, activeTab, options}) => {
22
22
  key: "category",
23
23
  type: "select",
24
24
  ...value,
25
- options: options?.categoriesOptions ?? [],
25
+ options: options?.categoriesOptions || options?.category || [],
26
26
  },
27
27
  ];
28
28
  }
@@ -2,12 +2,12 @@ export const getActionWidgetsConfig = ({ goTo, getRedirectLink, APP, t }) => [
2
2
  {
3
3
  icon: "MineSite",
4
4
  title: t("Create Mine Site"),
5
- onClick: () => goTo(getRedirectLink("/app/production-sites?create=true")),
5
+ onClick: () => goTo(getRedirectLink(`/app/${APP === 'nashiriki' ? 'scl' : 'production-sites'}?create=true`)),
6
6
  },
7
7
  {
8
8
  icon: "FileEdit",
9
9
  title: "Report Activity",
10
- onClick: () => goTo(getRedirectLink("/app/activities?create=true")),
10
+ onClick: () => goTo(getRedirectLink(`/app/${APP === 'nashiriki' ? 'corrective-actions' : 'activities'}?create=true`)),
11
11
  },
12
12
  {
13
13
  icon: "ReportIncidents",
@@ -67,6 +67,7 @@ function UserDashboard({
67
67
  t={t}
68
68
  goTo={goTo}
69
69
  getRedirectLink={getRedirectLink}
70
+ APP={APP}
70
71
  />
71
72
  </section>
72
73
  <section>
@@ -53,7 +53,7 @@ export const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {
53
53
  number: 0,
54
54
  name: item.name,
55
55
  sources: parentId ? [parentId] : [],
56
- subTitle: findOptions(item?.category, options?.categoriesOptions),
56
+ subTitle: findOptions(item?.category, options?.categoriesOptions || options?.category || []),
57
57
  leftIcon: type === "client" ? rightIcon : leftIcon,
58
58
  leftBackground: type === "client" ? rightBackground : leftBackground,
59
59
  topIcon: mapIcon(item.category),
@@ -70,7 +70,7 @@ export const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {
70
70
  id: data.id,
71
71
  number: 0,
72
72
  name: data.name,
73
- subTitle: findOptions(data?.category, options?.categoriesOptions),
73
+ subTitle: findOptions(data?.category, options?.categoriesOptions || options?.category || []),
74
74
  leftIcon: middleIcon,
75
75
  leftBackground: theme.colorPrimary10,
76
76
  topIcon: mapIcon(data.category),
@@ -117,7 +117,7 @@ export const getFilterOptions = (options, t) => {
117
117
  eventCategoryOptions,
118
118
  } = options || {};
119
119
 
120
- const catOptions = eventCategoryOptions?.map((item) => ({
120
+ const catOptions = (eventCategoryOptions || categoryOptions || [])?.map((item) => ({
121
121
  value: item.value,
122
122
  label: typeof item.label === 'object' ? Object.values(item.label)[1] : item.label,
123
123
  }))
@@ -188,7 +188,7 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
188
188
  label: t("Summary"),
189
189
  value: "Summary",
190
190
  onClick: () => {
191
- let link = `/app/${subject === 'scl' ? 'summary/scl' : 'mine-summary'}/${all.datastakeId}`
191
+ let link = `/app/mine-summary/${all.datastakeId}`
192
192
  if (activeTab === "shared") {
193
193
  link += `?sourceId=${all?.authorId?.id}`;
194
194
  }
@@ -79,6 +79,8 @@ const Create = ({
79
79
  form: formType
80
80
  };
81
81
 
82
+ const { datastakeId, ...finalPayload } = newPayload;
83
+
82
84
 
83
85
  const callback = (type, m, data) => {
84
86
  if (setSelectedFormNext) {
@@ -92,7 +94,7 @@ const Create = ({
92
94
  };
93
95
 
94
96
  saveData(
95
- !data && !data.id ? newPayload : Object.assign(newPayload, { id: data.id }),
97
+ !data && !data.id ? finalPayload : Object.assign(finalPayload, { id: data.id }),
96
98
  callback,
97
99
  );
98
100
  }}
@@ -94,6 +94,8 @@ export const useTablePage = ({
94
94
  [t, subject, getFiltersConfig]
95
95
  );
96
96
 
97
+ console.log({options})
98
+
97
99
  useEffect(() => {
98
100
  setSelectOptions((prev) => ({
99
101
  ...prev,
@@ -27,7 +27,6 @@ export const getNamespace = (namespace) => {
27
27
 
28
28
  class LinkedSubjectsService extends BaseService {
29
29
  getForm({ namespace }, language = "en", scope) {
30
- console.log({namespace, language, scope})
31
30
  return this.apiGet({
32
31
  url: `forms/${namespace === "documents" ? namespace : getNamespace(namespace)}`,
33
32
  isApp: true,
@@ -67,6 +66,7 @@ class LinkedSubjectsService extends BaseService {
67
66
  }
68
67
 
69
68
  save(payload, namespace) {
69
+ {payload, namespace}
70
70
  if (payload.datastakeId) {
71
71
  let _namespace = getNamespace(namespace);
72
72