Skip to content

Commit 11e51b6

Browse files
authored
Merge pull request #378 from icefoganalytics/test
Standing docs and letters
2 parents 8f85bea + 54664b3 commit 11e51b6

File tree

12 files changed

+557
-261
lines changed

12 files changed

+557
-261
lines changed

db/2025_updates.sql

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,11 @@ CREATE TABLE sfa.noc_codes (
66
noc_2021_code NVARCHAR(10) ,
77
noc_2021_title NVARCHAR(255),
88
notes NVARCHAR(max)
9-
);
9+
);
10+
11+
12+
ALTER TABLE sfa.student
13+
ADD json_data NVARCHAR(MAX);
14+
15+
ALTER TABLE sfa.application
16+
ADD json_data NVARCHAR(MAX);

src/api/models/request-type.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export enum RequestTypes {
3232
GRANT_FOR_STUDENTS_WITH_PERMANENT_DISABILITIES_PT = 34,
3333
GRANT_FOR_FULL_TIME_STUDENTS = 35,
3434
MATURE = 41,
35+
STUDENT_TRAINING_ALLOWANCE_OTHER = 46,
3536
}
3637

3738
interface RequestTypeRecord {

src/api/models/student.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ interface StudentRecord {
5151
kinCountryId?: number;
5252
kinPostalCode?: string;
5353

54+
json_data?: any;
55+
5456
// Relations
5557
dependents?: Dependent[];
5658
person?: Person;

src/api/routes/admin/student-router.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import express, { Request, Response } from "express";
1+
import express, { json, Request, Response } from "express";
22
import { body, param } from "express-validator";
33
import moment from "moment";
44
import knex from "knex";
@@ -55,6 +55,26 @@ studentRouter.post(
5555
}
5656
);
5757

58+
studentRouter.patch(
59+
"/:id",
60+
[param("id").isInt().notEmpty()],
61+
ReturnValidationErrors,
62+
async (req: Request, res: Response) => {
63+
const { id } = req.params;
64+
const student = await db("sfa.student").where({ id }).first();
65+
66+
if (req.body.json_data) req.body.json_data = JSON.stringify(req.body.json_data);
67+
68+
if (!isNil(student)) {
69+
await db("sfa.student")
70+
.where({ id })
71+
.update({ ...req.body });
72+
73+
res.json({ messages: [{ variant: "success", text: "Student saved" }] });
74+
} else res.status(404).send({ messages: [{ variant: "error", text: "Student not found" }] });
75+
}
76+
);
77+
5878
studentRouter.put(
5979
"/:student_id",
6080
[param("student_id").isInt().notEmpty()],
@@ -515,6 +535,7 @@ ${item.address_display}`;
515535
csl_warn_code: student.csl_warn_code,
516536
csl_letter_date: student.csl_letter_date,
517537
pre_over_award_amount: student.pre_over_award_amount,
538+
json_data: JSON.parse(student.json_data),
518539
};
519540

520541
return res.status(200).json({ data });

src/api/serializers/funding-requests/letters/student-training-allowance-alkan-air-approval-template-serializer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export default class StudentTrainingAllowanceAlkanAirApprovalTemplateSerializer
138138
name: studyArea.description,
139139
startDate: assessment.classesStartDate,
140140
endDate: assessment.classesEndDate,
141+
effectiveRateDate: assessment.effectiveRateDate,
141142
institutionName,
142143
ratePerWeekInCents,
143144
travelAllowanceInCents,

src/api/serializers/funding-requests/letters/student-training-allowance-yukon-university-approval-template-serializer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export default class StudentTrainingAllowanceYukonUniversityApprovalTemplateSeri
138138
name: studyArea.description,
139139
startDate: assessment.classesStartDate,
140140
endDate: assessment.classesEndDate,
141+
effectiveRateDate: assessment.effectiveRateDate,
141142
institutionName,
142143
ratePerWeekInCents,
143144
travelAllowanceInCents,

src/api/services/admin/funding-requests/letters/create-service.ts

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -67,27 +67,12 @@ export default class CreateService {
6767
currentUser,
6868
});
6969
} else if (requestType === RequestType.Types.STUDENT_TRAINING_ALLOWANCE && requestStatus === Status.Types.AWARDED) {
70-
// FUTURE: this could become a separate service
71-
const institutionName = this.#getInstitutionName(fundingRequest);
72-
if (institutionName === Institution.Names.YUKON_UNIVERSITY) {
73-
return this.#generateStudentTrainingAllowanceYukonUniversityApprovalLetter({
74-
director,
75-
uploader,
76-
fundingRequest,
77-
currentUser,
78-
});
79-
} else if (institutionName === Institution.Names.ALKAN_AIR_FLIGHT_TRAINING) {
80-
return this.#generateStudentTrainingAllowanceAlkanAirApprovalLetter({
81-
director,
82-
uploader,
83-
fundingRequest,
84-
currentUser,
85-
});
86-
} else {
87-
throw new Error(
88-
`Could not generate Student Training Allowance letter for institution name: ${institutionName}`
89-
);
90-
}
70+
return this.#generateStudentTrainingAllowanceYukonUniversityApprovalLetter({
71+
director,
72+
uploader,
73+
fundingRequest,
74+
currentUser,
75+
});
9176
} else if (
9277
requestType === RequestType.Types.STUDENT_TRAINING_ALLOWANCE &&
9378
requestStatus === Status.Types.REJECTED
@@ -98,6 +83,26 @@ export default class CreateService {
9883
fundingRequest,
9984
currentUser,
10085
});
86+
} else if (
87+
requestType === RequestType.Types.STUDENT_TRAINING_ALLOWANCE_OTHER &&
88+
requestStatus === Status.Types.AWARDED
89+
) {
90+
return this.#generateStudentTrainingAllowanceAlkanAirApprovalLetter({
91+
director,
92+
uploader,
93+
fundingRequest,
94+
currentUser,
95+
});
96+
} else if (
97+
requestType === RequestType.Types.STUDENT_TRAINING_ALLOWANCE_OTHER &&
98+
requestStatus === Status.Types.REJECTED
99+
) {
100+
return this.#generateStudentTrainingAllowanceRejectionLetter({
101+
director,
102+
uploader,
103+
fundingRequest,
104+
currentUser,
105+
});
101106
} else if (
102107
requestType === RequestType.Types.CANADA_STUDENT_LOAN_FULL_TIME &&
103108
requestStatus === Status.Types.AWARDED

src/api/templates/admin/application-letter/approval/student-training-allowance-alkan-air.handlebars

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
</p>
2828

2929
<p>
30-
I am pleased to inform you that your Student Training Allowance (STA) application has been
31-
approved as follows:
30+
I am pleased to inform you that your Student Training Allowance (STA) application has been approved as follows:
3231
</p>
3332

3433
<p>
@@ -41,6 +40,13 @@
4140
</span>
4241
<span class="flex justify-between">
4342
<strong>Institution: {{program.institutionName}}</strong>
43+
<span>
44+
<strong>Effective Rate Date:</strong>
45+
<span class="ml-4">{{momentDateFormat program.effectiveRateDate "MMM Do, YYYY"}}</span>
46+
</span>
47+
</span>
48+
<span class="flex justify-between">
49+
<strong>&nbsp;</strong>
4450
<span>
4551
<strong>End Date:</strong>
4652
<span class="ml-4">{{momentDateFormat program.endDate "MMM Do, YYYY"}}</span>
@@ -64,29 +70,28 @@
6470
</p>
6571

6672
<p>
67-
This funding covers the study period indicated above, up to a maximum of 40 weeks per academic
68-
year. If your application was received more than 14 days after the start of your classes, your
69-
start date above will reflect the date that your completed application was received.
73+
This funding covers the study period indicated above, up to a maximum of 40 weeks per academic year. If your
74+
application was received more than 14 days after the start of your classes, the effective rate date above will
75+
reflect the date that your completed application was received.
7076
</p>
7177

7278
<div>
7379
<strong>Your responsibilities:</strong>
7480

7581
<ul>
7682
<li>Ensure the information above regarding your funding is accurate.</li>
77-
<li>Before your program begins, provide banking information for direct deposit to Yukon
78-
Student Financial Assistance (SFA) by submitting a Direct Deposit Authorization Form
79-
including your direct deposit information to
83+
<li>Before your program begins, provide banking information for direct deposit to Yukon Student Financial
84+
Assistance (SFA) by submitting a Direct Deposit Authorization Form including your direct deposit information to
8085
<a href="mailto:sfa@yukon.ca">sfa@yukon.ca</a>. You can download the Authorization Form at
8186
<a
8287
href="http://yukon.ca/en/direct-deposit-authorziation-form"
8388
>http://yukon.ca/en/direct-deposit-authorziation-form</a>.</li>
84-
<li>If you stop attending classes, drop to part-time, or withdraw from classes, inform our
85-
office or Alkan Air to avoid having to pay back any STA.</li>
86-
<li>If you are or will be receiving financial assistance from any other source, check with our
87-
office to avoid having to pay back any STA.</li>
88-
<li>Yukon SFA will send you an email with the process required for confirming your regular
89-
attendance at {{program.institutionName}}.
89+
<li>If you stop attending classes, drop to part-time, or withdraw from classes, inform our office or Alkan Air to
90+
avoid having to pay back any STA.</li>
91+
<li>If you are or will be receiving financial assistance from any other source, check with our office to avoid
92+
having to pay back any STA.</li>
93+
<li>Yukon SFA will send you an email with the process required for confirming your regular attendance at
94+
{{program.institutionName}}.
9095
</li>
9196
</ul>
9297
</div>
@@ -106,4 +111,4 @@
106111
<br />
107112
Department of Education, Government of Yukon
108113
</p>
109-
</div>
114+
</div>

src/api/templates/admin/application-letter/approval/student-training-allowance-yukon-university.handlebars

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
</p>
2828

2929
<p>
30-
I am pleased to inform you that your Student Training Allowance (STA) application has been
31-
approved as follows:
30+
I am pleased to inform you that your Student Training Allowance (STA) application has been approved as follows:
3231
</p>
3332

3433
<p>
@@ -41,6 +40,13 @@
4140
</span>
4241
<span class="flex justify-between">
4342
<strong>Institution: {{program.institutionName}}</strong>
43+
<span>
44+
<strong>Effective Rate Date:</strong>
45+
<span class="ml-4">{{momentDateFormat program.effectiveRateDate "MMM Do, YYYY"}}</span>
46+
</span>
47+
</span>
48+
<span class="flex justify-between">
49+
<strong>&nbsp;</strong>
4450
<span>
4551
<strong>End Date:</strong>
4652
<span class="ml-4">{{momentDateFormat program.endDate "MMM Do, YYYY"}}</span>
@@ -64,29 +70,28 @@
6470
</p>
6571

6672
<p>
67-
This funding covers the study period indicated above, up to a maximum of 40 weeks per academic
68-
year. If your application was received more than 14 days after the start of your classes, your
69-
start date above will reflect the date that your completed application was received.
73+
This funding covers the study period indicated above, up to a maximum of 40 weeks per academic year. If your
74+
application was received more than 14 days after the start of your classes, the effective rate date above will
75+
reflect the date that your completed application was received.
7076
</p>
7177

7278
<div>
7379
<strong>Your responsibilities:</strong>
7480

7581
<ul>
7682
<li>Ensure the information above regarding your funding is accurate.</li>
77-
<li>Before your program begins, provide banking information for direct deposit to Yukon
78-
University. The payroll clerk can be reached at
83+
<li>Before your program begins, provide banking information for direct deposit to Yukon University. The payroll
84+
clerk can be reached at
7985
<a href="tel:867-668-8717">867-668-8717</a>
8086
(toll free at
8187
<a href="1-800-661-0504;8717">1-800-661-0504 extension 8717</a>).</li>
82-
<li>If you stop attending classes, drop to part-time, or withdraw from classes, inform our
83-
office or the Institution to avoid having to pay back any STA.</li>
84-
<li>If you are or will be receiving financial assistance from any other source, check with our
85-
office to avoid having to pay back any STA.</li>
88+
<li>If you stop attending classes, drop to part-time, or withdraw from classes, inform our office or the
89+
Institution to avoid having to pay back any STA.</li>
90+
<li>If you are or will be receiving financial assistance from any other source, check with our office to avoid
91+
having to pay back any STA.</li>
8692
<li>You will be required to sign in regularly to receive STA.</li>
87-
<li>The Financial Aid Advisor with the Office of the Registrar at Yukon University will send
88-
an email to your Yukon University email with the process required for confirming your
89-
regular attendance at the University.
93+
<li>The Financial Aid Advisor with the Office of the Registrar at Yukon University will send an email to your
94+
Yukon University email with the process required for confirming your regular attendance at the University.
9095
</li>
9196
</ul>
9297
</div>
@@ -106,4 +111,4 @@
106111
<br />
107112
Department of Education, Government of Yukon
108113
</p>
109-
</div>
114+
</div>

0 commit comments

Comments
 (0)