@undp/carbon-library 1.0.293-CARBON-425.0 → 1.0.293-CARBON-347.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/esm/index.js CHANGED
@@ -1277,6 +1277,11 @@ var InvestmentCreationType;
1277
1277
  InvestmentCreationType["EXISTING"] = "Existing";
1278
1278
  InvestmentCreationType["NEW"] = "New";
1279
1279
  })(InvestmentCreationType || (InvestmentCreationType = {}));
1280
+ var InvestmentOwnershipType;
1281
+ (function (InvestmentOwnershipType) {
1282
+ InvestmentOwnershipType["PROJECT"] = "Project";
1283
+ InvestmentOwnershipType["NATIONAL"] = "National";
1284
+ })(InvestmentOwnershipType || (InvestmentOwnershipType = {}));
1280
1285
  var InvestmentStream;
1281
1286
  (function (InvestmentStream) {
1282
1287
  InvestmentStream["CLIMATE_FINANCE"] = "ClimateFinance";
@@ -6828,9 +6833,7 @@ var AddNewCompanyComponent = function (props) {
6828
6833
  }); },
6829
6834
  },
6830
6835
  ] },
6831
- React.createElement(InputNumber, { style: { width: "100%" }, size: "large", min: 0, max: 99, formatter: function (value) {
6832
- return "".concat(value ? Math.round(value) : "", "%");
6833
- }, parser: function (value) { return value.replace("%", ""); } })))))))),
6836
+ React.createElement(InputNumber, { style: { width: "100%" }, size: "large", min: 1, max: 99, formatter: function (value) { return "".concat(Math.round(value), "%"); }, parser: function (value) { return value.replace("%", ""); } })))))))),
6834
6837
  React.createElement("div", { className: "steps-actions" }, isUpdate ? (React.createElement(Row, null,
6835
6838
  React.createElement(Button, { loading: loading, onClick: onCancel }, t("addCompany:cancel")),
6836
6839
  React.createElement(Button, { loading: loading, className: "mg-left-1", type: "primary", htmlType: "submit" }, t("addCompany:submit")))) : (current === 0 && (React.createElement(Button, { type: "primary", htmlType: "submit" }, t("addCompany:next")))))))));
@@ -15811,7 +15814,7 @@ var UserManagementComponent = function (props) {
15811
15814
  React.createElement(UserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: handleOk, onActionCanceled: handleCancel, openModal: openDeleteConfirmationModal, errorMsg: errorMsg, loading: loading })));
15812
15815
  };
15813
15816
 
15814
- var css_248z$m = ".steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem;\n justify-content: flex-start; }\n\n.investment-title-bar {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n padding: 0px 0px 30px 0px; }\n .investment-title-bar .title {\n display: flex;\n flex-direction: column;\n justify-content: space-between; }\n .investment-title-bar .actions {\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n .investment-title-bar .flex-display {\n margin-left: 15px; }\n\n.ownership-container {\n padding: 15px 0px; }\n .ownership-container .label {\n color: rgba(58, 53, 65, 0.5); }\n\n.separator {\n padding: 5px;\n color: #d8d8d8; }\n\n.role-group .ant-col-13 {\n max-width: 320px; }\n\n.role-group .condition-radio-container {\n width: 48%;\n text-align: center; }\n .role-group .condition-radio-container .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled) {\n color: #ffffff !important;\n border-color: #9155fd !important;\n box-shadow: none;\n max-width: 200px; }\n\n.role-group .ant-radio-button-wrapper::before {\n background-color: transparent; }\n\n.role-group .anticon {\n margin-right: 0.5rem; }\n\n.role-group .ant-radio-button-wrapper {\n border: 1px solid #d9d9d9;\n color: rgba(140, 140, 140, 0.7) !important;\n width: 100% !important; }\n\n.role-group .condition-radio {\n width: 100%;\n text-transform: uppercase; }\n .role-group .condition-radio .ant-radio-button-checked {\n background: #9155fd;\n color: #ffffff; }\n\n.role-group .role-icons {\n margin-right: 5px; }\n\n.investment-management .role-icon {\n padding: 0.5rem 0.6rem; }\n\n.investment-management .ant-tag {\n border: none; }\n\n.investment-management .ant-checkbox-checked .ant-checkbox-input[value='Rejected'] + .ant-checkbox-inner {\n background-color: rgba(237, 77, 71, 0.6);\n border: none; }\n\n.investment-management .ant-checkbox-checked .ant-checkbox-input[value='Cancelled'] + .ant-checkbox-inner {\n background-color: rgba(58, 53, 65, 0.4);\n border: none; }\n\n.investment-management .ant-checkbox-checked .ant-checkbox-input[value='Accepted'] + .ant-checkbox-inner {\n background-color: #16b1ff;\n border: none; }\n\n.investment-management .ant-checkbox-checked .ant-checkbox-input[value='Pending'] + .ant-checkbox-inner {\n background-color: rgba(118, 195, 39, 0.6);\n border: none; }\n\n.investment-management .ant-checkbox-checked .ant-checkbox-input[value='Recognised'] + .ant-checkbox-inner {\n background-color: #976ed7;\n border: none; }\n\n.investment-management .ant-checkbox-checked .ant-checkbox-input[value='NotRecognised'] + .ant-checkbox-inner {\n background-color: #ffa070;\n border: none; }\n\n.add-programme-main-container .adding-section .form-section .investment-sought-form-container .investment-sought-form .investment-radio-button .ant-radio-group {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n justify-content: space-between;\n width: fit-content; }\n\n.add-programme-main-container .adding-section .form-section .investment-sought-form-container .investment-sought-form .details-part-two .row .ant-picker-large {\n height: 40px !important;\n width: 100%; }\n";
15817
+ var css_248z$m = ".steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem;\n justify-content: flex-start; }\n\n.details-part-two .ant-input-number {\n width: 50%;\n margin-left: 15px; }\n\n.investment-title-bar {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n padding: 0px 0px 30px 0px; }\n .investment-title-bar .title {\n display: flex;\n flex-direction: column;\n justify-content: space-between; }\n .investment-title-bar .actions {\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n .investment-title-bar .flex-display {\n margin-left: 15px; }\n\n.ownership-container {\n padding: 15px 0px; }\n .ownership-container .label {\n color: rgba(58, 53, 65, 0.5); }\n\n.separator {\n padding: 5px;\n color: #d8d8d8; }\n\n.role-group .ant-col-13 {\n max-width: 320px; }\n\n.role-group .condition-radio-container {\n width: 48%;\n text-align: center; }\n .role-group .condition-radio-container .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled) {\n color: #ffffff !important;\n border-color: #9155fd !important;\n box-shadow: none;\n max-width: 200px; }\n\n.role-group .ant-radio-button-wrapper::before {\n background-color: transparent; }\n\n.role-group .anticon {\n margin-right: 0.5rem; }\n\n.role-group .ant-radio-button-wrapper {\n border: 1px solid #d9d9d9;\n color: rgba(140, 140, 140, 0.7) !important;\n width: 100% !important; }\n\n.role-group .condition-radio {\n width: 100%;\n text-transform: uppercase; }\n .role-group .condition-radio .ant-radio-button-checked {\n background: #9155fd;\n color: #ffffff; }\n\n.role-group .role-icons {\n margin-right: 5px; }\n\n.investment-management .role-icon {\n padding: 0.5rem 0.6rem; }\n\n.investment-management .ant-tag {\n border: none; }\n\n.investment-management .ant-checkbox-checked .ant-checkbox-input[value=\"Rejected\"] + .ant-checkbox-inner {\n background-color: rgba(237, 77, 71, 0.6);\n border: none; }\n\n.investment-management .ant-checkbox-checked .ant-checkbox-input[value=\"Cancelled\"] + .ant-checkbox-inner {\n background-color: rgba(58, 53, 65, 0.4);\n border: none; }\n\n.investment-management .ant-checkbox-checked .ant-checkbox-input[value=\"Accepted\"] + .ant-checkbox-inner {\n background-color: #16b1ff;\n border: none; }\n\n.investment-management .ant-checkbox-checked .ant-checkbox-input[value=\"Pending\"] + .ant-checkbox-inner {\n background-color: rgba(118, 195, 39, 0.6);\n border: none; }\n\n.investment-management .ant-checkbox-checked .ant-checkbox-input[value=\"Recognised\"] + .ant-checkbox-inner {\n background-color: #976ed7;\n border: none; }\n\n.investment-management .ant-checkbox-checked .ant-checkbox-input[value=\"NotRecognised\"] + .ant-checkbox-inner {\n background-color: #ffa070;\n border: none; }\n\n.add-programme-main-container .adding-section .form-section .investment-sought-form-container .investment-sought-form .investment-radio-button .ant-radio-group {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n justify-content: space-between;\n width: fit-content; }\n\n.add-programme-main-container .adding-section .form-section .investment-sought-form-container .investment-sought-form .details-part-two .row .ant-picker-large {\n height: 40px !important;\n width: 100%; }\n";
15815
15818
  styleInject(css_248z$m);
15816
15819
 
