datastake-daf 0.6.350 → 0.6.352

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.
@@ -12252,7 +12252,7 @@ GoToSelect.propTypes = {
12252
12252
 
12253
12253
  const _excluded$s = ["options", "defaultSelected", "onChange", "textWhenMultiple", "withCount", "oneAlwaysSelected", "canUnselectLast", "isAvatarGroup", "maxAvatarCount", "dropDownWidth", "topAvatarValue", "isSingle", "selectionType"];
12254
12254
  const {
12255
- useToken: useToken$l
12255
+ useToken: useToken$n
12256
12256
  } = antd.theme;
12257
12257
 
12258
12258
  /**
@@ -12346,7 +12346,7 @@ function Multiselect(_ref) {
12346
12346
  restProps = _objectWithoutProperties(_ref, _excluded$s);
12347
12347
  const {
12348
12348
  token
12349
- } = useToken$l();
12349
+ } = useToken$n();
12350
12350
  const [selectValue, setSelectValue] = React.useState(Array.isArray(defaultSelected) ? defaultSelected.length > 0 ? defaultSelected : [] : [defaultSelected]);
12351
12351
  function onSelectChange(value) {
12352
12352
  if (!canUnselectLast && value.length === 0) {
@@ -12899,7 +12899,7 @@ const useHeader = _ref => {
12899
12899
  };
12900
12900
 
12901
12901
  const {
12902
- useToken: useToken$k
12902
+ useToken: useToken$m
12903
12903
  } = antd.theme;
12904
12904
  function BreadCrumbs({
12905
12905
  breadcrumbs = [],
@@ -12908,7 +12908,7 @@ function BreadCrumbs({
12908
12908
  const [splitIndex, setSplitIndex] = React.useState(0);
12909
12909
  const {
12910
12910
  token
12911
- } = useToken$k();
12911
+ } = useToken$m();
12912
12912
  const _renderBreadcrumb = (b, i, isLast, noOnClickLast = false) => {
12913
12913
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
12914
12914
  className: "flex breadcrumb-item",
@@ -21940,7 +21940,7 @@ const {
21940
21940
  Meta
21941
21941
  } = antd.Card;
21942
21942
  const {
21943
- useToken: useToken$j
21943
+ useToken: useToken$l
21944
21944
  } = antd.theme;
21945
21945
  function ProjectWidget(_ref) {
21946
21946
  let {
@@ -21959,7 +21959,7 @@ function ProjectWidget(_ref) {
21959
21959
  const [isHovered, setIsHovered] = React__default["default"].useState(false);
21960
21960
  const {
21961
21961
  token
21962
- } = useToken$j();
21962
+ } = useToken$l();
21963
21963
  return /*#__PURE__*/jsxRuntime.jsxs(antd.Card, _objectSpread2(_objectSpread2({
21964
21964
  style: {
21965
21965
  // flex: 1,
@@ -22063,7 +22063,7 @@ const Style$x = dt.div`
22063
22063
  `;
22064
22064
 
22065
22065
  const {
22066
- useToken: useToken$i
22066
+ useToken: useToken$k
22067
22067
  } = antd.theme;
22068
22068
  const WidgetCard = _ref => {
22069
22069
  let {
@@ -22082,7 +22082,7 @@ const WidgetCard = _ref => {
22082
22082
  width,
22083
22083
  t = () => {}
22084
22084
  } = _ref;
22085
- useToken$i();
22085
+ useToken$k();
22086
22086
  return /*#__PURE__*/jsxRuntime.jsx(Style$x, {
22087
22087
  backgroundColor: backgroundColor,
22088
22088
  backgroundBorderColor: backgroundBorderColor,
@@ -22795,12 +22795,12 @@ function GroupInfos({
22795
22795
  }
22796
22796
 
22797
22797
  const {
22798
- useToken: useToken$h
22798
+ useToken: useToken$j
22799
22799
  } = antd.theme;
22800
22800
  function Smart() {
22801
22801
  const {
22802
22802
  token
22803
- } = useToken$h();
22803
+ } = useToken$j();
22804
22804
  const [isOpen, setIsOpen] = React.useState(false);
22805
22805
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
22806
22806
  style: {
@@ -22884,7 +22884,7 @@ function SmartWidget({
22884
22884
  }) {
22885
22885
  const {
22886
22886
  token
22887
- } = useToken$h();
22887
+ } = useToken$j();
22888
22888
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
22889
22889
  noTitle: true,
22890
22890
  className: "no-p-body p-xs",
@@ -23823,7 +23823,7 @@ function DataLink$1({
23823
23823
  }
23824
23824
 
23825
23825
  const {
23826
- useToken: useToken$g
23826
+ useToken: useToken$i
23827
23827
  } = antd.theme;
23828
23828
  const disabledTypes = ["dataLink"];
23829
23829
  function Versions({
@@ -23836,7 +23836,7 @@ function Versions({
23836
23836
  }) {
23837
23837
  const {
23838
23838
  token
23839
- } = useToken$g();
23839
+ } = useToken$i();
23840
23840
  const dataSource = React.useMemo(() => {
23841
23841
  if (!versionsDatapoints) {
23842
23842
  return [];
@@ -49273,7 +49273,7 @@ StyledTabs.propTypes = {
49273
49273
  };
49274
49274
 
49275
49275
  const {
49276
- useToken: useToken$f
49276
+ useToken: useToken$h
49277
49277
  } = antd.theme;
49278
49278
  const MAX_LENGTH = 3;
49279
49279
  function AvatarGroup(_ref) {
@@ -49285,7 +49285,7 @@ function AvatarGroup(_ref) {
49285
49285
  const count = items.length === maxLength + 1 ? items.length : maxLength;
49286
49286
  const {
49287
49287
  token
49288
- } = useToken$f();
49288
+ } = useToken$h();
49289
49289
  return /*#__PURE__*/jsxRuntime.jsx(antd.Avatar.Group, {
49290
49290
  max: {
49291
49291
  count: count,
@@ -49383,7 +49383,7 @@ const Container$1 = dt.div`
49383
49383
 
49384
49384
  const _excluded$7 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "isPercentage", "seriesField", "formattedYAxis", "formattedXAxis", "color", "height", "t", "isPdf", "extraLegendConfig", "width"];
49385
49385
  const {
49386
- useToken: useToken$e
49386
+ useToken: useToken$g
49387
49387
  } = antd.theme;
49388
49388
 
49389
49389
  /**
@@ -49475,7 +49475,7 @@ function BarChart(_ref) {
49475
49475
  const chartRef = React__default["default"].useRef(null);
49476
49476
  const {
49477
49477
  token
49478
- } = useToken$e();
49478
+ } = useToken$g();
49479
49479
  const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
49480
49480
  React__default["default"].useEffect(() => {
49481
49481
  if (!containerRef.current) {
@@ -49546,7 +49546,7 @@ function BarChart(_ref) {
49546
49546
 
49547
49547
  const _excluded$6 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isSmooth", "seriesField", "isArea", "formattedYAxis", "formattedXAxis", "color", "isPercentage", "height", "autoHideXLabel", "t", "isPdf", "extraLegendConfig", "width"];
49548
49548
  const {
49549
- useToken: useToken$d
49549
+ useToken: useToken$f
49550
49550
  } = antd.theme;
49551
49551
 
49552
49552
  /**
@@ -49636,7 +49636,7 @@ function LineChart(_ref) {
49636
49636
  const chartRef = React__default["default"].useRef(null);
49637
49637
  const {
49638
49638
  token
49639
- } = useToken$d();
49639
+ } = useToken$f();
49640
49640
  const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
49641
49641
  React__default["default"].useEffect(() => {
49642
49642
  if (!containerRef.current) {
@@ -49719,7 +49719,7 @@ function LineChart(_ref) {
49719
49719
 
49720
49720
  const _excluded$5 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "seriesField", "isPercentage", "showBackground", "formattedYAxis", "formattedXAxis", "color", "height", "groupField", "t", "isPdf", "extraLegendConfig", "shouldSeperateLegendName", "width"];
49721
49721
  const {
49722
- useToken: useToken$c
49722
+ useToken: useToken$e
49723
49723
  } = antd.theme;
49724
49724
 
49725
49725
  /**
@@ -49813,7 +49813,7 @@ function ColumnChart(_ref) {
49813
49813
  const chartRef = React__default["default"].useRef(null);
49814
49814
  const {
49815
49815
  token
49816
- } = useToken$c();
49816
+ } = useToken$e();
49817
49817
  const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
49818
49818
  React__default["default"].useEffect(() => {
49819
49819
  if (!containerRef.current) {
@@ -49893,7 +49893,7 @@ function ColumnChart(_ref) {
49893
49893
  }
49894
49894
 
49895
49895
  const {
49896
- useToken: useToken$b
49896
+ useToken: useToken$d
49897
49897
  } = antd.theme;
49898
49898
  /**
49899
49899
  * RadialBarChart Component
@@ -49953,7 +49953,7 @@ function RadialBarChart(_ref) {
49953
49953
  const chartRef = React__default["default"].useRef(null);
49954
49954
  const {
49955
49955
  token
49956
- } = useToken$b();
49956
+ } = useToken$d();
49957
49957
  const formattedData = React.useMemo(() => {
49958
49958
  return data.map(item => _objectSpread2(_objectSpread2({}, item), {}, {
49959
49959
  originalValue: item[yFieldKey],
@@ -50049,7 +50049,7 @@ function RadialBarChart(_ref) {
50049
50049
 
50050
50050
  const _excluded$4 = ["data", "angleField", "colorField", "color", "height", "innerRadius", "radius", "legend", "label", "statistic", "tooltip", "renderTooltipContent", "tooltipConfig", "meta", "animation", "t", "isPdf", "extraLegendConfig"];
50051
50051
  const {
50052
- useToken: useToken$a
50052
+ useToken: useToken$c
50053
50053
  } = antd.theme;
50054
50054
 
50055
50055
  /**
@@ -50127,7 +50127,7 @@ function DonutPie(_ref) {
50127
50127
  const chartRef = React.useRef(null);
50128
50128
  const {
50129
50129
  token
50130
- } = useToken$a();
50130
+ } = useToken$c();
50131
50131
  const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
50132
50132
 
50133
50133
  // Memoize processed data for progress mode
@@ -50372,7 +50372,7 @@ dt.div`
50372
50372
  `;
50373
50373
 
50374
50374
  const {
50375
- useToken: useToken$9
50375
+ useToken: useToken$b
50376
50376
  } = antd.theme;
50377
50377
  /**
50378
50378
  * StackChart Component
@@ -50460,7 +50460,7 @@ function StackChart(_ref) {
50460
50460
  const ref = React__default["default"].useRef();
50461
50461
  const {
50462
50462
  token
50463
- } = useToken$9();
50463
+ } = useToken$b();
50464
50464
  const isEmpty = !data.length;
50465
50465
  const [mouseY, setMouseY] = React__default["default"].useState(0);
50466
50466
  const [mouseX, setMouseX] = React__default["default"].useState(0);
@@ -50634,7 +50634,7 @@ function StackChart(_ref) {
50634
50634
 
50635
50635
  const _excluded$3 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "fillOpacity", "height", "t", "isPdf", "extraLegendConfig", "width"];
50636
50636
  const {
50637
- useToken: useToken$8
50637
+ useToken: useToken$a
50638
50638
  } = antd.theme;
50639
50639
 
50640
50640
  /**
@@ -50714,7 +50714,7 @@ const AreaChart = _ref => {
50714
50714
  const chartRef = React.useRef(null);
50715
50715
  const {
50716
50716
  token
50717
- } = useToken$8();
50717
+ } = useToken$a();
50718
50718
  const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
50719
50719
  React.useEffect(() => {
50720
50720
  if (!containerRef.current) {
@@ -50789,7 +50789,7 @@ const AreaChart = _ref => {
50789
50789
 
50790
50790
  const _excluded$2 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "score", "height"];
50791
50791
  const {
50792
- useToken: useToken$7
50792
+ useToken: useToken$9
50793
50793
  } = antd.theme;
50794
50794
  const RadarChart = _ref => {
50795
50795
  let {
@@ -50815,7 +50815,7 @@ const RadarChart = _ref => {
50815
50815
  const chartRef = React.useRef(null);
50816
50816
  const {
50817
50817
  token
50818
- } = useToken$7();
50818
+ } = useToken$9();
50819
50819
  React.useEffect(() => {
50820
50820
  if (!containerRef.current) {
50821
50821
  return;
@@ -50913,7 +50913,7 @@ const RadarChart = _ref => {
50913
50913
  };
50914
50914
 
50915
50915
  const {
50916
- useToken: useToken$6
50916
+ useToken: useToken$8
50917
50917
  } = antd.theme;
50918
50918
  function DualAxesChart(_ref) {
50919
50919
  let {
@@ -50933,7 +50933,7 @@ function DualAxesChart(_ref) {
50933
50933
  const chartRef = React__default["default"].useRef(null);
50934
50934
  const {
50935
50935
  token
50936
- } = useToken$6();
50936
+ } = useToken$8();
50937
50937
  const _colours = React.useMemo(() => {
50938
50938
  const defaultColours = [token.colorPrimary7, token.colorPrimary6, token.colorPrimary8];
50939
50939
  if (color) {
@@ -51369,14 +51369,14 @@ const Style$e = dt.div`
51369
51369
 
51370
51370
  const NAME_CARD_WIDTH = 315;
51371
51371
  const {
51372
- useToken: useToken$5
51372
+ useToken: useToken$7
51373
51373
  } = antd.theme;
51374
51374
  function NameNode({
51375
51375
  data
51376
51376
  }) {
51377
51377
  const {
51378
51378
  token
51379
- } = useToken$5();
51379
+ } = useToken$7();
51380
51380
  const translateFN = typeof data?.t === "function" ? data.t : key => key;
51381
51381
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
51382
51382
  children: [/*#__PURE__*/jsxRuntime.jsx(react.Handle, {
@@ -53422,7 +53422,7 @@ const getRangeOfTicks = max => {
53422
53422
  };
53423
53423
 
53424
53424
  const {
53425
- useToken: useToken$4
53425
+ useToken: useToken$6
53426
53426
  } = antd.theme;
53427
53427
  function useUserGrowth({
53428
53428
  container,
@@ -53434,7 +53434,7 @@ function useUserGrowth({
53434
53434
  const [data, setData] = React.useState([]);
53435
53435
  const {
53436
53436
  token
53437
- } = useToken$4();
53437
+ } = useToken$6();
53438
53438
  const fetchData = () => {
53439
53439
  const {
53440
53440
  dates = []
@@ -53608,7 +53608,7 @@ function UserGrowth({
53608
53608
  }
53609
53609
 
53610
53610
  const {
53611
- useToken: useToken$3
53611
+ useToken: useToken$5
53612
53612
  } = antd.theme;
53613
53613
  function useTopContributors({
53614
53614
  container,
@@ -53618,7 +53618,7 @@ function useTopContributors({
53618
53618
  const [mainGraph, setMainGraph] = React.useState(null);
53619
53619
  const {
53620
53620
  token
53621
- } = useToken$3();
53621
+ } = useToken$5();
53622
53622
  React.useEffect(() => {
53623
53623
  if (container.current) {
53624
53624
  if (mainGraph) {
@@ -54094,7 +54094,7 @@ const renderTypeTag = ({
54094
54094
  });
54095
54095
  };
54096
54096
 
54097
- const getColumns$5 = ({
54097
+ const getColumns$6 = ({
54098
54098
  t,
54099
54099
  show = "show",
54100
54100
  selectOptions,
@@ -54578,7 +54578,7 @@ function UserTable(_ref) {
54578
54578
  role: config.userRoles.filter(c => !c.isForAppAdmin)
54579
54579
  };
54580
54580
  }, [config.userRoles, config.accountTypes, accounts]);
54581
- const columns = React.useMemo(() => getColumns$5({
54581
+ const columns = React.useMemo(() => getColumns$6({
54582
54582
  t,
54583
54583
  show: activeTab,
54584
54584
  selectOptions,
@@ -54674,7 +54674,7 @@ function UserTable(_ref) {
54674
54674
  });
54675
54675
  }
54676
54676
 
54677
- const getColumns$4 = ({
54677
+ const getColumns$5 = ({
54678
54678
  t,
54679
54679
  goTo,
54680
54680
  show = "show",
@@ -55027,7 +55027,7 @@ const getTabs$1 = ({
55027
55027
  label: t("Suspended")
55028
55028
  }];
55029
55029
 
55030
- const getColumns$3 = ({
55030
+ const getColumns$4 = ({
55031
55031
  t,
55032
55032
  selectOptions,
55033
55033
  module
@@ -55134,7 +55134,7 @@ const Container = dt.div`
55134
55134
  `;
55135
55135
 
55136
55136
  const {
55137
- useToken: useToken$2
55137
+ useToken: useToken$4
55138
55138
  } = antd.theme;
55139
55139
  function CombineAccountModal({
55140
55140
  isOpen,
@@ -55147,10 +55147,10 @@ function CombineAccountModal({
55147
55147
  }) {
55148
55148
  const {
55149
55149
  token
55150
- } = useToken$2();
55150
+ } = useToken$4();
55151
55151
  const [MainForm] = antd.Form.useForm();
55152
55152
  const columns = React.useMemo(() => {
55153
- return getColumns$3({
55153
+ return getColumns$4({
55154
55154
  t,
55155
55155
  selectOptions,
55156
55156
  module
@@ -55453,7 +55453,7 @@ function AccountTable(_ref) {
55453
55453
  onCancel: () => {}
55454
55454
  });
55455
55455
  }, [t, fetchData, fetchPendingAccounts]);
55456
- const columns = React.useMemo(() => getColumns$4({
55456
+ const columns = React.useMemo(() => getColumns$5({
55457
55457
  t,
55458
55458
  show: activeTab,
55459
55459
  selectOptions,
@@ -55628,14 +55628,15 @@ const getNameByLevel = (data, level) => {
55628
55628
  const entry = Object.values(data || {}).find(item => item.level === level);
55629
55629
  return entry;
55630
55630
  };
55631
- const getColumns$2 = ({
55631
+
55632
+ const getColumns$3 = ({
55632
55633
  t,
55633
55634
  goTo = () => {},
55634
55635
  show = "show",
55635
55636
  getRedirectLink = () => {},
55636
55637
  token,
55637
- selectedLocations,
55638
- setSelectedLocations,
55638
+ selectedSubjects,
55639
+ setSelectedSubjects,
55639
55640
  selectOptions,
55640
55641
  entity
55641
55642
  }) => {
@@ -55652,15 +55653,15 @@ const getColumns$2 = ({
55652
55653
  });
55653
55654
  }
55654
55655
  return /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox, {
55655
- onChange: () => setSelectedLocations(prev => {
55656
+ onChange: () => setSelectedSubjects(prev => {
55656
55657
  const isSelected = prev.some(p => p.id === all.id);
55657
55658
  if (isSelected) {
55658
55659
  return prev.filter(p => p.id !== all.id);
55659
55660
  }
55660
55661
  return [...prev, all];
55661
55662
  }),
55662
- checked: selectedLocations.some(p => p.id === all.id),
55663
- disabled: selectedLocations?.length >= 3 && !selectedLocations.some(p => p.id === all.id)
55663
+ checked: selectedSubjects.some(p => p.id === all.id),
55664
+ disabled: selectedSubjects?.length >= 3 && !selectedSubjects.some(p => p.id === all.id)
55664
55665
  });
55665
55666
  }
55666
55667
  }, {
@@ -55849,7 +55850,7 @@ const getColumns$2 = ({
55849
55850
  return cols.filter(c => c[show]);
55850
55851
  };
55851
55852
 
55852
- const getColumns$1 = ({
55853
+ const getColumns$2 = ({
55853
55854
  t,
55854
55855
  selectOptions,
55855
55856
  module,
@@ -55940,7 +55941,7 @@ const getColumns$1 = ({
55940
55941
  };
55941
55942
 
55942
55943
  const {
55943
- useToken: useToken$1
55944
+ useToken: useToken$3
55944
55945
  } = antd.theme;
55945
55946
  function CombineLocationModal({
55946
55947
  isOpen,
@@ -55954,11 +55955,11 @@ function CombineLocationModal({
55954
55955
  }) {
55955
55956
  const {
55956
55957
  token
55957
- } = useToken$1();
55958
+ } = useToken$3();
55958
55959
  const [MainForm] = antd.Form.useForm();
55959
55960
  const [isDisabled, setIsDisabled] = React.useState(true);
55960
55961
  const columns = React.useMemo(() => {
55961
- return getColumns$1({
55962
+ return getColumns$2({
55962
55963
  t,
55963
55964
  selectOptions,
55964
55965
  module,
@@ -56108,7 +56109,7 @@ function CombineLocationModal({
56108
56109
  }
56109
56110
 
56110
56111
  const {
56111
- useToken
56112
+ useToken: useToken$2
56112
56113
  } = antd.theme;
56113
56114
  function LocationTable(_ref) {
56114
56115
  let {
@@ -56132,7 +56133,7 @@ function LocationTable(_ref) {
56132
56133
  const [selectedLocations, setSelectedLocations] = React.useState([]);
56133
56134
  const {
56134
56135
  token
56135
- } = useToken();
56136
+ } = useToken$2();
56136
56137
  const [combineLocationVisible, setCombineLocationVisible] = React.useState(false);
56137
56138
  const {
56138
56139
  filter,
@@ -56167,7 +56168,7 @@ function LocationTable(_ref) {
56167
56168
  };
56168
56169
  }, [config.options]);
56169
56170
  const columns = React.useMemo(() => {
56170
- return getColumns$2({
56171
+ return getColumns$3({
56171
56172
  t,
56172
56173
  goTo,
56173
56174
  token,
@@ -56261,6 +56262,418 @@ function LocationTable(_ref) {
56261
56262
  });
56262
56263
  }
56263
56264
 
56265
+ const mapToSelectOptions = (items, valueKey, selectOptions, optionKey, customMapper = null) => {
56266
+ return items.map(item => {
56267
+ if (customMapper) {
56268
+ return customMapper(item);
56269
+ }
56270
+ const value = item?.[valueKey] || "-";
56271
+ const optionsList = selectOptions?.[optionKey] || [];
56272
+ const foundOption = optionsList.find(option => option.value === value);
56273
+ return {
56274
+ label: foundOption?.label || value,
56275
+ value: value
56276
+ };
56277
+ }).filter((option, index, self) => index === self.findIndex(o => o.value === option.value));
56278
+ };
56279
+
56280
+ const getColumns$1 = ({
56281
+ t,
56282
+ selectOptions,
56283
+ module,
56284
+ entity
56285
+ }) => {
56286
+ return [{
56287
+ title: t("admin::organisation_id"),
56288
+ dataIndex: "datastakeId",
56289
+ key: "datastakeId",
56290
+ show: true,
56291
+ render: (value, all) => {
56292
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
56293
+ title: value,
56294
+ children: value
56295
+ });
56296
+ }
56297
+ }, {
56298
+ title: t("Name"),
56299
+ dataIndex: "name",
56300
+ key: "name",
56301
+ show: true,
56302
+ render: (value, all) => {
56303
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
56304
+ title: value,
56305
+ children: value
56306
+ });
56307
+ }
56308
+ }, {
56309
+ title: t("Category"),
56310
+ dataIndex: "category",
56311
+ key: "category",
56312
+ show: true,
56313
+ render: (value, all) => {
56314
+ const label = findOptions(value, selectOptions?.category);
56315
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
56316
+ title: label,
56317
+ children: label
56318
+ });
56319
+ }
56320
+ }, {
56321
+ title: t("Country"),
56322
+ dataIndex: "country",
56323
+ key: "country",
56324
+ show: true,
56325
+ render: (value, all) => {
56326
+ const label = findOptions(value, selectOptions?.country);
56327
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
56328
+ title: label,
56329
+ children: label
56330
+ });
56331
+ }
56332
+ }, {
56333
+ title: t("Province"),
56334
+ dataIndex: "administrativeLevel1",
56335
+ key: "administrativeLevel1",
56336
+ ellipsis: true,
56337
+ show: entity.includes("locations"),
56338
+ render: (value, all) => {
56339
+ let label;
56340
+ if (all?.administrativeLevel1 && value === all?.administrativeLevel1) {
56341
+ label = all?.linking?.SCL?.[value]?.name;
56342
+ } else {
56343
+ label = getNameByLevel(all?.linking?.SCL, "level_1")?.name;
56344
+ }
56345
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
56346
+ title: label || '-',
56347
+ children: label || '-'
56348
+ });
56349
+ }
56350
+ }, {
56351
+ title: t("Territory"),
56352
+ dataIndex: "administrativeLevel2",
56353
+ key: "administrativeLevel2",
56354
+ show: entity.includes("locations"),
56355
+ render: (value, all) => {
56356
+ let label;
56357
+ if (all?.administrativeLevel2 && value === all?.administrativeLevel2) {
56358
+ label = all?.linking?.SCL?.[value]?.name;
56359
+ } else {
56360
+ label = getNameByLevel(all?.linking?.SCL, "level_2")?.name;
56361
+ }
56362
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
56363
+ title: label || '-',
56364
+ children: label || '-'
56365
+ });
56366
+ }
56367
+ }].filter(c => c?.show);
56368
+ };
56369
+
56370
+ const {
56371
+ useToken: useToken$1
56372
+ } = antd.theme;
56373
+ function CombineSubjectsModal({
56374
+ isOpen,
56375
+ t,
56376
+ onClose,
56377
+ onSuccess,
56378
+ selectedSubjects,
56379
+ selectOptions,
56380
+ module,
56381
+ entity
56382
+ }) {
56383
+ const {
56384
+ token
56385
+ } = useToken$1();
56386
+ const [MainForm] = antd.Form.useForm();
56387
+ const [isDisabled, setIsDisabled] = React.useState(true);
56388
+ const columns = React.useMemo(() => {
56389
+ return getColumns$1({
56390
+ t,
56391
+ selectOptions,
56392
+ module,
56393
+ selectedSubjects,
56394
+ entity
56395
+ });
56396
+ }, [selectedSubjects, t, selectOptions, module, entity]);
56397
+ const onSubmit = () => {
56398
+ MainForm.validateFields().then(data => {
56399
+ const ids = selectedSubjects.map(subject => subject._id);
56400
+ onSuccess({
56401
+ ids,
56402
+ data
56403
+ });
56404
+ });
56405
+ };
56406
+ return /*#__PURE__*/jsxRuntime.jsxs(Modal, {
56407
+ open: isOpen,
56408
+ title: t("admin::merge"),
56409
+ onClose: onClose,
56410
+ onSuccess: onSubmit,
56411
+ withModalFormWrapper: false,
56412
+ width: 1100,
56413
+ disabled: isDisabled,
56414
+ destroyOnClose: true,
56415
+ onValuesChange: () => {
56416
+ setIsDisabled(() => {
56417
+ const values = MainForm.getFieldsValue();
56418
+ const requiredFields = entity === "location" ? ["id", "name", "category", "country", "administrativeLevel1", "administrativeLevel2"] : ["id", "name", "category", "country"];
56419
+ return requiredFields.some(field => values[field] === undefined);
56420
+ });
56421
+ },
56422
+ children: [/*#__PURE__*/jsxRuntime.jsxs(Container, {
56423
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
56424
+ className: "daf-table-wrapper no-pagination",
56425
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
56426
+ className: "merge-modal-section-text",
56427
+ style: {
56428
+ color: token.baseGray90
56429
+ },
56430
+ children: t("admin::current_subjects")
56431
+ }), /*#__PURE__*/jsxRuntime.jsx(DAFTable, {
56432
+ columns: columns,
56433
+ data: selectedSubjects,
56434
+ pagination: false,
56435
+ loading: false,
56436
+ rowKey: "userId"
56437
+ })]
56438
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
56439
+ className: "merge-modal-section-text",
56440
+ style: {
56441
+ color: token.baseGray90,
56442
+ marginTop: 14
56443
+ },
56444
+ children: t("admin::merged_output")
56445
+ }), /*#__PURE__*/jsxRuntime.jsxs(antd.Form, {
56446
+ form: MainForm,
56447
+ clearOnDestroy: true,
56448
+ className: "select-container",
56449
+ onValuesChange: () => {
56450
+ setIsDisabled(prev => {
56451
+ const values = MainForm.getFieldsValue();
56452
+ return Object.keys(values).some(key => values[key] === undefined);
56453
+ });
56454
+ },
56455
+ style: {
56456
+ borderColor: token.baseGray50
56457
+ },
56458
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
56459
+ className: "flex-1",
56460
+ name: "id",
56461
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
56462
+ options: mapToSelectOptions(selectedSubjects, "datastakeId", selectOptions, null),
56463
+ placeholder: t("ID")
56464
+ })
56465
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
56466
+ className: "flex-1",
56467
+ name: "name",
56468
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
56469
+ placeholder: t("Name")
56470
+ })
56471
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
56472
+ className: "flex-1",
56473
+ name: "category",
56474
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
56475
+ options: mapToSelectOptions(selectedSubjects, "category", selectOptions, "category"),
56476
+ placeholder: t("Category")
56477
+ })
56478
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
56479
+ className: "flex-1",
56480
+ name: "country",
56481
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
56482
+ options: mapToSelectOptions(selectedSubjects, "country", selectOptions, "country"),
56483
+ placeholder: t("admin::country")
56484
+ })
56485
+ }), entity.includes("locations") && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
56486
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
56487
+ className: "flex-1",
56488
+ name: "administrativeLevel1",
56489
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
56490
+ placeholder: t("Province"),
56491
+ options: mapToSelectOptions(selectedSubjects, null, selectOptions, null, subject => {
56492
+ const _data = getNameByLevel(subject?.linking?.SCL, "level_1");
56493
+ return {
56494
+ label: _data?.name || "-",
56495
+ value: _data?.id || "-"
56496
+ };
56497
+ })
56498
+ })
56499
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
56500
+ className: "flex-1",
56501
+ name: "administrativeLevel2",
56502
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
56503
+ placeholder: t("Territory"),
56504
+ options: mapToSelectOptions(selectedSubjects, null, selectOptions, null, subject => {
56505
+ const _data = getNameByLevel(subject?.linking?.SCL, "level_2");
56506
+ return {
56507
+ label: _data?.name || "-",
56508
+ value: _data?.id || "-"
56509
+ };
56510
+ })
56511
+ })
56512
+ })]
56513
+ })]
56514
+ })]
56515
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
56516
+ style: {
56517
+ height: 57
56518
+ }
56519
+ })]
56520
+ });
56521
+ }
56522
+
56523
+ const {
56524
+ useToken
56525
+ } = antd.theme;
56526
+ function SubjectsTable(_ref) {
56527
+ let {
56528
+ t = text => text,
56529
+ isMobile,
56530
+ goTo,
56531
+ getRedirectLink,
56532
+ location,
56533
+ getData,
56534
+ module,
56535
+ config,
56536
+ defaultPageSize = 20,
56537
+ view,
56538
+ headerTitle,
56539
+ breadcrumbs,
56540
+ mergeSubjectsFunction,
56541
+ refetchTrigger
56542
+ } = _ref;
56543
+ const [showFilters, setShowFilters] = React.useState(false);
56544
+ const [hasError, setHasError] = React.useState(false);
56545
+ const [selectedSubjects, setSelectedSubjects] = React.useState([]);
56546
+ const {
56547
+ token
56548
+ } = useToken();
56549
+ const [isCombineModalOpen, setIsModalOpen] = React.useState(false);
56550
+ const {
56551
+ filter,
56552
+ activeTab,
56553
+ canClearSearch,
56554
+ totalPending,
56555
+ data,
56556
+ loading,
56557
+ initFetchDone,
56558
+ fetchData,
56559
+ fetchPendingAccounts,
56560
+ setLoading
56561
+ } = useAdminTable({
56562
+ goTo,
56563
+ location,
56564
+ selectFiltersConfig: selectFiltersConfig$8,
56565
+ view,
56566
+ defaultUrlParams: defaultUrlParams$1,
56567
+ module,
56568
+ defaultPageSize,
56569
+ filtersConfig: filtersConfig$8,
56570
+ getRedirectLink,
56571
+ getData,
56572
+ refetchTrigger
56573
+ });
56574
+ const selectOptions = React.useMemo(() => {
56575
+ var _config$options, _config$options2;
56576
+ return {
56577
+ category: (_config$options = config.options) === null || _config$options === void 0 ? void 0 : _config$options.category,
56578
+ country: (_config$options2 = config.options) === null || _config$options2 === void 0 ? void 0 : _config$options2.countries,
56579
+ sources: [] //TODO: add sources logic and make sure you only show unique sources only once
56580
+ };
56581
+ }, [config.options]);
56582
+ const columns = React.useMemo(() => {
56583
+ return getColumns$3({
56584
+ t,
56585
+ goTo,
56586
+ token,
56587
+ module,
56588
+ selectedSubjects,
56589
+ setSelectedSubjects,
56590
+ getRedirectLink,
56591
+ selectOptions,
56592
+ entity: headerTitle
56593
+ });
56594
+ }, [t, goTo, module, token, selectedSubjects, getRedirectLink, selectOptions, headerTitle]);
56595
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
56596
+ children: [/*#__PURE__*/jsxRuntime.jsxs(AdminTable, {
56597
+ filters: filter,
56598
+ t: t,
56599
+ headerTitle: headerTitle,
56600
+ actionButton: [{
56601
+ icon: "Merge",
56602
+ onClick: () => setIsModalOpen(true),
56603
+ tooltip: t("admin::merge-subjects"),
56604
+ disabled: selectedSubjects.length < 2
56605
+ }],
56606
+ tabs: getTabs({
56607
+ t
56608
+ }),
56609
+ isMobile: isMobile,
56610
+ activeTab: activeTab,
56611
+ showFilters: showFilters,
56612
+ setShowFilters: setShowFilters,
56613
+ hasError: hasError,
56614
+ setHasError: setHasError,
56615
+ canClearSearch: canClearSearch,
56616
+ selectOptions: selectOptions,
56617
+ checkboxConfig: checkboxConfig$8,
56618
+ defaultTableFilters: {},
56619
+ breadcrumbs: breadcrumbs,
56620
+ children: [selectedSubjects.length > 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
56621
+ className: "flex flex-row ml-6 mt-5",
56622
+ style: {
56623
+ flexWrap: "wrap",
56624
+ gap: "8px"
56625
+ },
56626
+ children: selectedSubjects.map(account => /*#__PURE__*/jsxRuntime.jsxs(antd.Tag, {
56627
+ className: "flex flex-row gap-2 items-center",
56628
+ onClick: () => setSelectedSubjects(prev => prev.filter(a => a.datastakeId !== account.datastakeId)),
56629
+ style: {
56630
+ cursor: "pointer"
56631
+ },
56632
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
56633
+ children: account.datastakeId
56634
+ }), /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
56635
+ name: "Close",
56636
+ size: 10
56637
+ })]
56638
+ }, account.userId))
56639
+ }), /*#__PURE__*/jsxRuntime.jsx(DAFTable, {
56640
+ columns: columns,
56641
+ data: data,
56642
+ loading: loading,
56643
+ hideOnLoading: false,
56644
+ pagination: filter.pagination,
56645
+ rowKey: "id",
56646
+ selectOptions: selectOptions,
56647
+ doEmptyRows: true,
56648
+ setShowFilters: setShowFilters,
56649
+ filtersConfig: selectFiltersConfig$8,
56650
+ onFilterChange: filter.onFiltersChange,
56651
+ showFilters: showFilters,
56652
+ defaultFilters: filter.defaultFilters,
56653
+ onChange: filter.onTableChange
56654
+ })]
56655
+ }), /*#__PURE__*/jsxRuntime.jsx(CombineSubjectsModal, {
56656
+ isOpen: isCombineModalOpen,
56657
+ t: t,
56658
+ onClose: () => {
56659
+ setIsModalOpen(false);
56660
+ },
56661
+ onSuccess: data => {
56662
+ setIsModalOpen(false);
56663
+ setLoading(true);
56664
+ if (typeof mergeSubjectsFunction === 'function') {
56665
+ mergeSubjectsFunction(data);
56666
+ setSelectedSubjects([]);
56667
+ }
56668
+ },
56669
+ selectedSubjects: selectedSubjects,
56670
+ selectOptions: selectOptions || {},
56671
+ module: module,
56672
+ entity: headerTitle
56673
+ })]
56674
+ });
56675
+ }
56676
+
56264
56677
  const config$1 = [{
56265
56678
  label: "Details",
56266
56679
  key: "details",
@@ -62422,6 +62835,7 @@ exports.Steps = DAFSteps;
62422
62835
  exports.StickyTable = StickyTable;
62423
62836
  exports.StoreProvider = StoreProvider;
62424
62837
  exports.StyledTabs = StyledTabs;
62838
+ exports.SubjectsTable = SubjectsTable;
62425
62839
  exports.Table = DAFTable;
62426
62840
  exports.TableFilters = TableFilters;
62427
62841
  exports.Tabs = Tabs;