datastake-daf 0.6.763 → 0.6.765

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 (42) hide show
  1. package/dist/components/index.js +45 -19
  2. package/dist/hooks/index.js +1 -1
  3. package/dist/layouts/index.js +36 -11
  4. package/dist/pages/index.js +1974 -999
  5. package/dist/services/index.js +1 -21
  6. package/dist/style/datastake/mapbox-gl.css +330 -0
  7. package/package.json +1 -1
  8. package/src/@daf/core/components/Screens/TableScreen/TablePageWithTabs/index.jsx +9 -4
  9. package/src/@daf/core/components/Table/index.jsx +2 -2
  10. package/src/@daf/core/components/UI/KeyIndicatorNavigateLabel/index.jsx +29 -0
  11. package/src/@daf/hooks/useFilters.js +1 -1
  12. package/src/@daf/layouts/AppLayout/components/MobileDrawer/index.js +4 -2
  13. package/src/@daf/layouts/AppLayout/components/UserDropdown/index.js +23 -2
  14. package/src/@daf/layouts/AppLayout/index.jsx +2 -0
  15. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/config.js +7 -6
  16. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +2 -1
  17. package/src/@daf/pages/Dashboards/SupplyChain/components/KeyIndicators/config.js +29 -53
  18. package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +2 -2
  19. package/src/@daf/pages/Dashboards/UserDashboard/components/KeyIndicators/config.js +36 -70
  20. package/src/@daf/pages/Documents/index.jsx +9 -13
  21. package/src/@daf/pages/Events/Activities/index.jsx +8 -21
  22. package/src/@daf/pages/Events/Incidents/index.jsx +8 -21
  23. package/src/@daf/pages/Events/index.jsx +8 -20
  24. package/src/@daf/pages/Locations/MineSite/index.jsx +8 -21
  25. package/src/@daf/pages/Locations/index.jsx +9 -12
  26. package/src/@daf/pages/Partners/columns.js +421 -0
  27. package/src/@daf/pages/Partners/config.js +32 -0
  28. package/src/@daf/pages/Partners/create.jsx +145 -0
  29. package/src/@daf/pages/Partners/edit.jsx +98 -0
  30. package/src/@daf/pages/Partners/hook.js +153 -0
  31. package/src/@daf/pages/Partners/index.jsx +233 -8
  32. package/src/@daf/pages/Stakeholders/Operators/index.jsx +8 -22
  33. package/src/@daf/pages/Stakeholders/Workers/index.jsx +8 -21
  34. package/src/@daf/pages/Stakeholders/index.jsx +9 -10
  35. package/src/@daf/pages/Summary/Activities/PlantingCycle/config.js +40 -0
  36. package/src/@daf/pages/Summary/Activities/PlantingCycle/helper.js +122 -0
  37. package/src/@daf/pages/Summary/Activities/PlantingCycle/index.jsx +46 -0
  38. package/src/@daf/pages/Summary/Activities/Restoration/config.js +1 -1
  39. package/src/@daf/pages/hook.js +34 -0
  40. package/src/@daf/services/PartnerService.js +1 -16
  41. package/src/index.js +1 -1
  42. package/src/pages.js +2 -0
@@ -5901,10 +5901,10 @@ function DAFTable(_ref) {
5901
5901
  }) : filtersConfig;
5902
5902
  }, [sourcesKey, sources, filtersConfig, t]);
5903
5903
  React.useEffect(() => {
5904
- if (data) {
5904
+ if (data && Array.isArray(data)) {
5905
5905
  setSource(data);
5906
5906
  }
5907
- }, [data]);
5907
+ }, [data, data.length]);
5908
5908
  const paginationPageSize = pagination === null || pagination === void 0 ? void 0 : pagination.pageSize;
