placementt-core 11.0.533 → 11.0.803
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/constants.d.ts +13 -1
- package/lib/constants.js +86 -1
- package/lib/constants.js.map +1 -1
- package/lib/features/analytics/useAnalytics.d.ts +2 -0
- package/lib/features/analytics/useAnalytics.js +22 -19
- package/lib/features/analytics/useAnalytics.js.map +1 -1
- package/lib/features/global/downtime/useDowntime.d.ts +1 -0
- package/lib/features/global/downtime/useDowntime.js +9 -7
- package/lib/features/global/downtime/useDowntime.js.map +1 -1
- package/lib/features/global/users/useUserFunctions.js +1 -1
- package/lib/features/global/users/useUserFunctions.js.map +1 -1
- package/lib/features/jobs/jobsSlice.d.ts +10 -2
- package/lib/features/jobs/jobsSlice.js +5 -2
- package/lib/features/jobs/jobsSlice.js.map +1 -1
- package/lib/features/placements/studentPlacements/activePlacement.d.ts +5 -1
- package/lib/features/placements/studentPlacements/activePlacement.js +7 -3
- package/lib/features/placements/studentPlacements/activePlacement.js.map +1 -1
- package/lib/features/placements/studentPlacements/completedStudentPlacementsSlice.d.ts +3 -2
- package/lib/features/placements/studentPlacements/completedStudentPlacementsSlice.js +4 -1
- package/lib/features/placements/studentPlacements/completedStudentPlacementsSlice.js.map +1 -1
- package/lib/features/placements/studentPlacements/upcomingStudentPlacementsSlice.d.ts +2 -2
- package/lib/features/placements/studentPlacements/upcomingStudentPlacementsSlice.js +1 -1
- package/lib/features/placements/studentPlacements/upcomingStudentPlacementsSlice.js.map +1 -1
- package/lib/features/placements/studentPlacements/useStudentPlacements.d.ts +2 -12
- package/lib/features/placements/studentPlacements/useStudentPlacements.js +1 -26
- package/lib/features/placements/studentPlacements/useStudentPlacements.js.map +1 -1
- package/lib/features/updates/useUpdates.d.ts +1 -0
- package/lib/features/updates/useUpdates.js +13 -12
- package/lib/features/updates/useUpdates.js.map +1 -1
- package/lib/firebase/firebase.d.ts +5 -3
- package/lib/firebase/firebase.js +15 -9
- package/lib/firebase/firebase.js.map +1 -1
- package/lib/firebase/firebaseConfig.js.map +1 -1
- package/lib/firebase/firebaseQuery.d.ts +6 -2
- package/lib/firebase/firebaseQuery.js +11 -3
- package/lib/firebase/firebaseQuery.js.map +1 -1
- package/lib/firebase/readDatabase.d.ts +2 -4
- package/lib/firebase/readDatabase.js +30 -5
- package/lib/firebase/readDatabase.js.map +1 -1
- package/lib/firebase/writeDatabase.d.ts +6 -2
- package/lib/firebase/writeDatabase.js +2 -1
- package/lib/firebase/writeDatabase.js.map +1 -1
- package/lib/hooks.d.ts +226 -16
- package/lib/hooks.js +938 -146
- package/lib/hooks.js.map +1 -1
- package/lib/reduxHooks.d.ts +56 -4
- package/lib/reduxHooks.js +63 -19
- package/lib/reduxHooks.js.map +1 -1
- package/lib/tasksAndTips.d.ts +7 -5
- package/lib/tasksAndTips.js +487 -23
- package/lib/tasksAndTips.js.map +1 -1
- package/lib/typeDefinitions.d.ts +149 -30
- package/lib/util.d.ts +7 -2
- package/lib/util.js +32 -9
- package/lib/util.js.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +91 -3
- package/src/features/analytics/useAnalytics.tsx +25 -17
- package/src/features/global/downtime/useDowntime.tsx +11 -7
- package/src/features/global/users/useUserFunctions.tsx +1 -1
- package/src/features/jobs/jobsSlice.ts +9 -3
- package/src/features/placements/studentPlacements/activePlacement.ts +8 -3
- package/src/features/placements/studentPlacements/completedStudentPlacementsSlice.ts +5 -2
- package/src/features/placements/studentPlacements/upcomingStudentPlacementsSlice.ts +2 -2
- package/src/features/placements/studentPlacements/useStudentPlacements.tsx +4 -28
- package/src/features/updates/useUpdates.tsx +14 -12
- package/src/firebase/firebase.tsx +19 -12
- package/src/firebase/firebaseConfig.tsx +1 -1
- package/src/firebase/firebaseQuery.tsx +11 -3
- package/src/firebase/readDatabase.tsx +34 -6
- package/src/firebase/writeDatabase.tsx +3 -1
- package/src/hooks.tsx +1124 -166
- package/src/reduxHooks.ts +71 -22
- package/src/tasksAndTips.ts +495 -30
- package/src/typeDefinitions.ts +140 -35
- package/src/util.ts +45 -17
package/src/typeDefinitions.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {DocumentData, DocumentReference, Timestamp} from "firebase/firestore";
|
|
2
2
|
import {Descendant} from "slate";
|
|
3
|
+
import {emailTemplates} from "./constants";
|
|
3
4
|
|
|
4
5
|
export type Products = "institutes"|"providers"|"students"|"admin";
|
|
5
6
|
|
|
@@ -32,6 +33,7 @@ export type StudentPlacementData = {
|
|
|
32
33
|
["address-line2"]: string,
|
|
33
34
|
locality: string,
|
|
34
35
|
postal_code: string,
|
|
36
|
+
what3Words?: string,
|
|
35
37
|
country: string,
|
|
36
38
|
cohort?: string,
|
|
37
39
|
leadTimes: string[],
|
|
@@ -41,7 +43,7 @@ export type StudentPlacementData = {
|
|
|
41
43
|
placementId?: string,
|
|
42
44
|
addressId?: string,
|
|
43
45
|
geoHash?: string,
|
|
44
|
-
statusType: "draft"|"submitted"|"active"|"completed"|"withdrawn",
|
|
46
|
+
statusType: "draft"|"submitted"|"active"|"completed"|"withdrawn"|"requested",
|
|
45
47
|
questions: PlacementQuestions,
|
|
46
48
|
staffRoles: string[],
|
|
47
49
|
sector: string,
|
|
@@ -69,6 +71,11 @@ export type StudentPlacementData = {
|
|
|
69
71
|
webpage?: string,
|
|
70
72
|
providerLogs?: string[],
|
|
71
73
|
studentsLogs?: string[],
|
|
74
|
+
notes?: {
|
|
75
|
+
providers?: Descendant[],
|
|
76
|
+
institutes?: Descendant[],
|
|
77
|
+
students?: Descendant[]
|
|
78
|
+
}
|
|
72
79
|
staffLogs?: [],
|
|
73
80
|
feedback: {
|
|
74
81
|
students: {
|
|
@@ -85,13 +92,22 @@ export type StudentPlacementData = {
|
|
|
85
92
|
},
|
|
86
93
|
},
|
|
87
94
|
onboarding: (OnboardingDocs&{
|
|
95
|
+
deadline?: string,
|
|
88
96
|
completed: {
|
|
89
|
-
submitted:
|
|
97
|
+
submitted: boolean,
|
|
98
|
+
submittedDate?: string,
|
|
90
99
|
accepted?: boolean,
|
|
91
100
|
filesViewed?: string[],
|
|
92
101
|
formsCompleted?: {[key: string]: unknown},
|
|
93
102
|
filesUploaded?: {[key: number]: string[]},
|
|
94
|
-
}})|false,
|
|
103
|
+
}})|false|null,
|
|
104
|
+
studentForename?: string,
|
|
105
|
+
studentSurname?: string,
|
|
106
|
+
studentEmail?: string,
|
|
107
|
+
skillsTargetsValues?: {[key: string]: {
|
|
108
|
+
provider: number[],
|
|
109
|
+
student: number[],
|
|
110
|
+
}}
|
|
95
111
|
}
|
|
96
112
|
|
|
97
113
|
export type PlacementQuestions = {
|
|
@@ -154,6 +170,7 @@ export type PlacementListing = {
|
|
|
154
170
|
locality: string,
|
|
155
171
|
postal_code: string,
|
|
156
172
|
country: string,
|
|
173
|
+
what3Words?: string,
|
|
157
174
|
addressId?: string,
|
|
158
175
|
geoHash?: string,
|
|
159
176
|
status: "listed"|"unlisted"|"deleted"|"draft",
|
|
@@ -178,29 +195,17 @@ export type PlacementListing = {
|
|
|
178
195
|
applicationType?: "simple"|"complex",
|
|
179
196
|
applicantWorkflowId?: string,
|
|
180
197
|
applicantWorkflow?: ApplicantStage[],
|
|
181
|
-
onboarding: OnboardingDocs|false,
|
|
198
|
+
onboarding: (OnboardingDocs&{deadline: number})|false,
|
|
182
199
|
maxApplicants?: number,
|
|
183
200
|
maxStudents?: number,
|
|
184
201
|
primaryContactId: string,
|
|
185
202
|
}
|
|
186
203
|
|
|
187
204
|
export type OnboardingDocs = {
|
|
188
|
-
deadline?: string,
|
|
189
205
|
message?: string,
|
|
190
|
-
deadlineType?: "date"|"days"
|
|
191
206
|
forms?: string[],
|
|
192
207
|
files?: string[],
|
|
193
|
-
formDetails?: {[key: string]:
|
|
194
|
-
{
|
|
195
|
-
name: string,
|
|
196
|
-
id: string,
|
|
197
|
-
description?: string,
|
|
198
|
-
product: Products,
|
|
199
|
-
oId: string,
|
|
200
|
-
form: CustomFormSchema
|
|
201
|
-
}},
|
|
202
208
|
requiredFiles?: {fileName: string, fileType: string}[]
|
|
203
|
-
viewableFiles?: {[key: string]: FileItem},
|
|
204
209
|
}
|
|
205
210
|
|
|
206
211
|
export type PlacementTemplate = PlacementListing&{templateName: string};
|
|
@@ -241,7 +246,9 @@ export type OrganisationAddress = Address & {
|
|
|
241
246
|
},
|
|
242
247
|
primaryContactId?: string,
|
|
243
248
|
default?: boolean,
|
|
244
|
-
flags?: ("addressMissing" | "noPrimaryContact")[]
|
|
249
|
+
flags?: ("addressMissing" | "noPrimaryContact")[],
|
|
250
|
+
color?: string;
|
|
251
|
+
image?: string|false;
|
|
245
252
|
};
|
|
246
253
|
|
|
247
254
|
export type Address = {
|
|
@@ -251,7 +258,8 @@ export type Address = {
|
|
|
251
258
|
locality: string,
|
|
252
259
|
postal_code: string,
|
|
253
260
|
country: string,
|
|
254
|
-
geoHash?: string
|
|
261
|
+
geoHash?: string,
|
|
262
|
+
what3Words?: string
|
|
255
263
|
};
|
|
256
264
|
|
|
257
265
|
export type FlagCodes =
|
|
@@ -273,13 +281,17 @@ export type FlagCodes =
|
|
|
273
281
|
"completeOnboarding"|
|
|
274
282
|
"reviewOnboarding"|
|
|
275
283
|
"requestedVisibleAddresses"|
|
|
276
|
-
"requestedVisiblePlacementListings"
|
|
284
|
+
"requestedVisiblePlacementListings"|
|
|
285
|
+
"addOnboarding"|
|
|
286
|
+
"studentNotAccepted"|
|
|
287
|
+
"reminder"
|
|
277
288
|
|
|
278
289
|
|
|
279
290
|
export type UserData = {
|
|
280
291
|
details: {
|
|
281
292
|
forename: string,
|
|
282
293
|
surname: string,
|
|
294
|
+
pronouns?: string,
|
|
283
295
|
parentEmail?: string,
|
|
284
296
|
year?: string
|
|
285
297
|
},
|
|
@@ -312,13 +324,13 @@ export type UserData = {
|
|
|
312
324
|
dismissedTutorials?: string[],
|
|
313
325
|
dismissedTips?: string[],
|
|
314
326
|
viewCohorts?: "all"|"some"|"none",
|
|
315
|
-
|
|
316
|
-
studentFilterValues?: string,
|
|
317
|
-
studentFilter?: string
|
|
318
|
-
visibleCohorts?: string,
|
|
327
|
+
viewStudents?: "all"|"some"|"none",
|
|
328
|
+
studentFilterValues?: string[], // comma delimited list of values, such as "a, b, c, d"
|
|
329
|
+
studentFilter?: string // Field on which students can be filtered
|
|
330
|
+
visibleCohorts?: string[], // comma delimited list of values
|
|
319
331
|
readUpdates?: string[],
|
|
320
332
|
contactProviderConsent?: boolean,
|
|
321
|
-
|
|
333
|
+
contactProviderConsentDate?: boolean
|
|
322
334
|
referrals?: number,
|
|
323
335
|
shareNameWithReferralLeaderboardConsent?: boolean,
|
|
324
336
|
shareNameWithReferralLeaderboardConsentDate?: boolean,
|
|
@@ -327,9 +339,20 @@ export type UserData = {
|
|
|
327
339
|
monthAdded?: number,
|
|
328
340
|
placementsCharged?: boolean,
|
|
329
341
|
visibleAddresses?: string[],
|
|
342
|
+
visibleSchools?: string[],
|
|
330
343
|
visibleListings?: string[],
|
|
331
344
|
requestedVisibleAddresses?: string[],
|
|
332
|
-
requestedVisibleListings?: string[]
|
|
345
|
+
requestedVisibleListings?: string[],
|
|
346
|
+
packageData?: BillingPackage,
|
|
347
|
+
viewAddresses?: "all"|"request"|"none"|"some",
|
|
348
|
+
viewSchools?: "all"|"request"|"none"|"some",
|
|
349
|
+
viewPlacementListings?: "all"|"request"|"none",
|
|
350
|
+
viewPlacementGroups?: "all"|"request"|"none",
|
|
351
|
+
skillsTargets?: string[],
|
|
352
|
+
skillsTargetsValues?: {[key: string]: {
|
|
353
|
+
provider: number[],
|
|
354
|
+
student: number[],
|
|
355
|
+
}}
|
|
333
356
|
};
|
|
334
357
|
|
|
335
358
|
export type AnalyticsItem = {
|
|
@@ -402,7 +425,13 @@ export type StaffUserPermissions =
|
|
|
402
425
|
editCohorts?: boolean,
|
|
403
426
|
deleteCohorts?: boolean,
|
|
404
427
|
editRequests?: boolean,
|
|
405
|
-
deleteRequests?: boolean
|
|
428
|
+
deleteRequests?: boolean,
|
|
429
|
+
addEmailTemplates?: boolean,
|
|
430
|
+
editEmailTemplates?: boolean,
|
|
431
|
+
deleteEmailTemplates?: boolean,
|
|
432
|
+
addActivity?: boolean,
|
|
433
|
+
editActivity?: boolean,
|
|
434
|
+
deleteActivity?: boolean,
|
|
406
435
|
}
|
|
407
436
|
|
|
408
437
|
export type ProviderUserPermissions = {
|
|
@@ -428,6 +457,9 @@ export type ProviderUserPermissions = {
|
|
|
428
457
|
viewPlacementGroups?: "all"|"request"|"none",
|
|
429
458
|
viewAddresses?: "all"|"request"|"none",
|
|
430
459
|
processApplicants?: boolean,
|
|
460
|
+
addSchools?: boolean,
|
|
461
|
+
editSchools?: boolean,
|
|
462
|
+
deleteSchools?: boolean,
|
|
431
463
|
addAddresses?: boolean,
|
|
432
464
|
editAddresses?: boolean,
|
|
433
465
|
deleteAddresses?: boolean,
|
|
@@ -497,7 +529,7 @@ export type ProviderData = {
|
|
|
497
529
|
staffActive: number,
|
|
498
530
|
admin: string,
|
|
499
531
|
name: string,
|
|
500
|
-
insurance: boolean,
|
|
532
|
+
insurance: boolean|"awaitingReview",
|
|
501
533
|
regNumber?: string,
|
|
502
534
|
insuranceExpiry: string,
|
|
503
535
|
mapConsent?: boolean|"unlisted",
|
|
@@ -525,7 +557,7 @@ export type ProviderData = {
|
|
|
525
557
|
locations?: number,
|
|
526
558
|
},
|
|
527
559
|
discount?: string,
|
|
528
|
-
package
|
|
560
|
+
package: string,
|
|
529
561
|
splitBilling?: boolean,
|
|
530
562
|
adminBillingContactId: string,
|
|
531
563
|
addOnPackages?: string[],
|
|
@@ -539,7 +571,10 @@ export type InstituteData = {
|
|
|
539
571
|
studentsActive: number,
|
|
540
572
|
staffActive: number,
|
|
541
573
|
admin: string,
|
|
542
|
-
name: string
|
|
574
|
+
name: string,
|
|
575
|
+
monthAdded: number,
|
|
576
|
+
platformFee: number,
|
|
577
|
+
color?: string,
|
|
543
578
|
verifiedProviders?: string[],
|
|
544
579
|
awaitingProviderInsurance?: string[],
|
|
545
580
|
verifiedRiskAssessments?: string[],
|
|
@@ -551,12 +586,29 @@ export type InstituteData = {
|
|
|
551
586
|
cohortRequests: {[oId: string]: {[cohortId: string]: string[]}},
|
|
552
587
|
externalProviderUploads?: boolean,
|
|
553
588
|
discount?: string,
|
|
554
|
-
package
|
|
589
|
+
package: string,
|
|
555
590
|
splitBilling?: boolean,
|
|
556
591
|
adminBillingContactId?: string,
|
|
557
|
-
addOnPackages?: string[]
|
|
592
|
+
addOnPackages?: string[],
|
|
593
|
+
authorisedMISSystem?: {
|
|
594
|
+
name: "arbor",
|
|
595
|
+
data: {
|
|
596
|
+
url: string
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
providerActivities?: {[key: string]: ProviderActivity}
|
|
558
600
|
}&Address;
|
|
559
601
|
|
|
602
|
+
export type ProviderActivity = {
|
|
603
|
+
title?: string,
|
|
604
|
+
description: string,
|
|
605
|
+
position?: number,
|
|
606
|
+
image?: string,
|
|
607
|
+
color: string,
|
|
608
|
+
public?: boolean,
|
|
609
|
+
oId?: string
|
|
610
|
+
}
|
|
611
|
+
|
|
560
612
|
export type NotificationObject = {
|
|
561
613
|
buttonURL: string,
|
|
562
614
|
created: Timestamp,
|
|
@@ -647,6 +699,7 @@ export type Contact = {
|
|
|
647
699
|
"address-line1": string,
|
|
648
700
|
"address-line2": string,
|
|
649
701
|
locality: string,
|
|
702
|
+
what3Words?: string,
|
|
650
703
|
postal_code: string,
|
|
651
704
|
country: string,
|
|
652
705
|
created: string,
|
|
@@ -669,6 +722,7 @@ export type CohortData = {
|
|
|
669
722
|
customWorkflow?: boolean,
|
|
670
723
|
oId: string,
|
|
671
724
|
product: Products,
|
|
725
|
+
schoolId?: string,
|
|
672
726
|
designatedStaff?: string,
|
|
673
727
|
logType?: "basic"|"custom",
|
|
674
728
|
logs?: {
|
|
@@ -688,8 +742,8 @@ export type CohortData = {
|
|
|
688
742
|
},
|
|
689
743
|
providerFeedbackSent?: Timestamp,
|
|
690
744
|
studentsFeedbackSent?: Timestamp,
|
|
691
|
-
|
|
692
|
-
|
|
745
|
+
emailTemplates?: {[key in keyof typeof emailTemplates]: string},
|
|
746
|
+
skillsTargets?: string[]
|
|
693
747
|
}
|
|
694
748
|
|
|
695
749
|
export type ArrowObject = {
|
|
@@ -723,6 +777,7 @@ export type PlacementReviewDetails = {
|
|
|
723
777
|
["address-line2"]: string,
|
|
724
778
|
locality: string,
|
|
725
779
|
postal_code: string,
|
|
780
|
+
what3Words?: string,
|
|
726
781
|
country: string,
|
|
727
782
|
key: string,
|
|
728
783
|
oId: string,
|
|
@@ -752,14 +807,16 @@ export type PlacementReviewDetails = {
|
|
|
752
807
|
requireRA?: boolean,
|
|
753
808
|
requireDBS?: boolean,
|
|
754
809
|
importedProviderForms: boolean,
|
|
755
|
-
currentStage: WorkflowStage,
|
|
810
|
+
currentStage: WorkflowStage&{files: {[fileId: string]: {name: string, url: string}}},
|
|
756
811
|
placementId?: string,
|
|
757
812
|
incompleteItems: {[key: number]: string[]},
|
|
758
813
|
riskAssessmentData?: {[key: string]: unknown}[],
|
|
759
814
|
dbsCheckData?: {[key: string]: unknown}[],
|
|
760
815
|
feedbackText?: Descendant[],
|
|
761
816
|
feedback: CustomFormSchema,
|
|
762
|
-
providerFeedback?: {[key: string]: unknown}
|
|
817
|
+
providerFeedback?: {[key: string]: unknown},
|
|
818
|
+
primaryColor?: string,
|
|
819
|
+
primaryImage?: string
|
|
763
820
|
}
|
|
764
821
|
|
|
765
822
|
export type BlogCategories = "students"|"providers"|"institutes"|"placementt"
|
|
@@ -829,6 +886,7 @@ export type Application = {
|
|
|
829
886
|
uid: string,
|
|
830
887
|
applicantWorkflowId: string,
|
|
831
888
|
listingId: string,
|
|
889
|
+
addressId: string,
|
|
832
890
|
providerId: string,
|
|
833
891
|
reqUserType: "Students"|"Staff",
|
|
834
892
|
completedSections: {[stage: number]: {
|
|
@@ -884,6 +942,8 @@ export type Event = {
|
|
|
884
942
|
export type BillingPackage = {
|
|
885
943
|
name: string,
|
|
886
944
|
staffUnitCost: number,
|
|
945
|
+
platformFee: number,
|
|
946
|
+
platformFeeFrequency: "yearly"|"monthly",
|
|
887
947
|
studentUnitCost: number,
|
|
888
948
|
placementUnitCost: number,
|
|
889
949
|
product: Products,
|
|
@@ -892,8 +952,53 @@ export type BillingPackage = {
|
|
|
892
952
|
description: string
|
|
893
953
|
}
|
|
894
954
|
|
|
955
|
+
export type EmailTemplate = {
|
|
956
|
+
name: string,
|
|
957
|
+
created: Timestamp,
|
|
958
|
+
subject: string,
|
|
959
|
+
emailTemplate: string,
|
|
960
|
+
bodyText: Descendant[],
|
|
961
|
+
color?: string,
|
|
962
|
+
product: Products,
|
|
963
|
+
oId: string,
|
|
964
|
+
public?: boolean,
|
|
965
|
+
}
|
|
895
966
|
|
|
896
967
|
|
|
968
|
+
export type EmailTemplateConfig = {
|
|
969
|
+
description: string,
|
|
970
|
+
params: string[],
|
|
971
|
+
button?: {text: string, link: string},
|
|
972
|
+
type: "workflow"|"feedback"
|
|
973
|
+
}
|
|
897
974
|
|
|
898
975
|
|
|
976
|
+
export type Reminder = {
|
|
977
|
+
collection: "users"|"placements"|"placementListings",
|
|
978
|
+
documentId: string,
|
|
979
|
+
product: Products,
|
|
980
|
+
oId: string,
|
|
981
|
+
created: Timestamp,
|
|
982
|
+
title: string,
|
|
983
|
+
description?: string,
|
|
984
|
+
dueDate: string,
|
|
985
|
+
status: "upcoming"|"dismissed"
|
|
986
|
+
}
|
|
899
987
|
|
|
988
|
+
export type Sorts = {[label: string]: {
|
|
989
|
+
value: string
|
|
990
|
+
direction: "asc"|"desc"
|
|
991
|
+
}}|undefined
|
|
992
|
+
|
|
993
|
+
export type SchoolData = OrganisationAddress&{
|
|
994
|
+
billingEmail?: string,
|
|
995
|
+
billingContactId?: string,
|
|
996
|
+
authorisedMISSystem?: {
|
|
997
|
+
name: "arbor",
|
|
998
|
+
data: {
|
|
999
|
+
url: string
|
|
1000
|
+
}
|
|
1001
|
+
},
|
|
1002
|
+
monthAdded: number,
|
|
1003
|
+
acceptingAlumni?: boolean
|
|
1004
|
+
}
|
package/src/util.ts
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
|
+
import {where} from "firebase/firestore";
|
|
2
|
+
import FirebaseQuery from "./firebase/firebaseQuery";
|
|
1
3
|
import {FlagCodes, InstituteData, StudentPlacementData, UserData, WorkflowStage} from "./typeDefinitions";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import {convertDate} from "./firebase/util";
|
|
5
|
+
|
|
6
|
+
type PlacementFlagCodeParams = {
|
|
7
|
+
placement : StudentPlacementData, // Placement we get flag codes for
|
|
8
|
+
studentData: UserData, // Student associated with the placement
|
|
9
|
+
workflow: WorkflowStage[], // Workflow associated with the placement
|
|
10
|
+
institute: InstituteData, // Associated institutes
|
|
11
|
+
user: UserData // User that is fetching flag codes (staff or student)
|
|
9
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Description of function
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
type PlaceFlagCodeReturn = Promise<FlagCodes[]>;
|
|
10
19
|
|
|
11
|
-
export const getPlacementFlagCodes = ({placement, studentData, workflow, institute, user}:
|
|
20
|
+
export const getPlacementFlagCodes = async ({placement, studentData, workflow, institute, user}: PlacementFlagCodeParams):PlaceFlagCodeReturn => {
|
|
12
21
|
let flags:FlagCodes[] = placement.flags || [];
|
|
13
22
|
|
|
23
|
+
const firebaseQuery = new FirebaseQuery();
|
|
14
24
|
|
|
15
25
|
if (!studentData.details.parentEmail && !flags.find((x) => x.includes("noParentEmail"))) {
|
|
16
26
|
if (workflow.find((obj) => obj.id === placement.status)?.userType === "Parent") {
|
|
@@ -32,51 +42,70 @@ export const getPlacementFlagCodes = ({placement, studentData, workflow, institu
|
|
|
32
42
|
const dbsCheckNotVerified = !institute?.verifiedDbsChecks?.includes(placement.placementId || placement.id);
|
|
33
43
|
const awaitingDbsCheck = !placement.dbsCheck || institute?.awaitingPlacementDbsChecks?.includes(placement.placementId || placement.id);
|
|
34
44
|
|
|
35
|
-
|
|
45
|
+
const reminderCount = (await firebaseQuery.getCount(["reminders"], [where("oId", "==", user.oId), where("uid", "==", user.id), where("dueDate", "<=", convertDate(new Date(), "dbstring") as string), where("documentId", "==", placement.id), where("status", "==", "upcoming")]));
|
|
46
|
+
|
|
47
|
+
if (reminderCount) {
|
|
48
|
+
flags.push("reminder");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (user.userType === "Staff" && user.product === "institutes" && placement.insurance && placementIsPostProviderReview && placementNotEnded && providerUnverified && !awaitingProviderInsurance) {
|
|
36
52
|
console.log("Add insurance flag!");
|
|
37
53
|
flags.includes("noInsurance") || flags.push("noInsurance");
|
|
38
54
|
} else {
|
|
39
55
|
flags = flags.filter((x) => x !== "noInsurance");
|
|
40
56
|
}
|
|
41
57
|
|
|
42
|
-
if (user.
|
|
58
|
+
if (user.product === "providers" && placement.statusType === "requested") {
|
|
59
|
+
flags.includes("studentNotAccepted") || flags.push("studentNotAccepted");
|
|
60
|
+
} else {
|
|
61
|
+
flags = flags.filter((x) => x !== "studentNotAccepted");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
if (user.userType === "Staff" && user.product === "institutes" && placementIsPostProviderReview && placementNotEnded && awaitingProviderInsurance) {
|
|
43
66
|
flags.includes("awaitingInsurance") || flags.push("awaitingInsurance");
|
|
44
67
|
} else {
|
|
45
68
|
flags = flags.filter((x) => x !== "awaitingInsurance");
|
|
46
69
|
}
|
|
47
70
|
|
|
48
|
-
if (user.userType === "Staff" && placement.dbsCheck && workflow.find((stage) => stage.dbsCheck) && placement.dbsCheck !== true && placementIsPostProviderReview && placementNotEnded && dbsCheckNotVerified && !awaitingDbsCheck) {
|
|
71
|
+
if (user.userType === "Staff" && user.product === "institutes" && placement.dbsCheck && workflow.find((stage) => stage.dbsCheck) && placement.dbsCheck !== true && placementIsPostProviderReview && placementNotEnded && dbsCheckNotVerified && !awaitingDbsCheck) {
|
|
49
72
|
flags.includes("noDbsCheck") || flags.push("noDbsCheck");
|
|
50
73
|
} else {
|
|
51
74
|
flags = flags.filter((x) => x !== "noDbsCheck");
|
|
52
75
|
}
|
|
53
76
|
|
|
54
|
-
if (user.userType === "Staff" && placementIsPostProviderReview && workflow.find((stage) => stage.dbsCheck) && placementNotEnded && awaitingProviderInsurance) {
|
|
77
|
+
if (user.userType === "Staff" && user.product === "institutes" && placementIsPostProviderReview && workflow.find((stage) => stage.dbsCheck) && placementNotEnded && awaitingProviderInsurance) {
|
|
55
78
|
flags.includes("awaitingDbsCheck") || flags.push("awaitingDbsCheck");
|
|
56
79
|
} else {
|
|
57
80
|
flags = flags.filter((x) => x !== "awaitingDbsCheck");
|
|
58
81
|
}
|
|
59
82
|
|
|
60
|
-
if (user.userType === "Staff" && placement.riskAssessment && workflow.find((stage) => stage.riskAssessment) && placement.riskAssessment !== true && placementIsPostProviderReview && placementNotEnded && riskAssessmentNotVerified && !awaitingRiskAssessment) {
|
|
83
|
+
if (user.userType === "Staff" && user.product === "institutes" && placement.riskAssessment && workflow.find((stage) => stage.riskAssessment) && placement.riskAssessment !== true && placementIsPostProviderReview && placementNotEnded && riskAssessmentNotVerified && !awaitingRiskAssessment) {
|
|
61
84
|
console.log("Add RA flag!");
|
|
62
85
|
flags.includes("noRiskAssessment") || flags.push("noRiskAssessment");
|
|
63
86
|
} else {
|
|
64
87
|
flags = flags.filter((x) => x !== "noRiskAssessment");
|
|
65
88
|
}
|
|
66
89
|
|
|
67
|
-
if (user.userType === "Staff" && placementIsPostProviderReview && workflow.find((stage) => stage.riskAssessment) && placementNotEnded && awaitingProviderInsurance) {
|
|
90
|
+
if (user.userType === "Staff" && user.product === "institutes" && placementIsPostProviderReview && workflow.find((stage) => stage.riskAssessment) && placementNotEnded && awaitingProviderInsurance) {
|
|
68
91
|
flags.includes("awaitingRiskAssessment") || flags.push("awaitingRiskAssessment");
|
|
69
92
|
} else {
|
|
70
93
|
flags = flags.filter((x) => x !== "awaitingRiskAssessment");
|
|
71
94
|
}
|
|
72
95
|
|
|
73
|
-
if (user.userType === "Staff" && user.product === "providers" && user.oId === placement.providerId && placement.onboarding
|
|
96
|
+
if (placement.inProgress && user.userType === "Staff" && user.product === "providers" && user.oId === placement.providerId && placement.onboarding === null) {
|
|
97
|
+
flags.includes("addOnboarding") || flags.push("addOnboarding");
|
|
98
|
+
} else {
|
|
99
|
+
flags = flags.filter((x) => x !== "addOnboarding");
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (placement.inProgress && user.userType === "Staff" && user.product === "providers" && user.oId === placement.providerId && placement.onboarding && (placement.onboarding.completed?.submitted && !placement.onboarding.completed.accepted) && (placement.inProgress || placement.active)) {
|
|
74
103
|
flags.includes("reviewOnboarding") || flags.push("reviewOnboarding");
|
|
75
104
|
} else {
|
|
76
105
|
flags = flags.filter((x) => x !== "reviewOnboarding");
|
|
77
106
|
}
|
|
78
107
|
|
|
79
|
-
if (user.userType === "Students" && placement.onboarding && (!placement.onboarding.completed || (placement.onboarding.completed && !placement.onboarding.completed?.submitted)) && (placement.inProgress || placement.active)) {
|
|
108
|
+
if (placement.inProgress && user.userType === "Students" && placement.onboarding && (!placement.onboarding.completed || (placement.onboarding.completed && !placement.onboarding.completed?.submitted)) && (placement.inProgress || placement.active)) {
|
|
80
109
|
flags.includes("completeOnboarding") || flags.push("completeOnboarding");
|
|
81
110
|
} else {
|
|
82
111
|
flags = flags.filter((x) => x !== "completeOnboarding");
|
|
@@ -87,7 +116,6 @@ export const getPlacementFlagCodes = ({placement, studentData, workflow, institu
|
|
|
87
116
|
};
|
|
88
117
|
|
|
89
118
|
|
|
90
|
-
|
|
91
119
|
export function objectsEqualNew(a: any, b: any): boolean { // Works with arrays or objects.
|
|
92
120
|
if (a === b) {
|
|
93
121
|
return true;
|