datastake-daf 0.6.738 → 0.6.740

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.
@@ -7094,7 +7094,7 @@ const getAjaxData = async ({
7094
7094
  apiUrl,
7095
7095
  app
7096
7096
  }) => {
7097
- const noQuerryApps = ["nashiriki", "straatos"];
7097
+ const noQuerryApps = ["nashiriki", "straatos", "wazi", "hatua"];
7098
7098
  const data = await axios__default["default"].post(noQuerryApps.includes(app) ? "/query" : "/query/options", {
7099
7099
  entity,
7100
7100
  method,
@@ -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,
@@ -16041,8 +16041,8 @@ const getColumns$4 = ({
16041
16041
  });
16042
16042
  }
16043
16043
  }, {
16044
- dataIndex: 'category',
16045
- title: t('Category'),
16044
+ dataIndex: 'country',
16045
+ title: t('Country'),
16046
16046
  ellipsis: true,
16047
16047
  show: true,
16048
16048
  render: (v, all) => {
@@ -16051,15 +16051,15 @@ const getColumns$4 = ({
16051
16051
  className: "daf-default-cell"
16052
16052
  });
16053
16053
  }
16054
- const category = findOptions(v, data?.options?.locationCategories);
16055
- return category ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16056
- title: category,
16057
- children: category
16054
+ const country = findOptions(v, options?.countries);
16055
+ return country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16056
+ title: country,
16057
+ children: country
16058
16058
  }) : '-';
16059
16059
  }
16060
16060
  }, {
16061
- dataIndex: 'country',
16062
- title: t('Country'),
16061
+ dataIndex: 'type',
16062
+ title: t('Type'),
16063
16063
  ellipsis: true,
16064
16064
  show: true,
16065
16065
  render: (v, all) => {
@@ -16068,15 +16068,17 @@ const getColumns$4 = ({
16068
16068
  className: "daf-default-cell"
16069
16069
  });
16070
16070
  }
16071
- const country = findOptions(v, options?.countries);
16072
- return country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16073
- title: country,
16074
- children: country
16071
+
16072
+ // const category = findOptions(v, data?.options?.locationCategories);
16073
+
16074
+ return v ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16075
+ title: v,
16076
+ children: v
16075
16077
  }) : '-';
16076
16078
  }
16077
16079
  }, {
16078
- dataIndex: 'administrativeLevel1',
16079
- title: t('Region'),
16080
+ dataIndex: 'registration',
16081
+ title: t('Registration'),
16080
16082
  ellipsis: true,
16081
16083
  show: true,
16082
16084
  render: (v, all) => {
@@ -16092,8 +16094,8 @@ const getColumns$4 = ({
16092
16094
  }) : '-';
16093
16095
  }
16094
16096
  }, {
16095
- dataIndex: 'administrativeLevel2',
16096
- title: t('District'),
16097
+ dataIndex: 'status',
16098
+ title: t('Status'),
16097
16099
  ellipsis: true,
16098
16100
  show: true,
16099
16101
  render: (v, all) => {
@@ -16108,24 +16110,6 @@ const getColumns$4 = ({
16108
16110
  children: district
16109
16111
  }) : '-';
16110
16112
  }
16111
- }, {
16112
- title: t("Last Update"),
16113
- dataIndex: "updatedAt",
16114
- key: "updatedAt",
16115
- width: 125,
16116
- render: (date, all) => {
16117
- if (all.empty) {
16118
- return /*#__PURE__*/jsxRuntime.jsx("div", {
16119
- className: "daf-default-cell"
16120
- });
16121
- }
16122
- const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
16123
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16124
- title: _date,
16125
- children: _date
16126
- });
16127
- },
16128
- ellipsis: true
16129
16113
  }, {
16130
16114
  title: t("Sources"),
16131
16115
  dataIndex: "sources",
@@ -16145,6 +16129,24 @@ const getColumns$4 = ({
16145
16129
  items: val
16146
16130
  });
16147
16131
  }