15817
15820
  var Loading = function () {
@@ -15831,22 +15834,34 @@ var InsurancePayback;
15831
15834
 
15832
15835
  var RangePicker$3 = DatePicker.RangePicker;
15833
15836
  var InvestmentCreationComponent = function (props) {
15834
- var t = props.t, useLocation = props.useLocation, onNavigateToProgrammeManagementView = props.onNavigateToProgrammeManagementView, onNavigateToProgrammeView = props.onNavigateToProgrammeView;
15837
+ var t = props.t, useLocation = props.useLocation, onNavigateToProgrammeManagementView = props.onNavigateToProgrammeManagementView, onNavigateToProgrammeView = props.onNavigateToProgrammeView, onNavigateToInvestmentManagementView = props.onNavigateToInvestmentManagementView;
15835
15838
  var state = useLocation().state;
15836
15839
  var _a = useState(), data = _a[0], setData = _a[1];
15840
+ var _b = useState({}), companyNames = _b[0], setCompanyNames = _b[1];
15841
+ var _c = useState({}); _c[0]; var setUserOrganization = _c[1];
15842
+ var _d = useState({}), investmentNames = _d[0], setInvestmentNames = _d[1];
15843
+ var _e = useState(), projectData = _e[0], setProjectData = _e[1];
15844
+ var _f = useState(), investmentData = _f[0], setInvestmentData = _f[1];
15845
+ var _g = useState([]), allProjectData = _g[0], setAllProjectData = _g[1];
15837
15846
  var formOne = Form.useForm()[0];
15838
15847
  var formTwo = Form.useForm()[0];
15839
15848
  var post = useConnection().post;
15840
- var _b = useState(false), loading = _b[0], setLoading = _b[1];
15841
- var _c = useState("New"), typeCreation = _c[0], setTypeCreation = _c[1];
15842
- var _d = useState(false), loadingList = _d[0], setLoadingList = _d[1];
15843
- var _e = useState(0), current = _e[0], setCurrent = _e[1];
15844
- var _f = useState(0), currentPercTotal = _f[0], setCurrentPercTotal = _f[1];
15845
- var _g = useState([]), organisationsList = _g[0], setOrganisationList = _g[1];
15846
- var _h = useState([]), instrument = _h[0], setInstrument = _h[1];
15847
- var _j = useState(), stepOneData = _j[0], setStepOneData = _j[1];
15848
- var _k = useState(), govData = _k[0], setGovData = _k[1];
15849
+ var _h = useState(false), loading = _h[0], setLoading = _h[1];
15850
+ var _j = useState("New"), typeCreation = _j[0], setTypeCreation = _j[1];
15851
+ var _k = useState(InvestmentOwnershipType.PROJECT), investmentOwnershipType = _k[0], setInvestmentOwnershipType = _k[1];
15852
+ var _l = useState(false), loadingList = _l[0], setLoadingList = _l[1];
15853
+ var _m = useState(false), loadingInvestment = _m[0], setLoadingInvestment = _m[1];
15854
+ var _o = useState(false), loadingProgData = _o[0], setLoadingProgData = _o[1];
15855
+ var _p = useState(0), current = _p[0], setCurrent = _p[1];
15856
+ var _q = useState(0), currentPercTotal = _q[0], setCurrentPercTotal = _q[1];
15857
+ var _r = useState([]), organisationsList = _r[0], setOrganisationList = _r[1];
15858
+ var _s = useState([]), nationalInvestmentList = _s[0], setNationalInvestmentList = _s[1];
15859
+ var _t = useState([]), instrument = _t[0], setInstrument = _t[1];
15860
+ var _u = useState(), stepOneData = _u[0], setStepOneData = _u[1];
15861
+ var _v = useState(), govData = _v[0], setGovData = _v[1];
15849
15862
  var userInfoState = useUserContext().userInfoState;
15863
+ var _w = useState([]), ministrySectoralScope = _w[0], setMinistrySectoralScope = _w[1];
15864
+ var _x = useState({}), prevInvestor = _x[0], setPrevInvestor = _x[1];
15850
15865
  var instrumentOptions = Object.keys(Instrument).map(function (k, index) { return ({
15851
15866
  label: addSpaces(Object.values(Instrument)[index]),
15852
15867
  value: Object.values(Instrument)[index],
@@ -15898,52 +15913,225 @@ var InvestmentCreationComponent = function (props) {
15898
15913
  }
15899
15914
  });
15900
15915
  }); };
15901
- var getOrganisationsDetails = function () { return __awaiter(void 0, void 0, void 0, function () {
15902
- var filterAnd, _i, _a, c, response, error_2;
15916
+ var getAllProjectData = function () { return __awaiter(void 0, void 0, void 0, function () {
15917
+ var response, error_2;
15918
+ return __generator(this, function (_a) {
15919
+ switch (_a.label) {
15920
+ case 0:
15921
+ setLoadingProgData(true);
15922
+ _a.label = 1;
15923
+ case 1:
15924
+ _a.trys.push([1, 5, 6, 7]);
15925
+ if (!data) return [3 /*break*/, 4];
15926
+ if (!!(data === null || data === void 0 ? void 0 : data.programmeId)) return [3 /*break*/, 3];
15927
+ console.log("data non existing", data);
15928
+ console.log("getting all Project data");
15929
+ return [4 /*yield*/, post("national/programme/query", {
15930
+ page: 1,
15931
+ size: 100,
15932
+ filterAnd: [
15933
+ {
15934
+ key: "currentStage",
15935
+ operation: "!=",
15936
+ value: ProgrammeStageUnified.Rejected,
15937
+ },
15938
+ ],
15939
+ })];
15940
+ case 2:
15941
+ response = _a.sent();
15942
+ if (response.data) {
15943
+ setAllProjectData(response === null || response === void 0 ? void 0 : response.data);
15944
+ console.log("all Project data", response === null || response === void 0 ? void 0 : response.data);
15945
+ }
15946
+ return [3 /*break*/, 4];
15947
+ case 3:
15948
+ console.log("setting current Project data");
15949
+ setAllProjectData([data]);
15950
+ _a.label = 4;
15951
+ case 4: return [3 /*break*/, 7];
15952
+ case 5:
15953
+ error_2 = _a.sent();
15954
+ console.log("Error in getting all programme data", error_2);
15955
+ return [3 /*break*/, 7];
15956
+ case 6:
15957
+ setLoadingProgData(false);
15958
+ return [7 /*endfinally*/];
15959
+ case 7: return [2 /*return*/];
15960
+ }
15961
+ });
15962
+ }); };
15963
+ var setSelectedProgramme = function (value) { return __awaiter(void 0, void 0, void 0, function () {
15964
+ var _i, allProjectData_1, obj;
15965
+ return __generator(this, function (_a) {
15966
+ console.log("setSelectedProgramme", value);
15967
+ for (_i = 0, allProjectData_1 = allProjectData; _i < allProjectData_1.length; _i++) {
15968
+ obj = allProjectData_1[_i];
15969
+ if (obj.programmeId == value) {
15970
+ setProjectData(obj);
15971
+ break;
15972
+ }
15973
+ }
15974
+ return [2 /*return*/];
15975
+ });
15976
+ }); };
15977
+ var setSelectedInvestment = function (value) { return __awaiter(void 0, void 0, void 0, function () {
15978
+ return __generator(this, function (_a) {
15979
+ console.log("setSelectedInvestment", value);
15980
+ setInvestmentData(investmentNames[value]);
15981
+ return [2 /*return*/];
15982
+ });
15983
+ }); };
15984
+ var getNationalInvestmentDetails = function () { return __awaiter(void 0, void 0, void 0, function () {
15985
+ var optionalFilters, filterAnd, filterOr_1, response, investmentData_1, _i, _a, investment, error_3;
15903
15986
  return __generator(this, function (_b) {
15904
15987
  switch (_b.label) {
15905
15988
  case 0:
15906
- setLoadingList(true);
15989
+ setLoadingInvestment(true);
15907
15990
  _b.label = 1;
15908
15991
  case 1:
15909
15992
  _b.trys.push([1, 3, 4, 5]);
15993
+ optionalFilters = {};
15910
15994
  filterAnd = [];
15911
15995
  filterAnd = [
15912
15996
  {
15913
- key: "companyRole",
15997
+ key: "category",
15914
15998
  operation: "=",
15915
- value: CompanyRole.PROGRAMME_DEVELOPER.toString(),
15999
+ value: InvestmentOwnershipType.NATIONAL.toString(),
16000
+ },
16001
+ {
16002
+ key: "amount",
16003
+ operation: ">",
16004
+ value: 0,
15916
16005
  },
15917
16006
  ];
15918
16007
  if ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.PROGRAMME_DEVELOPER) {
15919
16008
  filterAnd.push({
15920
- key: "companyId",
15921
- operation: "!=",
16009
+ key: "toCompanyId",
16010
+ operation: "=",
15922
16011
  value: userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyId,
15923
16012
  });
15924
16013
  }
15925
- for (_i = 0, _a = data === null || data === void 0 ? void 0 : data.companyId; _i < _a.length; _i++) {
15926
- c = _a[_i];
15927
- filterAnd.push({
15928
- key: "companyId",
15929
- operation: "!=",
15930
- value: c,
16014
+ else if (((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT ||
16015
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY) &&
16016
+ (data === null || data === void 0 ? void 0 : data.programmeId)) {
16017
+ filterOr_1 = [];
16018
+ data.companyId.map(function (id) {
16019
+ return filterOr_1.push({
16020
+ key: "toCompanyId",
16021
+ operation: "=",
16022
+ value: id,
16023
+ });
15931
16024
  });
16025
+ optionalFilters.filterOr = filterOr_1;
15932
16026
  }
15933
- return [4 /*yield*/, post("national/organisation/queryNames", {
16027
+ return [4 /*yield*/, post("national/programme/investmentQuery", __assign({ page: 1, size: 100, filterAnd: filterAnd }, optionalFilters))];
16028
+ case 2:
16029
+ response = _b.sent();
16030
+ if (response.data) {
16031
+ setNationalInvestmentList(response === null || response === void 0 ? void 0 : response.data);
16032
+ investmentData_1 = {};
16033
+ for (_i = 0, _a = response === null || response === void 0 ? void 0 : response.data; _i < _a.length; _i++) {
16034
+ investment = _a[_i];
16035
+ investmentData_1[investment.requestId] = investment;
16036
+ }
16037
+ setInvestmentNames(investmentData_1);
16038
+ console.log(investmentData_1);
16039
+ }
16040
+ return [3 /*break*/, 5];
16041
+ case 3:
16042
+ error_3 = _b.sent();
16043
+ console.log("Error in getting national Investments list", error_3);
16044
+ return [3 /*break*/, 5];
16045
+ case 4:
16046
+ setLoadingInvestment(false);
16047
+ return [7 /*endfinally*/];
16048
+ case 5: return [2 /*return*/];
16049
+ }
16050
+ });
16051
+ }); };
16052
+ var getUserOrganization = function () { return __awaiter(void 0, void 0, void 0, function () {
16053
+ var response, error_4;
16054
+ return __generator(this, function (_a) {
16055
+ switch (_a.label) {
16056
+ case 0:
16057
+ _a.trys.push([0, 2, , 3]);
16058
+ return [4 /*yield*/, post("national/organisation/query", {
15934
16059
  page: 1,
15935
16060
  size: 100,
15936
- filterAnd: filterAnd,
16061
+ filterAnd: [
16062
+ { key: "companyId", operation: "=", value: userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyId },
16063
+ ],
15937
16064
  })];
16065
+ case 1:
16066
+ response = _a.sent();
16067
+ console.log("getUserOrganization", response.data[0]);
16068
+ setUserOrganization(response.data[0]);
16069
+ setMinistrySectoralScope(response.data[0].sectoralScope);
16070
+ return [3 /*break*/, 3];
15938
16071
  case 2:
15939
- response = _b.sent();
16072
+ error_4 = _a.sent();
16073
+ console.log("Error in getting user organization", error_4);
16074
+ return [3 /*break*/, 3];
16075
+ case 3: return [2 /*return*/];
16076
+ }
16077
+ });
16078
+ }); };
16079
+ var getOrganisationsDetails = function () { return __awaiter(void 0, void 0, void 0, function () {
16080
+ var filterAnd, filterOr, _i, _a, c, filters, response, companyName, _b, _c, company, error_5;
16081
+ return __generator(this, function (_d) {
16082
+ switch (_d.label) {
16083
+ case 0:
16084
+ setLoadingList(true);
16085
+ _d.label = 1;
16086
+ case 1:
16087
+ _d.trys.push([1, 3, 4, 5]);
16088
+ filterAnd = [];
16089
+ filterOr = [];
16090
+ filterAnd = [
16091
+ {
16092
+ key: "companyRole",
16093
+ operation: "=",
16094
+ value: CompanyRole.PROGRAMME_DEVELOPER.toString(),
16095
+ },
16096
+ ];
16097
+ // if (userInfoState?.companyRole === CompanyRole.PROGRAMME_DEVELOPER) {
16098
+ // filterAnd.push({
16099
+ // key: "companyId",
16100
+ // operation: "!=",
16101
+ // value: userInfoState?.companyId,
16102
+ // });
16103
+ // }
16104
+ if (data === null || data === void 0 ? void 0 : data.companyId) {
16105
+ for (_i = 0, _a = data === null || data === void 0 ? void 0 : data.companyId; _i < _a.length; _i++) {
16106
+ c = _a[_i];
16107
+ filterOr.push({
16108
+ key: "companyId",
16109
+ operation: "=",
16110
+ value: c,
16111
+ });
16112
+ }
16113
+ }
16114
+ filters = void 0;
16115
+ if (filterOr.length) {
16116
+ filters.filterOr = filterOr;
16117
+ }
16118
+ return [4 /*yield*/, post("national/organisation/queryNames", __assign({ page: 1, size: 100, filterAnd: filterAnd }, filters))];
16119
+ case 2:
16120
+ response = _d.sent();
15940
16121
  if (response.data) {
15941
16122
  setOrganisationList(response === null || response === void 0 ? void 0 : response.data);
16123
+ companyName = {};
16124
+ for (_b = 0, _c = response === null || response === void 0 ? void 0 : response.data; _b < _c.length; _b++) {
16125
+ company = _c[_b];
16126
+ companyName[Number(company.companyId)] = company.name;
16127
+ }
16128
+ setCompanyNames(companyName);
16129
+ console.log(companyName);
15942
16130
  }
15943
16131
  return [3 /*break*/, 5];
15944
16132
  case 3:
15945
- error_2 = _b.sent();
15946
- console.log("Error in getting organization list", error_2);
16133
+ error_5 = _d.sent();
16134
+ console.log("Error in getting organization list", error_5);
15947
16135
  return [3 /*break*/, 5];
15948
16136
  case 4:
15949
16137
  setLoadingList(false);
@@ -15958,52 +16146,72 @@ var InvestmentCreationComponent = function (props) {
15958
16146
  return;
15959
16147
  }
15960
16148
  if (state === null || state === void 0 ? void 0 : state.record) {
16149
+ console.log("condition 1 data", state === null || state === void 0 ? void 0 : state.record);
15961
16150
  setData(state === null || state === void 0 ? void 0 : state.record);
15962
16151
  }
15963
16152
  else {
16153
+ console.log("condition 2 data", { ownership: true });
15964
16154
  setData({ ownership: true });
15965
16155
  }
15966
16156
  }, []);
15967
16157
  useEffect(function () {
15968
- if (data) {
15969
- var keys = Object.keys(data);
15970
- if (keys[0] !== "ownership") {
15971
- getOrganisationsDetails();
15972
- }
15973
- }
16158
+ // if (data) {
16159
+ // const keys = Object.keys(data);
16160
+ // if (keys[0] !== "ownership") {
16161
+ // getOrganisationsDetails();
16162
+ // }
16163
+ // }
16164
+ getNationalInvestmentDetails();
16165
+ getOrganisationsDetails();
15974
16166
  getGovernmentDetails();
16167
+ getAllProjectData();
16168
+ getUserOrganization();
15975
16169
  }, [data]);
15976
- if (!data) {
16170
+ if (!data && allProjectData.length == 0) {
15977
16171
  return React.createElement(Loading, null);
15978
16172
  }
15979
16173
  console.log("data", data);
15980
- var companyName = {};
16174
+ console.log("data", data);
15981
16175
  if (data && Object.keys(data)[0] !== "ownership") {
15982
- for (var _i = 0, _l = data === null || data === void 0 ? void 0 : data.company; _i < _l.length; _i++) {
15983
- var company = _l[_i];
15984
- companyName[company === null || company === void 0 ? void 0 : company.companyId] = company;
15985
- }
16176
+ // for (const company of data!?.company) {
16177
+ // companyName[company?.companyId] = company;
16178
+ // }
15986
16179
  if (!data.proponentPercentage) {
15987
16180
  data.proponentPercentage = [100];
15988
16181
  }
15989
16182
  }
15990
16183
  var nextOne = function (val) {
16184
+ console.log("step 1 values", val);
16185
+ if (val.typeCreation == InvestmentCreationType.EXISTING) {
16186
+ val.toCompanyId = investmentData.toCompanyId;
16187
+ }
15991
16188
  setCurrent(current + 1);
15992
16189
  setStepOneData(val);
16190
+ if (data === null || data === void 0 ? void 0 : data.programmeId)
16191
+ setSelectedProgramme(data.programmeId);
16192
+ if (prevInvestor && prevInvestor != val.toCompanyId && !(data === null || data === void 0 ? void 0 : data.programmeId)) {
16193
+ formTwo.resetFields();
16194
+ setCurrentPercTotal(0);
16195
+ setProjectData(undefined);
16196
+ }
15993
16197
  };
15994
16198
  var prevOne = function () {
15995
16199
  setCurrent(current - 1);
16200
+ setPrevInvestor(stepOneData.toCompanyId);
16201
+ // formTwo.resetFields();
16202
+ // setCurrentPercTotal(0);
16203
+ // setProjectData(undefined);
15996
16204
  };
15997
16205
  var submitInvestment = function (val) { return __awaiter(void 0, void 0, void 0, function () {
15998
- var payload, response, error_3;
16206
+ var payload, response, error_6;
15999
16207
  return __generator(this, function (_a) {
16000
16208
  switch (_a.label) {
16001
16209
  case 0:
16002
16210
  console.log(val);
16003
16211
  console.log(stepOneData);
16212
+ console.log("OwnershipType", investmentOwnershipType);
16004
16213
  setLoading(true);
16005
16214
  payload = stepOneData;
16006
- payload.programmeId = data.programmeId;
16007
16215
  payload.amount = parseFloat(payload.amount);
16008
16216
  if (payload.interestRate) {
16009
16217
  payload.interestRate = parseFloat(payload.interestRate);
@@ -16020,16 +16228,32 @@ var InvestmentCreationComponent = function (props) {
16020
16228
  .startOf("day")
16021
16229
  .unix();
16022
16230
  }
16023
- payload.instrument = [payload.instrument];
16024
- payload.fromCompanyIds = data.companyId.map(function (e) { return Number(e); });
16025
- payload.percentage = val.percentage;
16026
16231
  payload.toCompanyId = Number(payload.toCompanyId);
16027
16232
  _a.label = 1;
16028
16233
  case 1:
16029
- _a.trys.push([1, 3, 4, 5]);
16234
+ _a.trys.push([1, 6, 7, 8]);
16235
+ response = void 0;
16236
+ if (!(investmentOwnershipType == InvestmentOwnershipType.PROJECT)) return [3 /*break*/, 3];
16237
+ if (typeCreation == InvestmentCreationType.EXISTING) {
16238
+ payload.nationalInvestmentId = investmentData.requestId;
16239
+ }
16240
+ else {
16241
+ payload.instrument = [payload.instrument];
16242
+ }
16243
+ payload.programmeId = projectData === null || projectData === void 0 ? void 0 : projectData.programmeId;
16244
+ payload.fromCompanyIds = projectData === null || projectData === void 0 ? void 0 : projectData.companyId.map(function (e) { return Number(e); });
16245
+ payload.percentage = val.percentage;
16030
16246
  return [4 /*yield*/, post("national/programme/addInvestment", payload)];
16031
16247
  case 2:
16032
16248
  response = _a.sent();
16249
+ return [3 /*break*/, 5];
16250
+ case 3:
16251
+ payload.instrument = [payload.instrument];
16252
+ return [4 /*yield*/, post("national/organisation/addInvestment", payload)];
16253
+ case 4:
16254
+ response = _a.sent();
16255
+ _a.label = 5;
16256
+ case 5:
16033
16257
  console.log("investment creation -> ", response);
16034
16258
  if ((response === null || response === void 0 ? void 0 : response.statusText) === "SUCCESS") {
16035
16259
  message.open({
@@ -16039,22 +16263,24 @@ var InvestmentCreationComponent = function (props) {
16039
16263
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
16040
16264
  });
16041
16265
  }
16042
- onNavigateToProgrammeView(data.programmeId);
16043
- return [3 /*break*/, 5];
16044
- case 3:
16045
- error_3 = _a.sent();
16046
- console.log("Error in investment creation - ", error_3);
16266
+ (data === null || data === void 0 ? void 0 : data.programmeId)
16267
+ ? onNavigateToProgrammeView(data === null || data === void 0 ? void 0 : data.programmeId)
16268
+ : onNavigateToInvestmentManagementView();
16269
+ return [3 /*break*/, 8];
16270
+ case 6:
16271
+ error_6 = _a.sent();
16272
+ console.log("Error in investment creation - ", error_6);
16047
16273
  message.open({
16048
16274
  type: "error",
16049
- content: error_3 === null || error_3 === void 0 ? void 0 : error_3.message,
16275
+ content: error_6 === null || error_6 === void 0 ? void 0 : error_6.message,
16050
16276
  duration: 4,
16051
16277
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
16052
16278
  });
16053
- return [3 /*break*/, 5];
16054
- case 4:
16279
+ return [3 /*break*/, 8];
16280
+ case 7:
16055
16281
  setLoading(false);
16056
16282
  return [7 /*endfinally*/];
16057
- case 5: return [2 /*return*/];
16283
+ case 8: return [2 /*return*/];
16058
16284
  }
16059
16285
  });
16060
16286
  }); };
@@ -16068,6 +16294,14 @@ var InvestmentCreationComponent = function (props) {
16068
16294
  var onChangeTypeCreation = function (e) {
16069
16295
  console.log("radio checked", e.target.value);
16070
16296
  setTypeCreation(e.target.value);
16297
+ formOne.resetFields();
16298
+ formTwo.resetFields();
16299
+ setCurrentPercTotal(0);
16300
+ setProjectData(undefined);
16301
+ };
16302
+ var onChangeInvestmentOwnershipType = function (e) {
16303
+ console.log("investment ownership type radio checked", e.target.value);
16304
+ setInvestmentOwnershipType(e.target.value);
16071
16305
  };
16072
16306
  return (React.createElement("div", { className: "add-programme-main-container" },
16073
16307
  React.createElement("div", { className: "title-container" },
@@ -16092,134 +16326,60 @@ var InvestmentCreationComponent = function (props) {
16092
16326
  ] },
16093
16327
  React.createElement(Radio.Group, { size: "large", defaultValue: typeCreation }, Object.values(InvestmentCreationType).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16094
16328
  React.createElement(Radio.Button, { className: "condition-radio", value: k, onChange: onChangeTypeCreation }, t("programme:" + k)))); }))))),
16095
- React.createElement(Row, { className: "row", gutter: [16, 16] },
16096
- React.createElement(Col, { xl: 12, md: 24 },
16097
- React.createElement("div", { className: "details-part-one" },
16098
- React.createElement(Form.Item, { label: t("programme:investorName"), name: "toCompanyId", wrapperCol: { span: 24 }, className: "organisation", rules: [
16099
- {
16100
- required: true,
16101
- message: "".concat(t("programme:investorName"), " ").concat(t("isRequired")),
16102
- },
16103
- ] },
16104
- React.createElement(Select, { size: "large", loading: loadingList }, organisationsList.map(function (organisation) { return (React.createElement(Select.Option, { key: organisation.companyId, value: organisation.companyId }, organisation.name)); }))))),
16105
- React.createElement(Col, { xl: 12, md: 24 },
16106
- React.createElement("div", { className: "details-part-two" },
16107
- React.createElement(Form.Item, { label: t("programme:amountInvested"), name: "amount", rules: [
16108
- {
16109
- required: true,
16110
- message: "",
16111
- },
16112
- {
16113
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16114
- return __generator(this, function (_a) {
16115
- if (String(value).trim() === "" ||
16116
- String(value).trim() === undefined ||
16117
- value === null ||
16118
- value === undefined) {
16119
- throw new Error("".concat(t("programme:amountInvested"), " ").concat(t("isRequired")));
16120
- }
16121
- else if (!isNaN(value) &&
16122
- Number(value) > 0) {
16123
- return [2 /*return*/, Promise.resolve()];
16124
- }
16125
- else {
16126
- throw new Error("".concat(t("programme:amountInvested"), " ").concat(t("isInvalid")));
16127
- }
16128
- });
16129
- }); },
16130
- },
16131
- ] },
16132
- React.createElement(Input, { size: "large" }))))),
16133
- React.createElement(Row, { className: "row", gutter: [16, 16] },
16134
- React.createElement(Col, { xl: 24, md: 24 },
16135
- React.createElement(Form.Item, { label: t("programme:instrument"), name: "instrument",
16136
- //wrapperCol={{ span: 24 }}
16137
- required: true, className: "investment-radio-button", rules: [
16138
- {
16139
- required: true,
16140
- message: "",
16141
- },
16142
- {
16143
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16144
- return __generator(this, function (_a) {
16145
- if (String(value).trim() === "" ||
16146
- String(value).trim() === undefined ||
16147
- value === null ||
16148
- value === undefined) {
16149
- throw new Error("".concat(t("programme:instrument"), " ").concat(t("isRequired")));
16150
- }
16151
- return [2 /*return*/];
16152
- });
16153
- }); },
16154
- },
16155
- ] },
16156
- React.createElement(Radio.Group, { onChange: onInstrumentChange, value: instrument[0] }, instrumentOptions.map(function (e) {
16157
- return (React.createElement(Radio, { value: e.value }, e.label));
16158
- }))))),
16159
- instrument &&
16160
- instrument.indexOf(Instrument.LOAN) >= 0 && (React.createElement(Row, { className: "row", gutter: [16, 16] },
16161
- React.createElement(Col, { xl: 8, md: 12 },
16162
- React.createElement("div", { className: "details-part-two" },
16163
- React.createElement(Form.Item, { label: t("programme:interestRate"), name: "interestRate", rules: [
16164
- {
16165
- required: true,
16166
- message: "",
16167
- },
16168
- {
16169
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16170
- return __generator(this, function (_a) {
16171
- if (String(value).trim() === "" ||
16172
- String(value).trim() ===
16173
- undefined ||
16174
- value === null ||
16175
- value === undefined) {
16176
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isRequired")));
16177
- }
16178
- else if (!isNaN(value)) {
16179
- return [2 /*return*/, Promise.resolve()];
16180
- }
16181
- else {
16182
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isInvalid")));
16183
- }
16184
- });
16185
- }); },
16186
- },
16187
- ] },
16188
- React.createElement(Input, { size: "large" })))))),
16189
- instrument &&
16190
- (instrument.indexOf(Instrument.CONLOAN) >= 0 ||
16191
- instrument.indexOf(Instrument.NONCONLOAN) >= 0) && (React.createElement("div", { className: "details-part-two" },
16329
+ typeCreation == InvestmentCreationType.NEW && (React.createElement("div", null,
16192
16330
  React.createElement(Row, { className: "row", gutter: [16, 16] },
16193
- React.createElement(Col, { xl: 8, md: 12 },
16194
- React.createElement(Form.Item, { label: t("programme:interestRate"), name: "interestRate", rules: [
16195
- {
16196
- required: true,
16197
- message: "",
16198
- },
16199
- {
16200
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16201
- return __generator(this, function (_a) {
16202
- if (String(value).trim() === "" ||
16203
- String(value).trim() ===
16204
- undefined ||
16205
- value === null ||
16206
- value === undefined) {
16207
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isRequired")));
16208
- }
16209
- else if (!isNaN(value)) {
16210
- return [2 /*return*/, Promise.resolve()];
16211
- }
16212
- else {
16213
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isInvalid")));
16214
- }
16215
- });
16216
- }); },
16217
- },
16218
- ] },
16219
- React.createElement(Input, { size: "large" })))),
16331
+ React.createElement(Col, { xl: 12, md: 24 },
16332
+ React.createElement("div", { className: "details-part-one" },
16333
+ React.createElement(Form.Item, { label: t("programme:investorName"), name: "toCompanyId", wrapperCol: { span: 24 }, className: "organisation", rules: [
16334
+ {
16335
+ required: true,
16336
+ message: "".concat(t("programme:investorName"), " ").concat(t("isRequired")),
16337
+ },
16338
+ ] },
16339
+ React.createElement(Select, { size: "large", loading: loadingList }, organisationsList.map(function (organisation) {
16340
+ if (data === null || data === void 0 ? void 0 : data.programmeId) {
16341
+ if (data.companyId
16342
+ .map(function (id) { return Number(id); })
16343
+ .includes(Number(organisation.companyId))) {
16344
+ return (React.createElement(Select.Option, { key: organisation.companyId, value: organisation.companyId }, organisation.name));
16345
+ }
16346
+ }
16347
+ else {
16348
+ return (React.createElement(Select.Option, { key: organisation.companyId, value: organisation.companyId }, organisation.name));
16349
+ }
16350
+ }))))),
16351
+ React.createElement(Col, { xl: 12, md: 24 },
16352
+ React.createElement("div", { className: "details-part-two" },
16353
+ React.createElement(Form.Item, { label: t("programme:amountInvested"), name: "amount", rules: [
16354
+ {
16355
+ required: true,
16356
+ message: "",
16357
+ },
16358
+ {
16359
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16360
+ return __generator(this, function (_a) {
16361
+ if (String(value).trim() === "" ||
16362
+ String(value).trim() ===
16363
+ undefined ||
16364
+ value === null ||
16365
+ value === undefined) {
16366
+ throw new Error("".concat(t("programme:amountInvested"), " ").concat(t("isRequired")));
16367
+ }
16368
+ else if (!isNaN(value) &&
16369
+ Number(value) > 0) {
16370
+ return [2 /*return*/, Promise.resolve()];
16371
+ }
16372
+ else {
16373
+ throw new Error("".concat(t("programme:amountInvested"), " ").concat(t("isInvalid")));
16374
+ }
16375
+ });
16376
+ }); },
16377
+ },
16378
+ ] },
16379
+ React.createElement(Input, { size: "large" }))))),
16220
16380
  React.createElement(Row, { className: "row", gutter: [16, 16] },
16221
- React.createElement(Col, { xl: 8, md: 12 },
16222
- React.createElement(Form.Item, { label: t("programme:loanPeriod"), name: "period", required: true, rules: [
16381
+ React.createElement(Col, { xl: 24, md: 24 },
16382
+ React.createElement(Form.Item, { label: t("programme:instrument"), name: "instrument", required: true, className: "investment-radio-button", rules: [
16223
16383
  {
16224
16384
  required: true,
16225
16385
  message: "",
@@ -16228,268 +16388,422 @@ var InvestmentCreationComponent = function (props) {
16228
16388
  validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16229
16389
  return __generator(this, function (_a) {
16230
16390
  if (String(value).trim() === "" ||
16231
- String(value).trim() ===
16232
- undefined ||
16391
+ String(value).trim() === undefined ||
16233
16392
  value === null ||
16234
16393
  value === undefined) {
16235
- throw new Error("".concat(t("programme:loanPeriod"), " ").concat(t("isRequired")));
16394
+ throw new Error("".concat(t("programme:instrument"), " ").concat(t("isRequired")));
16236
16395
  }
16237
16396
  return [2 /*return*/];
16238
16397
  });
16239
16398
  }); },
16240
16399
  },
16241
16400
  ] },
16242
- React.createElement(RangePicker$3, { showTime: true, allowClear: true, format: "DD:MM:YYYY", size: "large" }))),
16401
+ React.createElement(Radio.Group, { onChange: onInstrumentChange, value: instrument[0] }, instrumentOptions.map(function (e) {
16402
+ return (React.createElement(Radio, { value: e.value }, e.label));
16403
+ }))))),
16404
+ instrument &&
16405
+ instrument.indexOf(Instrument.LOAN) >= 0 && (React.createElement(Row, { className: "row", gutter: [16, 16] },
16243
16406
  React.createElement(Col, { xl: 8, md: 12 },
16244
- React.createElement(Form.Item, { label: t("programme:startOfPayback"), name: "startOfPayback", rules: [
16245
- {
16246
- required: true,
16247
- message: "",
16248
- },
16249
- {
16250
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16251
- return __generator(this, function (_a) {
16252
- if (String(value).trim() === "" ||
16253
- String(value).trim() ===
16254
- undefined ||
16255
- value === null ||
16256
- value === undefined) {
16257
- throw new Error("".concat(t("programme:startOfPayback"), " ").concat(t("isRequired")));
16258
- }
16259
- return [2 /*return*/];
16260
- });
16261
- }); },
16262
- },
16263
- ] },
16264
- React.createElement(DatePicker, { size: "large", disabledDate: function (currentDate) {
16265
- return currentDate < moment().startOf("day");
16266
- } })))))),
16267
- instrument &&
16268
- instrument.indexOf(Instrument.GUARANTEE) >= 0 && (React.createElement("div", { className: "details-part-two" },
16269
- React.createElement(Row, { className: "row", gutter: [16, 16] },
16407
+ React.createElement("div", { className: "details-part-two" },
16408
+ React.createElement(Form.Item, { label: t("programme:interestRate"), name: "interestRate", rules: [
16409
+ {
16410
+ required: true,
16411
+ message: "",
16412
+ },
16413
+ {
16414
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16415
+ return __generator(this, function (_a) {
16416
+ if (String(value).trim() === "" ||
16417
+ String(value).trim() ===
16418
+ undefined ||
16419
+ value === null ||
16420
+ value === undefined) {
16421
+ throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isRequired")));
16422
+ }
16423
+ else if (!isNaN(value)) {
16424
+ return [2 /*return*/, Promise.resolve()];
16425
+ }
16426
+ else {
16427
+ throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isInvalid")));
16428
+ }
16429
+ });
16430
+ }); },
16431
+ },
16432
+ ] },
16433
+ React.createElement(Input, { size: "large" })))))),
16434
+ instrument &&
16435
+ (instrument.indexOf(Instrument.CONLOAN) >= 0 ||
16436
+ instrument.indexOf(Instrument.NONCONLOAN) >=
16437
+ 0) && (React.createElement("div", { className: "details-part-two" },
16438
+ React.createElement(Row, { className: "row", gutter: [16, 16] },
16439
+ React.createElement(Col, { xl: 8, md: 12 },
16440
+ React.createElement(Form.Item, { label: t("programme:interestRate"), name: "interestRate", rules: [
16441
+ {
16442
+ required: true,
16443
+ message: "",
16444
+ },
16445
+ {
16446
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16447
+ return __generator(this, function (_a) {
16448
+ if (String(value).trim() === "" ||
16449
+ String(value).trim() ===
16450
+ undefined ||
16451
+ value === null ||
16452
+ value === undefined) {
16453
+ throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isRequired")));
16454
+ }
16455
+ else if (!isNaN(value)) {
16456
+ return [2 /*return*/, Promise.resolve()];
16457
+ }
16458
+ else {
16459
+ throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isInvalid")));
16460
+ }
16461
+ });
16462
+ }); },
16463
+ },
16464
+ ] },
16465
+ React.createElement(Input, { size: "large" })))),
16466
+ React.createElement(Row, { className: "row", gutter: [16, 16] },
16467
+ React.createElement(Col, { xl: 8, md: 12 },
16468
+ React.createElement(Form.Item, { label: t("programme:loanPeriod"), name: "period", required: true, rules: [
16469
+ {
16470
+ required: true,
16471
+ message: "",
16472
+ },
16473
+ {
16474
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16475
+ return __generator(this, function (_a) {
16476
+ if (String(value).trim() === "" ||
16477
+ String(value).trim() ===
16478
+ undefined ||
16479
+ value === null ||
16480
+ value === undefined) {
16481
+ throw new Error("".concat(t("programme:loanPeriod"), " ").concat(t("isRequired")));
16482
+ }
16483
+ return [2 /*return*/];
16484
+ });
16485
+ }); },
16486
+ },
16487
+ ] },
16488
+ React.createElement(RangePicker$3, { showTime: true, allowClear: true, format: "DD:MM:YYYY", size: "large" }))),
16489
+ React.createElement(Col, { xl: 8, md: 12 },
16490
+ React.createElement(Form.Item, { label: t("programme:startOfPayback"), name: "startOfPayback", rules: [
16491
+ {
16492
+ required: true,
16493
+ message: "",
16494
+ },
16495
+ {
16496
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16497
+ return __generator(this, function (_a) {
16498
+ if (String(value).trim() === "" ||
16499
+ String(value).trim() ===
16500
+ undefined ||
16501
+ value === null ||
16502
+ value === undefined) {
16503
+ throw new Error("".concat(t("programme:startOfPayback"), " ").concat(t("isRequired")));
16504
+ }
16505
+ return [2 /*return*/];
16506
+ });
16507
+ }); },
16508
+ },
16509
+ ] },
16510
+ React.createElement(DatePicker, { size: "large", disabledDate: function (currentDate) {
16511
+ return currentDate <
16512
+ moment().startOf("day");
16513
+ } })))))),
16514
+ instrument &&
16515
+ instrument.indexOf(Instrument.GUARANTEE) >= 0 && (React.createElement("div", { className: "details-part-two" },
16516
+ React.createElement(Row, { className: "row", gutter: [16, 16] },
16517
+ React.createElement(Col, { xl: 8, md: 12 },
16518
+ React.createElement(Form.Item, { label: t("programme:interestRate"), name: "interestRate", rules: [
16519
+ {
16520
+ required: true,
16521
+ message: "",
16522
+ },
16523
+ {
16524
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16525
+ return __generator(this, function (_a) {
16526
+ if (String(value).trim() === "" ||
16527
+ String(value).trim() ===
16528
+ undefined ||
16529
+ value === null ||
16530
+ value === undefined) {
16531
+ throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isRequired")));
16532
+ }
16533
+ else if (!isNaN(value)) {
16534
+ return [2 /*return*/, Promise.resolve()];
16535
+ }
16536
+ else {
16537
+ throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isInvalid")));
16538
+ }
16539
+ });
16540
+ }); },
16541
+ },
16542
+ ] },
16543
+ React.createElement(Input, { size: "large" })))),
16544
+ React.createElement(Row, { className: "row", gutter: [16, 16] },
16545
+ React.createElement(Col, { xl: 8, md: 12 },
16546
+ React.createElement(Form.Item, { label: t("programme:period"), name: "period", required: true, rules: [
16547
+ {
16548
+ required: true,
16549
+ message: "",
16550
+ },
16551
+ {
16552
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16553
+ return __generator(this, function (_a) {
16554
+ if (String(value).trim() === "" ||
16555
+ String(value).trim() ===
16556
+ undefined ||
16557
+ value === null ||
16558
+ value === undefined) {
16559
+ throw new Error("".concat(t("programme:period"), " ").concat(t("isRequired")));
16560
+ }
16561
+ return [2 /*return*/];
16562
+ });
16563
+ }); },
16564
+ },
16565
+ ] },
16566
+ React.createElement(RangePicker$3, { showTime: true, allowClear: true, format: "DD:MM:YYYY", size: "large" }))),
16567
+ React.createElement(Col, { xl: 8, md: 12 },
16568
+ React.createElement(Form.Item, { label: t("programme:payback"), wrapperCol: { span: 13 }, className: "role-group", name: "guaranteePayback", rules: [
16569
+ {
16570
+ required: true,
16571
+ message: "",
16572
+ },
16573
+ {
16574
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16575
+ return __generator(this, function (_a) {
16576
+ if (String(value).trim() === "" ||
16577
+ String(value).trim() ===
16578
+ undefined ||
16579
+ value === null ||
16580
+ value === undefined) {
16581
+ throw new Error("".concat(t("programme:payback"), " ").concat(t("isRequired")));
16582
+ }
16583
+ return [2 /*return*/];
16584
+ });
16585
+ }); },
16586
+ },
16587
+ ] },
16588
+ React.createElement(Radio.Group, { size: "large" }, Object.values(GuaranteePayback).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16589
+ React.createElement(Radio.Button, { className: "condition-radio", value: k }, t("programme:" + k)))); }))))))),
16590
+ instrument &&
16591
+ instrument.indexOf(Instrument.RESULT_BASED) >=
16592
+ 0 && (React.createElement(Row, { className: "row", gutter: [16, 16] },
16593
+ React.createElement(Col, { xl: 12, md: 24 },
16594
+ React.createElement("div", { className: "details-part-two" },
16595
+ React.createElement(Form.Item, { label: t("programme:resultMetric"), name: "resultMetric", rules: [
16596
+ {
16597
+ required: true,
16598
+ message: "",
16599
+ },
16600
+ {
16601
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16602
+ return __generator(this, function (_a) {
16603
+ if (String(value).trim() === "" ||
16604
+ String(value).trim() ===
16605
+ undefined ||
16606
+ value === null ||
16607
+ value === undefined) {
16608
+ throw new Error("".concat(t("programme:resultMetric"), " ").concat(t("isRequired")));
16609
+ }
16610
+ return [2 /*return*/];
16611
+ });
16612
+ }); },
16613
+ },
16614
+ ] },
16615
+ React.createElement(Input, { size: "large" })))),
16616
+ React.createElement(Col, { xl: 12, md: 24 },
16617
+ React.createElement("div", { className: "details-part-two" },
16618
+ React.createElement(Form.Item, { label: t("programme:paymentPerMetric"), name: "paymentPerMetric", rules: [
16619
+ {
16620
+ required: true,
16621
+ message: "",
16622
+ },
16623
+ {
16624
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16625
+ return __generator(this, function (_a) {
16626
+ if (String(value).trim() === "" ||
16627
+ String(value).trim() ===
16628
+ undefined ||
16629
+ value === null ||
16630
+ value === undefined) {
16631
+ throw new Error("".concat(t("programme:paymentPerMetric"), " ").concat(t("isRequired")));
16632
+ }
16633
+ else if (!isNaN(value)) {
16634
+ return [2 /*return*/, Promise.resolve()];
16635
+ }
16636
+ else {
16637
+ throw new Error("".concat(t("programme:paymentPerMetric"), " ").concat(t("isInvalid")));
16638
+ }
16639
+ });
16640
+ }); },
16641
+ },
16642
+ ] },
16643
+ React.createElement(Input, { size: "large" })))))),
16644
+ instrument &&
16645
+ instrument.indexOf(Instrument.INKIND) >= 0 && (React.createElement(Row, { className: "row", gutter: [16, 16] },
16646
+ React.createElement(Col, { xl: 12, md: 24 },
16647
+ React.createElement("div", { className: "details-part-two" },
16648
+ React.createElement(Form.Item, { label: t("programme:description"), name: "description", rules: [
16649
+ {
16650
+ required: false,
16651
+ message: "",
16652
+ },
16653
+ ] },
16654
+ React.createElement(Input, { size: "large" })))))),
16655
+ instrument &&
16656
+ instrument.indexOf(Instrument.INSURANCE) >= 0 && (React.createElement(Row, { className: "row", gutter: [16, 16] },
16270
16657
  React.createElement(Col, { xl: 8, md: 12 },
16271
- React.createElement(Form.Item, { label: t("programme:interestRate"), name: "interestRate", rules: [
16272
- {
16273
- required: true,
16274
- message: "",
16275
- },
16276
- {
16277
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16278
- return __generator(this, function (_a) {
16279
- if (String(value).trim() === "" ||
16280
- String(value).trim() ===
16281
- undefined ||
16282
- value === null ||
16283
- value === undefined) {
16284
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isRequired")));
16285
- }
16286
- else if (!isNaN(value)) {
16287
- return [2 /*return*/, Promise.resolve()];
16288
- }
16289
- else {
16290
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isInvalid")));
16291
- }
16292
- });
16293
- }); },
16294
- },
16295
- ] },
16296
- React.createElement(Input, { size: "large" })))),
16658
+ React.createElement("div", { className: "details-part-two" },
16659
+ React.createElement(Form.Item, { label: t("programme:payback"), wrapperCol: { span: 13 }, className: "role-group", name: "insurancePayback", rules: [
16660
+ {
16661
+ required: true,
16662
+ message: "",
16663
+ },
16664
+ {
16665
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16666
+ return __generator(this, function (_a) {
16667
+ if (String(value).trim() === "" ||
16668
+ String(value).trim() ===
16669
+ undefined ||
16670
+ value === null ||
16671
+ value === undefined) {
16672
+ throw new Error("".concat(t("programme:payback"), " ").concat(t("isRequired")));
16673
+ }
16674
+ return [2 /*return*/];
16675
+ });
16676
+ }); },
16677
+ },
16678
+ ] },
16679
+ React.createElement(Radio.Group, { size: "large" }, Object.values(InsurancePayback).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16680
+ React.createElement(Radio.Button, { className: "condition-radio", value: k }, t("programme:" + k)))); }))))))),
16681
+ instrument &&
16682
+ instrument.indexOf(Instrument.OTHER) >= 0 && (React.createElement(Row, { className: "row", gutter: [16, 16] },
16683
+ React.createElement(Col, { xl: 12, md: 24 },
16684
+ React.createElement("div", { className: "details-part-two" },
16685
+ React.createElement(Form.Item, { label: t("programme:comments"), name: "comments", rules: [
16686
+ {
16687
+ required: true,
16688
+ message: "",
16689
+ },
16690
+ {
16691
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16692
+ return __generator(this, function (_a) {
16693
+ if (String(value).trim() === "" ||
16694
+ String(value).trim() ===
16695
+ undefined ||
16696
+ value === null ||
16697
+ value === undefined) {
16698
+ throw new Error("".concat(t("programme:comments"), " ").concat(t("isRequired")));
16699
+ }
16700
+ return [2 /*return*/];
16701
+ });
16702
+ }); },
16703
+ },
16704
+ ] },
16705
+ React.createElement(Input, { size: "large" })))))),
16297
16706
  React.createElement(Row, { className: "row", gutter: [16, 16] },
16298
16707
  React.createElement(Col, { xl: 8, md: 12 },
16299
- React.createElement(Form.Item, { label: t("programme:period"), name: "period", required: true, rules: [
16708
+ React.createElement(Form.Item, { label: t("programme:type"), wrapperCol: { span: 13 }, className: "role-group", name: "type", rules: [
16300
16709
  {
16301
- required: true,
16302
- message: "",
16303
- },
16304
- {
16305
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16306
- return __generator(this, function (_a) {
16307
- if (String(value).trim() === "" ||
16308
- String(value).trim() ===
16309
- undefined ||
16310
- value === null ||
16311
- value === undefined) {
16312
- throw new Error("".concat(t("programme:period"), " ").concat(t("isRequired")));
16313
- }
16314
- return [2 /*return*/];
16315
- });
16316
- }); },
16710
+ required: false,
16317
16711
  },
16318
16712
  ] },
16319
- React.createElement(RangePicker$3, { showTime: true, allowClear: true, format: "DD:MM:YYYY", size: "large" }))),
16713
+ React.createElement(Radio.Group, { size: "large" }, Object.values(InvestmentType).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16714
+ React.createElement(Radio.Button, { className: "condition-radio", value: k, onClick: function (e) {
16715
+ return deselectOnClick(e, "type");
16716
+ } }, t("programme:" + k)))); })))),
16320
16717
  React.createElement(Col, { xl: 8, md: 12 },
16321
- React.createElement(Form.Item, { label: t("programme:payback"), wrapperCol: { span: 13 }, className: "role-group", name: "guaranteePayback", rules: [
16322
- {
16323
- required: true,
16324
- message: "",
16325
- },
16326
- {
16327
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16328
- return __generator(this, function (_a) {
16329
- if (String(value).trim() === "" ||
16330
- String(value).trim() ===
16331
- undefined ||
16332
- value === null ||
16333
- value === undefined) {
16334
- throw new Error("".concat(t("programme:payback"), " ").concat(t("isRequired")));
16335
- }
16336
- return [2 /*return*/];
16337
- });
16338
- }); },
16339
- },
16340
- ] },
16341
- React.createElement(Radio.Group, { size: "large" }, Object.values(GuaranteePayback).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16342
- React.createElement(Radio.Button, { className: "condition-radio", value: k }, t("programme:" + k)))); }))))))),
16343
- instrument &&
16344
- instrument.indexOf(Instrument.RESULT_BASED) >= 0 && (React.createElement(Row, { className: "row", gutter: [16, 16] },
16345
- React.createElement(Col, { xl: 12, md: 24 },
16346
- React.createElement("div", { className: "details-part-two" },
16347
- React.createElement(Form.Item, { label: t("programme:resultMetric"), name: "resultMetric", rules: [
16348
- {
16349
- required: true,
16350
- message: "",
16351
- },
16352
- {
16353
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16354
- return __generator(this, function (_a) {
16355
- if (String(value).trim() === "" ||
16356
- String(value).trim() ===
16357
- undefined ||
16358
- value === null ||
16359
- value === undefined) {
16360
- throw new Error("".concat(t("programme:resultMetric"), " ").concat(t("isRequired")));
16361
- }
16362
- return [2 /*return*/];
16363
- });
16364
- }); },
16365
- },
16366
- ] },
16367
- React.createElement(Input, { size: "large" })))),
16368
- React.createElement(Col, { xl: 12, md: 24 },
16369
- React.createElement("div", { className: "details-part-two" },
16370
- React.createElement(Form.Item, { label: t("programme:paymentPerMetric"), name: "paymentPerMetric", rules: [
16371
- {
16372
- required: true,
16373
- message: "",
16374
- },
16375
- {
16376
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16377
- return __generator(this, function (_a) {
16378
- if (String(value).trim() === "" ||
16379
- String(value).trim() ===
16380
- undefined ||
16381
- value === null ||
16382
- value === undefined) {
16383
- throw new Error("".concat(t("programme:paymentPerMetric"), " ").concat(t("isRequired")));
16384
- }
16385
- else if (!isNaN(value)) {
16386
- return [2 /*return*/, Promise.resolve()];
16387
- }
16388
- else {
16389
- throw new Error("".concat(t("programme:paymentPerMetric"), " ").concat(t("isInvalid")));
16390
- }
16391
- });
16392
- }); },
16393
- },
16394
- ] },
16395
- React.createElement(Input, { size: "large" })))))),
16396
- instrument &&
16397
- instrument.indexOf(Instrument.INKIND) >= 0 && (React.createElement(Row, { className: "row", gutter: [16, 16] },
16398
- React.createElement(Col, { xl: 12, md: 24 },
16399
- React.createElement("div", { className: "details-part-two" },
16400
- React.createElement(Form.Item, { label: t("programme:description"), name: "description", rules: [
16718
+ React.createElement(Form.Item, { label: t("programme:level"), wrapperCol: { span: 13 }, className: "role-group", name: "level", rules: [
16401
16719
  {
16402
16720
  required: false,
16403
- message: "",
16404
16721
  },
16405
16722
  ] },
16406
- React.createElement(Input, { size: "large" })))))),
16407
- instrument &&
16408
- instrument.indexOf(Instrument.INSURANCE) >= 0 && (React.createElement(Row, { className: "row", gutter: [16, 16] },
16409
- React.createElement(Col, { xl: 8, md: 12 },
16410
- React.createElement("div", { className: "details-part-two" },
16411
- React.createElement(Form.Item, { label: t("programme:payback"), wrapperCol: { span: 13 }, className: "role-group", name: "insurancePayback", rules: [
16412
- {
16413
- required: true,
16414
- message: "",
16415
- },
16723
+ React.createElement(Radio.Group, { size: "large" }, Object.values(InvestmentLevel).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16724
+ React.createElement(Radio.Button, { className: "condition-radio", value: k, onClick: function (e) {
16725
+ return deselectOnClick(e, "level");
16726
+ } }, t("programme:" + k)))); })))),
16727
+ React.createElement(Col, { xl: 8, md: 12 },
16728
+ React.createElement(Form.Item, { label: t("programme:stream"), wrapperCol: { span: 13 }, className: "role-group", name: "stream", rules: [
16416
16729
  {
16417
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16418
- return __generator(this, function (_a) {
16419
- if (String(value).trim() === "" ||
16420
- String(value).trim() ===
16421
- undefined ||
16422
- value === null ||
16423
- value === undefined) {
16424
- throw new Error("".concat(t("programme:payback"), " ").concat(t("isRequired")));
16425
- }
16426
- return [2 /*return*/];
16427
- });
16428
- }); },
16730
+ required: false,
16429
16731
  },
16430
16732
  ] },
16431
- React.createElement(Radio.Group, { size: "large" }, Object.values(InsurancePayback).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16432
- React.createElement(Radio.Button, { className: "condition-radio", value: k }, t("programme:" + k)))); }))))))),
16433
- instrument &&
16434
- instrument.indexOf(Instrument.OTHER) >= 0 && (React.createElement(Row, { className: "row", gutter: [16, 16] },
16435
- React.createElement(Col, { xl: 12, md: 24 },
16436
- React.createElement("div", { className: "details-part-two" },
16437
- React.createElement(Form.Item, { label: t("programme:comments"), name: "comments", rules: [
16438
- {
16439
- required: true,
16440
- message: "",
16441
- },
16442
- {
16443
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16444
- return __generator(this, function (_a) {
16445
- if (String(value).trim() === "" ||
16446
- String(value).trim() ===
16447
- undefined ||
16448
- value === null ||
16449
- value === undefined) {
16450
- throw new Error("".concat(t("programme:comments"), " ").concat(t("isRequired")));
16451
- }
16452
- return [2 /*return*/];
16733
+ React.createElement(Radio.Group, { size: "large" }, Object.values(InvestmentStream).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16734
+ React.createElement(Radio.Button, { className: "condition-radio", value: k, onClick: function (e) {
16735
+ return deselectOnClick(e, "stream");
16736
+ } }, t("programme:" + k)))); }))))),
16737
+ React.createElement(Row, { className: "row", gutter: [16, 16] },
16738
+ React.createElement(Col, { xl: 12, md: 24 },
16739
+ React.createElement(Form.Item, { label: t("programme:esgType"), name: "esgClassification" },
16740
+ React.createElement(Select, { size: "large" }, Object.values(ESGType).map(function (esg) { return (React.createElement(Select.Option, { value: esg }, esg)); }))))))),
16741
+ typeCreation == InvestmentCreationType.EXISTING && (React.createElement("div", null,
16742
+ React.createElement(Row, { className: "row", gutter: [16, 16] },
16743
+ React.createElement(Col, { xl: 12, md: 24 },
16744
+ React.createElement("div", { className: "details-part-one" },
16745
+ React.createElement(Form.Item, { label: t("programme:existingInvestmentSource"), name: "existinngInvestmentId", wrapperCol: { span: 24 }, rules: [
16746
+ {
16747
+ required: true,
16748
+ message: "".concat(t("programme:existingInvestmentSource"), " ").concat(t("isRequired")),
16749
+ },
16750
+ ] },
16751
+ React.createElement(Select, { size: "large", loading: loadingInvestment, onChange: setSelectedInvestment }, nationalInvestmentList.map(function (investment) { return (React.createElement(Select.Option, { key: investment.requestId, value: investment.requestId }, investment.investmentName)); })))))),
16752
+ React.createElement(Row, { className: "row", gutter: [16, 16] },
16753
+ React.createElement(Col, { xl: 12, md: 24 },
16754
+ React.createElement("div", { className: "details-part-two" },
16755
+ React.createElement(Form.Item, { label: t("programme:amountInvested"), name: "amount", rules: [
16756
+ {
16757
+ required: true,
16758
+ message: "",
16759
+ },
16760
+ {
16761
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16762
+ return __generator(this, function (_a) {
16763
+ if (String(value).trim() === "" ||
16764
+ String(value).trim() ===
16765
+ undefined ||
16766
+ value === null ||
16767
+ value === undefined) {
16768
+ throw new Error("".concat(t("programme:amountInvested"), " ").concat(t("isRequired")));
16769
+ }
16770
+ else if (!isNaN(value) &&
16771
+ Number(value) > 0) {
16772
+ return [2 /*return*/, Promise.resolve()];
16773
+ }
16774
+ else {
16775
+ throw new Error("".concat(t("programme:amountInvested"), " ").concat(t("isInvalid")));
16776
+ }
16777
+ });
16778
+ }); },
16779
+ },
16780
+ function (_a) {
16781
+ var getFieldValue = _a.getFieldValue;
16782
+ return ({
16783
+ validator: function (rule, v) {
16784
+ if (getFieldValue("amount") &&
16785
+ investmentData &&
16786
+ investmentData.amount <
16787
+ parseFloat(getFieldValue("amount"))) {
16788
+ // eslint-disable-next-line prefer-promise-reject-errors
16789
+ return Promise.reject("Amount > Available");
16790
+ }
16791
+ return Promise.resolve();
16792
+ },
16453
16793
  });
16454
- }); },
16455
- },
16456
- ] },
16457
- React.createElement(Input, { size: "large" })))))),
16458
- React.createElement(Row, { className: "row", gutter: [16, 16] },
16459
- React.createElement(Col, { xl: 8, md: 12 },
16460
- React.createElement(Form.Item, { label: t("programme:type"), wrapperCol: { span: 13 }, className: "role-group", name: "type", rules: [
16461
- {
16462
- required: false,
16463
- },
16464
- ] },
16465
- React.createElement(Radio.Group, { size: "large" }, Object.values(InvestmentType).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16466
- React.createElement(Radio.Button, { className: "condition-radio", value: k, onClick: function (e) {
16467
- return deselectOnClick(e, "type");
16468
- } }, t("programme:" + k)))); })))),
16469
- React.createElement(Col, { xl: 8, md: 12 },
16470
- React.createElement(Form.Item, { label: t("programme:level"), wrapperCol: { span: 13 }, className: "role-group", name: "level", rules: [
16471
- {
16472
- required: false,
16473
- },
16474
- ] },
16475
- React.createElement(Radio.Group, { size: "large" }, Object.values(InvestmentLevel).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16476
- React.createElement(Radio.Button, { className: "condition-radio", value: k, onClick: function (e) {
16477
- return deselectOnClick(e, "level");
16478
- } }, t("programme:" + k)))); })))),
16479
- React.createElement(Col, { xl: 8, md: 12 },
16480
- React.createElement(Form.Item, { label: t("programme:stream"), wrapperCol: { span: 13 }, className: "role-group", name: "stream", rules: [
16481
- {
16482
- required: false,
16483
- },
16484
- ] },
16485
- React.createElement(Radio.Group, { size: "large" }, Object.values(InvestmentStream).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16486
- React.createElement(Radio.Button, { className: "condition-radio", value: k, onClick: function (e) {
16487
- return deselectOnClick(e, "stream");
16488
- } }, t("programme:" + k)))); }))))),
16489
- React.createElement(Row, { className: "row", gutter: [16, 16] },
16490
- React.createElement(Col, { xl: 12, md: 24 },
16491
- React.createElement(Form.Item, { label: t("programme:esgType"), name: "esgClassification" },
16492
- React.createElement(Select, { size: "large" }, Object.values(ESGType).map(function (esg) { return (React.createElement(Select.Option, { value: esg }, esg)); }))))),
16794
+ },
16795
+ ] },
16796
+ React.createElement(Input, { size: "large" })))),
16797
+ React.createElement(Col, { xl: 12, md: 24 },
16798
+ React.createElement("div", { className: "details-part-two" },
16799
+ React.createElement(Form.Item, { label: " ", name: "sourceAmount" },
16800
+ React.createElement("div", null,
16801
+ "/",
16802
+ React.createElement(InputNumber, { size: "large", width: "100%", formatter: function (value) {
16803
+ return "$".concat(addCommSep(value));
16804
+ }, disabled: true, value: investmentData
16805
+ ? investmentData.amount
16806
+ : 0 })))))))),
16493
16807
  React.createElement(Form.Item, null,
16494
16808
  React.createElement("div", { className: "steps-actions" },
16495
16809
  React.createElement(Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: nextOne }, t("programme:next")))))))),
