datastake-daf 0.6.737 → 0.6.739

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 (36) hide show
  1. package/dist/components/index.js +16 -9
  2. package/dist/hooks/index.js +4662 -21
  3. package/dist/layouts/index.js +19 -6
  4. package/dist/pages/index.js +1589 -78
  5. package/dist/services/index.js +76 -0
  6. package/dist/utils/index.js +4 -4
  7. package/package.json +1 -1
  8. package/public/assets/favicons/datastake-black.svg +13 -0
  9. package/public/assets/favicons/datastake-white.svg +13 -0
  10. package/src/@daf/core/components/EditForm/components/DataLink/useAjaxModal.js +1 -1
  11. package/src/@daf/core/components/Filters/selectFilters/AjaxSelect.jsx +1 -1
  12. package/src/@daf/core/components/PdfForm/utils/useAjaxModal.js +1 -1
  13. package/src/@daf/core/components/Sidenav/index.jsx +15 -3
  14. package/src/@daf/core/components/ViewForm/components/DataLink/useAjaxModal.js +1 -1
  15. package/src/@daf/hooks/useGetQueryParams.js +2 -2
  16. package/src/@daf/layouts/AppLayout/components/Sidenav/index.js +2 -0
  17. package/src/@daf/layouts/AppLayout/index.jsx +6 -1
  18. package/src/@daf/pages/dashboards/AllInformation/Documents/columns.js +106 -0
  19. package/src/@daf/pages/dashboards/AllInformation/Documents/config.js +31 -0
  20. package/src/@daf/pages/dashboards/AllInformation/Documents/create.jsx +104 -0
  21. package/src/@daf/pages/dashboards/AllInformation/Documents/index.jsx +156 -0
  22. package/src/@daf/pages/dashboards/AllInformation/Events/columns.js +150 -0
  23. package/src/@daf/pages/dashboards/AllInformation/Events/config.js +31 -0
  24. package/src/@daf/pages/dashboards/AllInformation/Events/create.jsx +104 -0
  25. package/src/@daf/pages/dashboards/AllInformation/Events/index.jsx +156 -0
  26. package/src/@daf/pages/dashboards/AllInformation/Locations/index.jsx +1 -2
  27. package/src/@daf/pages/dashboards/Operations/Operators/columns.js +150 -0
  28. package/src/@daf/pages/dashboards/Operations/Operators/config.js +163 -0
  29. package/src/@daf/pages/dashboards/Operations/Operators/create.jsx +104 -0
  30. package/src/@daf/pages/dashboards/Operations/Operators/index.jsx +155 -0
  31. package/src/@daf/pages/pages/TablePageWithTabs/index.jsx +2 -2
  32. package/src/@daf/services/OperatorService.js +90 -0
  33. package/src/helpers/StringHelper.js +4 -4
  34. package/src/pages.js +5 -2
  35. package/src/services.js +2 -1
  36. package/dist/style/datastake/mapbox-gl.css +0 -330
@@ -4662,12 +4662,12 @@ const camelCaseToTitle = string => string && typeof string === 'string' ? string
4662
4662
  const findOptions = (value, options) => {
4663
4663
  if (value instanceof Array) {
4664
4664
  return value.map(v => {
4665
- const op = options?.find(o => o.value === v);
4665
+ const op = Array.isArray(options) ? options.find(o => o.value === v) : null;
4666
4666
  return op ? op.label : v;
4667
4667
  });
4668
4668
  }
4669
4669
  if (typeof value === "string") {
4670
- const op = options?.find(o => o.value === value);
4670
+ const op = Array.isArray(options) ? options.find(o => o.value === value) : null;
4671
4671
  return op ? op.label : value;
4672
4672
  }
4673
4673
  return value;
@@ -5316,7 +5316,7 @@ const getAjaxData = async ({
5316
5316
  apiUrl,
5317
5317
  app
5318
5318
  }) => {
5319
- const noQuerryApps = ["nashiriki", "straatos"];
5319
+ const noQuerryApps = ["nashiriki", "straatos", "wazi", "hatua"];
5320
5320
  const data = await axios__default["default"].post(noQuerryApps.includes(app) ? "/query" : "/query/options", {
5321
5321
  entity,
5322
5322
  method,
@@ -13547,7 +13547,7 @@ const getTabs = t => {
13547
13547
  label: t("Events")
13548
13548
  }];
13549
13549
  };
13550
- const getFiltersConfig$2 = (t, filters, locationCategories) => {
13550
+ const getFiltersConfig$5 = (t, filters, locationCategories) => {
13551
13551
  const value = filters.type ? {
13552
13552
  value: filters.type
13553
13553
  } : {};
@@ -13756,7 +13756,7 @@ function MineSites({
13756
13756
  config: dataFetchConfig
13757
13757
  });
13758
13758
  const tabs = React.useMemo(() => getTabs(t), [t]);
13759
- const filtersConfig = React.useMemo(() => getFiltersConfig$2(t, filters, locationCategories), [activeTab, filters, t, locationCategories]);
13759
+ const filtersConfig = React.useMemo(() => getFiltersConfig$5(t, filters, locationCategories), [activeTab, filters, t, locationCategories]);
13760
13760
  const onFilterChange = filters => {
13761
13761
  setFilters(p => ({
13762
13762
  ...p,
@@ -15860,7 +15860,7 @@ const TablePageWithTabs = ({
15860
15860
  onCreateModalClose = () => {},
15861
15861
  children
15862
15862
  }) => {
15863
- const params = new URLSearchParams(location.search);
15863
+ const params = new URLSearchParams(location?.search);
15864
15864
  const [activeTab, setActiveTab] = React.useState(params.get("tab") || defaultActiveTab);
15865
15865
  const [openCreateModal, setOpenCreateModal] = React.useState(false);
15866
15866
  const getActiveTabRef = React.useRef(getActiveTab);
@@ -15901,7 +15901,7 @@ const TablePageWithTabs = ({
15901
15901
  return;
15902
15902
  }
15903
15903
  setActiveTab(val);
15904
- const newParams = new URLSearchParams(location.search);
15904
+ const newParams = new URLSearchParams(location?.search);
15905
15905
  newParams.set("tab", val);
15906
15906
  goTo(`${location.pathname}?${newParams.toString()}`);
15907
15907
  },
@@ -15992,7 +15992,13 @@ function AvatarGroup({
15992
15992
  });
15993
15993
  }
15994
15994
 
15995
- const getColumns$1 = ({
15995
+ const getLinkValue$2 = (value, linkingObject) => {
15996
+ if (linkingObject && linkingObject?.[value]) {
15997
+ return linkingObject?.[value]?.name;
15998
+ }
15999
+ return null;
16000
+ };
16001
+ const getColumns$4 = ({
15996
16002
  t,
15997
16003
  goTo,
15998
16004
  user,
@@ -16000,7 +16006,8 @@ const getColumns$1 = ({
16000
16006
  activeTab,
16001
16007
  getRedirectLink,
16002
16008
  theme,
16003
- subject
16009
+ subject,
16010
+ data
16004
16011
  }) => [{
16005
16012
  dataIndex: 'datastakeId',
16006
16013
  title: t('ID'),
@@ -16044,15 +16051,15 @@ const getColumns$1 = ({
16044
16051
  className: "daf-default-cell"
16045
16052
  });
16046
16053
  }
16047
- const category = findOptions(v, options?.categoriesOptions);
16054
+ const category = findOptions(v, data?.options?.locationCategories);
16048
16055
  return category ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16049
16056
  title: category,
16050
16057
  children: category
16051
16058
  }) : '-';
16052
16059
  }
16053
16060
  }, {
16054
- dataIndex: 'subCategory',
16055
- title: t('Sub Category'),
16061
+ dataIndex: 'country',
16062
+ title: t('Country'),
16056
16063
  ellipsis: true,
16057
16064
  show: true,
16058
16065
  render: (v, all) => {
@@ -16061,15 +16068,15 @@ const getColumns$1 = ({
16061
16068
  className: "daf-default-cell"
16062
16069
  });
16063
16070
  }
16064
- const subCategory = findOptions(v, options?.subCategoriesOptions);
16065
- return subCategory ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16066
- title: subCategory,
16067
- children: subCategory
16071
+ const country = findOptions(v, options?.countries);
16072
+ return country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16073
+ title: country,
16074
+ children: country
16068
16075
  }) : '-';
16069
16076
  }
16070
16077
  }, {
16071
- dataIndex: 'country',
16072
- title: t('Country'),
16078
+ dataIndex: 'administrativeLevel1',
16079
+ title: t('Region'),
16073
16080
  ellipsis: true,
16074
16081
  show: true,
16075
16082
  render: (v, all) => {
@@ -16078,10 +16085,27 @@ const getColumns$1 = ({
16078
16085
  className: "daf-default-cell"
16079
16086
  });
16080
16087
  }
16081
- const country = findOptions(v, options?.countries);
16082
- return country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16083
- title: country,
16084
- children: country
16088
+ const region = getLinkValue$2(v, all?.linking?.SCL);
16089
+ return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16090
+ title: region,
16091
+ children: region
16092
+ }) : '-';
16093
+ }
16094
+ }, {
16095
+ dataIndex: 'administrativeLevel2',
16096
+ title: t('District'),
16097
+ ellipsis: true,
16098
+ show: true,
16099
+ render: (v, all) => {
16100
+ if (all.empty) {
16101
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16102
+ className: "daf-default-cell"
16103
+ });
16104
+ }
16105
+ const district = getLinkValue$2(v, all?.linking?.SCL);
16106
+ return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16107
+ title: district,
16108
+ children: district
16085
16109
  }) : '-';
16086
16110
  }