16132
+ }, {
16133
+ title: t("Last Update"),
16134
+ dataIndex: "updatedAt",
16135
+ key: "updatedAt",
16136
+ width: 125,
16137
+ render: (date, all) => {
16138
+ if (all.empty) {
16139
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16140
+ className: "daf-default-cell"
16141
+ });
16142
+ }
16143
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
16144
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16145
+ title: _date,
16146
+ children: _date
16147
+ });
16148
+ },
16149
+ ellipsis: true
16148
16150
  }, {
16149
16151
  id: 'actions',
16150
16152
  title: "",
@@ -16183,7 +16185,144 @@ const getFiltersConfig$4 = ({
16183
16185
  return {
16184
16186
  country: {
16185
16187
  type: 'select',
16186
- placeholder: t('Country'),
16188
+ label: 'Country',
16189
+ placeholder: t => `${t('Filter by')} ${t('Country').toLowerCase()}`,
16190
+ style: {
16191
+ flex: 1
16192
+ },
16193
+ labelStyle: {
16194
+ flex: 1
16195
+ },
16196
+ getLabel: option => option.label,
16197
+ getValue: option => option.value
16198
+ },
16199
+ administrativeLevel1: {
16200
+ type: 'ajaxSelect',
16201
+ label: ({
16202
+ t = s => s,
16203
+ options = {},
16204
+ filters = {},
16205
+ language = 'en'
16206
+ }) => {
16207
+ const {
16208
+ administrativeLevel1
16209
+ } = options;
16210
+ if (administrativeLevel1) {
16211
+ if (options.country) {
16212
+ const _item = administrativeLevel1[filters.country];
16213
+ if (_item) {
16214
+ if (_item[language]) {
16215
+ return _item[language];
16216
+ }
16217
+ }
16218
+ }
16219
+ }
16220
+ return t('Province');
16221
+ },
16222
+ placeholder: t => `${t('Filter by')} ${t('Province').toLowerCase()}`,
16223
+ filters: data => ({
16224
+ country: data.country,
16225
+ level: 'level_1'
16226
+ }),
16227
+ show: data => !data.country,
16228
+ disabled: data => !data.country,
16229
+ mapper: {
16230
+ label: "name",
16231
+ value: "id"
16232
+ },
16233
+ method: 'getOptions',
16234
+ entity: 'AdministrativeLevel',
16235
+ style: {
16236
+ flex: 1
16237
+ },
16238
+ labelStyle: {
16239
+ flex: 1
16240
+ }
16241
+ },
16242
+ administrativeLevel2: {
16243
+ type: 'ajaxSelect',
16244
+ label: ({
16245
+ t = s => s,
16246
+ options = {},
16247
+ filters = {},
16248
+ language = 'en'
16249
+ }) => {
16250
+ const {
16251
+ administrativeLevel2
16252
+ } = options;
16253
+ if (administrativeLevel2) {
16254
+ if (options.country) {
16255
+ const _item = administrativeLevel2[filters.country];
16256
+ if (_item) {
16257
+ if (_item[language]) {
16258
+ return _item[language];
16259
+ }
16260
+ }
16261
+ }
16262
+ }
16263
+ return t('Province');
16264
+ },
16265
+ show: data => !(data.country && data.administrativeLevel1),
16266
+ placeholder: t => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
16267
+ filters: data => ({
16268
+ country: data.country,
16269
+ level: 'level_2',
16270
+ administrativeLevel1: data.administrativeLevel1
16271
+ }),
16272
+ disabled: data => !(data.country && data.administrativeLevel1),
16273
+ mapper: {
16274
+ label: "name",
16275
+ value: "id"
16276
+ },
16277
+ method: 'getOptions',
16278
+ entity: 'AdministrativeLevel',
16279
+ style: {
16280
+ flex: 1
16281
+ },
16282
+ labelStyle: {
16283
+ flex: 1
16284
+ }
16285
+ },
16286
+ subCategory: {
16287
+ type: 'select',
16288
+ label: 'Sub Category',
16289
+ placeholder: t => `${t('Filter by')} ${t('Sub Category').toLowerCase()}`,
16290
+ style: {
16291
+ flex: 1
16292
+ },
16293
+ labelStyle: {
16294
+ flex: 1
16295
+ },
16296
+ getLabel: option => option.label,
16297
+ getValue: option => option.value,
16298
+ filterOptions: val => {
16299
+ if (val) {
16300
+ const {
16301
+ option,
16302
+ filters
16303
+ } = val;
16304
+ if (filters && option) {
16305
+ const {
16306
+ filters: optionFilters
16307
+ } = option;
16308
+ if (Array.isArray(optionFilters) && optionFilters.length) {
16309
+ const {
16310
+ value,
16311
+ condition
16312
+ } = optionFilters[0];
16313
+ if (condition === 'includes') {
16314
+ return value.includes('corporation');
16315
+ }
16316
+ }
16317
+ }
16318
+ }
16319
+ return true;
16320
+ }
16321
+ },
16322
+ positionInTheMineralSupplyChain: {
16323
+ type: 'select',
16324
+ label: 'Position',
16325
+ placeholder: t => `${t('Filter by')} ${t('Position').toLowerCase()}`,
16187
16326
  style: {
16188
16327
  flex: 1
16189
16328
  },
@@ -16192,6 +16331,19 @@ const getFiltersConfig$4 = ({
16192
16331
  },
16193
16332
  getLabel: option => option.label,
16194
16333
  getValue: option => option.value
16334
+ },
16335
+ status: {
16336
+ type: "select",
16337
+ label: "Status",
16338
+ placeholder: t => `${t("Filter by")} ${t("Status").toLowerCase()}`,
16339
+ style: {
16340
+ flex: 1
16341
+ },
16342
+ labelStyle: {
16343
+ fley: 1
16344
+ },
16345
+ getLabel: option => option.label,
16346
+ getValue: option => option.value
16195
16347
  }
16196
16348
  };
16197
16349
  };
@@ -16201,10 +16353,32 @@ const filtersConfig$4 = {
16201
16353
  };
16202
16354
  const getFilterOptions$4 = (options, t) => {
16203
16355
  const {
16204
- countries
16356
+ statusOptions = [],
16357
+ categoryOptions = [],
16358
+ countries = [],
16359
+ subCategory = [],
16360
+ subCategoriesOptions,
16361
+ stakeholderCategoryOptions,
16362
+ stakeholderSubCategoriesOptions,
16363
+ administrativeLevel1,
16364
+ administrativeLevel2
16205
16365
  } = options || {};
16366
+ console.log({
16367
+ options
16368
+ });
16206
16369
  const _default = {
16207
- country: countries
16370
+ category: stakeholderCategoryOptions || categoryOptions,
16371
+ country: countries,
16372
+ administrativeLevel1,
16373
+ administrativeLevel2,
16374
+ subCategory: subCategoriesOptions,
16375
+ status: [{
16376
+ value: "submitted",
16377
+ label: "Submitted"
16378
+ }, {
16379
+ value: "private",
16380
+ label: "Private"
16381
+ }]
16208
16382
  };
16209
16383
  return _default;
16210
16384
  };
@@ -20238,7 +20412,7 @@ function Geolocation({
20238
20412
  }
20239
20413
 
20240
20414
  const noDafApps = ['tif', 'cukura']; //PACKAGE_CHANGE_LATER (remove sbg)
20241
- const packageApps$1 = ["kota", "sbg", "nashiriki", "straatos"]; //PACKAGE_CHANGE_LATER (add sbg)
20415
+ const packageApps$1 = ["kota", "sbg", "nashiriki", "straatos", "wazi", "hatua"]; //PACKAGE_CHANGE_LATER (add sbg)
20242
20416
 
20243
20417
  function useAjaxModal$1({
20244
20418
  name = {},
@@ -24639,7 +24813,7 @@ function convertUndefinedToNull(obj) {
24639
24813
  return obj;
24640
24814
  }
24641
24815
 
24642
- const packageApps = ["kota", "sbg", "nashiriki", "straatos"]; //PACKAGE_CHANGE_LATER (add sbg)
24816
+ const packageApps = ["kota", "sbg", "nashiriki", "straatos", "wazi", "hatua"]; //PACKAGE_CHANGE_LATER (add sbg)
24643
24817
 
24644
24818
  function useAjaxModal({
24645
24819
  name = {},
@@ -29961,7 +30135,10 @@ const StakeholdersCreate$2 = ({
29961
30135
  className: "daf-create-form",
29962
30136
  children: /*#__PURE__*/jsxRuntime.jsx(DynamicForm, {
29963
30137
  form: form,
29964
- data: data,
30138
+ data: {
30139
+ ...defaultData,
30140
+ ...data
30141
+ },
29965
30142
  showSaveAndNext: false,
29966
30143
  module: APP,
29967
30144
  onCancel: onCancel,
@@ -30036,7 +30213,8 @@ const OperatorsTable = ({
30036
30213
  formData = {},
30037
30214
  formValue = {},
30038
30215
  form = {},
30039
- extendingFilters = {}
30216
+ extendingFilters = {},
30217
+ createDefaultValues = {}
30040
30218
  }) => {
30041
30219
  const [selectOptions, setSelectOptions] = React.useState();
30042
30220
  const [activeTab, setActiveTab] = React.useState();
@@ -30061,32 +30239,26 @@ const OperatorsTable = ({
30061
30239
  } = useGetQueryParams({
30062
30240
  location
30063
30241
  });
30064
- const filters = React.useMemo(() => {
30242
+ React.useMemo(() => {
30065
30243
  return {
30066
30244
  ...otherParams,
30067
30245
  ...extendingFilters
30068
30246
  };
30069
30247
  }, [otherParams, extendingFilters]);
30070
30248
  React.useEffect(() => {
30071
- console.log("fetching data");
30072
30249
  getData({
30073
30250
  pagination: paginationQuery,
30074
- ...(Object.keys(filters).length > 0 && {
30075
- filters: filters
30076
- }),
30077
30251
  ...(Object.keys(searchParams).length > 0 && {
30078
30252
  search: searchParams
30079
30253
  }),
30254
+ ...otherParams,
30080
30255
  tab: activeTab,
30081
30256
  sortBy: {
30082
30257
  [sortBy || "updatedAt"]: sortDir ? sortDir === "ascend" ? 1 : -1 : -1
30083
- }
30258
+ },
30259
+ ...extendingFilters
30084
30260
  }, 'operators');
30085
- console.log("data fetched");
30086
30261
  }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
30087
- console.log({
30088
- data
30089
- });
30090
30262
  const selectFiltersConfig = React.useMemo(() => {
30091
30263
  return getFiltersConfig$4({
30092
30264
  t
@@ -30128,6 +30300,7 @@ const OperatorsTable = ({
30128
30300
  children: ({
30129
30301
  onDrawerClose
30130
30302
  }) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$2, {
30303
+ defaultData: createDefaultValues,
30131
30304
  t: t,
30132
30305
  goTo: goTo,
30133
30306
  user: user,
@@ -1439,14 +1439,6 @@ class LinkedSubjectsService extends BaseService {
1439
1439
  }
1440
1440
  var LinkedSubjects = createLazyService(LinkedSubjectsService);
1441
1441
 
1442
- const namespaceEnums = {
1443
- scl: "location",
1444
- workers: "worker",
1445
- operators: "operator",
1446
- testimonials: "nashirikiEvent",
1447
- armedGroups: "armed-groups",
1448
- conflictAreas: "location"
1449
- };
1450
1442
  class OperatorService extends BaseService {
1451
1443
  get(params) {
1452
1444
  return this.apiGet({
@@ -1457,7 +1449,7 @@ class OperatorService extends BaseService {
1457
1449
  }
1458
1450
  getForm(scope = "create", language = "en") {
1459
1451
  return this.apiGet({
1460
- url: `/forms/${namespaceEnums["operators"]}`,
1452
+ url: `/forms/stakeholder`,
1461
1453
  isApp: true,
1462
1454
  params: {
1463
1455
  scope,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.738",
3
+ "version": "0.6.740",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -5,7 +5,7 @@ import { getToken } from "../../../../../../helpers/Token";
5
5
  import { noDafApps } from "../../../ViewForm/components/DataLink/useAjaxModal";
6
6
  import { sortForm } from "../../../../../../helpers/Forms";
7
7
 
8
- const packageApps = ["kota", "sbg", "nashiriki", "straatos"]; //PACKAGE_CHANGE_LATER (add sbg)
8
+ const packageApps = ["kota", "sbg", "nashiriki", "straatos", "wazi", "hatua"]; //PACKAGE_CHANGE_LATER (add sbg)
9
9
 
10
10
  export default function useAjaxModal({
11
11
  name = {},
@@ -16,7 +16,7 @@ const getAjaxData = async ({
16
16
  apiUrl,
17
17
  app,
18
18
  }) => {
19
- const noQuerryApps = ["nashiriki","straatos"];
19
+ const noQuerryApps = ["nashiriki","straatos", "wazi", "hatua"];
20
20
  const data = await axios.post(
21
21
  noQuerryApps.includes(app) ? "/query" : "/query/options",
22
22
  {
@@ -4,7 +4,7 @@ import { getToken } from "../../../../../helpers/Token";
4
4
  import { noDafApps } from "../../ViewForm/components/DataLink/useAjaxModal";
5
5
  import { sortForm } from "../../../../../helpers/Forms";
6
6
 
7
- const packageApps = ["kota", "sbg", "nashiriki", "straatos"]; //PACKAGE_CHANGE_LATER (add sbg)
7
+ const packageApps = ["kota", "sbg", "nashiriki", "straatos", "wazi", "hatua"]; //PACKAGE_CHANGE_LATER (add sbg)
8
8
 
9
9
  export default function useAjaxModal({
10
10
  name = {},
@@ -3,7 +3,7 @@ import axios from "axios";
3
3
  import { sortForm } from "../../../../../../helpers/Forms";
4
4
 
5
5
  export const noDafApps = ['tif', 'cukura']; //PACKAGE_CHANGE_LATER (remove sbg)
6
- const packageApps = ["kota", "sbg", "nashiriki", "straatos"]; //PACKAGE_CHANGE_LATER (add sbg)
6
+ const packageApps = ["kota", "sbg", "nashiriki", "straatos", "wazi", "hatua"]; //PACKAGE_CHANGE_LATER (add sbg)
7
7
 
8
8
  export default function useAjaxModal({
9
9
  name = {},
@@ -38,10 +38,10 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
38
38
 
39
39
  return <Tooltip title={v}>{v}</Tooltip>;
40
40
  },
41
- },
41
+ },
42
42
  {
43
- dataIndex: 'category',
44
- title: t('Category'),
43
+ dataIndex: 'country',
44
+ title: t('Country'),
45
45
  ellipsis: true,
46
46
  show: true,
47
47
  render: (v, all) => {
@@ -49,14 +49,14 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
49
49
  return <div className="daf-default-cell" />
50
50
  }
51
51
 
52
- const category = findOptions(v, data?.options?.locationCategories);
53
-
54
- return category ? <Tooltip title={category}>{category}</Tooltip> : '-';
52
+ const country = findOptions(v, options?.countries);
53
+
54
+ return country ? <Tooltip title={country}>{country}</Tooltip> : '-';
55
55
  },
56
- },
56
+ },
57
57
  {
58
- dataIndex: 'country',
59
- title: t('Country'),
58
+ dataIndex: 'type',
59
+ title: t('Type'),
60
60
  ellipsis: true,
61
61
  show: true,
62
62
  render: (v, all) => {
@@ -64,14 +64,14 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
64
64
  return <div className="daf-default-cell" />
65
65
  }
66
66
 
67
- const country = findOptions(v, options?.countries);
68
-
69
- return country ? <Tooltip title={country}>{country}</Tooltip> : '-';
67
+ // const category = findOptions(v, data?.options?.locationCategories);
68
+
69
+ return v ? <Tooltip title={v}>{v}</Tooltip> : '-';
70
70
  },
71
- },
71
+ },
72
72
  {
73
- dataIndex: 'administrativeLevel1',
74
- title: t('Region'),
73
+ dataIndex: 'registration',
74
+ title: t('Registration'),
75
75
  ellipsis: true,
76
76
  show: true,
77
77
  render: (v, all) => {
@@ -85,8 +85,8 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
85
85
  },
86
86
  },
87
87
  {
88
- dataIndex: 'administrativeLevel2',
89
- title: t('District'),
88
+ dataIndex: 'status',
89
+ title: t('Status'),
90
90
  ellipsis: true,
91
91
  show: true,
92
92
  render: (v, all) => {
@@ -99,21 +99,6 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
99
99
  return district ? <Tooltip title={district}>{district}</Tooltip> : '-';
100
100
  },
101
101
  },
102
- {
103
- title: t("Last Update"),
104
- dataIndex: "updatedAt",
105
- key: "updatedAt",
106
- width: 125,
107
- render: (date, all) => {
108
- if (all.empty) {
109
- return <div className="daf-default-cell" />;
110
- }
111
-
112
- const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
113
- return <Tooltip title={_date}>{_date}</Tooltip>;
114
- },
115
- ellipsis: true,
116
- },
117
102
  {
118
103
  title: t("Sources"),
119
104
  dataIndex: "sources",
@@ -129,6 +114,21 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
129
114
  return <AvatarGroup items={val}></AvatarGroup>;
130
115
  },
131
116
  },
117
+ {
118
+ title: t("Last Update"),
119
+ dataIndex: "updatedAt",
120
+ key: "updatedAt",
121
+ width: 125,
122
+ render: (date, all) => {
123
+ if (all.empty) {
124
+ return <div className="daf-default-cell" />;
125
+ }
126
+
127
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
128
+ return <Tooltip title={_date}>{_date}</Tooltip>;
129
+ },
130
+ ellipsis: true,
131
+ },
132
132
  {
133
133
  id: 'actions',
134
134
  title: "",