@undp/carbon-library 1.0.292-CARBON-369.2 → 1.0.292-CARBON-423.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cjs/index.js CHANGED
@@ -27628,7 +27628,7 @@ var EditableCell = function (_a) {
27628
27628
  React.createElement(antd.Input, { onBlur: function () { return onBlurHandler(record); }, placeholder: t("ndc:kpiPlaceHolder") }))) : (children)));
27629
27629
  };
27630
27630
 
27631
- var css_248z$7 = ".ndc-steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem;\n justify-content: center; }\n .ndc-steps-actions .action-btn {\n border: 1px solid #16b1ff;\n color: #16b1ff;\n margin-right: 1rem; }\n .ndc-steps-actions .back-btn {\n border: 1px solid rgba(140, 140, 140, 0.7);\n color: rgba(140, 140, 140, 0.7);\n margin-right: 1rem; }\n .ndc-steps-actions .mg-left-1 {\n margin-left: 1rem; }\n\n.ndc-details .ant-input-number-input-wrap {\n margin-right: 10px; }\n\n.ndc-details tbody {\n vertical-align: top; }\n\n.ndc-details td .ant-space-item {\n margin-top: 5px; }\n\n.ndc-details .btn-danger {\n color: #ff4d4f !important;\n border-color: #ff8183 !important; }\n";
27631
+ var css_248z$7 = ".ndc-steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem;\n justify-content: center; }\n .ndc-steps-actions .action-btn {\n border: 1px solid #16b1ff;\n color: #16b1ff;\n margin-right: 1rem; }\n .ndc-steps-actions .back-btn {\n border: 1px solid rgba(140, 140, 140, 0.7);\n color: rgba(140, 140, 140, 0.7);\n margin-right: 1rem; }\n .ndc-steps-actions .mg-left-1 {\n margin-left: 1rem; }\n\n.ndc-details .ant-input-number-input-wrap {\n margin-right: 10px; }\n\n.ndc-details tbody {\n vertical-align: top; }\n\n.ndc-details td .ant-space-item {\n margin-top: 5px; }\n\n.ndc-details .ant-table-pagination.ant-pagination {\n margin-top: 16px;\n margin-right: 0px;\n margin-left: 24px;\n margin-bottom: 0px; }\n\n.ndc-details .ndc-button-row {\n margin-top: 16px; }\n\n.ndc-details .btn-danger {\n color: #ff4d4f !important;\n border-color: #ff8183 !important; }\n";
27632
27632
  styleInject(css_248z$7);
27633
27633
 
27634
27634
  var NdcDetailsActionType;
@@ -28064,7 +28064,7 @@ var NdcDetailsComponent = function (props) {
28064
28064
  }
28065
28065
  else {
28066
28066
  setActionInfo({
28067
- action: "Finalize",
28067
+ action: "Finalise",
28068
28068
  headerText: t("ndc:finalizeApproveTitle"),
28069
28069
  text: t("ndc:finalizeApproveSubTitle"),
28070
28070
  type: "primary",
@@ -28135,7 +28135,7 @@ var NdcDetailsComponent = function (props) {
28135
28135
  !selectedPeriod.finalized && (React.createElement(antd.Row, { justify: "center" },
28136
28136
  React.createElement(antd.Button, { className: "btnAddNewMainAct", disabled: isMainActionInEditMode(), onClick: onClickedAddNewNdcDetail, type: "default" }, t("ndc:addNdcAction"))));
28137
28137
  } })))),
