@undp/carbon-library 1.0.292 → 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/cjs/index.js CHANGED
@@ -1298,6 +1298,11 @@ exports.InvestmentCreationType = void 0;
1298
1298
  InvestmentCreationType["EXISTING"] = "Existing";
1299
1299
  InvestmentCreationType["NEW"] = "New";
1300
1300
  })(exports.InvestmentCreationType || (exports.InvestmentCreationType = {}));
1301
+ exports.InvestmentOwnershipType = void 0;
1302
+ (function (InvestmentOwnershipType) {
1303
+ InvestmentOwnershipType["PROJECT"] = "Project";
1304
+ InvestmentOwnershipType["NATIONAL"] = "National";
1305
+ })(exports.InvestmentOwnershipType || (exports.InvestmentOwnershipType = {}));
1301
1306
  exports.InvestmentStream = void 0;
1302
1307
  (function (InvestmentStream) {
1303
1308
  InvestmentStream["CLIMATE_FINANCE"] = "ClimateFinance";
@@ -15830,7 +15835,7 @@ var UserManagementComponent = function (props) {
15830
15835
  React.createElement(UserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: handleOk, onActionCanceled: handleCancel, openModal: openDeleteConfirmationModal, errorMsg: errorMsg, loading: loading })));
15831
15836
  };
15832
15837
 
15833
- 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";
15838
+ 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";
15834
15839
  styleInject(css_248z$m);
15835
15840
 
