Skip to content

Commit

Permalink
ofmcc-5687 - update after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
vietle-cgi committed Aug 22, 2024
1 parent 628bc62 commit 56bfc3c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<LicenceDetails :licence="licence" :read-only="true" />
</v-card>
<v-card class="mt-4">
<AppDocumentUpload class="pa-4" :readonly="true" :document-label="DOCUMENT_LABELS.LICENCE" :document-type="`Licence ${licence?.licence}`" :uploaded-documents="getLicenceDocument(licence)">
<AppDocumentUpload class="pa-4" :readonly="true" :document-label="DOCUMENT_LABELS.LICENCE" :document-type="`Licence ${licence.licence}`" :uploaded-documents="getLicenceDocument(licence)">
<AppMissingInfoError
v-if="!readonly && !getLicenceDocument(licence)?.length"
:to="{ name: APPLICATION_ROUTES.SERVICE_DELIVERY, hash: `#${licence.licenceId}`, params: { applicationGuid: $route.params.applicationGuid } }">
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/components/ui/AppDocumentUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
:rules="[...fileRules]"
:accept="fileExtensionAccept"
:disabled="loading"
@update:modelValue="validateFile(item.id)"></v-file-input>
@update:model-value="validateFile(item.id)"></v-file-input>
</v-col>
<v-col cols="11" md="7" class="pr-4">
<v-text-field v-model.trim="item.description" :disabled="loading" placeholder="Enter a description (Optional)" counter maxlength="1000" dense clearable></v-text-field>
Expand All @@ -36,7 +36,7 @@
<template #item.actionButtons="{ item }">
<v-icon v-if="!loading && !readonly" small @click="$emit('deleteUploadedDocument', item.documentId, documentType)">mdi-delete</v-icon>
</template>
<template v-slot:bottom><!-- no paging --></template>
<template #bottom><!-- no paging --></template>
</v-data-table>
</div>
<div>
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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()
}
},
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/stores/applications.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},

/*
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/views/applications/ServiceDeliveryView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
},
Expand Down Expand Up @@ -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,
}
Expand All @@ -266,11 +266,11 @@ export default {
}),
)
if (this.haveLicenceDocumentsToProcess) {
if (this.hasLicenceDocumentsToProcess) {
await this.processLicenceDocuments()
}
if (this.haveHealthAuthorityReportDocumentsToProcess) {
if (this.hasHealthAuthorityReportDocumentsToProcess) {
await this.processHealthAuthorityReportDocuments()
}
Expand Down

0 comments on commit 56bfc3c

Please sign in to comment.