Skip to content

Commit

Permalink
Adding school placement preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
PeteWilliams committed Aug 22, 2024
1 parent 56127ee commit 571183e
Show file tree
Hide file tree
Showing 4 changed files with 287 additions and 13 deletions.
24 changes: 21 additions & 3 deletions app/routes/applications.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,37 @@ module.exports = router => {
})
})

router.get('/applications/:id/school-placement', (req, res) => {
router.get('/applications/:id/school-placement(-second)?', (req, res) => {
console.log(req.params);
const { id } = req.params
var priority = req.params[0]
if ( priority) {
priority = priority.substring(1)
} else {
priority = 'first'
}

const placementItems = data.placements
var placementItems = data.placements
.sort((a, b) => (a.name.localeCompare(b.name)))
.map(placement => ({ text: placement.name, value: placement.name, hint: { text: placement.address } }))

placementItems.unshift({'text': 'I have no preference', value: 'I have no preference'})

res.render('applications/school-placement', {
id,
priority,
placementItems
})
})

router.get('/applications/:id/school-placement-preferences', (req, res) => {
const { id } = req.params
res.render('applications/school-placement-preferences', {
id
})
})


router.get('/applications/:id/courses-other', (req, res) => {
const { id } = req.params

Expand Down Expand Up @@ -362,4 +380,4 @@ module.exports = router => {

res.redirect('/accepted')
})
}
}
106 changes: 103 additions & 3 deletions app/views/applications/review.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ <h1 class="govuk-heading-l">{{ title }}</h1>

<p class="govuk-body">This information and your details will be shared with {{ application.providerName }} when you submit your application.</p>

{% if application.placement.location == "home" %}
{% set locationAnswer = "My home address (" + ( data.address.postalCode or "KT23 3NW" ) + ")" %}
{% elseif application.placement.location == "another" %}
{% set locationAnswer = application.placement.otherLocation %}
{% else %}
{% set locationAnswer = "I am open to relocating" %}
{% endif %}

{{ govukSummaryList({
rows: [
{
Expand Down Expand Up @@ -55,10 +63,10 @@ <h1 class="govuk-heading-l">{{ title }}</h1>
},
{
key: {
text: "Location"
text: "First choice placement"
},
value: {
html: application.placement
html: application.placement.first
},
actions: {
items: [
Expand All @@ -68,7 +76,99 @@ <h1 class="govuk-heading-l">{{ title }}</h1>
}
]
}
}
},
{
key: {
text: "Second choice placement"
},
value: {
html: application.placement.second
},
actions: {
items: [
{
text: "Change",
href: "/applications/" + id + "/school-placement-second"
}
]
}
},
{
key: {
text: "Where you will travel from"
},
value: {
html: locationAnswer
},
actions: {
items: [
{
text: "Change",
href: "/applications/" + id + "/school-placement-preferences"
}
]
}
},
{
key: {
text: "Constraints on your time"
},
value: {
text: ("Yes" if application.placement.constraints == "yes" else "No")
},
actions: {
items: [
{
text: "Change",
href: "/applications/" + id + "/school-placement-preferences"
}
]
}
},
{
key: {
text: "Relevant information"
},
value: {
html: application.placement.constraintsDetails
},
actions: {
items: [{
text: "Change",
href: "/applications/" + id + "/school-placement-preferences"
}]
}
} if application.placement.constraints === "yes",
{
key: {
text: "Anything else"
},
value: {
text: ("Yes" if application.placement.other == "yes" else "No")
},
actions: {
items: [
{
text: "Change",
href: "/applications/" + id + "/school-placement-preferences"
}
]
}
},
{
key: {
text: "Relevant information"
},
value: {
html: application.placement.otherDetails
},
actions: {
items: [{
text: "Change",
href: "/applications/" + id + "/school-placement-preferences"
}]
}
} if application.placement.other === "yes"
]
})}}

Expand Down
149 changes: 149 additions & 0 deletions app/views/applications/school-placement-preferences.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
{% extends "layouts/main.html" %}

{% set primaryNavId = "applications" %}

{% set title = "Select your " + priority + " choice placement" %}
{% set application = data.applications[id] %}

{% block beforeContent %}
{{ govukBackLink({
href: "/applications/" + id + "/course"
}) }}
{% endblock %}