15836
15841
  var Loading = function () {
@@ -15850,22 +15855,34 @@ var InsurancePayback;
15850
15855
 
15851
15856
  var RangePicker$3 = antd.DatePicker.RangePicker;
15852
15857
  var InvestmentCreationComponent = function (props) {
15853
- var t = props.t, useLocation = props.useLocation, onNavigateToProgrammeManagementView = props.onNavigateToProgrammeManagementView, onNavigateToProgrammeView = props.onNavigateToProgrammeView;
15858
+ var t = props.t, useLocation = props.useLocation, onNavigateToProgrammeManagementView = props.onNavigateToProgrammeManagementView, onNavigateToProgrammeView = props.onNavigateToProgrammeView, onNavigateToInvestmentManagementView = props.onNavigateToInvestmentManagementView;
15854
15859
  var state = useLocation().state;
15855
15860
  var _a = React.useState(), data = _a[0], setData = _a[1];
15861
+ var _b = React.useState({}), companyNames = _b[0], setCompanyNames = _b[1];
15862
+ var _c = React.useState({}); _c[0]; var setUserOrganization = _c[1];
15863
+ var _d = React.useState({}), investmentNames = _d[0], setInvestmentNames = _d[1];
15864
+ var _e = React.useState(), projectData = _e[0], setProjectData = _e[1];
15865
+ var _f = React.useState(), investmentData = _f[0], setInvestmentData = _f[1];
15866
+ var _g = React.useState([]), allProjectData = _g[0], setAllProjectData = _g[1];
15856
15867
  var formOne = antd.Form.useForm()[0];
15857
15868
  var formTwo = antd.Form.useForm()[0];
15858
15869
  var post = useConnection().post;
15859
- var _b = React.useState(false), loading = _b[0], setLoading = _b[1];
15860
- var _c = React.useState("New"), typeCreation = _c[0], setTypeCreation = _c[1];
15861
- var _d = React.useState(false), loadingList = _d[0], setLoadingList = _d[1];
15862
- var _e = React.useState(0), current = _e[0], setCurrent = _e[1];
15863
- var _f = React.useState(0), currentPercTotal = _f[0], setCurrentPercTotal = _f[1];
15864
- var _g = React.useState([]), organisationsList = _g[0], setOrganisationList = _g[1];
15865
- var _h = React.useState([]), instrument = _h[0], setInstrument = _h[1];
15866
- var _j = React.useState(), stepOneData = _j[0], setStepOneData = _j[1];
15867
- var _k = React.useState(), govData = _k[0], setGovData = _k[1];
15870
+ var _h = React.useState(false), loading = _h[0], setLoading = _h[1];
15871
+ var _j = React.useState("New"), typeCreation = _j[0], setTypeCreation = _j[1];
15872
+ var _k = React.useState(exports.InvestmentOwnershipType.PROJECT), investmentOwnershipType = _k[0], setInvestmentOwnershipType = _k[1];
15873
+ var _l = React.useState(false), loadingList = _l[0], setLoadingList = _l[1];
15874
+ var _m = React.useState(false), loadingInvestment = _m[0], setLoadingInvestment = _m[1];
15875
+ var _o = React.useState(false), loadingProgData = _o[0], setLoadingProgData = _o[1];
15876
+ var _p = React.useState(0), current = _p[0], setCurrent = _p[1];
15877
+ var _q = React.useState(0), currentPercTotal = _q[0], setCurrentPercTotal = _q[1];
15878
+ var _r = React.useState([]), organisationsList = _r[0], setOrganisationList = _r[1];
15879
+ var _s = React.useState([]), nationalInvestmentList = _s[0], setNationalInvestmentList = _s[1];
15880
+ var _t = React.useState([]), instrument = _t[0], setInstrument = _t[1];
15881
+ var _u = React.useState(), stepOneData = _u[0], setStepOneData = _u[1];
15882
+ var _v = React.useState(), govData = _v[0], setGovData = _v[1];
15868
15883
  var userInfoState = useUserContext().userInfoState;
15884
+ var _w = React.useState([]), ministrySectoralScope = _w[0], setMinistrySectoralScope = _w[1];
15885
+ var _x = React.useState({}), prevInvestor = _x[0], setPrevInvestor = _x[1];
15869
15886
  var instrumentOptions = Object.keys(exports.Instrument).map(function (k, index) { return ({
15870
15887
  label: addSpaces(Object.values(exports.Instrument)[index]),
15871
15888
  value: Object.values(exports.Instrument)[index],
@@ -15917,52 +15934,225 @@ var InvestmentCreationComponent = function (props) {
15917
15934
  }
15918
15935
  });
15919
15936
  }); };
15920
- var getOrganisationsDetails = function () { return __awaiter(void 0, void 0, void 0, function () {
15921
- var filterAnd, _i, _a, c, response, error_2;
15937
+ var getAllProjectData = function () { return __awaiter(void 0, void 0, void 0, function () {
15938
+ var response, error_2;
15939
+ return __generator(this, function (_a) {
15940
+ switch (_a.label) {
15941
+ case 0:
15942
+ setLoadingProgData(true);
15943
+ _a.label = 1;
15944
+ case 1:
15945
+ _a.trys.push([1, 5, 6, 7]);
15946
+ if (!data) return [3 /*break*/, 4];
15947
+ if (!!(data === null || data === void 0 ? void 0 : data.programmeId)) return [3 /*break*/, 3];
15948
+ console.log("data non existing", data);
15949
+ console.log("getting all Project data");
15950
+ return [4 /*yield*/, post("national/programme/query", {
15951
+ page: 1,
15952
+ size: 100,
15953
+ filterAnd: [
15954
+ {
15955
+ key: "currentStage",
15956
+ operation: "!=",
15957
+ value: exports.ProgrammeStageUnified.Rejected,
15958
+ },
15959
+ ],
15960
+ })];
15961
+ case 2:
15962
+ response = _a.sent();
15963
+ if (response.data) {
15964
+ setAllProjectData(response === null || response === void 0 ? void 0 : response.data);
15965
+ console.log("all Project data", response === null || response === void 0 ? void 0 : response.data);
15966
+ }
15967
+ return [3 /*break*/, 4];
15968
+ case 3:
15969
+ console.log("setting current Project data");
15970
+ setAllProjectData([data]);
15971
+ _a.label = 4;
15972
+ case 4: return [3 /*break*/, 7];
15973
+ case 5:
15974
+ error_2 = _a.sent();
15975
+ console.log("Error in getting all programme data", error_2);
15976
+ return [3 /*break*/, 7];
15977
+ case 6:
15978
+ setLoadingProgData(false);
15979
+ return [7 /*endfinally*/];
15980
+ case 7: return [2 /*return*/];
15981
+ }
15982
+ });
15983
+ }); };
15984
+ var setSelectedProgramme = function (value) { return __awaiter(void 0, void 0, void 0, function () {
15985
+ var _i, allProjectData_1, obj;
15986
+ return __generator(this, function (_a) {
15987
+ console.log("setSelectedProgramme", value);
15988
+ for (_i = 0, allProjectData_1 = allProjectData; _i < allProjectData_1.length; _i++) {
15989
+ obj = allProjectData_1[_i];
15990
+ if (obj.programmeId == value) {
15991
+ setProjectData(obj);
15992
+ break;
15993
+ }
15994
+ }
15995
+ return [2 /*return*/];
15996
+ });
15997
+ }); };
15998
+ var setSelectedInvestment = function (value) { return __awaiter(void 0, void 0, void 0, function () {
15999
+ return __generator(this, function (_a) {
16000
+ console.log("setSelectedInvestment", value);
16001
+ setInvestmentData(investmentNames[value]);
16002
+ return [2 /*return*/];
16003
+ });
16004
+ }); };
16005
+ var getNationalInvestmentDetails = function () { return __awaiter(void 0, void 0, void 0, function () {
16006
+ var optionalFilters, filterAnd, filterOr_1, response, investmentData_1, _i, _a, investment, error_3;
15922
16007
  return __generator(this, function (_b) {
15923
16008
  switch (_b.label) {
15924
16009
  case 0:
15925
- setLoadingList(true);
16010
+ setLoadingInvestment(true);
15926
16011
  _b.label = 1;
15927
16012
  case 1:
15928
16013
  _b.trys.push([1, 3, 4, 5]);
16014
+ optionalFilters = {};
15929
16015
  filterAnd = [];
15930
16016
  filterAnd = [
15931
16017
  {
15932
- key: "companyRole",
16018
+ key: "category",
15933
16019
  operation: "=",
15934
- value: exports.CompanyRole.PROGRAMME_DEVELOPER.toString(),
16020
+ value: exports.InvestmentOwnershipType.NATIONAL.toString(),
16021
+ },
16022
+ {
16023
+ key: "amount",
16024
+ operation: ">",
16025
+ value: 0,
15935
16026
  },
15936
16027
  ];
15937
16028
  if ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.PROGRAMME_DEVELOPER) {
15938
16029
  filterAnd.push({
15939
- key: "companyId",
15940
- operation: "!=",
16030
+ key: "toCompanyId",
16031
+ operation: "=",
15941
16032
  value: userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyId,
15942
16033
  });
15943
16034
  }
15944
- for (_i = 0, _a = data === null || data === void 0 ? void 0 : data.companyId; _i < _a.length; _i++) {
15945
- c = _a[_i];
15946
- filterAnd.push({
15947
- key: "companyId",
15948
- operation: "!=",
15949
- value: c,
16035
+ else if (((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT ||
16036
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.MINISTRY) &&
16037
+ (data === null || data === void 0 ? void 0 : data.programmeId)) {
16038
+ filterOr_1 = [];
16039
+ data.companyId.map(function (id) {
16040
+ return filterOr_1.push({
16041
+ key: "toCompanyId",
16042
+ operation: "=",
16043
+ value: id,
16044
+ });
15950
16045
  });
16046
+ optionalFilters.filterOr = filterOr_1;
15951
16047
  }
15952
- return [4 /*yield*/, post("national/organisation/queryNames", {
16048
+ return [4 /*yield*/, post("national/programme/investmentQuery", __assign({ page: 1, size: 100, filterAnd: filterAnd }, optionalFilters))];
16049
+ case 2:
16050
+ response = _b.sent();
16051
+ if (response.data) {
16052
+ setNationalInvestmentList(response === null || response === void 0 ? void 0 : response.data);
16053
+ investmentData_1 = {};
16054
+ for (_i = 0, _a = response === null || response === void 0 ? void 0 : response.data; _i < _a.length; _i++) {
16055
+ investment = _a[_i];
16056
+ investmentData_1[investment.requestId] = investment;
16057
+ }
16058
+ setInvestmentNames(investmentData_1);
16059
+ console.log(investmentData_1);
16060
+ }
16061
+ return [3 /*break*/, 5];
16062
+ case 3:
16063
+ error_3 = _b.sent();
16064
+ console.log("Error in getting national Investments list", error_3);
16065
+ return [3 /*break*/, 5];
16066
+ case 4:
16067
+ setLoadingInvestment(false);
16068
+ return [7 /*endfinally*/];
16069
+ case 5: return [2 /*return*/];
16070
+ }
16071
+ });
16072
+ }); };
16073
+ var getUserOrganization = function () { return __awaiter(void 0, void 0, void 0, function () {
16074
+ var response, error_4;
16075
+ return __generator(this, function (_a) {
16076
+ switch (_a.label) {
16077
+ case 0:
16078
+ _a.trys.push([0, 2, , 3]);
16079
+ return [4 /*yield*/, post("national/organisation/query", {
15953
16080
  page: 1,
15954
16081
  size: 100,
15955
- filterAnd: filterAnd,
16082
+ filterAnd: [
16083
+ { key: "companyId", operation: "=", value: userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyId },
16084
+ ],
15956
16085
  })];
16086
+ case 1:
16087
+ response = _a.sent();
16088
+ console.log("getUserOrganization", response.data[0]);
16089
+ setUserOrganization(response.data[0]);
16090
+ setMinistrySectoralScope(response.data[0].sectoralScope);
16091
+ return [3 /*break*/, 3];
15957
16092
  case 2:
15958
- response = _b.sent();
16093
+ error_4 = _a.sent();
16094
+ console.log("Error in getting user organization", error_4);
16095
+ return [3 /*break*/, 3];
16096
+ case 3: return [2 /*return*/];
16097
+ }
16098
+ });
16099
+ }); };
16100
+ var getOrganisationsDetails = function () { return __awaiter(void 0, void 0, void 0, function () {
16101
+ var filterAnd, filterOr, _i, _a, c, filters, response, companyName, _b, _c, company, error_5;
16102
+ return __generator(this, function (_d) {
16103
+ switch (_d.label) {
16104
+ case 0:
16105
+ setLoadingList(true);
16106
+ _d.label = 1;
16107
+ case 1:
16108
+ _d.trys.push([1, 3, 4, 5]);
16109
+ filterAnd = [];
16110
+ filterOr = [];
16111
+ filterAnd = [
16112
+ {
16113
+ key: "companyRole",
16114
+ operation: "=",
16115
+ value: exports.CompanyRole.PROGRAMME_DEVELOPER.toString(),
16116
+ },
16117
+ ];
16118
+ // if (userInfoState?.companyRole === CompanyRole.PROGRAMME_DEVELOPER) {
16119
+ // filterAnd.push({
16120
+ // key: "companyId",
16121
+ // operation: "!=",
16122
+ // value: userInfoState?.companyId,
16123
+ // });
16124
+ // }
16125
+ if (data === null || data === void 0 ? void 0 : data.companyId) {
16126
+ for (_i = 0, _a = data === null || data === void 0 ? void 0 : data.companyId; _i < _a.length; _i++) {
16127
+ c = _a[_i];
16128
+ filterOr.push({
16129
+ key: "companyId",
16130
+ operation: "=",
16131
+ value: c,
16132
+ });
16133
+ }
16134
+ }
16135
+ filters = void 0;
16136
+ if (filterOr.length) {
16137
+ filters.filterOr = filterOr;
16138
+ }
16139
+ return [4 /*yield*/, post("national/organisation/queryNames", __assign({ page: 1, size: 100, filterAnd: filterAnd }, filters))];
16140
+ case 2:
16141
+ response = _d.sent();
15959
16142
  if (response.data) {
15960
16143
  setOrganisationList(response === null || response === void 0 ? void 0 : response.data);
16144
+ companyName = {};
16145
+ for (_b = 0, _c = response === null || response === void 0 ? void 0 : response.data; _b < _c.length; _b++) {
16146
+ company = _c[_b];
16147
+ companyName[Number(company.companyId)] = company.name;
16148
+ }
16149
+ setCompanyNames(companyName);
16150
+ console.log(companyName);
15961
16151
  }
15962
16152
  return [3 /*break*/, 5];
15963
16153
  case 3:
15964
- error_2 = _b.sent();
15965
- console.log("Error in getting organization list", error_2);
16154
+ error_5 = _d.sent();
16155
+ console.log("Error in getting organization list", error_5);
15966
16156
  return [3 /*break*/, 5];
15967
16157
  case 4:
15968
16158
  setLoadingList(false);
@@ -15977,52 +16167,72 @@ var InvestmentCreationComponent = function (props) {
15977
16167
  return;
15978
16168
  }
15979
16169
  if (state === null || state === void 0 ? void 0 : state.record) {
16170
+ console.log("condition 1 data", state === null || state === void 0 ? void 0 : state.record);
15980
16171
  setData(state === null || state === void 0 ? void 0 : state.record);
15981
16172
  }
15982
16173
  else {
16174
+ console.log("condition 2 data", { ownership: true });
15983
16175
  setData({ ownership: true });
15984
16176
  }
15985
16177
  }, []);
15986
16178
  React.useEffect(function () {
15987
- if (data) {
15988
- var keys = Object.keys(data);
15989
- if (keys[0] !== "ownership") {
15990
- getOrganisationsDetails();
15991
- }
15992
- }
16179
+ // if (data) {
16180
+ // const keys = Object.keys(data);
16181
+ // if (keys[0] !== "ownership") {
16182
+ // getOrganisationsDetails();
16183
+ // }
16184
+ // }
16185
+ getNationalInvestmentDetails();
16186
+ getOrganisationsDetails();
15993
16187
  getGovernmentDetails();
16188
+ getAllProjectData();
16189
+ getUserOrganization();
15994
16190
  }, [data]);
15995
- if (!data) {
16191
+ if (!data && allProjectData.length == 0) {
15996
16192
  return React.createElement(Loading, null);
15997
16193
  }
15998
16194
  console.log("data", data);
15999
- var companyName = {};
16195
+ console.log("data", data);
16000
16196
  if (data && Object.keys(data)[0] !== "ownership") {
16001
- for (var _i = 0, _l = data === null || data === void 0 ? void 0 : data.company; _i < _l.length; _i++) {
16002
- var company = _l[_i];
16003
- companyName[company === null || company === void 0 ? void 0 : company.companyId] = company;
16004
- }
16197
+ // for (const company of data!?.company) {
16198
+ // companyName[company?.companyId] = company;
16199
+ // }
16005
16200
  if (!data.proponentPercentage) {
16006
16201
  data.proponentPercentage = [100];
16007
16202
  }
16008
16203
  }
16009
16204
  var nextOne = function (val) {
16205
+ console.log("step 1 values", val);
16206
+ if (val.typeCreation == exports.InvestmentCreationType.EXISTING) {
16207
+ val.toCompanyId = investmentData.toCompanyId;
16208
+ }
16010
16209
  setCurrent(current + 1);
16011
16210
  setStepOneData(val);
16211
+ if (data === null || data === void 0 ? void 0 : data.programmeId)
16212
+ setSelectedProgramme(data.programmeId);
16213
+ if (prevInvestor && prevInvestor != val.toCompanyId && !(data === null || data === void 0 ? void 0 : data.programmeId)) {
16214
+ formTwo.resetFields();
16215
+ setCurrentPercTotal(0);
16216
+ setProjectData(undefined);
16217
+ }
16012
16218
  };
16013
16219
  var prevOne = function () {
16014
16220
  setCurrent(current - 1);
16221
+ setPrevInvestor(stepOneData.toCompanyId);
16222
+ // formTwo.resetFields();
16223
+ // setCurrentPercTotal(0);
16224
+ // setProjectData(undefined);
16015
16225
  };
16016
16226
  var submitInvestment = function (val) { return __awaiter(void 0, void 0, void 0, function () {
16017
- var payload, response, error_3;
16227
+ var payload, response, error_6;
16018
16228
  return __generator(this, function (_a) {
16019
16229
  switch (_a.label) {
16020
16230
  case 0:
16021
16231
  console.log(val);
16022
16232
  console.log(stepOneData);
16233
+ console.log("OwnershipType", investmentOwnershipType);
16023
16234
  setLoading(true);
16024
16235
  payload = stepOneData;
16025
- payload.programmeId = data.programmeId;
16026
16236
  payload.amount = parseFloat(payload.amount);
16027
16237
  if (payload.interestRate) {
16028
16238
  payload.interestRate = parseFloat(payload.interestRate);
@@ -16039,16 +16249,32 @@ var InvestmentCreationComponent = function (props) {
16039
16249
  .startOf("day")
16040
16250
  .unix();
16041
16251
  }
16042
- payload.instrument = [payload.instrument];
16043
- payload.fromCompanyIds = data.companyId.map(function (e) { return Number(e); });
16044
- payload.percentage = val.percentage;
16045
16252
  payload.toCompanyId = Number(payload.toCompanyId);
16046
16253
  _a.label = 1;
16047
16254
  case 1:
16048
- _a.trys.push([1, 3, 4, 5]);
16255
+ _a.trys.push([1, 6, 7, 8]);
16256
+ response = void 0;
16257
+ if (!(investmentOwnershipType == exports.InvestmentOwnershipType.PROJECT)) return [3 /*break*/, 3];
16258
+ if (typeCreation == exports.InvestmentCreationType.EXISTING) {
16259
+ payload.nationalInvestmentId = investmentData.requestId;
16260
+ }
16261
+ else {
16262
+ payload.instrument = [payload.instrument];
16263
+ }
16264
+ payload.programmeId = projectData === null || projectData === void 0 ? void 0 : projectData.programmeId;
16265
+ payload.fromCompanyIds = projectData === null || projectData === void 0 ? void 0 : projectData.companyId.map(function (e) { return Number(e); });
16266
+ payload.percentage = val.percentage;
16049
16267
  return [4 /*yield*/, post("national/programme/addInvestment", payload)];
16050
16268
  case 2:
16051
16269
  response = _a.sent();
16270
+ return [3 /*break*/, 5];
16271
+ case 3:
16272
+ payload.instrument = [payload.instrument];
16273
+ return [4 /*yield*/, post("national/organisation/addInvestment", payload)];
16274
+ case 4:
16275
+ response = _a.sent();
16276
+ _a.label = 5;
16277
+ case 5:
16052
16278
  console.log("investment creation -> ", response);
16053
16279
  if ((response === null || response === void 0 ? void 0 : response.statusText) === "SUCCESS") {
16054
16280
  antd.message.open({
@@ -16058,22 +16284,24 @@ var InvestmentCreationComponent = function (props) {
16058
16284
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
16059
16285
  });
16060
16286
  }
16061
- onNavigateToProgrammeView(data.programmeId);
16062
- return [3 /*break*/, 5];
16063
- case 3:
16064
- error_3 = _a.sent();
16065
- console.log("Error in investment creation - ", error_3);
16287
+ (data === null || data === void 0 ? void 0 : data.programmeId)
16288
+ ? onNavigateToProgrammeView(data === null || data === void 0 ? void 0 : data.programmeId)
16289
+ : onNavigateToInvestmentManagementView();
16290
+ return [3 /*break*/, 8];
16291
+ case 6:
16292
+ error_6 = _a.sent();
16293
+ console.log("Error in investment creation - ", error_6);
16066
16294
  antd.message.open({
16067
16295
  type: "error",
16068
- content: error_3 === null || error_3 === void 0 ? void 0 : error_3.message,
16296
+ content: error_6 === null || error_6 === void 0 ? void 0 : error_6.message,
16069
16297
  duration: 4,
16070
16298
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
16071
16299
  });
16072
- return [3 /*break*/, 5];
16073
- case 4:
16300
+ return [3 /*break*/, 8];
16301
+ case 7:
16074
16302
  setLoading(false);
16075
16303
  return [7 /*endfinally*/];
16076
- case 5: return [2 /*return*/];
16304
+ case 8: return [2 /*return*/];
16077
16305
  }
16078
16306
  });
16079
16307
  }); };
@@ -16087,6 +16315,14 @@ var InvestmentCreationComponent = function (props) {
16087
16315
  var onChangeTypeCreation = function (e) {
16088
16316
  console.log("radio checked", e.target.value);
16089
16317
  setTypeCreation(e.target.value);
16318
+ formOne.resetFields();
16319
+ formTwo.resetFields();
16320
+ setCurrentPercTotal(0);
16321
+ setProjectData(undefined);
16322
+ };
16323
+ var onChangeInvestmentOwnershipType = function (e) {
16324
+ console.log("investment ownership type radio checked", e.target.value);
16325
+ setInvestmentOwnershipType(e.target.value);
16090
16326
  };
16091
16327
  return (React.createElement("div", { className: "add-programme-main-container" },
16092
16328
  React.createElement("div", { className: "title-container" },
@@ -16111,323 +16347,60 @@ var InvestmentCreationComponent = function (props) {
16111
16347
  ] },
16112
16348
  React.createElement(antd.Radio.Group, { size: "large", defaultValue: typeCreation }, Object.values(exports.InvestmentCreationType).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16113
16349
  React.createElement(antd.Radio.Button, { className: "condition-radio", value: k, onChange: onChangeTypeCreation }, t("programme:" + k)))); }))))),
16114
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16115
- React.createElement(antd.Col, { xl: 12, md: 24 },
16116
- React.createElement("div", { className: "details-part-one" },
16117
- React.createElement(antd.Form.Item, { label: t("programme:investorName"), name: "toCompanyId", wrapperCol: { span: 24 }, className: "organisation", rules: [
16118
- {
16119
- required: true,
16120
- message: "".concat(t("programme:investorName"), " ").concat(t("isRequired")),
16121
- },
16122
- ] },
16123
- React.createElement(antd.Select, { size: "large", loading: loadingList }, organisationsList.map(function (organisation) { return (React.createElement(antd.Select.Option, { key: organisation.companyId, value: organisation.companyId }, organisation.name)); }))))),
16124
- React.createElement(antd.Col, { xl: 12, md: 24 },
16125
- React.createElement("div", { className: "details-part-two" },
16126
- React.createElement(antd.Form.Item, { label: t("programme:amountInvested"), name: "amount", rules: [
16127
- {
16128
- required: true,
16129
- message: "",
16130
- },
16131
- {
16132
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16133
- return __generator(this, function (_a) {
16134
- if (String(value).trim() === "" ||
16135
- String(value).trim() === undefined ||
16136
- value === null ||
16137
- value === undefined) {
16138
- throw new Error("".concat(t("programme:amountInvested"), " ").concat(t("isRequired")));
16139
- }
16140
- else if (!isNaN(value) &&
16141
- Number(value) > 0) {
16142
- return [2 /*return*/, Promise.resolve()];
16143
- }
16144
- else {
16145
- throw new Error("".concat(t("programme:amountInvested"), " ").concat(t("isInvalid")));
16146
- }
16147
- });
16148
- }); },
16149
- },
16150
- ] },
16151
- React.createElement(antd.Input, { size: "large" }))))),
16152
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16153
- React.createElement(antd.Col, { xl: 24, md: 24 },
16154
- React.createElement(antd.Form.Item, { label: t("programme:instrument"), name: "instrument",
16155
- //wrapperCol={{ span: 24 }}
16156
- required: true, className: "investment-radio-button", rules: [
16157
- {
16158
- required: true,
16159
- message: "",
16160
- },
16161
- {
16162
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16163
- return __generator(this, function (_a) {
16164
- if (String(value).trim() === "" ||
16165
- String(value).trim() === undefined ||
16166
- value === null ||
16167
- value === undefined) {
16168
- throw new Error("".concat(t("programme:instrument"), " ").concat(t("isRequired")));
16169
- }
16170
- return [2 /*return*/];
16171
- });
16172
- }); },
16173
- },
16174
- ] },
16175
- React.createElement(antd.Radio.Group, { onChange: onInstrumentChange, value: instrument[0] }, instrumentOptions.map(function (e) {
16176
- return (React.createElement(antd.Radio, { value: e.value }, e.label));
16177
- }))))),
16178
- instrument &&
16179
- instrument.indexOf(exports.Instrument.LOAN) >= 0 && (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16180
- React.createElement(antd.Col, { xl: 8, md: 12 },
16181
- React.createElement("div", { className: "details-part-two" },
16182
- React.createElement(antd.Form.Item, { label: t("programme:interestRate"), name: "interestRate", rules: [
16183
- {
16184
- required: true,
16185
- message: "",
16186
- },
16187
- {
16188
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16189
- return __generator(this, function (_a) {
16190
- if (String(value).trim() === "" ||
16191
- String(value).trim() ===
16192
- undefined ||
16193
- value === null ||
16194
- value === undefined) {
16195
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isRequired")));
16196
- }
16197
- else if (!isNaN(value)) {
16198
- return [2 /*return*/, Promise.resolve()];
16199
- }
16200
- else {
16201
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isInvalid")));
16202
- }
16203
- });
16204
- }); },
16205
- },
16206
- ] },
16207
- React.createElement(antd.Input, { size: "large" })))))),
16208
- instrument &&
16209
- (instrument.indexOf(exports.Instrument.CONLOAN) >= 0 ||
16210
- instrument.indexOf(exports.Instrument.NONCONLOAN) >= 0) && (React.createElement("div", { className: "details-part-two" },
16211
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16212
- React.createElement(antd.Col, { xl: 8, md: 12 },
16213
- React.createElement(antd.Form.Item, { label: t("programme:interestRate"), name: "interestRate", rules: [
16214
- {
16215
- required: true,
16216
- message: "",
16217
- },
16218
- {
16219
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16220
- return __generator(this, function (_a) {
16221
- if (String(value).trim() === "" ||
16222
- String(value).trim() ===
16223
- undefined ||
16224
- value === null ||
16225
- value === undefined) {
16226
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isRequired")));
16227
- }
16228
- else if (!isNaN(value)) {
16229
- return [2 /*return*/, Promise.resolve()];
16230
- }
16231
- else {
16232
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isInvalid")));
16233
- }
16234
- });
16235
- }); },
16236
- },
16237
- ] },
16238
- React.createElement(antd.Input, { size: "large" })))),
16239
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16240
- React.createElement(antd.Col, { xl: 8, md: 12 },
16241
- React.createElement(antd.Form.Item, { label: t("programme:loanPeriod"), name: "period", required: true, rules: [
16242
- {
16243
- required: true,
16244
- message: "",
16245
- },
16246
- {
16247
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16248
- return __generator(this, function (_a) {
16249
- if (String(value).trim() === "" ||
16250
- String(value).trim() ===
16251
- undefined ||
16252
- value === null ||
16253
- value === undefined) {
16254
- throw new Error("".concat(t("programme:loanPeriod"), " ").concat(t("isRequired")));
16255
- }
16256
- return [2 /*return*/];
16257
- });
16258
- }); },
16259
- },
16260
- ] },
16261
- React.createElement(RangePicker$3, { showTime: true, allowClear: true, format: "DD:MM:YYYY", size: "large" }))),
16262
- React.createElement(antd.Col, { xl: 8, md: 12 },
16263
- React.createElement(antd.Form.Item, { label: t("programme:startOfPayback"), name: "startOfPayback", rules: [
16264
- {
16265
- required: true,
16266
- message: "",
16267
- },
16268
- {
16269
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16270
- return __generator(this, function (_a) {
16271
- if (String(value).trim() === "" ||
16272
- String(value).trim() ===
16273
- undefined ||
16274
- value === null ||
16275
- value === undefined) {
16276
- throw new Error("".concat(t("programme:startOfPayback"), " ").concat(t("isRequired")));
16277
- }
16278
- return [2 /*return*/];
16279
- });
16280
- }); },
16281
- },
16282
- ] },
16283
- React.createElement(antd.DatePicker, { size: "large", disabledDate: function (currentDate) {
16284
- return currentDate < moment().startOf("day");
16285
- } })))))),
16286
- instrument &&
16287
- instrument.indexOf(exports.Instrument.GUARANTEE) >= 0 && (React.createElement("div", { className: "details-part-two" },
16350
+ typeCreation == exports.InvestmentCreationType.NEW && (React.createElement("div", null,
16288
16351
  React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16289
- React.createElement(antd.Col, { xl: 8, md: 12 },
16290
- React.createElement(antd.Form.Item, { label: t("programme:interestRate"), name: "interestRate", rules: [
16291
- {
16292
- required: true,
16293
- message: "",
16294
- },
16295
- {
16296
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16297
- return __generator(this, function (_a) {
16298
- if (String(value).trim() === "" ||
16299
- String(value).trim() ===
16300
- undefined ||
16301
- value === null ||
16302
- value === undefined) {
16303
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isRequired")));
16304
- }
16305
- else if (!isNaN(value)) {
16306
- return [2 /*return*/, Promise.resolve()];
16307
- }
16308
- else {
16309
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isInvalid")));
16310
- }
16311
- });
16312
- }); },
16313
- },
16314
- ] },
16315
- React.createElement(antd.Input, { size: "large" })))),
16316
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16317
- React.createElement(antd.Col, { xl: 8, md: 12 },
16318
- React.createElement(antd.Form.Item, { label: t("programme:period"), name: "period", required: true, rules: [
16319
- {
16320
- required: true,
16321
- message: "",
16322
- },
16323
- {
16324
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16325
- return __generator(this, function (_a) {
16326
- if (String(value).trim() === "" ||
16327
- String(value).trim() ===
16328
- undefined ||
16329
- value === null ||
16330
- value === undefined) {
16331
- throw new Error("".concat(t("programme:period"), " ").concat(t("isRequired")));
16332
- }
16333
- return [2 /*return*/];
16334
- });
16335
- }); },
16336
- },
16337
- ] },
16338
- React.createElement(RangePicker$3, { showTime: true, allowClear: true, format: "DD:MM:YYYY", size: "large" }))),
16339
- React.createElement(antd.Col, { xl: 8, md: 12 },
16340
- React.createElement(antd.Form.Item, { label: t("programme:payback"), wrapperCol: { span: 13 }, className: "role-group", name: "guaranteePayback", rules: [
16341
- {
16342
- required: true,
16343
- message: "",
16344
- },
16345
- {
16346
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16347
- return __generator(this, function (_a) {
16348
- if (String(value).trim() === "" ||
16349
- String(value).trim() ===
16350
- undefined ||
16351
- value === null ||
16352
- value === undefined) {
16353
- throw new Error("".concat(t("programme:payback"), " ").concat(t("isRequired")));
16354
- }
16355
- return [2 /*return*/];
16356
- });
16357
- }); },
16358
- },
16359
- ] },
16360
- React.createElement(antd.Radio.Group, { size: "large" }, Object.values(GuaranteePayback).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16361
- React.createElement(antd.Radio.Button, { className: "condition-radio", value: k }, t("programme:" + k)))); }))))))),
16362
- instrument &&
16363
- instrument.indexOf(exports.Instrument.RESULT_BASED) >= 0 && (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16364
- React.createElement(antd.Col, { xl: 12, md: 24 },
16365
- React.createElement("div", { className: "details-part-two" },
16366
- React.createElement(antd.Form.Item, { label: t("programme:resultMetric"), name: "resultMetric", rules: [
16367
- {
16368
- required: true,
16369
- message: "",
16370
- },
16371
- {
16372
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16373
- return __generator(this, function (_a) {
16374
- if (String(value).trim() === "" ||
16375
- String(value).trim() ===
16376
- undefined ||
16377
- value === null ||
16378
- value === undefined) {
16379
- throw new Error("".concat(t("programme:resultMetric"), " ").concat(t("isRequired")));
16380
- }
16381
- return [2 /*return*/];
16382
- });
16383
- }); },
16384
- },
16385
- ] },
16386
- React.createElement(antd.Input, { size: "large" })))),
16387
- React.createElement(antd.Col, { xl: 12, md: 24 },
16388
- React.createElement("div", { className: "details-part-two" },
16389
- React.createElement(antd.Form.Item, { label: t("programme:paymentPerMetric"), name: "paymentPerMetric", rules: [
16390
- {
16391
- required: true,
16392
- message: "",
16393
- },
16394
- {
16395
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16396
- return __generator(this, function (_a) {
16397
- if (String(value).trim() === "" ||
16398
- String(value).trim() ===
16399
- undefined ||
16400
- value === null ||
16401
- value === undefined) {
16402
- throw new Error("".concat(t("programme:paymentPerMetric"), " ").concat(t("isRequired")));
16403
- }
16404
- else if (!isNaN(value)) {
16405
- return [2 /*return*/, Promise.resolve()];
16406
- }
16407
- else {
16408
- throw new Error("".concat(t("programme:paymentPerMetric"), " ").concat(t("isInvalid")));
16409
- }
16410
- });
16411
- }); },
16412
- },
16413
- ] },
16414
- React.createElement(antd.Input, { size: "large" })))))),
16415
- instrument &&
16416
- instrument.indexOf(exports.Instrument.INKIND) >= 0 && (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16417
- React.createElement(antd.Col, { xl: 12, md: 24 },
16418
- React.createElement("div", { className: "details-part-two" },
16419
- React.createElement(antd.Form.Item, { label: t("programme:description"), name: "description", rules: [
16420
- {
16421
- required: false,
16422
- message: "",
16423
- },
16424
- ] },
16425
- React.createElement(antd.Input, { size: "large" })))))),
16426
- instrument &&
16427
- instrument.indexOf(exports.Instrument.INSURANCE) >= 0 && (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16428
- React.createElement(antd.Col, { xl: 8, md: 12 },
16429
- React.createElement("div", { className: "details-part-two" },
16430
- React.createElement(antd.Form.Item, { label: t("programme:payback"), wrapperCol: { span: 13 }, className: "role-group", name: "insurancePayback", rules: [
16352
+ React.createElement(antd.Col, { xl: 12, md: 24 },
16353
+ React.createElement("div", { className: "details-part-one" },
16354
+ React.createElement(antd.Form.Item, { label: t("programme:investorName"), name: "toCompanyId", wrapperCol: { span: 24 }, className: "organisation", rules: [
16355
+ {
16356
+ required: true,
16357
+ message: "".concat(t("programme:investorName"), " ").concat(t("isRequired")),
16358
+ },
16359
+ ] },
16360
+ React.createElement(antd.Select, { size: "large", loading: loadingList }, organisationsList.map(function (organisation) {
16361
+ if (data === null || data === void 0 ? void 0 : data.programmeId) {
16362
+ if (data.companyId
16363
+ .map(function (id) { return Number(id); })
16364
+ .includes(Number(organisation.companyId))) {
16365
+ return (React.createElement(antd.Select.Option, { key: organisation.companyId, value: organisation.companyId }, organisation.name));
16366
+ }
16367
+ }
16368
+ else {
16369
+ return (React.createElement(antd.Select.Option, { key: organisation.companyId, value: organisation.companyId }, organisation.name));
16370
+ }
16371
+ }))))),
16372
+ React.createElement(antd.Col, { xl: 12, md: 24 },
16373
+ React.createElement("div", { className: "details-part-two" },
16374
+ React.createElement(antd.Form.Item, { label: t("programme:amountInvested"), name: "amount", rules: [
16375
+ {
16376
+ required: true,
16377
+ message: "",
16378
+ },
16379
+ {
16380
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16381
+ return __generator(this, function (_a) {
16382
+ if (String(value).trim() === "" ||
16383
+ String(value).trim() ===
16384
+ undefined ||
16385
+ value === null ||
16386
+ value === undefined) {
16387
+ throw new Error("".concat(t("programme:amountInvested"), " ").concat(t("isRequired")));
16388
+ }
16389
+ else if (!isNaN(value) &&
16390
+ Number(value) > 0) {
16391
+ return [2 /*return*/, Promise.resolve()];
16392
+ }
16393
+ else {
16394
+ throw new Error("".concat(t("programme:amountInvested"), " ").concat(t("isInvalid")));
16395
+ }
16396
+ });
16397
+ }); },
16398
+ },
16399
+ ] },
16400
+ React.createElement(antd.Input, { size: "large" }))))),
16401
+ React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16402
+ React.createElement(antd.Col, { xl: 24, md: 24 },
16403
+ React.createElement(antd.Form.Item, { label: t("programme:instrument"), name: "instrument", required: true, className: "investment-radio-button", rules: [
16431
16404
  {
16432
16405
  required: true,
16433
16406
  message: "",
@@ -16436,79 +16409,422 @@ var InvestmentCreationComponent = function (props) {
16436
16409
  validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16437
16410
  return __generator(this, function (_a) {
16438
16411
  if (String(value).trim() === "" ||
16439
- String(value).trim() ===
16440
- undefined ||
16412
+ String(value).trim() === undefined ||
16441
16413
  value === null ||
16442
16414
  value === undefined) {
16443
- throw new Error("".concat(t("programme:payback"), " ").concat(t("isRequired")));
16415
+ throw new Error("".concat(t("programme:instrument"), " ").concat(t("isRequired")));
16444
16416
  }
16445
16417
  return [2 /*return*/];
16446
16418
  });
16447
16419
  }); },
16448
16420
  },
16449
16421
  ] },
16450
- React.createElement(antd.Radio.Group, { size: "large" }, Object.values(InsurancePayback).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16451
- React.createElement(antd.Radio.Button, { className: "condition-radio", value: k }, t("programme:" + k)))); }))))))),
16452
- instrument &&
16453
- instrument.indexOf(exports.Instrument.OTHER) >= 0 && (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16454
- React.createElement(antd.Col, { xl: 12, md: 24 },
16455
- React.createElement("div", { className: "details-part-two" },
16456
- React.createElement(antd.Form.Item, { label: t("programme:comments"), name: "comments", rules: [
16422
+ React.createElement(antd.Radio.Group, { onChange: onInstrumentChange, value: instrument[0] }, instrumentOptions.map(function (e) {
16423
+ return (React.createElement(antd.Radio, { value: e.value }, e.label));
16424
+ }))))),
16425
+ instrument &&
16426
+ instrument.indexOf(exports.Instrument.LOAN) >= 0 && (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16427
+ React.createElement(antd.Col, { xl: 8, md: 12 },
16428
+ React.createElement("div", { className: "details-part-two" },
16429
+ React.createElement(antd.Form.Item, { label: t("programme:interestRate"), name: "interestRate", rules: [
16430
+ {
16431
+ required: true,
16432
+ message: "",
16433
+ },
16434
+ {
16435
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16436
+ return __generator(this, function (_a) {
16437
+ if (String(value).trim() === "" ||
16438
+ String(value).trim() ===
16439
+ undefined ||
16440
+ value === null ||
16441
+ value === undefined) {
16442
+ throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isRequired")));
16443
+ }
16444
+ else if (!isNaN(value)) {
16445
+ return [2 /*return*/, Promise.resolve()];
16446
+ }
16447
+ else {
16448
+ throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isInvalid")));
16449
+ }
16450
+ });
16451
+ }); },
16452
+ },
16453
+ ] },
16454
+ React.createElement(antd.Input, { size: "large" })))))),
16455
+ instrument &&
16456
+ (instrument.indexOf(exports.Instrument.CONLOAN) >= 0 ||
16457
+ instrument.indexOf(exports.Instrument.NONCONLOAN) >=
16458
+ 0) && (React.createElement("div", { className: "details-part-two" },
16459
+ React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16460
+ React.createElement(antd.Col, { xl: 8, md: 12 },
16461
+ React.createElement(antd.Form.Item, { label: t("programme:interestRate"), name: "interestRate", rules: [
16462
+ {
16463
+ required: true,
16464
+ message: "",
16465
+ },
16466
+ {
16467
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16468
+ return __generator(this, function (_a) {
16469
+ if (String(value).trim() === "" ||
16470
+ String(value).trim() ===
16471
+ undefined ||
16472
+ value === null ||
16473
+ value === undefined) {
16474
+ throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isRequired")));
16475
+ }
16476
+ else if (!isNaN(value)) {
16477
+ return [2 /*return*/, Promise.resolve()];
16478
+ }
16479
+ else {
16480
+ throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isInvalid")));
16481
+ }
16482
+ });
16483
+ }); },
16484
+ },
16485
+ ] },
16486
+ React.createElement(antd.Input, { size: "large" })))),
16487
+ React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16488
+ React.createElement(antd.Col, { xl: 8, md: 12 },
16489
+ React.createElement(antd.Form.Item, { label: t("programme:loanPeriod"), name: "period", required: true, rules: [
16490
+ {
16491
+ required: true,
16492
+ message: "",
16493
+ },
16494
+ {
16495
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16496
+ return __generator(this, function (_a) {
16497
+ if (String(value).trim() === "" ||
16498
+ String(value).trim() ===
16499
+ undefined ||
16500
+ value === null ||
16501
+ value === undefined) {
16502
+ throw new Error("".concat(t("programme:loanPeriod"), " ").concat(t("isRequired")));
16503
+ }
16504
+ return [2 /*return*/];
16505
+ });
16506
+ }); },
16507
+ },
16508
+ ] },
16509
+ React.createElement(RangePicker$3, { showTime: true, allowClear: true, format: "DD:MM:YYYY", size: "large" }))),
16510
+ React.createElement(antd.Col, { xl: 8, md: 12 },
16511
+ React.createElement(antd.Form.Item, { label: t("programme:startOfPayback"), name: "startOfPayback", rules: [
16512
+ {
16513
+ required: true,
16514
+ message: "",
16515
+ },
16516
+ {
16517
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16518
+ return __generator(this, function (_a) {
16519
+ if (String(value).trim() === "" ||
16520
+ String(value).trim() ===
16521
+ undefined ||
16522
+ value === null ||
16523
+ value === undefined) {
16524
+ throw new Error("".concat(t("programme:startOfPayback"), " ").concat(t("isRequired")));
16525
+ }
16526
+ return [2 /*return*/];
16527
+ });
16528
+ }); },
16529
+ },
16530
+ ] },
16531
+ React.createElement(antd.DatePicker, { size: "large", disabledDate: function (currentDate) {
16532
+ return currentDate <
16533
+ moment().startOf("day");
16534
+ } })))))),
16535
+ instrument &&
16536
+ instrument.indexOf(exports.Instrument.GUARANTEE) >= 0 && (React.createElement("div", { className: "details-part-two" },
16537
+ React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16538
+ React.createElement(antd.Col, { xl: 8, md: 12 },
16539
+ React.createElement(antd.Form.Item, { label: t("programme:interestRate"), name: "interestRate", rules: [
16540
+ {
16541
+ required: true,
16542
+ message: "",
16543
+ },
16544
+ {
16545
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16546
+ return __generator(this, function (_a) {
16547
+ if (String(value).trim() === "" ||
16548
+ String(value).trim() ===
16549
+ undefined ||
16550
+ value === null ||
16551
+ value === undefined) {
16552
+ throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isRequired")));
16553
+ }
16554
+ else if (!isNaN(value)) {
16555
+ return [2 /*return*/, Promise.resolve()];
16556
+ }
16557
+ else {
16558
+ throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isInvalid")));
16559
+ }
16560
+ });
16561
+ }); },
16562
+ },
16563
+ ] },
16564
+ React.createElement(antd.Input, { size: "large" })))),
16565
+ React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16566
+ React.createElement(antd.Col, { xl: 8, md: 12 },
16567
+ React.createElement(antd.Form.Item, { label: t("programme:period"), name: "period", required: true, rules: [
16568
+ {
16569
+ required: true,
16570
+ message: "",
16571
+ },
16572
+ {
16573
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16574
+ return __generator(this, function (_a) {
16575
+ if (String(value).trim() === "" ||
16576
+ String(value).trim() ===
16577
+ undefined ||
16578
+ value === null ||
16579
+ value === undefined) {
16580
+ throw new Error("".concat(t("programme:period"), " ").concat(t("isRequired")));
16581
+ }
16582
+ return [2 /*return*/];
16583
+ });
16584
+ }); },
16585
+ },
16586
+ ] },
16587
+ React.createElement(RangePicker$3, { showTime: true, allowClear: true, format: "DD:MM:YYYY", size: "large" }))),
16588
+ React.createElement(antd.Col, { xl: 8, md: 12 },
16589
+ React.createElement(antd.Form.Item, { label: t("programme:payback"), wrapperCol: { span: 13 }, className: "role-group", name: "guaranteePayback", rules: [
16590
+ {
16591
+ required: true,
16592
+ message: "",
16593
+ },
16594
+ {
16595
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16596
+ return __generator(this, function (_a) {
16597
+ if (String(value).trim() === "" ||
16598
+ String(value).trim() ===
16599
+ undefined ||
16600
+ value === null ||
16601
+ value === undefined) {
16602
+ throw new Error("".concat(t("programme:payback"), " ").concat(t("isRequired")));
16603
+ }
16604
+ return [2 /*return*/];
16605
+ });
16606
+ }); },
16607
+ },
16608
+ ] },
16609
+ React.createElement(antd.Radio.Group, { size: "large" }, Object.values(GuaranteePayback).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16610
+ React.createElement(antd.Radio.Button, { className: "condition-radio", value: k }, t("programme:" + k)))); }))))))),
16611
+ instrument &&
16612
+ instrument.indexOf(exports.Instrument.RESULT_BASED) >=
16613
+ 0 && (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16614
+ React.createElement(antd.Col, { xl: 12, md: 24 },
16615
+ React.createElement("div", { className: "details-part-two" },
16616
+ React.createElement(antd.Form.Item, { label: t("programme:resultMetric"), name: "resultMetric", rules: [
16617
+ {
16618
+ required: true,
16619
+ message: "",
16620
+ },
16621
+ {
16622
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16623
+ return __generator(this, function (_a) {
16624
+ if (String(value).trim() === "" ||
16625
+ String(value).trim() ===
16626
+ undefined ||
16627
+ value === null ||
16628
+ value === undefined) {
16629
+ throw new Error("".concat(t("programme:resultMetric"), " ").concat(t("isRequired")));
16630
+ }
16631
+ return [2 /*return*/];
16632
+ });
16633
+ }); },
16634
+ },
16635
+ ] },
16636
+ React.createElement(antd.Input, { size: "large" })))),
16637
+ React.createElement(antd.Col, { xl: 12, md: 24 },
16638
+ React.createElement("div", { className: "details-part-two" },
16639
+ React.createElement(antd.Form.Item, { label: t("programme:paymentPerMetric"), name: "paymentPerMetric", rules: [
16640
+ {
16641
+ required: true,
16642
+ message: "",
16643
+ },
16644
+ {
16645
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16646
+ return __generator(this, function (_a) {
16647
+ if (String(value).trim() === "" ||
16648
+ String(value).trim() ===
16649
+ undefined ||
16650
+ value === null ||
16651
+ value === undefined) {
16652
+ throw new Error("".concat(t("programme:paymentPerMetric"), " ").concat(t("isRequired")));
16653
+ }
16654
+ else if (!isNaN(value)) {
16655
+ return [2 /*return*/, Promise.resolve()];
16656
+ }
16657
+ else {
16658
+ throw new Error("".concat(t("programme:paymentPerMetric"), " ").concat(t("isInvalid")));
16659
+ }
16660
+ });
16661
+ }); },
16662
+ },
16663
+ ] },
16664
+ React.createElement(antd.Input, { size: "large" })))))),
16665
+ instrument &&
16666
+ instrument.indexOf(exports.Instrument.INKIND) >= 0 && (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16667
+ React.createElement(antd.Col, { xl: 12, md: 24 },
16668
+ React.createElement("div", { className: "details-part-two" },
16669
+ React.createElement(antd.Form.Item, { label: t("programme:description"), name: "description", rules: [
16670
+ {
16671
+ required: false,
16672
+ message: "",
16673
+ },
16674
+ ] },
16675
+ React.createElement(antd.Input, { size: "large" })))))),
16676
+ instrument &&
16677
+ instrument.indexOf(exports.Instrument.INSURANCE) >= 0 && (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16678
+ React.createElement(antd.Col, { xl: 8, md: 12 },
16679
+ React.createElement("div", { className: "details-part-two" },
16680
+ React.createElement(antd.Form.Item, { label: t("programme:payback"), wrapperCol: { span: 13 }, className: "role-group", name: "insurancePayback", rules: [
16681
+ {
16682
+ required: true,
16683
+ message: "",
16684
+ },
16685
+ {
16686
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16687
+ return __generator(this, function (_a) {
16688
+ if (String(value).trim() === "" ||
16689
+ String(value).trim() ===
16690
+ undefined ||
16691
+ value === null ||
16692
+ value === undefined) {
16693
+ throw new Error("".concat(t("programme:payback"), " ").concat(t("isRequired")));
16694
+ }
16695
+ return [2 /*return*/];
16696
+ });
16697
+ }); },
16698
+ },
16699
+ ] },
16700
+ React.createElement(antd.Radio.Group, { size: "large" }, Object.values(InsurancePayback).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16701
+ React.createElement(antd.Radio.Button, { className: "condition-radio", value: k }, t("programme:" + k)))); }))))))),
16702
+ instrument &&
16703
+ instrument.indexOf(exports.Instrument.OTHER) >= 0 && (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16704
+ React.createElement(antd.Col, { xl: 12, md: 24 },
16705
+ React.createElement("div", { className: "details-part-two" },
16706
+ React.createElement(antd.Form.Item, { label: t("programme:comments"), name: "comments", rules: [
16707
+ {
16708
+ required: true,
16709
+ message: "",
16710
+ },
16711
+ {
16712
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16713
+ return __generator(this, function (_a) {
16714
+ if (String(value).trim() === "" ||
16715
+ String(value).trim() ===
16716
+ undefined ||
16717
+ value === null ||
16718
+ value === undefined) {
16719
+ throw new Error("".concat(t("programme:comments"), " ").concat(t("isRequired")));
16720
+ }
16721
+ return [2 /*return*/];
16722
+ });
16723
+ }); },
16724
+ },
16725
+ ] },
16726
+ React.createElement(antd.Input, { size: "large" })))))),
16727
+ React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16728
+ React.createElement(antd.Col, { xl: 8, md: 12 },
16729
+ React.createElement(antd.Form.Item, { label: t("programme:type"), wrapperCol: { span: 13 }, className: "role-group", name: "type", rules: [
16457
16730
  {
16458
- required: true,
16459
- message: "",
16731
+ required: false,
16460
16732
  },
16733
+ ] },
16734
+ React.createElement(antd.Radio.Group, { size: "large" }, Object.values(exports.InvestmentType).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16735
+ React.createElement(antd.Radio.Button, { className: "condition-radio", value: k, onClick: function (e) {
16736
+ return deselectOnClick(e, "type");
16737
+ } }, t("programme:" + k)))); })))),
16738
+ React.createElement(antd.Col, { xl: 8, md: 12 },
16739
+ React.createElement(antd.Form.Item, { label: t("programme:level"), wrapperCol: { span: 13 }, className: "role-group", name: "level", rules: [
16461
16740
  {
16462
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16463
- return __generator(this, function (_a) {
16464
- if (String(value).trim() === "" ||
16465
- String(value).trim() ===
16466
- undefined ||
16467
- value === null ||
16468
- value === undefined) {
16469
- throw new Error("".concat(t("programme:comments"), " ").concat(t("isRequired")));
16470
- }
16471
- return [2 /*return*/];
16472
- });
16473
- }); },
16741
+ required: false,
16474
16742
  },
16475
16743
  ] },
