@undp/carbon-library 1.0.292-CARBON-239.0 → 1.0.292-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";
@@ -6779,6 +6784,7 @@ var AddNewCompanyComponent = function (props) {
6779
6784
  },
6780
6785
  {
6781
6786
  validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
6787
+ var phoneNo;
6782
6788
  return __generator(this, function (_a) {
6783
6789
  if (String(value).trim() === "" ||
6784
6790
  String(value).trim() === undefined ||
@@ -6787,9 +6793,13 @@ var AddNewCompanyComponent = function (props) {
6787
6793
  throw new Error("".concat(t("addCompany:phoneNo"), " ").concat(t("isRequired")));
6788
6794
  }
6789
6795
  else {
6790
- PhoneInput.formatPhoneNumber(String(value));
6791
- if (!PhoneInput.isPossiblePhoneNumber(String(value))) {
6792
- throw new Error("".concat(t("addCompany:phoneNo"), " ").concat(t("isInvalid")));
6796
+ phoneNo = PhoneInput.formatPhoneNumber(String(value));
6797
+ if (String(value).trim() !== "") {
6798
+ if (phoneNo === null ||
6799
+ phoneNo === "" ||
6800
+ phoneNo === undefined) {
6801
+ throw new Error("".concat(t("addCompany:phoneNo"), " ").concat(t("isRequired")));
6802
+ }
6793
6803
  }
6794
6804
  }
6795
6805
  return [2 /*return*/];
@@ -15825,7 +15835,7 @@ var UserManagementComponent = function (props) {
15825
15835
  React.createElement(UserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: handleOk, onActionCanceled: handleCancel, openModal: openDeleteConfirmationModal, errorMsg: errorMsg, loading: loading })));
15826
15836
  };
15827
15837
 
15828
- 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";
15829
15839
  styleInject(css_248z$m);
15830
15840
 
15831
15841
  var Loading = function () {
@@ -15845,22 +15855,34 @@ var InsurancePayback;
15845
15855
 
15846
15856
  var RangePicker$3 = antd.DatePicker.RangePicker;
15847
15857
  var InvestmentCreationComponent = function (props) {
15848
- 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;
15849
15859
  var state = useLocation().state;
15850
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];
15851
15867
  var formOne = antd.Form.useForm()[0];
15852
15868
  var formTwo = antd.Form.useForm()[0];
15853
15869
  var post = useConnection().post;
15854
- var _b = React.useState(false), loading = _b[0], setLoading = _b[1];
15855
- var _c = React.useState("New"), typeCreation = _c[0], setTypeCreation = _c[1];
15856
- var _d = React.useState(false), loadingList = _d[0], setLoadingList = _d[1];
15857
- var _e = React.useState(0), current = _e[0], setCurrent = _e[1];
15858
- var _f = React.useState(0), currentPercTotal = _f[0], setCurrentPercTotal = _f[1];
15859
- var _g = React.useState([]), organisationsList = _g[0], setOrganisationList = _g[1];
15860
- var _h = React.useState([]), instrument = _h[0], setInstrument = _h[1];
15861
- var _j = React.useState(), stepOneData = _j[0], setStepOneData = _j[1];
15862
- 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];
15863
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];
15864
15886
  var instrumentOptions = Object.keys(exports.Instrument).map(function (k, index) { return ({
15865
15887
  label: addSpaces(Object.values(exports.Instrument)[index]),
15866
15888
  value: Object.values(exports.Instrument)[index],
@@ -15912,52 +15934,225 @@ var InvestmentCreationComponent = function (props) {
15912
15934
  }
15913
15935
  });
15914
15936
  }); };
