@undp/carbon-library 1.0.175-CARBON-347.8 → 1.0.175-CARBON-347.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.js +372 -161
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +372 -161
- package/dist/esm/index.js.map +1 -1
- package/dist/locales/i18n/programme/en.json +2 -2
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
@@ -15642,26 +15642,34 @@ var Loading = function () {
|
|
15642
15642
|
};
|
15643
15643
|
|
15644
15644
|
var InvestmentCreationComponent = function (props) {
|
15645
|
-
var t = props.t, useLocation = props.useLocation, onNavigateToProgrammeManagementView = props.onNavigateToProgrammeManagementView, onNavigateToProgrammeView = props.onNavigateToProgrammeView;
|
15645
|
+
var t = props.t, useLocation = props.useLocation, onNavigateToProgrammeManagementView = props.onNavigateToProgrammeManagementView, onNavigateToProgrammeView = props.onNavigateToProgrammeView, onNavigateToInvestmentManagementView = props.onNavigateToInvestmentManagementView;
|
15646
15646
|
var state = useLocation().state;
|
15647
15647
|
var _a = useState(), data = _a[0], setData = _a[1];
|
15648
|
-
var _b = useState(),
|
15649
|
-
var _c = useState(
|
15648
|
+
var _b = useState({}), companyNames = _b[0], setCompanyNames = _b[1];
|
15649
|
+
var _c = useState({}); _c[0]; var setUserOrganization = _c[1];
|
15650
|
+
var _d = useState({}), investmentNames = _d[0], setInvestmentNames = _d[1];
|
15651
|
+
var _e = useState(), projectData = _e[0], setProjectData = _e[1];
|
15652
|
+
var _f = useState(), investmentData = _f[0], setInvestmentData = _f[1];
|
15653
|
+
var _g = useState([]), allProjectData = _g[0], setAllProjectData = _g[1];
|
15650
15654
|
var formOne = Form.useForm()[0];
|
15651
15655
|
var formTwo = Form.useForm()[0];
|
15652
15656
|
var post = useConnection().post;
|
15653
|
-
var
|
15654
|
-
var
|
15655
|
-
var
|
15656
|
-
var
|
15657
|
-
var
|
15658
|
-
var
|
15659
|
-
var
|
15660
|
-
var
|
15661
|
-
var
|
15662
|
-
var
|
15663
|
-
var
|
15657
|
+
var _h = useState(false), loading = _h[0], setLoading = _h[1];
|
15658
|
+
var _j = useState("New"), typeCreation = _j[0], setTypeCreation = _j[1];
|
15659
|
+
var _k = useState(InvestmentOwnershipType.PROJECT), investmentOwnershipType = _k[0], setInvestmentOwnershipType = _k[1];
|
15660
|
+
var _l = useState(false), loadingList = _l[0], setLoadingList = _l[1];
|
15661
|
+
var _m = useState(false), loadingInvestment = _m[0], setLoadingInvestment = _m[1];
|
15662
|
+
var _o = useState(false), loadingProgData = _o[0], setLoadingProgData = _o[1];
|
15663
|
+
var _p = useState(0), current = _p[0], setCurrent = _p[1];
|
15664
|
+
var _q = useState(0), currentPercTotal = _q[0], setCurrentPercTotal = _q[1];
|
15665
|
+
var _r = useState([]), organisationsList = _r[0], setOrganisationList = _r[1];
|
15666
|
+
var _s = useState([]), nationalInvestmentList = _s[0], setNationalInvestmentList = _s[1];
|
15667
|
+
var _t = useState([]), instrument = _t[0], setInstrument = _t[1];
|
15668
|
+
var _u = useState(), stepOneData = _u[0], setStepOneData = _u[1];
|
15669
|
+
var _v = useState(), govData = _v[0], setGovData = _v[1];
|
15664
15670
|
var userInfoState = useUserContext().userInfoState;
|
15671
|
+
var _w = useState([]), ministrySectoralScope = _w[0], setMinistrySectoralScope = _w[1];
|
15672
|
+
var _x = useState({}), prevInvestor = _x[0], setPrevInvestor = _x[1];
|
15665
15673
|
var instrumentOptions = Object.keys(Instrument).map(function (k, index) { return ({
|
15666
15674
|
label: addSpaces(Object.values(Instrument)[index]),
|
15667
15675
|
value: Object.values(Instrument)[index],
|
@@ -15721,7 +15729,9 @@ var InvestmentCreationComponent = function (props) {
|
|
15721
15729
|
_a.label = 1;
|
15722
15730
|
case 1:
|
15723
15731
|
_a.trys.push([1, 5, 6, 7]);
|
15732
|
+
if (!data) return [3 /*break*/, 4];
|
15724
15733
|
if (!!(data === null || data === void 0 ? void 0 : data.programmeId)) return [3 /*break*/, 3];
|
15734
|
+
console.log("data non existing", data);
|
15725
15735
|
console.log("getting all Project data");
|
15726
15736
|
return [4 /*yield*/, post("national/programme/query", {
|
15727
15737
|
page: 1,
|
@@ -15737,17 +15747,7 @@ var InvestmentCreationComponent = function (props) {
|
|
15737
15747
|
case 2:
|
15738
15748
|
response = _a.sent();
|
15739
15749
|
if (response.data) {
|
15740
|
-
|
15741
|
-
stepOneData.toCompanyId != userInfoState.companyId) {
|
15742
|
-
setAllProjectData(response === null || response === void 0 ? void 0 : response.data.map(function (obj) {
|
15743
|
-
if (obj.companyId.includes(userInfoState.companyId)) {
|
15744
|
-
return obj;
|
15745
|
-
}
|
15746
|
-
}));
|
15747
|
-
}
|
15748
|
-
else {
|
15749
|
-
setAllProjectData(response === null || response === void 0 ? void 0 : response.data);
|
15750
|
-
}
|
15750
|
+
setAllProjectData(response === null || response === void 0 ? void 0 : response.data);
|
15751
15751
|
console.log("all Project data", response === null || response === void 0 ? void 0 : response.data);
|
15752
15752
|
}
|
15753
15753
|
return [3 /*break*/, 4];
|
@@ -15781,16 +15781,108 @@ var InvestmentCreationComponent = function (props) {
|
|
15781
15781
|
return [2 /*return*/];
|
15782
15782
|
});
|
15783
15783
|
}); };
|
15784
|
-
var
|
15785
|
-
|
15784
|
+
var setSelectedInvestment = function (value) { return __awaiter(void 0, void 0, void 0, function () {
|
15785
|
+
return __generator(this, function (_a) {
|
15786
|
+
console.log("setSelectedInvestment", value);
|
15787
|
+
setInvestmentData(investmentNames[value]);
|
15788
|
+
return [2 /*return*/];
|
15789
|
+
});
|
15790
|
+
}); };
|
15791
|
+
var getNationalInvestmentDetails = function () { return __awaiter(void 0, void 0, void 0, function () {
|
15792
|
+
var filterAnd, response, investmentData_1, _i, _a, investment, error_3;
|
15786
15793
|
return __generator(this, function (_b) {
|
15787
15794
|
switch (_b.label) {
|
15788
15795
|
case 0:
|
15789
|
-
|
15796
|
+
setLoadingInvestment(true);
|
15790
15797
|
_b.label = 1;
|
15791
15798
|
case 1:
|
15792
15799
|
_b.trys.push([1, 3, 4, 5]);
|
15793
15800
|
filterAnd = [];
|
15801
|
+
filterAnd = [
|
15802
|
+
{
|
15803
|
+
key: "category",
|
15804
|
+
operation: "=",
|
15805
|
+
value: InvestmentOwnershipType.NATIONAL.toString(),
|
15806
|
+
},
|
15807
|
+
{
|
15808
|
+
key: "amount",
|
15809
|
+
operation: ">",
|
15810
|
+
value: 0,
|
15811
|
+
},
|
15812
|
+
];
|
15813
|
+
if ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.PROGRAMME_DEVELOPER) {
|
15814
|
+
filterAnd.push({
|
15815
|
+
key: "toCompanyId",
|
15816
|
+
operation: "=",
|
15817
|
+
value: userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyId,
|
15818
|
+
});
|
15819
|
+
}
|
15820
|
+
return [4 /*yield*/, post("national/programme/investmentQuery", {
|
15821
|
+
page: 1,
|
15822
|
+
size: 100,
|
15823
|
+
filterAnd: filterAnd,
|
15824
|
+
})];
|
15825
|
+
case 2:
|
15826
|
+
response = _b.sent();
|
15827
|
+
if (response.data) {
|
15828
|
+
setNationalInvestmentList(response === null || response === void 0 ? void 0 : response.data);
|
15829
|
+
investmentData_1 = {};
|
15830
|
+
for (_i = 0, _a = response === null || response === void 0 ? void 0 : response.data; _i < _a.length; _i++) {
|
15831
|
+
investment = _a[_i];
|
15832
|
+
investmentData_1[investment.requestId] = investment;
|
15833
|
+
}
|
15834
|
+
setInvestmentNames(investmentData_1);
|
15835
|
+
console.log(investmentData_1);
|
15836
|
+
}
|
15837
|
+
return [3 /*break*/, 5];
|
15838
|
+
case 3:
|
15839
|
+
error_3 = _b.sent();
|
15840
|
+
console.log("Error in getting national Investments list", error_3);
|
15841
|
+
return [3 /*break*/, 5];
|
15842
|
+
case 4:
|
15843
|
+
setLoadingInvestment(false);
|
15844
|
+
return [7 /*endfinally*/];
|
15845
|
+
case 5: return [2 /*return*/];
|
15846
|
+
}
|
15847
|
+
});
|
15848
|
+
}); };
|
15849
|
+
var getUserOrganization = function () { return __awaiter(void 0, void 0, void 0, function () {
|
15850
|
+
var response, error_4;
|
15851
|
+
return __generator(this, function (_a) {
|
15852
|
+
switch (_a.label) {
|
15853
|
+
case 0:
|
15854
|
+
_a.trys.push([0, 2, , 3]);
|
15855
|
+
return [4 /*yield*/, post("national/organisation/query", {
|
15856
|
+
page: 1,
|
15857
|
+
size: 100,
|
15858
|
+
filterAnd: [
|
15859
|
+
{ key: "companyId", operation: "=", value: userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyId },
|
15860
|
+
],
|
15861
|
+
})];
|
15862
|
+
case 1:
|
15863
|
+
response = _a.sent();
|
15864
|
+
console.log("getUserOrganization", response.data[0]);
|
15865
|
+
setUserOrganization(response.data[0]);
|
15866
|
+
setMinistrySectoralScope(response.data[0].sectoralScope);
|
15867
|
+
return [3 /*break*/, 3];
|
15868
|
+
case 2:
|
15869
|
+
error_4 = _a.sent();
|
15870
|
+
console.log("Error in getting user organization", error_4);
|
15871
|
+
return [3 /*break*/, 3];
|
15872
|
+
case 3: return [2 /*return*/];
|
15873
|
+
}
|
15874
|
+
});
|
15875
|
+
}); };
|
15876
|
+
var getOrganisationsDetails = function () { return __awaiter(void 0, void 0, void 0, function () {
|
15877
|
+
var filterAnd, filterOr, _i, _a, c, filters, response, companyName, _b, _c, company, error_5;
|
15878
|
+
return __generator(this, function (_d) {
|
15879
|
+
switch (_d.label) {
|
15880
|
+
case 0:
|
15881
|
+
setLoadingList(true);
|
15882
|
+
_d.label = 1;
|
15883
|
+
case 1:
|
15884
|
+
_d.trys.push([1, 3, 4, 5]);
|
15885
|
+
filterAnd = [];
|
15794
15886
|
filterOr = [];
|
15795
15887
|
filterAnd = [
|
15796
15888
|
{
|
@@ -15806,29 +15898,37 @@ var InvestmentCreationComponent = function (props) {
|
|
15806
15898
|
// value: userInfoState?.companyId,
|
15807
15899
|
// });
|
15808
15900
|
// }
|
15809
|
-
|
15810
|
-
|
15811
|
-
|
15812
|
-
|
15813
|
-
|
15814
|
-
|
15815
|
-
|
15901
|
+
if (data === null || data === void 0 ? void 0 : data.companyId) {
|
15902
|
+
for (_i = 0, _a = data === null || data === void 0 ? void 0 : data.companyId; _i < _a.length; _i++) {
|
15903
|
+
c = _a[_i];
|
15904
|
+
filterOr.push({
|
15905
|
+
key: "companyId",
|
15906
|
+
operation: "=",
|
15907
|
+
value: c,
|
15908
|
+
});
|
15909
|
+
}
|
15816
15910
|
}
|
15817
|
-
|
15818
|
-
|
15819
|
-
|
15820
|
-
|
15821
|
-
|
15822
|
-
})];
|
15911
|
+
filters = void 0;
|
15912
|
+
if (filterOr.length) {
|
15913
|
+
filters.filterOr = filterOr;
|
15914
|
+
}
|
15915
|
+
return [4 /*yield*/, post("national/organisation/queryNames", __assign({ page: 1, size: 100, filterAnd: filterAnd }, filters))];
|
15823
15916
|
case 2:
|
15824
|
-
response =
|
15917
|
+
response = _d.sent();
|
15825
15918
|
if (response.data) {
|
15826
15919
|
setOrganisationList(response === null || response === void 0 ? void 0 : response.data);
|
15920
|
+
companyName = {};
|
15921
|
+
for (_b = 0, _c = response === null || response === void 0 ? void 0 : response.data; _b < _c.length; _b++) {
|
15922
|
+
company = _c[_b];
|
15923
|
+
companyName[Number(company.companyId)] = company.name;
|
15924
|
+
}
|
15925
|
+
setCompanyNames(companyName);
|
15926
|
+
console.log(companyName);
|
15827
15927
|
}
|
15828
15928
|
return [3 /*break*/, 5];
|
15829
15929
|
case 3:
|
15830
|
-
|
15831
|
-
console.log("Error in getting organization list",
|
15930
|
+
error_5 = _d.sent();
|
15931
|
+
console.log("Error in getting organization list", error_5);
|
15832
15932
|
return [3 /*break*/, 5];
|
15833
15933
|
case 4:
|
15834
15934
|
setLoadingList(false);
|
@@ -15843,55 +15943,71 @@ var InvestmentCreationComponent = function (props) {
|
|
15843
15943
|
return;
|
15844
15944
|
}
|
15845
15945
|
if (state === null || state === void 0 ? void 0 : state.record) {
|
15946
|
+
console.log("condition 1 data", state === null || state === void 0 ? void 0 : state.record);
|
15846
15947
|
setData(state === null || state === void 0 ? void 0 : state.record);
|
15847
15948
|
}
|
15848
15949
|
else {
|
15950
|
+
console.log("condition 2 data", { ownership: true });
|
15849
15951
|
setData({ ownership: true });
|
15850
15952
|
}
|
15851
15953
|
}, []);
|
15852
15954
|
useEffect(function () {
|
15853
|
-
if (data) {
|
15854
|
-
|
15855
|
-
|
15856
|
-
|
15857
|
-
|
15858
|
-
}
|
15955
|
+
// if (data) {
|
15956
|
+
// const keys = Object.keys(data);
|
15957
|
+
// if (keys[0] !== "ownership") {
|
15958
|
+
// getOrganisationsDetails();
|
15959
|
+
// }
|
15960
|
+
// }
|
15961
|
+
getNationalInvestmentDetails();
|
15962
|
+
getOrganisationsDetails();
|
15859
15963
|
getGovernmentDetails();
|
15860
15964
|
getAllProjectData();
|
15965
|
+
getUserOrganization();
|
15861
15966
|
}, [data]);
|
15862
|
-
if (!data
|
15967
|
+
if (!data && allProjectData.length == 0) {
|
15863
15968
|
return React.createElement(Loading, null);
|
15864
15969
|
}
|
15865
15970
|
console.log("data", data);
|
15866
|
-
var companyName = {};
|
15867
15971
|
if (data && Object.keys(data)[0] !== "ownership") {
|
15868
|
-
for (
|
15869
|
-
|
15870
|
-
|
15871
|
-
}
|
15972
|
+
// for (const company of data!?.company) {
|
15973
|
+
// companyName[company?.companyId] = company;
|
15974
|
+
// }
|
15872
15975
|
if (!data.proponentPercentage) {
|
15873
15976
|
data.proponentPercentage = [100];
|
15874
15977
|
}
|
15875
15978
|
}
|
15876
15979
|
var nextOne = function (val) {
|
15980
|
+
console.log("step 1 values", val);
|
15981
|
+
if (val.typeCreation == InvestmentCreationType.EXISTING) {
|
15982
|
+
val.toCompanyId = investmentData.toCompanyId;
|
15983
|
+
}
|
15877
15984
|
setCurrent(current + 1);
|
15878
15985
|
setStepOneData(val);
|
15879
15986
|
if (data === null || data === void 0 ? void 0 : data.programmeId)
|
15880
15987
|
setSelectedProgramme(data.programmeId);
|
15988
|
+
if (prevInvestor && prevInvestor != val.toCompanyId && !(data === null || data === void 0 ? void 0 : data.programmeId)) {
|
15989
|
+
formTwo.resetFields();
|
15990
|
+
setCurrentPercTotal(0);
|
15991
|
+
setProjectData(undefined);
|
15992
|
+
}
|
15881
15993
|
};
|
15882
15994
|
var prevOne = function () {
|
15883
15995
|
setCurrent(current - 1);
|
15996
|
+
setPrevInvestor(stepOneData.toCompanyId);
|
15997
|
+
// formTwo.resetFields();
|
15998
|
+
// setCurrentPercTotal(0);
|
15999
|
+
// setProjectData(undefined);
|
15884
16000
|
};
|
15885
16001
|
var submitInvestment = function (val) { return __awaiter(void 0, void 0, void 0, function () {
|
15886
|
-
var payload, response,
|
16002
|
+
var payload, response, error_6;
|
15887
16003
|
return __generator(this, function (_a) {
|
15888
16004
|
switch (_a.label) {
|
15889
16005
|
case 0:
|
15890
16006
|
console.log(val);
|
15891
16007
|
console.log(stepOneData);
|
16008
|
+
console.log("OwnershipType", investmentOwnershipType);
|
15892
16009
|
setLoading(true);
|
15893
16010
|
payload = stepOneData;
|
15894
|
-
payload.programmeId = data.programmeId;
|
15895
16011
|
payload.amount = parseFloat(payload.amount);
|
15896
16012
|
if (payload.interestRate) {
|
15897
16013
|
payload.interestRate = parseFloat(payload.interestRate);
|
@@ -15899,15 +16015,27 @@ var InvestmentCreationComponent = function (props) {
|
|
15899
16015
|
if (payload.paymentPerMetric) {
|
15900
16016
|
payload.paymentPerMetric = parseFloat(payload.paymentPerMetric);
|
15901
16017
|
}
|
15902
|
-
payload.fromCompanyIds = data.companyId.map(function (e) { return Number(e); });
|
15903
|
-
payload.percentage = val.percentage;
|
15904
16018
|
payload.toCompanyId = Number(payload.toCompanyId);
|
15905
16019
|
_a.label = 1;
|
15906
16020
|
case 1:
|
15907
|
-
_a.trys.push([1,
|
16021
|
+
_a.trys.push([1, 6, 7, 8]);
|
16022
|
+
response = void 0;
|
16023
|
+
if (!(investmentOwnershipType == InvestmentOwnershipType.PROJECT)) return [3 /*break*/, 3];
|
16024
|
+
if (typeCreation == InvestmentCreationType.EXISTING) {
|
16025
|
+
payload.nationalInvestmentId = investmentData.requestId;
|
16026
|
+
}
|
16027
|
+
payload.programmeId = projectData === null || projectData === void 0 ? void 0 : projectData.programmeId;
|
16028
|
+
payload.fromCompanyIds = projectData === null || projectData === void 0 ? void 0 : projectData.companyId.map(function (e) { return Number(e); });
|
16029
|
+
payload.percentage = val.percentage;
|
15908
16030
|
return [4 /*yield*/, post("national/programme/addInvestment", payload)];
|
15909
16031
|
case 2:
|
15910
16032
|
response = _a.sent();
|
16033
|
+
return [3 /*break*/, 5];
|
16034
|
+
case 3: return [4 /*yield*/, post("national/organisation/addInvestment", payload)];
|
16035
|
+
case 4:
|
16036
|
+
response = _a.sent();
|
16037
|
+
_a.label = 5;
|
16038
|
+
case 5:
|
15911
16039
|
console.log("investment creation -> ", response);
|
15912
16040
|
if ((response === null || response === void 0 ? void 0 : response.statusText) === "SUCCESS") {
|
15913
16041
|
message.open({
|
@@ -15917,22 +16045,24 @@ var InvestmentCreationComponent = function (props) {
|
|
15917
16045
|
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
15918
16046
|
});
|
15919
16047
|
}
|
15920
|
-
|
15921
|
-
|
15922
|
-
|
15923
|
-
|
15924
|
-
|
16048
|
+
(data === null || data === void 0 ? void 0 : data.programmeId)
|
16049
|
+
? onNavigateToProgrammeView(data === null || data === void 0 ? void 0 : data.programmeId)
|
16050
|
+
: onNavigateToInvestmentManagementView();
|
16051
|
+
return [3 /*break*/, 8];
|
16052
|
+
case 6:
|
16053
|
+
error_6 = _a.sent();
|
16054
|
+
console.log("Error in investment creation - ", error_6);
|
15925
16055
|
message.open({
|
15926
16056
|
type: "error",
|
15927
|
-
content:
|
16057
|
+
content: error_6 === null || error_6 === void 0 ? void 0 : error_6.message,
|
15928
16058
|
duration: 4,
|
15929
16059
|
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
15930
16060
|
});
|
15931
|
-
return [3 /*break*/,
|
15932
|
-
case
|
16061
|
+
return [3 /*break*/, 8];
|
16062
|
+
case 7:
|
15933
16063
|
setLoading(false);
|
15934
16064
|
return [7 /*endfinally*/];
|
15935
|
-
case
|
16065
|
+
case 8: return [2 /*return*/];
|
15936
16066
|
}
|
15937
16067
|
});
|
15938
16068
|
}); };
|
@@ -15946,6 +16076,10 @@ var InvestmentCreationComponent = function (props) {
|
|
15946
16076
|
var onChangeTypeCreation = function (e) {
|
15947
16077
|
console.log("radio checked", e.target.value);
|
15948
16078
|
setTypeCreation(e.target.value);
|
16079
|
+
formOne.resetFields();
|
16080
|
+
formTwo.resetFields();
|
16081
|
+
setCurrentPercTotal(0);
|
16082
|
+
setProjectData(undefined);
|
15949
16083
|
};
|
15950
16084
|
var onChangeInvestmentOwnershipType = function (e) {
|
15951
16085
|
console.log("investment ownership type radio checked", e.target.value);
|
@@ -15984,7 +16118,18 @@ var InvestmentCreationComponent = function (props) {
|
|
15984
16118
|
message: "".concat(t("programme:investorName"), " ").concat(t("isRequired")),
|
15985
16119
|
},
|
15986
16120
|
] },
|
15987
|
-
React.createElement(Select, { size: "large", loading: loadingList }, organisationsList.map(function (organisation) {
|
16121
|
+
React.createElement(Select, { size: "large", loading: loadingList }, organisationsList.map(function (organisation) {
|
16122
|
+
if (data === null || data === void 0 ? void 0 : data.programmeId) {
|
16123
|
+
if (data.companyId
|
16124
|
+
.map(function (id) { return Number(id); })
|
16125
|
+
.includes(Number(organisation.companyId))) {
|
16126
|
+
return (React.createElement(Select.Option, { key: organisation.companyId, value: organisation.companyId }, organisation.name));
|
16127
|
+
}
|
16128
|
+
}
|
16129
|
+
else {
|
16130
|
+
return (React.createElement(Select.Option, { key: organisation.companyId, value: organisation.companyId }, organisation.name));
|
16131
|
+
}
|
16132
|
+
}))))),
|
15988
16133
|
React.createElement(Col, { xl: 12, md: 24 },
|
15989
16134
|
React.createElement("div", { className: "details-part-two" },
|
15990
16135
|
React.createElement(Form.Item, { label: t("programme:amountInvested"), name: "amount", rules: [
|
@@ -16183,7 +16328,7 @@ var InvestmentCreationComponent = function (props) {
|
|
16183
16328
|
message: "".concat(t("programme:existingInvestmentSource"), " ").concat(t("isRequired")),
|
16184
16329
|
},
|
16185
16330
|
] },
|
16186
|
-
React.createElement(Select, { size: "large", loading:
|
16331
|
+
React.createElement(Select, { size: "large", loading: loadingInvestment, onChange: setSelectedInvestment }, nationalInvestmentList.map(function (investment) { return (React.createElement(Select.Option, { key: investment.requestId, value: investment.requestId }, investment.investmentName)); })))))),
|
16187
16332
|
React.createElement(Row, { className: "row", gutter: [16, 16] },
|
16188
16333
|
React.createElement(Col, { xl: 12, md: 24 },
|
16189
16334
|
React.createElement("div", { className: "details-part-two" },
|
@@ -16212,6 +16357,21 @@ var InvestmentCreationComponent = function (props) {
|
|
16212
16357
|
});
|
16213
16358
|
}); },
|
16214
16359
|
},
|
16360
|
+
function (_a) {
|
16361
|
+
var getFieldValue = _a.getFieldValue;
|
16362
|
+
return ({
|
16363
|
+
validator: function (rule, v) {
|
16364
|
+
if (getFieldValue("amount") &&
|
16365
|
+
investmentData &&
|
16366
|
+
investmentData.amount <
|
16367
|
+
parseFloat(getFieldValue("amount"))) {
|
16368
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
16369
|
+
return Promise.reject("Amount > Available");
|
16370
|
+
}
|
16371
|
+
return Promise.resolve();
|
16372
|
+
},
|
16373
|
+
});
|
16374
|
+
},
|
16215
16375
|
] },
|
16216
16376
|
React.createElement(Input, { size: "large" })))),
|
16217
16377
|
React.createElement(Col, { xl: 12, md: 24 },
|
@@ -16221,7 +16381,9 @@ var InvestmentCreationComponent = function (props) {
|
|
16221
16381
|
"/",
|
16222
16382
|
React.createElement(InputNumber, { size: "large", width: "100%", formatter: function (value) {
|
16223
16383
|
return "$".concat(addCommSep(value));
|
16224
|
-
}, disabled: true
|
16384
|
+
}, disabled: true, value: investmentData
|
16385
|
+
? investmentData.amount
|
16386
|
+
: 0 })))))))),
|
16225
16387
|
React.createElement(Form.Item, null,
|
16226
16388
|
React.createElement("div", { className: "steps-actions" },
|
16227
16389
|
React.createElement(Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: nextOne }, t("programme:next")))))))),
|
@@ -16252,105 +16414,141 @@ var InvestmentCreationComponent = function (props) {
|
|
16252
16414
|
InvestmentOwnershipType.NATIONAL &&
|
16253
16415
|
(data === null || data === void 0 ? void 0 : data.programmeId))) {
|
16254
16416
|
return (React.createElement("div", { className: "condition-radio-container" },
|
16255
|
-
React.createElement(
|
16417
|
+
React.createElement(Tooltip, { title: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ==
|
16256
16418
|
CompanyRole.PROGRAMME_DEVELOPER &&
|
16257
16419
|
stepOneData.toCompanyId !=
|
16258
16420
|
userInfoState.companyId &&
|
16259
16421
|
k ==
|
16260
|
-
InvestmentOwnershipType.NATIONAL
|
16422
|
+
InvestmentOwnershipType.NATIONAL
|
16423
|
+
? "This action is unauthorized due to the selected investor name."
|
16424
|
+
: "", color: TooltipColor, key: TooltipColor },
|
16425
|
+
React.createElement(Radio.Button, { className: "condition-radio", value: k, onChange: onChangeInvestmentOwnershipType, disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ==
|
16426
|
+
CompanyRole.PROGRAMME_DEVELOPER &&
|
16427
|
+
stepOneData.toCompanyId !=
|
16428
|
+
userInfoState.companyId &&
|
16429
|
+
k ==
|
16430
|
+
InvestmentOwnershipType.NATIONAL }, t("programme:" + k)))));
|
16261
16431
|
}
|
16262
16432
|
})))))))),
|
16263
|
-
React.createElement("div", { className: "programme-sought-form-container ownership-container" },
|
16264
|
-
React.createElement(
|
16265
|
-
|
16266
|
-
|
16267
|
-
|
16268
|
-
|
16269
|
-
|
16270
|
-
|
16271
|
-
|
16272
|
-
|
16273
|
-
|
16274
|
-
|
16275
|
-
|
16276
|
-
|
16277
|
-
|
16278
|
-
|
16279
|
-
|
16280
|
-
|
16281
|
-
|
16282
|
-
|
16283
|
-
|
16284
|
-
|
16285
|
-
|
16286
|
-
|
16287
|
-
|
16288
|
-
|
16289
|
-
|
16290
|
-
|
16291
|
-
|
16292
|
-
|
16293
|
-
|
16294
|
-
|
16295
|
-
|
16296
|
-
|
16297
|
-
|
16298
|
-
|
16299
|
-
|
16300
|
-
|
16301
|
-
|
16302
|
-
|
16303
|
-
|
16304
|
-
|
16305
|
-
|
16306
|
-
|
16307
|
-
|
16308
|
-
|
16433
|
+
React.createElement("div", { className: "programme-sought-form-container ownership-container" },
|
16434
|
+
React.createElement("div", { className: "programme-sought-form" },
|
16435
|
+
React.createElement(Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, form: formTwo, name: "investment-sought", className: "investment-sought-form", layout: "vertical", requiredMark: true, onChange: onPercentageChange, onFinish: submitInvestment },
|
16436
|
+
allProjectData.length > 0 &&
|
16437
|
+
investmentOwnershipType ==
|
16438
|
+
InvestmentOwnershipType.PROJECT && (React.createElement("div", null,
|
16439
|
+
React.createElement(Row, { className: "row", gutter: [16, 16] },
|
16440
|
+
React.createElement(Col, { xl: 12, md: 24 },
|
16441
|
+
React.createElement("div", { className: "details-part-one" },
|
16442
|
+
React.createElement(Form.Item, { label: t("programme:title"), name: "projectId", wrapperCol: { span: 24 }, initialValue: allProjectData.length == 1
|
16443
|
+
? allProjectData[0].programmeId
|
16444
|
+
: null, rules: [
|
16445
|
+
{
|
16446
|
+
required: true,
|
16447
|
+
message: "".concat(t("programme:title"), " ").concat(t("isRequired")),
|
16448
|
+
},
|
16449
|
+
] },
|
16450
|
+
React.createElement(Select, { size: "large", loading: loadingProgData,
|
16451
|
+
// defaultValue={
|
16452
|
+
// allProjectData.length == 1
|
16453
|
+
// ? allProjectData[0].programmeId
|
16454
|
+
// : null
|
16455
|
+
// }
|
16456
|
+
disabled: allProjectData.length == 1 &&
|
16457
|
+
(data === null || data === void 0 ? void 0 : data.programmeId) != undefined, onChange: setSelectedProgramme }, allProjectData.map(function (project) {
|
16458
|
+
if ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ==
|
16459
|
+
CompanyRole.PROGRAMME_DEVELOPER &&
|
16460
|
+
Number(stepOneData.toCompanyId) !=
|
16461
|
+
userInfoState.companyId) {
|
16462
|
+
if (project.companyId
|
16463
|
+
.map(function (id) { return Number(id); })
|
16464
|
+
.includes(userInfoState.companyId)) {
|
16465
|
+
return (React.createElement(Select.Option, { key: project.programmeId, value: project.programmeId }, project.title));
|
16466
|
+
}
|
16467
|
+
}
|
16468
|
+
else if ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ===
|
16469
|
+
CompanyRole.MINISTRY) {
|
16470
|
+
if (ministrySectoralScope.includes(project.sectoralScope)) {
|
16471
|
+
return (React.createElement(Select.Option, { key: project.programmeId, value: project.programmeId }, project.title));
|
16472
|
+
}
|
16473
|
+
}
|
16474
|
+
else {
|
16475
|
+
return (React.createElement(Select.Option, { key: project.programmeId, value: project.programmeId }, project.title));
|
16476
|
+
}
|
16477
|
+
})))))), projectData === null || projectData === void 0 ? void 0 :
|
16478
|
+
projectData.companyId.map(function (companyId, index) {
|
16479
|
+
if (formTwo.getFieldValue("percentage") &&
|
16480
|
+
formTwo.getFieldValue("percentage")[index] &&
|
16481
|
+
companyId == stepOneData.toCompanyId) {
|
16482
|
+
formTwo.getFieldValue("percentage")[index] = 0;
|
16483
|
+
}
|
16484
|
+
return (React.createElement(Row, { className: "row", gutter: [16, 16] },
|
16485
|
+
React.createElement(Col, { xl: 8, md: 15 },
|
16486
|
+
React.createElement("div", { className: "label" },
|
16487
|
+
companyNames[Number(companyId)],
|
16488
|
+
React.createElement("span", { className: "required-mark" }, "*"))),
|
16489
|
+
React.createElement(Col, { xl: 8, md: 9 },
|
16490
|
+
React.createElement(Form.Item, { className: "inline", name: ["percentage", index], initialValue: 0, rules: [
|
16491
|
+
{
|
16492
|
+
pattern: new RegExp(/^[+]?([.]\d+|\d+[.]?\d*)$/g),
|
16493
|
+
message: "Percentage Should be a positive number",
|
16494
|
+
},
|
16495
|
+
{
|
16496
|
+
required: true,
|
16497
|
+
message: "Required field",
|
16498
|
+
},
|
16499
|
+
function (_a) {
|
16500
|
+
var getFieldValue = _a.getFieldValue;
|
16501
|
+
return ({
|
16502
|
+
validator: function (rule, v) {
|
16503
|
+
if (getFieldValue([
|
16309
16504
|
"percentage",
|
16310
16505
|
index,
|
16311
|
-
])
|
16312
|
-
|
16313
|
-
|
16314
|
-
|
16315
|
-
|
16316
|
-
|
16317
|
-
|
16318
|
-
|
16319
|
-
|
16320
|
-
|
16321
|
-
|
16322
|
-
|
16323
|
-
|
16324
|
-
|
16325
|
-
|
16326
|
-
|
16327
|
-
|
16328
|
-
|
16506
|
+
]) &&
|
16507
|
+
parseFloat(getFieldValue([
|
16508
|
+
"percentage",
|
16509
|
+
index,
|
16510
|
+
])) >
|
16511
|
+
projectData
|
16512
|
+
.proponentPercentage[index]) {
|
16513
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
16514
|
+
return Promise.reject("Amount > Available");
|
16515
|
+
}
|
16516
|
+
return Promise.resolve();
|
16517
|
+
},
|
16518
|
+
});
|
16519
|
+
},
|
16520
|
+
] },
|
16521
|
+
React.createElement(InputNumber, { placeholder: "", controls: false, disabled: govData.companyId ==
|
16522
|
+
companyId ||
|
16523
|
+
companyId ==
|
16524
|
+
stepOneData.toCompanyId, value: 0,
|
16525
|
+
// disabled={userInfoState?.companyId === Number(companyId)}
|
16526
|
+
onKeyPress: function (event) {
|
16527
|
+
if (!/[0-9\.]/.test(event.key)) {
|
16528
|
+
event.preventDefault();
|
16529
|
+
}
|
16530
|
+
} })),
|
16531
|
+
React.createElement("div", { className: "inline separator" }, "/"),
|
16532
|
+
React.createElement(Form.Item, { className: "inline" },
|
16533
|
+
React.createElement(InputNumber, { placeholder: String(projectData === null || projectData === void 0 ? void 0 : projectData.proponentPercentage[index]), disabled: true })))));
|
16534
|
+
}),
|
16535
|
+
React.createElement(Row, { className: "row", gutter: [16, 16] },
|
16536
|
+
React.createElement(Col, { xl: 8, md: 15 },
|
16537
|
+
React.createElement("div", { className: "label" }, t("programme:total"))),
|
16538
|
+
React.createElement(Col, { xl: 8, md: 9 },
|
16539
|
+
React.createElement(Form.Item, { className: "inline", name: ["total"] },
|
16540
|
+
React.createElement(InputNumber, { placeholder: currentPercTotal + "", controls: false, disabled: true, onKeyPress: function (event) {
|
16329
16541
|
if (!/[0-9\.]/.test(event.key)) {
|
16330
16542
|
event.preventDefault();
|
16331
16543
|
}
|
16332
16544
|
} })),
|
16333
16545
|
React.createElement("div", { className: "inline separator" }, "/"),
|
16334
16546
|
React.createElement(Form.Item, { className: "inline" },
|
16335
|
-
React.createElement(InputNumber, {
|
16336
|
-
|
16337
|
-
|
16338
|
-
|
16339
|
-
React.createElement(
|
16340
|
-
React.createElement(Col, { xl: 8, md: 9 },
|
16341
|
-
React.createElement(Form.Item, { className: "inline", name: ["total"] },
|
16342
|
-
React.createElement(InputNumber, { placeholder: currentPercTotal + "", controls: false, disabled: true, onKeyPress: function (event) {
|
16343
|
-
if (!/[0-9\.]/.test(event.key)) {
|
16344
|
-
event.preventDefault();
|
16345
|
-
}
|
16346
|
-
} })),
|
16347
|
-
React.createElement("div", { className: "inline separator" }, "/"),
|
16348
|
-
React.createElement(Form.Item, { className: "inline" },
|
16349
|
-
React.createElement(InputNumber, { disabled: true, placeholder: "100" })))))),
|
16350
|
-
React.createElement(Form.Item, null,
|
16351
|
-
React.createElement("div", { className: "steps-actions" },
|
16352
|
-
React.createElement(Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: submitInvestment }, t("programme:submit")),
|
16353
|
-
React.createElement(Button, { className: "back-btn", onClick: function () { return prevOne(); }, loading: loading }, t("programme:back")))))))))),
|
16547
|
+
React.createElement(InputNumber, { disabled: true, placeholder: "100" })))))),
|
16548
|
+
React.createElement(Form.Item, null,
|
16549
|
+
React.createElement("div", { className: "steps-actions" },
|
16550
|
+
React.createElement(Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: submitInvestment }, t("programme:submit")),
|
16551
|
+
React.createElement(Button, { className: "back-btn", onClick: function () { return prevOne(); }, loading: loading }, t("programme:back"))))))))),
|
16354
16552
|
},
|
16355
16553
|
] })))));
|
16356
16554
|
};
|
@@ -16799,7 +16997,10 @@ var InvestmentManagementComponent = function (props) {
|
|
16799
16997
|
sorter: true,
|
16800
16998
|
align: "left",
|
16801
16999
|
render: function (item) {
|
16802
|
-
|
17000
|
+
if (item) {
|
17001
|
+
return React.createElement("span", { className: "clickable" }, item);
|
17002
|
+
}
|
17003
|
+
return React.createElement("span", null, "-");
|
16803
17004
|
},
|
16804
17005
|
onCell: function (record, rowIndex) {
|
16805
17006
|
return {
|
@@ -16857,6 +17058,12 @@ var InvestmentManagementComponent = function (props) {
|
|
16857
17058
|
key: "programmeSector",
|
16858
17059
|
sorter: true,
|
16859
17060
|
align: "left",
|
17061
|
+
render: function (item) {
|
17062
|
+
if (item) {
|
17063
|
+
return React.createElement("span", null, item);
|
17064
|
+
}
|
17065
|
+
return React.createElement("span", null, "-");
|
17066
|
+
},
|
16860
17067
|
},
|
16861
17068
|
{
|
16862
17069
|
title: t("programme:investor"),
|
@@ -16940,7 +17147,11 @@ var InvestmentManagementComponent = function (props) {
|
|
16940
17147
|
React.createElement("div", { className: "title-bar" },
|
16941
17148
|
React.createElement("div", { className: "body-title" }, t("programme:investmentTitle")),
|
16942
17149
|
React.createElement("div", { className: "body-sub-title" }, t("programme:investmentDesc"))),
|
16943
|
-
React.createElement("div", { className: "actions" }, enableAddOwnership &&
|
17150
|
+
React.createElement("div", { className: "actions" }, enableAddOwnership &&
|
17151
|
+
((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) == CompanyRole.MINISTRY ||
|
17152
|
+
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) == CompanyRole.GOVERNMENT ||
|
17153
|
+
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) == CompanyRole.PROGRAMME_DEVELOPER) &&
|
17154
|
+
userInfoState.userRole != Role.ViewOnly && (React.createElement("div", { className: "action-bar" },
|
16944
17155
|
React.createElement(Button, { type: "primary", size: "large", block: true, icon: React.createElement(PlusOutlined, null), onClick: onClickAddOwnership }, t("programme:addOwnership")))))),
|
16945
17156
|
React.createElement("div", { className: "content-card" },
|
16946
17157
|
React.createElement(Row, null,
|
@@ -16981,7 +17192,7 @@ var InvestmentManagementComponent = function (props) {
|
|
16981
17192
|
return handleTableChange(val, sorter);
|
16982
17193
|
}, locale: {
|
16983
17194
|
emptyText: (React.createElement(Empty, { image: Empty.PRESENTED_IMAGE_SIMPLE, description: tableData.length === 0
|
16984
|
-
? t("
|
17195
|
+
? t("programme:noInvestmentData")
|
16985
17196
|
: null })),
|
16986
17197
|
} }))))),
|
16987
17198
|
popupInfo && selectedReq && (React.createElement(InvestmentActionModel, { investment: selectedReq, onCancel: function () {
|