16476
- React.createElement(antd.Input, { size: "large" })))))),
16477
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16478
- React.createElement(antd.Col, { xl: 8, md: 12 },
16479
- React.createElement(antd.Form.Item, { label: t("programme:type"), wrapperCol: { span: 13 }, className: "role-group", name: "type", rules: [
16480
- {
16481
- required: false,
16482
- },
16483
- ] },
16484
- React.createElement(antd.Radio.Group, { size: "large" }, Object.values(exports.InvestmentType).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16485
- React.createElement(antd.Radio.Button, { className: "condition-radio", value: k, onClick: function (e) {
16486
- return deselectOnClick(e, "type");
16487
- } }, t("programme:" + k)))); })))),
16488
- React.createElement(antd.Col, { xl: 8, md: 12 },
16489
- React.createElement(antd.Form.Item, { label: t("programme:level"), wrapperCol: { span: 13 }, className: "role-group", name: "level", rules: [
16490
- {
16491
- required: false,
16492
- },
16493
- ] },
16494
- React.createElement(antd.Radio.Group, { size: "large" }, Object.values(exports.InvestmentLevel).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16495
- React.createElement(antd.Radio.Button, { className: "condition-radio", value: k, onClick: function (e) {
16496
- return deselectOnClick(e, "level");
16497
- } }, t("programme:" + k)))); })))),
16498
- React.createElement(antd.Col, { xl: 8, md: 12 },
16499
- React.createElement(antd.Form.Item, { label: t("programme:stream"), wrapperCol: { span: 13 }, className: "role-group", name: "stream", rules: [
16500
- {
16501
- required: false,
16502
- },
16503
- ] },
16504
- React.createElement(antd.Radio.Group, { size: "large" }, Object.values(exports.InvestmentStream).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16505
- React.createElement(antd.Radio.Button, { className: "condition-radio", value: k, onClick: function (e) {
16506
- return deselectOnClick(e, "stream");
16507
- } }, t("programme:" + k)))); }))))),
16508
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16509
- React.createElement(antd.Col, { xl: 12, md: 24 },
16510
- React.createElement(antd.Form.Item, { label: t("programme:esgType"), name: "esgClassification" },
16511
- React.createElement(antd.Select, { size: "large" }, Object.values(exports.ESGType).map(function (esg) { return (React.createElement(antd.Select.Option, { value: esg }, esg)); }))))),
16744
+ React.createElement(antd.Radio.Group, { size: "large" }, Object.values(exports.InvestmentLevel).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16745
+ React.createElement(antd.Radio.Button, { className: "condition-radio", value: k, onClick: function (e) {
16746
+ return deselectOnClick(e, "level");
16747
+ } }, t("programme:" + k)))); })))),
16748
+ React.createElement(antd.Col, { xl: 8, md: 12 },
16749
+ React.createElement(antd.Form.Item, { label: t("programme:stream"), wrapperCol: { span: 13 }, className: "role-group", name: "stream", rules: [
16750
+ {
16751
+ required: false,
16752
+ },
16753
+ ] },
16754
+ React.createElement(antd.Radio.Group, { size: "large" }, Object.values(exports.InvestmentStream).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16755
+ React.createElement(antd.Radio.Button, { className: "condition-radio", value: k, onClick: function (e) {
16756
+ return deselectOnClick(e, "stream");
16757
+ } }, t("programme:" + k)))); }))))),
16758
+ React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16759
+ React.createElement(antd.Col, { xl: 12, md: 24 },
16760
+ React.createElement(antd.Form.Item, { label: t("programme:esgType"), name: "esgClassification" },
16761
+ React.createElement(antd.Select, { size: "large" }, Object.values(exports.ESGType).map(function (esg) { return (React.createElement(antd.Select.Option, { value: esg }, esg)); }))))))),
16762
+ typeCreation == exports.InvestmentCreationType.EXISTING && (React.createElement("div", null,
16763
+ React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16764
+ React.createElement(antd.Col, { xl: 12, md: 24 },
16765
+ React.createElement("div", { className: "details-part-one" },
16766
+ React.createElement(antd.Form.Item, { label: t("programme:existingInvestmentSource"), name: "existinngInvestmentId", wrapperCol: { span: 24 }, rules: [
16767
+ {
16768
+ required: true,
16769
+ message: "".concat(t("programme:existingInvestmentSource"), " ").concat(t("isRequired")),
16770
+ },
16771
+ ] },
16772
+ React.createElement(antd.Select, { size: "large", loading: loadingInvestment, onChange: setSelectedInvestment }, nationalInvestmentList.map(function (investment) { return (React.createElement(antd.Select.Option, { key: investment.requestId, value: investment.requestId }, investment.investmentName)); })))))),
16773
+ React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16774
+ React.createElement(antd.Col, { xl: 12, md: 24 },
16775
+ React.createElement("div", { className: "details-part-two" },
16776
+ React.createElement(antd.Form.Item, { label: t("programme:amountInvested"), name: "amount", rules: [
16777
+ {
16778
+ required: true,
16779
+ message: "",
16780
+ },
16781
+ {
16782
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16783
+ return __generator(this, function (_a) {
16784
+ if (String(value).trim() === "" ||
16785
+ String(value).trim() ===
16786
+ undefined ||
16787
+ value === null ||
16788
+ value === undefined) {
16789
+ throw new Error("".concat(t("programme:amountInvested"), " ").concat(t("isRequired")));
16790
+ }
16791
+ else if (!isNaN(value) &&
16792
+ Number(value) > 0) {
16793
+ return [2 /*return*/, Promise.resolve()];
16794
+ }
16795
+ else {
16796
+ throw new Error("".concat(t("programme:amountInvested"), " ").concat(t("isInvalid")));
16797
+ }
16798
+ });
16799
+ }); },
16800
+ },
16801
+ function (_a) {
16802
+ var getFieldValue = _a.getFieldValue;
16803
+ return ({
16804
+ validator: function (rule, v) {
16805
+ if (getFieldValue("amount") &&
16806
+ investmentData &&
16807
+ investmentData.amount <
16808
+ parseFloat(getFieldValue("amount"))) {
16809
+ // eslint-disable-next-line prefer-promise-reject-errors
16810
+ return Promise.reject("Amount > Available");
16811
+ }
16812
+ return Promise.resolve();
16813
+ },
16814
+ });
16815
+ },
16816
+ ] },
16817
+ React.createElement(antd.Input, { size: "large" })))),
16818
+ React.createElement(antd.Col, { xl: 12, md: 24 },
16819
+ React.createElement("div", { className: "details-part-two" },
16820
+ React.createElement(antd.Form.Item, { label: " ", name: "sourceAmount" },
16821
+ React.createElement("div", null,
16822
+ "/",
16823
+ React.createElement(antd.InputNumber, { size: "large", width: "100%", formatter: function (value) {
16824
+ return "$".concat(addCommSep(value));
16825
+ }, disabled: true, value: investmentData
16826
+ ? investmentData.amount
16827
+ : 0 })))))))),
16512
16828
  React.createElement(antd.Form.Item, null,
16513
16829
  React.createElement("div", { className: "steps-actions" },
16514
16830
  React.createElement(antd.Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: nextOne }, t("programme:next")))))))),