15915
- var getOrganisationsDetails = function () { return __awaiter(void 0, void 0, void 0, function () {
15916
- 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;
15917
16007
  return __generator(this, function (_b) {
15918
16008
  switch (_b.label) {
15919
16009
  case 0:
15920
- setLoadingList(true);
16010
+ setLoadingInvestment(true);
15921
16011
  _b.label = 1;
15922
16012
  case 1:
15923
16013
  _b.trys.push([1, 3, 4, 5]);
16014
+ optionalFilters = {};
15924
16015
  filterAnd = [];
15925
16016
  filterAnd = [
15926
16017
  {
15927
- key: "companyRole",
16018
+ key: "category",
15928
16019
  operation: "=",
15929
- value: exports.CompanyRole.PROGRAMME_DEVELOPER.toString(),
16020
+ value: exports.InvestmentOwnershipType.NATIONAL.toString(),
16021
+ },
16022
+ {
16023
+ key: "amount",
16024
+ operation: ">",
16025
+ value: 0,
15930
16026
  },
15931
16027
  ];
15932
16028
  if ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.PROGRAMME_DEVELOPER) {
15933
16029
  filterAnd.push({
15934
- key: "companyId",
15935
- operation: "!=",
16030
+ key: "toCompanyId",
16031
+ operation: "=",
15936
16032
  value: userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyId,
15937
16033
  });
15938
16034
  }
15939
- for (_i = 0, _a = data === null || data === void 0 ? void 0 : data.companyId; _i < _a.length; _i++) {
15940
- c = _a[_i];
15941
- filterAnd.push({
15942
- key: "companyId",
15943
- operation: "!=",
15944
- 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
+ });
15945
16045
  });
16046
+ optionalFilters.filterOr = filterOr_1;
15946
16047
  }
15947
- 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", {
15948
16080
  page: 1,
15949
16081
  size: 100,
15950
- filterAnd: filterAnd,
16082
+ filterAnd: [
16083
+ { key: "companyId", operation: "=", value: userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyId },
16084
+ ],
15951
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];
15952
16092
  case 2:
15953
- 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();
15954
16142
  if (response.data) {
15955
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);
15956
16151
  }
15957
16152
  return [3 /*break*/, 5];
15958
16153
  case 3:
15959
- error_2 = _b.sent();
15960
- console.log("Error in getting organization list", error_2);
16154
+ error_5 = _d.sent();
16155
+ console.log("Error in getting organization list", error_5);
15961
16156
  return [3 /*break*/, 5];
15962
16157
  case 4:
15963
16158
  setLoadingList(false);
@@ -15972,52 +16167,72 @@ var InvestmentCreationComponent = function (props) {
15972
16167
  return;
15973
16168
  }
15974
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);
15975
16171
  setData(state === null || state === void 0 ? void 0 : state.record);
15976
16172
  }
15977
16173
  else {
16174
+ console.log("condition 2 data", { ownership: true });
15978
16175
  setData({ ownership: true });
15979
16176
  }
15980
16177
  }, []);
15981
16178
  React.useEffect(function () {
15982
- if (data) {
15983
- var keys = Object.keys(data);
15984
- if (keys[0] !== "ownership") {
15985
- getOrganisationsDetails();
15986
- }
15987
- }
16179
+ // if (data) {
16180
+ // const keys = Object.keys(data);
16181
+ // if (keys[0] !== "ownership") {
16182
+ // getOrganisationsDetails();
16183
+ // }
16184
+ // }
16185
+ getNationalInvestmentDetails();
16186
+ getOrganisationsDetails();
15988
16187
  getGovernmentDetails();
16188
+ getAllProjectData();
16189
+ getUserOrganization();
15989
16190
  }, [data]);
15990
- if (!data) {
16191
+ if (!data && allProjectData.length == 0) {
15991
16192
  return React.createElement(Loading, null);
15992
16193
  }
15993
16194
  console.log("data", data);
15994
- var companyName = {};
16195
+ console.log("data", data);
15995
16196
  if (data && Object.keys(data)[0] !== "ownership") {
15996
- for (var _i = 0, _l = data === null || data === void 0 ? void 0 : data.company; _i < _l.length; _i++) {
15997
- var company = _l[_i];
15998
- companyName[company === null || company === void 0 ? void 0 : company.companyId] = company;
15999
- }
16197
+ // for (const company of data!?.company) {
16198
+ // companyName[company?.companyId] = company;
16199
+ // }
16000
16200
  if (!data.proponentPercentage) {
16001
16201
  data.proponentPercentage = [100];
16002
16202
  }
16003
16203
  }
16004
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
+ }
16005
16209
  setCurrent(current + 1);
16006
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
+ }
16007
16218
  };
16008
16219
  var prevOne = function () {
16009
16220
  setCurrent(current - 1);
16221
+ setPrevInvestor(stepOneData.toCompanyId);
16222
+ // formTwo.resetFields();
16223
+ // setCurrentPercTotal(0);
16224
+ // setProjectData(undefined);
16010
16225
  };
