diff --git a/frontend/src/services/applicationService.js b/frontend/src/services/applicationService.js
index 0b384a3b..10b1402f 100644
--- a/frontend/src/services/applicationService.js
+++ b/frontend/src/services/applicationService.js
@@ -12,6 +12,17 @@ function sortApplications(applications) {
}
export default {
+ async getApplicationsByFacilityId(facilityId) {
+ try {
+ if (!facilityId) return
+ const response = await ApiService.apiAxios.get(`${ApiRoutes.APPLICATIONS}?facilityId=${facilityId}`)
+ return response?.data
+ } catch (error) {
+ console.log(`Failed to get the list of applications by facility id - ${error}`)
+ throw error
+ }
+ },
+
async getActiveApplicationsByFacilityId(facilityId) {
try {
if (!facilityId) return
@@ -52,6 +63,25 @@ export default {
}
},
+ async getApplications() {
+ try {
+ const authStore = useAuthStore()
+ const facilities = authStore?.userInfo?.facilities
+ let applications = []
+ await Promise.all(
+ facilities?.map(async (facility) => {
+ const response = await this.getApplicationsByFacilityId(facility.facilityId)
+ applications = applications?.concat(response)
+ }),
+ )
+ sortApplications(applications)
+ return applications
+ } catch (error) {
+ console.log(`Failed to get the applications - ${error}`)
+ throw error
+ }
+ },
+
async getActiveApplications() {
try {
const authStore = useAuthStore()
diff --git a/frontend/src/views/applications/ApplicationsHistoryView.vue b/frontend/src/views/applications/ApplicationsHistoryView.vue
index 24178f16..bb2ecde8 100644
--- a/frontend/src/views/applications/ApplicationsHistoryView.vue
+++ b/frontend/src/views/applications/ApplicationsHistoryView.vue
@@ -82,7 +82,7 @@
class="soft-outline"
density="compact">
- {{ item.status }}
+ {{ getStatusLabel(item) }}
@@ -222,8 +222,11 @@ export default {
return this.applications?.some((application) => ApplicationService.isValidApplication(application)) && this.hasGoodStanding
},
filteredApplicationItems() {
+ const hiddenCodes = [APPLICATION_STATUS_CODES.EXPIRED, APPLICATION_STATUS_CODES.REDIRECTED]
return this.sortApplicationItems(
- this.applicationItems.filter((application) => !this.facilityNameFilter || application.facilityName?.toLowerCase().includes(this.facilityNameFilter.toLowerCase())),
+ this.applicationItems
+ .filter((application) => !this.facilityNameFilter || application.facilityName?.toLowerCase().includes(this.facilityNameFilter.toLowerCase()))
+ .filter((application) => !hiddenCodes.includes(application.statusCode)),
)
},
ofmApplicationCardText() {
@@ -301,7 +304,9 @@ export default {
},
showPDFDownloadButton(application) {
- if (application.applicationType === APPLICATION_TYPES.IRREGULAR_EXPENSE || application.statusCode === APPLICATION_STATUS_CODES.REDIRECTED) {
+ const invalidAppCodes = [APPLICATION_STATUS_CODES.INELIGIBLE, APPLICATION_STATUS_CODES.CANCELLED_BY_MINISTRY, APPLICATION_STATUS_CODES.CANCELLED_BY_SP]
+
+ if (application.applicationType === APPLICATION_TYPES.IRREGULAR_EXPENSE || invalidAppCodes.includes(application.statusCode)) {
return false
//OFM core generates PDF upon submit - Supp App generates PDF only once approved
} else if (application.applicationType === APPLICATION_TYPES.OFM) {
@@ -336,15 +341,18 @@ export default {
},
async getApplicationsAndFundingAgreement() {
- this.applications = await ApplicationService.getActiveApplications()
- // Applications' funding agreements are used in applications validation to enable the Add Supplementary Application button
+ let applications = await ApplicationService.getApplications()
+ // Applications' funding agreements are used in applications validation to enable the Add SupplementaryApplication
+ // Application button
await Promise.all(
- this.applications?.map(async (application) => {
+ applications.map(async (application) => {
application.status = application.statusCode === APPLICATION_STATUS_CODES.VERIFIED ? 'In Review' : application.status
- //we should ignore MOD igreements below - if MOD FA is in status of not active - it will prevent the user from applying for Irreg Expense funding
+ // we should ignore MOD igreements below - if MOD FA is in status of not active - it will prevent the user
+ // from applying for Irreg Expense funding
application.fundingAgreement = await FundingAgreementService.getActiveFundingAgreementByApplicationId(application.applicationId, true)
}),
)
+ this.applications = applications
},
async getSupplementaryApplications() {
@@ -422,9 +430,17 @@ export default {
const supplementaryApplicationItems = this.transformSupplementaryApplicationsToItems(this.supplementaryApplications, applicationItemsMap)
this.applicationItems = [...this.applicationItems, ...supplementaryApplicationItems, ...this.irregularExpenses]
},
-
+ getStatusLabel(applicationItem) {
+ if ([APPLICATION_STATUS_CODES.CANCELLED_BY_SP, APPLICATION_STATUS_CODES.CANCELLED_BY_MINISTRY].includes(applicationItem.statusCode)) {
+ return 'Cancelled'
+ }
+ return applicationItem.status
+ },
getStatusClass(statusCode) {
- if (this.DRAFT_STATUS_CODES.includes(statusCode) || statusCode === APPLICATION_STATUS_CODES.REDIRECTED) {
+ if (
+ this.DRAFT_STATUS_CODES.includes(statusCode) ||
+ [APPLICATION_STATUS_CODES.REDIRECTED, APPLICATION_STATUS_CODES.INELIGIBLE, APPLICATION_STATUS_CODES.CANCELLED_BY_MINISTRY, APPLICATION_STATUS_CODES.CANCELLED_BY_SP].includes(statusCode)
+ ) {
return 'status-gray'
} else if (
[