@@ -16518,73 +16834,164 @@ var InvestmentCreationComponent = function (props) {
16518
16834
  React.createElement("div", { className: "step-count" }, "02"),
16519
16835
  React.createElement("div", { className: "title" }, t("programme:ownership")))),
16520
16836
  description: current === 1 && (React.createElement("div", null,
16521
- React.createElement("div", { className: "programme-sought-form-container ownership-container" }, Object.keys(data).length > 0 && (React.createElement("div", { className: "programme-sought-form" },
16522
- React.createElement(antd.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 :
16523
- data.companyId.map(function (companyId, index) {
16524
- return (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16525
- React.createElement(antd.Col, { xl: 8, md: 15 },
16526
- React.createElement("div", { className: "label" },
16527
- companyName[companyId].name,
16528
- React.createElement("span", { className: "required-mark" }, "*"))),
16529
- React.createElement(antd.Col, { xl: 8, md: 9 },
16530
- React.createElement(antd.Form.Item, { className: "inline", name: ["percentage", index], initialValue: 0, rules: [
16531
- {
16532
- pattern: new RegExp(/^[+]?([.]\d+|\d+[.]?\d*)$/g),
16533
- message: "Percentage Should be a positive number",
16534
- },
16837
+ React.createElement("div", { className: "investment-sought-form-container" },
16838
+ React.createElement("div", { className: "investment-sought-form" },
16839
+ React.createElement(antd.Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, name: "investment-sought", className: "investment-sought-form", layout: "vertical", requiredMark: true },
16840
+ React.createElement(antd.Row, { className: "row", gutter: [4, 4] },
16841
+ React.createElement(antd.Col, { xl: 8, md: 12 },
16842
+ React.createElement(antd.Form.Item, { label: t("programme:typeCreation"), wrapperCol: { span: 13 }, className: "role-group", name: "investmentOwnershipType", rules: [
16535
16843
  {
16536
- required: true,
16537
- message: "Required field",
16538
- },
16539
- function (_a) {
16540
- var getFieldValue = _a.getFieldValue;
16541
- return ({
16542
- validator: function (rule, v) {
16543
- if (getFieldValue([
16544
- "percentage",
16545
- index,
16546
- ]) &&
16547
- parseFloat(getFieldValue([
16548
- "percentage",
16549
- index,
16550
- ])) >
16551
- data.proponentPercentage[index]) {
16552
- // eslint-disable-next-line prefer-promise-reject-errors
16553
- return Promise.reject("Amount > Available");
16554
- }
16555
- return Promise.resolve();
16556
- },
16557
- });
16844
+ required: false,
16558
16845
  },
16559
16846
  ] },
16560
- React.createElement(antd.InputNumber, { placeholder: "", controls: false, disabled: govData.companyId == companyId,
16561
- // disabled={userInfoState?.companyId === Number(companyId)}
16562
- onKeyPress: function (event) {
16563
- if (!/[0-9\.]/.test(event.key)) {
16564
- event.preventDefault();
16565
- }
16566
- } })),
16567
- React.createElement("div", { className: "inline separator" }, "/"),
16568
- React.createElement(antd.Form.Item, { className: "inline" },
16569
- React.createElement(antd.InputNumber, { placeholder: String(data === null || data === void 0 ? void 0 : data.proponentPercentage[index]), disabled: true })))));
16570
- }),
16571
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16572
- React.createElement(antd.Col, { xl: 8, md: 15 },
16573
- React.createElement("div", { className: "label" }, t("programme:total"))),
16574
- React.createElement(antd.Col, { xl: 8, md: 9 },
16575
- React.createElement(antd.Form.Item, { className: "inline", name: ["total"] },
16576
- React.createElement(antd.InputNumber, { placeholder: currentPercTotal + "", controls: false, disabled: true, onKeyPress: function (event) {
16577
- if (!/[0-9\.]/.test(event.key)) {
16578
- event.preventDefault();
16847
+ React.createElement(antd.Radio.Group, { size: "large", defaultValue: typeCreation ==
16848
+ exports.InvestmentCreationType.EXISTING
16849
+ ? exports.InvestmentOwnershipType.PROJECT
16850
+ : investmentOwnershipType }, Object.values(exports.InvestmentOwnershipType).map(function (k, index) {
16851
+ if (!(typeCreation ==
16852
+ exports.InvestmentCreationType.EXISTING &&
16853
+ k == exports.InvestmentOwnershipType.NATIONAL) &&
16854
+ !(k ==
16855
+ exports.InvestmentOwnershipType.NATIONAL &&
16856
+ (data === null || data === void 0 ? void 0 : data.programmeId))) {
16857
+ return (React.createElement("div", { className: "condition-radio-container" },
16858
+ React.createElement(antd.Tooltip, { title: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ==
16859
+ exports.CompanyRole.PROGRAMME_DEVELOPER &&
16860
+ stepOneData.toCompanyId !=
16861
+ userInfoState.companyId &&
16862
+ k ==
16863
+ exports.InvestmentOwnershipType.NATIONAL
16864
+ ? "This action is unauthorized due to the selected investor name."
16865
+ : "", color: TooltipColor, key: TooltipColor },
16866
+ React.createElement(antd.Radio.Button, { className: "condition-radio", value: k, onChange: onChangeInvestmentOwnershipType, disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ==
16867
+ exports.CompanyRole.PROGRAMME_DEVELOPER &&
16868
+ stepOneData.toCompanyId !=
16869
+ userInfoState.companyId &&
16870
+ k ==
16871
+ exports.InvestmentOwnershipType.NATIONAL }, t("programme:" + k)))));
16579
16872
  }
16580
- } })),
16581
- React.createElement("div", { className: "inline separator" }, "/"),
16582
- React.createElement(antd.Form.Item, { className: "inline" },
16583
- React.createElement(antd.InputNumber, { disabled: true, placeholder: "100" })))),
16584
- React.createElement(antd.Form.Item, null,
16585
- React.createElement("div", { className: "steps-actions" },
16586
- React.createElement(antd.Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: submitInvestment }, t("programme:submit")),
16587
- React.createElement(antd.Button, { className: "back-btn", onClick: function () { return prevOne(); }, loading: loading }, t("programme:back")))))))))),
16873
+ })))))))),
16874
+ React.createElement("div", { className: "programme-sought-form-container ownership-container" },
16875
+ React.createElement("div", { className: "programme-sought-form" },
16876
+ React.createElement(antd.Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, form: formTwo, name: "investment-sought", className: "investment-sought-form", layout: "vertical", requiredMark: true, onChange: onPercentageChange, onFinish: submitInvestment },
16877
+ allProjectData.length > 0 &&
16878
+ investmentOwnershipType ==
16879
+ exports.InvestmentOwnershipType.PROJECT && (React.createElement("div", null,
16880
+ React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16881
+ React.createElement(antd.Col, { xl: 12, md: 24 },
16882
+ React.createElement("div", { className: "details-part-one" },
16883
+ React.createElement(antd.Form.Item, { label: t("programme:title"), name: "projectId", wrapperCol: { span: 24 }, initialValue: (data === null || data === void 0 ? void 0 : data.programmeId) != undefined
16884
+ ? allProjectData[0].programmeId
16885
+ : null, rules: [
16886
+ {
16887
+ required: true,
16888
+ message: "".concat(t("programme:title"), " ").concat(t("isRequired")),
16889
+ },
16890
+ ] },
16891
+ React.createElement(antd.Select, { size: "large", loading: loadingProgData,
16892
+ // defaultValue={
16893
+ // allProjectData.length == 1
16894
+ // ? allProjectData[0].programmeId
16895
+ // : null
16896
+ // }
16897
+ disabled: allProjectData.length == 1 &&
16898
+ (data === null || data === void 0 ? void 0 : data.programmeId) != undefined, onChange: setSelectedProgramme }, allProjectData.map(function (project) {
16899
+ if ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ==
16900
+ exports.CompanyRole.PROGRAMME_DEVELOPER &&
16901
+ Number(stepOneData.toCompanyId) !=
16902
+ userInfoState.companyId) {
16903
+ if (project.companyId
16904
+ .map(function (id) { return Number(id); })
16905
+ .includes(userInfoState.companyId)) {
16906
+ return (React.createElement(antd.Select.Option, { key: project.programmeId, value: project.programmeId }, project.title));
16907
+ }
16908
+ }
16909
+ else if ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ===
16910
+ exports.CompanyRole.MINISTRY) {
16911
+ if (ministrySectoralScope.includes(project.sectoralScope)) {
16912
+ return (React.createElement(antd.Select.Option, { key: project.programmeId, value: project.programmeId }, project.title));
16913
+ }
16914
+ }
16915
+ else {
16916
+ return (React.createElement(antd.Select.Option, { key: project.programmeId, value: project.programmeId }, project.title));
16917
+ }
16918
+ })))))), projectData === null || projectData === void 0 ? void 0 :
16919
+ projectData.companyId.map(function (companyId, index) {
16920
+ if (formTwo.getFieldValue("percentage") &&
16921
+ formTwo.getFieldValue("percentage")[index] &&
16922
+ companyId == stepOneData.toCompanyId) {
16923
+ formTwo.getFieldValue("percentage")[index] = 0;
16924
+ }
16925
+ return (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16926
+ React.createElement(antd.Col, { xl: 8, md: 15 },
16927
+ React.createElement("div", { className: "label" },
16928
+ govData.companyId == companyId
16929
+ ? govData.name
16930
+ : companyNames[Number(companyId)],
16931
+ React.createElement("span", { className: "required-mark" }, "*"))),
16932
+ React.createElement(antd.Col, { xl: 8, md: 9 },
16933
+ React.createElement(antd.Form.Item, { className: "inline", name: ["percentage", index], initialValue: 0, rules: [
16934
+ {
16935
+ pattern: new RegExp(/^[+]?([.]\d+|\d+[.]?\d*)$/g),
16936
+ message: "Percentage Should be a positive number",
16937
+ },
16938
+ {
16939
+ required: true,
16940
+ message: "Required field",
16941
+ },
16942
+ function (_a) {
16943
+ var getFieldValue = _a.getFieldValue;
16944
+ return ({
16945
+ validator: function (rule, v) {
16946
+ if (getFieldValue([
16947
+ "percentage",
16948
+ index,
16949
+ ]) &&
16950
+ parseFloat(getFieldValue([
16951
+ "percentage",
16952
+ index,
16953
+ ])) >
16954
+ projectData
16955
+ .proponentPercentage[index]) {
16956
+ // eslint-disable-next-line prefer-promise-reject-errors
16957
+ return Promise.reject("Amount > Available");
16958
+ }
16959
+ return Promise.resolve();
16960
+ },
16961
+ });
16962
+ },
16963
+ ] },
16964
+ React.createElement(antd.InputNumber, { placeholder: "", controls: false, disabled: govData.companyId ==
16965
+ companyId ||
16966
+ companyId ==
16967
+ stepOneData.toCompanyId, value: 0,
16968
+ // disabled={userInfoState?.companyId === Number(companyId)}
16969
+ onKeyPress: function (event) {
16970
+ if (!/[0-9\.]/.test(event.key)) {
16971
+ event.preventDefault();
16972
+ }
16973
+ } })),
16974
+ React.createElement("div", { className: "inline separator" }, "/"),
16975
+ React.createElement(antd.Form.Item, { className: "inline" },
16976
+ React.createElement(antd.InputNumber, { placeholder: String(projectData === null || projectData === void 0 ? void 0 : projectData.proponentPercentage[index]), disabled: true })))));
16977
+ }),
16978
+ React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16979
+ React.createElement(antd.Col, { xl: 8, md: 15 },
16980
+ React.createElement("div", { className: "label" }, t("programme:total"))),
16981
+ React.createElement(antd.Col, { xl: 8, md: 9 },
16982
+ React.createElement(antd.Form.Item, { className: "inline", name: ["total"] },
16983
+ React.createElement(antd.InputNumber, { placeholder: currentPercTotal + "", controls: false, disabled: true, onKeyPress: function (event) {
16984
+ if (!/[0-9\.]/.test(event.key)) {
16985
+ event.preventDefault();
16986
+ }
16987
+ } })),
16988
+ React.createElement("div", { className: "inline separator" }, "/"),
16989
+ React.createElement(antd.Form.Item, { className: "inline" },
16990
+ React.createElement(antd.InputNumber, { disabled: true, placeholder: "100" })))))),
16991
+ React.createElement(antd.Form.Item, null,
16992
+ React.createElement("div", { className: "steps-actions" },
16993
+ React.createElement(antd.Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: submitInvestment }, t("programme:submit")),
16994
+ React.createElement(antd.Button, { className: "back-btn", onClick: function () { return prevOne(); }, loading: loading }, t("programme:back"))))))))),
16588
16995
  },
