@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/esm/index.js CHANGED
@@ -23616,6 +23616,7 @@ var NdcDetailsComponent = function (props) {
23616
23616
  var _c = useState([]), periodItems = _c[0], setPeriodItems = _c[1];
23617
23617
  var _d = useState("add_new"), selectedTab = _d[0], setSelectedTab = _d[1];
23618
23618
  var selectedPeriod = useRef({});
23619
+ var addedNdcDetailId = useRef(0);
23619
23620
  var userInfoState = useUserContext().userInfoState;
23620
23621
  var isAddRangeVisible = function () {
23621
23622
  return (((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY ||
@@ -23677,11 +23678,14 @@ var NdcDetailsComponent = function (props) {
23677
23678
  }); } });
23678
23679
  });
23679
23680
  function onAddNewNdcDetail() {
23681
+ var range = selectedTab.split("-");
23682
+ addedNdcDetailId.current = addedNdcDetailId.current + 1;
23680
23683
  var newData = {
23681
- startDate: new Date("2014-12-24 23:12:00"),
23682
- endDate: new Date("2014-12-24 23:12:00"),
23683
- nationalPlanObj: "sample text2",
23684
- kpi: 34,
23684
+ key: addedNdcDetailId.current,
23685
+ startDate: new Date("".concat(Number(range[0]), "-01-24 23:12:00")),
23686
+ endDate: new Date("".concat(Number(range[0]), "-12-24 23:12:00")),
23687
+ nationalPlanObj: t("ndc:enterNewPlanTxt"),
23688
+ kpi: 0,
23685
23689
  };
23686
23690
  setNdcDetailsData(__spreadArray(__spreadArray([], ndcDetailsData, true), [newData], false));
23687
23691
  }
@@ -23769,30 +23773,35 @@ var NdcDetailsComponent = function (props) {
23769
23773
  useEffect(function () {
23770
23774
  var defaultNdcDetails = [
23771
23775
  {
23776
+ key: 1,
23772
23777
  startDate: new Date("2019-03-25"),
23773
23778
  endDate: new Date("2020-03-25"),
23774
23779
  nationalPlanObj: "Enhance value addition in key growth opportunities",
23775
23780
  kpi: 25,
23776
23781
  },
23777
23782
  {
23783
+ key: 2,
23778
23784
  startDate: new Date("2019-03-25"),
23779
23785
  endDate: new Date("2019-08-25"),
23780
23786
  nationalPlanObj: "Strengthen the private sector to create 10,000 jobs",
23781
23787
  kpi: 10500,
23782
23788
  },
23783
23789
  {
23790
+ key: 3,
23784
23791
  startDate: new Date("2021-03-25"),
23785
23792
  endDate: new Date("2022-03-25"),
23786
23793
  nationalPlanObj: "Consolidate and increase the stock and quality of productive infrastructure by 50%",
23787
23794
  kpi: 48,
23788
23795
  },
23789
23796
  {
23797
+ key: 4,
23790
23798
  startDate: new Date("2022-03-25"),
23791
23799
  endDate: new Date("2022-05-25"),
23792
23800
  nationalPlanObj: "Enhance the productivity and social wellbeing of the population",
23793
23801
  kpi: 20,
23794
23802
  },
23795
23803
  {
23804
+ key: 5,
23796
23805
  startDate: new Date("2022-03-25"),
23797
23806
  endDate: new Date("2023-03-25"),
23798
23807
  nationalPlanObj: "Strengthen the role of the state in guiding and facilitating development",
@@ -23824,6 +23833,7 @@ var NdcDetailsComponent = function (props) {
23824
23833
  children: addNewPeriodContent(),
23825
23834
  });
23826
23835
  }
23836
+ addedNdcDetailId.current = 5;
23827
23837
  setPeriodItems(initialPeriods);
23828
23838
  periodItemsRef.current = initialPeriods;
23829
23839
  setNdcDetailsData(defaultNdcDetails);