@undp/carbon-library 1.0.175-CARBON-347.6 → 1.0.175-CARBON-347.8

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cjs/index.js CHANGED
@@ -1233,6 +1233,11 @@ exports.InvestmentCreationType = void 0;
1233
1233
  InvestmentCreationType["EXISTING"] = "Existing";
1234
1234
  InvestmentCreationType["NEW"] = "New";
1235
1235
  })(exports.InvestmentCreationType || (exports.InvestmentCreationType = {}));
1236
+ exports.InvestmentOwnershipType = void 0;
1237
+ (function (InvestmentOwnershipType) {
1238
+ InvestmentOwnershipType["PROJECT"] = "Project";
1239
+ InvestmentOwnershipType["NATIONAL"] = "National";
1240
+ })(exports.InvestmentOwnershipType || (exports.InvestmentOwnershipType = {}));
1236
1241
  exports.InvestmentStream = void 0;
1237
1242
  (function (InvestmentStream) {
1238
1243
  InvestmentStream["CLIMATE_FINANCE"] = "ClimateFinance";
@@ -15649,7 +15654,7 @@ var UserManagementComponent = function (props) {
15649
15654
  React.createElement(UserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: handleOk, onActionCanceled: handleCancel, openModal: openDeleteConfirmationModal, errorMsg: errorMsg, loading: loading })));
15650
15655
  };
15651
15656
 
15652
- var css_248z$j = ".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";
15657
+ var css_248z$j = ".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";
15653
15658
  styleInject(css_248z$j);
15654
15659
 
