From 56bfc3c2077fb53c4ef0f692bf0c22773d5ca7bb Mon Sep 17 00:00:00 2001 From: Le Date: Thu, 22 Aug 2024 14:23:58 -0700 Subject: [PATCH] ofmcc-5687 - update after code review --- .../applications/review/ServiceDeliverySummary.vue | 2 +- frontend/src/components/ui/AppDocumentUpload.vue | 10 +++++----- frontend/src/stores/applications.js | 4 ++-- .../src/views/applications/ServiceDeliveryView.vue | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/applications/review/ServiceDeliverySummary.vue b/frontend/src/components/applications/review/ServiceDeliverySummary.vue index a1d0aecf..fbc028d9 100644 --- a/frontend/src/components/applications/review/ServiceDeliverySummary.vue +++ b/frontend/src/components/applications/review/ServiceDeliverySummary.vue @@ -25,7 +25,7 @@ - + diff --git a/frontend/src/components/ui/AppDocumentUpload.vue b/frontend/src/components/ui/AppDocumentUpload.vue index b01d4b74..e1181528 100644 --- a/frontend/src/components/ui/AppDocumentUpload.vue +++ b/frontend/src/components/ui/AppDocumentUpload.vue @@ -20,7 +20,7 @@ :rules="[...fileRules]" :accept="fileExtensionAccept" :disabled="loading" - @update:modelValue="validateFile(item.id)"> + @update:model-value="validateFile(item.id)"> @@ -36,7 +36,7 @@ - +
@@ -102,11 +102,11 @@ export default { } }, computed: { - reachUploadLimit() { + uploadLimitReached() { return this.uploadLimit && this.documents?.length + this.uploadedDocuments?.length >= Number(this.uploadLimit) }, showAddFileButton() { - return !this.loading && !this.readonly && !this.reachUploadLimit + return !this.loading && !this.readonly && !this.uploadLimitReached }, }, watch: { @@ -143,7 +143,7 @@ export default { { title: 'Description', key: 'description', width: '60%' }, { title: '', key: 'actionButtons', sortable: false, width: '6%' }, ] - if (!this.disabled && !this.readonly && !this.reachUploadLimit) { + if (!this.disabled && !this.readonly && !this.uploadLimitReached) { this.addFile() } }, diff --git a/frontend/src/stores/applications.js b/frontend/src/stores/applications.js index d53dfe4f..4b2afcaa 100644 --- a/frontend/src/stores/applications.js +++ b/frontend/src/stores/applications.js @@ -90,13 +90,13 @@ export const useApplicationsStore = defineStore('applications', { isLicenceDocumentUploaded() { return this.currentApplication.licences.every((licence) => { const uploadedDocument = this.currentApplication?.uploadedDocuments?.filter((document) => document.documentType?.includes(licence?.licence)) - return uploadedDocument?.length > 0 + return !isEmpty(uploadedDocument) }) }, isHealthAuthorityReportUploaded() { const healthAuthorityReports = this.currentApplication?.uploadedDocuments?.filter((document) => document.documentType?.includes(DOCUMENT_TYPES.HEALTH_AUTHORITY_REPORT)) - return healthAuthorityReports?.length > 0 + return !isEmpty(healthAuthorityReports) }, /* diff --git a/frontend/src/views/applications/ServiceDeliveryView.vue b/frontend/src/views/applications/ServiceDeliveryView.vue index 5af63324..bc9ca1e5 100644 --- a/frontend/src/views/applications/ServiceDeliveryView.vue +++ b/frontend/src/views/applications/ServiceDeliveryView.vue @@ -194,11 +194,11 @@ export default { return !isEmpty(this.healthAuthorityReports?.documentsToUpload) || !isEmpty(this.healthAuthorityReports?.uploadedDocuments) }, - haveLicenceDocumentsToProcess() { + hasLicenceDocumentsToProcess() { return Object.keys(this.licenceDocuments)?.some((licence) => !isEmpty(this.licenceDocuments[licence]?.documentsToUpload) || !isEmpty(this.licenceDocuments[licence]?.documentsToDelete)) }, - haveHealthAuthorityReportDocumentsToProcess() { + hasHealthAuthorityReportDocumentsToProcess() { return !isEmpty(this.healthAuthorityReports?.documentsToUpload) || !isEmpty(this.healthAuthorityReports?.documentsToDelete) }, }, @@ -250,7 +250,7 @@ export default { try { this.$emit('process', true) this.processing = true - let reloadApplication = this.changedLicences?.length > 0 || this.haveLicenceDocumentsToProcess || this.haveHealthAuthorityReportDocumentsToProcess + let reloadApplication = !isEmpty(this.changedLicences) || this.hasLicenceDocumentsToProcess || this.hasHealthAuthorityReportDocumentsToProcess const payload = { licenceDeclaration: this.licenceDeclaration, } @@ -266,11 +266,11 @@ export default { }), ) - if (this.haveLicenceDocumentsToProcess) { + if (this.hasLicenceDocumentsToProcess) { await this.processLicenceDocuments() } - if (this.haveHealthAuthorityReportDocumentsToProcess) { + if (this.hasHealthAuthorityReportDocumentsToProcess) { await this.processHealthAuthorityReportDocuments() }