@@ -6,6 +6,8 @@ import DocumentService from '@/services/documentService'
6
6
import FacilityService from '@/services/facilityService'
7
7
import LicenceService from '@/services/licenceService'
8
8
import { useAppStore } from '@/stores/app'
9
+ import { useAuthStore } from '@/stores/auth'
10
+
9
11
import { APPLICATION_RENEWAL_TYPES , APPLICATION_STATUS_CODES , DOCUMENT_TYPES , FACILITY_TYPES , OFM_PROGRAM_CODES , YES_NO_CHOICE_CRM_MAPPING , YES_NO_RADIO_GROUP_MAPPING } from '@/utils/constants'
10
12
11
13
export const useApplicationsStore = defineStore ( 'applications' , {
@@ -39,6 +41,7 @@ export const useApplicationsStore = defineStore('applications', {
39
41
40
42
async getApplication ( applicationId ) {
41
43
try {
44
+ const authStore = useAuthStore ( ) ;
42
45
this . currentApplication = await ApplicationService . getApplication ( applicationId )
43
46
if ( ! this . currentApplication ) return
44
47
const [ uploadedDocuments , licences , facility ] = await Promise . all ( [
@@ -49,6 +52,7 @@ export const useApplicationsStore = defineStore('applications', {
49
52
this . currentApplication . uploadedDocuments = uploadedDocuments
50
53
this . currentApplication . licences = licences
51
54
this . currentApplication . facility = facility
55
+ this . currentApplication . facilityCanAddApplication = authStore . userInfo . facilities . find ( ( f ) => f . facilityId === facility . facilityId ) ?. intakeWindowCheckForAddApplication || false
52
56
this . checkApplicationComplete ( )
53
57
} catch ( error ) {
54
58
console . log ( `Failed to get the application by application id - ${ error } ` )
0 commit comments