From bcf17d93fff259811adc6150ea3dba1e8619e947 Mon Sep 17 00:00:00 2001 From: Trevor Richards Date: Fri, 10 Jan 2025 15:32:52 -0800 Subject: [PATCH 1/2] feat: include cancelled & ineligible apps in hist. --- frontend/src/services/applicationService.js | 30 +++++++++ .../applications/ApplicationsHistoryView.vue | 62 +++++++++++++++---- 2 files changed, 81 insertions(+), 11 deletions(-) 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..feb7f478 100644 --- a/frontend/src/views/applications/ApplicationsHistoryView.vue +++ b/frontend/src/views/applications/ApplicationsHistoryView.vue @@ -82,7 +82,7 @@ class="soft-outline" density="compact">