16087
16111
  }, {
@@ -16113,9 +16137,10 @@ const getColumns$1 = ({
16113
16137
  className: "daf-default-cell"
16114
16138
  });
16115
16139
  }
16116
- if (!val || val?.length === 0) {
16117
- return "--";
16118
- }
16140
+ console.log({
16141
+ val,
16142
+ all
16143
+ });
16119
16144
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
16120
16145
  items: val
16121
16146
  });
@@ -16148,17 +16173,154 @@ const getColumns$1 = ({
16148
16173
  }
16149
16174
  }].filter(column => column.show !== false);
16150
16175
 
16151
- const checkboxConfig$1 = {
16176
+ const checkboxConfig$4 = {
16152
16177
  name: 'Name',
16153
16178
  datastakeId: 'ID'
16154
16179
  };
16155
- const getFiltersConfig$1 = ({
16180
+ const getFiltersConfig$4 = ({
16156
16181
  t
16157
16182
  }) => {
16158
16183
  return {
16159
16184
  country: {
16160
16185
  type: 'select',
16161
- placeholder: t('Country'),
16186
+ label: 'Country',
16187
+ placeholder: t => `${t('Filter by')} ${t('Country').toLowerCase()}`,
16188
+ style: {
16189
+ flex: 1
16190
+ },
16191
+ labelStyle: {
16192
+ flex: 1
16193
+ },
16194
+ getLabel: option => option.label,
16195
+ getValue: option => option.value
16196
+ },
16197
+ administrativeLevel1: {
16198
+ type: 'ajaxSelect',
16199
+ label: ({
16200
+ t = s => s,
16201
+ options = {},
16202
+ filters = {},
16203
+ language = 'en'
16204
+ }) => {
16205
+ const {
16206
+ administrativeLevel1
16207
+ } = options;
16208
+ if (administrativeLevel1) {
16209
+ if (options.country) {
16210
+ const _item = administrativeLevel1[filters.country];
16211
+ if (_item) {
16212
+ if (_item[language]) {
16213
+ return _item[language];
16214
+ }
16215
+ }
16216
+ }
16217
+ }
16218
+ return t('Province');
16219
+ },
16220
+ placeholder: t => `${t('Filter by')} ${t('Province').toLowerCase()}`,
16221
+ filters: data => ({
16222
+ country: data.country,
16223
+ level: 'level_1'
16224
+ }),
16225
+ show: data => !data.country,
16226
+ disabled: data => !data.country,
16227
+ mapper: {
16228
+ label: "name",
16229
+ value: "id"
16230
+ },
16231
+ method: 'getOptions',
16232
+ entity: 'AdministrativeLevel',
16233
+ style: {
16234
+ flex: 1
16235
+ },
16236
+ labelStyle: {
16237
+ flex: 1
16238
+ }
16239
+ },
16240
+ administrativeLevel2: {
16241
+ type: 'ajaxSelect',
16242
+ label: ({
16243
+ t = s => s,
16244
+ options = {},
16245
+ filters = {},
16246
+ language = 'en'
16247
+ }) => {
16248
+ const {
16249
+ administrativeLevel2
16250
+ } = options;
16251
+ if (administrativeLevel2) {
16252
+ if (options.country) {
16253
+ const _item = administrativeLevel2[filters.country];
16254
+ if (_item) {
16255
+ if (_item[language]) {
16256
+ return _item[language];
16257
+ }
16258
+ }
16259
+ }
16260
+ }
16261
+ return t('Province');
16262
+ },
16263
+ show: data => !(data.country && data.administrativeLevel1),
16264
+ placeholder: t => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
16265
+ filters: data => ({
16266
+ country: data.country,
16267
+ level: 'level_2',
16268
+ administrativeLevel1: data.administrativeLevel1
16269
+ }),
16270
+ disabled: data => !(data.country && data.administrativeLevel1),
16271
+ mapper: {
16272
+ label: "name",
16273
+ value: "id"
16274
+ },
16275
+ method: 'getOptions',
16276
+ entity: 'AdministrativeLevel',
16277
+ style: {
16278
+ flex: 1
16279
+ },
16280
+ labelStyle: {
16281
+ flex: 1
16282
+ }
16283
+ },
16284
+ subCategory: {
16285
+ type: 'select',
16286
+ label: 'Sub Category',
16287
+ placeholder: t => `${t('Filter by')} ${t('Sub Category').toLowerCase()}`,
16288
+ style: {
16289
+ flex: 1
16290
+ },
16291
+ labelStyle: {
16292
+ flex: 1
16293
+ },
16294
+ getLabel: option => option.label,
16295
+ getValue: option => option.value,
16296
+ filterOptions: val => {
16297
+ if (val) {
16298
+ const {
16299
+ option,
16300
+ filters
16301
+ } = val;
16302
+ if (filters && option) {
16303
+ const {
16304
+ filters: optionFilters
16305
+ } = option;
16306
+ if (Array.isArray(optionFilters) && optionFilters.length) {
16307
+ const {
16308
+ value,
16309
+ condition
16310
+ } = optionFilters[0];
16311
+ if (condition === 'includes') {
16312
+ return value.includes('corporation');
16313
+ }
16314
+ }
16315
+ }
16316
+ }
16317
+ return true;
16318
+ }
16319
+ },
16320
+ positionInTheMineralSupplyChain: {
16321
+ type: 'select',
16322
+ label: 'Position',
16323
+ placeholder: t => `${t('Filter by')} ${t('Position').toLowerCase()}`,
16162
16324
  style: {
16163
16325
  flex: 1
16164
16326
  },
@@ -16167,19 +16329,54 @@ const getFiltersConfig$1 = ({
16167
16329
  },
16168
16330
  getLabel: option => option.label,
16169
16331
  getValue: option => option.value
16332
+ },
16333
+ status: {
16334
+ type: "select",
16335
+ label: "Status",
16336
+ placeholder: t => `${t("Filter by")} ${t("Status").toLowerCase()}`,
16337
+ style: {
16338
+ flex: 1
16339
+ },
16340
+ labelStyle: {
16341
+ fley: 1
16342
+ },
16343
+ getLabel: option => option.label,
16344
+ getValue: option => option.value
16170
16345
  }
16171
16346
  };
16172
16347
  };
16173
- const filtersConfig$1 = {
16348
+ const filtersConfig$4 = {
16174
16349
  name: '',
16175
16350
  datastakeId: ''
16176
16351
  };
16177
- const getFilterOptions$1 = (options, t) => {
16352
+ const getFilterOptions$4 = (options, t) => {
16178
16353
  const {
16179
- countries
16354
+ statusOptions = [],
16355
+ categoryOptions = [],
16356
+ countries = [],
16357
+ subCategory = [],
16358
+ subCategoriesOptions,
16359
+ stakeholderCategoryOptions,
16360
+ stakeholderSubCategoriesOptions,
16361
+ administrativeLevel1,
16362
+ administrativeLevel2
16180
16363
  } = options || {};
16364
+ console.log({
16365
+ options
16366
+ });
16181
16367
  const _default = {
16182
- country: countries
16368
+ category: stakeholderCategoryOptions || categoryOptions,
16369
+ country: countries,
16370
+ administrativeLevel1,
16371
+ administrativeLevel2,
16372
+ subCategory: subCategoriesOptions,
16373
+ status: [{
16374
+ value: "submitted",
16375
+ label: "Submitted"
16376
+ }, {
16377
+ value: "private",
16378
+ label: "Private"
16379
+ }]
16183
16380
  };
16184
16381
  return _default;
16185
16382
  };
@@ -16197,12 +16394,14 @@ const useGetQueryParams = ({
16197
16394
  pageSize,
16198
16395
  search,
16199
16396
  searchParams: rawSearchParams,
16397
+ sortBy,
16398
+ sortDir,
16200
16399
  ...rest
16201
16400
  } = queryParams;
16202
16401
  return {
16203
16402
  paginationQuery: {
16204
- page,
16205
- pageSize
16403
+ skip: page,
16404
+ take: pageSize
16206
16405
  },
16207
16406
  searchParams: {
16208
16407
  qs: search,
@@ -20211,7 +20410,7 @@ function Geolocation({
20211
20410
  }
20212
20411
 
20213
20412
  const noDafApps = ['tif', 'cukura']; //PACKAGE_CHANGE_LATER (remove sbg)
20214
- const packageApps$1 = ["kota", "sbg", "nashiriki", "straatos"]; //PACKAGE_CHANGE_LATER (add sbg)
20413
+ const packageApps$1 = ["kota", "sbg", "nashiriki", "straatos", "wazi", "hatua"]; //PACKAGE_CHANGE_LATER (add sbg)
20215
20414
 
20216
20415
  function useAjaxModal$1({
20217
20416
  name = {},
@@ -24612,7 +24811,7 @@ function convertUndefinedToNull(obj) {
24612
24811
  return obj;
24613
24812
  }
24614
24813
 
24615
- const packageApps = ["kota", "sbg", "nashiriki", "straatos"]; //PACKAGE_CHANGE_LATER (add sbg)
24814
+ const packageApps = ["kota", "sbg", "nashiriki", "straatos", "wazi", "hatua"]; //PACKAGE_CHANGE_LATER (add sbg)
24616
24815
 
24617
24816
  function useAjaxModal({
24618
24817
  name = {},
@@ -29883,9 +30082,9 @@ function DynamicForm({
29883
30082
  });
29884
30083
  }
29885
30084
 
29886
- const StakeholdersCreate$1 = ({
29887
- namespace = 'stakeholders',
29888
- view = 'scoping',
30085
+ const StakeholdersCreate$2 = ({
30086
+ namespace = "OPERATOR",
30087
+ view = ['scoping', 'new'],
29889
30088
  edit = false,
29890
30089
  formData = {},
29891
30090
  loading = false,
@@ -29934,7 +30133,10 @@ const StakeholdersCreate$1 = ({
29934
30133
  className: "daf-create-form",
29935
30134
  children: /*#__PURE__*/jsxRuntime.jsx(DynamicForm, {
29936
30135
  form: form,
29937
- data: data,
30136
+ data: {
30137
+ ...defaultData,
30138
+ ...data
30139
+ },
29938
30140
  showSaveAndNext: false,
29939
30141
  module: APP,
29940
30142
  onCancel: onCancel,
@@ -29960,7 +30162,7 @@ const StakeholdersCreate$1 = ({
29960
30162
  const newPayload = {
29961
30163
  ...defaultData,
29962
30164
  ...payloadData,
29963
- form: 'stakeholder'
30165
+ form: 'operator'
29964
30166
  };
29965
30167
  const callback = (type, m, data) => {
29966
30168
  if (setSelectedFormNext) {
@@ -29983,7 +30185,7 @@ const StakeholdersCreate$1 = ({
29983
30185
  });
29984
30186
  };
29985
30187
 
29986
- const StakeholdersTable = ({
30188
+ const OperatorsTable = ({
29987
30189
  t = () => {},
29988
30190
  goTo = () => {},
29989
30191
  user = {},
@@ -30008,11 +30210,13 @@ const StakeholdersTable = ({
30008
30210
  changeAjaxOptions = () => {},
30009
30211
  formData = {},
30010
30212
  formValue = {},
30011
- form = {}
30213
+ form = {},
30214
+ extendingFilters = {},
30215
+ createDefaultValues = {}
30012
30216
  }) => {
30013
30217
  const [selectOptions, setSelectOptions] = React.useState();
30014
30218
  const [activeTab, setActiveTab] = React.useState();
30015
- const columns = React.useMemo(() => getColumns$1({
30219
+ const columns = React.useMemo(() => getColumns$4({
30016
30220
  t,
30017
30221
  goTo,
30018
30222
  user,
@@ -30020,37 +30224,48 @@ const StakeholdersTable = ({
30020
30224
  activeTab,
30021
30225
  getRedirectLink,
30022
30226
  theme,
30023
- subject: 'stakeholders'
30024
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme]);
30227
+ subject: 'operators',
30228
+ data
30229
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data]);
30025
30230
  const breadCrumbs = [];
30026
30231
  const {
30027
30232
  paginationQuery,
30028
30233
  searchParams,
30029
- otherParams
30234
+ otherParams,
30235
+ sortBy,
30236
+ sortDir
30030
30237
  } = useGetQueryParams({
30031
30238
  location
30032
30239
  });
30240
+ React.useMemo(() => {
30241
+ return {
30242
+ ...otherParams,
30243
+ ...extendingFilters
30244
+ };
30245
+ }, [otherParams, extendingFilters]);
30033
30246
  React.useEffect(() => {
30034
30247
  getData({
30035
30248
  pagination: paginationQuery,
30036
- ...(Object.keys(otherParams).length > 0 && {
30037
- filters: otherParams
30038
- }),
30039
30249
  ...(Object.keys(searchParams).length > 0 && {
30040
30250
  search: searchParams
30041
30251
  }),
30042
- tab: activeTab
30043
- }, 'stakeholders');
30044
- }, [paginationQuery, otherParams, searchParams, activeTab]);
30252
+ ...otherParams,
30253
+ tab: activeTab,
30254
+ sortBy: {
30255
+ [sortBy || "updatedAt"]: sortDir ? sortDir === "ascend" ? 1 : -1 : -1
30256
+ },
30257
+ ...extendingFilters
30258
+ }, 'operators');
30259
+ }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
30045
30260
  const selectFiltersConfig = React.useMemo(() => {
30046
- return getFiltersConfig$1({
30261
+ return getFiltersConfig$4({
30047
30262
  t
30048
30263
  });
30049
30264
  }, [t]);
30050
30265
  React.useEffect(() => {
30051
30266
  setSelectOptions(prev => ({
30052
30267
  ...prev,
30053
- ...getFilterOptions$1(options)
30268
+ ...getFilterOptions$4(options)
30054
30269
  }));
30055
30270
  }, [options, t]);
30056
30271
  const handleActiveTabChange = React.useCallback(value => {
@@ -30058,7 +30273,7 @@ const StakeholdersTable = ({
30058
30273
  }, []);
30059
30274
  return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
30060
30275
  t: t,
30061
- title: t("Stakeholders"),
30276
+ title: t("Operators"),
30062
30277
  breadCrumbs: breadCrumbs,
30063
30278
  location: location,
30064
30279
  loading: loading,
@@ -30066,23 +30281,24 @@ const StakeholdersTable = ({
30066
30281
  defaultActiveTab: "all",
30067
30282
  columns: columns,
30068
30283
  data: data,
30069
- checkboxConfig: checkboxConfig$1,
30284
+ checkboxConfig: checkboxConfig$4,
30070
30285
  APP: APP,
30071
30286
  getApiBaseUrl: getApiBaseUrl,
30072
30287
  selectOptions: selectOptions,
30073
30288
  selectFiltersConfig: selectFiltersConfig,
30074
30289
  getRedirectLink: getRedirectLink,
30075
- filtersConfig: filtersConfig$1,
30290
+ filtersConfig: filtersConfig$4,
30076
30291
  isMobile: isMobile,
30077
- view: "stakeholders",
30292
+ view: "operators",
30078
30293
  getActiveTab: handleActiveTabChange,
30079
30294
  onDownload: () => {
30080
30295
  console.log("download");
30081
30296
  },
30082
- drawerTitle: t("Create Stakeholder"),
30297
+ drawerTitle: t("Create Operator"),
30083
30298
  children: ({
30084
30299
  onDrawerClose
30085
- }) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$1, {
30300
+ }) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$2, {
30301
+ defaultData: createDefaultValues,
30086
30302
  t: t,
30087
30303
  goTo: goTo,
30088
30304
  user: user,
@@ -30095,7 +30311,8 @@ const StakeholdersTable = ({
30095
30311
  onSubmitted: (type, m, data) => {
30096
30312
  if (data.datastakeId) {
30097
30313
  displayMessage(type, t("affirmations::subject-created-successfully") || m);
30098
- goTo(`/app/stakeholders`);
30314
+ // goTo(`/app/edit/stakeholders/${data.datastakeId}`);
30315
+ goTo(`/app/edit/operators/${data.datastakeId}`);
30099
30316
  }
30100
30317
  },
30101
30318
  onCancel: onDrawerClose,
@@ -30111,13 +30328,13 @@ const StakeholdersTable = ({
30111
30328
  });
30112
30329
  };
30113
30330
 
30114
- const getLinkValue = (value, linkingObject) => {
30331
+ const getLinkValue$1 = (value, linkingObject) => {
30115
30332
  if (linkingObject && linkingObject?.[value]) {
30116
30333
  return linkingObject?.[value]?.name;
30117
30334
  }
30118
30335
  return null;
30119
30336
  };
30120
- const getColumns = ({
30337
+ const getColumns$3 = ({
30121
30338
  t,
30122
30339
  goTo,
30123
30340
  user,
@@ -30204,7 +30421,7 @@ const getColumns = ({
30204
30421
  className: "daf-default-cell"
30205
30422
  });
30206
30423
  }
30207
- const region = getLinkValue(v, all?.linking?.SCL);
30424
+ const region = getLinkValue$1(v, all?.linking?.SCL);
30208
30425
  return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30209
30426
  title: region,
30210
30427
  children: region
@@ -30221,7 +30438,7 @@ const getColumns = ({
30221
30438
  className: "daf-default-cell"
30222
30439
  });
30223
30440
  }
30224
- const district = getLinkValue(v, all?.linking?.SCL);
30441
+ const district = getLinkValue$1(v, all?.linking?.SCL);
30225
30442
  return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30226
30443
  title: district,
30227
30444
  children: district
@@ -30292,11 +30509,11 @@ const getColumns = ({
30292
30509
  }
30293
30510
  }].filter(column => column.show !== false);
30294
30511
 
30295
- const checkboxConfig = {
30512
+ const checkboxConfig$3 = {
30296
30513
  name: 'Name',
30297
30514
  datastakeId: 'ID'
30298
30515
  };
30299
- const getFiltersConfig = ({
30516
+ const getFiltersConfig$3 = ({
30300
30517
  t
30301
30518
  }) => {
30302
30519
  return {
@@ -30314,11 +30531,11 @@ const getFiltersConfig = ({
30314
30531
  }
30315
30532
  };
30316
30533
  };
30317
- const filtersConfig = {
30534
+ const filtersConfig$3 = {
30318
30535
  name: '',
30319
30536
  datastakeId: ''
30320
30537
  };
30321
- const getFilterOptions = (options, t) => {
30538
+ const getFilterOptions$3 = (options, t) => {
30322
30539
  const {
30323
30540
  countries
30324
30541
  } = options || {};
@@ -30328,7 +30545,7 @@ const getFilterOptions = (options, t) => {
30328
30545
  return _default;
30329
30546
  };
30330
30547
 
30331
- const StakeholdersCreate = ({
30548
+ const StakeholdersCreate$1 = ({
30332
30549
  namespace = 'locations',
30333
30550
  view = 'scoping',
30334
30551
  edit = false,
@@ -30457,7 +30674,7 @@ const LocationsTable = ({
30457
30674
  }) => {
30458
30675
  const [selectOptions, setSelectOptions] = React.useState();
30459
30676
  const [activeTab, setActiveTab] = React.useState();
30460
- const columns = React.useMemo(() => getColumns({
30677
+ const columns = React.useMemo(() => getColumns$3({
30461
30678
  t,
30462
30679
  goTo,
30463
30680
  user,
@@ -30492,14 +30709,14 @@ const LocationsTable = ({
30492
30709
  data
30493
30710
  });
30494
30711
  const selectFiltersConfig = React.useMemo(() => {
30495
- return getFiltersConfig({
30712
+ return getFiltersConfig$3({
30496
30713
  t
30497
30714
  });
30498
30715
  }, [t]);
30499
30716
  React.useEffect(() => {
30500
30717
  setSelectOptions(prev => ({
30501
30718
  ...prev,
30502
- ...getFilterOptions(options)
30719
+ ...getFilterOptions$3(options)
30503
30720
  }));
30504
30721
  }, [options, t]);
30505
30722
  const handleActiveTabChange = React.useCallback(value => {
@@ -30515,13 +30732,13 @@ const LocationsTable = ({
30515
30732
  defaultActiveTab: "all",
30516
30733
  columns: columns,
30517
30734
  data: data,
30518
- checkboxConfig: checkboxConfig,
30735
+ checkboxConfig: checkboxConfig$3,
30519
30736
  APP: APP,
30520
30737
  getApiBaseUrl: getApiBaseUrl,
30521
30738
  selectOptions: selectOptions,
30522
30739
  selectFiltersConfig: selectFiltersConfig,
30523
30740
  getRedirectLink: getRedirectLink,
30524
- filtersConfig: filtersConfig,
30741
+ filtersConfig: filtersConfig$3,
30525
30742
  isMobile: isMobile,
30526
30743
  view: "locations",
30527
30744
  getActiveTab: handleActiveTabChange,
@@ -30531,7 +30748,1298 @@ const LocationsTable = ({
30531
30748
  drawerTitle: t("Create Location"),
30532
30749
  children: ({
30533
30750
  onDrawerClose
30534
- }) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate, {
30751
+ }) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$1, {
30752
+ t: t,
30753
+ goTo: goTo,
30754
+ user: user,
30755
+ APP: APP,
30756
+ getApiBaseUrl: getApiBaseUrl,
30757
+ getAppHeader: getAppHeader,
30758
+ getData: getFormData,
30759
+ saveData: saveFormData,
30760
+ loading: formLoading,
30761
+ onSubmitted: (type, m, data) => {
30762
+ if (data.datastakeId) {
30763
+ displayMessage(type, t("affirmations::subject-created-successfully") || m);
30764
+ goTo(`/app/edit/locations/${data.datastakeId}`);
30765
+ }
30766
+ },
30767
+ onCancel: onDrawerClose,
30768
+ query: query,
30769
+ ajaxForms: ajaxForms,
30770
+ changeAjaxForms: changeAjaxForms,
30771
+ ajaxOptions: ajaxOptions,
30772
+ changeAjaxOptions: changeAjaxOptions,
30773
+ formData: formData,
30774
+ formValue: formValue,
30775
+ form: form
30776
+ })
30777
+ });
30778
+ };
30779
+
30780
+ const getColumns$2 = ({
30781
+ t,
30782
+ goTo,
30783
+ user,
30784
+ options,
30785
+ activeTab,
30786
+ getRedirectLink,
30787
+ theme,
30788
+ subject
30789
+ }) => [{
30790
+ dataIndex: 'datastakeId',
30791
+ title: t('ID'),
30792
+ ellipsis: true,
30793
+ show: true,
30794
+ render: (v, all) => {
30795
+ if (all.empty) {
30796
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30797
+ className: "daf-default-cell"
30798
+ });
30799
+ }
30800
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30801
+ title: v,
30802
+ children: v
30803
+ });
30804
+ }
30805
+ }, {
30806
+ dataIndex: 'name',
30807
+ title: t('Name'),
30808
+ ellipsis: true,
30809
+ show: true,
30810
+ render: (v, all) => {
30811
+ if (all.empty) {
30812
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30813
+ className: "daf-default-cell"
30814
+ });
30815
+ }
30816
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30817
+ title: v,
30818
+ children: v
30819
+ });
30820
+ }
30821
+ }, {
30822
+ dataIndex: 'category',
30823
+ title: t('Category'),
30824
+ ellipsis: true,
30825
+ show: true,
30826
+ render: (v, all) => {
30827
+ if (all.empty) {
30828
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30829
+ className: "daf-default-cell"
30830
+ });
30831
+ }
30832
+ const category = findOptions(v, options?.categoriesOptions);
30833
+ return category ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30834
+ title: category,
30835
+ children: category
30836
+ }) : '-';
30837
+ }
30838
+ }, {
30839
+ dataIndex: 'subCategory',
30840
+ title: t('Sub Category'),
30841
+ ellipsis: true,
30842
+ show: true,
30843
+ render: (v, all) => {
30844
+ if (all.empty) {
30845
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30846
+ className: "daf-default-cell"
30847
+ });
30848
+ }
30849
+ const subCategory = findOptions(v, options?.subCategoriesOptions);
30850
+ return subCategory ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30851
+ title: subCategory,
30852
+ children: subCategory
30853
+ }) : '-';
30854
+ }
30855
+ }, {
30856
+ dataIndex: 'country',
30857
+ title: t('Country'),
30858
+ ellipsis: true,
30859
+ show: true,
30860
+ render: (v, all) => {
30861
+ if (all.empty) {
30862
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30863
+ className: "daf-default-cell"
30864
+ });
30865
+ }
30866
+ const country = findOptions(v, options?.countries);
30867
+ return country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30868
+ title: country,
30869
+ children: country
30870
+ }) : '-';
30871
+ }
30872
+ }, {
30873
+ title: t("Last Update"),
30874
+ dataIndex: "updatedAt",
30875
+ key: "updatedAt",
30876
+ width: 125,
30877
+ render: (date, all) => {
30878
+ if (all.empty) {
30879
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30880
+ className: "daf-default-cell"
30881
+ });
30882
+ }
30883
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
30884
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30885
+ title: _date,
30886
+ children: _date
30887
+ });
30888
+ },
30889
+ ellipsis: true
30890
+ }, {
30891
+ title: t("Sources"),
30892
+ dataIndex: "sources",
30893
+ key: "sources",
30894
+ show: activeTab !== "own",
30895
+ render: (val, all) => {
30896
+ if (all.empty) {
30897
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30898
+ className: "daf-default-cell"
30899
+ });
30900
+ }
30901
+ if (!val || val?.length === 0) {
30902
+ return "--";
30903
+ }
30904
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
30905
+ items: val
30906
+ });
30907
+ }
30908
+ }, {
30909
+ id: 'actions',
30910
+ title: "",
30911
+ width: 60,
30912
+ render: (_, all) => {
30913
+ if (all.empty) {
30914
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30915
+ className: "daf-default-cell"
30916
+ });
30917
+ }
30918
+ const link = `/app/view/${subject}/${all.datastakeId}`;
30919
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30920
+ style: {
30921
+ display: "flex",
30922
+ justifyContent: "center"
30923
+ },
30924
+ children: /*#__PURE__*/jsxRuntime.jsx("a", {
30925
+ href: getRedirectLink(link),
30926
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
30927
+ name: "Link",
30928
+ size: 15,
30929
+ color: theme.baseGray70
30930
+ })
30931
+ })
30932
+ });
30933
+ }
30934
+ }].filter(column => column.show !== false);
30935
+
30936
+ const checkboxConfig$2 = {
30937
+ name: 'Name',
30938
+ datastakeId: 'ID'
30939
+ };
30940
+ const getFiltersConfig$2 = ({
30941
+ t
30942
+ }) => {
30943
+ return {
30944
+ country: {
30945
+ type: 'select',
30946
+ placeholder: t('Country'),
30947
+ style: {
30948
+ flex: 1
30949
+ },
30950
+ labelStyle: {
30951
+ flex: 1
30952
+ },
30953
+ getLabel: option => option.label,
30954
+ getValue: option => option.value
30955
+ }
30956
+ };
30957
+ };
30958
+ const filtersConfig$2 = {
30959
+ name: '',
30960
+ datastakeId: ''
30961
+ };
30962
+ const getFilterOptions$2 = (options, t) => {
30963
+ const {
30964
+ countries
30965
+ } = options || {};
30966
+ const _default = {
30967
+ country: countries
30968
+ };
30969
+ return _default;
30970
+ };
30971
+
30972
+ const StakeholdersCreate = ({
30973
+ namespace = 'stakeholders',
30974
+ view = 'scoping',
30975
+ edit = false,
30976
+ formData = {},
30977
+ loading = false,
30978
+ onSubmitted = () => {},
30979
+ onCancel = () => {},
30980
+ getData = () => {},
30981
+ saveData = () => {},
30982
+ form: formConfig = {},
30983
+ formValue = {},
30984
+ defaultData = {},
30985
+ user = {},
30986
+ APP,
30987
+ query,
30988
+ goTo = () => {},
30989
+ t = () => {},
30990
+ ajaxForms = {},
30991
+ changeAjaxForms = () => {},
30992
+ ajaxOptions = {},
30993
+ changeAjaxOptions = () => {},
30994
+ getAppHeader = () => {},
30995
+ getApiBaseUrl = () => {}
30996
+ }) => {
30997
+ let {
30998
+ form = {},
30999
+ data = defaultData || {}
31000
+ } = !edit ? formData[`${APP}-${view}`] || {} : {
31001
+ form: formConfig,
31002
+ data: formValue
31003
+ };
31004
+ React.useEffect(() => {
31005
+ if (Object.keys(form).length === 0 && !formData[`${APP}-${view}`]) {
31006
+ if (!edit) {
31007
+ getData({
31008
+ namespace,
31009
+ module: APP,
31010
+ view,
31011
+ scope: 'global'
31012
+ });
31013
+ } else {
31014
+ form = formConfig;
31015
+ data = formValue;
31016
+ }
31017
+ }
31018
+ }, [edit, user?.language]);
31019
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31020
+ className: "daf-create-form",
31021
+ children: /*#__PURE__*/jsxRuntime.jsx(DynamicForm, {
31022
+ form: form,
31023
+ data: data,
31024
+ showSaveAndNext: false,
31025
+ module: APP,
31026
+ onCancel: onCancel,
31027
+ isCreate: true,
31028
+ t: t,
31029
+ excludedKeys: ["title"],
31030
+ user: user,
31031
+ ajaxForms: ajaxForms,
31032
+ ajaxOptions: ajaxOptions,
31033
+ getAppHeader: getAppHeader,
31034
+ getApiBaseUrl: getApiBaseUrl,
31035
+ changeAjaxOptions: changeAjaxOptions,
31036
+ app: APP,
31037
+ query: query,
31038
+ goTo: goTo,
31039
+ changeAjaxForms: changeAjaxForms,
31040
+ submit: (payload, setSelectedFormNext) => {
31041
+ const payloadData = {
31042
+ ...payload,
31043
+ module: APP,
31044
+ namespace
31045
+ };
31046
+ const newPayload = {
31047
+ ...defaultData,
31048
+ ...payloadData,
31049
+ form: 'stakeholder'
31050
+ };
31051
+ const callback = (type, m, data) => {
31052
+ if (setSelectedFormNext) {
31053
+ setSelectedFormNext();
31054
+ }
31055
+ if (type === MessageTypes.SUCCESS) {
31056
+ if (onSubmitted) onSubmitted(type, m, data);
31057
+ } else {
31058
+ antd.message.error(m);
31059
+ }
31060
+ };
31061
+ saveData(!data && !data.id ? newPayload : Object.assign(newPayload, {
31062
+ id: data.id
31063
+ }), callback);
31064
+ },
31065
+ isFormDisabled: () => {
31066
+ return !data || !data.typeOfEvent;
31067
+ }
31068
+ })
31069
+ });
31070
+ };
31071
+
31072
+ const StakeholdersTable = ({
31073
+ t = () => {},
31074
+ goTo = () => {},
31075
+ user = {},
31076
+ options = {},
31077
+ getRedirectLink = () => {},
31078
+ theme = {},
31079
+ loading = false,
31080
+ data = {},
31081
+ isMobile,
31082
+ APP,
31083
+ location,
31084
+ getData = () => {},
31085
+ getApiBaseUrl = () => {},
31086
+ getAppHeader = () => {},
31087
+ getFormData = () => {},
31088
+ saveFormData = () => {},
31089
+ formLoading = false,
31090
+ query = {},
31091
+ ajaxForms = {},
31092
+ changeAjaxForms = () => {},
31093
+ ajaxOptions = {},
31094
+ changeAjaxOptions = () => {},
31095
+ formData = {},
31096
+ formValue = {},
31097
+ form = {}
31098
+ }) => {
31099
+ const [selectOptions, setSelectOptions] = React.useState();
31100
+ const [activeTab, setActiveTab] = React.useState();
31101
+ const columns = React.useMemo(() => getColumns$2({
31102
+ t,
31103
+ goTo,
31104
+ user,
31105
+ options,
31106
+ activeTab,
31107
+ getRedirectLink,
31108
+ theme,
31109
+ subject: 'stakeholders'
31110
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme]);
31111
+ const breadCrumbs = [];
31112
+ const {
31113
+ paginationQuery,
31114
+ searchParams,
31115
+ otherParams
31116
+ } = useGetQueryParams({
31117
+ location
31118
+ });
31119
+ React.useEffect(() => {
31120
+ getData({
31121
+ pagination: paginationQuery,
31122
+ ...(Object.keys(otherParams).length > 0 && {
31123
+ filters: otherParams
31124
+ }),
31125
+ ...(Object.keys(searchParams).length > 0 && {
31126
+ search: searchParams
31127
+ }),
31128
+ tab: activeTab
31129
+ }, 'stakeholders');
31130
+ }, [paginationQuery, otherParams, searchParams, activeTab]);
31131
+ const selectFiltersConfig = React.useMemo(() => {
31132
+ return getFiltersConfig$2({
31133
+ t
31134
+ });
31135
+ }, [t]);
31136
+ React.useEffect(() => {
31137
+ setSelectOptions(prev => ({
31138
+ ...prev,
31139
+ ...getFilterOptions$2(options)
31140
+ }));
31141
+ }, [options, t]);
31142
+ const handleActiveTabChange = React.useCallback(value => {
31143
+ setActiveTab(value);
31144
+ }, []);
31145
+ return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
31146
+ t: t,
31147
+ title: t("Stakeholders"),
31148
+ breadCrumbs: breadCrumbs,
31149
+ location: location,
31150
+ loading: loading,
31151
+ goTo: goTo,
31152
+ defaultActiveTab: "all",
31153
+ columns: columns,
31154
+ data: data,
31155
+ checkboxConfig: checkboxConfig$2,
31156
+ APP: APP,
31157
+ getApiBaseUrl: getApiBaseUrl,
31158
+ selectOptions: selectOptions,
31159
+ selectFiltersConfig: selectFiltersConfig,
31160
+ getRedirectLink: getRedirectLink,
31161
+ filtersConfig: filtersConfig$2,
31162
+ isMobile: isMobile,
31163
+ view: "stakeholders",
31164
+ getActiveTab: handleActiveTabChange,
31165
+ onDownload: () => {
31166
+ console.log("download");
31167
+ },
31168
+ drawerTitle: t("Create Stakeholder"),
31169
+ children: ({
31170
+ onDrawerClose
31171
+ }) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate, {
31172
+ t: t,
31173
+ goTo: goTo,
31174
+ user: user,
31175
+ APP: APP,
31176
+ getApiBaseUrl: getApiBaseUrl,
31177
+ getAppHeader: getAppHeader,
31178
+ getData: getFormData,
31179
+ saveData: saveFormData,
31180
+ loading: formLoading,
31181
+ onSubmitted: (type, m, data) => {
31182
+ if (data.datastakeId) {
31183
+ displayMessage(type, t("affirmations::subject-created-successfully") || m);
31184
+ goTo(`/app/stakeholders`);
31185
+ }
31186
+ },
31187
+ onCancel: onDrawerClose,
31188
+ query: query,
31189
+ ajaxForms: ajaxForms,
31190
+ changeAjaxForms: changeAjaxForms,
31191
+ ajaxOptions: ajaxOptions,
31192
+ changeAjaxOptions: changeAjaxOptions,
31193
+ formData: formData,
31194
+ formValue: formValue,
31195
+ form: form
31196
+ })
31197
+ });
31198
+ };
31199
+
31200
+ const getLinkValue = (value, linkingObject) => {
31201
+ if (linkingObject && linkingObject?.[value]) {
31202
+ return linkingObject?.[value]?.name;
31203
+ }
31204
+ return null;
31205
+ };
31206
+ const getColumns$1 = ({
31207
+ t,
31208
+ goTo,
31209
+ user,
31210
+ options,
31211
+ activeTab,
31212
+ getRedirectLink,
31213
+ theme,
31214
+ subject,
31215
+ data
31216
+ }) => [{
31217
+ dataIndex: 'datastakeId',
31218
+ title: t('ID'),
31219
+ ellipsis: true,
31220
+ show: true,
31221
+ render: (v, all) => {
31222
+ if (all.empty) {
31223
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31224
+ className: "daf-default-cell"
31225
+ });
31226
+ }
31227
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31228
+ title: v,
31229
+ children: v
31230
+ });
31231
+ }
31232
+ }, {
31233
+ dataIndex: 'name',
31234
+ title: t('Name'),
31235
+ ellipsis: true,
31236
+ show: true,
31237
+ render: (v, all) => {
31238
+ if (all.empty) {
31239
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31240
+ className: "daf-default-cell"
31241
+ });
31242
+ }
31243
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31244
+ title: v,
31245
+ children: v
31246
+ });
31247
+ }
31248
+ }, {
31249
+ dataIndex: 'type',
31250
+ title: t('Type'),
31251
+ ellipsis: true,
31252
+ show: true,
31253
+ render: (v, all) => {
31254
+ if (all.empty) {
31255
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31256
+ className: "daf-default-cell"
31257
+ });
31258
+ }
31259
+ const type = findOptions(v, data?.options?.locationCategories);
31260
+ return type ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31261
+ title: type,
31262
+ children: type
31263
+ }) : '-';
31264
+ }
31265
+ }, {
31266
+ dataIndex: 'keyStakeholder',
31267
+ title: t('Key Stakeholder'),
31268
+ ellipsis: true,
31269
+ show: true,
31270
+ render: (v, all) => {
31271
+ if (all.empty) {
31272
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31273
+ className: "daf-default-cell"
31274
+ });
31275
+ }
31276
+ const country = findOptions(v, options?.countries);
31277
+ return country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31278
+ title: country,
31279
+ children: country
31280
+ }) : '-';
31281
+ }
31282
+ }, {
31283
+ dataIndex: 'scope',
31284
+ title: t('Scope'),
31285
+ ellipsis: true,
31286
+ show: true,
31287
+ render: (v, all) => {
31288
+ if (all.empty) {
31289
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31290
+ className: "daf-default-cell"
31291
+ });
31292
+ }
31293
+ const scope = getLinkValue(v, all?.linking?.SCL);
31294
+ return scope ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31295
+ title: scope,
31296
+ children: scope
31297
+ }) : '-';
31298
+ }
31299
+ }, {
31300
+ title: t("Start Date"),
31301
+ dataIndex: "startDate",
31302
+ key: "startDate",
31303
+ width: 125,
31304
+ render: (date, all) => {
31305
+ if (all.empty) {
31306
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31307
+ className: "daf-default-cell"
31308
+ });
31309
+ }
31310
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
31311
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31312
+ title: _date,
31313
+ children: _date
31314
+ });
31315
+ },
31316
+ ellipsis: true
31317
+ }, {
31318
+ title: t("End Date"),
31319
+ dataIndex: "endDate",
31320
+ key: "endDate",
31321
+ width: 125,
31322
+ render: (date, all) => {
31323
+ if (all.empty) {
31324
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31325
+ className: "daf-default-cell"
31326
+ });
31327
+ }
31328
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
31329
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31330
+ title: _date,
31331
+ children: _date
31332
+ });
31333
+ },
31334
+ ellipsis: true
31335
+ }, {
31336
+ title: t("Sources"),
31337
+ dataIndex: "sources",
31338
+ key: "sources",
31339
+ show: activeTab !== "own",
31340
+ render: (val, all) => {
31341
+ if (all.empty) {
31342
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31343
+ className: "daf-default-cell"
31344
+ });
31345
+ }
31346
+ console.log({
31347
+ val,
31348
+ all
31349
+ });
31350
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
31351
+ items: val
31352
+ });
31353
+ }
31354
+ }, {
31355
+ id: 'actions',
31356
+ title: "",
31357
+ width: 60,
31358
+ render: (_, all) => {
31359
+ if (all.empty) {
31360
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31361
+ className: "daf-default-cell"
31362
+ });
31363
+ }
31364
+ const link = `/app/view/${subject}/${all.datastakeId}`;
31365
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31366
+ style: {
31367
+ display: "flex",
31368
+ justifyContent: "center"
31369
+ },
31370
+ children: /*#__PURE__*/jsxRuntime.jsx("a", {
31371
+ href: getRedirectLink(link),
31372
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
31373
+ name: "Link",
31374
+ size: 15,
31375
+ color: theme.baseGray70
31376
+ })
31377
+ })
31378
+ });
31379
+ }
31380
+ }].filter(column => column.show !== false);
31381
+
31382
+ const checkboxConfig$1 = {
31383
+ name: 'Name',
31384
+ datastakeId: 'ID'
31385
+ };
31386
+ const getFiltersConfig$1 = ({
31387
+ t
31388
+ }) => {
31389
+ return {
31390
+ country: {
31391
+ type: 'select',
31392
+ placeholder: t('Country'),
31393
+ style: {
31394
+ flex: 1
31395
+ },
31396
+ labelStyle: {
31397
+ flex: 1
31398
+ },
31399
+ getLabel: option => option.label,
31400
+ getValue: option => option.value
31401
+ }
31402
+ };
31403
+ };
31404
+ const filtersConfig$1 = {
31405
+ name: '',
31406
+ datastakeId: ''
31407
+ };
31408
+ const getFilterOptions$1 = (options, t) => {
31409
+ const {
31410
+ countries
31411
+ } = options || {};
31412
+ const _default = {
31413
+ country: countries
31414
+ };
31415
+ return _default;
31416
+ };
31417
+
31418
+ const EventsCreate = ({
31419
+ namespace = 'events',
31420
+ view = 'scoping',
31421
+ edit = false,
31422
+ formData = {},
31423
+ loading = false,
31424
+ onSubmitted = () => {},
31425
+ onCancel = () => {},
31426
+ getData = () => {},
31427
+ saveData = () => {},
31428
+ form: formConfig = {},
31429
+ formValue = {},
31430
+ defaultData = {},
31431
+ user = {},
31432
+ APP,
31433
+ query,
31434
+ goTo = () => {},
31435
+ t = () => {},
31436
+ ajaxForms = {},
31437
+ changeAjaxForms = () => {},
31438
+ ajaxOptions = {},
31439
+ changeAjaxOptions = () => {},
31440
+ getAppHeader = () => {},
31441
+ getApiBaseUrl = () => {}
31442
+ }) => {
31443
+ let {
31444
+ form = {},
31445
+ data = defaultData || {}
31446
+ } = !edit ? formData[`${APP}-${view}`] || {} : {
31447
+ form: formConfig,
31448
+ data: formValue
31449
+ };
31450
+ React.useEffect(() => {
31451
+ if (Object.keys(form).length === 0 && !formData[`${APP}-${view}`]) {
31452
+ if (!edit) {
31453
+ getData({
31454
+ namespace,
31455
+ module: APP,
31456
+ view,
31457
+ scope: 'global'
31458
+ });
31459
+ } else {
31460
+ form = formConfig;
31461
+ data = formValue;
31462
+ }
31463
+ }
31464
+ }, [edit, user?.language]);
31465
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31466
+ className: "daf-create-form",
31467
+ children: /*#__PURE__*/jsxRuntime.jsx(DynamicForm, {
31468
+ form: form,
31469
+ data: data,
31470
+ showSaveAndNext: false,
31471
+ module: APP,
31472
+ onCancel: onCancel,
31473
+ isCreate: true,
31474
+ t: t,
31475
+ excludedKeys: ["title"],
31476
+ user: user,
31477
+ ajaxForms: ajaxForms,
31478
+ ajaxOptions: ajaxOptions,
31479
+ getAppHeader: getAppHeader,
31480
+ getApiBaseUrl: getApiBaseUrl,
31481
+ changeAjaxOptions: changeAjaxOptions,
31482
+ app: APP,
31483
+ query: query,
31484
+ goTo: goTo,
31485
+ changeAjaxForms: changeAjaxForms,
31486
+ submit: (payload, setSelectedFormNext) => {
31487
+ const payloadData = {
31488
+ ...payload,
31489
+ module: APP,
31490
+ namespace
31491
+ };
31492
+ const newPayload = {
31493
+ ...defaultData,
31494
+ ...payloadData,
31495
+ form: 'location'
31496
+ };
31497
+ const callback = (type, m, data) => {
31498
+ if (setSelectedFormNext) {
31499
+ setSelectedFormNext();
31500
+ }
31501
+ if (type === MessageTypes.SUCCESS) {
31502
+ if (onSubmitted) onSubmitted(type, m, data);
31503
+ } else {
31504
+ antd.message.error(m);
31505
+ }
31506
+ };
31507
+ saveData(!data && !data.id ? newPayload : Object.assign(newPayload, {
31508
+ id: data.id
31509
+ }), callback);
31510
+ },
31511
+ isFormDisabled: () => {
31512
+ return !data || !data.typeOfEvent;
31513
+ }
31514
+ })
31515
+ });
31516
+ };
31517
+
31518
+ const EventsTable = ({
31519
+ t = () => {},
31520
+ goTo = () => {},
31521
+ user = {},
31522
+ options = {},
31523
+ getRedirectLink = () => {},
31524
+ theme = {},
31525
+ loading = false,
31526
+ data = {},
31527
+ isMobile,
31528
+ APP,
31529
+ location,
31530
+ getData = () => {},
31531
+ getApiBaseUrl = () => {},
31532
+ getAppHeader = () => {},
31533
+ getFormData = () => {},
31534
+ saveFormData = () => {},
31535
+ formLoading = false,
31536
+ query = {},
31537
+ ajaxForms = {},
31538
+ changeAjaxForms = () => {},
31539
+ ajaxOptions = {},
31540
+ changeAjaxOptions = () => {},
31541
+ formData = {},
31542
+ formValue = {},
31543
+ form = {},
31544
+ extendingFilters = {}
31545
+ }) => {
31546
+ const [selectOptions, setSelectOptions] = React.useState();
31547
+ const [activeTab, setActiveTab] = React.useState();
31548
+ const columns = React.useMemo(() => getColumns$1({
31549
+ t,
31550
+ goTo,
31551
+ user,
31552
+ options,
31553
+ activeTab,
31554
+ getRedirectLink,
31555
+ theme,
31556
+ subject: 'events',
31557
+ data
31558
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data]);
31559
+ const breadCrumbs = [];
31560
+ const {
31561
+ paginationQuery,
31562
+ searchParams,
31563
+ otherParams,
31564
+ sortBy,
31565
+ sortDir
31566
+ } = useGetQueryParams({
31567
+ location
31568
+ });
31569
+ const filters = React.useMemo(() => {
31570
+ return {
31571
+ ...otherParams,
31572
+ ...extendingFilters
31573
+ };
31574
+ }, [otherParams, extendingFilters]);
31575
+ React.useEffect(() => {
31576
+ console.log("fetching data");
31577
+ getData({
31578
+ pagination: paginationQuery,
31579
+ ...(Object.keys(filters).length > 0 && {
31580
+ filters: filters
31581
+ }),
31582
+ ...(Object.keys(searchParams).length > 0 && {
31583
+ search: searchParams
31584
+ }),
31585
+ tab: activeTab,
31586
+ sortBy: {
31587
+ [sortBy || "updatedAt"]: sortDir ? sortDir === "ascend" ? 1 : -1 : -1
31588
+ }
31589
+ }, 'events');
31590
+ console.log("data fetched");
31591
+ }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
31592
+ console.log({
31593
+ data
31594
+ });
31595
+ const selectFiltersConfig = React.useMemo(() => {
31596
+ return getFiltersConfig$1({
31597
+ t
31598
+ });
31599
+ }, [t]);
31600
+ React.useEffect(() => {
31601
+ setSelectOptions(prev => ({
31602
+ ...prev,
31603
+ ...getFilterOptions$1(options)
31604
+ }));
31605
+ }, [options, t]);
31606
+ const handleActiveTabChange = React.useCallback(value => {
31607
+ setActiveTab(value);
31608
+ }, []);
31609
+ return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
31610
+ t: t,
31611
+ title: t("events"),
31612
+ breadCrumbs: breadCrumbs,
31613
+ location: location,
31614
+ loading: loading,
31615
+ goTo: goTo,
31616
+ defaultActiveTab: "all",
31617
+ columns: columns,
31618
+ data: data,
31619
+ checkboxConfig: checkboxConfig$1,
31620
+ APP: APP,
31621
+ getApiBaseUrl: getApiBaseUrl,
31622
+ selectOptions: selectOptions,
31623
+ selectFiltersConfig: selectFiltersConfig,
31624
+ getRedirectLink: getRedirectLink,
31625
+ filtersConfig: filtersConfig$1,
31626
+ isMobile: isMobile,
31627
+ view: "events",
31628
+ getActiveTab: handleActiveTabChange,
31629
+ onDownload: () => {
31630
+ console.log("download");
31631
+ },
31632
+ drawerTitle: t("Create Events"),
31633
+ children: ({
31634
+ onDrawerClose
31635
+ }) => /*#__PURE__*/jsxRuntime.jsx(EventsCreate, {
31636
+ t: t,
31637
+ goTo: goTo,
31638
+ user: user,
31639
+ APP: APP,
31640
+ getApiBaseUrl: getApiBaseUrl,
31641
+ getAppHeader: getAppHeader,
31642
+ getData: getFormData,
31643
+ saveData: saveFormData,
31644
+ loading: formLoading,
31645
+ onSubmitted: (type, m, data) => {
31646
+ if (data.datastakeId) {
31647
+ displayMessage(type, t("affirmations::subject-created-successfully") || m);
31648
+ // goTo(`/app/edit/stakeholders/${data.datastakeId}`);
31649
+ goTo(`/app/edit/events/${data.datastakeId}`);
31650
+ }
31651
+ },
31652
+ onCancel: onDrawerClose,
31653
+ query: query,
31654
+ ajaxForms: ajaxForms,
31655
+ changeAjaxForms: changeAjaxForms,
31656
+ ajaxOptions: ajaxOptions,
31657
+ changeAjaxOptions: changeAjaxOptions,
31658
+ formData: formData,
31659
+ formValue: formValue,
31660
+ form: form
31661
+ })
31662
+ });
31663
+ };
31664
+
31665
+ const getColumns = ({
31666
+ t,
31667
+ goTo,
31668
+ user,
31669
+ options,
31670
+ activeTab,
31671
+ getRedirectLink,
31672
+ theme,
31673
+ subject,
31674
+ data
31675
+ }) => [{
31676
+ dataIndex: 'datastakeId',
31677
+ title: t('ID'),
31678
+ ellipsis: true,
31679
+ show: true,
31680
+ render: (v, all) => {
31681
+ if (all.empty) {
31682
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31683
+ className: "daf-default-cell"
31684
+ });
31685
+ }
31686
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31687
+ title: v,
31688
+ children: v
31689
+ });
31690
+ }
31691
+ }, {
31692
+ dataIndex: 'title',
31693
+ title: t('Title'),
31694
+ ellipsis: true,
31695
+ show: true,
31696
+ render: (v, all) => {
31697
+ if (all.empty) {
31698
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31699
+ className: "daf-default-cell"
31700
+ });
31701
+ }
31702
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31703
+ title: v,
31704
+ children: v
31705
+ });
31706
+ }
31707
+ }, {
31708
+ dataIndex: 'type',
31709
+ title: t('Type'),
31710
+ ellipsis: true,
31711
+ show: true,
31712
+ render: (v, all) => {
31713
+ if (all.empty) {
31714
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31715
+ className: "daf-default-cell"
31716
+ });
31717
+ }
31718
+ const type = findOptions(v, data?.options?.locationCategories);
31719
+ return type ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31720
+ title: type,
31721
+ children: type
31722
+ }) : '-';
31723
+ }
31724
+ }, {
31725
+ title: t("Last Update"),
31726
+ dataIndex: "updatedAt",
31727
+ key: "updatedAt",
31728
+ width: 125,
31729
+ render: (date, all) => {
31730
+ if (all.empty) {
31731
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31732
+ className: "daf-default-cell"
31733
+ });
31734
+ }
31735
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
31736
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31737
+ title: _date,
31738
+ children: _date
31739
+ });
31740
+ },
31741
+ ellipsis: true
31742
+ }, {
31743
+ title: t("Sources"),
31744
+ dataIndex: "sources",
31745
+ key: "sources",
31746
+ show: activeTab !== "own",
31747
+ render: (val, all) => {
31748
+ if (all.empty) {
31749
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31750
+ className: "daf-default-cell"
31751
+ });
31752
+ }
31753
+ console.log({
31754
+ val,
31755
+ all
31756
+ });
31757
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
31758
+ items: val
31759
+ });
31760
+ }
31761
+ }, {
31762
+ id: 'actions',
31763
+ title: "",
31764
+ width: 60,
31765
+ render: (_, all) => {
31766
+ if (all.empty) {
31767
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31768
+ className: "daf-default-cell"
31769
+ });
31770
+ }
31771
+ const link = `/app/view/${subject}/${all.datastakeId}`;
31772
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31773
+ style: {
31774
+ display: "flex",
31775
+ justifyContent: "center"
31776
+ },
31777
+ children: /*#__PURE__*/jsxRuntime.jsx("a", {
31778
+ href: getRedirectLink(link),
31779
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
31780
+ name: "Link",
31781
+ size: 15,
31782
+ color: theme.baseGray70
31783
+ })
31784
+ })
31785
+ });
31786
+ }
31787
+ }].filter(column => column.show !== false);
31788
+
31789
+ const checkboxConfig = {
31790
+ name: 'Name',
31791
+ datastakeId: 'ID'
31792
+ };
31793
+ const getFiltersConfig = ({
31794
+ t
31795
+ }) => {
31796
+ return {
31797
+ country: {
31798
+ type: 'select',
31799
+ placeholder: t('Country'),
31800
+ style: {
31801
+ flex: 1
31802
+ },
31803
+ labelStyle: {
31804
+ flex: 1
31805
+ },
31806
+ getLabel: option => option.label,
31807
+ getValue: option => option.value
31808
+ }
31809
+ };
31810
+ };
31811
+ const filtersConfig = {
31812
+ name: '',
31813
+ datastakeId: ''
31814
+ };
31815
+ const getFilterOptions = (options, t) => {
31816
+ const {
31817
+ countries
31818
+ } = options || {};
31819
+ const _default = {
31820
+ country: countries
31821
+ };
31822
+ return _default;
31823
+ };
31824
+
31825
+ const DocumentsCreate = ({
31826
+ namespace = 'documents',
31827
+ view = 'scoping',
31828
+ edit = false,
31829
+ formData = {},
31830
+ loading = false,
31831
+ onSubmitted = () => {},
31832
+ onCancel = () => {},
31833
+ getData = () => {},
31834
+ saveData = () => {},
31835
+ form: formConfig = {},
31836
+ formValue = {},
31837
+ defaultData = {},
31838
+ user = {},
31839
+ APP,
31840
+ query,
31841
+ goTo = () => {},
31842
+ t = () => {},
31843
+ ajaxForms = {},
31844
+ changeAjaxForms = () => {},
31845
+ ajaxOptions = {},
31846
+ changeAjaxOptions = () => {},
31847
+ getAppHeader = () => {},
31848
+ getApiBaseUrl = () => {}
31849
+ }) => {
31850
+ let {
31851
+ form = {},
31852
+ data = defaultData || {}
31853
+ } = !edit ? formData[`${APP}-${view}`] || {} : {
31854
+ form: formConfig,
31855
+ data: formValue
31856
+ };
31857
+ React.useEffect(() => {
31858
+ if (Object.keys(form).length === 0 && !formData[`${APP}-${view}`]) {
31859
+ if (!edit) {
31860
+ getData({
31861
+ namespace,
31862
+ module: APP,
31863
+ view,
31864
+ scope: 'global'
31865
+ });
31866
+ } else {
31867
+ form = formConfig;
31868
+ data = formValue;
31869
+ }
31870
+ }
31871
+ }, [edit, user?.language]);
31872
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31873
+ className: "daf-create-form",
31874
+ children: /*#__PURE__*/jsxRuntime.jsx(DynamicForm, {
31875
+ form: form,
31876
+ data: data,
31877
+ showSaveAndNext: false,
31878
+ module: APP,
31879
+ onCancel: onCancel,
31880
+ isCreate: true,
31881
+ t: t,
31882
+ excludedKeys: ["title"],
31883
+ user: user,
31884
+ ajaxForms: ajaxForms,
31885
+ ajaxOptions: ajaxOptions,
31886
+ getAppHeader: getAppHeader,
31887
+ getApiBaseUrl: getApiBaseUrl,
31888
+ changeAjaxOptions: changeAjaxOptions,
31889
+ app: APP,
31890
+ query: query,
31891
+ goTo: goTo,
31892
+ changeAjaxForms: changeAjaxForms,
31893
+ submit: (payload, setSelectedFormNext) => {
31894
+ const payloadData = {
31895
+ ...payload,
31896
+ module: APP,
31897
+ namespace
31898
+ };
31899
+ const newPayload = {
31900
+ ...defaultData,
31901
+ ...payloadData,
31902
+ form: 'document'
31903
+ };
31904
+ const callback = (type, m, data) => {
31905
+ if (setSelectedFormNext) {
31906
+ setSelectedFormNext();
31907
+ }
31908
+ if (type === MessageTypes.SUCCESS) {
31909
+ if (onSubmitted) onSubmitted(type, m, data);
31910
+ } else {
31911
+ antd.message.error(m);
31912
+ }
31913
+ };
31914
+ saveData(!data && !data.id ? newPayload : Object.assign(newPayload, {
31915
+ id: data.id
31916
+ }), callback);
31917
+ },
31918
+ isFormDisabled: () => {
31919
+ return !data || !data.typeOfEvent;
31920
+ }
31921
+ })
31922
+ });
31923
+ };
31924
+
31925
+ const DocumentsTable = ({
31926
+ t = () => {},
31927
+ goTo = () => {},
31928
+ user = {},
31929
+ options = {},
31930
+ getRedirectLink = () => {},
31931
+ theme = {},
31932
+ loading = false,
31933
+ data = {},
31934
+ isMobile,
31935
+ APP,
31936
+ location,
31937
+ getData = () => {},
31938
+ getApiBaseUrl = () => {},
31939
+ getAppHeader = () => {},
31940
+ getFormData = () => {},
31941
+ saveFormData = () => {},
31942
+ formLoading = false,
31943
+ query = {},
31944
+ ajaxForms = {},
31945
+ changeAjaxForms = () => {},
31946
+ ajaxOptions = {},
31947
+ changeAjaxOptions = () => {},
31948
+ formData = {},
31949
+ formValue = {},
31950
+ form = {},
31951
+ extendingFilters = {}
31952
+ }) => {
31953
+ const [selectOptions, setSelectOptions] = React.useState();
31954
+ const [activeTab, setActiveTab] = React.useState();
31955
+ const columns = React.useMemo(() => getColumns({
31956
+ t,
31957
+ goTo,
31958
+ user,
31959
+ options,
31960
+ activeTab,
31961
+ getRedirectLink,
31962
+ theme,
31963
+ subject: 'documents',
31964
+ data
31965
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data]);
31966
+ const breadCrumbs = [];
31967
+ const {
31968
+ paginationQuery,
31969
+ searchParams,
31970
+ otherParams,
31971
+ sortBy,
31972
+ sortDir
31973
+ } = useGetQueryParams({
31974
+ location
31975
+ });
31976
+ const filters = React.useMemo(() => {
31977
+ return {
31978
+ ...otherParams,
31979
+ ...extendingFilters
31980
+ };
31981
+ }, [otherParams, extendingFilters]);
31982
+ React.useEffect(() => {
31983
+ console.log("fetching data");
31984
+ getData({
31985
+ pagination: paginationQuery,
31986
+ ...(Object.keys(filters).length > 0 && {
31987
+ filters: filters
31988
+ }),
31989
+ ...(Object.keys(searchParams).length > 0 && {
31990
+ search: searchParams
31991
+ }),
31992
+ tab: activeTab,
31993
+ sortBy: {
31994
+ [sortBy || "updatedAt"]: sortDir ? sortDir === "ascend" ? 1 : -1 : -1
31995
+ }
31996
+ }, 'documents');
31997
+ console.log("data fetched");
31998
+ }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
31999
+ console.log({
32000
+ data
32001
+ });
32002
+ const selectFiltersConfig = React.useMemo(() => {
32003
+ return getFiltersConfig({
32004
+ t
32005
+ });
32006
+ }, [t]);
32007
+ React.useEffect(() => {
32008
+ setSelectOptions(prev => ({
32009
+ ...prev,
32010
+ ...getFilterOptions(options)
32011
+ }));
32012
+ }, [options, t]);
32013
+ const handleActiveTabChange = React.useCallback(value => {
32014
+ setActiveTab(value);
32015
+ }, []);
32016
+ return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
32017
+ t: t,
32018
+ title: t("documents"),
32019
+ breadCrumbs: breadCrumbs,
32020
+ location: location,
32021
+ loading: loading,
32022
+ goTo: goTo,
32023
+ defaultActiveTab: "all",
32024
+ columns: columns,
32025
+ data: data,
32026
+ checkboxConfig: checkboxConfig,
32027
+ APP: APP,
32028
+ getApiBaseUrl: getApiBaseUrl,
32029
+ selectOptions: selectOptions,
32030
+ selectFiltersConfig: selectFiltersConfig,
32031
+ getRedirectLink: getRedirectLink,
32032
+ filtersConfig: filtersConfig,
32033
+ isMobile: isMobile,
32034
+ view: "documents",
32035
+ getActiveTab: handleActiveTabChange,
32036
+ onDownload: () => {
32037
+ console.log("download");
32038
+ },
32039
+ drawerTitle: t("Create Document"),
32040
+ children: ({
32041
+ onDrawerClose
32042
+ }) => /*#__PURE__*/jsxRuntime.jsx(DocumentsCreate, {
30535
32043
  t: t,
30536
32044
  goTo: goTo,
30537
32045
  user: user,
@@ -30545,7 +32053,7 @@ const LocationsTable = ({
30545
32053
  if (data.datastakeId) {
30546
32054
  displayMessage(type, t("affirmations::subject-created-successfully") || m);
30547
32055
  // goTo(`/app/edit/stakeholders/${data.datastakeId}`);
30548
- goTo('/app/locations');
32056
+ goTo(`/app/edit/documents/${data.datastakeId}`);
30549
32057
  }
30550
32058
  },
30551
32059
  onCancel: onDrawerClose,
@@ -30561,7 +32069,10 @@ const LocationsTable = ({
30561
32069
  });
30562
32070
  };
30563
32071
 
32072
+ exports.DocumentsTable = DocumentsTable;
32073
+ exports.EventsTable = EventsTable;
30564
32074
  exports.LocationsTable = LocationsTable;
32075
+ exports.OperatorsTable = OperatorsTable;
30565
32076
  exports.StakeholdersTable = StakeholdersTable;
30566
32077
  exports.SupplyChainDashboard = SupplyChain;
30567
32078
  exports.TablePageWithTabs = TablePageWithTabs;