16011
16226
  var submitInvestment = function (val) { return __awaiter(void 0, void 0, void 0, function () {
16012
- var payload, response, error_3;
16227
+ var payload, response, error_6;
16013
16228
  return __generator(this, function (_a) {
16014
16229
  switch (_a.label) {
16015
16230
  case 0:
16016
16231
  console.log(val);
16017
16232
  console.log(stepOneData);
16233
+ console.log("OwnershipType", investmentOwnershipType);
16018
16234
  setLoading(true);
16019
16235
  payload = stepOneData;
16020
- payload.programmeId = data.programmeId;
16021
16236
  payload.amount = parseFloat(payload.amount);
16022
16237
  if (payload.interestRate) {
16023
16238
  payload.interestRate = parseFloat(payload.interestRate);
@@ -16034,16 +16249,32 @@ var InvestmentCreationComponent = function (props) {
16034
16249
  .startOf("day")
16035
16250
  .unix();
16036
16251
  }
16037
- payload.instrument = [payload.instrument];
16038
- payload.fromCompanyIds = data.companyId.map(function (e) { return Number(e); });
16039
- payload.percentage = val.percentage;
16040
16252
  payload.toCompanyId = Number(payload.toCompanyId);
16041
16253
  _a.label = 1;
16042
16254
  case 1:
16043
- _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;
16044
16267
  return [4 /*yield*/, post("national/programme/addInvestment", payload)];
16045
16268
  case 2:
16046
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:
16047
16278
  console.log("investment creation -> ", response);
16048
16279
  if ((response === null || response === void 0 ? void 0 : response.statusText) === "SUCCESS") {
16049
16280
  antd.message.open({
@@ -16053,22 +16284,24 @@ var InvestmentCreationComponent = function (props) {
16053
16284
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
16054
16285
  });
16055
16286
  }
16056
- onNavigateToProgrammeView(data.programmeId);
16057
- return [3 /*break*/, 5];
16058
- case 3:
16059
- error_3 = _a.sent();
16060
- 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);
16061
16294
  antd.message.open({
16062
16295
  type: "error",
16063
- 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,
16064
16297
  duration: 4,
16065
16298
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
16066
16299
  });
16067
- return [3 /*break*/, 5];
16068
- case 4:
16300
+ return [3 /*break*/, 8];
16301
+ case 7:
16069
16302
  setLoading(false);
16070
16303
  return [7 /*endfinally*/];
16071
- case 5: return [2 /*return*/];
16304
+ case 8: return [2 /*return*/];
16072
16305
  }
16073
16306
  });
16074
16307
  }); };
@@ -16082,6 +16315,14 @@ var InvestmentCreationComponent = function (props) {
16082
16315
  var onChangeTypeCreation = function (e) {
16083
16316
  console.log("radio checked", e.target.value);
16084
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);
16085
16326
  };
16086
16327
  return (React.createElement("div", { className: "add-programme-main-container" },
16087
16328
  React.createElement("div", { className: "title-container" },
@@ -16106,75 +16347,60 @@ var InvestmentCreationComponent = function (props) {
16106
16347
  ] },
16107
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" },
16108
16349
  React.createElement(antd.Radio.Button, { className: "condition-radio", value: k, onChange: onChangeTypeCreation }, t("programme:" + k)))); }))))),