15655
15660
  var Loading = function () {
@@ -15660,18 +15665,22 @@ var InvestmentCreationComponent = function (props) {
15660
15665
  var t = props.t, useLocation = props.useLocation, onNavigateToProgrammeManagementView = props.onNavigateToProgrammeManagementView, onNavigateToProgrammeView = props.onNavigateToProgrammeView;
15661
15666
  var state = useLocation().state;
15662
15667
  var _a = React.useState(), data = _a[0], setData = _a[1];
15668
+ var _b = React.useState(), projectData = _b[0], setProjectData = _b[1];
15669
+ var _c = React.useState([]), allProjectData = _c[0], setAllProjectData = _c[1];
15663
15670
  var formOne = antd.Form.useForm()[0];
15664
15671
  var formTwo = antd.Form.useForm()[0];
15665
15672
  var post = useConnection().post;
15666
- var _b = React.useState(false), loading = _b[0], setLoading = _b[1];
15667
- var _c = React.useState("New"), typeCreation = _c[0], setTypeCreation = _c[1];
15668
- var _d = React.useState(false), loadingList = _d[0], setLoadingList = _d[1];
15669
- var _e = React.useState(0), current = _e[0], setCurrent = _e[1];
15670
- var _f = React.useState(0), currentPercTotal = _f[0], setCurrentPercTotal = _f[1];
15671
- var _g = React.useState([]), organisationsList = _g[0], setOrganisationList = _g[1];
15672
- var _h = React.useState([]), instrument = _h[0], setInstrument = _h[1];
15673
- var _j = React.useState(), stepOneData = _j[0], setStepOneData = _j[1];
15674
- var _k = React.useState(), govData = _k[0], setGovData = _k[1];
15673
+ var _d = React.useState(false), loading = _d[0], setLoading = _d[1];
15674
+ var _e = React.useState("New"), typeCreation = _e[0], setTypeCreation = _e[1];
15675
+ var _f = React.useState(exports.InvestmentOwnershipType.PROJECT), investmentOwnershipType = _f[0], setInvestmentOwnershipType = _f[1];
15676
+ var _g = React.useState(false), loadingList = _g[0], setLoadingList = _g[1];
15677
+ var _h = React.useState(false), loadingProgData = _h[0], setLoadingProgData = _h[1];
15678
+ var _j = React.useState(0), current = _j[0], setCurrent = _j[1];
15679
+ var _k = React.useState(0), currentPercTotal = _k[0], setCurrentPercTotal = _k[1];
15680
+ var _l = React.useState([]), organisationsList = _l[0], setOrganisationList = _l[1];
15681
+ var _m = React.useState([]), instrument = _m[0], setInstrument = _m[1];
15682
+ var _o = React.useState(), stepOneData = _o[0], setStepOneData = _o[1];
15683
+ var _p = React.useState(), govData = _p[0], setGovData = _p[1];
15675
15684
  var userInfoState = useUserContext().userInfoState;
15676
15685
  var instrumentOptions = Object.keys(exports.Instrument).map(function (k, index) { return ({
15677
15686
  label: addSpaces(Object.values(exports.Instrument)[index]),
@@ -15723,8 +15732,77 @@ var InvestmentCreationComponent = function (props) {
15723
15732
  }
15724
15733
  });
15725
15734
  }); };
15735
+ var getAllProjectData = function () { return __awaiter(void 0, void 0, void 0, function () {
15736
+ var response, error_2;
15737
+ return __generator(this, function (_a) {
15738
+ switch (_a.label) {
15739
+ case 0:
15740
+ setLoadingProgData(true);
15741
+ _a.label = 1;
15742
+ case 1:
15743
+ _a.trys.push([1, 5, 6, 7]);
15744
+ if (!!(data === null || data === void 0 ? void 0 : data.programmeId)) return [3 /*break*/, 3];
15745
+ console.log("getting all Project data");
15746
+ return [4 /*yield*/, post("national/programme/query", {
15747
+ page: 1,
15748
+ size: 100,
15749
+ filterAnd: [
15750
+ {
15751
+ key: "currentStage",
15752
+ operation: "!=",
15753
+ value: exports.ProgrammeStageUnified.Rejected,
15754
+ },
15755
+ ],
15756
+ })];
15757
+ case 2:
15758
+ response = _a.sent();
15759
+ if (response.data) {
15760
+ if ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) == exports.CompanyRole.PROGRAMME_DEVELOPER &&
15761
+ stepOneData.toCompanyId != userInfoState.companyId) {
15762
+ setAllProjectData(response === null || response === void 0 ? void 0 : response.data.map(function (obj) {
15763
+ if (obj.companyId.includes(userInfoState.companyId)) {
15764
+ return obj;
15765
+ }
15766
+ }));
15767
+ }
15768
+ else {
15769
+ setAllProjectData(response === null || response === void 0 ? void 0 : response.data);
15770
+ }
15771
+ console.log("all Project data", response === null || response === void 0 ? void 0 : response.data);
15772
+ }
15773
+ return [3 /*break*/, 4];
15774
+ case 3:
15775
+ console.log("setting current Project data");
15776
+ setAllProjectData([data]);
15777
+ _a.label = 4;
15778
+ case 4: return [3 /*break*/, 7];
15779
+ case 5:
15780
+ error_2 = _a.sent();
15781
+ console.log("Error in getting all programme data", error_2);
15782
+ return [3 /*break*/, 7];
15783
+ case 6:
15784
+ setLoadingProgData(false);
15785
+ return [7 /*endfinally*/];
15786
+ case 7: return [2 /*return*/];
15787
+ }
15788
+ });
15789
+ }); };
15790
+ var setSelectedProgramme = function (value) { return __awaiter(void 0, void 0, void 0, function () {
15791
+ var _i, allProjectData_1, obj;
15792
+ return __generator(this, function (_a) {
15793
+ console.log("setSelectedProgramme", value);
15794
+ for (_i = 0, allProjectData_1 = allProjectData; _i < allProjectData_1.length; _i++) {
15795
+ obj = allProjectData_1[_i];
15796
+ if (obj.programmeId == value) {
15797
+ setProjectData(obj);
15798
+ break;
15799
+ }
15800
+ }
15801
+ return [2 /*return*/];
15802
+ });
15803
+ }); };
15726
15804
  var getOrganisationsDetails = function () { return __awaiter(void 0, void 0, void 0, function () {
15727
- var filterAnd, _i, _a, c, response, error_2;
15805
+ var filterAnd, filterOr, _i, _a, c, response, error_3;
15728
15806
  return __generator(this, function (_b) {
15729
15807
  switch (_b.label) {
15730
15808
  case 0:
@@ -15733,6 +15811,7 @@ var InvestmentCreationComponent = function (props) {
15733
15811
  case 1:
15734
15812
  _b.trys.push([1, 3, 4, 5]);
15735
15813
  filterAnd = [];
15814
+ filterOr = [];
15736
15815
  filterAnd = [
15737
15816
  {
15738
15817
  key: "companyRole",
@@ -15740,18 +15819,18 @@ var InvestmentCreationComponent = function (props) {
15740
15819
  value: exports.CompanyRole.PROGRAMME_DEVELOPER.toString(),
15741
15820
  },
15742
15821
  ];
15743
- if ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.PROGRAMME_DEVELOPER) {
15744
- filterAnd.push({
15745
- key: "companyId",
15746
- operation: "!=",
15747
- value: userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyId,
15748
- });
15749
- }
15822
+ // if (userInfoState?.companyRole === CompanyRole.PROGRAMME_DEVELOPER) {
15823
+ // filterAnd.push({
15824
+ // key: "companyId",
15825
+ // operation: "!=",
15826
+ // value: userInfoState?.companyId,
15827
+ // });
15828
+ // }
15750
15829
  for (_i = 0, _a = data === null || data === void 0 ? void 0 : data.companyId; _i < _a.length; _i++) {
15751
15830
  c = _a[_i];
15752
- filterAnd.push({
15831
+ filterOr.push({
15753
15832
  key: "companyId",
15754
- operation: "!=",
15833
+ operation: "=",
15755
15834
  value: c,
15756
15835
  });
15757
15836
  }
@@ -15759,6 +15838,7 @@ var InvestmentCreationComponent = function (props) {
15759
15838
  page: 1,
15760
15839
  size: 100,
15761
15840
  filterAnd: filterAnd,
15841
+ filterOr: filterOr,
15762
15842
  })];
15763
15843
  case 2:
15764
15844
  response = _b.sent();
@@ -15767,8 +15847,8 @@ var InvestmentCreationComponent = function (props) {
15767
15847
  }
15768
15848
  return [3 /*break*/, 5];
15769
15849
  case 3:
15770
- error_2 = _b.sent();
15771
- console.log("Error in getting organization list", error_2);
15850
+ error_3 = _b.sent();
15851
+ console.log("Error in getting organization list", error_3);
15772
15852
  return [3 /*break*/, 5];
15773
15853
  case 4:
15774
15854
  setLoadingList(false);
@@ -15797,15 +15877,16 @@ var InvestmentCreationComponent = function (props) {
15797
15877
  }
15798
15878
  }
15799
15879
  getGovernmentDetails();
15880
+ getAllProjectData();
15800
15881
  }, [data]);
15801
- if (!data) {
15882
+ if (!data || allProjectData.length == 0) {
15802
15883
  return React.createElement(Loading, null);
15803
15884
  }
15804
15885
  console.log("data", data);
15805
15886
  var companyName = {};
15806
15887
  if (data && Object.keys(data)[0] !== "ownership") {
15807
- for (var _i = 0, _l = data === null || data === void 0 ? void 0 : data.company; _i < _l.length; _i++) {
15808
- var company = _l[_i];
15888
+ for (var _i = 0, _q = data === null || data === void 0 ? void 0 : data.company; _i < _q.length; _i++) {
15889
+ var company = _q[_i];
15809
15890
  companyName[company === null || company === void 0 ? void 0 : company.companyId] = company;
15810
15891
  }
15811
15892
  if (!data.proponentPercentage) {
@@ -15815,12 +15896,14 @@ var InvestmentCreationComponent = function (props) {
15815
15896
  var nextOne = function (val) {
15816
15897
  setCurrent(current + 1);
15817
15898
  setStepOneData(val);
15899
+ if (data === null || data === void 0 ? void 0 : data.programmeId)
15900
+ setSelectedProgramme(data.programmeId);
15818
15901
  };
15819
15902
  var prevOne = function () {
15820
15903
  setCurrent(current - 1);
15821
15904
  };
15822
15905
  var submitInvestment = function (val) { return __awaiter(void 0, void 0, void 0, function () {
15823
- var payload, response, error_3;
15906
+ var payload, response, error_4;
15824
15907
  return __generator(this, function (_a) {
15825
15908
  switch (_a.label) {
15826
15909
  case 0:
@@ -15857,11 +15940,11 @@ var InvestmentCreationComponent = function (props) {
15857
15940
  onNavigateToProgrammeView(data.programmeId);
15858
15941
  return [3 /*break*/, 5];
15859
15942
  case 3:
15860
- error_3 = _a.sent();
15861
- console.log("Error in investment creation - ", error_3);
15943
+ error_4 = _a.sent();
15944
+ console.log("Error in investment creation - ", error_4);
15862
15945
  antd.message.open({
15863
15946
  type: "error",
15864
- content: error_3 === null || error_3 === void 0 ? void 0 : error_3.message,
15947
+ content: error_4 === null || error_4 === void 0 ? void 0 : error_4.message,
15865
15948
  duration: 4,
15866
15949
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
15867
15950
  });
@@ -15884,6 +15967,10 @@ var InvestmentCreationComponent = function (props) {
15884
15967
  console.log("radio checked", e.target.value);
15885
15968
  setTypeCreation(e.target.value);
15886
15969
  };
15970
+ var onChangeInvestmentOwnershipType = function (e) {
15971
+ console.log("investment ownership type radio checked", e.target.value);
15972
+ setInvestmentOwnershipType(e.target.value);
15973
+ };
15887
15974
  return (React.createElement("div", { className: "add-programme-main-container" },
15888
15975
  React.createElement("div", { className: "title-container" },
15889
15976
  React.createElement("div", { className: "main" }, t("programme:addInvestment")),
@@ -16105,79 +16192,181 @@ var InvestmentCreationComponent = function (props) {
16105
16192
  React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16106
16193
  React.createElement(antd.Col, { xl: 12, md: 24 },
16107
16194
  React.createElement(antd.Form.Item, { label: t("programme:esgType"), name: "esgClassification" },
16108
- React.createElement(antd.Select, { size: "large" }, Object.values(exports.ESGType).map(function (esg) { return (React.createElement(antd.Select.Option, { value: esg }, esg)); }))))),
16109
- React.createElement(antd.Form.Item, null,
16110
- React.createElement("div", { className: "steps-actions" },
16111
- React.createElement(antd.Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: nextOne }, t("programme:next")))))))))),
16195
+ React.createElement(antd.Select, { size: "large" }, Object.values(exports.ESGType).map(function (esg) { return (React.createElement(antd.Select.Option, { value: esg }, esg)); }))))))),
16196
+ typeCreation == exports.InvestmentCreationType.EXISTING && (React.createElement("div", null,
16197
+ React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16198
+ React.createElement(antd.Col, { xl: 12, md: 24 },
16199
+ React.createElement("div", { className: "details-part-one" },
16200
+ React.createElement(antd.Form.Item, { label: t("programme:existingInvestmentSource"), name: "existinngInvestmentId", wrapperCol: { span: 24 }, rules: [
16201
+ {
16202
+ required: true,
16203
+ message: "".concat(t("programme:existingInvestmentSource"), " ").concat(t("isRequired")),
16204
+ },
16205
+ ] },
16206
+ 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)); })))))),
16207
+ React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16208
+ React.createElement(antd.Col, { xl: 12, md: 24 },
16209
+ React.createElement("div", { className: "details-part-two" },
16210
+ React.createElement(antd.Form.Item, { label: t("programme:amountInvested"), name: "amount", rules: [
16211
+ {
16212
+ required: true,
16213
+ message: "",
16214
+ },
16215
+ {
16216
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
16217
+ return __generator(this, function (_a) {
16218
+ if (String(value).trim() === "" ||
16219
+ String(value).trim() ===
16220
+ undefined ||
16221
+ value === null ||
16222
+ value === undefined) {
16223
+ throw new Error("".concat(t("programme:amountInvested"), " ").concat(t("isRequired")));
16224
+ }
16225
+ else if (!isNaN(value) &&
16226
+ Number(value) > 0) {
16227
+ return [2 /*return*/, Promise.resolve()];
16228
+ }
16229
+ else {
16230
+ throw new Error("".concat(t("programme:amountInvested"), " ").concat(t("isInvalid")));
16231
+ }
16232
+ });
16233
+ }); },
16234
+ },
16235
+ ] },
16236
+ React.createElement(antd.Input, { size: "large" })))),
16237
+ React.createElement(antd.Col, { xl: 12, md: 24 },
16238
+ React.createElement("div", { className: "details-part-two" },
16239
+ React.createElement(antd.Form.Item, { label: " ", name: "sourceAmount" },
16240
+ React.createElement("div", null,
16241
+ "/",
16242
+ React.createElement(antd.InputNumber, { size: "large", width: "100%", formatter: function (value) {
16243
+ return "$".concat(addCommSep(value));
16244
+ }, disabled: true })))))))),
16245
+ React.createElement(antd.Form.Item, null,
16246
+ React.createElement("div", { className: "steps-actions" },
16247
+ React.createElement(antd.Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: nextOne }, t("programme:next")))))))),
16112
16248
  },
