Skip to content

Commit 54664b3

Browse files
committed
Standing Documents
1 parent 69aa5dd commit 54664b3

File tree

6 files changed

+488
-210
lines changed

6 files changed

+488
-210
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/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 });
Lines changed: 51 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
11
<template>
2-
<v-menu
3-
:disabled="disabled"
4-
v-model="menu_change"
5-
:close-on-content-click="false"
6-
transition="scale-transition"
7-
left
8-
nudge-top="26"
9-
offset-y
10-
min-width="auto"
11-
>
12-
<template v-slot:activator="{ on, attrs }">
13-
<v-text-field
14-
:disabled="disabled"
15-
v-model="date_formatted"
16-
:label="label"
17-
hide-details
18-
readonly
19-
outlined
20-
dense
21-
background-color="white"
22-
v-bind="attrs"
23-
v-on="on"
24-
clearable
25-
></v-text-field>
26-
</template>
27-
<v-date-picker
2+
<v-menu
3+
:disabled="disabled"
4+
v-model="menu_change"
5+
:close-on-content-click="false"
6+
transition="scale-transition"
7+
left
8+
nudge-top="26"
9+
offset-y
10+
min-width="auto"
11+
>
12+
<template v-slot:activator="{ on, attrs }">
13+
<v-text-field
2814
:disabled="disabled"
2915
v-model="date_formatted"
30-
@input="e => {
31-
$emit('input', e);
32-
menu_change = false;
33-
}"
34-
></v-date-picker>
35-
</v-menu>
16+
:label="label"
17+
hide-details
18+
readonly
19+
outlined
20+
dense
21+
background-color="white"
22+
v-bind="attrs"
23+
v-on="on"
24+
clearable
25+
@click:clear="$emit('input', null)"
26+
></v-text-field>
27+
</template>
28+
<v-date-picker
29+
:disabled="disabled"
30+
v-model="date_formatted"
31+
@input="
32+
(e) => {
33+
$emit('input', e);
34+
menu_change = false;
35+
}
36+
"
37+
></v-date-picker>
38+
</v-menu>
3639
</template>
3740

3841
<script>
@@ -45,32 +48,33 @@ export default {
4548
props: ["value", "label", "disabled", "menu"],
4649
data() {
4750
return {
48-
date_formatted: null,
49-
menu_change: false,
51+
date_formatted: null,
52+
menu_change: false,
5053
};
5154
},
52-
methods: {
55+
methods: {
5356
formatDate(value) {
5457
if (value) {
5558
return dateHelper.getDateFromUTC(value);
5659
}
5760
return null;
58-
}
61+
},
5962
},
6063
watch: {
6164
value: {
62-
immediate: true,
63-
handler(newVal) {
64-
this.date_formatted = this.formatDate(newVal);
65-
this.$emit("input", newVal);
66-
}
65+
immediate: true,
66+
handler(newVal) {
67+
this.date_formatted = this.formatDate(newVal);
68+
this.$emit("input", newVal);
69+
this.$emit("change", newVal);
70+
},
6771
},
6872
menu: {
69-
immediate: true,
70-
handler(newVal) {
71-
this.menu_change = newVal;
72-
}
73-
}
73+
immediate: true,
74+
handler(newVal) {
75+
this.menu_change = newVal;
76+
},
77+
},
7478
},
7579
};
76-
</script>
80+
</script>

0 commit comments

Comments
 (0)