16109
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16110
- React.createElement(antd.Col, { xl: 12, md: 24 },
16111
- React.createElement("div", { className: "details-part-one" },
16112
- React.createElement(antd.Form.Item, { label: t("programme:investorName"), name: "toCompanyId", wrapperCol: { span: 24 }, className: "organisation", rules: [
16113
- {
16114
- required: true,
16115
- message: "".concat(t("programme:investorName"), " ").concat(t("isRequired")),
16116
- },
16117
- ] },
16118
- 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)); }))))),
16119
- React.createElement(antd.Col, { xl: 12, md: 24 },
16120
- React.createElement("div", { className: "details-part-two" },
16121
- React.createElement(antd.Form.Item, { label: t("programme:amountInvested"), name: "amount", rules: [
16122
- {
16123
- required: true,
16124
- message: "",
16125
- },
16126
- {
16127
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16128
- return __generator(this, function (_a) {
16129
- if (String(value).trim() === "" ||
16130
- String(value).trim() === undefined ||
16131
- value === null ||
16132
- value === undefined) {
16133
- throw new Error("".concat(t("programme:amountInvested"), " ").concat(t("isRequired")));
16134
- }
16135
- else if (!isNaN(value) &&
16136
- Number(value) > 0) {
16137
- return [2 /*return*/, Promise.resolve()];
16138
- }
16139
- else {
16140
- throw new Error("".concat(t("programme:amountInvested"), " ").concat(t("isInvalid")));
16141
- }
16142
- });
16143
- }); },
16144
- },
16145
- ] },
16146
- React.createElement(antd.Input, { size: "large" }))))),
16147
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16148
- React.createElement(antd.Col, { xl: 24, md: 24 },
16149
- React.createElement(antd.Form.Item, { label: t("programme:instrument"), name: "instrument",
16150
- //wrapperCol={{ span: 24 }}
16151
- required: true, className: "investment-radio-button", rules: [
16152
- {
16153
- required: true,
16154
- message: "",
16155
- },
16156
- {
16157
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16158
- return __generator(this, function (_a) {
16159
- if (String(value).trim() === "" ||
16160
- String(value).trim() === undefined ||
16161
- value === null ||
16162
- value === undefined) {
16163
- throw new Error("".concat(t("programme:instrument"), " ").concat(t("isRequired")));
16350
+ typeCreation == exports.InvestmentCreationType.NEW && (React.createElement("div", null,
16351
+ React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
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));
16164
16366
  }
16165
- return [2 /*return*/];
16166
- });
16167
- }); },
16168
- },
16169
- ] },
16170
- React.createElement(antd.Radio.Group, { onChange: onInstrumentChange, value: instrument[0] }, instrumentOptions.map(function (e) {
16171
- return (React.createElement(antd.Radio, { value: e.value }, e.label));
16172
- }))))),
16173
- instrument &&
16174
- instrument.indexOf(exports.Instrument.LOAN) >= 0 && (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16175
- React.createElement(antd.Col, { xl: 8, md: 12 },
16176
- React.createElement("div", { className: "details-part-two" },
16177
- React.createElement(antd.Form.Item, { label: t("programme:interestRate"), name: "interestRate", rules: [
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: [
16178
16404
  {
16179
16405
  required: true,
16180
16406
  message: "",
@@ -16183,327 +16409,422 @@ var InvestmentCreationComponent = function (props) {
16183
16409
  validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16184
16410
  return __generator(this, function (_a) {
16185
16411
  if (String(value).trim() === "" ||
16186
- String(value).trim() ===
16187
- undefined ||
16412
+ String(value).trim() === undefined ||
16188
16413
  value === null ||
16189
16414
  value === undefined) {
16190
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isRequired")));
16191
- }
16192
- else if (!isNaN(value)) {
16193
- return [2 /*return*/, Promise.resolve()];
16194
- }
16195
- else {
16196
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isInvalid")));
16415
+ throw new Error("".concat(t("programme:instrument"), " ").concat(t("isRequired")));
16197
16416
  }
16417
+ return [2 /*return*/];
16198
16418
  });
16199
16419
  }); },
16200
16420
  },
16201
16421
  ] },
16202
- React.createElement(antd.Input, { size: "large" })))))),
16203
- instrument &&
16204
- (instrument.indexOf(exports.Instrument.CONLOAN) >= 0 ||
16205
- instrument.indexOf(exports.Instrument.NONCONLOAN) >= 0) && (React.createElement("div", { className: "details-part-two" },
16206
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
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] },
16207
16427
  React.createElement(antd.Col, { xl: 8, md: 12 },
16208
- React.createElement(antd.Form.Item, { label: t("programme:interestRate"), name: "interestRate", rules: [
16209
- {
16210
- required: true,
16211
- message: "",
16212
- },
16213
- {
16214
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16215
- return __generator(this, function (_a) {
16216
- if (String(value).trim() === "" ||
16217
- String(value).trim() ===
16218
- undefined ||
16219
- value === null ||
16220
- value === undefined) {
16221
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isRequired")));
16222
- }
16223
- else if (!isNaN(value)) {
16224
- return [2 /*return*/, Promise.resolve()];
16225
- }
16226
- else {
16227
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isInvalid")));
16228
- }
16229
- });
16230
- }); },
16231
- },
16232
- ] },
16233
- React.createElement(antd.Input, { size: "large" })))),
16234
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16235
- React.createElement(antd.Col, { xl: 8, md: 12 },
16236
- React.createElement(antd.Form.Item, { label: t("programme:loanPeriod"), name: "period", required: true, rules: [
16237
- {
16238
- required: true,
16239
- message: "",
16240
- },
16241
- {
16242
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16243
- return __generator(this, function (_a) {
16244
- if (String(value).trim() === "" ||
16245
- String(value).trim() ===
16246
- undefined ||
16247
- value === null ||
16248
- value === undefined) {
16249
- throw new Error("".concat(t("programme:loanPeriod"), " ").concat(t("isRequired")));
16250
- }
16251
- return [2 /*return*/];
16252
- });
16253
- }); },
16254
- },
16255
- ] },
16256
- React.createElement(RangePicker$3, { showTime: true, allowClear: true, format: "DD:MM:YYYY", size: "large" }))),
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] },
16257
16678
  React.createElement(antd.Col, { xl: 8, md: 12 },
16258
- React.createElement(antd.Form.Item, { label: t("programme:startOfPayback"), name: "startOfPayback", rules: [
16259
- {
16260
- required: true,
16261
- message: "",
16262
- },
16263
- {
16264
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16265
- return __generator(this, function (_a) {
16266
- if (String(value).trim() === "" ||
16267
- String(value).trim() ===
16268
- undefined ||
16269
- value === null ||
16270
- value === undefined) {
16271
- throw new Error("".concat(t("programme:startOfPayback"), " ").concat(t("isRequired")));
16272
- }
16273
- return [2 /*return*/];
16274
- });
16275
- }); },
16276
- },
16277
- ] },
16278
- React.createElement(antd.DatePicker, { size: "large", disabledDate: function (currentDate) {
16279
- return currentDate < moment().startOf("day");
16280
- } })))))),
16281
- instrument &&
16282
- instrument.indexOf(exports.Instrument.GUARANTEE) >= 0 && (React.createElement("div", { className: "details-part-two" },
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" })))))),
16283
16727
  React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16284
16728
  React.createElement(antd.Col, { xl: 8, md: 12 },
16285
- React.createElement(antd.Form.Item, { label: t("programme:interestRate"), name: "interestRate", rules: [
16286
- {
16287
- required: true,
16288
- message: "",
16289
- },
16729
+ React.createElement(antd.Form.Item, { label: t("programme:type"), wrapperCol: { span: 13 }, className: "role-group", name: "type", rules: [
16290
16730
  {
16291
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16292
- return __generator(this, function (_a) {
16293
- if (String(value).trim() === "" ||
16294
- String(value).trim() ===
16295
- undefined ||
16296
- value === null ||
16297
- value === undefined) {
16298
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isRequired")));
16299
- }
16300
- else if (!isNaN(value)) {
16301
- return [2 /*return*/, Promise.resolve()];
16302
- }
16303
- else {
16304
- throw new Error("".concat(t("programme:interestRate"), " ").concat(t("isInvalid")));
16305
- }
16306
- });
16307
- }); },
16731
+ required: false,
16308
16732
  },
16309
16733
  ] },
16310
- React.createElement(antd.Input, { size: "large" })))),
16311
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
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)))); })))),
16312
16738
  React.createElement(antd.Col, { xl: 8, md: 12 },
16313
- React.createElement(antd.Form.Item, { label: t("programme:period"), name: "period", required: true, rules: [
16739
+ React.createElement(antd.Form.Item, { label: t("programme:level"), wrapperCol: { span: 13 }, className: "role-group", name: "level", rules: [
16314
16740
  {
16315
- required: true,
16316
- message: "",
16317
- },
16318
- {
16319
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16320
- return __generator(this, function (_a) {
16321
- if (String(value).trim() === "" ||
16322
- String(value).trim() ===
16323
- undefined ||
16324
- value === null ||
16325
- value === undefined) {
16326
- throw new Error("".concat(t("programme:period"), " ").concat(t("isRequired")));
16327
- }
16328
- return [2 /*return*/];
16329
- });
16330
- }); },
16741
+ required: false,
16331
16742
  },
16332
16743
  ] },
16333
- React.createElement(RangePicker$3, { showTime: true, allowClear: true, format: "DD:MM:YYYY", size: "large" }))),
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)))); })))),
16334
16748
  React.createElement(antd.Col, { xl: 8, md: 12 },
16335
- React.createElement(antd.Form.Item, { label: t("programme:payback"), wrapperCol: { span: 13 }, className: "role-group", name: "guaranteePayback", rules: [
16336
- {
16337
- required: true,
16338
- message: "",
16339
- },
16340
- {
16341
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16342
- return __generator(this, function (_a) {
16343
- if (String(value).trim() === "" ||
16344
- String(value).trim() ===
16345
- undefined ||
16346
- value === null ||
16347
- value === undefined) {
16348
- throw new Error("".concat(t("programme:payback"), " ").concat(t("isRequired")));
16349
- }
16350
- return [2 /*return*/];
16351
- });
16352
- }); },
16353
- },
16354
- ] },
16355
- React.createElement(antd.Radio.Group, { size: "large" }, Object.values(GuaranteePayback).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16356
- React.createElement(antd.Radio.Button, { className: "condition-radio", value: k }, t("programme:" + k)))); }))))))),
16357
- instrument &&
16358
- instrument.indexOf(exports.Instrument.RESULT_BASED) >= 0 && (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16359
- React.createElement(antd.Col, { xl: 12, md: 24 },
16360
- React.createElement("div", { className: "details-part-two" },
16361
- React.createElement(antd.Form.Item, { label: t("programme:resultMetric"), name: "resultMetric", rules: [
16362
- {
16363
- required: true,
16364
- message: "",
16365
- },
16366
- {
16367
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16368
- return __generator(this, function (_a) {
16369
- if (String(value).trim() === "" ||
16370
- String(value).trim() ===
16371
- undefined ||
16372
- value === null ||
16373
- value === undefined) {
16374
- throw new Error("".concat(t("programme:resultMetric"), " ").concat(t("isRequired")));
16375
- }
16376
- return [2 /*return*/];
16377
- });
16378
- }); },
16379
- },
16380
- ] },
16381
- React.createElement(antd.Input, { size: "large" })))),
16382
- React.createElement(antd.Col, { xl: 12, md: 24 },
16383
- React.createElement("div", { className: "details-part-two" },
16384
- React.createElement(antd.Form.Item, { label: t("programme:paymentPerMetric"), name: "paymentPerMetric", rules: [
16385
- {
16386
- required: true,
16387
- message: "",
16388
- },
16389
- {
16390
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16391
- return __generator(this, function (_a) {
16392
- if (String(value).trim() === "" ||
16393
- String(value).trim() ===
16394
- undefined ||
16395
- value === null ||
16396
- value === undefined) {
16397
- throw new Error("".concat(t("programme:paymentPerMetric"), " ").concat(t("isRequired")));
16398
- }
16399
- else if (!isNaN(value)) {
16400
- return [2 /*return*/, Promise.resolve()];
16401
- }
16402
- else {
16403
- throw new Error("".concat(t("programme:paymentPerMetric"), " ").concat(t("isInvalid")));
16404
- }
16405
- });
16406
- }); },
16407
- },
16408
- ] },
16409
- React.createElement(antd.Input, { size: "large" })))))),
16410
- instrument &&
16411
- instrument.indexOf(exports.Instrument.INKIND) >= 0 && (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16412
- React.createElement(antd.Col, { xl: 12, md: 24 },
16413
- React.createElement("div", { className: "details-part-two" },
16414
- React.createElement(antd.Form.Item, { label: t("programme:description"), name: "description", rules: [
16749
+ React.createElement(antd.Form.Item, { label: t("programme:stream"), wrapperCol: { span: 13 }, className: "role-group", name: "stream", rules: [
16415
16750
  {
16416
16751
  required: false,
16417
- message: "",
16418
- },
16419
- ] },
16420
- React.createElement(antd.Input, { size: "large" })))))),
16421
- instrument &&
16422
- instrument.indexOf(exports.Instrument.INSURANCE) >= 0 && (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16423
- React.createElement(antd.Col, { xl: 8, md: 12 },
16424
- React.createElement("div", { className: "details-part-two" },
16425
- React.createElement(antd.Form.Item, { label: t("programme:payback"), wrapperCol: { span: 13 }, className: "role-group", name: "insurancePayback", rules: [
16426
- {
16427
- required: true,
16428
- message: "",
16429
- },
16430
- {
16431
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16432
- return __generator(this, function (_a) {
16433
- if (String(value).trim() === "" ||
16434
- String(value).trim() ===
16435
- undefined ||
16436
- value === null ||
16437
- value === undefined) {
16438
- throw new Error("".concat(t("programme:payback"), " ").concat(t("isRequired")));
16439
- }
16440
- return [2 /*return*/];
16441
- });
16442
- }); },
16443
16752
  },
16444
16753
  ] },
16445
- React.createElement(antd.Radio.Group, { size: "large" }, Object.values(InsurancePayback).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16446
- React.createElement(antd.Radio.Button, { className: "condition-radio", value: k }, t("programme:" + k)))); }))))))),
16447
- instrument &&
16448
- instrument.indexOf(exports.Instrument.OTHER) >= 0 && (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16449
- React.createElement(antd.Col, { xl: 12, md: 24 },
16450
- React.createElement("div", { className: "details-part-two" },
16451
- React.createElement(antd.Form.Item, { label: t("programme:comments"), name: "comments", rules: [
16452
- {
16453
- required: true,
16454
- message: "",
16455
- },
16456
- {
16457
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16458
- return __generator(this, function (_a) {
16459
- if (String(value).trim() === "" ||
16460
- String(value).trim() ===
16461
- undefined ||
16462
- value === null ||
16463
- value === undefined) {
16464
- throw new Error("".concat(t("programme:comments"), " ").concat(t("isRequired")));
16465
- }
16466
- return [2 /*return*/];
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
+ },
16467
16814
  });
16468
- }); },
16469
- },
16470
- ] },
16471
- React.createElement(antd.Input, { size: "large" })))))),
16472
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16473
- React.createElement(antd.Col, { xl: 8, md: 12 },
16474
- React.createElement(antd.Form.Item, { label: t("programme:type"), wrapperCol: { span: 13 }, className: "role-group", name: "type", rules: [
16475
- {
16476
- required: false,
16477
- },
16478
- ] },
16479
- React.createElement(antd.Radio.Group, { size: "large" }, Object.values(exports.InvestmentType).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16480
- React.createElement(antd.Radio.Button, { className: "condition-radio", value: k, onClick: function (e) {
16481
- return deselectOnClick(e, "type");
16482
- } }, t("programme:" + k)))); })))),
16483
- React.createElement(antd.Col, { xl: 8, md: 12 },
16484
- React.createElement(antd.Form.Item, { label: t("programme:level"), wrapperCol: { span: 13 }, className: "role-group", name: "level", rules: [
16485
- {
16486
- required: false,
16487
- },
16488
- ] },
16489
- React.createElement(antd.Radio.Group, { size: "large" }, Object.values(exports.InvestmentLevel).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16490
- React.createElement(antd.Radio.Button, { className: "condition-radio", value: k, onClick: function (e) {
16491
- return deselectOnClick(e, "level");
16492
- } }, t("programme:" + k)))); })))),
16493
- React.createElement(antd.Col, { xl: 8, md: 12 },
16494
- React.createElement(antd.Form.Item, { label: t("programme:stream"), wrapperCol: { span: 13 }, className: "role-group", name: "stream", rules: [
16495
- {
16496
- required: false,
16497
- },
16498
- ] },
16499
- React.createElement(antd.Radio.Group, { size: "large" }, Object.values(exports.InvestmentStream).map(function (k, index) { return (React.createElement("div", { className: "condition-radio-container" },
16500
- React.createElement(antd.Radio.Button, { className: "condition-radio", value: k, onClick: function (e) {
16501
- return deselectOnClick(e, "stream");
16502
- } }, t("programme:" + k)))); }))))),
16503
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16504
- React.createElement(antd.Col, { xl: 12, md: 24 },
16505
- React.createElement(antd.Form.Item, { label: t("programme:esgType"), name: "esgClassification" },
16506
- React.createElement(antd.Select, { size: "large" }, Object.values(exports.ESGType).map(function (esg) { return (React.createElement(antd.Select.Option, { value: esg }, esg)); }))))),
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 })))))))),
16507
16828
  React.createElement(antd.Form.Item, null,
16508
16829
  React.createElement("div", { className: "steps-actions" },
16509
16830
  React.createElement(antd.Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: nextOne }, t("programme:next")))))))),