16589
16996
  ] })))));
16590
16997
  };
@@ -17085,7 +17492,10 @@ var InvestmentManagementComponent = function (props) {
17085
17492
  sorter: true,
17086
17493
  align: "left",
17087
17494
  render: function (item) {
17088
- return React.createElement("span", { className: "clickable" }, item);
17495
+ if (item) {
17496
+ return React.createElement("span", { className: "clickable" }, item);
17497
+ }
17498
+ return React.createElement("span", null, "-");
17089
17499
  },
17090
17500
  onCell: function (record, rowIndex) {
17091
17501
  return {
@@ -17143,6 +17553,12 @@ var InvestmentManagementComponent = function (props) {
17143
17553
  key: "programmeSector",
17144
17554
  sorter: true,
17145
17555
  align: "left",
17556
+ render: function (item) {
17557
+ if (item) {
17558
+ return React.createElement("span", null, item);
17559
+ }
17560
+ return React.createElement("span", null, "-");
17561
+ },
17146
17562
  },
17147
17563
  {
17148
17564
  title: t("programme:investor"),
@@ -17226,7 +17642,11 @@ var InvestmentManagementComponent = function (props) {
17226
17642
  React.createElement("div", { className: "title-bar" },
17227
17643
  React.createElement("div", { className: "body-title" }, t("programme:investmentTitle")),
17228
17644
  React.createElement("div", { className: "body-sub-title" }, t("programme:investmentDesc"))),
17229
- React.createElement("div", { className: "actions" }, enableAddOwnership && (React.createElement("div", { className: "action-bar" },
17645
+ React.createElement("div", { className: "actions" }, enableAddOwnership &&
17646
+ ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) == exports.CompanyRole.MINISTRY ||
17647
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) == exports.CompanyRole.GOVERNMENT ||
17648
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) == exports.CompanyRole.PROGRAMME_DEVELOPER) &&
17649
+ userInfoState.userRole != exports.Role.ViewOnly && (React.createElement("div", { className: "action-bar" },
17230
17650
  React.createElement(antd.Button, { type: "primary", size: "large", block: true, icon: React.createElement(icons.PlusOutlined, null), onClick: onClickAddOwnership }, t("programme:addOwnership")))))),
17231
17651
  React.createElement("div", { className: "content-card" },
17232
17652
  React.createElement(antd.Row, null,
@@ -17273,7 +17693,7 @@ var InvestmentManagementComponent = function (props) {
17273
17693
  return handleTableChange(val, sorter);
17274
17694
  }, locale: {
17275
17695
  emptyText: (React.createElement(antd.Empty, { image: antd.Empty.PRESENTED_IMAGE_SIMPLE, description: tableData.length === 0
17276
- ? t("creditTransfer:noTransfer")
17696
+ ? t("programme:noInvestmentData")
17277
17697
  : null })),
17278
17698
  } }))))),
17279
17699
  popupInfo && selectedReq && (React.createElement(InvestmentActionModel, { investment: selectedReq, onCancel: function () {