datastake-daf 0.6.733 → 0.6.735

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.
@@ -14,7 +14,7 @@ export const featureIsNotAvailable = (t, isDemo) => {
14
14
  ? "This feature is not available in demo mode."
15
15
  : "This feature is not available to you.",
16
16
  okText: "Ok",
17
- onOk: () => {},
17
+ onOk: () => { },
18
18
  maskClosable: true,
19
19
  });
20
20
  };
@@ -36,7 +36,7 @@ export default function SidenavMenu({
36
36
  isDemo,
37
37
  isDev,
38
38
  t = (s) => s,
39
- checkOnClick = () => {},
39
+ checkOnClick = () => { },
40
40
  project,
41
41
  showSettings = false,
42
42
  // eslint-disable-next-line no-unused-vars
@@ -145,12 +145,12 @@ export default function SidenavMenu({
145
145
  children: [
146
146
  isCollapsed
147
147
  ? {
148
- disabled: true,
149
- icon: <CustomIcon width={15} height={15} name={item.icon} />,
150
- className: "title",
151
- key: `${item.path}`,
152
- label: t(item.name),
153
- }
148
+ disabled: true,
149
+ icon: <CustomIcon width={15} height={15} name={item.icon} />,
150
+ className: "title",
151
+ key: `${item.path}`,
152
+ label: t(item.name),
153
+ }
154
154
  : null,
155
155
  ...item.items
156
156
  .filter((item) => (item.visible ? item.visible(user, project) : false))
@@ -161,11 +161,11 @@ export default function SidenavMenu({
161
161
  className: formatClassname([
162
162
  typeof selectedKeys[0] === "string"
163
163
  ? !!(
164
- selectedKeys[0].includes(subitem.path) ||
165
- (subitem.subPath || []).find((p) =>
166
- matchPath(p, selectedKeys[0])
167
- )
168
- ) && "selected"
164
+ selectedKeys[0].includes(subitem.path) ||
165
+ (subitem.subPath || []).find((p) =>
166
+ matchPath(p, selectedKeys[0])
167
+ )
168
+ ) && "selected"
169
169
  : "",
170
170
  ]),
171
171
  onClick: () => {
@@ -257,162 +257,6 @@ export default function SidenavMenu({
257
257
  item.type === "link"
258
258
  ? isCollapsed
259
259
  ? {
260
- onMouseEnter: (e) => {
261
- if (isCollapsed && !item.isDisabled) {
262
- document.removeEventListener("mousemove", onMouseMove);
263
- setHoverItem(item);
264
- setTopHover(
265
- e.domEvent.currentTarget.getBoundingClientRect().top
266
- );
267
- setHoverOpen(true);
268
- }
269
- },
270
- className: formatClassname([
271
- !!(selectedKeys[0] && item.path
272
- ? matchPath(item.path, selectedKeys[0])
273
- : undefined) && "selected",
274
- ]),
275
- disabled: item.isDisabled,
276
- onMouseLeave: () => {
277
- if (isCollapsed) {
278
- document.addEventListener("mousemove", onMouseMove);
279
- }
280
- },
281
- key: item.name,
282
- onTitleClick: () => {
283
- checkOnClick({
284
- event: () => {
285
- if (
286
- isModuleApproved(user, module) ||
287
- isSuperAdmin(user)
288
- ) {
289
- if (
290
- (isDemo && !item.demo) ||
291
- (item.isDisabled && item.isDisabled(user) && !isDev)
292
- ) {
293
- featureIsNotAvailable(t, isDemo);
294
- return;
295
- }
296
- if (item.path) {
297
- goTo(item.path);
298
- }
299
-
300
- if (typeof item.onClick === "function") {
301
- item.onClick();
302
- }
303
- } else {
304
- notApprovedModal(item.path);
305
- }
306
- },
307
- });
308
- },
309
- label: t(item.name),
310
- icon: <CustomIcon width={15} height={15} name={item.icon} />,
311
- children: [
312
- {
313
- key: item.path || item.name,
314
- style: item.style ? item.style : {},
315
- icon: (
316
- <CustomIcon width={15} height={15} name={item.icon} />
317
- ),
318
- disabled: item.isDisabled,
319
- onClick: () => {
320
- checkOnClick({
321
- event: () => {
322
- if (
323
- isModuleApproved(user, module) ||
324
- isSuperAdmin(user)
325
- ) {
326
- if (
327
- (isDemo && !item.demo) ||
328
- (item.isDisabled &&
329
- item.isDisabled(user) &&
330
- !isDev)
331
- ) {
332
- featureIsNotAvailable(t, isDemo);
333
- return;
334
- }
335
- if (item.path) {
336
- goTo(item.path);
337
- }
338
-
339
- if (typeof item.onClick === "function") {
340
- item.onClick();
341
- }
342
- } else {
343
- notApprovedModal(item.path);
344
- }
345
- },
346
- });
347
- },
348
- label: t(item.name),
349
- },
350
- ],
351
- }
352
- : {
353
- key: item.path,
354
- style: item.style ? item.style : {},
355
- icon: <CustomIcon width={15} height={15} name={item.icon} />,
356
- disabled: item.isDisabled,
357
- onClick: () => {
358
- checkOnClick({
359
- event: () => {
360
- if (
361
- isModuleApproved(user, module) ||
362
- isSuperAdmin(user)
363
- ) {
364
- if (
365
- (isDemo && !item.demo) ||
366
- (item.isDisabled && item.isDisabled(user) && !isDev)
367
- ) {
368
- featureIsNotAvailable(t, isDemo);
369
- return;
370
- }
371
- if (item.path) {
372
- goTo(item.path);
373
- }
374
-
375
- if (typeof item.onClick === "function") {
376
- item.onClick();
377
- }
378
- } else {
379
- notApprovedModal(item.path);
380
- }
381
- },
382
- });
383
- },
384
- label: t(item.name),
385
- }
386
- : {
387
- key: `item-${i}`,
388
- icon: <CustomIcon width={15} height={15} name={item.icon} />,
389
- disabled: item.isDisabled,
390
- className: formatClassname([
391
- !!(selectedKeys[0] && Array.isArray(item.items)
392
- ? item.items.find((it) =>
393
- it.items
394
- ? it.items.find((item) =>
395
- (item.subPath || []).find((p) =>
396
- matchPath(p, selectedKeys[0])
397
- )
398
- )
399
- : (it.subPath || []).find((p) =>
400
- matchPath(p, selectedKeys[0])
401
- ) || matchPath(it.path, selectedKeys[0])
402
- )
403
- : undefined) && "selected",
404
- ]),
405
- onTitleClick: () => {
406
- checkOnClick({
407
- event: () => {
408
- // if (item.onTitleClick) {
409
- // if (item.onTitleClick === 'PUSH_TO_DD_ANALYSIS') {
410
- // goTo(`/app/${module}/analysis/dd`);
411
- // }
412
- // }
413
- },
414
- });
415
- },
416
260
  onMouseEnter: (e) => {
417
261
  if (isCollapsed && !item.isDisabled) {
418
262
  document.removeEventListener("mousemove", onMouseMove);
@@ -423,108 +267,264 @@ export default function SidenavMenu({
423
267
  setHoverOpen(true);
424
268
  }
425
269
  },
270
+ className: formatClassname([
271
+ !!(selectedKeys[0] && item.path
272
+ ? matchPath(item.path, selectedKeys[0])
273
+ : undefined) && "selected",
274
+ ]),
275
+ disabled: item.isDisabled,
426
276
  onMouseLeave: () => {
427
277
  if (isCollapsed) {
428
278
  document.addEventListener("mousemove", onMouseMove);
429
279
  }
430
280
  },
281
+ key: item.name,
282
+ onTitleClick: () => {
283
+ checkOnClick({
284
+ event: () => {
285
+ if (
286
+ isModuleApproved(user, module) ||
287
+ isSuperAdmin(user)
288
+ ) {
289
+ if (
290
+ (isDemo && !item.demo) ||
291
+ (item.isDisabled && item.isDisabled(user) && !isDev)
292
+ ) {
293
+ featureIsNotAvailable(t, isDemo);
294
+ return;
295
+ }
296
+ if (item.path) {
297
+ goTo(item.path);
298
+ }
299
+
300
+ if (typeof item.onClick === "function") {
301
+ item.onClick();
302
+ }
303
+ } else {
304
+ notApprovedModal(item.path);
305
+ }
306
+ },
307
+ });
308
+ },
431
309
  label: t(item.name),
310
+ icon: <CustomIcon width={15} height={15} name={item.icon} />,
432
311
  children: [
433
- isCollapsed
434
- ? {
435
- disabled: true,
436
- icon: (
437
- <CustomIcon width={15} height={15} name={item.icon} />
438
- ),
439
- className: "title",
440
- label: t(item.name),
441
- key: `${item.name}-link`,
312
+ {
313
+ key: item.path || item.name,
314
+ style: item.style ? item.style : {},
315
+ icon: (
316
+ <CustomIcon width={15} height={15} name={item.icon} />
317
+ ),
318
+ disabled: item.isDisabled,
319
+ onClick: () => {
320
+ checkOnClick({
321
+ event: () => {
322
+ if (
323
+ isModuleApproved(user, module) ||
324
+ isSuperAdmin(user)
325
+ ) {
326
+ if (
327
+ (isDemo && !item.demo) ||
328
+ (item.isDisabled &&
329
+ item.isDisabled(user) &&
330
+ !isDev)
331
+ ) {
332
+ featureIsNotAvailable(t, isDemo);
333
+ return;
334
+ }
335
+ if (item.path) {
336
+ goTo(item.path);
337
+ }
338
+
339
+ if (typeof item.onClick === "function") {
340
+ item.onClick();
341
+ }
342
+ } else {
343
+ notApprovedModal(item.path);
344
+ }
345
+ },
346
+ });
347
+ },
348
+ label: t(item.name),
349
+ },
350
+ ],
351
+ }
352
+ : {
353
+ key: item.path,
354
+ style: item.style ? item.style : {},
355
+ icon: <CustomIcon width={15} height={15} name={item.icon} />,
356
+ disabled: item.isDisabled,
357
+ onClick: () => {
358
+ checkOnClick({
359
+ event: () => {
360
+ if (
361
+ isModuleApproved(user, module) ||
362
+ isSuperAdmin(user)
363
+ ) {
364
+ if (
365
+ (isDemo && !item.demo) ||
366
+ (item.isDisabled && item.isDisabled(user) && !isDev)
367
+ ) {
368
+ featureIsNotAvailable(t, isDemo);
369
+ return;
370
+ }
371
+ if (item.path) {
372
+ goTo(item.path);
373
+ }
374
+
375
+ if (typeof item.onClick === "function") {
376
+ item.onClick();
377
+ }
378
+ } else {
379
+ notApprovedModal(item.path);
442
380
  }
443
- : null,
444
- ...item.items
445
- .filter((item) =>
446
- item.visible ? item.visible(user, project) : false
447
- )
448
- .map((subitem, j) =>
449
- subitem.items
450
- ? renderSubMenu(subitem, `${subitem.name}`)
451
- : {
452
- label: (
453
- <Typography.Text
454
- ellipsis={{ tooltip: t(subitem.name) }}
455
- // style={{ color: module === 'tazama' ? 'var(--base-gray-90)' : module === 'cukura' ? 'var(--base-gray-70)' : 'white' }}
456
- style={{
457
- color:
458
- subitem.color ||
459
- (module === "tazama"
460
- ? "var(--base-gray-90)"
461
- : module === "cukura"
462
- ? "var(--base-gray-70)"
463
- : "white"),
464
- }}
465
- className={formatClassname([
466
- typeof selectedKeys[0] === "string"
467
- ? !!(
468
- selectedKeys[0].includes(subitem.path) ||
469
- (subitem.subPath || []).find((p) =>
470
- matchPath(p, selectedKeys[0])
471
- )
472
- ) && "selected-label"
473
- : "",
474
- ])}
475
- >
476
- {t(subitem.name)}
477
- </Typography.Text>
478
- ),
479
- style: subitem.style ? subitem.style : {},
480
- icon: (
481
- <CustomIcon
482
- width={15}
483
- height={15}
484
- name={subitem?.icon}
485
- />
486
- ),
487
- key: `${subitem.path}-link-${j}`,
488
- disabled: item.isDisabled || subitem.isDisabled,
489
- className: formatClassname([
381
+ },
382
+ });
383
+ },
384
+ label: t(item.name),
385
+ }
386
+ : {
387
+ key: `item-${i}`,
388
+ icon: <CustomIcon width={15} height={15} name={item.icon} />,
389
+ disabled: item.isDisabled,
390
+ className: formatClassname([
391
+ !!(selectedKeys[0] && Array.isArray(item.items)
392
+ ? item.items.find((it) =>
393
+ it.items
394
+ ? it.items.find((item) =>
395
+ (item.subPath || []).find((p) =>
396
+ matchPath(p, selectedKeys[0])
397
+ )
398
+ )
399
+ : (it.subPath || []).find((p) =>
400
+ matchPath(p, selectedKeys[0])
401
+ ) || matchPath(it.path, selectedKeys[0])
402
+ )
403
+ : undefined) && "selected",
404
+ ]),
405
+ onTitleClick: () => {
406
+ checkOnClick({
407
+ event: () => {
408
+ // if (item.onTitleClick) {
409
+ // if (item.onTitleClick === 'PUSH_TO_DD_ANALYSIS') {
410
+ // goTo(`/app/${module}/analysis/dd`);
411
+ // }
412
+ // }
413
+ },
414
+ });
415
+ },
416
+ onMouseEnter: (e) => {
417
+ if (isCollapsed && !item.isDisabled) {
418
+ document.removeEventListener("mousemove", onMouseMove);
419
+ setHoverItem(item);
420
+ setTopHover(
421
+ e.domEvent.currentTarget.getBoundingClientRect().top
422
+ );
423
+ setHoverOpen(true);
424
+ }
425
+ },
426
+ onMouseLeave: () => {
427
+ if (isCollapsed) {
428
+ document.addEventListener("mousemove", onMouseMove);
429
+ }
430
+ },
431
+ label: t(item.name),
432
+ children: [
433
+ isCollapsed
434
+ ? {
435
+ disabled: true,
436
+ icon: (
437
+ <CustomIcon width={15} height={15} name={item.icon} />
438
+ ),
439
+ className: "title",
440
+ label: t(item.name),
441
+ key: `${item.name}-link`,
442
+ }
443
+ : null,
444
+ ...item.items
445
+ .filter((item) =>
446
+ item.visible ? item.visible(user, project) : false
447
+ )
448
+ .map((subitem, j) =>
449
+ subitem.items
450
+ ? renderSubMenu(subitem, `${subitem.name}`)
451
+ : {
452
+ label: (
453
+ <Typography.Text
454
+ ellipsis={{ tooltip: t(subitem.name) }}
455
+ // style={{ color: module === 'tazama' ? 'var(--base-gray-90)' : module === 'cukura' ? 'var(--base-gray-70)' : 'white' }}
456
+ style={{
457
+ color:
458
+ subitem.color ||
459
+ (module === "tazama"
460
+ ? "var(--base-gray-90)"
461
+ : module === "cukura"
462
+ ? "var(--base-gray-70)"
463
+ : "white"),
464
+ }}
465
+ className={formatClassname([
490
466
  typeof selectedKeys[0] === "string"
491
467
  ? !!(
492
- selectedKeys[0].includes(subitem.path) ||
493
- (subitem.subPath || []).find((p) =>
494
- matchPath(p, selectedKeys[0])
495
- )
496
- ) && "selected-it"
468
+ selectedKeys[0].includes(subitem.path) ||
469
+ (subitem.subPath || []).find((p) =>
470
+ matchPath(p, selectedKeys[0])
471
+ )
472
+ ) && "selected-label"
497
473
  : "",
498
- ]),
499
- onClick: () => {
500
- checkOnClick({
501
- event: () => {
502
- if (
503
- isModuleApproved(user, module) ||
504
- isSuperAdmin(user)
505
- ) {
506
- if (
507
- (isDemo && !subitem.demo) ||
508
- (subitem.isDisabled &&
509
- subitem.isDisabled(user) &&
510
- !isDev)
511
- ) {
512
- featureIsNotAvailable(t, isDemo);
513
- return;
514
- }
515
- if (subitem.path) {
516
- goTo(subitem.path);
517
- }
518
- } else {
519
- notApprovedModal(subitem.path);
520
- }
521
- },
522
- });
474
+ ])}
475
+ >
476
+ {t(subitem.name)}
477
+ </Typography.Text>
478
+ ),
479
+ style: subitem.style ? subitem.style : {},
480
+ icon: (
481
+ <CustomIcon
482
+ width={15}
483
+ height={15}
484
+ name={subitem?.icon}
485
+ />
486
+ ),
487
+ key: `${subitem.path}-link-${j}`,
488
+ disabled: item.isDisabled || subitem.isDisabled,
489
+ className: formatClassname([
490
+ typeof selectedKeys[0] === "string"
491
+ ? !!(
492
+ selectedKeys[0].includes(subitem.path) ||
493
+ (subitem.subPath || []).find((p) =>
494
+ matchPath(p, selectedKeys[0])
495
+ )
496
+ ) && "selected-it"
497
+ : "",
498
+ ]),
499
+ onClick: () => {
500
+ checkOnClick({
501
+ event: () => {
502
+ if (
503
+ isModuleApproved(user, module) ||
504
+ isSuperAdmin(user)
505
+ ) {
506
+ if (
507
+ (isDemo && !subitem.demo) ||
508
+ (subitem.isDisabled &&
509
+ subitem.isDisabled(user) &&
510
+ !isDev)
511
+ ) {
512
+ featureIsNotAvailable(t, isDemo);
513
+ return;
514
+ }
515
+ if (subitem.path) {
516
+ goTo(subitem.path);
517
+ }
518
+ } else {
519
+ notApprovedModal(subitem.path);
520
+ }
523
521
  },
524
- }
525
- ),
526
- ].filter((v) => !!v),
527
- }
522
+ });
523
+ },
524
+ }
525
+ ),
526
+ ].filter((v) => !!v),
527
+ }
528
528
  )}
529
529
  />
530
530
  );
@@ -545,6 +545,12 @@ export default function SidenavMenu({
545
545
  <span className="title-span">{t("core")}</span>
546
546
  {renderMenu(coreItems)}
547
547
  </div>
548
+ ) : null}
549
+ {operationsItems.length ? (
550
+ <div className="sidemenu-cont">
551
+ <span className="title-span">{t("operations")}</span>
552
+ {renderMenu(operationsItems)}
553
+ </div>
548
554
  ) : null}
549
555
  {activityItems.length ? (
550
556
  <div className="sidemenu-cont">
@@ -600,12 +606,6 @@ export default function SidenavMenu({
600
606
  {renderMenu(specificationsItems)}
601
607
  </div>
602
608
  ) : null}
603
- {operationsItems.length ? (
604
- <div className="sidemenu-cont">
605
- <span className="title-span">{t("operations")}</span>
606
- {renderMenu(operationsItems)}
607
- </div>
608
- ) : null}
609
609
  {projectDataItems.length ? (
610
610
  <div className="sidemenu-cont">
611
611
  <span className="title-span">{t("Project Data")}</span>
@@ -35,7 +35,7 @@ export const useWidgetFetch = ({config, getData = DashboardService.getWidget, on
35
35
 
36
36
  useEffect(() => {
37
37
  fetchData();
38
- }, []);
38
+ }, [config]);
39
39
 
40
40
  return {
41
41
  data,
@@ -5,7 +5,14 @@ import { renderDateFormatted } from '../../../../../helpers/Forms.js';
5
5
  import CustomIcon from '../../../../core/components/Icon/CustomIcon.jsx';
6
6
  import AvatarGroup from '../../../../core/components/AvatarGroup/index.jsx';
7
7
 
8
- export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, dataOptions}) => [
8
+ const getLinkValue = (value, linkingObject) => {
9
+ if(linkingObject && linkingObject?.[value]) {
10
+ return linkingObject?.[value]?.name;
11
+ }
12
+ return null;
13
+ }
14
+
15
+ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data}) => [
9
16
  {
10
17
  dataIndex: 'datastakeId',
11
18
  title: t('ID'),
@@ -42,7 +49,7 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
42
49
  return <div className="daf-default-cell" />
43
50
  }
44
51
 
45
- const category = findOptions(v, dataOptions?.locationCategories);
52
+ const category = findOptions(v, data?.options?.locationCategories);
46
53
 
47
54
  return category ? <Tooltip title={category}>{category}</Tooltip> : '-';
48
55
  },
@@ -72,9 +79,9 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
72
79
  return <div className="daf-default-cell" />
73
80
  }
74
81
 
75
- const country = findOptions(v, options?.countries);
82
+ const region = getLinkValue(v, all?.linking?.SCL);
76
83
 
77
- return '-';
84
+ return region ? <Tooltip title={region}>{region}</Tooltip> : '-';
78
85
  },
79
86
  },
80
87
  {
@@ -87,9 +94,9 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
87
94
  return <div className="daf-default-cell" />
88
95
  }
89
96
 
90
- const country = findOptions(v, options?.countries);
97
+ const district = getLinkValue(v, all?.linking?.SCL);
91
98
 
92
- return '-';
99
+ return district ? <Tooltip title={district}>{district}</Tooltip> : '-';
93
100
  },
94
101
  },
95
102
  {
@@ -116,9 +123,8 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
116
123
  if (all.empty) {
117
124
  return <div className="daf-default-cell" />;
118
125
  }
119
- if (!val || val?.length === 0) {
120
- return "--";
121
- }
126
+
127
+ console.log({val, all})
122
128
 
123
129
  return <AvatarGroup items={val}></AvatarGroup>;
124
130
  },
@@ -74,6 +74,7 @@ const StakeholdersCreate = ({
74
74
  const newPayload = {
75
75
  ...defaultData,
76
76
  ...payloadData,
77
+ form: 'location'
77
78
  };
78
79
 
79
80
  const callback = (type, m, data) => {