@@ -16513,73 +16834,164 @@ var InvestmentCreationComponent = function (props) {
16513
16834
  React.createElement("div", { className: "step-count" }, "02"),
16514
16835
  React.createElement("div", { className: "title" }, t("programme:ownership")))),
16515
16836
  description: current === 1 && (React.createElement("div", null,
16516
- React.createElement("div", { className: "programme-sought-form-container ownership-container" }, Object.keys(data).length > 0 && (React.createElement("div", { className: "programme-sought-form" },
16517
- 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 :
16518
- data.companyId.map(function (companyId, index) {
16519
- return (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16520
- React.createElement(antd.Col, { xl: 8, md: 15 },
16521
- React.createElement("div", { className: "label" },
16522
- companyName[companyId].name,
16523
- React.createElement("span", { className: "required-mark" }, "*"))),
16524
- React.createElement(antd.Col, { xl: 8, md: 9 },
16525
- React.createElement(antd.Form.Item, { className: "inline", name: ["percentage", index], initialValue: 0, rules: [
16526
- {
16527
- pattern: new RegExp(/^[+]?([.]\d+|\d+[.]?\d*)$/g),
16528
- message: "Percentage Should be a positive number",
16529
- },
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: [
16530
16843
  {
16531
- required: true,
16532
- message: "Required field",
16533
- },
16534
- function (_a) {
16535
- var getFieldValue = _a.getFieldValue;
16536
- return ({
16537
- validator: function (rule, v) {
16538
- if (getFieldValue([
16539
- "percentage",
16540
- index,
16541
- ]) &&
16542
- parseFloat(getFieldValue([
16543
- "percentage",
16544
- index,
16545
- ])) >
16546
- data.proponentPercentage[index]) {
16547
- // eslint-disable-next-line prefer-promise-reject-errors
16548
- return Promise.reject("Amount > Available");
16549
- }
16550
- return Promise.resolve();
16551
- },
16552
- });
16844
+ required: false,
16553
16845
  },
16554
16846
  ] },
16555
- React.createElement(antd.InputNumber, { placeholder: "", controls: false, disabled: govData.companyId == companyId,
16556
- // disabled={userInfoState?.companyId === Number(companyId)}
16557
- onKeyPress: function (event) {
16558
- if (!/[0-9\.]/.test(event.key)) {
16559
- event.preventDefault();
16560
- }
16561
- } })),
16562
- React.createElement("div", { className: "inline separator" }, "/"),
16563
- React.createElement(antd.Form.Item, { className: "inline" },
16564
- React.createElement(antd.InputNumber, { placeholder: String(data === null || data === void 0 ? void 0 : data.proponentPercentage[index]), disabled: true })))));
16565
- }),
16566
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16567
- React.createElement(antd.Col, { xl: 8, md: 15 },
16568
- React.createElement("div", { className: "label" }, t("programme:total"))),
16569
- React.createElement(antd.Col, { xl: 8, md: 9 },
16570
- React.createElement(antd.Form.Item, { className: "inline", name: ["total"] },
16571
- React.createElement(antd.InputNumber, { placeholder: currentPercTotal + "", controls: false, disabled: true, onKeyPress: function (event) {
16572
- if (!/[0-9\.]/.test(event.key)) {
16573
- 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)))));
16574
16872
  }
16575
- } })),
16576
- React.createElement("div", { className: "inline separator" }, "/"),
16577
- React.createElement(antd.Form.Item, { className: "inline" },
16578
- React.createElement(antd.InputNumber, { disabled: true, placeholder: "100" })))),
16579
- React.createElement(antd.Form.Item, null,
16580
- React.createElement("div", { className: "steps-actions" },
16581
- React.createElement(antd.Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: submitInvestment }, t("programme:submit")),
16582
- 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"))))))))),
16583
16995
  },
