@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/cjs/index.js
CHANGED
@@ -15662,26 +15662,34 @@ var Loading = function () {
|
|
15662
15662
|
};
|
15663
15663
|
|
15664
15664
|
var InvestmentCreationComponent = function (props) {
|
15665
|
-
var t = props.t, useLocation = props.useLocation, onNavigateToProgrammeManagementView = props.onNavigateToProgrammeManagementView, onNavigateToProgrammeView = props.onNavigateToProgrammeView;
|
15665
|
+
var t = props.t, useLocation = props.useLocation, onNavigateToProgrammeManagementView = props.onNavigateToProgrammeManagementView, onNavigateToProgrammeView = props.onNavigateToProgrammeView, onNavigateToInvestmentManagementView = props.onNavigateToInvestmentManagementView;
|
15666
15666
|
var state = useLocation().state;
|
15667
15667
|
var _a = React.useState(), data = _a[0], setData = _a[1];
|
15668
|
-
var _b = React.useState(),
|
15669
|
-
var _c = React.useState(
|
15668
|
+
var _b = React.useState({}), companyNames = _b[0], setCompanyNames = _b[1];
|
15669
|
+
var _c = React.useState({}); _c[0]; var setUserOrganization = _c[1];
|
15670
|
+
var _d = React.useState({}), investmentNames = _d[0], setInvestmentNames = _d[1];
|
15671
|
+
var _e = React.useState(), projectData = _e[0], setProjectData = _e[1];
|
15672
|
+
var _f = React.useState(), investmentData = _f[0], setInvestmentData = _f[1];
|
15673
|
+
var _g = React.useState([]), allProjectData = _g[0], setAllProjectData = _g[1];
|
15670
15674
|
var formOne = antd.Form.useForm()[0];
|
15671
15675
|
var formTwo = antd.Form.useForm()[0];
|
15672
15676
|
var post = useConnection().post;
|
15673
|
-
var
|
15674
|
-
var
|
15675
|
-
var
|
15676
|
-
var
|
15677
|
-
var
|
15678
|
-
var
|
15679
|
-
var
|
15680
|
-
var
|
15681
|
-
var
|
15682
|
-
var
|
15683
|
-
var
|
15677
|
+
var _h = React.useState(false), loading = _h[0], setLoading = _h[1];
|
15678
|
+
var _j = React.useState("New"), typeCreation = _j[0], setTypeCreation = _j[1];
|
15679
|
+
var _k = React.useState(exports.InvestmentOwnershipType.PROJECT), investmentOwnershipType = _k[0], setInvestmentOwnershipType = _k[1];
|
15680
|
+
var _l = React.useState(false), loadingList = _l[0], setLoadingList = _l[1];
|
15681
|
+
var _m = React.useState(false), loadingInvestment = _m[0], setLoadingInvestment = _m[1];
|
15682
|
+
var _o = React.useState(false), loadingProgData = _o[0], setLoadingProgData = _o[1];
|
15683
|
+
var _p = React.useState(0), current = _p[0], setCurrent = _p[1];
|
15684
|
+
var _q = React.useState(0), currentPercTotal = _q[0], setCurrentPercTotal = _q[1];
|
15685
|
+
var _r = React.useState([]), organisationsList = _r[0], setOrganisationList = _r[1];
|
15686
|
+
var _s = React.useState([]), nationalInvestmentList = _s[0], setNationalInvestmentList = _s[1];
|
15687
|
+
var _t = React.useState([]), instrument = _t[0], setInstrument = _t[1];
|
15688
|
+
var _u = React.useState(), stepOneData = _u[0], setStepOneData = _u[1];
|
15689
|
+
var _v = React.useState(), govData = _v[0], setGovData = _v[1];
|
15684
15690
|
var userInfoState = useUserContext().userInfoState;
|
15691
|
+
var _w = React.useState([]), ministrySectoralScope = _w[0], setMinistrySectoralScope = _w[1];
|
15692
|
+
var _x = React.useState({}), prevInvestor = _x[0], setPrevInvestor = _x[1];
|
15685
15693
|
var instrumentOptions = Object.keys(exports.Instrument).map(function (k, index) { return ({
|
15686
15694
|
label: addSpaces(Object.values(exports.Instrument)[index]),
|
15687
15695
|
value: Object.values(exports.Instrument)[index],
|
@@ -15741,7 +15749,9 @@ var InvestmentCreationComponent = function (props) {
|
|
15741
15749
|
_a.label = 1;
|
15742
15750
|
case 1:
|
15743
15751
|
_a.trys.push([1, 5, 6, 7]);
|
15752
|
+
if (!data) return [3 /*break*/, 4];
|
15744
15753
|
if (!!(data === null || data === void 0 ? void 0 : data.programmeId)) return [3 /*break*/, 3];
|
15754
|
+
console.log("data non existing", data);
|
15745
15755
|
console.log("getting all Project data");
|
15746
15756
|
return [4 /*yield*/, post("national/programme/query", {
|
15747
15757
|
page: 1,
|
@@ -15757,17 +15767,7 @@ var InvestmentCreationComponent = function (props) {
|
|
15757
15767
|
case 2:
|
15758
15768
|
response = _a.sent();
|
15759
15769
|
if (response.data) {
|
15760
|
-
|
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
|
-
}
|
15770
|
+
setAllProjectData(response === null || response === void 0 ? void 0 : response.data);
|
15771
15771
|
console.log("all Project data", response === null || response === void 0 ? void 0 : response.data);
|
15772
15772
|
}
|
15773
15773
|
return [3 /*break*/, 4];
|
@@ -15801,16 +15801,108 @@ var InvestmentCreationComponent = function (props) {
|
|
15801
15801
|
return [2 /*return*/];
|
15802
15802
|
});
|
15803
15803
|
}); };
|
15804
|
-
var
|
15805
|
-
|
15804
|
+
var setSelectedInvestment = function (value) { return __awaiter(void 0, void 0, void 0, function () {
|
15805
|
+
return __generator(this, function (_a) {
|
15806
|
+
console.log("setSelectedInvestment", value);
|
15807
|
+
setInvestmentData(investmentNames[value]);
|
15808
|
+
return [2 /*return*/];
|
15809
|
+
});
|
15810
|
+
}); };
|
15811
|
+
var getNationalInvestmentDetails = function () { return __awaiter(void 0, void 0, void 0, function () {
|
15812
|
+
var filterAnd, response, investmentData_1, _i, _a, investment, error_3;
|
15806
15813
|
return __generator(this, function (_b) {
|
15807
15814
|
switch (_b.label) {
|
15808
15815
|
case 0:
|
15809
|
-
|
15816
|
+
setLoadingInvestment(true);
|
15810
15817
|
_b.label = 1;
|
15811
15818
|
case 1:
|
15812
15819
|
_b.trys.push([1, 3, 4, 5]);
|
15813
15820
|
filterAnd = [];
|
15821
|
+
filterAnd = [
|
15822
|
+
{
|
15823
|
+
key: "category",
|
15824
|
+
operation: "=",
|
15825
|
+
value: exports.InvestmentOwnershipType.NATIONAL.toString(),
|
15826
|
+
},
|
15827
|
+
{
|
15828
|
+
key: "amount",
|
15829
|
+
operation: ">",
|
15830
|
+
value: 0,
|
15831
|
+
},
|
15832
|
+
];
|
15833
|
+
if ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.PROGRAMME_DEVELOPER) {
|
15834
|
+
filterAnd.push({
|
15835
|
+
key: "toCompanyId",
|
15836
|
+
operation: "=",
|
15837
|
+
value: userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyId,
|
15838
|
+
});
|
15839
|
+
}
|
15840
|
+
return [4 /*yield*/, post("national/programme/investmentQuery", {
|
15841
|
+
page: 1,
|
15842
|
+
size: 100,
|
15843
|
+
filterAnd: filterAnd,
|
15844
|
+
})];
|
15845
|
+
case 2:
|
15846
|
+
response = _b.sent();
|
15847
|
+
if (response.data) {
|
15848
|
+
setNationalInvestmentList(response === null || response === void 0 ? void 0 : response.data);
|
15849
|
+
investmentData_1 = {};
|
15850
|
+
for (_i = 0, _a = response === null || response === void 0 ? void 0 : response.data; _i < _a.length; _i++) {
|
15851
|
+
investment = _a[_i];
|
15852
|
+
investmentData_1[investment.requestId] = investment;
|
15853
|
+
}
|
15854
|
+
setInvestmentNames(investmentData_1);
|
15855
|
+
console.log(investmentData_1);
|
15856
|
+
}
|
15857
|
+
return [3 /*break*/, 5];
|
15858
|
+
case 3:
|
15859
|
+
error_3 = _b.sent();
|
15860
|
+
console.log("Error in getting national Investments list", error_3);
|
15861
|
+
return [3 /*break*/, 5];
|
15862
|
+
case 4:
|
15863
|
+
setLoadingInvestment(false);
|
15864
|
+
return [7 /*endfinally*/];
|
15865
|
+
case 5: return [2 /*return*/];
|
15866
|
+
}
|
15867
|
+
});
|
15868
|
+
}); };
|
15869
|
+
var getUserOrganization = function () { return __awaiter(void 0, void 0, void 0, function () {
|
15870
|
+
var response, error_4;
|
15871
|
+
return __generator(this, function (_a) {
|
15872
|
+
switch (_a.label) {
|
15873
|
+
case 0:
|
15874
|
+
_a.trys.push([0, 2, , 3]);
|
15875
|
+
return [4 /*yield*/, post("national/organisation/query", {
|
15876
|
+
page: 1,
|
15877
|
+
size: 100,
|
15878
|
+
filterAnd: [
|
15879
|
+
{ key: "companyId", operation: "=", value: userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyId },
|
15880
|
+
],
|
15881
|
+
})];
|
15882
|
+
case 1:
|
15883
|
+
response = _a.sent();
|
15884
|
+
console.log("getUserOrganization", response.data[0]);
|
15885
|
+
setUserOrganization(response.data[0]);
|
15886
|
+
setMinistrySectoralScope(response.data[0].sectoralScope);
|
15887
|
+
return [3 /*break*/, 3];
|
15888
|
+
case 2:
|
15889
|
+
error_4 = _a.sent();
|
15890
|
+
console.log("Error in getting user organization", error_4);
|
15891
|
+
return [3 /*break*/, 3];
|
15892
|
+
case 3: return [2 /*return*/];
|
15893
|
+
}
|
15894
|
+
});
|
15895
|
+
}); };
|
15896
|
+
var getOrganisationsDetails = function () { return __awaiter(void 0, void 0, void 0, function () {
|
15897
|
+
var filterAnd, filterOr, _i, _a, c, filters, response, companyName, _b, _c, company, error_5;
|
15898
|
+
return __generator(this, function (_d) {
|
15899
|
+
switch (_d.label) {
|
15900
|
+
case 0:
|
15901
|
+
setLoadingList(true);
|
15902
|
+
_d.label = 1;
|
15903
|
+
case 1:
|
15904
|
+
_d.trys.push([1, 3, 4, 5]);
|
15905
|
+
filterAnd = [];
|
15814
15906
|
filterOr = [];
|
15815
15907
|
filterAnd = [
|
15816
15908
|
{
|
@@ -15826,29 +15918,37 @@ var InvestmentCreationComponent = function (props) {
|
|
15826
15918
|
// value: userInfoState?.companyId,
|
15827
15919
|
// });
|
15828
15920
|
// }
|
15829
|
-
|
15830
|
-
|
15831
|
-
|
15832
|
-
|
15833
|
-
|
15834
|
-
|
15835
|
-
|
15921
|
+
if (data === null || data === void 0 ? void 0 : data.companyId) {
|
15922
|
+
for (_i = 0, _a = data === null || data === void 0 ? void 0 : data.companyId; _i < _a.length; _i++) {
|
15923
|
+
c = _a[_i];
|
15924
|
+
filterOr.push({
|
15925
|
+
key: "companyId",
|
15926
|
+
operation: "=",
|
15927
|
+
value: c,
|
15928
|
+
});
|
15929
|
+
}
|
15836
15930
|
}
|
15837
|
-
|
15838
|
-
|
15839
|
-
|
15840
|
-
|
15841
|
-
|
15842
|
-
})];
|
15931
|
+
filters = void 0;
|
15932
|
+
if (filterOr.length) {
|
15933
|
+
filters.filterOr = filterOr;
|
15934
|
+
}
|
15935
|
+
return [4 /*yield*/, post("national/organisation/queryNames", __assign({ page: 1, size: 100, filterAnd: filterAnd }, filters))];
|
15843
15936
|
case 2:
|
15844
|
-
response =
|
15937
|
+
response = _d.sent();
|
15845
15938
|
if (response.data) {
|
15846
15939
|
setOrganisationList(response === null || response === void 0 ? void 0 : response.data);
|
15940
|
+
companyName = {};
|
15941
|
+
for (_b = 0, _c = response === null || response === void 0 ? void 0 : response.data; _b < _c.length; _b++) {
|
15942
|
+
company = _c[_b];
|
15943
|
+
companyName[Number(company.companyId)] = company.name;
|
15944
|
+
}
|
15945
|
+
setCompanyNames(companyName);
|
15946
|
+
console.log(companyName);
|
15847
15947
|
}
|
15848
15948
|
return [3 /*break*/, 5];
|
15849
15949
|
case 3:
|
15850
|
-
|
15851
|
-
console.log("Error in getting organization list",
|
15950
|
+
error_5 = _d.sent();
|
15951
|
+
console.log("Error in getting organization list", error_5);
|
15852
15952
|
return [3 /*break*/, 5];
|
15853
15953
|
case 4:
|
15854
15954
|
setLoadingList(false);
|
@@ -15863,55 +15963,71 @@ var InvestmentCreationComponent = function (props) {
|
|
15863
15963
|
return;
|
15864
15964
|
}
|
15865
15965
|
if (state === null || state === void 0 ? void 0 : state.record) {
|
15966
|
+
console.log("condition 1 data", state === null || state === void 0 ? void 0 : state.record);
|
15866
15967
|
setData(state === null || state === void 0 ? void 0 : state.record);
|
15867
15968
|
}
|
15868
15969
|
else {
|
15970
|
+
console.log("condition 2 data", { ownership: true });
|
15869
15971
|
setData({ ownership: true });
|
15870
15972
|
}
|
15871
15973
|
}, []);
|
15872
15974
|
React.useEffect(function () {
|
15873
|
-
if (data) {
|
15874
|
-
|
15875
|
-
|
15876
|
-
|
15877
|
-
|
15878
|
-
}
|
15975
|
+
// if (data) {
|
15976
|
+
// const keys = Object.keys(data);
|
15977
|
+
// if (keys[0] !== "ownership") {
|
15978
|
+
// getOrganisationsDetails();
|
15979
|
+
// }
|
15980
|
+
// }
|
15981
|
+
getNationalInvestmentDetails();
|
15982
|
+
getOrganisationsDetails();
|
15879
15983
|
getGovernmentDetails();
|
15880
15984
|
getAllProjectData();
|
15985
|
+
getUserOrganization();
|
15881
15986
|
}, [data]);
|
15882
|
-
if (!data
|
15987
|
+
if (!data && allProjectData.length == 0) {
|
15883
15988
|
return React.createElement(Loading, null);
|
15884
15989
|
}
|
15885
15990
|
console.log("data", data);
|
15886
|
-
var companyName = {};
|
15887
15991
|
if (data && Object.keys(data)[0] !== "ownership") {
|
15888
|
-
for (
|
15889
|
-
|
15890
|
-
|
15891
|
-
}
|
15992
|
+
// for (const company of data!?.company) {
|
15993
|
+
// companyName[company?.companyId] = company;
|
15994
|
+
// }
|
15892
15995
|
if (!data.proponentPercentage) {
|
15893
15996
|
data.proponentPercentage = [100];
|
15894
15997
|
}
|
15895
15998
|
}
|
15896
15999
|
var nextOne = function (val) {
|
16000
|
+
console.log("step 1 values", val);
|
16001
|
+
if (val.typeCreation == exports.InvestmentCreationType.EXISTING) {
|
16002
|
+
val.toCompanyId = investmentData.toCompanyId;
|
16003
|
+
}
|
15897
16004
|
setCurrent(current + 1);
|
15898
16005
|
setStepOneData(val);
|
15899
16006
|
if (data === null || data === void 0 ? void 0 : data.programmeId)
|
15900
16007
|
setSelectedProgramme(data.programmeId);
|
16008
|
+
if (prevInvestor && prevInvestor != val.toCompanyId && !(data === null || data === void 0 ? void 0 : data.programmeId)) {
|
16009
|
+
formTwo.resetFields();
|
16010
|
+
setCurrentPercTotal(0);
|
16011
|
+
setProjectData(undefined);
|
16012
|
+
}
|
15901
16013
|
};
|
15902
16014
|
var prevOne = function () {
|
15903
16015
|
setCurrent(current - 1);
|
16016
|
+
setPrevInvestor(stepOneData.toCompanyId);
|
16017
|
+
// formTwo.resetFields();
|
16018
|
+
// setCurrentPercTotal(0);
|
16019
|
+
// setProjectData(undefined);
|
15904
16020
|
};
|
15905
16021
|
var submitInvestment = function (val) { return __awaiter(void 0, void 0, void 0, function () {
|
15906
|
-
var payload, response,
|
16022
|
+
var payload, response, error_6;
|
15907
16023
|
return __generator(this, function (_a) {
|
15908
16024
|
switch (_a.label) {
|
15909
16025
|
case 0:
|
15910
16026
|
console.log(val);
|
15911
16027
|
console.log(stepOneData);
|
16028
|
+
console.log("OwnershipType", investmentOwnershipType);
|
15912
16029
|
setLoading(true);
|
15913
16030
|
payload = stepOneData;
|
15914
|
-
payload.programmeId = data.programmeId;
|
15915
16031
|
payload.amount = parseFloat(payload.amount);
|
15916
16032
|
if (payload.interestRate) {
|
15917
16033
|
payload.interestRate = parseFloat(payload.interestRate);
|
@@ -15919,15 +16035,27 @@ var InvestmentCreationComponent = function (props) {
|
|
15919
16035
|
if (payload.paymentPerMetric) {
|
15920
16036
|
payload.paymentPerMetric = parseFloat(payload.paymentPerMetric);
|
15921
16037
|
}
|
15922
|
-
payload.fromCompanyIds = data.companyId.map(function (e) { return Number(e); });
|
15923
|
-
payload.percentage = val.percentage;
|
15924
16038
|
payload.toCompanyId = Number(payload.toCompanyId);
|
15925
16039
|
_a.label = 1;
|
15926
16040
|
case 1:
|
15927
|
-
_a.trys.push([1,
|
16041
|
+
_a.trys.push([1, 6, 7, 8]);
|
16042
|
+
response = void 0;
|
16043
|
+
if (!(investmentOwnershipType == exports.InvestmentOwnershipType.PROJECT)) return [3 /*break*/, 3];
|
16044
|
+
if (typeCreation == exports.InvestmentCreationType.EXISTING) {
|
16045
|
+
payload.nationalInvestmentId = investmentData.requestId;
|
16046
|
+
}
|
16047
|
+
payload.programmeId = projectData === null || projectData === void 0 ? void 0 : projectData.programmeId;
|
16048
|
+
payload.fromCompanyIds = projectData === null || projectData === void 0 ? void 0 : projectData.companyId.map(function (e) { return Number(e); });
|
16049
|
+
payload.percentage = val.percentage;
|
15928
16050
|
return [4 /*yield*/, post("national/programme/addInvestment", payload)];
|
15929
16051
|
case 2:
|
15930
16052
|
response = _a.sent();
|
16053
|
+
return [3 /*break*/, 5];
|
16054
|
+
case 3: return [4 /*yield*/, post("national/organisation/addInvestment", payload)];
|
16055
|
+
case 4:
|
16056
|
+
response = _a.sent();
|
16057
|
+
_a.label = 5;
|
16058
|
+
case 5:
|
15931
16059
|
console.log("investment creation -> ", response);
|
15932
16060
|
if ((response === null || response === void 0 ? void 0 : response.statusText) === "SUCCESS") {
|
15933
16061
|
antd.message.open({
|
@@ -15937,22 +16065,24 @@ var InvestmentCreationComponent = function (props) {
|
|
15937
16065
|
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
15938
16066
|
});
|
15939
16067
|
}
|
15940
|
-
|
15941
|
-
|
15942
|
-
|
15943
|
-
|
15944
|
-
|
16068
|
+
(data === null || data === void 0 ? void 0 : data.programmeId)
|
16069
|
+
? onNavigateToProgrammeView(data === null || data === void 0 ? void 0 : data.programmeId)
|
16070
|
+
: onNavigateToInvestmentManagementView();
|
16071
|
+
return [3 /*break*/, 8];
|
16072
|
+
case 6:
|
16073
|
+
error_6 = _a.sent();
|
16074
|
+
console.log("Error in investment creation - ", error_6);
|
15945
16075
|
antd.message.open({
|
15946
16076
|
type: "error",
|
15947
|
-
content:
|
16077
|
+
content: error_6 === null || error_6 === void 0 ? void 0 : error_6.message,
|
15948
16078
|
duration: 4,
|
15949
16079
|
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
15950
16080
|
});
|
15951
|
-
return [3 /*break*/,
|
15952
|
-
case
|
16081
|
+
return [3 /*break*/, 8];
|
16082
|
+
case 7:
|
15953
16083
|
setLoading(false);
|
15954
16084
|
return [7 /*endfinally*/];
|
15955
|
-
case
|
16085
|
+
case 8: return [2 /*return*/];
|
15956
16086
|
}
|
15957
16087
|
});
|
15958
16088
|
}); };
|
@@ -15966,6 +16096,10 @@ var InvestmentCreationComponent = function (props) {
|
|
15966
16096
|
var onChangeTypeCreation = function (e) {
|
15967
16097
|
console.log("radio checked", e.target.value);
|
15968
16098
|
setTypeCreation(e.target.value);
|
16099
|
+
formOne.resetFields();
|
16100
|
+
formTwo.resetFields();
|
16101
|
+
setCurrentPercTotal(0);
|
16102
|
+
setProjectData(undefined);
|
15969
16103
|
};
|
15970
16104
|
var onChangeInvestmentOwnershipType = function (e) {
|
15971
16105
|
console.log("investment ownership type radio checked", e.target.value);
|
@@ -16004,7 +16138,18 @@ var InvestmentCreationComponent = function (props) {
|
|
16004
16138
|
message: "".concat(t("programme:investorName"), " ").concat(t("isRequired")),
|
16005
16139
|
},
|
16006
16140
|
] },
|
16007
|
-
React.createElement(antd.Select, { size: "large", loading: loadingList }, organisationsList.map(function (organisation) {
|
16141
|
+
React.createElement(antd.Select, { size: "large", loading: loadingList }, organisationsList.map(function (organisation) {
|
16142
|
+
if (data === null || data === void 0 ? void 0 : data.programmeId) {
|
16143
|
+
if (data.companyId
|
16144
|
+
.map(function (id) { return Number(id); })
|
16145
|
+
.includes(Number(organisation.companyId))) {
|
16146
|
+
return (React.createElement(antd.Select.Option, { key: organisation.companyId, value: organisation.companyId }, organisation.name));
|
16147
|
+
}
|
16148
|
+
}
|
16149
|
+
else {
|
16150
|
+
return (React.createElement(antd.Select.Option, { key: organisation.companyId, value: organisation.companyId }, organisation.name));
|
16151
|
+
}
|
16152
|
+
}))))),
|
16008
16153
|
React.createElement(antd.Col, { xl: 12, md: 24 },
|
16009
16154
|
React.createElement("div", { className: "details-part-two" },
|
16010
16155
|
React.createElement(antd.Form.Item, { label: t("programme:amountInvested"), name: "amount", rules: [
|
@@ -16203,7 +16348,7 @@ var InvestmentCreationComponent = function (props) {
|
|
16203
16348
|
message: "".concat(t("programme:existingInvestmentSource"), " ").concat(t("isRequired")),
|
16204
16349
|
},
|
16205
16350
|
] },
|
16206
|
-
React.createElement(antd.Select, { size: "large", loading:
|
16351
|
+
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)); })))))),
|
16207
16352
|
React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
|
16208
16353
|
React.createElement(antd.Col, { xl: 12, md: 24 },
|
16209
16354
|
React.createElement("div", { className: "details-part-two" },
|
@@ -16232,6 +16377,21 @@ var InvestmentCreationComponent = function (props) {
|
|
16232
16377
|
});
|
16233
16378
|
}); },
|
16234
16379
|
},
|
16380
|
+
function (_a) {
|
16381
|
+
var getFieldValue = _a.getFieldValue;
|
16382
|
+
return ({
|
16383
|
+
validator: function (rule, v) {
|
16384
|
+
if (getFieldValue("amount") &&
|
16385
|
+
investmentData &&
|
16386
|
+
investmentData.amount <
|
16387
|
+
parseFloat(getFieldValue("amount"))) {
|
16388
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
16389
|
+
return Promise.reject("Amount > Available");
|
16390
|
+
}
|
16391
|
+
return Promise.resolve();
|
16392
|
+
},
|
16393
|
+
});
|
16394
|
+
},
|
16235
16395
|
] },
|
16236
16396
|
React.createElement(antd.Input, { size: "large" })))),
|
16237
16397
|
React.createElement(antd.Col, { xl: 12, md: 24 },
|
@@ -16241,7 +16401,9 @@ var InvestmentCreationComponent = function (props) {
|
|
16241
16401
|
"/",
|
16242
16402
|
React.createElement(antd.InputNumber, { size: "large", width: "100%", formatter: function (value) {
|
16243
16403
|
return "$".concat(addCommSep(value));
|
16244
|
-
}, disabled: true
|
16404
|
+
}, disabled: true, value: investmentData
|
16405
|
+
? investmentData.amount
|
16406
|
+
: 0 })))))))),
|
16245
16407
|
React.createElement(antd.Form.Item, null,
|
16246
16408
|
React.createElement("div", { className: "steps-actions" },
|
16247
16409
|
React.createElement(antd.Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: nextOne }, t("programme:next")))))))),
|
@@ -16272,105 +16434,141 @@ var InvestmentCreationComponent = function (props) {
|
|
16272
16434
|
exports.InvestmentOwnershipType.NATIONAL &&
|
16273
16435
|
(data === null || data === void 0 ? void 0 : data.programmeId))) {
|
16274
16436
|
return (React.createElement("div", { className: "condition-radio-container" },
|
16275
|
-
React.createElement(antd.
|
16437
|
+
React.createElement(antd.Tooltip, { title: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ==
|
16276
16438
|
exports.CompanyRole.PROGRAMME_DEVELOPER &&
|
16277
16439
|
stepOneData.toCompanyId !=
|
16278
16440
|
userInfoState.companyId &&
|
16279
16441
|
k ==
|
16280
|
-
exports.InvestmentOwnershipType.NATIONAL
|
16442
|
+
exports.InvestmentOwnershipType.NATIONAL
|
16443
|
+
? "This action is unauthorized due to the selected investor name."
|
16444
|
+
: "", color: TooltipColor, key: TooltipColor },
|
16445
|
+
React.createElement(antd.Radio.Button, { className: "condition-radio", value: k, onChange: onChangeInvestmentOwnershipType, disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ==
|
16446
|
+
exports.CompanyRole.PROGRAMME_DEVELOPER &&
|
16447
|
+
stepOneData.toCompanyId !=
|
16448
|
+
userInfoState.companyId &&
|
16449
|
+
k ==
|
16450
|
+
exports.InvestmentOwnershipType.NATIONAL }, t("programme:" + k)))));
|
16281
16451
|
}
|
16282
16452
|
})))))))),
|
16283
|
-
React.createElement("div", { className: "programme-sought-form-container ownership-container" },
|
16284
|
-
React.createElement(
|
16285
|
-
|
16286
|
-
|
16287
|
-
|
16288
|
-
|
16289
|
-
|
16290
|
-
|
16291
|
-
|
16292
|
-
|
16293
|
-
|
16294
|
-
|
16295
|
-
|
16296
|
-
|
16297
|
-
|
16298
|
-
|
16299
|
-
|
16300
|
-
|
16301
|
-
|
16302
|
-
|
16303
|
-
|
16304
|
-
|
16305
|
-
|
16306
|
-
|
16307
|
-
|
16308
|
-
|
16309
|
-
|
16310
|
-
|
16311
|
-
|
16312
|
-
|
16313
|
-
|
16314
|
-
|
16315
|
-
|
16316
|
-
|
16317
|
-
|
16318
|
-
|
16319
|
-
|
16320
|
-
|
16321
|
-
|
16322
|
-
|
16323
|
-
|
16324
|
-
|
16325
|
-
|
16326
|
-
|
16327
|
-
|
16328
|
-
|
16453
|
+
React.createElement("div", { className: "programme-sought-form-container ownership-container" },
|
16454
|
+
React.createElement("div", { className: "programme-sought-form" },
|
16455
|
+
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 },
|
16456
|
+
allProjectData.length > 0 &&
|
16457
|
+
investmentOwnershipType ==
|
16458
|
+
exports.InvestmentOwnershipType.PROJECT && (React.createElement("div", null,
|
16459
|
+
React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
|
16460
|
+
React.createElement(antd.Col, { xl: 12, md: 24 },
|
16461
|
+
React.createElement("div", { className: "details-part-one" },
|
16462
|
+
React.createElement(antd.Form.Item, { label: t("programme:title"), name: "projectId", wrapperCol: { span: 24 }, initialValue: allProjectData.length == 1
|
16463
|
+
? allProjectData[0].programmeId
|
16464
|
+
: null, rules: [
|
16465
|
+
{
|
16466
|
+
required: true,
|
16467
|
+
message: "".concat(t("programme:title"), " ").concat(t("isRequired")),
|
16468
|
+
},
|
16469
|
+
] },
|
16470
|
+
React.createElement(antd.Select, { size: "large", loading: loadingProgData,
|
16471
|
+
// defaultValue={
|
16472
|
+
// allProjectData.length == 1
|
16473
|
+
// ? allProjectData[0].programmeId
|
16474
|
+
// : null
|
16475
|
+
// }
|
16476
|
+
disabled: allProjectData.length == 1 &&
|
16477
|
+
(data === null || data === void 0 ? void 0 : data.programmeId) != undefined, onChange: setSelectedProgramme }, allProjectData.map(function (project) {
|
16478
|
+
if ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ==
|
16479
|
+
exports.CompanyRole.PROGRAMME_DEVELOPER &&
|
16480
|
+
Number(stepOneData.toCompanyId) !=
|
16481
|
+
userInfoState.companyId) {
|
16482
|
+
if (project.companyId
|
16483
|
+
.map(function (id) { return Number(id); })
|
16484
|
+
.includes(userInfoState.companyId)) {
|
16485
|
+
return (React.createElement(antd.Select.Option, { key: project.programmeId, value: project.programmeId }, project.title));
|
16486
|
+
}
|
16487
|
+
}
|
16488
|
+
else if ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) ===
|
16489
|
+
exports.CompanyRole.MINISTRY) {
|
16490
|
+
if (ministrySectoralScope.includes(project.sectoralScope)) {
|
16491
|
+
return (React.createElement(antd.Select.Option, { key: project.programmeId, value: project.programmeId }, project.title));
|
16492
|
+
}
|
16493
|
+
}
|
16494
|
+
else {
|
16495
|
+
return (React.createElement(antd.Select.Option, { key: project.programmeId, value: project.programmeId }, project.title));
|
16496
|
+
}
|
16497
|
+
})))))), projectData === null || projectData === void 0 ? void 0 :
|
16498
|
+
projectData.companyId.map(function (companyId, index) {
|
16499
|
+
if (formTwo.getFieldValue("percentage") &&
|
16500
|
+
formTwo.getFieldValue("percentage")[index] &&
|
16501
|
+
companyId == stepOneData.toCompanyId) {
|
16502
|
+
formTwo.getFieldValue("percentage")[index] = 0;
|
16503
|
+
}
|
16504
|
+
return (React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
|
16505
|
+
React.createElement(antd.Col, { xl: 8, md: 15 },
|
16506
|
+
React.createElement("div", { className: "label" },
|
16507
|
+
companyNames[Number(companyId)],
|
16508
|
+
React.createElement("span", { className: "required-mark" }, "*"))),
|
16509
|
+
React.createElement(antd.Col, { xl: 8, md: 9 },
|
16510
|
+
React.createElement(antd.Form.Item, { className: "inline", name: ["percentage", index], initialValue: 0, rules: [
|
16511
|
+
{
|
16512
|
+
pattern: new RegExp(/^[+]?([.]\d+|\d+[.]?\d*)$/g),
|
16513
|
+
message: "Percentage Should be a positive number",
|
16514
|
+
},
|
16515
|
+
{
|
16516
|
+
required: true,
|
16517
|
+
message: "Required field",
|
16518
|
+
},
|
16519
|
+
function (_a) {
|
16520
|
+
var getFieldValue = _a.getFieldValue;
|
16521
|
+
return ({
|
16522
|
+
validator: function (rule, v) {
|
16523
|
+
if (getFieldValue([
|
16329
16524
|
"percentage",
|
16330
16525
|
index,
|
16331
|
-
])
|
16332
|
-
|
16333
|
-
|
16334
|
-
|
16335
|
-
|
16336
|
-
|
16337
|
-
|
16338
|
-
|
16339
|
-
|
16340
|
-
|
16341
|
-
|
16342
|
-
|
16343
|
-
|
16344
|
-
|
16345
|
-
|
16346
|
-
|
16347
|
-
|
16348
|
-
|
16526
|
+
]) &&
|
16527
|
+
parseFloat(getFieldValue([
|
16528
|
+
"percentage",
|
16529
|
+
index,
|
16530
|
+
])) >
|
16531
|
+
projectData
|
16532
|
+
.proponentPercentage[index]) {
|
16533
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
16534
|
+
return Promise.reject("Amount > Available");
|
16535
|
+
}
|
16536
|
+
return Promise.resolve();
|
16537
|
+
},
|
16538
|
+
});
|
16539
|
+
},
|
16540
|
+
] },
|
16541
|
+
React.createElement(antd.InputNumber, { placeholder: "", controls: false, disabled: govData.companyId ==
|
16542
|
+
companyId ||
|
16543
|
+
companyId ==
|
16544
|
+
stepOneData.toCompanyId, value: 0,
|
16545
|
+
// disabled={userInfoState?.companyId === Number(companyId)}
|
16546
|
+
onKeyPress: function (event) {
|
16547
|
+
if (!/[0-9\.]/.test(event.key)) {
|
16548
|
+
event.preventDefault();
|
16549
|
+
}
|
16550
|
+
} })),
|
16551
|
+
React.createElement("div", { className: "inline separator" }, "/"),
|
16552
|
+
React.createElement(antd.Form.Item, { className: "inline" },
|
16553
|
+
React.createElement(antd.InputNumber, { placeholder: String(projectData === null || projectData === void 0 ? void 0 : projectData.proponentPercentage[index]), disabled: true })))));
|
16554
|
+
}),
|
16555
|
+
React.createElement(antd.Row, { className: "row", gutter: [16, 16] },
|
16556
|
+
React.createElement(antd.Col, { xl: 8, md: 15 },
|
16557
|
+
React.createElement("div", { className: "label" }, t("programme:total"))),
|
16558
|
+
React.createElement(antd.Col, { xl: 8, md: 9 },
|
16559
|
+
React.createElement(antd.Form.Item, { className: "inline", name: ["total"] },
|
16560
|
+
React.createElement(antd.InputNumber, { placeholder: currentPercTotal + "", controls: false, disabled: true, onKeyPress: function (event) {
|
16349
16561
|
if (!/[0-9\.]/.test(event.key)) {
|
16350
16562
|
event.preventDefault();
|
16351
16563
|
}
|
16352
16564
|
} })),
|
16353
16565
|
React.createElement("div", { className: "inline separator" }, "/"),
|
16354
16566
|
React.createElement(antd.Form.Item, { className: "inline" },
|
16355
|
-
React.createElement(antd.InputNumber, {
|
16356
|
-
|
16357
|
-
|
16358
|
-
|
16359
|
-
React.createElement(
|
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) {
|
16363
|
-
if (!/[0-9\.]/.test(event.key)) {
|
16364
|
-
event.preventDefault();
|
16365
|
-
}
|
16366
|
-
} })),
|
16367
|
-
React.createElement("div", { className: "inline separator" }, "/"),
|
16368
|
-
React.createElement(antd.Form.Item, { className: "inline" },
|
16369
|
-
React.createElement(antd.InputNumber, { disabled: true, placeholder: "100" })))))),
|
16370
|
-
React.createElement(antd.Form.Item, null,
|
16371
|
-
React.createElement("div", { className: "steps-actions" },
|
16372
|
-
React.createElement(antd.Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: submitInvestment }, t("programme:submit")),
|
16373
|
-
React.createElement(antd.Button, { className: "back-btn", onClick: function () { return prevOne(); }, loading: loading }, t("programme:back")))))))))),
|
16567
|
+
React.createElement(antd.InputNumber, { disabled: true, placeholder: "100" })))))),
|
16568
|
+
React.createElement(antd.Form.Item, null,
|
16569
|
+
React.createElement("div", { className: "steps-actions" },
|
16570
|
+
React.createElement(antd.Button, { type: "primary", htmlType: "submit", loading: loading, onSubmit: submitInvestment }, t("programme:submit")),
|
16571
|
+
React.createElement(antd.Button, { className: "back-btn", onClick: function () { return prevOne(); }, loading: loading }, t("programme:back"))))))))),
|
16374
16572
|
},
|
16375
16573
|
] })))));
|
16376
16574
|
};
|
@@ -16819,7 +17017,10 @@ var InvestmentManagementComponent = function (props) {
|
|
16819
17017
|
sorter: true,
|
16820
17018
|
align: "left",
|
16821
17019
|
render: function (item) {
|
16822
|
-
|
17020
|
+
if (item) {
|
17021
|
+
return React.createElement("span", { className: "clickable" }, item);
|
17022
|
+
}
|
17023
|
+
return React.createElement("span", null, "-");
|
16823
17024
|
},
|
16824
17025
|
onCell: function (record, rowIndex) {
|
16825
17026
|
return {
|
@@ -16877,6 +17078,12 @@ var InvestmentManagementComponent = function (props) {
|
|
16877
17078
|
key: "programmeSector",
|
16878
17079
|
sorter: true,
|
16879
17080
|
align: "left",
|
17081
|
+
render: function (item) {
|
17082
|
+
if (item) {
|
17083
|
+
return React.createElement("span", null, item);
|
17084
|
+
}
|
17085
|
+
return React.createElement("span", null, "-");
|
17086
|
+
},
|
16880
17087
|
},
|
16881
17088
|
{
|
16882
17089
|
title: t("programme:investor"),
|
@@ -16960,7 +17167,11 @@ var InvestmentManagementComponent = function (props) {
|
|
16960
17167
|
React.createElement("div", { className: "title-bar" },
|
16961
17168
|
React.createElement("div", { className: "body-title" }, t("programme:investmentTitle")),
|
16962
17169
|
React.createElement("div", { className: "body-sub-title" }, t("programme:investmentDesc"))),
|
16963
|
-
React.createElement("div", { className: "actions" }, enableAddOwnership &&
|
17170
|
+
React.createElement("div", { className: "actions" }, enableAddOwnership &&
|
17171
|
+
((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) == exports.CompanyRole.MINISTRY ||
|
17172
|
+
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) == exports.CompanyRole.GOVERNMENT ||
|
17173
|
+
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) == exports.CompanyRole.PROGRAMME_DEVELOPER) &&
|
17174
|
+
userInfoState.userRole != exports.Role.ViewOnly && (React.createElement("div", { className: "action-bar" },
|
16964
17175
|
React.createElement(antd.Button, { type: "primary", size: "large", block: true, icon: React.createElement(icons.PlusOutlined, null), onClick: onClickAddOwnership }, t("programme:addOwnership")))))),
|
16965
17176
|
React.createElement("div", { className: "content-card" },
|
16966
17177
|
React.createElement(antd.Row, null,
|
@@ -17001,7 +17212,7 @@ var InvestmentManagementComponent = function (props) {
|
|
17001
17212
|
return handleTableChange(val, sorter);
|
17002
17213
|
}, locale: {
|
17003
17214
|
emptyText: (React.createElement(antd.Empty, { image: antd.Empty.PRESENTED_IMAGE_SIMPLE, description: tableData.length === 0
|
17004
|
-
? t("
|
17215
|
+
? t("programme:noInvestmentData")
|
17005
17216
|
: null })),
|
17006
17217
|
} }))))),
|
17007
17218
|
popupInfo && selectedReq && (React.createElement(InvestmentActionModel, { investment: selectedReq, onCancel: function () {
|