@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
@@ -0,0 +1 @@
|
|
1
|
+
export declare const isValidateFileType: (fileType: string) => boolean;
|
package/dist/esm/index.js
CHANGED
@@ -4769,7 +4769,7 @@ var AddNewCompanyComponent = function (props) {
|
|
4769
4769
|
setCompanyRole(value);
|
4770
4770
|
};
|
4771
4771
|
var CompanyDetailsForm = function () {
|
4772
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
4772
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
4773
4773
|
var companyRoleClassName = companyRole === CompanyRole.CERTIFIER
|
4774
4774
|
? "certifier"
|
4775
4775
|
: companyRole === CompanyRole.PROGRAMME_DEVELOPER
|
@@ -4827,7 +4827,27 @@ var AddNewCompanyComponent = function (props) {
|
|
4827
4827
|
] },
|
4828
4828
|
React.createElement(Input, { size: "large" })))
|
4829
4829
|
: null,
|
4830
|
-
React.createElement(Form.Item, { label: "
|
4830
|
+
React.createElement(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: [
|
4831
|
+
{
|
4832
|
+
required: true,
|
4833
|
+
message: "",
|
4834
|
+
},
|
4835
|
+
{
|
4836
|
+
validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
|
4837
|
+
return __generator(this, function (_a) {
|
4838
|
+
if (String(value).trim() === "" ||
|
4839
|
+
String(value).trim() === undefined ||
|
4840
|
+
value === null ||
|
4841
|
+
value === undefined) {
|
4842
|
+
throw new Error("Registration Payment ID ".concat(t("isRequired")));
|
4843
|
+
}
|
4844
|
+
return [2 /*return*/];
|
4845
|
+
});
|
4846
|
+
}); },
|
4847
|
+
},
|
4848
|
+
] },
|
4849
|
+
React.createElement(Input, { size: "large" })),
|
4850
|
+
React.createElement(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: [
|
4831
4851
|
{
|
4832
4852
|
required: true,
|
4833
4853
|
message: "",
|
@@ -4858,7 +4878,7 @@ var AddNewCompanyComponent = function (props) {
|
|
4858
4878
|
},
|
4859
4879
|
] },
|
4860
4880
|
React.createElement(Input, { size: "large" })),
|
4861
|
-
React.createElement(Form.Item, { className: "website", label: "Website", initialValue: (
|
4881
|
+
React.createElement(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: [
|
4862
4882
|
{
|
4863
4883
|
required: false,
|
4864
4884
|
validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
|
@@ -4919,7 +4939,7 @@ var AddNewCompanyComponent = function (props) {
|
|
4919
4939
|
return false;
|
4920
4940
|
}, className: "logo-upload-section", name: "logo", action: "/upload.do", listType: "picture", multiple: false, defaultFileList: fileList, maxCount: 1 },
|
4921
4941
|
React.createElement(Button, { size: "large", icon: React.createElement(UploadOutlined, null) }, "Upload"))),
|
4922
|
-
companyRole === CompanyRole.MINISTRY && (React.createElement(Form.Item, { name: "address", label: "Address", initialValue: (
|
4942
|
+
companyRole === CompanyRole.MINISTRY && (React.createElement(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: [
|
4923
4943
|
{ required: true, message: "" },
|
4924
4944
|
{
|
4925
4945
|
validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
|
@@ -4975,7 +4995,7 @@ var AddNewCompanyComponent = function (props) {
|
|
4975
4995
|
React.createElement(Radio.Button, { className: "minister", value: "Ministry" },
|
4976
4996
|
React.createElement(AuditOutlined, { className: "role-icons" }),
|
4977
4997
|
"Ministry")))))))),
|
4978
|
-
companyRole === CompanyRole.MINISTRY && (React.createElement(Form.Item, { label: "Name of the Minister", name: "nameOfMinister", initialValue: (
|
4998
|
+
companyRole === CompanyRole.MINISTRY && (React.createElement(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: [
|
4979
4999
|
{
|
4980
5000
|
required: true,
|
4981
5001
|
message: "",
|
@@ -5000,12 +5020,12 @@ var AddNewCompanyComponent = function (props) {
|
|
5000
5020
|
required: true,
|
5001
5021
|
message: "Sectoral Scope ".concat(t("isRequired")),
|
5002
5022
|
},
|
5003
|
-
], initialValue: (
|
5023
|
+
], initialValue: (_j = state === null || state === void 0 ? void 0 : state.record) === null || _j === void 0 ? void 0 : _j.sectoralScope },
|
5004
5024
|
React.createElement(Select, { mode: "multiple", size: "large", maxTagCount: 2, allowClear: true }, Object.entries(SectoralScope).map(function (_a) {
|
5005
5025
|
var key = _a[0], value = _a[1];
|
5006
5026
|
return (React.createElement(Select.Option, { key: value, value: value }, key));
|
5007
5027
|
})))),
|
5008
|
-
React.createElement(Form.Item, { name: "phoneNo", label: "Phone Number", initialValue: (
|
5028
|
+
React.createElement(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: [
|
5009
5029
|
{
|
5010
5030
|
required: true,
|
5011
5031
|
message: "",
|
@@ -5036,14 +5056,14 @@ var AddNewCompanyComponent = function (props) {
|
|
5036
5056
|
},
|
5037
5057
|
] },
|
5038
5058
|
React.createElement(PhoneInput, { placeholder: "Phone number", international: true, value: formatPhoneNumberIntl(contactNoInput), defaultCountry: "LK", countryCallingCodeEditable: false, onChange: function (v) { }, countries: countries })),
|
5039
|
-
regionField && (React.createElement(Form.Item, { label: t("region"), name: "regions", initialValue: (
|
5059
|
+
regionField && (React.createElement(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: [
|
5040
5060
|
{
|
5041
5061
|
required: true,
|
5042
5062
|
message: "".concat(t("region"), " ").concat(t("isRequired")),
|
5043
5063
|
},
|
5044
5064
|
] },
|
5045
5065
|
React.createElement(Select, { mode: "multiple", size: "large", maxTagCount: 2, onChange: onChangeRegion, loading: loadingList, allowClear: true }, regionsList.map(function (region) { return (React.createElement(Select.Option, { value: region }, region)); })))),
|
5046
|
-
companyRole !== CompanyRole.MINISTRY && (React.createElement(Form.Item, { name: "address", label: "Address", initialValue: (
|
5066
|
+
companyRole !== CompanyRole.MINISTRY && (React.createElement(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: [
|
5047
5067
|
{ required: true, message: "" },
|
5048
5068
|
{
|
5049
5069
|
validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
|
@@ -5390,6 +5410,9 @@ var CompanyProfileComponent = function (props) {
|
|
5390
5410
|
React.createElement(Row, { className: "field" },
|
5391
5411
|
React.createElement(Col, { span: 12, className: "field-key" }, t("companyProfile:taxId")),
|
5392
5412
|
React.createElement(Col, { span: 12, className: "field-value nextline-overflow" }, companyDetails.taxId ? companyDetails.taxId : "-")),
|
5413
|
+
React.createElement(Row, { className: "field" },
|
5414
|
+
React.createElement(Col, { span: 12, className: "field-key" }, t("companyProfile:paymentId")),
|
5415
|
+
React.createElement(Col, { span: 12, className: "field-value nextline-overflow" }, companyDetails.paymentId ? companyDetails.paymentId : "-")),
|
5393
5416
|
React.createElement(Row, { className: "field" },
|
5394
5417
|
React.createElement(Col, { span: 12, className: "field-key" }, t("companyProfile:companyRole")),
|
5395
5418
|
React.createElement(Col, { span: 12, className: "field-value" },
|
@@ -11571,6 +11594,21 @@ var moment$1 = {exports: {}};
|
|
11571
11594
|
var momentExports = moment$1.exports;
|
11572
11595
|
var moment = /*@__PURE__*/getDefaultExportFromCjs(momentExports);
|
11573
11596
|
|
11597
|
+
var allowedFileTypes = [
|
11598
|
+
"application/pdf",
|
11599
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
11600
|
+
"application/vnd.ms-powerpoint",
|
11601
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
11602
|
+
"application/msword",
|
11603
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
11604
|
+
"text/csv",
|
11605
|
+
"image/png",
|
11606
|
+
"image/jpeg"
|
11607
|
+
];
|
11608
|
+
var isValidateFileType = function (fileType) {
|
11609
|
+
return allowedFileTypes.includes(fileType);
|
11610
|
+
};
|
11611
|
+
|
11574
11612
|
var maximumImageSize = process.env.REACT_APP_MAXIMUM_FILE_SIZE
|
11575
11613
|
? parseInt(process.env.REACT_APP_MAXIMUM_FILE_SIZE)
|
11576
11614
|
: 5000000;
|
@@ -11857,7 +11895,7 @@ var ProgrammeCreationComponent = function (props) {
|
|
11857
11895
|
setCurrent(current - 1);
|
11858
11896
|
};
|
11859
11897
|
var onFinishStepOne = function (values) { return __awaiter(void 0, void 0, void 0, function () {
|
11860
|
-
var programmeDetails, ownershipPercentage, totalPercentage, proponentPercentages, proponentTxIds, logoBase64,
|
11898
|
+
var programmeDetails, ownershipPercentage, totalPercentage, proponentPercentages, proponentTxIds, logoBase64, propTaxIds, duplicateIds;
|
11861
11899
|
var _a, _b;
|
11862
11900
|
return __generator(this, function (_c) {
|
11863
11901
|
switch (_c.label) {
|
@@ -11871,12 +11909,10 @@ var ProgrammeCreationComponent = function (props) {
|
|
11871
11909
|
? ownershipPercentage === null || ownershipPercentage === void 0 ? void 0 : ownershipPercentage.slice(1).map(function (item) { return item.organisation; })
|
11872
11910
|
: ownershipPercentage === null || ownershipPercentage === void 0 ? void 0 : ownershipPercentage.map(function (item) { return item.organisation; });
|
11873
11911
|
logoBase64 = "";
|
11874
|
-
logoUrls = [];
|
11875
11912
|
if (!(((_a = values === null || values === void 0 ? void 0 : values.designDocument) === null || _a === void 0 ? void 0 : _a.length) > 0)) return [3 /*break*/, 2];
|
11876
11913
|
return [4 /*yield*/, getBase64((_b = values === null || values === void 0 ? void 0 : values.designDocument[0]) === null || _b === void 0 ? void 0 : _b.originFileObj)];
|
11877
11914
|
case 1:
|
11878
11915
|
logoBase64 = _c.sent();
|
11879
|
-
logoUrls = logoBase64 === null || logoBase64 === void 0 ? void 0 : logoBase64.split(",");
|
11880
11916
|
_c.label = 2;
|
11881
11917
|
case 2:
|
11882
11918
|
propTaxIds = (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) !== CompanyRole.GOVERNMENT &&
|
@@ -11919,8 +11955,8 @@ var ProgrammeCreationComponent = function (props) {
|
|
11919
11955
|
})), (includedInNDC !== undefined &&
|
11920
11956
|
includedInNDC !== null && { includedInNdc: includedInNDC })),
|
11921
11957
|
};
|
11922
|
-
if ((
|
11923
|
-
programmeDetails.designDocument =
|
11958
|
+
if ((logoBase64 === null || logoBase64 === void 0 ? void 0 : logoBase64.length) > 0) {
|
11959
|
+
programmeDetails.designDocument = logoBase64;
|
11924
11960
|
}
|
11925
11961
|
setLoading(false);
|
11926
11962
|
console.log(programmeDetails);
|
@@ -12199,15 +12235,10 @@ var ProgrammeCreationComponent = function (props) {
|
|
12199
12235
|
},
|
12200
12236
|
{
|
12201
12237
|
validator: function (rule, file) { return __awaiter(void 0, void 0, void 0, function () {
|
12202
|
-
var isCorrectFormat;
|
12203
12238
|
var _a, _b;
|
12204
12239
|
return __generator(this, function (_c) {
|
12205
12240
|
if ((file === null || file === void 0 ? void 0 : file.length) > 0) {
|
12206
|
-
|
12207
|
-
if (((_a = file[0]) === null || _a === void 0 ? void 0 : _a.type) === "application/pdf") {
|
12208
|
-
isCorrectFormat = true;
|
12209
|
-
}
|
12210
|
-
if (!isCorrectFormat) {
|
12241
|
+
if (!isValidateFileType((_a = file[0]) === null || _a === void 0 ? void 0 : _a.type)) {
|
12211
12242
|
throw new Error("".concat(t("addProgramme:invalidFileFormat")));
|
12212
12243
|
}
|
12213
12244
|
else if (((_b = file[0]) === null || _b === void 0 ? void 0 : _b.size) > maximumImageSize) {
|
@@ -12220,7 +12251,7 @@ var ProgrammeCreationComponent = function (props) {
|
|
12220
12251
|
}); },
|
12221
12252
|
},
|
12222
12253
|
] },
|
12223
|
-
React.createElement(Upload, { accept: ".pdf", beforeUpload: function (file) {
|
12254
|
+
React.createElement(Upload, { accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", beforeUpload: function (file) {
|
12224
12255
|
return false;
|
12225
12256
|
}, className: "design-upload-section", name: "design", action: "/upload.do", listType: "picture", multiple: false,
|
12226
12257
|
// defaultFileList={fileList}
|
@@ -12524,7 +12555,6 @@ var ChangePasswordModel = function (props) {
|
|
12524
12555
|
React.createElement(Button, { className: "mg-left-2", type: "primary", htmlType: "submit", loading: loadingBtn }, t("passwordReset:setPassword"))))));
|
12525
12556
|
};
|
12526
12557
|
|
12527
|
-
Select.Option;
|
12528
12558
|
var AddNewUserComponent = function (props) {
|
12529
12559
|
var _a, _b, _c, _d, _e, _f;
|
12530
12560
|
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;
|
@@ -15301,7 +15331,7 @@ var NdcActionDetails = function (props) {
|
|
15301
15331
|
calculateMethodologyEstimatedCredits();
|
15302
15332
|
};
|
15303
15333
|
var onNdcActionDetailsFormSubmit = function (ndcActionFormvalues) { return __awaiter(void 0, void 0, void 0, function () {
|
15304
|
-
var ndcActionDetailObj, enablementReport
|
15334
|
+
var ndcActionDetailObj, enablementReport;
|
15305
15335
|
var _a;
|
15306
15336
|
return __generator(this, function (_b) {
|
15307
15337
|
switch (_b.label) {
|
@@ -15386,9 +15416,7 @@ var NdcActionDetails = function (props) {
|
|
15386
15416
|
return [4 /*yield*/, getBase64((_a = ndcActionFormvalues.EnablementReport[0]) === null || _a === void 0 ? void 0 : _a.originFileObj)];
|
15387
15417
|
case 1:
|
15388
15418
|
enablementReport = _b.sent();
|
15389
|
-
|
15390
|
-
ndcActionDetailObj.enablementProperties.report =
|
15391
|
-
enablementReportData[1];
|
15419
|
+
ndcActionDetailObj.enablementProperties.report = enablementReport;
|
15392
15420
|
_b.label = 2;
|
15393
15421
|
case 2:
|
15394
15422
|
ndcActionDetailObj.enablementReportData =
|
@@ -15704,15 +15732,10 @@ var NdcActionDetails = function (props) {
|
|
15704
15732
|
React.createElement(Form.Item, { label: t("ndcAction:report"), name: "EnablementReport", valuePropName: "fileList", getValueFromEvent: normFile, required: false, rules: [
|
15705
15733
|
{
|
15706
15734
|
validator: function (rule, file) { return __awaiter(void 0, void 0, void 0, function () {
|
15707
|
-
var isCorrectFormat;
|
15708
15735
|
var _a, _b;
|
15709
15736
|
return __generator(this, function (_c) {
|
15710
|
-
isCorrectFormat = false;
|
15711
15737
|
if (file && file.length > 0) {
|
15712
|
-
if (((_a = file[0]) === null || _a === void 0 ? void 0 : _a.type)
|
15713
|
-
isCorrectFormat = true;
|
15714
|
-
}
|
15715
|
-
if (!isCorrectFormat) {
|
15738
|
+
if (!isValidateFileType((_a = file[0]) === null || _a === void 0 ? void 0 : _a.type)) {
|
15716
15739
|
throw new Error("".concat(t("ndcAction:invalidFileFormat")));
|
15717
15740
|
}
|
15718
15741
|
else if (((_b = file[0]) === null || _b === void 0 ? void 0 : _b.size) > maximumImageSize) {
|
@@ -15724,7 +15747,7 @@ var NdcActionDetails = function (props) {
|
|
15724
15747
|
}); },
|
15725
15748
|
},
|
15726
15749
|
] },
|
15727
|
-
React.createElement(Upload, { accept: ".pdf", beforeUpload: function (file) {
|
15750
|
+
React.createElement(Upload, { accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", beforeUpload: function (file) {
|
15728
15751
|
return false;
|
15729
15752
|
}, className: "design-upload-section", name: "design", listType: "picture", multiple: false, maxCount: 1 },
|
15730
15753
|
React.createElement(Button, { className: "upload-doc", size: "large", icon: React.createElement(UploadOutlined, null) }, "Upload")))))),
|
@@ -15975,8 +15998,9 @@ var Assessment = function (props) {
|
|
15975
15998
|
return [4 /*yield*/, getBase64(changedField.value[0].originFileObj)];
|
15976
15999
|
case 1:
|
15977
16000
|
base64Value = _a.sent();
|
15978
|
-
|
15979
|
-
|
16001
|
+
console.log("FEAsibility document : ", base64Value);
|
16002
|
+
values_1 = base64Value;
|
16003
|
+
setCobenefitsAssessmentDetails(function (pre) { return (__assign(__assign({}, pre), { document: values_1 })); });
|
15980
16004
|
return [3 /*break*/, 3];
|
15981
16005
|
case 2:
|
15982
16006
|
changedValues[changedField.name[0]] = changedField.value;
|
@@ -16214,15 +16238,10 @@ var Assessment = function (props) {
|
|
16214
16238
|
!viewOnly && (React.createElement(Form.Item, { label: t("assessmentDocuments"), name: "document", valuePropName: "fileList", getValueFromEvent: normFile, required: false, rules: [
|
16215
16239
|
{
|
16216
16240
|
validator: function (rule, file) { return __awaiter(void 0, void 0, void 0, function () {
|
16217
|
-
var isCorrectFormat;
|
16218
16241
|
var _a, _b;
|
16219
16242
|
return __generator(this, function (_c) {
|
16220
16243
|
if ((file === null || file === void 0 ? void 0 : file.length) > 0) {
|
16221
|
-
|
16222
|
-
if (((_a = file[0]) === null || _a === void 0 ? void 0 : _a.type) === "application/pdf") {
|
16223
|
-
isCorrectFormat = true;
|
16224
|
-
}
|
16225
|
-
if (!isCorrectFormat) {
|
16244
|
+
if (!isValidateFileType((_a = file[0]) === null || _a === void 0 ? void 0 : _a.type)) {
|
16226
16245
|
throw new Error("".concat(t("invalidFileFormat")));
|
16227
16246
|
}
|
16228
16247
|
else if (((_b = file[0]) === null || _b === void 0 ? void 0 : _b.size) > maximumFileSize) {
|
@@ -16234,7 +16253,7 @@ var Assessment = function (props) {
|
|
16234
16253
|
}); },
|
16235
16254
|
},
|
16236
16255
|
] },
|
16237
|
-
React.createElement(Upload, { accept: ".pdf", beforeUpload: function (file) {
|
16256
|
+
React.createElement(Upload, { accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", beforeUpload: function (file) {
|
16238
16257
|
return false;
|
16239
16258
|
}, className: "design-upload-section", name: "document", listType: "picture", multiple: false, maxCount: 1 },
|
16240
16259
|
React.createElement(Button, { className: "upload-doc", size: "large", icon: React.createElement(UploadOutlined, null) }, "Upload")))),
|
@@ -18194,25 +18213,13 @@ var AddNdcActionComponent = function (props) {
|
|
18194
18213
|
React.createElement(Form.Item, { label: t("ndcAction:monitoringReport"), name: "monitoringReport", valuePropName: "fileList", getValueFromEvent: normFile, required: false, rules: [
|
18195
18214
|
{
|
18196
18215
|
validator: function (rule, file) { return __awaiter(void 0, void 0, void 0, function () {
|
18197
|
-
var
|
18198
|
-
|
18199
|
-
return __generator(this, function (_e) {
|
18216
|
+
var _a, _b;
|
18217
|
+
return __generator(this, function (_c) {
|
18200
18218
|
if ((file === null || file === void 0 ? void 0 : file.length) > 0) {
|
18201
|
-
|
18202
|
-
if (((_a = file[0]) === null || _a === void 0 ? void 0 : _a.type) === "application/pdf") {
|
18203
|
-
isCorrectFormat = true;
|
18204
|
-
}
|
18205
|
-
else if (((_b = file[0]) === null || _b === void 0 ? void 0 : _b.type) ===
|
18206
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") {
|
18207
|
-
isCorrectFormat = true;
|
18208
|
-
}
|
18209
|
-
else if (((_c = file[0]) === null || _c === void 0 ? void 0 : _c.type) === "text/csv") {
|
18210
|
-
isCorrectFormat = true;
|
18211
|
-
}
|
18212
|
-
if (!isCorrectFormat) {
|
18219
|
+
if (!isValidateFileType((_a = file[0]) === null || _a === void 0 ? void 0 : _a.type)) {
|
18213
18220
|
throw new Error("".concat(t("ndcAction:invalidFileFormat")));
|
18214
18221
|
}
|
18215
|
-
else if (((
|
18222
|
+
else if (((_b = file[0]) === null || _b === void 0 ? void 0 : _b.size) > maximumImageSize) {
|
18216
18223
|
// default size format of files would be in bytes -> 1MB = 1000000bytes
|
18217
18224
|
throw new Error("".concat(t("common:maxSizeVal")));
|
18218
18225
|
}
|
@@ -23717,7 +23724,7 @@ var NdcActionBody = function (props) {
|
|
23717
23724
|
(_a = fileInputVerificationRef === null || fileInputVerificationRef === void 0 ? void 0 : fileInputVerificationRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
23718
23725
|
};
|
23719
23726
|
var onUploadDocument = function (file, type) { return __awaiter(void 0, void 0, void 0, function () {
|
23720
|
-
var logoBase64,
|
23727
|
+
var logoBase64, response;
|
23721
23728
|
return __generator(this, function (_a) {
|
23722
23729
|
switch (_a.label) {
|
23723
23730
|
case 0:
|
@@ -23734,22 +23741,13 @@ var NdcActionBody = function (props) {
|
|
23734
23741
|
return [4 /*yield*/, getBase64(file)];
|
23735
23742
|
case 1:
|
23736
23743
|
logoBase64 = _a.sent();
|
23737
|
-
imgData = logoBase64;
|
23738
|
-
if (type !== DocType.MONITORING_REPORT) {
|
23739
|
-
logoUrls = logoBase64.split(",");
|
23740
|
-
imgData = logoUrls[1];
|
23741
|
-
}
|
23742
23744
|
_a.label = 2;
|
23743
23745
|
case 2:
|
23744
23746
|
_a.trys.push([2, 6, 7, 8]);
|
23745
|
-
if (!(
|
23746
|
-
(type === DocType.MONITORING_REPORT &&
|
23747
|
-
((file === null || file === void 0 ? void 0 : file.type) ===
|
23748
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
|
23749
|
-
(file === null || file === void 0 ? void 0 : file.type) === "text/csv")))) return [3 /*break*/, 4];
|
23747
|
+
if (!isValidateFileType(file === null || file === void 0 ? void 0 : file.type)) return [3 /*break*/, 4];
|
23750
23748
|
return [4 /*yield*/, post("national/programme/addDocument", {
|
23751
23749
|
type: type,
|
23752
|
-
data:
|
23750
|
+
data: logoBase64,
|
23753
23751
|
programmeId: programmeId,
|
23754
23752
|
actionId: ndcActionId,
|
23755
23753
|
})];
|
@@ -23906,7 +23904,7 @@ var NdcActionBody = function (props) {
|
|
23906
23904
|
handleFileUploadMonitor();
|
23907
23905
|
}
|
23908
23906
|
} })),
|
23909
|
-
React.createElement("input", { type: "file", ref: fileInputMonitoringRef, style: { display: "none" }, accept: ".
|
23907
|
+
React.createElement("input", { type: "file", ref: fileInputMonitoringRef, style: { display: "none" }, accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", onChange: function (e) {
|
23910
23908
|
var selectedFile = e.target.files[0];
|
23911
23909
|
e.target.value = null;
|
23912
23910
|
onUploadDocument(selectedFile, DocType.MONITORING_REPORT);
|
@@ -23930,7 +23928,7 @@ var NdcActionBody = function (props) {
|
|
23930
23928
|
handleFileUploadMonitor();
|
23931
23929
|
}
|
23932
23930
|
} })),
|
23933
|
-
React.createElement("input", { type: "file", ref: fileInputMonitoringRef, style: { display: "none" }, accept: ".
|
23931
|
+
React.createElement("input", { type: "file", ref: fileInputMonitoringRef, style: { display: "none" }, accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", onChange: function (e) {
|
23934
23932
|
var selectedFile = e.target.files[0];
|
23935
23933
|
e.target.value = null;
|
23936
23934
|
onUploadDocument(selectedFile, DocType.MONITORING_REPORT);
|
@@ -23977,7 +23975,7 @@ var NdcActionBody = function (props) {
|
|
23977
23975
|
handleFileUploadVerification();
|
23978
23976
|
}
|
23979
23977
|
} })),
|
23980
|
-
monitoringReportAccepted && (React.createElement("input", { type: "file", ref: fileInputVerificationRef, style: { display: "none" }, accept: ".pdf", onChange: function (e) {
|
23978
|
+
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) {
|
23981
23979
|
var selectedFile = e.target.files[0];
|
23982
23980
|
e.target.value = null;
|
23983
23981
|
onUploadDocument(selectedFile, DocType.VERIFICATION_REPORT);
|
@@ -24001,7 +23999,7 @@ var NdcActionBody = function (props) {
|
|
24001
23999
|
handleFileUploadVerification();
|
24002
24000
|
}
|
24003
24001
|
} })),
|
24004
|
-
React.createElement("input", { type: "file", ref: fileInputVerificationRef, style: { display: "none" }, accept: ".pdf", onChange: function (e) {
|
24002
|
+
React.createElement("input", { type: "file", ref: fileInputVerificationRef, style: { display: "none" }, accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", onChange: function (e) {
|
24005
24003
|
var selectedFile = e.target.files[0];
|
24006
24004
|
e.target.value = null;
|
24007
24005
|
onUploadDocument(selectedFile, DocType.VERIFICATION_REPORT);
|
@@ -24013,7 +24011,7 @@ var css_248z$1 = ".info-view .title-icon {\n padding-right: 10px; }\n\n.info-vi
|
|
24013
24011
|
styleInject(css_248z$1);
|
24014
24012
|
|
24015
24013
|
var ProgrammeDocuments = function (props) {
|
24016
|
-
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;
|
24014
|
+
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;
|
24017
24015
|
var t = translator.t;
|
24018
24016
|
var userInfoState = useUserContext().userInfoState;
|
24019
24017
|
var _a = useConnection(); _a.delete; var post = _a.post;
|
@@ -24086,7 +24084,7 @@ var ProgrammeDocuments = function (props) {
|
|
24086
24084
|
});
|
24087
24085
|
};
|
24088
24086
|
var onUploadDocument = function (file, type) { return __awaiter(void 0, void 0, void 0, function () {
|
24089
|
-
var logoBase64,
|
24087
|
+
var logoBase64, response;
|
24090
24088
|
return __generator(this, function (_a) {
|
24091
24089
|
switch (_a.label) {
|
24092
24090
|
case 0:
|
@@ -24103,29 +24101,22 @@ var ProgrammeDocuments = function (props) {
|
|
24103
24101
|
return [4 /*yield*/, getBase64(file)];
|
24104
24102
|
case 1:
|
24105
24103
|
logoBase64 = _a.sent();
|
24106
|
-
imgData = logoBase64;
|
24107
|
-
if (type !== DocType.MONITORING_REPORT) {
|
24108
|
-
logoUrls = logoBase64.split(",");
|
24109
|
-
imgData = logoUrls[1];
|
24110
|
-
}
|
24111
24104
|
_a.label = 2;
|
24112
24105
|
case 2:
|
24113
24106
|
_a.trys.push([2, 6, 7, 8]);
|
24114
|
-
if (!(
|
24115
|
-
(file === null || file === void 0 ? void 0 : file.type) === "application/pdf") ||
|
24116
|
-
(type === DocType.METHODOLOGY_DOCUMENT &&
|
24117
|
-
(file === null || file === void 0 ? void 0 : file.type) ===
|
24118
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"))) return [3 /*break*/, 4];
|
24107
|
+
if (!isValidateFileType(file === null || file === void 0 ? void 0 : file.type)) return [3 /*break*/, 4];
|
24119
24108
|
return [4 /*yield*/, post("national/programme/addDocument", {
|
24120
24109
|
type: type,
|
24121
|
-
data:
|
24110
|
+
data: logoBase64,
|
24122
24111
|
programmeId: programmeId,
|
24123
24112
|
})];
|
24124
24113
|
case 3:
|
24125
24114
|
response = _a.sent();
|
24115
|
+
console.log(response);
|
24126
24116
|
fileInputRefMeth.current = null;
|
24127
24117
|
if (response === null || response === void 0 ? void 0 : response.data) {
|
24128
24118
|
setDocData(__spreadArray(__spreadArray([], docData, true), [response === null || response === void 0 ? void 0 : response.data], false));
|
24119
|
+
methodologyDocumentUpdated();
|
24129
24120
|
message.open({
|
24130
24121
|
type: "success",
|
24131
24122
|
content: "".concat(t("programme:isUploaded")),
|
@@ -24257,7 +24248,7 @@ var ProgrammeDocuments = function (props) {
|
|
24257
24248
|
: { color: "#cacaca", cursor: "default" }, onClick: function () {
|
24258
24249
|
return uploadDocUserPermission(userInfoState, DocType.DESIGN_DOCUMENT, programmeOwnerId, ministryLevelPermission) && handleDesignDocFileUpload();
|
24259
24250
|
} })),
|
24260
|
-
React.createElement("input", { type: "file", ref: fileInputRef, style: { display: "none" }, accept: ".pdf", onChange: function (e) {
|
24251
|
+
React.createElement("input", { type: "file", ref: fileInputRef, style: { display: "none" }, accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", onChange: function (e) {
|
24261
24252
|
var selectedFile = e.target.files[0];
|
24262
24253
|
e.target.value = null;
|
24263
24254
|
onUploadDocument(selectedFile, DocType.DESIGN_DOCUMENT);
|
@@ -24271,7 +24262,7 @@ var ProgrammeDocuments = function (props) {
|
|
24271
24262
|
: { color: "#cacaca", cursor: "default" }, onClick: function () {
|
24272
24263
|
return uploadDocUserPermission(userInfoState, DocType.DESIGN_DOCUMENT, programmeOwnerId, ministryLevelPermission) && handleDesignDocFileUpload();
|
24273
24264
|
} })),
|
24274
|
-
React.createElement("input", { type: "file", ref: fileInputRef, style: { display: "none" }, accept: ".pdf", onChange: function (e) {
|
24265
|
+
React.createElement("input", { type: "file", ref: fileInputRef, style: { display: "none" }, accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", onChange: function (e) {
|
24275
24266
|
var selectedFile = e.target.files[0];
|
24276
24267
|
e.target.value = null;
|
24277
24268
|
onUploadDocument(selectedFile, DocType.DESIGN_DOCUMENT);
|
@@ -24323,7 +24314,7 @@ var ProgrammeDocuments = function (props) {
|
|
24323
24314
|
uploadDocUserPermission(userInfoState, DocType.METHODOLOGY_DOCUMENT, programmeOwnerId, ministryLevelPermission) &&
|
24324
24315
|
handleMethodologyFileUpload();
|
24325
24316
|
} })),
|
24326
|
-
React.createElement("input", { type: "file", ref: fileInputRefMeth, style: { display: "none" }, accept: ".xlsx
|
24317
|
+
React.createElement("input", { type: "file", ref: fileInputRefMeth, style: { display: "none" }, accept: ".xls, .xlsx, .ppt, .pptx, .csv, .doc, .docx, .pdf, .png, .jpg", onChange: function (e) {
|
24327
24318
|
var selectedFile = e.target.files[0];
|
24328
24319
|
e.target.value = null;
|
24329
24320
|
if (designDocStatus === DocumentStatus.ACCEPTED)
|
@@ -24343,7 +24334,7 @@ var ProgrammeDocuments = function (props) {
|
|
24343
24334
|
uploadDocUserPermission(userInfoState, 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 === DocumentStatus.ACCEPTED)
|