5909
5909
  const dataSource = React.useMemo(() => {
5910
5910
  const pageSize = paginationPageSize ? paginationPageSize : source.length > 10 ? source.length : 10;
@@ -10317,21 +10317,20 @@ const handleDataLinkWithTableKeys = ({
10317
10317
  }
10318
10318
  };
10319
10319
 
10320
- const handleGroupChildren = _ref => {
10321
- let {
10322
- config,
10323
- value,
10324
- allData,
10325
- level,
10326
- t,
10327
- rootForm,
10328
- user,
10329
- getApiBaseUrl = () => {},
10330
- getAppHeader = () => {},
10331
- app,
10332
- TreeNodeComponent
10333
- } = _ref;
10334
- if (!(config !== null && config !== void 0 && config.inputs)) {
10320
+ const handleGroupChildren = ({
10321
+ config,
10322
+ value,
10323
+ allData,
10324
+ level,
10325
+ t,
10326
+ rootForm,
10327
+ user,
10328
+ getApiBaseUrl = () => {},
10329
+ getAppHeader = () => {},
10330
+ app,
10331
+ TreeNodeComponent
10332
+ }) => {
10333
+ if (!config?.inputs) {
10335
10334
  return null;
10336
10335
  }
10337
10336
  const inputKeys = Object.keys(config.inputs);
@@ -10344,7 +10343,7 @@ const handleGroupChildren = _ref => {
10344
10343
  if (value && typeof value === 'object' && value[inputKey]) {
10345
10344
  inputValue = value[inputKey];
10346
10345
  } else {
10347
- inputValue = allData === null || allData === void 0 ? void 0 : allData[inputKey];
10346
+ inputValue = allData?.[inputKey];
10348
10347
  }
10349
10348
  return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
10350
10349
  nodeKey: inputKey,
@@ -44109,7 +44108,7 @@ const useFilters = ({
44109
44108
  return Math.ceil(pagination.total / pagination.pageSize);
44110
44109
  }, [pagination]);
44111
44110
  const canGoPrev = React.useMemo(() => pagination.current !== 1, [pagination]);
44112
- const canGoNext = React.useMemo(() => pagination.current !== totalPages && totalPages, [pagination, totalPages]);
44111
+ const canGoNext = React.useMemo(() => pagination.current !== totalPages && totalPages > 0, [pagination, totalPages]);
44113
44112
  const goPrev = () => {
44114
44113
  if (!canGoPrev) {
44115
44114
  return;
@@ -60269,6 +60268,32 @@ CountryFlag.propTypes = {
60269
60268
  hasTooltip: PropTypes__default["default"].bool
60270
60269
  };
60271
60270
 
60271
+ function KeyIndicatorNavigateLabel(_ref) {
60272
+ let {
60273
+ t,
60274
+ getRedirectLink,
60275
+ theme,
60276
+ label,
60277
+ link
60278
+ } = _ref;
60279
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
60280
+ className: "flex",
60281
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
60282
+ className: "flex-1",
60283
+ children: t(label)
60284
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
60285
+ className: "cursor-pointer",
60286
+ onClick: () => window.open(getRedirectLink(link), '_blank'),
60287
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
60288
+ name: "LinkNewTab",
60289
+ width: 16,
60290
+ height: 16,
60291
+ color: theme.colorPrimary
60292
+ })
60293
+ })]
60294
+ });
60295
+ }
60296
+
60272
60297
  var Style$5 = styled__default["default"].div`
60273
60298
  display: flex;
60274
60299
  flex-direction: column;
@@ -61610,6 +61635,7 @@ exports.InformationChannelsDataPoint = DataPoint;
61610
61635
  exports.InformationChannelsSubject = Subject;
61611
61636
  exports.InformationChannelsView = InformationChannel;
61612
61637
  exports.InformationUnavailable = InformationUnavailable;
61638
+ exports.KeyIndicatorNavigateLabel = KeyIndicatorNavigateLabel;
61613
61639
  exports.KeyIndicators = KeyIndicatorsWidget$1;
61614
61640
  exports.KeyIndicatorsDetails = KeyIndicatorsDetails;
61615
61641
  exports.LineChart = LineChart;
@@ -418,7 +418,7 @@ const useFilters = ({
418
418
  return Math.ceil(pagination.total / pagination.pageSize);
419
419
  }, [pagination]);
420
420
  const canGoPrev = React.useMemo(() => pagination.current !== 1, [pagination]);
421
- const canGoNext = React.useMemo(() => pagination.current !== totalPages && totalPages, [pagination, totalPages]);
421
+ const canGoNext = React.useMemo(() => pagination.current !== totalPages && totalPages > 0, [pagination, totalPages]);
422
422
  const goPrev = () => {
423
423
  if (!canGoPrev) {
424
424
  return;
@@ -4583,6 +4583,10 @@ CustomIcon.propTypes = {
4583
4583
  size: PropTypes__default["default"].number
4584
4584
  };
4585
4585
 
4586
+ const userIsAdmin = user => {
4587
+ return user?.role?.id === 'APP_ADMIN';
4588
+ };
4589
+
4586
4590
  /* eslint-disable no-unused-vars */
4587
4591
  const featureIsNotAvailable = (t, isDemo) => {
4588
4592
  antd.Modal.error({
@@ -5800,10 +5804,12 @@ function MobileDrawer({
5800
5804
  userHelpers = {},
5801
5805
  isDev = false,
5802
5806
  selectedProject,
5803
- theme = {}
5807
+ theme = {},
5808
+ dropdownItems = []
5804
5809
  }) {
5805
5810
  const items = React.useMemo(() => sidenavConfig[mod] || [], [sidenavConfig, mod]);
5806
- const canViewPartners = React.useMemo(() => mod === 'tazama', [mod]);
5811
+ const appsWithPartners = ['tazama', 'nashiriki', 'wazi', 'hatua'];
5812
+ const canViewPartners = React.useMemo(() => appsWithPartners.includes(mod), [mod]);
5807
5813
  const canViewProjects = checkPermission({
5808
5814
  permission: 'projects.canView',
5809
5815
  permissions: user?.role?.permissions
@@ -5856,7 +5862,7 @@ function MobileDrawer({
5856
5862
  }, {
5857
5863
  type: 'link',
5858
5864
  name: t('Partners'),
5859
- path: `/app/${mod}/partners`,
5865
+ path: `/app/partners`,
5860
5866
  isDashboard: true,
5861
5867
  visible: canViewPartners
5862
5868
  }, {
@@ -5962,16 +5968,14 @@ const UserDropdownMenu = ({
5962
5968
  userHelpers = {},
5963
5969
  isDev = false,
5964
5970
  theme = {},
5965
- moduleInterfaceConfig = null
5971
+ moduleInterfaceConfig = null,
5972
+ dropdownItems = []
5966
5973
  }) => {
5967
5974
  const resizeContext = useResizeContext();
5968
5975
  const {
5969
5976
  windowWidth
5970
5977
  } = resizeContext || {};
5971
- const {
5972
- userIsAdmin
5973
- } = userHelpers;
5974
- const isAdmin = React.useMemo(() => userIsAdmin?.(user), [user, userIsAdmin]);
5978
+ const isAdmin = React.useMemo(() => userIsAdmin(user), [user]);
5975
5979
 
5976
5980
  // Add fallback for windowWidth
5977
5981
  const actualWidth = windowWidth || (typeof window !== 'undefined' ? window.innerWidth : 1920);
@@ -6029,7 +6033,8 @@ const UserDropdownMenu = ({
6029
6033
  changeNotificationState: changeNotificationState,
6030
6034
  appName: appName,
6031
6035
  theme: theme,
6032
- moduleInterfaceConfig: moduleInterfaceConfig
6036
+ moduleInterfaceConfig: moduleInterfaceConfig,
6037
+ dropdownItems: dropdownItems
6033
6038
  })]
6034
6039
  }) : /*#__PURE__*/jsxRuntime.jsx(antd.Dropdown, {
6035
6040
  trigger: "click",
@@ -6047,7 +6052,25 @@ const UserDropdownMenu = ({
6047
6052
  })]
6048
6053
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
6049
6054
  className: "list",
6050
- children: [user.company && !isDemoEnv && canViewUsers && !isAdmin ? /*#__PURE__*/jsxRuntime.jsx("div", {
6055
+ children: [dropdownItems && dropdownItems.filter(item => {
6056
+ if (typeof item.condition === 'function') {
6057
+ return item.condition({
6058
+ user,
6059
+ isAdmin,
6060
+ module,
6061
+ checkPermission,
6062
+ appName
6063
+ });
6064
+ }
6065
+ if ('condition' in item) {
6066
+ return !!item.condition;
6067
+ }
6068
+ return true;
6069
+ }).map(item => /*#__PURE__*/jsxRuntime.jsx("div", {
6070
+ className: "list-item",
6071
+ onClick: () => handlegoTo(getRedirectLink(item.path)),
6072
+ children: item.name
6073
+ }, item.key)), user.company && !isDemoEnv && canViewUsers && !isAdmin ? /*#__PURE__*/jsxRuntime.jsx("div", {
6051
6074
  className: "list-item",
6052
6075
  onClick: () => handlegoTo(getRedirectLink(`/app/users`)),
6053
6076
  children: t('Users')
@@ -7905,6 +7928,7 @@ function AppLayout({
7905
7928
  updateLanguage,
7906
7929
  getUserOptions,
7907
7930
  selectedProject,
7931
+ dropdownItems = [],
7908
7932
  // Navigation (injected from app)
7909
7933
  goTo = () => {},
7910
7934
  location,
@@ -8233,7 +8257,8 @@ function AppLayout({
8233
8257
  userHelpers: userHelpers,
8234
8258
  isDev: isDev,
8235
8259
  theme: theme,
8236
- moduleInterfaceConfig: moduleInterfaceConfig
8260
+ moduleInterfaceConfig: moduleInterfaceConfig,
8261
+ dropdownItems: dropdownItems
8237
8262
  })
8238
8263
  })]
8239
8264
  })]