16113
16249
  {
16114
16250
  title: (React.createElement("div", { className: "step-title-container" },
16115
16251
  React.createElement("div", { className: "step-count" }, "02"),
16116
16252
  React.createElement("div", { className: "title" }, t("programme:ownership")))),
16117
16253
  description: current === 1 && (React.createElement("div", null,
16118
- React.createElement("div", { className: "programme-sought-form-container ownership-container" }, Object.keys(data).length > 0 && (React.createElement("div", { className: "programme-sought-form" },
16119
- 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 :
16120
- data.companyId.map(function (companyId, index) {
16121
- return (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16122
- React.createElement(antd.Col, { xl: 8, md: 15 },
16123
- React.createElement("div", { className: "label" },
16124
- companyName[companyId].name,
16125
- React.createElement("span", { className: "required-mark" }, "*"))),
16126
- React.createElement(antd.Col, { xl: 8, md: 9 },
16127
- React.createElement(antd.Form.Item, { className: "inline", name: ["percentage", index], initialValue: 0, rules: [
16128
- {
16129
- pattern: new RegExp(/^[+]?([.]\d+|\d+[.]?\d*)$/g),
16130
- message: "Percentage Should be a positive number",
16131
- },
16254
+ React.createElement("div", { className: "investment-sought-form-container" },
16255
+ React.createElement("div", { className: "investment-sought-form" },
16256
+ React.createElement(antd.Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, name: "investment-sought", className: "investment-sought-form", layout: "vertical", requiredMark: true },
16257
+ React.createElement(antd.Row, { className: "row", gutter: [4, 4] },
16258
+ React.createElement(antd.Col, { xl: 8, md: 12 },
16259
+ React.createElement(antd.Form.Item, { label: t("programme:typeCreation"), wrapperCol: { span: 13 }, className: "role-group", name: "investmentOwnershipType", rules: [
16132
16260
  {
16133
- required: true,
16134
- message: "Required field",
16261
+ required: false,
16135
16262
  },
16136
- function (_a) {
16137
- var getFieldValue = _a.getFieldValue;
16138
- return ({
16139
- validator: function (rule, v) {
16140
- if (getFieldValue([
16141
- "percentage",
16142
- index,
16143
- ]) &&
16144
- parseFloat(getFieldValue([
16263
+ ] },
16264
+ React.createElement(antd.Radio.Group, { size: "large", defaultValue: typeCreation ==
16265
+ exports.InvestmentCreationType.EXISTING
16266
+ ? exports.InvestmentOwnershipType.PROJECT
16267
+ : investmentOwnershipType }, Object.values(exports.InvestmentOwnershipType).map(function (k, index) {
16268
+ if (!(typeCreation ==
16269
+ exports.InvestmentCreationType.EXISTING &&
16270
+ k == exports.InvestmentOwnershipType.NATIONAL) &&
16271
+ !(k ==
16272
+ exports.InvestmentOwnershipType.NATIONAL &&
16273
+ (data === null || data === void 0 ? void 0 : data.programmeId))) {
16274
+ return (React.createElement("div", { className: "condition-radio-container" },
16275
+ React.createElement(antd.Radio.Button, { className: "condition-radio", value: k, onChange: onChangeInvestmentOwnershipType, disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ==
16276
+ exports.CompanyRole.PROGRAMME_DEVELOPER &&
16277
+ stepOneData.toCompanyId !=
16278
+ userInfoState.companyId &&
16279
+ k ==
16280
+ exports.InvestmentOwnershipType.NATIONAL }, t("programme:" + k))));
16281
+ }
16282
+ })))))))),
16283
+ React.createElement("div", { className: "programme-sought-form-container ownership-container" }, Object.keys(data).length > 0 && (React.createElement("div", { className: "programme-sought-form" },
16284
+ 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 },
16285
+ investmentOwnershipType ==
16286
+ exports.InvestmentOwnershipType.PROJECT && (React.createElement("div", null,
16287
+ React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16288
+ React.createElement(antd.Col, { xl: 12, md: 24 },
16289
+ React.createElement("div", { className: "details-part-one" },
16290
+ React.createElement(antd.Form.Item, { label: t("programme:title"), name: "projectId", wrapperCol: { span: 24 }, rules: [
16291
+ {
16292
+ required: true,
16293
+ message: "".concat(t("programme:title"), " ").concat(t("isRequired")),
16294
+ },
16295
+ ] },
16296
+ React.createElement(antd.Select, { size: "large", loading: loadingProgData, defaultValue: allProjectData.length == 1
16297
+ ? allProjectData[0].title
16298
+ : null, disabled: allProjectData.length == 1, onChange: setSelectedProgramme }, allProjectData.map(function (project) { return (React.createElement(antd.Select.Option, { key: project.programmeId, value: project.programmeId }, project.title)); })))))), projectData === null || projectData === void 0 ? void 0 :
16299
+ projectData.companyId.map(function (companyId, index) {
16300
+ if (formTwo.getFieldValue("percentage") &&
16301
+ formTwo.getFieldValue("percentage")[index] &&
16302
+ companyId == stepOneData.toCompanyId) {
16303
+ formTwo.getFieldValue("percentage")[index] = 0;
16304
+ }
16305
+ return (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16306
+ React.createElement(antd.Col, { xl: 8, md: 15 },
16307
+ React.createElement("div", { className: "label" },
16308
+ companyName[companyId].name,
16309
+ React.createElement("span", { className: "required-mark" }, "*"))),
16310
+ React.createElement(antd.Col, { xl: 8, md: 9 },
16311
+ React.createElement(antd.Form.Item, { className: "inline", name: ["percentage", index], initialValue: 0, rules: [
16312
+ {
16313
+ pattern: new RegExp(/^[+]?([.]\d+|\d+[.]?\d*)$/g),
16314
+ message: "Percentage Should be a positive number",
16315
+ },
16316
+ {
16317
+ required: true,
16318
+ message: "Required field",
16319
+ },
16320
+ function (_a) {
16321
+ var getFieldValue = _a.getFieldValue;
16322
+ return ({
16323
+ validator: function (rule, v) {
16324
+ if (getFieldValue([
16145
16325
  "percentage",
16146
16326
  index,
16147
- ])) >
16148
- data.proponentPercentage[index]) {
16149
- // eslint-disable-next-line prefer-promise-reject-errors
16150
- return Promise.reject("Amount > Available");
16151
- }
16152
- return Promise.resolve();
16153
- },
16154
- });
16155
- },
16156
- ] },
16157
- React.createElement(antd.InputNumber, { placeholder: "", controls: false, disabled: govData.companyId == companyId,
16158
- // disabled={userInfoState?.companyId === Number(companyId)}
16159
- onKeyPress: function (event) {
16327
+ ]) &&
16328
+ parseFloat(getFieldValue([
16329
+ "percentage",
16330
+ index,
16331
+ ])) >
16332
+ projectData
16333
+ .proponentPercentage[index]) {
16334
+ // eslint-disable-next-line prefer-promise-reject-errors
16335
+ return Promise.reject("Amount > Available");
16336
+ }
16337
+ return Promise.resolve();
16338
+ },
16339
+ });
16340
+ },
16341
+ ] },
16342
+ React.createElement(antd.InputNumber, { placeholder: "", controls: false, disabled: govData.companyId ==
16343
+ companyId ||
16344
+ companyId ==
16345
+ stepOneData.toCompanyId,
16346
+ // defaultValue={0}
16347
+ // disabled={userInfoState?.companyId === Number(companyId)}
16348
+ onKeyPress: function (event) {
16349
+ if (!/[0-9\.]/.test(event.key)) {
16350
+ event.preventDefault();
16351
+ }
16352
+ } })),
16353
+ React.createElement("div", { className: "inline separator" }, "/"),
16354
+ React.createElement(antd.Form.Item, { className: "inline" },
16355
+ React.createElement(antd.InputNumber, { placeholder: String(projectData === null || projectData === void 0 ? void 0 : projectData.proponentPercentage[index]), disabled: true })))));
16356
+ }),
16357
+ React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16358
+ React.createElement(antd.Col, { xl: 8, md: 15 },
16359
+ React.createElement("div", { className: "label" }, t("programme:total"))),
16360
+ React.createElement(antd.Col, { xl: 8, md: 9 },
16361
+ React.createElement(antd.Form.Item, { className: "inline", name: ["total"] },
16362
+ React.createElement(antd.InputNumber, { placeholder: currentPercTotal + "", controls: false, disabled: true, onKeyPress: function (event) {
16160
16363
  if (!/[0-9\.]/.test(event.key)) {
16161
16364
  event.preventDefault();
16162
16365
  }
16163
16366
  } })),
16164
16367
  React.createElement("div", { className: "inline separator" }, "/"),
16165
16368
  React.createElement(antd.Form.Item, { className: "inline" },
16166
- React.createElement(antd.InputNumber, { placeholder: String(data === null || data === void 0 ? void 0 : data.proponentPercentage[index]), disabled: true })))));
16167
- }),
16168
- React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
16169
- React.createElement(antd.Col, { xl: 8, md: 15 },
16170
- React.createElement("div", { className: "label" }, t("programme:total"))),
16171
- React.createElement(antd.Col, { xl: 8, md: 9 },
16172
- React.createElement(antd.Form.Item, { className: "inline", name: ["total"] },
16173
- React.createElement(antd.InputNumber, { placeholder: currentPercTotal + "", controls: false, disabled: true, onKeyPress: function (event) {
16174
- if (!/[0-9\.]/.test(event.key)) {
16175
- event.preventDefault();
16176
- }
16177
- } })),
16178
- React.createElement("div", { className: "inline separator" }, "/"),
16179
- React.createElement(antd.Form.Item, { className: "inline" },
16180
- React.createElement(antd.InputNumber, { disabled: true, placeholder: "100" })))),
16369
+ React.createElement(antd.InputNumber, { disabled: true, placeholder: "100" })))))),
16181
16370
  React.createElement(antd.Form.Item, null,
16182
16371
  React.createElement("div", { className: "steps-actions" },
16183
16372
  React.createElement(antd.Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: submitInvestment }, t("programme:submit")),