@undp/carbon-library 1.0.95 → 1.0.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +82 -91
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/Components/Common/ProgrammeDocuments/programmeDocuments.d.ts +1 -0
- package/dist/cjs/types/Utils/DocumentValidator.d.ts +1 -0
- package/dist/esm/index.js +82 -91
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/Components/Common/ProgrammeDocuments/programmeDocuments.d.ts +1 -0
- package/dist/esm/types/Utils/DocumentValidator.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
@@ -4789,7 +4789,7 @@ var AddNewCompanyComponent = function (props) {
|
|
4789
4789
|
setCompanyRole(value);
|
4790
4790
|
};
|
4791
4791
|
var CompanyDetailsForm = function () {
|
4792
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
4792
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
4793
4793
|
var companyRoleClassName = companyRole === exports.CompanyRole.CERTIFIER
|
4794
4794
|
? "certifier"
|
4795
4795
|
: companyRole === exports.CompanyRole.PROGRAMME_DEVELOPER
|
@@ -4847,7 +4847,27 @@ var AddNewCompanyComponent = function (props) {
|
|
4847
4847
|
] },
|
4848
4848
|
React.createElement(antd.Input, { size: "large" })))
|
4849
4849
|
: null,
|
4850
|
-
React.createElement(antd.Form.Item, { label: "
|
4850
|
+
React.createElement(antd.Form.Item, { label: "Registration Payment ID", initialValue: (_c = state === null || state === void 0 ? void 0 : state.record) === null || _c === void 0 ? void 0 : _c.paymentId, name: "paymentId", rules: [
|
4851
|
+
{
|
4852
|
+
required: true,
|
4853
|
+
message: "",
|
4854
|
+
},
|
4855
|
+
{
|
4856
|
+
validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
|
4857
|
+
return __generator(this, function (_a) {
|
4858
|
+
if (String(value).trim() === "" ||
|
4859
|
+
String(value).trim() === undefined ||
|
4860
|
+
value === null ||
|
4861
|
+
value === undefined) {
|
4862
|
+
throw new Error("Registration Payment ID ".concat(t("isRequired")));
|
4863
|
+
}
|
4864
|
+
return [2 /*return*/];
|
4865
|
+
});
|
4866
|
+
}); },
|
4867
|
+
},
|
4868
|
+
] },
|
4869
|
+
React.createElement(antd.Input, { size: "large" })),
|
4870
|
+
React.createElement(antd.Form.Item, { label: "Email", name: "email", initialValue: (_d = state === null || state === void 0 ? void 0 : state.record) === null || _d === void 0 ? void 0 : _d.email, rules: [
|
4851
4871
|
{
|
4852
4872
|
required: true,
|
4853
4873
|
message: "",
|
@@ -4878,7 +4898,7 @@ var AddNewCompanyComponent = function (props) {
|
|
4878
4898
|
},
|
4879
4899
|
] },
|
4880
4900
|
React.createElement(antd.Input, { size: "large" })),
|
4881
|
-
React.createElement(antd.Form.Item, { className: "website", label: "Website", initialValue: (
|
4901
|
+
React.createElement(antd.Form.Item, { className: "website", label: "Website", initialValue: (_f = (_e = state === null || state === void 0 ? void 0 : state.record) === null || _e === void 0 ? void 0 : _e.website) === null || _f === void 0 ? void 0 : _f.split("://")[1], name: "website", rules: [
|
4882
4902
|
{
|
4883
4903
|
required: false,
|
4884
4904
|
validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
|
@@ -4939,7 +4959,7 @@ var AddNewCompanyComponent = function (props) {
|
|
4939
4959
|
return false;
|
4940
4960
|
}, className: "logo-upload-section", name: "logo", action: "/upload.do", listType: "picture", multiple: false, defaultFileList: fileList, maxCount: 1 },
|
4941
4961
|
React.createElement(antd.Button, { size: "large", icon: React.createElement(icons.UploadOutlined, null) }, "Upload"))),
|
4942
|
-
companyRole === exports.CompanyRole.MINISTRY && (React.createElement(antd.Form.Item, { name: "address", label: "Address", initialValue: (
|
4962
|
+
companyRole === exports.CompanyRole.MINISTRY && (React.createElement(antd.Form.Item, { name: "address", label: "Address", initialValue: (_g = state === null || state === void 0 ? void 0 : state.record) === null || _g === void 0 ? void 0 : _g.address, rules: [
|
4943
4963
|
{ required: true, message: "" },
|
4944
4964
|
{
|
4945
4965
|
validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
|
@@ -4995,7 +5015,7 @@ var AddNewCompanyComponent = function (props) {
|
|
4995
5015
|
React.createElement(antd.Radio.Button, { className: "minister", value: "Ministry" },
|
4996
5016
|
React.createElement(icons.AuditOutlined, { className: "role-icons" }),
|
4997
5017
|
"Ministry")))))))),
|
4998
|
-
companyRole === exports.CompanyRole.MINISTRY && (React.createElement(antd.Form.Item, { label: "Name of the Minister", name: "nameOfMinister", initialValue: (
|
5018
|
+
companyRole === exports.CompanyRole.MINISTRY && (React.createElement(antd.Form.Item, { label: "Name of the Minister", name: "nameOfMinister", initialValue: (_h = state === null || state === void 0 ? void 0 : state.record) === null || _h === void 0 ? void 0 : _h.nameOfMinister, rules: [
|
4999
5019
|
{
|
5000
5020
|
required: true,
|
5001
5021
|
message: "",
|
@@ -5020,12 +5040,12 @@ var AddNewCompanyComponent = function (props) {
|
|
5020
5040
|
required: true,
|
5021
5041
|
message: "Sectoral Scope ".concat(t("isRequired")),
|
5022
5042
|
},
|
5023
|
-
], initialValue: (
|
5043
|
+
], initialValue: (_j = state === null || state === void 0 ? void 0 : state.record) === null || _j === void 0 ? void 0 : _j.sectoralScope },
|
5024
5044
|
React.createElement(antd.Select, { mode: "multiple", size: "large", maxTagCount: 2, allowClear: true }, Object.entries(exports.SectoralScope).map(function (_a) {
|
5025
5045
|
var key = _a[0], value = _a[1];
|
5026
5046
|
return (React.createElement(antd.Select.Option, { key: value, value: value }, key));
|
5027
5047
|
})))),
|
5028
|
-
React.createElement(antd.Form.Item, { name: "phoneNo", label: "Phone Number", initialValue: (
|
5048
|
+
React.createElement(antd.Form.Item, { name: "phoneNo", label: "Phone Number", initialValue: (_k = state === null || state === void 0 ? void 0 : state.record) === null || _k === void 0 ? void 0 : _k.phoneNo, rules: [
|
5029
5049
|
{
|
5030
5050
|
required: true,
|
5031
5051
|
message: "",
|
@@ -5056,14 +5076,14 @@ var AddNewCompanyComponent = function (props) {
|
|
5056
5076
|
},
|
5057
5077
|
] },
|
5058
5078
|
React.createElement(PhoneInput, { placeholder: "Phone number", international: true, value: PhoneInput.formatPhoneNumberIntl(contactNoInput), defaultCountry: "LK", countryCallingCodeEditable: false, onChange: function (v) { }, countries: countries })),
|
5059
|
-
regionField && (React.createElement(antd.Form.Item, { label: t("region"), name: "regions", initialValue: (
|
5079
|
+
regionField && (React.createElement(antd.Form.Item, { label: t("region"), name: "regions", initialValue: (_l = state === null || state === void 0 ? void 0 : state.record) === null || _l === void 0 ? void 0 : _l.regions, rules: [
|
5060
5080
|
{
|
5061
5081
|
required: true,
|
5062
5082
|
message: "".concat(t("region"), " ").concat(t("isRequired")),
|
5063
5083
|
},
|
5064
5084
|
] },
|
5065
5085
|
React.createElement(antd.Select, { mode: "multiple", size: "large", maxTagCount: 2, onChange: onChangeRegion, loading: loadingList, allowClear: true }, regionsList.map(function (region) { return (React.createElement(antd.Select.Option, { value: region }, region)); })))),
|
5066
|
-
companyRole !== exports.CompanyRole.MINISTRY && (React.createElement(antd.Form.Item, { name: "address", label: "Address", initialValue: (
|
5086
|
+
companyRole !== exports.CompanyRole.MINISTRY && (React.createElement(antd.Form.Item, { name: "address", label: "Address", initialValue: (_m = state === null || state === void 0 ? void 0 : state.record) === null || _m === void 0 ? void 0 : _m.address, rules: [
|
5067
5087
|
{ required: true, message: "" },
|
5068
5088
|
{
|
5069
5089
|
validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
|
@@ -5410,6 +5430,9 @@ var CompanyProfileComponent = function (props) {
|
|
5410
5430
|
React.createElement(antd.Row, { className: "field" },
|
5411
5431
|
React.createElement(antd.Col, { span: 12, className: "field-key" }, t("companyProfile:taxId")),
|
5412
5432
|
React.createElement(antd.Col, { span: 12, className: "field-value nextline-overflow" }, companyDetails.taxId ? companyDetails.taxId : "-")),
|
5433
|
+
React.createElement(antd.Row, { className: "field" },
|
5434
|
+
React.createElement(antd.Col, { span: 12, className: "field-key" }, t("companyProfile:paymentId")),
|
5435
|
+
React.createElement(antd.Col, { span: 12, className: "field-value nextline-overflow" }, companyDetails.paymentId ? companyDetails.paymentId : "-")),
|
5413
5436
|
React.createElement(antd.Row, { className: "field" },
|
5414
5437
|
React.createElement(antd.Col, { span: 12, className: "field-key" }, t("companyProfile:companyRole")),
|
5415
5438
|
React.createElement(antd.Col, { span: 12, className: "field-value" },
|
@@ -11591,6 +11614,21 @@ var moment$1 = {exports: {}};
|
|
11591
11614
|
var momentExports = moment$1.exports;
|
11592
11615
|
var moment = /*@__PURE__*/getDefaultExportFromCjs(momentExports);
|
11593
11616
|
|
11617
|
+
var allowedFileTypes = [
|
11618
|
+
"application/pdf",
|
11619
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
11620
|
+
"application/vnd.ms-powerpoint",
|
11621
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
11622
|
+
"application/msword",
|
11623
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
11624
|
+
"text/csv",
|
11625
|
+
"image/png",
|
11626
|
+
"image/jpeg"
|
11627
|
+
];
|
11628
|
+
var isValidateFileType = function (fileType) {
|
11629
|
+
return allowedFileTypes.includes(fileType);
|
11630
|
+
};
|
11631
|
+
|
11594
11632
|
var maximumImageSize = process.env.REACT_APP_MAXIMUM_FILE_SIZE
|
11595
11633
|
? parseInt(process.env.REACT_APP_MAXIMUM_FILE_SIZE)
|
11596
11634
|
: 5000000;
|
@@ -11877,7 +11915,7 @@ var ProgrammeCreationComponent = function (props) {
|
|
11877
11915
|
setCurrent(current - 1);
|
11878
11916
|
};
|
11879
11917
|
var onFinishStepOne = function (values) { return __awaiter(void 0, void 0, void 0, function () {
|
11880
|
-
var programmeDetails, ownershipPercentage, totalPercentage, proponentPercentages, proponentTxIds, logoBase64,
|
11918
|
+
var programmeDetails, ownershipPercentage, totalPercentage, proponentPercentages, proponentTxIds, logoBase64, propTaxIds, duplicateIds;
|
11881
11919
|
var _a, _b;
|
11882
11920
|
return __generator(this, function (_c) {
|
11883
11921
|
switch (_c.label) {
|
@@ -11891,12 +11929,10 @@ var ProgrammeCreationComponent = function (props) {
|
|
11891
11929
|
? ownershipPercentage === null || ownershipPercentage === void 0 ? void 0 : ownershipPercentage.slice(1).map(function (item) { return item.organisation; })
|
11892
11930
|
: ownershipPercentage === null || ownershipPercentage === void 0 ? void 0 : ownershipPercentage.map(function (item) { return item.organisation; });
|
11893
11931
|
logoBase64 = "";
|
11894
|
-
logoUrls = [];
|
11895
11932
|
if (!(((_a = values === null || values === void 0 ? void 0 : values.designDocument) === null || _a === void 0 ? void 0 : _a.length) > 0)) return [3 /*break*/, 2];
|
11896
11933
|
return [4 /*yield*/, getBase64((_b = values === null || values === void 0 ? void 0 : values.designDocument[0]) === null || _b === void 0 ? void 0 : _b.originFileObj)];
|
11897
11934
|
case 1:
|
11898
11935
|
logoBase64 = _c.sent();
|
11899
|
-
logoUrls = logoBase64 === null || logoBase64 === void 0 ? void 0 : logoBase64.split(",");
|
11900
11936
|
_c.label = 2;
|
11901
11937
|
case 2:
|
11902
11938
|
propTaxIds = (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) !== exports.CompanyRole.GOVERNMENT &&
|
@@ -11939,8 +11975,8 @@ var ProgrammeCreationComponent = function (props) {
|
|
11939
11975
|
})), (includedInNDC !== undefined &&
|
11940
11976
|
includedInNDC !== null && { includedInNdc: includedInNDC })),
|
11941
11977
|
};
|
11942
|
-
if ((
|
11943
|
-
programmeDetails.designDocument =
|
11978
|
+
if ((logoBase64 === null || logoBase64 === void 0 ? void 0 : logoBase64.length) > 0) {
|
11979
|
+
programmeDetails.designDocument = logoBase64;
|
11944
11980
|
}
|
11945
11981
|
setLoading(false);
|
11946
11982
|
console.log(programmeDetails);
|
@@ -12219,15 +12255,10 @@ var ProgrammeCreationComponent = function (props) {
|
|
12219
12255
|
},
|
12220
12256
|
{
|
12221
12257
|
validator: function (rule, file) { return __awaiter(void 0, void 0, void 0, function () {
|
12222
|
-
var isCorrectFormat;
|
12223
12258
|
var _a, _b;
|
12224
12259
|
return __generator(this, function (_c) {
|
12225
12260
|
if ((file === null || file === void 0 ? void 0 : file.length) > 0) {
|
12226
|
-
|
12227
|
-
if (((_a = file[0]) === null || _a === void 0 ? void 0 : _a.type) === "application/pdf") {
|
12228
|
-
isCorrectFormat = true;
|
12229
|
-
}
|
12230
|
-
if (!isCorrectFormat) {
|
12261
|
+
if (!isValidateFileType((_a = file[0]) === null || _a === void 0 ? void 0 : _a.type)) {
|
12231
12262
|
throw new Error("".concat(t("addProgramme:invalidFileFormat")));
|
12232
12263
|
}
|
12233
12264
|
else if (((_b = file[0]) === null || _b === void 0 ? void 0 : _b.size) > maximumImageSize) {
|
@@ -12240,7 +12271,7 @@ var ProgrammeCreationComponent = function (props) {
|
|
12240
12271
|
}); },
|
12241
12272
|
},
|
12242
12273
|
] },
|
12243
|
-
React.createElement(antd.Upload, { accept: ".pdf", beforeUpload: function (file) {
|
12274
|
+
React.createElement(antd.Upload, { accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", beforeUpload: function (file) {
|
12244
12275
|
return false;
|
12245
12276
|
}, className: "design-upload-section", name: "design", action: "/upload.do", listType: "picture", multiple: false,
|
12246
12277
|
// defaultFileList={fileList}
|
@@ -12544,7 +12575,6 @@ var ChangePasswordModel = function (props) {
|
|
12544
12575
|
React.createElement(antd.Button, { className: "mg-left-2", type: "primary", htmlType: "submit", loading: loadingBtn }, t("passwordReset:setPassword"))))));
|
12545
12576
|
};
|
12546
12577
|
|
12547
|
-
antd.Select.Option;
|
12548
12578
|
var AddNewUserComponent = function (props) {
|
12549
12579
|
var _a, _b, _c, _d, _e, _f;
|
12550
12580
|
var t = props.t, onNavigateToUserManagement = props.onNavigateToUserManagement, onNavigateLogin = props.onNavigateLogin, useConnection = props.useConnection, useUserContext = props.useUserContext, useLocation = props.useLocation, useAbilityContext = props.useAbilityContext, themeColor = props.themeColor;
|
@@ -15321,7 +15351,7 @@ var NdcActionDetails = function (props) {
|
|
15321
15351
|
calculateMethodologyEstimatedCredits();
|
15322
15352
|
};
|
15323
15353
|
var onNdcActionDetailsFormSubmit = function (ndcActionFormvalues) { return __awaiter(void 0, void 0, void 0, function () {
|
15324
|
-
var ndcActionDetailObj, enablementReport
|
15354
|
+
var ndcActionDetailObj, enablementReport;
|
15325
15355
|
var _a;
|
15326
15356
|
return __generator(this, function (_b) {
|
15327
15357
|
switch (_b.label) {
|
@@ -15406,9 +15436,7 @@ var NdcActionDetails = function (props) {
|
|
15406
15436
|
return [4 /*yield*/, getBase64((_a = ndcActionFormvalues.EnablementReport[0]) === null || _a === void 0 ? void 0 : _a.originFileObj)];
|
15407
15437
|
case 1:
|
15408
15438
|
enablementReport = _b.sent();
|
15409
|
-
|
15410
|
-
ndcActionDetailObj.enablementProperties.report =
|
15411
|
-
enablementReportData[1];
|
15439
|
+
ndcActionDetailObj.enablementProperties.report = enablementReport;
|
15412
15440
|
_b.label = 2;
|
15413
15441
|
case 2:
|
15414
15442
|
ndcActionDetailObj.enablementReportData =
|
@@ -15724,15 +15752,10 @@ var NdcActionDetails = function (props) {
|
|
15724
15752
|
React.createElement(antd.Form.Item, { label: t("ndcAction:report"), name: "EnablementReport", valuePropName: "fileList", getValueFromEvent: normFile, required: false, rules: [
|
15725
15753
|
{
|
15726
15754
|
validator: function (rule, file) { return __awaiter(void 0, void 0, void 0, function () {
|
15727
|
-
var isCorrectFormat;
|
15728
15755
|
var _a, _b;
|
15729
15756
|
return __generator(this, function (_c) {
|
15730
|
-
isCorrectFormat = false;
|
15731
15757
|
if (file && file.length > 0) {
|
15732
|
-
if (((_a = file[0]) === null || _a === void 0 ? void 0 : _a.type)
|
15733
|
-
isCorrectFormat = true;
|
15734
|
-
}
|
15735
|
-
if (!isCorrectFormat) {
|
15758
|
+
if (!isValidateFileType((_a = file[0]) === null || _a === void 0 ? void 0 : _a.type)) {
|
15736
15759
|
throw new Error("".concat(t("ndcAction:invalidFileFormat")));
|
15737
15760
|
}
|
15738
15761
|
else if (((_b = file[0]) === null || _b === void 0 ? void 0 : _b.size) > maximumImageSize) {
|
@@ -15744,7 +15767,7 @@ var NdcActionDetails = function (props) {
|
|
15744
15767
|
}); },
|
15745
15768
|
},
|
15746
15769
|
] },
|
15747
|
-
React.createElement(antd.Upload, { accept: ".pdf", beforeUpload: function (file) {
|
15770
|
+
React.createElement(antd.Upload, { accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", beforeUpload: function (file) {
|
15748
15771
|
return false;
|
15749
15772
|
}, className: "design-upload-section", name: "design", listType: "picture", multiple: false, maxCount: 1 },
|
15750
15773
|
React.createElement(antd.Button, { className: "upload-doc", size: "large", icon: React.createElement(icons.UploadOutlined, null) }, "Upload")))))),
|
@@ -15995,8 +16018,9 @@ var Assessment = function (props) {
|
|
15995
16018
|
return [4 /*yield*/, getBase64(changedField.value[0].originFileObj)];
|
15996
16019
|
case 1:
|
15997
16020
|
base64Value = _a.sent();
|
15998
|
-
|
15999
|
-
|
16021
|
+
console.log("FEAsibility document : ", base64Value);
|
16022
|
+
values_1 = base64Value;
|
16023
|
+
setCobenefitsAssessmentDetails(function (pre) { return (__assign(__assign({}, pre), { document: values_1 })); });
|
16000
16024
|
return [3 /*break*/, 3];
|
16001
16025
|
case 2:
|
16002
16026
|
changedValues[changedField.name[0]] = changedField.value;
|
@@ -16234,15 +16258,10 @@ var Assessment = function (props) {
|
|
16234
16258
|
!viewOnly && (React.createElement(antd.Form.Item, { label: t("assessmentDocuments"), name: "document", valuePropName: "fileList", getValueFromEvent: normFile, required: false, rules: [
|
16235
16259
|
{
|
16236
16260
|
validator: function (rule, file) { return __awaiter(void 0, void 0, void 0, function () {
|
16237
|
-
var isCorrectFormat;
|
16238
16261
|
var _a, _b;
|
16239
16262
|
return __generator(this, function (_c) {
|
16240
16263
|
if ((file === null || file === void 0 ? void 0 : file.length) > 0) {
|
16241
|
-
|
16242
|
-
if (((_a = file[0]) === null || _a === void 0 ? void 0 : _a.type) === "application/pdf") {
|
16243
|
-
isCorrectFormat = true;
|
16244
|
-
}
|
16245
|
-
if (!isCorrectFormat) {
|
16264
|
+
if (!isValidateFileType((_a = file[0]) === null || _a === void 0 ? void 0 : _a.type)) {
|
16246
16265
|
throw new Error("".concat(t("invalidFileFormat")));
|
16247
16266
|
}
|
16248
16267
|
else if (((_b = file[0]) === null || _b === void 0 ? void 0 : _b.size) > maximumFileSize) {
|
@@ -16254,7 +16273,7 @@ var Assessment = function (props) {
|
|
16254
16273
|
}); },
|
16255
16274
|
},
|
16256
16275
|
] },
|
16257
|
-
React.createElement(antd.Upload, { accept: ".pdf", beforeUpload: function (file) {
|
16276
|
+
React.createElement(antd.Upload, { accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", beforeUpload: function (file) {
|
16258
16277
|
return false;
|
16259
16278
|
}, className: "design-upload-section", name: "document", listType: "picture", multiple: false, maxCount: 1 },
|
16260
16279
|
React.createElement(antd.Button, { className: "upload-doc", size: "large", icon: React.createElement(icons.UploadOutlined, null) }, "Upload")))),
|
@@ -18214,25 +18233,13 @@ var AddNdcActionComponent = function (props) {
|
|
18214
18233
|
React.createElement(antd.Form.Item, { label: t("ndcAction:monitoringReport"), name: "monitoringReport", valuePropName: "fileList", getValueFromEvent: normFile, required: false, rules: [
|
18215
18234
|
{
|
18216
18235
|
validator: function (rule, file) { return __awaiter(void 0, void 0, void 0, function () {
|
18217
|
-
var
|
18218
|
-
|
18219
|
-
return __generator(this, function (_e) {
|
18236
|
+
var _a, _b;
|
18237
|
+
return __generator(this, function (_c) {
|
18220
18238
|
if ((file === null || file === void 0 ? void 0 : file.length) > 0) {
|
18221
|
-
|
18222
|
-
if (((_a = file[0]) === null || _a === void 0 ? void 0 : _a.type) === "application/pdf") {
|
18223
|
-
isCorrectFormat = true;
|
18224
|
-
}
|
18225
|
-
else if (((_b = file[0]) === null || _b === void 0 ? void 0 : _b.type) ===
|
18226
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") {
|
18227
|
-
isCorrectFormat = true;
|
18228
|
-
}
|
18229
|
-
else if (((_c = file[0]) === null || _c === void 0 ? void 0 : _c.type) === "text/csv") {
|
18230
|
-
isCorrectFormat = true;
|
18231
|
-
}
|
18232
|
-
if (!isCorrectFormat) {
|
18239
|
+
if (!isValidateFileType((_a = file[0]) === null || _a === void 0 ? void 0 : _a.type)) {
|
18233
18240
|
throw new Error("".concat(t("ndcAction:invalidFileFormat")));
|
18234
18241
|
}
|
18235
|
-
else if (((
|
18242
|
+
else if (((_b = file[0]) === null || _b === void 0 ? void 0 : _b.size) > maximumImageSize) {
|
18236
18243
|
// default size format of files would be in bytes -> 1MB = 1000000bytes
|
18237
18244
|
throw new Error("".concat(t("common:maxSizeVal")));
|
18238
18245
|
}
|
@@ -23737,7 +23744,7 @@ var NdcActionBody = function (props) {
|
|
23737
23744
|
(_a = fileInputVerificationRef === null || fileInputVerificationRef === void 0 ? void 0 : fileInputVerificationRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
23738
23745
|
};
|
23739
23746
|
var onUploadDocument = function (file, type) { return __awaiter(void 0, void 0, void 0, function () {
|
23740
|
-
var logoBase64,
|
23747
|
+
var logoBase64, response;
|
23741
23748
|
return __generator(this, function (_a) {
|
23742
23749
|
switch (_a.label) {
|
23743
23750
|
case 0:
|
@@ -23754,22 +23761,13 @@ var NdcActionBody = function (props) {
|
|
23754
23761
|
return [4 /*yield*/, getBase64(file)];
|
23755
23762
|
case 1:
|
23756
23763
|
logoBase64 = _a.sent();
|
23757
|
-
imgData = logoBase64;
|
23758
|
-
if (type !== exports.DocType.MONITORING_REPORT) {
|
23759
|
-
logoUrls = logoBase64.split(",");
|
23760
|
-
imgData = logoUrls[1];
|
23761
|
-
}
|
23762
23764
|
_a.label = 2;
|
23763
23765
|
case 2:
|
23764
23766
|
_a.trys.push([2, 6, 7, 8]);
|
23765
|
-
if (!(
|
23766
|
-
(type === exports.DocType.MONITORING_REPORT &&
|
23767
|
-
((file === null || file === void 0 ? void 0 : file.type) ===
|
23768
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
|
23769
|
-
(file === null || file === void 0 ? void 0 : file.type) === "text/csv")))) return [3 /*break*/, 4];
|
23767
|
+
if (!isValidateFileType(file === null || file === void 0 ? void 0 : file.type)) return [3 /*break*/, 4];
|
23770
23768
|
return [4 /*yield*/, post("national/programme/addDocument", {
|
23771
23769
|
type: type,
|
23772
|
-
data:
|
23770
|
+
data: logoBase64,
|
23773
23771
|
programmeId: programmeId,
|
23774
23772
|
actionId: ndcActionId,
|
23775
23773
|
})];
|
@@ -23926,7 +23924,7 @@ var NdcActionBody = function (props) {
|
|
23926
23924
|
handleFileUploadMonitor();
|
23927
23925
|
}
|
23928
23926
|
} })),
|
23929
|
-
React.createElement("input", { type: "file", ref: fileInputMonitoringRef, style: { display: "none" }, accept: ".
|
23927
|
+
React.createElement("input", { type: "file", ref: fileInputMonitoringRef, style: { display: "none" }, accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", onChange: function (e) {
|
23930
23928
|
var selectedFile = e.target.files[0];
|
23931
23929
|
e.target.value = null;
|
23932
23930
|
onUploadDocument(selectedFile, exports.DocType.MONITORING_REPORT);
|
@@ -23950,7 +23948,7 @@ var NdcActionBody = function (props) {
|
|
23950
23948
|
handleFileUploadMonitor();
|
23951
23949
|
}
|
23952
23950
|
} })),
|
23953
|
-
React.createElement("input", { type: "file", ref: fileInputMonitoringRef, style: { display: "none" }, accept: ".
|
23951
|
+
React.createElement("input", { type: "file", ref: fileInputMonitoringRef, style: { display: "none" }, accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", onChange: function (e) {
|
23954
23952
|
var selectedFile = e.target.files[0];
|
23955
23953
|
e.target.value = null;
|
23956
23954
|
onUploadDocument(selectedFile, exports.DocType.MONITORING_REPORT);
|
@@ -23997,7 +23995,7 @@ var NdcActionBody = function (props) {
|
|
23997
23995
|
handleFileUploadVerification();
|
23998
23996
|
}
|
23999
23997
|
} })),
|
24000
|
-
monitoringReportAccepted && (React.createElement("input", { type: "file", ref: fileInputVerificationRef, style: { display: "none" }, accept: ".pdf", onChange: function (e) {
|
23998
|
+
monitoringReportAccepted && (React.createElement("input", { type: "file", ref: fileInputVerificationRef, style: { display: "none" }, accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", onChange: function (e) {
|
24001
23999
|
var selectedFile = e.target.files[0];
|
24002
24000
|
e.target.value = null;
|
24003
24001
|
onUploadDocument(selectedFile, exports.DocType.VERIFICATION_REPORT);
|
@@ -24021,7 +24019,7 @@ var NdcActionBody = function (props) {
|
|
24021
24019
|
handleFileUploadVerification();
|
24022
24020
|
}
|
24023
24021
|
} })),
|
24024
|
-
React.createElement("input", { type: "file", ref: fileInputVerificationRef, style: { display: "none" }, accept: ".pdf", onChange: function (e) {
|
24022
|
+
React.createElement("input", { type: "file", ref: fileInputVerificationRef, style: { display: "none" }, accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", onChange: function (e) {
|
24025
24023
|
var selectedFile = e.target.files[0];
|
24026
24024
|
e.target.value = null;
|
24027
24025
|
onUploadDocument(selectedFile, exports.DocType.VERIFICATION_REPORT);
|
@@ -24033,7 +24031,7 @@ var css_248z$1 = ".info-view .title-icon {\n padding-right: 10px; }\n\n.info-vi
|
|
24033
24031
|
styleInject(css_248z$1);
|
24034
24032
|
|
24035
24033
|
var ProgrammeDocuments = function (props) {
|
24036
|
-
var data = props.data, title = props.title, icon = props.icon, programmeId = props.programmeId, programmeOwnerId = props.programmeOwnerId, getDocumentDetails = props.getDocumentDetails, getProgrammeById = props.getProgrammeById, ministryLevelPermission = props.ministryLevelPermission, linkDocVisible = props.linkDocVisible, uploadDocUserPermission = props.uploadDocUserPermission, useConnection = props.useConnection, useUserContext = props.useUserContext, translator = props.translator;
|
24034
|
+
var data = props.data, title = props.title, icon = props.icon, programmeId = props.programmeId, programmeOwnerId = props.programmeOwnerId, getDocumentDetails = props.getDocumentDetails, getProgrammeById = props.getProgrammeById, ministryLevelPermission = props.ministryLevelPermission, linkDocVisible = props.linkDocVisible, uploadDocUserPermission = props.uploadDocUserPermission, useConnection = props.useConnection, useUserContext = props.useUserContext, translator = props.translator, methodologyDocumentUpdated = props.methodologyDocumentUpdated;
|
24037
24035
|
var t = translator.t;
|
24038
24036
|
var userInfoState = useUserContext().userInfoState;
|
24039
24037
|
var _a = useConnection(); _a.delete; var post = _a.post;
|
@@ -24106,7 +24104,7 @@ var ProgrammeDocuments = function (props) {
|
|
24106
24104
|
});
|
24107
24105
|
};
|
24108
24106
|
var onUploadDocument = function (file, type) { return __awaiter(void 0, void 0, void 0, function () {
|
24109
|
-
var logoBase64,
|
24107
|
+
var logoBase64, response;
|
24110
24108
|
return __generator(this, function (_a) {
|
24111
24109
|
switch (_a.label) {
|
24112
24110
|
case 0:
|
@@ -24123,29 +24121,22 @@ var ProgrammeDocuments = function (props) {
|
|
24123
24121
|
return [4 /*yield*/, getBase64(file)];
|
24124
24122
|
case 1:
|
24125
24123
|
logoBase64 = _a.sent();
|
24126
|
-
imgData = logoBase64;
|
24127
|
-
if (type !== exports.DocType.MONITORING_REPORT) {
|
24128
|
-
logoUrls = logoBase64.split(",");
|
24129
|
-
imgData = logoUrls[1];
|
24130
|
-
}
|
24131
24124
|
_a.label = 2;
|
24132
24125
|
case 2:
|
24133
24126
|
_a.trys.push([2, 6, 7, 8]);
|
24134
|
-
if (!(
|
24135
|
-
(file === null || file === void 0 ? void 0 : file.type) === "application/pdf") ||
|
24136
|
-
(type === exports.DocType.METHODOLOGY_DOCUMENT &&
|
24137
|
-
(file === null || file === void 0 ? void 0 : file.type) ===
|
24138
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"))) return [3 /*break*/, 4];
|
24127
|
+
if (!isValidateFileType(file === null || file === void 0 ? void 0 : file.type)) return [3 /*break*/, 4];
|
24139
24128
|
return [4 /*yield*/, post("national/programme/addDocument", {
|
24140
24129
|
type: type,
|
24141
|
-
data:
|
24130
|
+
data: logoBase64,
|
24142
24131
|
programmeId: programmeId,
|
24143
24132
|
})];
|
24144
24133
|
case 3:
|
24145
24134
|
response = _a.sent();
|
24135
|
+
console.log(response);
|
24146
24136
|
fileInputRefMeth.current = null;
|
24147
24137
|
if (response === null || response === void 0 ? void 0 : response.data) {
|
24148
24138
|
setDocData(__spreadArray(__spreadArray([], docData, true), [response === null || response === void 0 ? void 0 : response.data], false));
|
24139
|
+
methodologyDocumentUpdated();
|
24149
24140
|
antd.message.open({
|
24150
24141
|
type: "success",
|
24151
24142
|
content: "".concat(t("programme:isUploaded")),
|
@@ -24277,7 +24268,7 @@ var ProgrammeDocuments = function (props) {
|
|
24277
24268
|
: { color: "#cacaca", cursor: "default" }, onClick: function () {
|
24278
24269
|
return uploadDocUserPermission(userInfoState, exports.DocType.DESIGN_DOCUMENT, programmeOwnerId, ministryLevelPermission) && handleDesignDocFileUpload();
|
24279
24270
|
} })),
|
24280
|
-
React.createElement("input", { type: "file", ref: fileInputRef, style: { display: "none" }, accept: ".pdf", onChange: function (e) {
|
24271
|
+
React.createElement("input", { type: "file", ref: fileInputRef, style: { display: "none" }, accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", onChange: function (e) {
|
24281
24272
|
var selectedFile = e.target.files[0];
|
24282
24273
|
e.target.value = null;
|
24283
24274
|
onUploadDocument(selectedFile, exports.DocType.DESIGN_DOCUMENT);
|
@@ -24291,7 +24282,7 @@ var ProgrammeDocuments = function (props) {
|
|
24291
24282
|
: { color: "#cacaca", cursor: "default" }, onClick: function () {
|
24292
24283
|
return uploadDocUserPermission(userInfoState, exports.DocType.DESIGN_DOCUMENT, programmeOwnerId, ministryLevelPermission) && handleDesignDocFileUpload();
|
24293
24284
|
} })),
|
24294
|
-
React.createElement("input", { type: "file", ref: fileInputRef, style: { display: "none" }, accept: ".pdf", onChange: function (e) {
|
24285
|
+
React.createElement("input", { type: "file", ref: fileInputRef, style: { display: "none" }, accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", onChange: function (e) {
|
24295
24286
|
var selectedFile = e.target.files[0];
|
24296
24287
|
e.target.value = null;
|
24297
24288
|
onUploadDocument(selectedFile, exports.DocType.DESIGN_DOCUMENT);
|
@@ -24343,7 +24334,7 @@ var ProgrammeDocuments = function (props) {
|
|
24343
24334
|
uploadDocUserPermission(userInfoState, exports.DocType.METHODOLOGY_DOCUMENT, programmeOwnerId, ministryLevelPermission) &&
|
24344
24335
|
handleMethodologyFileUpload();
|
24345
24336
|
} })),
|
24346
|
-
React.createElement("input", { type: "file", ref: fileInputRefMeth, style: { display: "none" }, accept: ".xlsx
|
24337
|
+
React.createElement("input", { type: "file", ref: fileInputRefMeth, style: { display: "none" }, accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", onChange: function (e) {
|
24347
24338
|
var selectedFile = e.target.files[0];
|
24348
24339
|
e.target.value = null;
|
24349
24340
|
if (designDocStatus === exports.DocumentStatus.ACCEPTED)
|
@@ -24363,7 +24354,7 @@ var ProgrammeDocuments = function (props) {
|
|
24363
24354
|
uploadDocUserPermission(userInfoState, exports.DocType.METHODOLOGY_DOCUMENT, programmeOwnerId, ministryLevelPermission) &&
|
24364
24355
|
handleMethodologyFileUpload();
|
24365
24356
|
} })),
|
24366
|
-
React.createElement("input", { type: "file", ref: fileInputRefMeth, style: { display: "none" }, accept: ".xlsx
|
24357
|
+
React.createElement("input", { type: "file", ref: fileInputRefMeth, style: { display: "none" }, accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", onChange: function (e) {
|
24367
24358
|
var selectedFile = e.target.files[0];
|
24368
24359
|
e.target.value = null;
|
24369
24360
|
if (designDocStatus === exports.DocumentStatus.ACCEPTED)
|