@@ -16499,73 +16813,164 @@ var InvestmentCreationComponent = function (props) {
16499
16813
  React.createElement("div", { className: "step-count" }, "02"),
16500
16814
  React.createElement("div", { className: "title" }, t("programme:ownership")))),
16501
16815
  description: current === 1 && (React.createElement("div", null,
16502
- React.createElement("div", { className: "programme-sought-form-container ownership-container" }, Object.keys(data).length > 0 && (React.createElement("div", { className: "programme-sought-form" },
16503
- React.createElement(Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, form: formTwo, name: "investment-sought", className: "investment-sought-form", layout: "vertical", requiredMark: true, onChange: onPercentageChange, onFinish: submitInvestment }, data === null || data === void 0 ? void 0 :
16504
- data.companyId.map(function (companyId, index) {
16505
- return (React.createElement(Row, { className: "row", gutter: [16, 16] },
16506
- React.createElement(Col, { xl: 8, md: 15 },
16507
- React.createElement("div", { className: "label" },
16508
- companyName[companyId].name,
16509
- React.createElement("span", { className: "required-mark" }, "*"))),
16510
- React.createElement(Col, { xl: 8, md: 9 },
16511
- React.createElement(Form.Item, { className: "inline", name: ["percentage", index], initialValue: 0, rules: [
16512
- {
16513
- pattern: new RegExp(/^[+]?([.]\d+|\d+[.]?\d*)$/g),
16514
- message: "Percentage Should be a positive number",
16515
- },
16816
+ React.createElement("div", { className: "investment-sought-form-container" },
16817
+ React.createElement("div", { className: "investment-sought-form" },
16818
+ React.createElement(Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, name: "investment-sought", className: "investment-sought-form", layout: "vertical", requiredMark: true },
16819
+ React.createElement(Row, { className: "row", gutter: [4, 4] },
16820
+ React.createElement(Col, { xl: 8, md: 12 },
16821
+ React.createElement(Form.Item, { label: t("programme:typeCreation"), wrapperCol: { span: 13 }, className: "role-group", name: "investmentOwnershipType", rules: [
16516
16822
  {
16517
- required: true,
16518
- message: "Required field",
16519
- },
16520
- function (_a) {
16521
- var getFieldValue = _a.getFieldValue;
16522
- return ({
16523
- validator: function (rule, v) {
16524
- if (getFieldValue([
16525
- "percentage",
16526
- index,
16527
- ]) &&
16528
- parseFloat(getFieldValue([
16529
- "percentage",
16530
- index,
16531
- ])) >
16532
- data.proponentPercentage[index]) {
16533
- // eslint-disable-next-line prefer-promise-reject-errors
16534
- return Promise.reject("Amount > Available");
16535
- }
16536
- return Promise.resolve();
16537
- },
16538
- });
16823
+ required: false,
16539
16824
  },
16540
16825
  ] },
16541
- React.createElement(InputNumber, { placeholder: "", controls: false, disabled: govData.companyId == companyId,
16542
- // disabled={userInfoState?.companyId === Number(companyId)}
16543
- onKeyPress: function (event) {
16544
- if (!/[0-9\.]/.test(event.key)) {
16545
- event.preventDefault();
16546
- }
16547
- } })),
16548
- React.createElement("div", { className: "inline separator" }, "/"),
16549
- React.createElement(Form.Item, { className: "inline" },
16550
- React.createElement(InputNumber, { placeholder: String(data === null || data === void 0 ? void 0 : data.proponentPercentage[index]), disabled: true })))));
16551
- }),
16552
- React.createElement(Row, { className: "row", gutter: [16, 16] },
16553
- React.createElement(Col, { xl: 8, md: 15 },
16554
- React.createElement("div", { className: "label" }, t("programme:total"))),
16555
- React.createElement(Col, { xl: 8, md: 9 },
16556
- React.createElement(Form.Item, { className: "inline", name: ["total"] },
16557
- React.createElement(InputNumber, { placeholder: currentPercTotal + "", controls: false, disabled: true, onKeyPress: function (event) {
16558
- if (!/[0-9\.]/.test(event.key)) {
16559
- event.preventDefault();
16826
+ React.createElement(Radio.Group, { size: "large", defaultValue: typeCreation ==
16827
+ InvestmentCreationType.EXISTING
16828
+ ? InvestmentOwnershipType.PROJECT
16829
+ : investmentOwnershipType }, Object.values(InvestmentOwnershipType).map(function (k, index) {
16830
+ if (!(typeCreation ==
16831
+ InvestmentCreationType.EXISTING &&
16832
+ k == InvestmentOwnershipType.NATIONAL) &&
16833
+ !(k ==
16834
+ InvestmentOwnershipType.NATIONAL &&
16835
+ (data === null || data === void 0 ? void 0 : data.programmeId))) {
16836
+ return (React.createElement("div", { className: "condition-radio-container" },
16837
+ React.createElement(Tooltip, { title: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ==
16838
+ CompanyRole.PROGRAMME_DEVELOPER &&
16839
+ stepOneData.toCompanyId !=
16840
+ userInfoState.companyId &&
16841
+ k ==
16842
+ InvestmentOwnershipType.NATIONAL
16843
+ ? "This action is unauthorized due to the selected investor name."
16844
+ : "", color: TooltipColor, key: TooltipColor },
16845
+ React.createElement(Radio.Button, { className: "condition-radio", value: k, onChange: onChangeInvestmentOwnershipType, disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ==
16846
+ CompanyRole.PROGRAMME_DEVELOPER &&
16847
+ stepOneData.toCompanyId !=
16848
+ userInfoState.companyId &&
16849
+ k ==
16850
+ InvestmentOwnershipType.NATIONAL }, t("programme:" + k)))));
16560
16851
  }
16561
- } })),
16562
- React.createElement("div", { className: "inline separator" }, "/"),
16563
- React.createElement(Form.Item, { className: "inline" },
16564
- React.createElement(InputNumber, { disabled: true, placeholder: "100" })))),
16565
- React.createElement(Form.Item, null,
16566
- React.createElement("div", { className: "steps-actions" },
16567
- React.createElement(Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: submitInvestment }, t("programme:submit")),
16568
- React.createElement(Button, { className: "back-btn", onClick: function () { return prevOne(); }, loading: loading }, t("programme:back")))))))))),
16852
+ })))))))),
16853
+ React.createElement("div", { className: "programme-sought-form-container ownership-container" },
16854
+ React.createElement("div", { className: "programme-sought-form" },
16855
+ React.createElement(Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, form: formTwo, name: "investment-sought", className: "investment-sought-form", layout: "vertical", requiredMark: true, onChange: onPercentageChange, onFinish: submitInvestment },
16856
+ allProjectData.length > 0 &&
16857
+ investmentOwnershipType ==
16858
+ InvestmentOwnershipType.PROJECT && (React.createElement("div", null,
16859
+ React.createElement(Row, { className: "row", gutter: [16, 16] },
16860
+ React.createElement(Col, { xl: 12, md: 24 },
16861
+ React.createElement("div", { className: "details-part-one" },
16862
+ React.createElement(Form.Item, { label: t("programme:title"), name: "projectId", wrapperCol: { span: 24 }, initialValue: (data === null || data === void 0 ? void 0 : data.programmeId) != undefined
16863
+ ? allProjectData[0].programmeId
16864
+ : null, rules: [
16865
+ {
16866
+ required: true,
16867
+ message: "".concat(t("programme:title"), " ").concat(t("isRequired")),
16868
+ },
16869
+ ] },
16870
+ React.createElement(Select, { size: "large", loading: loadingProgData,
16871
+ // defaultValue={
16872
+ // allProjectData.length == 1
16873
+ // ? allProjectData[0].programmeId
16874
+ // : null
16875
+ // }
16876
+ disabled: allProjectData.length == 1 &&
16877
+ (data === null || data === void 0 ? void 0 : data.programmeId) != undefined, onChange: setSelectedProgramme }, allProjectData.map(function (project) {
16878
+ if ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ==
16879
+ CompanyRole.PROGRAMME_DEVELOPER &&
16880
+ Number(stepOneData.toCompanyId) !=
16881
+ userInfoState.companyId) {
16882
+ if (project.companyId
16883
+ .map(function (id) { return Number(id); })
16884
+ .includes(userInfoState.companyId)) {
16885
+ return (React.createElement(Select.Option, { key: project.programmeId, value: project.programmeId }, project.title));
16886
+ }
16887
+ }
16888
+ else if ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ===
16889
+ CompanyRole.MINISTRY) {
16890
+ if (ministrySectoralScope.includes(project.sectoralScope)) {
16891
+ return (React.createElement(Select.Option, { key: project.programmeId, value: project.programmeId }, project.title));
16892
+ }
16893
+ }
16894
+ else {
16895
+ return (React.createElement(Select.Option, { key: project.programmeId, value: project.programmeId }, project.title));
16896
+ }
16897
+ })))))), projectData === null || projectData === void 0 ? void 0 :
16898
+ projectData.companyId.map(function (companyId, index) {
16899
+ if (formTwo.getFieldValue("percentage") &&
16900
+ formTwo.getFieldValue("percentage")[index] &&
16901
+ companyId == stepOneData.toCompanyId) {
16902
+ formTwo.getFieldValue("percentage")[index] = 0;
16903
+ }
16904
+ return (React.createElement(Row, { className: "row", gutter: [16, 16] },
16905
+ React.createElement(Col, { xl: 8, md: 15 },
16906
+ React.createElement("div", { className: "label" },
16907
+ govData.companyId == companyId
16908
+ ? govData.name
16909
+ : companyNames[Number(companyId)],
16910
+ React.createElement("span", { className: "required-mark" }, "*"))),
16911
+ React.createElement(Col, { xl: 8, md: 9 },
16912
+ React.createElement(Form.Item, { className: "inline", name: ["percentage", index], initialValue: 0, rules: [
16913
+ {
16914
+ pattern: new RegExp(/^[+]?([.]\d+|\d+[.]?\d*)$/g),
16915
+ message: "Percentage Should be a positive number",
16916
+ },
16917
+ {
16918
+ required: true,
16919
+ message: "Required field",
16920
+ },
16921
+ function (_a) {
16922
+ var getFieldValue = _a.getFieldValue;
16923
+ return ({
16924
+ validator: function (rule, v) {
16925
+ if (getFieldValue([
16926
+ "percentage",
16927
+ index,
16928
+ ]) &&
16929
+ parseFloat(getFieldValue([
16930
+ "percentage",
16931
+ index,
16932
+ ])) >
16933
+ projectData
16934
+ .proponentPercentage[index]) {
16935
+ // eslint-disable-next-line prefer-promise-reject-errors
16936
+ return Promise.reject("Amount > Available");
16937
+ }
16938
+ return Promise.resolve();
16939
+ },
16940
+ });
16941
+ },
16942
+ ] },
16943
+ React.createElement(InputNumber, { placeholder: "", controls: false, disabled: govData.companyId ==
16944
+ companyId ||
16945
+ companyId ==
16946
+ stepOneData.toCompanyId, value: 0,
16947
+ // disabled={userInfoState?.companyId === Number(companyId)}
16948
+ onKeyPress: function (event) {
16949
+ if (!/[0-9\.]/.test(event.key)) {
16950
+ event.preventDefault();
16951
+ }
16952
+ } })),
16953
+ React.createElement("div", { className: "inline separator" }, "/"),
16954
+ React.createElement(Form.Item, { className: "inline" },
16955
+ React.createElement(InputNumber, { placeholder: String(projectData === null || projectData === void 0 ? void 0 : projectData.proponentPercentage[index]), disabled: true })))));
16956
+ }),
16957
+ React.createElement(Row, { className: "row", gutter: [16, 16] },
16958
+ React.createElement(Col, { xl: 8, md: 15 },
16959
+ React.createElement("div", { className: "label" }, t("programme:total"))),
16960
+ React.createElement(Col, { xl: 8, md: 9 },
16961
+ React.createElement(Form.Item, { className: "inline", name: ["total"] },
16962
+ React.createElement(InputNumber, { placeholder: currentPercTotal + "", controls: false, disabled: true, onKeyPress: function (event) {
16963
+ if (!/[0-9\.]/.test(event.key)) {
16964
+ event.preventDefault();
16965
+ }
16966
+ } })),
16967
+ React.createElement("div", { className: "inline separator" }, "/"),
16968
+ React.createElement(Form.Item, { className: "inline" },
16969
+ React.createElement(InputNumber, { disabled: true, placeholder: "100" })))))),
16970
+ React.createElement(Form.Item, null,
16971
+ React.createElement("div", { className: "steps-actions" },
16972
+ React.createElement(Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: submitInvestment }, t("programme:submit")),
16973
+ React.createElement(Button, { className: "back-btn", onClick: function () { return prevOne(); }, loading: loading }, t("programme:back"))))))))),
16569
16974
  },