{% block content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-three-quarters">
<span class="govuk-caption-l">{{ application.providerName }}</span>
<h1 class="govuk-heading-l">School placement preferences</h1>

<p class="govuk-body">Your training provider will work with you to select placements that suit your needs.</p>
<p class="govuk-body">You can also talk to them at interview about your needs.</p>

<form action="/applications/{{ id }}/review" method="post">

{% set locationHtml %}
{{ govukInput({
id: "other-location",
name: "applications[" + id + "][placement][otherLocation]",
value: data.applications[id].placement.otherLocation,
classes: "govuk-!-width-one-third",
label: {
text: "Postcode or town name"
}
}) }}
{% endset -%}

{{ govukRadios({
name: "applications[" + id + "][placement][location]",
value: data.applications[id].placement.location,
fieldset: {
legend: {
text: "Where will you travel to your placement from? (optional)",
isPageHeading: false,
classes: "govuk-fieldset__legend--m"
}
},
items: [
{
value: "home",
text: "My home address (" + ( data.address.postalCode or "KT23 3NW" ) + ")"
},
{
value: "another",
text: "Another location",
conditional: {
html: locationHtml
}
},
{
value: "relocating",
text: "I am open to relocating"
}
]
}) }}

{% set constraintsHtml %}
{{ govukTextarea({
id: "constraints-details",
name: "applications[" + id + "][placement][constraintsDetails]",
value: data.applications[id].placement.constraintsDetails,
classes: "govuk-!-width-full",
label: {
text: "Enter more detail"
}
}) }}
{% endset -%}

{{ govukRadios({
name: "applications[" + id + "][placement][constraints]",
value: data.applications[id].placement.constraints,
fieldset: {
legend: {
text: "Do you have any constraints on your time? (optional)",
isPageHeading: false,
classes: "govuk-fieldset__legend--m"
}
},
hint: {
text: "For example, you need to do the school run."
},
items: [
{
value: "yes",
text: "Yes",
conditional: {
html: constraintsHtml
}
},
{
value: "no",
text: "No"
}
]
}) }}

{% set otherHtml %}
{{ govukTextarea({
id: "other-details",
name: "applications[" + id + "][placement][otherDetails]",
value: data.applications[id].placement.otherDetails,
classes: "govuk-!-width-full",
label: {
text: "Enter more detail"
}
}) }}
{% endset -%}

{{ govukRadios({
name: "applications[" + id + "][placement][other]",
value: data.applications[id].placement.other,
fieldset: {
legend: {
text: "Is there anything else we should know when we select your placement schools? (optional)",
isPageHeading: false,
classes: "govuk-fieldset__legend--m"
}
},
items: [
{
value: "yes",
text: "Yes",
conditional: {
html: otherHtml
}
},
{
value: "no",
text: "No"
}
]
}) }}

{{ govukButton({
text: "Continue"
}) }}
</form>
</div>
</div>
{% endblock %}
21 changes: 14 additions & 7 deletions app/views/applications/school-placement.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% set primaryNavId = "applications" %}

{% set title = "Which location are you interested in?" %}
{% set title = "Select your " + priority + " choice placement" %}
{% set application = data.applications[id] %}

{% block beforeContent %}
Expand All @@ -15,11 +15,18 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-three-quarters">
<span class="govuk-caption-l">{{ application.providerName }}</span>
<h1 class="govuk-heading-l">School placement location</h1>
<p class="govuk-body">During your training, you’ll be placed in at least 2 different schools to give you experience of teaching in a real classroom.</p>
<p class="govuk-body">You can choose which location you’re most interested in. Your training provider will do their best to place you at a location you prefer and can travel to.</p>
<h1 class="govuk-heading-l">Placement schools</h1>

{% if priority == 'first' %}
<p class="govuk-body">Your training provider will select at least 2 different placement schools to give you experience of teaching in a real classroom. They will choose placements based on both your practical needs, such as location and transport, and their knowledge of the different strengths and features of the schools in their network.</p>
<p class="govuk-body">You can select the schools that you are most interested in, but this does not guarantee that you will be placed in them.</p>
<p class="govuk-body"> The schools that training providers work with can change, so schools may be added or removed from this list at any time.</p>

<form action="/applications/{{ id }}/school-placement-second" method="post">
{% else %}
<form action="/applications/{{ id }}/school-placement-preferences" method="post">
{% endif %}

<form action="/applications/{{ id }}/review" method="post">

{{ govukRadios({
fieldset: {
Expand All @@ -30,8 +37,8 @@ <h1 class="govuk-heading-l">School placement location</h1>
},
idPrefix: "placement",
items: placementItems,
name: "applications[" + id + "][placement]",
value: data.applications[id].placement
name: "applications[" + id + "][placement][" + priority + "]",
value: data.applications[id].placement[" + priority + "]
}) }}

{{ govukButton({
Expand Down

0 comments on commit 571183e

Please sign in to comment.