Skip to content

Commit

Permalink
TASK 3266: Update file size to 15MB (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
mihailistov committed Mar 26, 2024
1 parent 11e5fdc commit 01132d5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
7 changes: 4 additions & 3 deletions assets/application/js/documents.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
FILE INFO
-------------------
tags: ["Documents", "Application", "JS"]
version: 1.0.1
version: 1.0.2
name: Documents
type: JS Script
description: This is the JS script for the Documents step in APPLICATION form.
*/
if (window.jQuery) {
(function ($) {
const MAXIMUM_FILE_SIZE_IN_KB = 15360;
const MAXIMUM_FILE_SIZE_TEXT = '15MB';
const allowedMimeTypes = [
'text/csv',
'application/msword',
Expand Down Expand Up @@ -235,7 +236,7 @@ if (window.jQuery) {

let alertStr = '';
if (!isValidFileType && !isValidFileSize) {
alertStr = `Selected file(s) do not match the allowed file extensions and exceed file size limit of 10MB. Please upload a valid file size & file type of: ${allowedFileTypes.join(
alertStr = `Selected file(s) do not match the allowed file extensions and exceed file size limit of ${MAXIMUM_FILE_SIZE_TEXT}. Please upload a valid file size & file type of: ${allowedFileTypes.join(
', '
)}.`;
} else if (!isValidFileType) {
Expand All @@ -244,7 +245,7 @@ if (window.jQuery) {
)}.`;
} else if (!isValidFileSize) {
alertStr =
'Selected file(s) exceeds the allowed file upload limit of 10MB. Please upload a file with a size of 10MB or less.';
`Selected file(s) exceeds the allowed file upload limit of ${MAXIMUM_FILE_SIZE_TEXT}. Please upload a file with a size of ${MAXIMUM_FILE_SIZE_TEXT} or less.`;
}

if (alertStr) {
Expand Down
7 changes: 4 additions & 3 deletions assets/claim/js/documents.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
FILE INFO
-------------------
tags: ["Documents", "Claim", "JS"]
version: 1.0.1
version: 1.0.2
name: Documents
type: JS Script
description: This is the JS script for the Documents step in CLAIM form.
*/
if (window.jQuery) {
(function ($) {
var MAXIMUM_FILE_SIZE_IN_KB = 15360;
const MAXIMUM_FILE_SIZE_TEXT = '15MB';
var allowedMimeTypes = [
"text/csv",
"application/msword",
Expand Down Expand Up @@ -133,7 +134,7 @@ if (window.jQuery) {

let alertStr = "";
if (!isValidFileType && !isValidFileSize) {
alertStr = `Selected file(s) do not match the allowed file extensions and exceed file size limit of 10MB. Please upload a valid file size & file type of: ${allowedFileTypes.join(
alertStr = `Selected file(s) do not match the allowed file extensions and exceed file size limit of ${MAXIMUM_FILE_SIZE_TEXT}. Please upload a valid file size & file type of: ${allowedFileTypes.join(
", "
)}.`;
} else if (!isValidFileType) {
Expand All @@ -142,7 +143,7 @@ if (window.jQuery) {
)}.`;
} else if (!isValidFileSize) {
alertStr =
"Selected file(s) exceeds the allowed file upload limit of 10MB. Please upload a file with a size of 10MB or less.";
`Selected file(s) exceeds the allowed file upload limit of ${MAXIMUM_FILE_SIZE_TEXT}. Please upload a file with a size of ${MAXIMUM_FILE_SIZE_TEXT} or less.`;
}

if (alertStr) {
Expand Down
5 changes: 3 additions & 2 deletions powerpod/src/js/claim/documents.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Logger } from '../common/logger.js';
const logger = new Logger('claim/documents');

const MAXIMUM_FILE_SIZE_IN_KB = 15360;
const MAXIMUM_FILE_SIZE_TEXT = '15MB';
const ALLOWED_MIME_TYPES = [
'text/csv',
'application/msword',
Expand Down Expand Up @@ -128,7 +129,7 @@ function validateFileUpload(file) {

let alertStr = '';
if (!isValidFileType && !isValidFileSize) {
alertStr = `Selected file(s) do not match the allowed file extensions and exceed file size limit of 10MB. Please upload a valid file size & file type of: ${ALLOWED_FILE_TYPES.join(
alertStr = `Selected file(s) do not match the allowed file extensions and exceed file size limit of ${MAXIMUM_FILE_SIZE_TEXT}. Please upload a valid file size & file type of: ${ALLOWED_FILE_TYPES.join(
', '
)}.`;
} else if (!isValidFileType) {
Expand All @@ -137,7 +138,7 @@ function validateFileUpload(file) {
)}.`;
} else if (!isValidFileSize) {
alertStr =
'Selected file(s) exceeds the allowed file upload limit of 10MB. Please upload a file with a size of 10MB or less.';
`Selected file(s) exceeds the allowed file upload limit of ${MAXIMUM_FILE_SIZE_TEXT}. Please upload a file with a size of ${MAXIMUM_FILE_SIZE_TEXT} or less.`;
}

if (alertStr) {
Expand Down

0 comments on commit 01132d5

Please sign in to comment.