16570
16975
  ] })))));
16571
16976
  };
@@ -17066,7 +17471,10 @@ var InvestmentManagementComponent = function (props) {
17066
17471
  sorter: true,
17067
17472
  align: "left",
17068
17473
  render: function (item) {
17069
- return React.createElement("span", { className: "clickable" }, item);
17474
+ if (item) {
17475
+ return React.createElement("span", { className: "clickable" }, item);
17476
+ }
17477
+ return React.createElement("span", null, "-");
17070
17478
  },
17071
17479
  onCell: function (record, rowIndex) {
17072
17480
  return {
@@ -17124,6 +17532,12 @@ var InvestmentManagementComponent = function (props) {
17124
17532
  key: "programmeSector",
17125
17533
  sorter: true,
17126
17534
  align: "left",
17535
+ render: function (item) {
17536
+ if (item) {
17537
+ return React.createElement("span", null, item);
17538
+ }
17539
+ return React.createElement("span", null, "-");
17540
+ },
17127
17541
  },
17128
17542
  {
17129
17543
  title: t("programme:investor"),
@@ -17207,7 +17621,11 @@ var InvestmentManagementComponent = function (props) {
17207
17621
  React.createElement("div", { className: "title-bar" },
17208
17622
  React.createElement("div", { className: "body-title" }, t("programme:investmentTitle")),
17209
17623
  React.createElement("div", { className: "body-sub-title" }, t("programme:investmentDesc"))),
17210
- React.createElement("div", { className: "actions" }, enableAddOwnership && (React.createElement("div", { className: "action-bar" },
17624
+ React.createElement("div", { className: "actions" }, enableAddOwnership &&
17625
+ ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) == CompanyRole.MINISTRY ||
17626
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) == CompanyRole.GOVERNMENT ||
17627
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) == CompanyRole.PROGRAMME_DEVELOPER) &&
17628
+ userInfoState.userRole != Role.ViewOnly && (React.createElement("div", { className: "action-bar" },
17211
17629
  React.createElement(Button, { type: "primary", size: "large", block: true, icon: React.createElement(PlusOutlined, null), onClick: onClickAddOwnership }, t("programme:addOwnership")))))),
17212
17630
  React.createElement("div", { className: "content-card" },
17213
17631
  React.createElement(Row, null,
@@ -17254,7 +17672,7 @@ var InvestmentManagementComponent = function (props) {
17254
17672
  return handleTableChange(val, sorter);
17255
17673
  }, locale: {
17256
17674
  emptyText: (React.createElement(Empty, { image: Empty.PRESENTED_IMAGE_SIMPLE, description: tableData.length === 0
17257
- ? t("creditTransfer:noTransfer")
17675
+ ? t("programme:noInvestmentData")
17258
17676
  : null })),
17259
17677
  } }))))),
