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/lib/util.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.getPlacementFlagCodes = void 0;
|
|
4
7
|
exports.objectsEqualNew = objectsEqualNew;
|
|
5
|
-
const
|
|
8
|
+
const firestore_1 = require("firebase/firestore");
|
|
9
|
+
const firebaseQuery_1 = __importDefault(require("./firebase/firebaseQuery"));
|
|
10
|
+
const util_1 = require("./firebase/util");
|
|
11
|
+
const getPlacementFlagCodes = async ({ placement, studentData, workflow, institute, user }) => {
|
|
6
12
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
7
13
|
let flags = placement.flags || [];
|
|
14
|
+
const firebaseQuery = new firebaseQuery_1.default();
|
|
8
15
|
if (!studentData.details.parentEmail && !flags.find((x) => x.includes("noParentEmail"))) {
|
|
9
16
|
if (((_a = workflow.find((obj) => obj.id === placement.status)) === null || _a === void 0 ? void 0 : _a.userType) === "Parent") {
|
|
10
17
|
flags.includes("noParentEmailWarning") || flags.push("noParentEmailError");
|
|
@@ -22,51 +29,67 @@ const getPlacementFlagCodes = ({ placement, studentData, workflow, institute, us
|
|
|
22
29
|
const awaitingRiskAssessment = !placement.riskAssessment || ((_e = institute === null || institute === void 0 ? void 0 : institute.awaitingPlacementRiskAssessments) === null || _e === void 0 ? void 0 : _e.includes(placement.placementId || placement.id));
|
|
23
30
|
const dbsCheckNotVerified = !((_f = institute === null || institute === void 0 ? void 0 : institute.verifiedDbsChecks) === null || _f === void 0 ? void 0 : _f.includes(placement.placementId || placement.id));
|
|
24
31
|
const awaitingDbsCheck = !placement.dbsCheck || ((_g = institute === null || institute === void 0 ? void 0 : institute.awaitingPlacementDbsChecks) === null || _g === void 0 ? void 0 : _g.includes(placement.placementId || placement.id));
|
|
25
|
-
|
|
32
|
+
const reminderCount = (await firebaseQuery.getCount(["reminders"], [(0, firestore_1.where)("oId", "==", user.oId), (0, firestore_1.where)("uid", "==", user.id), (0, firestore_1.where)("dueDate", "<=", (0, util_1.convertDate)(new Date(), "dbstring")), (0, firestore_1.where)("documentId", "==", placement.id), (0, firestore_1.where)("status", "==", "upcoming")]));
|
|
33
|
+
if (reminderCount) {
|
|
34
|
+
flags.push("reminder");
|
|
35
|
+
}
|
|
36
|
+
if (user.userType === "Staff" && user.product === "institutes" && placement.insurance && placementIsPostProviderReview && placementNotEnded && providerUnverified && !awaitingProviderInsurance) {
|
|
26
37
|
console.log("Add insurance flag!");
|
|
27
38
|
flags.includes("noInsurance") || flags.push("noInsurance");
|
|
28
39
|
}
|
|
29
40
|
else {
|
|
30
41
|
flags = flags.filter((x) => x !== "noInsurance");
|
|
31
42
|
}
|
|
32
|
-
if (user.
|
|
43
|
+
if (user.product === "providers" && placement.statusType === "requested") {
|
|
44
|
+
flags.includes("studentNotAccepted") || flags.push("studentNotAccepted");
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
flags = flags.filter((x) => x !== "studentNotAccepted");
|
|
48
|
+
}
|
|
49
|
+
if (user.userType === "Staff" && user.product === "institutes" && placementIsPostProviderReview && placementNotEnded && awaitingProviderInsurance) {
|
|
33
50
|
flags.includes("awaitingInsurance") || flags.push("awaitingInsurance");
|
|
34
51
|
}
|
|
35
52
|
else {
|
|
36
53
|
flags = flags.filter((x) => x !== "awaitingInsurance");
|
|
37
54
|
}
|
|
38
|
-
if (user.userType === "Staff" && placement.dbsCheck && workflow.find((stage) => stage.dbsCheck) && placement.dbsCheck !== true && placementIsPostProviderReview && placementNotEnded && dbsCheckNotVerified && !awaitingDbsCheck) {
|
|
55
|
+
if (user.userType === "Staff" && user.product === "institutes" && placement.dbsCheck && workflow.find((stage) => stage.dbsCheck) && placement.dbsCheck !== true && placementIsPostProviderReview && placementNotEnded && dbsCheckNotVerified && !awaitingDbsCheck) {
|
|
39
56
|
flags.includes("noDbsCheck") || flags.push("noDbsCheck");
|
|
40
57
|
}
|
|
41
58
|
else {
|
|
42
59
|
flags = flags.filter((x) => x !== "noDbsCheck");
|
|
43
60
|
}
|
|
44
|
-
if (user.userType === "Staff" && placementIsPostProviderReview && workflow.find((stage) => stage.dbsCheck) && placementNotEnded && awaitingProviderInsurance) {
|
|
61
|
+
if (user.userType === "Staff" && user.product === "institutes" && placementIsPostProviderReview && workflow.find((stage) => stage.dbsCheck) && placementNotEnded && awaitingProviderInsurance) {
|
|
45
62
|
flags.includes("awaitingDbsCheck") || flags.push("awaitingDbsCheck");
|
|
46
63
|
}
|
|
47
64
|
else {
|
|
48
65
|
flags = flags.filter((x) => x !== "awaitingDbsCheck");
|
|
49
66
|
}
|
|
50
|
-
if (user.userType === "Staff" && placement.riskAssessment && workflow.find((stage) => stage.riskAssessment) && placement.riskAssessment !== true && placementIsPostProviderReview && placementNotEnded && riskAssessmentNotVerified && !awaitingRiskAssessment) {
|
|
67
|
+
if (user.userType === "Staff" && user.product === "institutes" && placement.riskAssessment && workflow.find((stage) => stage.riskAssessment) && placement.riskAssessment !== true && placementIsPostProviderReview && placementNotEnded && riskAssessmentNotVerified && !awaitingRiskAssessment) {
|
|
51
68
|
console.log("Add RA flag!");
|
|
52
69
|
flags.includes("noRiskAssessment") || flags.push("noRiskAssessment");
|
|
53
70
|
}
|
|
54
71
|
else {
|
|
55
72
|
flags = flags.filter((x) => x !== "noRiskAssessment");
|
|
56
73
|
}
|
|
57
|
-
if (user.userType === "Staff" && placementIsPostProviderReview && workflow.find((stage) => stage.riskAssessment) && placementNotEnded && awaitingProviderInsurance) {
|
|
74
|
+
if (user.userType === "Staff" && user.product === "institutes" && placementIsPostProviderReview && workflow.find((stage) => stage.riskAssessment) && placementNotEnded && awaitingProviderInsurance) {
|
|
58
75
|
flags.includes("awaitingRiskAssessment") || flags.push("awaitingRiskAssessment");
|
|
59
76
|
}
|
|
60
77
|
else {
|
|
61
78
|
flags = flags.filter((x) => x !== "awaitingRiskAssessment");
|
|
62
79
|
}
|
|
63
|
-
if (user.userType === "Staff" && user.product === "providers" && user.oId === placement.providerId && placement.onboarding
|
|
80
|
+
if (placement.inProgress && user.userType === "Staff" && user.product === "providers" && user.oId === placement.providerId && placement.onboarding === null) {
|
|
81
|
+
flags.includes("addOnboarding") || flags.push("addOnboarding");
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
flags = flags.filter((x) => x !== "addOnboarding");
|
|
85
|
+
}
|
|
86
|
+
if (placement.inProgress && user.userType === "Staff" && user.product === "providers" && user.oId === placement.providerId && placement.onboarding && (((_h = placement.onboarding.completed) === null || _h === void 0 ? void 0 : _h.submitted) && !placement.onboarding.completed.accepted) && (placement.inProgress || placement.active)) {
|
|
64
87
|
flags.includes("reviewOnboarding") || flags.push("reviewOnboarding");
|
|
65
88
|
}
|
|
66
89
|
else {
|
|
67
90
|
flags = flags.filter((x) => x !== "reviewOnboarding");
|
|
68
91
|
}
|
|
69
|
-
if (user.userType === "Students" && placement.onboarding && (!placement.onboarding.completed || (placement.onboarding.completed && !((_j = placement.onboarding.completed) === null || _j === void 0 ? void 0 : _j.submitted))) && (placement.inProgress || placement.active)) {
|
|
92
|
+
if (placement.inProgress && user.userType === "Students" && placement.onboarding && (!placement.onboarding.completed || (placement.onboarding.completed && !((_j = placement.onboarding.completed) === null || _j === void 0 ? void 0 : _j.submitted))) && (placement.inProgress || placement.active)) {
|
|
70
93
|
flags.includes("completeOnboarding") || flags.push("completeOnboarding");
|
|
71
94
|
}
|
|
72
95
|
else {
|
package/lib/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;;;;AAsH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AAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QAC7E,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAE7B,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;YAChC,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvB,OAAO,KAAK,CAAC;YACjB,CAAC;YACD,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBACnC,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {AnalyticsItem, ApplicantStage, FlagCodes, WorkflowStage} from "./typeDefinitions";
|
|
1
|
+
import {AnalyticsItem, ApplicantStage, EmailTemplateConfig, FlagCodes, WorkflowStage} from "./typeDefinitions";
|
|
2
2
|
|
|
3
3
|
/* eslint-disable max-len */
|
|
4
4
|
export const providerCodes = {
|
|
@@ -265,7 +265,7 @@ export const defaultStudentWorkflow:WorkflowStage[] = [
|
|
|
265
265
|
},
|
|
266
266
|
];
|
|
267
267
|
|
|
268
|
-
export const flagCodes:{[k in FlagCodes]: {message: string, severity: "warning"|"error"|"info", button?: string}} = {
|
|
268
|
+
export const flagCodes:{[k in FlagCodes]: {message: string, severity: "warning"|"error"|"info", button?: string, onClose?: boolean}} = {
|
|
269
269
|
inactive: {
|
|
270
270
|
message: "User account not yet activated.",
|
|
271
271
|
severity: "warning",
|
|
@@ -349,6 +349,22 @@ export const flagCodes:{[k in FlagCodes]: {message: string, severity: "warning"|
|
|
|
349
349
|
severity: "warning",
|
|
350
350
|
button: "Review"
|
|
351
351
|
},
|
|
352
|
+
addOnboarding: {
|
|
353
|
+
message: "Send onboarding documents to your student.",
|
|
354
|
+
severity: "info",
|
|
355
|
+
button: "Add onboarding",
|
|
356
|
+
onClose: true,
|
|
357
|
+
},
|
|
358
|
+
studentNotAccepted: {
|
|
359
|
+
message: "This student has not yet accepted the placement.",
|
|
360
|
+
severity: "warning",
|
|
361
|
+
button: "Share request",
|
|
362
|
+
onClose: true,
|
|
363
|
+
},
|
|
364
|
+
reminder: {
|
|
365
|
+
message: "You have outstanding reminder(s) on this placement.",
|
|
366
|
+
severity: "info"
|
|
367
|
+
},
|
|
352
368
|
};
|
|
353
369
|
|
|
354
370
|
export const sampleTargets: AnalyticsItem = {
|
|
@@ -705,4 +721,76 @@ export const defaultApplicantWorkflow: ApplicantStage[] = [
|
|
|
705
721
|
y: 435,
|
|
706
722
|
},
|
|
707
723
|
},
|
|
708
|
-
];
|
|
724
|
+
];
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
export const emailTemplates:{[key: string]: EmailTemplateConfig} = {
|
|
728
|
+
studentPlacementCreated: {
|
|
729
|
+
description: "Sent to the student once a placement has been created.",
|
|
730
|
+
params: ["studentForename", "studentSurname", "studentEmail", "providerName", "providerEmail", "startDate", "endDate", "parentEmail", "instituteName", "cohortContactForename", "cohortContactSurname", "cohortContactEmail", "addressLineOne", "addressLineTwo", "city", "postalCode", "country"],
|
|
731
|
+
button: {text: "View placement", link: "/institutes/placements/{{pId}}"},
|
|
732
|
+
type: "workflow"
|
|
733
|
+
},
|
|
734
|
+
parentActionRequired: {
|
|
735
|
+
description: "Sent to the parent (if required) when they need to review the placement.",
|
|
736
|
+
params: ["studentForename", "studentSurname", "studentEmail", "providerName", "providerEmail", "startDate", "endDate", "parentEmail", "instituteName", "cohortContactForename", "cohortContactSurname", "cohortContactEmail", "addressLineOne", "addressLineTwo", "city", "postalCode", "country"],
|
|
737
|
+
button: {text: "Review placement", link: "/review/{{uid}}/{{pId}}/{{key}}"},
|
|
738
|
+
type: "workflow"
|
|
739
|
+
},
|
|
740
|
+
providerActionRequired: {
|
|
741
|
+
description: "Sent to the provider when they need to review the placement.",
|
|
742
|
+
params: ["studentForename", "studentSurname", "studentEmail", "providerName", "providerEmail", "startDate", "endDate", "parentEmail", "instituteName", "providerContactForename", "providerContactSurname", "cohortContactForename", "cohortContactSurname", "cohortContactEmail", "addressLineOne", "addressLineTwo", "city", "postalCode", "country"],
|
|
743
|
+
button: {text: "Review placement", link: "/review/{{uid}}/{{pId}}/{{key}}"},
|
|
744
|
+
type: "workflow"
|
|
745
|
+
},
|
|
746
|
+
studentPlacementStarting: {
|
|
747
|
+
description: "Sent to the student 1 week before placement, and one day before the placement.",
|
|
748
|
+
params: ["studentForename", "studentSurname", "studentEmail", "providerName", "providerEmail", "startDate", "endDate", "parentEmail", "daysUntilPlacement", "instituteName", "cohortContactForename", "cohortContactSurname", "cohortContactEmail", "addressLineOne", "addressLineTwo", "city", "postalCode", "country"],
|
|
749
|
+
button: {text: "View placement", link: "/institutes/placements/{{pId}}"},
|
|
750
|
+
type: "workflow"
|
|
751
|
+
},
|
|
752
|
+
providerPlacementStarting: {
|
|
753
|
+
description: "Sent to the employer 1 week before placement.",
|
|
754
|
+
params: ["studentForename", "studentSurname", "studentEmail", "providerName", "providerEmail", "startDate", "endDate", "parentEmail", "instituteName", "cohortContactForename", "cohortContactSurname", "cohortContactEmail", "addressLineOne", "addressLineTwo", "city", "postalCode", "country"],
|
|
755
|
+
button: {text: "View placement", link: "/review/{{uid}}/{{pId}}/{{key}}"},
|
|
756
|
+
type: "workflow"
|
|
757
|
+
},
|
|
758
|
+
parentPlacementStarting: {
|
|
759
|
+
description: "Sent to the parent 1 week before placement.",
|
|
760
|
+
params: ["studentForename", "studentSurname", "studentEmail", "providerName", "providerEmail", "startDate", "endDate", "parentEmail", "instituteName", "cohortContactForename", "cohortContactSurname", "cohortContactEmail", "addressLineOne", "addressLineTwo", "city", "postalCode", "country"],
|
|
761
|
+
button: {text: "View placement", link: "/review/{{uid}}/{{pId}}/{{key}}"},
|
|
762
|
+
type: "workflow"
|
|
763
|
+
},
|
|
764
|
+
studentPostPlacement: {
|
|
765
|
+
description: "Send to the student once the placement has completed. This will contain a link to feedback.",
|
|
766
|
+
params: ["studentForename", "studentSurname", "studentEmail", "providerName", "providerEmail", "startDate", "endDate", "parentEmail", "instituteName", "cohortContactForename", "cohortContactSurname", "cohortContactEmail", "addressLineOne", "addressLineTwo", "city", "postalCode", "country"],
|
|
767
|
+
button: {text: "Complete feedback", link: "/institutes/cohorts/placements/{{pId}}"},
|
|
768
|
+
type: "feedback"
|
|
769
|
+
},
|
|
770
|
+
providerPostPlacement: {
|
|
771
|
+
description: "Send to the provider once the placement has completed. This will contain a link to feedback.",
|
|
772
|
+
params: ["studentForename", "studentSurname", "studentEmail", "providerName", "providerEmail", "startDate", "endDate", "parentEmail", "instituteName", "providerContactForename", "providerContactSurname", "cohortContactForename", "cohortContactSurname", "cohortContactEmail", "addressLineOne", "addressLineTwo", "city", "postalCode", "country"],
|
|
773
|
+
button: {text: "Complete feedback", link: "/review/{{uid}}/{{pId}}/{{key}}"},
|
|
774
|
+
type: "feedback"
|
|
775
|
+
},
|
|
776
|
+
parentPostPlacement: {
|
|
777
|
+
description: "Send to the provider once the placement has completed. This will contain a link to feedback.",
|
|
778
|
+
params: ["studentForename", "studentSurname", "studentEmail", "providerName", "providerEmail", "startDate", "endDate", "parentEmail", "instituteName", "providerContactForename", "providerContactSurname", "cohortContactForename", "cohortContactSurname", "cohortContactEmail", "addressLineOne", "addressLineTwo", "city", "postalCode", "country"],
|
|
779
|
+
button: {text: "Complete feedback", link: "/review/{{uid}}/{{pId}}/{{key}}"},
|
|
780
|
+
type: "feedback"
|
|
781
|
+
},
|
|
782
|
+
parentWelcomeEmail: {
|
|
783
|
+
description: "Send to the parent once the students account is activated.",
|
|
784
|
+
params: ["studentForename", "studentSurname", "studentEmail", "parentEmail", "instituteName", "cohortContactForename", "cohortContactSurname", "cohortContactEmail"],
|
|
785
|
+
type: "feedback"
|
|
786
|
+
},
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
export const MISQueryParams = {
|
|
790
|
+
arbor: [{
|
|
791
|
+
label: "Year group",
|
|
792
|
+
name: "year",
|
|
793
|
+
description: "Enter the year group in the below box, as it appears in the academicLevel__academicLevelName value in Arbor.",
|
|
794
|
+
placeholder: "E.g. 'Year X'",
|
|
795
|
+
}],
|
|
796
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useState
|
|
1
|
+
import {useState} from "react"
|
|
2
2
|
import FirebaseQuery from "../../firebase/firebaseQuery"
|
|
3
3
|
import {where} from "firebase/firestore"
|
|
4
4
|
import {StudentPlacementData, UserData} from "../../typeDefinitions"
|
|
@@ -12,30 +12,39 @@ export function useAnalyticsCard({user}: {user: UserData}){
|
|
|
12
12
|
const [_, setPlacementsWithoutAnalytics] = useState<{[key:string]: StudentPlacementData}>();
|
|
13
13
|
const firebaseQuery = new FirebaseQuery();
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
const fetchAnalyticsCardDetails = async () => {
|
|
16
|
+
try {
|
|
17
|
+
setTotal(await firebaseQuery.getCount("placements", [where("uid", "==", user.id)]))
|
|
18
|
+
setCompleted(await firebaseQuery.getCount("placements", [where("uid", "==", user.id), where("completed", "==", true)]))
|
|
19
|
+
setPlacementsWithoutAnalytics(await firebaseQuery.getDocsWhere("placements", [where("uid", "==", user.id)]) as {[key:string]: StudentPlacementData});
|
|
20
|
+
|
|
21
|
+
} catch(error) {
|
|
22
|
+
console.log(error)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
}
|
|
21
26
|
|
|
22
27
|
|
|
23
|
-
return ({...{total, completed}})
|
|
28
|
+
return ({...{total, completed, fetchAnalyticsCardDetails}})
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
export function useAnalyticsViews(user: UserData | null){
|
|
27
32
|
const [placementsWithoutAnalytics, setPlacementsWithoutAnalytics] = useState<{[key:string]: StudentPlacementData}>();
|
|
28
33
|
const firebaseQuery = new FirebaseQuery();
|
|
29
34
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const p = Object.fromEntries(Object.entries(
|
|
35
|
+
const fetchAnalyticsViews = async () => {
|
|
36
|
+
try {
|
|
37
|
+
const docs = await firebaseQuery.getDocsWhere("placements", [where("uid", "==", user?.id)])
|
|
38
|
+
const p = Object.fromEntries(Object.entries(docs as {[key:string]: StudentPlacementData}).filter(([_, v]) => (!v.units || !v.personalAnalytics)))
|
|
34
39
|
setPlacementsWithoutAnalytics(p)
|
|
35
|
-
});
|
|
36
|
-
}, [user]);
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
} catch(error) {
|
|
42
|
+
console.log(error)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return ({...{placementsWithoutAnalytics, fetchAnalyticsViews}})
|
|
39
48
|
|
|
40
49
|
}
|
|
41
50
|
|
|
@@ -44,8 +53,7 @@ export function useReviewPlacementItem(id: string, onComplete: () => void){
|
|
|
44
53
|
const dispatch = useAppDispatch()
|
|
45
54
|
|
|
46
55
|
const submitPlacementData = async (type: "upcoming" | "completed") => {
|
|
47
|
-
if (!analytics?.units
|
|
48
|
-
console.log("PLACEMENTTTT", id);
|
|
56
|
+
if (!analytics?.units) return;
|
|
49
57
|
// await firebaseQuery.update(["placements", id], analytics);
|
|
50
58
|
type === "upcoming" ? dispatch(updateUpcomingStudentPlacement({placementId: id, attributes: analytics})) : dispatch(updateCompletedStudentPlacement({placementId: id, attributes: analytics}))
|
|
51
59
|
onComplete()
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import {where} from "firebase/firestore";
|
|
2
2
|
import FirebaseQuery from "../../../firebase/firebaseQuery";
|
|
3
|
-
import {
|
|
3
|
+
import {useState} from "react";
|
|
4
4
|
import { UserData } from "../../../typeDefinitions";
|
|
5
5
|
|
|
6
6
|
export function useDowntime({user}: {user: UserData}){
|
|
7
7
|
const [downtime, setDowntime] = useState<{title: string, body: string}|false>();
|
|
8
8
|
const firebaseQuery = new FirebaseQuery();
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const fetchDownTime = async () => {
|
|
11
|
+
try {
|
|
12
|
+
const docs = await firebaseQuery.getDocsWhere("downtime", [where("products", "array-contains", user?.product), where("active", "==", true)])
|
|
13
13
|
const downtimeDocs = { ...docs as {[key: string]: {title: string, body: string}}};
|
|
14
14
|
setDowntime(downtimeDocs[Object.keys(downtimeDocs)[0]] || false);
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
|
|
16
|
+
} catch(error) {
|
|
17
|
+
console.log(error)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
17
21
|
|
|
18
|
-
return ({...{downtime, setDowntime}})
|
|
22
|
+
return ({...{downtime, setDowntime, fetchDownTime}})
|
|
19
23
|
|
|
20
24
|
}
|
|
@@ -59,7 +59,7 @@ export function useContactProviderConsent({user}: {user: UserData}){
|
|
|
59
59
|
try {
|
|
60
60
|
await firebaseQuery.update(["users", user.id], {
|
|
61
61
|
contactProviderConsent: consent,
|
|
62
|
-
|
|
62
|
+
contactProviderConsentDate: (new Date()).toISOString()
|
|
63
63
|
})
|
|
64
64
|
// dispatch(updateUser({userId: user.id, attributes: {
|
|
65
65
|
// contactProviderConsent: consent,
|
|
@@ -4,7 +4,11 @@ export type Job = {
|
|
|
4
4
|
id: string
|
|
5
5
|
description: string
|
|
6
6
|
finished: string
|
|
7
|
-
logs: Array<
|
|
7
|
+
logs: Array<{
|
|
8
|
+
severity?: string,
|
|
9
|
+
title: string,
|
|
10
|
+
description: string,
|
|
11
|
+
}>
|
|
8
12
|
oId: string
|
|
9
13
|
outputMsg: string
|
|
10
14
|
product: string
|
|
@@ -55,12 +59,14 @@ export const JobsSlice = createSlice({
|
|
|
55
59
|
state.values[action.payload.jobId].status = action.payload.status;
|
|
56
60
|
state.values[action.payload.jobId].updated = (new Date()).toISOString();
|
|
57
61
|
},
|
|
58
|
-
|
|
62
|
+
updateJob: (state, action) => {
|
|
63
|
+
state.values[action.payload.jobId] = action.payload.data;
|
|
64
|
+
},
|
|
59
65
|
|
|
60
66
|
},
|
|
61
67
|
|
|
62
68
|
});
|
|
63
69
|
|
|
64
|
-
export const {setJobs, addJob, setMarkRead, setJobStatus} = JobsSlice.actions;
|
|
70
|
+
export const {setJobs, addJob, setMarkRead, setJobStatus, updateJob} = JobsSlice.actions;
|
|
65
71
|
|
|
66
72
|
export default JobsSlice.reducer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {createSlice, createAsyncThunk} from "@reduxjs/toolkit";
|
|
2
2
|
import FirebaseQuery from "../../../firebase/firebaseQuery";
|
|
3
3
|
import { StudentPlacementData } from "../../../typeDefinitions"
|
|
4
|
-
import { where } from "firebase/firestore";
|
|
4
|
+
import { orderBy, where } from "firebase/firestore";
|
|
5
5
|
|
|
6
6
|
type InitialActivePlacementSlice = {
|
|
7
7
|
status: string
|
|
@@ -18,7 +18,7 @@ export const fetchActivePlacement = createAsyncThunk(
|
|
|
18
18
|
async ({userId}: {userId: string}) => {
|
|
19
19
|
const firebaseQuery = new FirebaseQuery();
|
|
20
20
|
try {
|
|
21
|
-
const docs = await firebaseQuery.getDocsWhere(["placements"], [where("active", "==", true), where("uid", "==", userId)]);
|
|
21
|
+
const docs = await firebaseQuery.getDocsWhere(["placements"], [where("active", "==", true), where("uid", "==", userId), where("completed", "==", false), orderBy("endDate")]);
|
|
22
22
|
const d = { ...docs as { [key: string]: StudentPlacementData } };
|
|
23
23
|
return d[Object.keys(d)[0]] || undefined;
|
|
24
24
|
|
|
@@ -36,7 +36,12 @@ export const activePlacementSlice = createSlice({
|
|
|
36
36
|
reducers: {
|
|
37
37
|
setActivePlacement: (state, action) => {
|
|
38
38
|
state.values = action.payload
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
editActivePlacement: (state, action) => {
|
|
42
|
+
state.values = {...state.values, ...action.payload}
|
|
39
43
|
}
|
|
44
|
+
|
|
40
45
|
},
|
|
41
46
|
|
|
42
47
|
extraReducers(builder) {
|
|
@@ -59,6 +64,6 @@ export const activePlacementSlice = createSlice({
|
|
|
59
64
|
})
|
|
60
65
|
|
|
61
66
|
|
|
62
|
-
export const {setActivePlacement} = activePlacementSlice.actions
|
|
67
|
+
export const {setActivePlacement, editActivePlacement} = activePlacementSlice.actions
|
|
63
68
|
|
|
64
69
|
export default activePlacementSlice.reducer;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {createSlice, createAsyncThunk} from "@reduxjs/toolkit";
|
|
2
2
|
import FirebaseQuery from "../../../firebase/firebaseQuery";
|
|
3
3
|
import { PlacementState } from "../types";
|
|
4
|
+
import { StudentPlacementData } from "../../../typeDefinitions";
|
|
4
5
|
|
|
5
6
|
const initialState: PlacementState = {
|
|
6
7
|
status: "",
|
|
@@ -11,7 +12,7 @@ const initialState: PlacementState = {
|
|
|
11
12
|
|
|
12
13
|
export const updateCompletedStudentPlacement = createAsyncThunk(
|
|
13
14
|
"completedStudentPlacements/updateStudentPlacement",
|
|
14
|
-
async ({ placementId, attributes }:{placementId: string, attributes:
|
|
15
|
+
async ({ placementId, attributes }:{placementId: string, attributes: Partial<StudentPlacementData>}, {rejectWithValue}) => {
|
|
15
16
|
const firebaseQuery = new FirebaseQuery();
|
|
16
17
|
try {
|
|
17
18
|
await firebaseQuery.update(["placements", placementId], attributes);
|
|
@@ -76,7 +77,9 @@ export const completedStudentPlacementsSlice = createSlice({
|
|
|
76
77
|
extraReducers(builder){
|
|
77
78
|
builder
|
|
78
79
|
.addCase(updateCompletedStudentPlacement.fulfilled, (state, action) => {
|
|
79
|
-
|
|
80
|
+
const {attributes, placementId} = action.payload
|
|
81
|
+
if (!placementId) return
|
|
82
|
+
state.values[placementId] = {...state.values[placementId], ...attributes};
|
|
80
83
|
})
|
|
81
84
|
|
|
82
85
|
|
|
@@ -18,7 +18,7 @@ const initialState: UpcomingPlacementState = {
|
|
|
18
18
|
|
|
19
19
|
export const updateUpcomingStudentPlacement = createAsyncThunk(
|
|
20
20
|
"upcomingStudentPlacements/updateStudentPlacement",
|
|
21
|
-
async ({ placementId, attributes }:{placementId: string, attributes:
|
|
21
|
+
async ({ placementId, attributes }:{placementId: string, attributes: Partial<StudentPlacementData>}, {rejectWithValue}) => {
|
|
22
22
|
const firebaseQuery = new FirebaseQuery();
|
|
23
23
|
try {
|
|
24
24
|
await firebaseQuery.update(["placements", placementId], attributes);
|
|
@@ -90,7 +90,7 @@ export const upcomingStudentsPlacementsSlice = createSlice({
|
|
|
90
90
|
.addCase(updateUpcomingStudentPlacement.fulfilled, (state, action) => {
|
|
91
91
|
const {attributes, placementId} = action.payload
|
|
92
92
|
if (!placementId) return
|
|
93
|
-
state.values[placementId] = attributes;
|
|
93
|
+
state.values[placementId] = {...state.values[placementId], ...attributes};
|
|
94
94
|
})
|
|
95
95
|
|
|
96
96
|
|
|
@@ -1,33 +1,9 @@
|
|
|
1
|
-
import { QueryConstraint
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import FirebaseQuery from "../../../firebase/firebaseQuery";
|
|
4
|
-
import { getPlacementsWhere } from "../../../firebase/readDatabase";
|
|
5
|
-
import { convertDate } from "../../../firebase/util";
|
|
1
|
+
import { QueryConstraint } from "firebase/firestore";
|
|
6
2
|
import { useStudentPlacementList } from "../../../hooks";
|
|
7
|
-
import {
|
|
3
|
+
import { UserData } from "../../../typeDefinitions";
|
|
8
4
|
|
|
9
|
-
export function useStudentPlacements({user, uid, queryConstraint}: {user: UserData, uid?: string, queryConstraint?: QueryConstraint[]}){
|
|
10
|
-
const [activePlacement, setActivePlacement] = useState<StudentPlacementData>();
|
|
5
|
+
export function useStudentPlacements({user, uid, queryConstraint}: {user: UserData, uid?: string, queryConstraint?: QueryConstraint[]}){
|
|
11
6
|
const {placements, loadMoreIcon, loadMorePlacements, setQuery, setInitialQueryLimit, reset} = useStudentPlacementList({...{user: user as UserData, uid: uid || user?.id, queryConstraint}})
|
|
12
7
|
|
|
13
|
-
|
|
14
|
-
firebaseQuery.getDocsWhere(["placements"], [where("active", "==", true), where("uid", "==", user?.id)]).then((docs) => {
|
|
15
|
-
const d = {...docs as {[key:string]: StudentPlacementData}}
|
|
16
|
-
setActivePlacement(d[Object.keys(d)[0]] || undefined);
|
|
17
|
-
});
|
|
18
|
-
}, [user?.id]);
|
|
19
|
-
|
|
20
|
-
const getUserPlacements = async () => {
|
|
21
|
-
return await getPlacementsWhere({w: where("uid", "==", user?.id)})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const getPlacementsStart = async (start: Date, end: Date) => {
|
|
25
|
-
return await firebaseQuery.getDocsWhere("placements", [where("uid", "==", user?.id), where("startDate", ">=", convertDate(start, "dbstring")), where("startDate", "<=", convertDate(end, "dbstring"))]) as {[key:string]: StudentPlacementData};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const getPlacementsEnd = async (end: Date) => {
|
|
29
|
-
return await firebaseQuery.getDocsWhere("placements", [where("uid", "==", user?.id), where("endDate", ">=", convertDate(end, "dbstring")), where("endDate", "<=", convertDate(end, "dbstring"))]) as {[key:string]: StudentPlacementData};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return ({...{placements, loadMoreIcon, loadMorePlacements, setQuery, setInitialQueryLimit, resetPlacements: reset, getUserPlacements, getPlacementsStart, getPlacementsEnd, activePlacement}});
|
|
8
|
+
return ({...{placements, loadMoreIcon, loadMorePlacements, setQuery, setInitialQueryLimit, resetPlacements: reset}});
|
|
33
9
|
}
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import FirebaseQuery from "../../firebase/firebaseQuery";
|
|
2
2
|
import {orderBy, limit, arrayUnion} from "firebase/firestore";
|
|
3
|
-
import {useState
|
|
3
|
+
import {useState} from "react";
|
|
4
4
|
import { UserData } from "../../typeDefinitions";
|
|
5
5
|
|
|
6
6
|
export function useUpdates({user}: {user: UserData}){
|
|
7
7
|
const [active, setActive] = useState<{title: string, body: string, id: string}>();
|
|
8
8
|
const firebaseQuery = new FirebaseQuery();
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
const fetchUpdates = async () => {
|
|
11
|
+
try {
|
|
12
|
+
const docs = await firebaseQuery.getDocsWhere("updates", [orderBy("created", "desc"), limit(1)])
|
|
13
|
+
const item = Object.values(docs as {[key:string]: {title: string, body: string, id: string}})[0];
|
|
14
|
+
if (!user?.readUpdates?.includes(item.id)) setActive(item);
|
|
15
|
+
|
|
16
|
+
} catch(error) {
|
|
17
|
+
console.log(error)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
20
22
|
|
|
21
23
|
const dismiss = () => {
|
|
22
24
|
if (!user) return
|
|
@@ -31,6 +33,6 @@ export function useUpdates({user}: {user: UserData}){
|
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
return ({...{active, dismiss}})
|
|
36
|
+
return ({...{active, dismiss, fetchUpdates}})
|
|
35
37
|
|
|
36
38
|
}
|