@undp/carbon-library 1.0.135-ghg-inventory.12.17 → 1.0.135-ghg-inventory.12.18

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cjs/index.js CHANGED
@@ -29483,14 +29483,23 @@ var GHGEmissionsComponent = function (props) {
29483
29483
  setOpenFinalizeFormModal(false);
29484
29484
  };
29485
29485
  var onOpenFinalizeFormModel = function () {
29486
- setActionInfo({
29487
- action: "".concat(t("ghgInventory:finalize")),
29488
- headerText: "".concat(t("ghgInventory:finalizeModelHeader")),
29489
- type: "primary",
29490
- icon: React.createElement(Icon.ClipboardCheck, null),
29486
+ form
29487
+ .validateFields()
29488
+ .then(function (values) {
29489
+ // Validation successful, set ActionInfo and open the form modal
29490
+ setActionInfo({
29491
+ action: "".concat(t("ghgInventory:finalize")),
29492
+ headerText: "".concat(t("ghgInventory:finalizeModelHeader")),
29493
+ type: "primary",
29494
+ icon: React.createElement(Icon.ClipboardCheck, null),
29495
+ });
29496
+ setErrorMsg('');
29497
+ setOpenFinalizeFormModal(true);
29498
+ })
29499
+ .catch(function (errorInfo) {
29500
+ // Validation failed
29501
+ console.log('Validation failed:', errorInfo);
29491
29502
  });
29492
- setErrorMsg('');
29493
- setOpenFinalizeFormModal(true);
29494
29503
  };
29495
29504
  var onSubmitForm = function (remarks, status) { return __awaiter(void 0, void 0, void 0, function () {
29496
29505
  var fields, payload, response, messageContent, error_1;
@@ -31023,14 +31032,23 @@ var GHGProjectionsComponent = function (props) {
31023
31032
  setOpenFinalizeFormModal(false);
31024
31033
  };
31025
31034
  var onOpenFinalizeFormModel = function () {
31026
- setActionInfo({
31027
- action: "".concat(t("ghgInventory:finalize")),
31028
- headerText: "".concat(t("ghgInventory:finalizeModelHeader")),
31029
- type: "primary",
31030
- icon: React.createElement(Icon.ClipboardCheck, null),
31035
+ form
31036
+ .validateFields()
31037
+ .then(function (values) {
31038
+ // Validation successful, set ActionInfo and open the form modal
31039
+ setActionInfo({
31040
+ action: "".concat(t("ghgInventory:finalize")),
31041
+ headerText: "".concat(t("ghgInventory:finalizeModelHeader")),
31042
+ type: "primary",
31043
+ icon: React.createElement(Icon.ClipboardCheck, null),
31044
+ });
31045
+ setErrorMsg('');
31046
+ setOpenFinalizeFormModal(true);
31047
+ })
31048
+ .catch(function (errorInfo) {
31049
+ // Validation failed
31050
+ console.log('Validation failed:', errorInfo);
31031
31051
  });
31032
- setErrorMsg('');
31033
- setOpenFinalizeFormModal(true);
31034
31052
  };
31035
31053
  var getProjectionData = function () { return __awaiter(void 0, void 0, void 0, function () {
31036
31054
  var response, error_1;