17260
17678
  popupInfo && selectedReq && (React.createElement(InvestmentActionModel, { investment: selectedReq, onCancel: function () {
@@ -35113,5 +35531,5 @@ var GHGDashboardComponent = function (props) {
35113
35531
  React.createElement(Row, { gutter: [40, 40], className: "statics-card-row" }, row.map(function (item, j) { return getWidgetJSX(item); })))); }))));
35114
35532
  };
35115
35533
 
35116
- export { Action, AddNdcActionComponent, AddNewCompanyComponent, AddNewUserComponent, AdminBGColor, AdminColor, BaseEntity, CarbonSystemType, CertBGColor, CertColor, CoBenifitsComponent, Company, CompanyManagementColumns, CompanyManagementComponent, CompanyProfileComponent, CompanyRole, CompanyState, ConfigurationSettingsType, ConnectionContextProvider, CreditTransferComponent, CreditTransferStage, DevBGColor, DevColor, DocType, DocumentStatus, ESGType, Emission, EmissionGas, EmissionSector, EmissionSubSectors, EnergyGenerationUnits, FormElementType, GHGDashboardComponent, GHGEmissionsComponent, GHGProjectionsComponent, GhgStatCardTypes, GovBGColor, GovColor, ImgWithFallback, InfoView, Instrument, InvestmentBGColor, InvestmentBody, InvestmentColor, InvestmentCreationComponent, InvestmentCreationType, InvestmentLevel, InvestmentManagementComponent, InvestmentStatus, InvestmentStream, InvestmentType, LandAreaUnits, LegendItem, Loading, ManagerBGColor, ManagerColor, MapComponent, MapTypes, MapboxComponent, MinBGColor, MinColor, MitigationSubTypes, MitigationTypes, MrvDashboardComponent, MrvStatsCardsTypes, NdcActionBody, NdcActionManagementComponent, NdcActionStatus, NdcActionTypes, NdcActionViewComponent, NdcDetailsComponent, OrganisationStatus, ProfileIcon, ProgrammeCertify, ProgrammeCreationComponent, ProgrammeDocuments, ProgrammeEntity, ProgrammeIssueForm, ProgrammeManagementColumns, ProgrammeManagementComponent, ProgrammeRetireForm, ProgrammeRevokeForm, ProgrammeStageLegend, ProgrammeStageMRV, ProgrammeStageR, ProgrammeStageUnified, ProgrammeTransfer, ProgrammeTransferForm, Projection, ProjectionTypes$1 as ProjectionTypes, RadioButtonStatus, RadioButtonStatus2, RegistryDashboardComponent, RejectDocumentationConfirmationModel, RetireType, Role, RoleIcon, RootBGColor, RootColor, SdgGoals$1 as SdgGoals, Sector, SectoralScope, SettingsContext, SettingsContextProvider, StasticCard, StatsCardsTypes, SubTypeOfMitigation, SupportCreationComponent, SupportManagementComponent, SystemNames, TimelineBody, Titles, TooltipColor, TransferActionModel, TxType, TypeOfMitigation, UnitField, User, UserContext, UserInformationContextProvider, UserManagementColumns, UserManagementComponent, UserProfileComponent, UserRoleIcon, ViewBGColor, ViewColor, WidgetType, addCommSep, addCommSepRound$1 as addCommSepRound, addNdcDesc, addRoundNumber, addSpaces, consumerGroupList, creditUnit, dateFormat, dateTimeFormat, energyGenerationUnitList, getBase64, getCompanyBgColor, getCreditStageVal, getFinancialFields, getGeneralFields, getInvestmentStatusEnumVal, getNdcActionStatusEnumVal$1 as getNdcActionStatusEnumVal, getNdcStatusTagType, getRetirementTypeString, getStageEnumVal, getStageTagType, getStageTagTypeMRV, getStageTransferEnumVal, getStatusTagType, getTransferStageTagType, getValidNdcActions, isBase64, landAreaUnitList, methodologyOptions, mitigationSubTypeList, mitigationSubTypesListMapped, mitigationTypeList, ndcActionTypeList, sectorMitigationTypesListMapped, sumArray, titleList, useConnection, useSettingsContext, useUserContext };
35534
+ export { Action, AddNdcActionComponent, AddNewCompanyComponent, AddNewUserComponent, AdminBGColor, AdminColor, BaseEntity, CarbonSystemType, CertBGColor, CertColor, CoBenifitsComponent, Company, CompanyManagementColumns, CompanyManagementComponent, CompanyProfileComponent, CompanyRole, CompanyState, ConfigurationSettingsType, ConnectionContextProvider, CreditTransferComponent, CreditTransferStage, DevBGColor, DevColor, DocType, DocumentStatus, ESGType, Emission, EmissionGas, EmissionSector, EmissionSubSectors, EnergyGenerationUnits, FormElementType, GHGDashboardComponent, GHGEmissionsComponent, GHGProjectionsComponent, GhgStatCardTypes, GovBGColor, GovColor, ImgWithFallback, InfoView, Instrument, InvestmentBGColor, InvestmentBody, InvestmentColor, InvestmentCreationComponent, InvestmentCreationType, InvestmentLevel, InvestmentManagementComponent, InvestmentOwnershipType, InvestmentStatus, InvestmentStream, InvestmentType, LandAreaUnits, LegendItem, Loading, ManagerBGColor, ManagerColor, MapComponent, MapTypes, MapboxComponent, MinBGColor, MinColor, MitigationSubTypes, MitigationTypes, MrvDashboardComponent, MrvStatsCardsTypes, NdcActionBody, NdcActionManagementComponent, NdcActionStatus, NdcActionTypes, NdcActionViewComponent, NdcDetailsComponent, OrganisationStatus, ProfileIcon, ProgrammeCertify, ProgrammeCreationComponent, ProgrammeDocuments, ProgrammeEntity, ProgrammeIssueForm, ProgrammeManagementColumns, ProgrammeManagementComponent, ProgrammeRetireForm, ProgrammeRevokeForm, ProgrammeStageLegend, ProgrammeStageMRV, ProgrammeStageR, ProgrammeStageUnified, ProgrammeTransfer, ProgrammeTransferForm, Projection, ProjectionTypes$1 as ProjectionTypes, RadioButtonStatus, RadioButtonStatus2, RegistryDashboardComponent, RejectDocumentationConfirmationModel, RetireType, Role, RoleIcon, RootBGColor, RootColor, SdgGoals$1 as SdgGoals, Sector, SectoralScope, SettingsContext, SettingsContextProvider, StasticCard, StatsCardsTypes, SubTypeOfMitigation, SupportCreationComponent, SupportManagementComponent, SystemNames, TimelineBody, Titles, TooltipColor, TransferActionModel, TxType, TypeOfMitigation, UnitField, User, UserContext, UserInformationContextProvider, UserManagementColumns, UserManagementComponent, UserProfileComponent, UserRoleIcon, ViewBGColor, ViewColor, WidgetType, addCommSep, addCommSepRound$1 as addCommSepRound, addNdcDesc, addRoundNumber, addSpaces, consumerGroupList, creditUnit, dateFormat, dateTimeFormat, energyGenerationUnitList, getBase64, getCompanyBgColor, getCreditStageVal, getFinancialFields, getGeneralFields, getInvestmentStatusEnumVal, getNdcActionStatusEnumVal$1 as getNdcActionStatusEnumVal, getNdcStatusTagType, getRetirementTypeString, getStageEnumVal, getStageTagType, getStageTagTypeMRV, getStageTransferEnumVal, getStatusTagType, getTransferStageTagType, getValidNdcActions, isBase64, landAreaUnitList, methodologyOptions, mitigationSubTypeList, mitigationSubTypesListMapped, mitigationTypeList, ndcActionTypeList, sectorMitigationTypesListMapped, sumArray, titleList, useConnection, useSettingsContext, useUserContext };
35117
35535
  //# sourceMappingURL=index.js.map