diff --git a/app/frontend/src/components/admin/FormComponentsProactiveHelp.vue b/app/frontend/src/components/admin/FormComponentsProactiveHelp.vue index 844c89b78..e424f2922 100644 --- a/app/frontend/src/components/admin/FormComponentsProactiveHelp.vue +++ b/app/frontend/src/components/admin/FormComponentsProactiveHelp.vue @@ -1,172 +1,80 @@ - diff --git a/app/frontend/src/components/forms/PrintOptions.vue b/app/frontend/src/components/forms/PrintOptions.vue index 99c7a3451..e6b0c4d46 100644 --- a/app/frontend/src/components/forms/PrintOptions.vue +++ b/app/frontend/src/components/forms/PrintOptions.vue @@ -1,7 +1,7 @@ @@ -446,6 +466,7 @@ defineExpose({ value="upload" > 0) { - if (sort[0].key === 'date') { - sortBy.value.column = 'createdAt'; - } else if (sort[0].key === 'submitter') { - sortBy.value.column = 'createdBy'; - } else if (sort[0].key === 'status') { - sortBy.value.column = 'formSubmissionStatusCode'; + if (sortBy?.length > 0) { + if (sortBy[0].key === 'date') { + sort.value.column = 'createdAt'; + } else if (sortBy[0].key === 'submitter') { + sort.value.column = 'createdBy'; + } else if (sortBy[0].key === 'status') { + sort.value.column = 'formSubmissionStatusCode'; } else { - sortBy.value.column = sort[0].key; + sort.value.column = sortBy[0].key; } - sortBy.value.order = sort[0].order; + sort.value.order = sortBy[0].order; } else { - sortBy.value = {}; + sort.value = {}; } - if (itemsPP) { - itemsPerPage.value = itemsPP; + if (itemsPerPage) { + itemsPP.value = itemsPerPage; } if (!firstDataLoad.value) { await refreshSubmissions(); @@ -336,11 +336,11 @@ async function updateTableOptions({ pg, itemsPP, sort }) { async function getSubmissionData() { let criteria = { formId: properties.formId, - itemsPerPage: itemsPerPage.value, - page: page.value - 1, + itemsPerPage: itemsPP.value, + page: currentPage.value - 1, filterformSubmissionStatusCode: true, paginationEnabled: true, - sortBy: sortBy.value, + sortBy: sort.value, search: search.value, searchEnabled: search.value.length > 0 ? true : false, createdAt: Object.values({ @@ -539,11 +539,11 @@ defineExpose({ getSubmissionData, handleSearch, HEADERS, - itemsPerPage, + itemsPP, multiDeleteMessage, multiRestoreMessage, onShowColumnDialog, - page, + currentPage, restoreSub, serverItems, showColumnsDialog, @@ -554,7 +554,7 @@ defineExpose({ singleRestoreMessage, singleSubmissionDelete, singleSubmissionRestore, - sortBy, + sort, updateFilter, userColumns, USER_PREFERENCES, @@ -691,7 +691,7 @@ defineExpose({ hover :items-length="totalSubmissions" class="submissions-table" - :items-per-page="itemsPerPage" + :items-per-page="itemsPP" :headers="HEADERS" item-value="submissionId" :items="serverItems" diff --git a/app/frontend/src/components/forms/manage/DocumentTemplate.vue b/app/frontend/src/components/forms/manage/DocumentTemplate.vue index fa1f8d21a..a15b0ce28 100644 --- a/app/frontend/src/components/forms/manage/DocumentTemplate.vue +++ b/app/frontend/src/components/forms/manage/DocumentTemplate.vue @@ -27,6 +27,7 @@ const headers = ref([ const loading = ref(true); const isFileInputEmpty = ref(true); const isValidFile = ref(true); +const isValidSize = ref(true); const techdocsLinkTemplateUpload = ref( 'https://developer.gov.bc.ca/docs/default/component/chefs-techdocs/Capabilities/Functionalities/CDOGS-Template-Upload/' ); @@ -38,6 +39,7 @@ const notificationStore = useNotificationStore(); const { form, isRTL } = storeToRefs(useFormStore()); const validationRules = computed(() => [ + isValidSize.value || t('trans.documentTemplate.fileSizeError'), isValidFile.value || t('trans.documentTemplate.invalidFileMessage'), ]); @@ -83,6 +85,15 @@ function handleFileInput(event) { if (event && event.length > 0) { isFileInputEmpty.value = false; uploadedFile = event[0]; + + // validate file size + if (uploadedFile.size > 25000000) { + isValidSize.value = false; + } else { + isValidSize.value = true; + } + + // validate file extension const fileExtension = event[0].name.split('.').pop(); if (validFileExtensions.includes(fileExtension)) { isValidFile.value = true; @@ -92,6 +103,7 @@ function handleFileInput(event) { } else { isFileInputEmpty.value = true; isValidFile.value = true; + isValidSize.value = true; } } @@ -120,12 +132,21 @@ async function handleFileUpload() { ...NotificationTypes.SUCCESS, }); } catch (e) { - notificationStore.addNotification({ - text: t('trans.documentTemplate.uploadError'), - consoleError: t('trans.documentTemplate.uploadError', { - error: e.message, - }), - }); + if (e.response.status === 413) { + notificationStore.addNotification({ + text: t('trans.documentTemplate.fileSizeError'), + consoleError: t('trans.documentTemplate.fileSizeError', { + error: e.message, + }), + }); + } else { + notificationStore.addNotification({ + text: t('trans.documentTemplate.uploadError'), + consoleError: t('trans.documentTemplate.uploadError', { + error: e.message, + }), + }); + } } finally { loading.value = false; } @@ -196,6 +217,7 @@ defineExpose({ handleFileInput, isFileInputEmpty, isValidFile, + isValidSize, uploadedFile, }); @@ -322,7 +344,10 @@ defineExpose({ -import { mapActions, mapState } from 'pinia'; + diff --git a/app/frontend/src/components/infolinks/ProactiveHelpDialog.vue b/app/frontend/src/components/infolinks/ProactiveHelpDialog.vue index 99b54a85b..3aff3a9d8 100644 --- a/app/frontend/src/components/infolinks/ProactiveHelpDialog.vue +++ b/app/frontend/src/components/infolinks/ProactiveHelpDialog.vue @@ -1,131 +1,154 @@ -