Skip to content

Commit

Permalink
Parvathy | BAH-2833 | Fix. Handle Document Size Limit Error Message
Browse files Browse the repository at this point in the history
  • Loading branch information
parvathy00 authored and rahu1ramesh committed Apr 1, 2024
1 parent 08ea44b commit e65c77a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions ui/app/common/domain/services/visitDocumentService.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ angular.module('bahmni.common.domain')
return response;
}, function (error) {
if (error.status === 413) {
var maxAllowedSize = roundToNearestHalf(error.data.maxDocumentSizeMB * 0.70);
messagingService.showMessage("error", $translate.instant("FILE_SIZE_LIMIT_EXCEEDED_MESSAGE", { maxAllowedSize: maxAllowedSize }));
if (!isNaN(error.data.maxDocumentSizeMB)) {
var maxAllowedSize = roundToNearestHalf(error.data.maxDocumentSizeMB * 0.70);
messagingService.showMessage("error", $translate.instant("FILE_SIZE_LIMIT_EXCEEDED_MESSAGE", { maxAllowedSize: maxAllowedSize }));
} else {
messagingService.showMessage("error", $translate.instant("SIZE_LIMIT_EXCEEDED_MESSAGE"));
}
}
return $q.reject(error);
});
Expand Down
3 changes: 2 additions & 1 deletion ui/app/i18n/document-upload/locale_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@
"VISIT_FROM_LABEL": "From:",
"VISIT_TO_LABEL": "To:",
"FILE_TYPE_NOT_SUPPORTED_MESSAGE": "File type is not supported",
"FILE_SIZE_LIMIT_EXCEEDED_MESSAGE": "File size limit exceeded. Please upload a file less than {{maxAllowedSize}} MB."
"FILE_SIZE_LIMIT_EXCEEDED_MESSAGE": "File size limit exceeded. Please upload a file less than {{maxAllowedSize}} MB.",
"SIZE_LIMIT_EXCEEDED_MESSAGE": "File size limit exceeded. Please upload a smaller file"
}

0 comments on commit e65c77a

Please sign in to comment.