16584
16996
  ] })))));
16585
16997
  };
@@ -17080,7 +17492,10 @@ var InvestmentManagementComponent = function (props) {
17080
17492
  sorter: true,
17081
17493
  align: "left",
17082
17494
  render: function (item) {
17083
- 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, "-");
17084
17499
  },
17085
17500
  onCell: function (record, rowIndex) {
17086
17501
  return {
@@ -17138,6 +17553,12 @@ var InvestmentManagementComponent = function (props) {
17138
17553
  key: "programmeSector",
17139
17554
  sorter: true,
17140
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
+ },
17141
17562
  },
17142
17563
  {
17143
17564
  title: t("programme:investor"),
@@ -17221,7 +17642,11 @@ var InvestmentManagementComponent = function (props) {
17221
17642
  React.createElement("div", { className: "title-bar" },
17222
17643
  React.createElement("div", { className: "body-title" }, t("programme:investmentTitle")),
17223
17644
  React.createElement("div", { className: "body-sub-title" }, t("programme:investmentDesc"))),
17224
- 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" },
17225
17650
  React.createElement(antd.Button, { type: "primary", size: "large", block: true, icon: React.createElement(icons.PlusOutlined, null), onClick: onClickAddOwnership }, t("programme:addOwnership")))))),
17226
17651
  React.createElement("div", { className: "content-card" },
17227
17652
  React.createElement(antd.Row, null,
@@ -17268,7 +17693,7 @@ var InvestmentManagementComponent = function (props) {
17268
17693
  return handleTableChange(val, sorter);
17269
17694
  }, locale: {
17270
17695
  emptyText: (React.createElement(antd.Empty, { image: antd.Empty.PRESENTED_IMAGE_SIMPLE, description: tableData.length === 0
17271
- ? t("creditTransfer:noTransfer")
17696
+ ? t("programme:noInvestmentData")
17272
17697
  : null })),
17273
17698
  } }))))),
17274
17699
  popupInfo && selectedReq && (React.createElement(InvestmentActionModel, { investment: selectedReq, onCancel: function () {