@undp/carbon-library 1.0.135-CARBON-343.13 → 1.0.135-CARBON-343.15

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cjs/index.js CHANGED
@@ -23636,6 +23636,7 @@ var NdcDetailsComponent = function (props) {
23636
23636
  var _c = React.useState([]), periodItems = _c[0], setPeriodItems = _c[1];
23637
23637
  var _d = React.useState("add_new"), selectedTab = _d[0], setSelectedTab = _d[1];
23638
23638
  var selectedPeriod = React.useRef({});
23639
+ var addedNdcDetailId = React.useRef(0);
23639
23640
  var userInfoState = useUserContext().userInfoState;
23640
23641
  var isAddRangeVisible = function () {
23641
23642
  return (((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.MINISTRY ||
@@ -23697,11 +23698,14 @@ var NdcDetailsComponent = function (props) {
23697
23698
  }); } });
23698
23699
  });
23699
23700
  function onAddNewNdcDetail() {
23701
+ var range = selectedTab.split("-");
23702
+ addedNdcDetailId.current = addedNdcDetailId.current + 1;
23700
23703
  var newData = {
23701
- startDate: new Date("2014-12-24 23:12:00"),
23702
- endDate: new Date("2014-12-24 23:12:00"),
23703
- nationalPlanObj: "sample text2",
23704
- kpi: 34,
23704
+ key: addedNdcDetailId.current,
23705
+ startDate: new Date("".concat(Number(range[0]), "-01-24 23:12:00")),
23706
+ endDate: new Date("".concat(Number(range[0]), "-12-24 23:12:00")),
23707
+ nationalPlanObj: t("ndc:enterNewPlanTxt"),
23708
+ kpi: 0,
23705
23709
  };
23706
23710
  setNdcDetailsData(__spreadArray(__spreadArray([], ndcDetailsData, true), [newData], false));
23707
23711
  }
@@ -23789,30 +23793,35 @@ var NdcDetailsComponent = function (props) {
23789
23793
  React.useEffect(function () {
23790
23794
  var defaultNdcDetails = [
23791
23795
  {
23796
+ key: 1,
23792
23797
  startDate: new Date("2019-03-25"),
23793
23798
  endDate: new Date("2020-03-25"),
23794
23799
  nationalPlanObj: "Enhance value addition in key growth opportunities",
23795
23800
  kpi: 25,
23796
23801
  },
23797
23802
  {
23803
+ key: 2,
23798
23804
  startDate: new Date("2019-03-25"),
23799
23805
  endDate: new Date("2019-08-25"),
23800
23806
  nationalPlanObj: "Strengthen the private sector to create 10,000 jobs",
23801
23807
  kpi: 10500,
23802
23808
  },
23803
23809
  {
23810
+ key: 3,
23804
23811
  startDate: new Date("2021-03-25"),
23805
23812
  endDate: new Date("2022-03-25"),
23806
23813
  nationalPlanObj: "Consolidate and increase the stock and quality of productive infrastructure by 50%",
23807
23814
  kpi: 48,
23808
23815
  },
23809
23816
  {
23817
+ key: 4,
23810
23818
  startDate: new Date("2022-03-25"),
23811
23819
  endDate: new Date("2022-05-25"),
23812
23820
  nationalPlanObj: "Enhance the productivity and social wellbeing of the population",
23813
23821
  kpi: 20,
23814
23822
  },
23815
23823
  {
23824
+ key: 5,
23816
23825
  startDate: new Date("2022-03-25"),
23817
23826
  endDate: new Date("2023-03-25"),
23818
23827
  nationalPlanObj: "Strengthen the role of the state in guiding and facilitating development",
@@ -23844,6 +23853,7 @@ var NdcDetailsComponent = function (props) {
23844
23853
  children: addNewPeriodContent(),
23845
23854
  });
23846
23855
  }
23856
+ addedNdcDetailId.current = 5;
23847
23857
  setPeriodItems(initialPeriods);
23848
23858
  periodItemsRef.current = initialPeriods;
23849
23859
  setNdcDetailsData(defaultNdcDetails);