28138
- isGovernmentUser && selectedPeriod && !selectedPeriod.finalized ? (React.createElement(antd.Row, { justify: "end" }, isMainActionInEditMode() ? (React.createElement(React.Fragment, null,
28138
+ isGovernmentUser && selectedPeriod && !selectedPeriod.finalized ? (React.createElement(antd.Row, { justify: "end", className: "ndc-button-row" }, isMainActionInEditMode() ? (React.createElement(React.Fragment, null,
28139
28139
  React.createElement(antd.Button, { className: "mg-left-1", disabled: true }, t("ndc:delete")),
28140
28140
  React.createElement(antd.Button, { className: "mg-left-1", disabled: true }, t("ndc:finalize")))) : (React.createElement(React.Fragment, null,
28141
28141
  React.createElement(antd.Button, { className: "mg-left-1 btn-danger", onClick: onClickedDeletePeriod, htmlType: "submit", loading: loading }, t("ndc:delete")),
@@ -28165,11 +28165,21 @@ var NdcDetailsComponent = function (props) {
28165
28165
  return __generator(this, function (_a) {
28166
28166
  switch (_a.label) {
28167
28167
  case 0:
28168
- _a.trys.push([0, 4, , 5]);
28169
- if (!(selectedDateRangeRef &&
28170
- selectedDateRangeRef.current &&
28171
- selectedDateRangeRef.current.startYear &&
28172
- selectedDateRangeRef.current.endYear)) return [3 /*break*/, 3];
28168
+ if (!selectedDateRangeRef ||
28169
+ !selectedDateRangeRef.current ||
28170
+ !selectedDateRangeRef.current.startYear ||
28171
+ !selectedDateRangeRef.current.endYear) {
28172
+ antd.message.open({
28173
+ type: "error",
28174
+ content: t("ndc:invalidYearsSelected"),
28175
+ duration: 3,
28176
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
28177
+ });
28178
+ return [2 /*return*/];
28179
+ }
28180
+ _a.label = 1;
28181
+ case 1:
28182
+ _a.trys.push([1, 5, , 6]);
28173
28183
  periodItem_1 = {
28174
28184
  startYear: selectedDateRangeRef.current.startYear,
28175
28185
  endYear: selectedDateRangeRef.current.endYear,
@@ -28179,27 +28189,28 @@ var NdcDetailsComponent = function (props) {
28179
28189
  return inRange(periodItem_1.startYear, item.startYear, item.endYear) ||
28180
28190
  inRange(periodItem_1.endYear, item.startYear, item.endYear);
28181
28191
  });
28182
- if (!(existingIndex === -1)) return [3 /*break*/, 2];
28192
+ if (!(existingIndex === -1)) return [3 /*break*/, 3];
28183
28193
  return [4 /*yield*/, post("national/programme/addNdcDetailsPeriod", __assign({}, periodItem_1))];
28184
- case 1:
28194
+ case 2:
28185
28195
  response = _a.sent();
28186
28196
  if (response && response.data) {
28187
28197
  addedPeriodItem = response.data;
28188
28198
  updatedPeriodItem_1 = __assign(__assign({}, addedPeriodItem), { key: addedPeriodItem.id, label: "".concat(addedPeriodItem.startYear, "-").concat(addedPeriodItem.endYear) });
28189
28199
  setPeriodItems(function (items) { return __spreadArray(__spreadArray([], items, true), [updatedPeriodItem_1], false); });
28190
28200
  setSelectedPeriod(updatedPeriodItem_1);
28201
+ selectedDateRangeRef.current = null;
28191
28202
  }
28192
- return [3 /*break*/, 3];
28193
- case 2:
28203
+ return [3 /*break*/, 4];
28204
+ case 3:
28194
28205
  antd.message.open({
28195
28206
  type: "error",
28196
28207
  content: t("ndc:rangeAlreadyExists"),
28197
28208
  duration: 3,
28198
28209
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
28199
28210
  });
28200
- _a.label = 3;
28201
- case 3: return [3 /*break*/, 5];
28202
- case 4:
28211
+ _a.label = 4;
28212
+ case 4: return [3 /*break*/, 6];
28213
+ case 5:
28203
28214
  exception_3 = _a.sent();
28204
28215
  antd.message.open({
28205
28216
  type: "error",
@@ -28207,8 +28218,8 @@ var NdcDetailsComponent = function (props) {
28207
28218
  duration: 3,
28208
28219
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
28209
28220
  });
28210
- return [3 /*break*/, 5];
28211
- case 5: return [2 /*return*/];
28221
+ return [3 /*break*/, 6];
28222
+ case 6: return [2 /*return*/];
28212
28223
  }
28213
28224
  });
28214
28225
  }); };
@@ -28230,6 +28241,12 @@ var NdcDetailsComponent = function (props) {
28230
28241
  selectedDateRangeRef.current = period;
28231
28242
  }
28232
28243
  }
28244
+ else {
28245
+ selectedDateRangeRef.current = {
28246
+ startYear: range,
28247
+ endYear: range,
28248
+ };
28249
+ }
28233
28250
  };
28234
28251
  var onTabChange = function (key) {
28235
28252
  var selectedPeriod = periodItems.find(function (item) { return item.key === key; });
@@ -28262,7 +28279,7 @@ var NdcDetailsComponent = function (props) {
28262
28279
  actionResponse = _a.sent();
28263
28280
  return [3 /*break*/, 9];
28264
28281
  case 5:
28265
- if (!(actionInfo.action === "Finalize")) return [3 /*break*/, 7];
28282
+ if (!(actionInfo.action === "Finalise")) return [3 /*break*/, 7];
28266
28283
  return [4 /*yield*/, post("national/programme/finalizeNdcDetailsPeriod", {
28267
28284
  id: selectedPeriod.key,
28268
28285
  })];
@@ -28298,7 +28315,7 @@ var NdcDetailsComponent = function (props) {
28298
28315
  });
28299
28316
  fetchNdcDetailPeriods();
28300
28317
  }
28301
- else if (actionInfo.action === "Finalize") {
28318
+ else if (actionInfo.action === "Finalise") {
28302
28319
  antd.message.open({
28303
28320
  type: "success",
28304
28321
  content: t("ndc:finalizeSuccessMsg"),