datastake-daf 0.6.762 → 0.6.764

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 (47) hide show
  1. package/dist/components/index.js +205 -165
  2. package/dist/hooks/index.js +1 -5
  3. package/dist/layouts/index.js +36 -11
  4. package/dist/pages/index.js +1922 -1021
  5. package/dist/services/index.js +1 -21
  6. package/dist/utils/index.js +0 -6
  7. package/package.json +1 -1
  8. package/src/@daf/core/components/Graphs/StakeholderMappings/index.jsx +2 -0
  9. package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +2 -1
  10. package/src/@daf/core/components/Screens/TableScreen/TablePageWithTabs/index.jsx +9 -4
  11. package/src/@daf/core/components/Screens/Users/config.js +0 -1
  12. package/src/@daf/core/components/Table/index.jsx +2 -2
  13. package/src/@daf/core/components/UI/KeyIndicatorNavigateLabel/index.jsx +29 -0
  14. package/src/@daf/hooks/useFilters.js +1 -3
  15. package/src/@daf/layouts/AppLayout/components/MobileDrawer/index.js +4 -2
  16. package/src/@daf/layouts/AppLayout/components/UserDropdown/index.js +23 -2
  17. package/src/@daf/layouts/AppLayout/index.jsx +2 -0
  18. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/config.js +7 -6
  19. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +2 -1
  20. package/src/@daf/pages/Dashboards/SupplyChain/components/KeyIndicators/config.js +29 -53
  21. package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +2 -2
  22. package/src/@daf/pages/Dashboards/UserDashboard/components/DataCompilation/index.jsx +1 -0
  23. package/src/@daf/pages/Dashboards/UserDashboard/components/DataConsilidation/index.jsx +0 -1
  24. package/src/@daf/pages/Dashboards/UserDashboard/components/KeyIndicators/config.js +36 -70
  25. package/src/@daf/pages/Documents/index.jsx +9 -13
  26. package/src/@daf/pages/Events/Activities/index.jsx +8 -21
  27. package/src/@daf/pages/Events/Incidents/index.jsx +8 -21
  28. package/src/@daf/pages/Events/config.js +0 -1
  29. package/src/@daf/pages/Events/index.jsx +8 -20
  30. package/src/@daf/pages/Locations/MineSite/columns.js +3 -3
  31. package/src/@daf/pages/Locations/MineSite/config.js +0 -1
  32. package/src/@daf/pages/Locations/MineSite/index.jsx +8 -21
  33. package/src/@daf/pages/Locations/index.jsx +9 -12
  34. package/src/@daf/pages/Partners/columns.js +421 -0
  35. package/src/@daf/pages/Partners/config.js +32 -0
  36. package/src/@daf/pages/Partners/create.jsx +145 -0
  37. package/src/@daf/pages/Partners/edit.jsx +98 -0
  38. package/src/@daf/pages/Partners/hook.js +153 -0
  39. package/src/@daf/pages/Partners/index.jsx +233 -8
  40. package/src/@daf/pages/Stakeholders/Operators/index.jsx +8 -22
  41. package/src/@daf/pages/Stakeholders/Workers/index.jsx +8 -21
  42. package/src/@daf/pages/Stakeholders/index.jsx +9 -10
  43. package/src/@daf/pages/hook.js +34 -0
  44. package/src/@daf/services/PartnerService.js +1 -16
  45. package/src/helpers/breadCrumbs.js +0 -2
  46. package/src/index.js +1 -1
  47. package/src/pages.js +1 -0
@@ -418,11 +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]);
422
- console.log({
423
- totalPages,
424
- pagination
425
- });
421
+ const canGoNext = React.useMemo(() => pagination.current !== totalPages && totalPages > 0, [pagination, totalPages]);
426
422
  const goPrev = () => {
427
423
  if (!canGoPrev) {
428
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
  })]