|
1 | 1 | {% extends "_layouts/form.njk" %} |
2 | 2 |
|
3 | 3 | {% set paths = { back: patient.uri } %} |
| 4 | +{% set confirmButtonText = __("patient.inviteToClinic.confirm") %} |
| 5 | + |
4 | 6 | {% if clinicReadyProgrammes.length > 1 %} |
5 | 7 | {% set title = __("patient.inviteToClinic.title.multiple") %} |
6 | 8 | {% else %} |
7 | | - {% set title = __("patient.inviteToClinic.title.single", { firstName: patient.firstName, lastName: patient.lastName }) %} |
| 9 | + {% if clinicReadyProgrammesWithoutClinics.count === 0 %} |
| 10 | + {% set title = __("patient.inviteToClinic.title.single.clinicsScheduled", { firstName: patient.firstName, lastName: patient.lastName }) %} |
| 11 | + {% else %} |
| 12 | + {% set title = __("patient.inviteToClinic.title.single.noClinicsScheduled", { firstName: patient.firstName, lastName: patient.lastName }) %} |
| 13 | + {% endif %} |
8 | 14 | {% endif %} |
9 | | -{% set confirmButtonText = __("patient.inviteToClinic.confirm") %} |
10 | 15 |
|
11 | 16 | {% set checkboxItems = [] %} |
12 | 17 | {% for patientProgramme in clinicReadyProgrammes %} |
|
32 | 37 | }) }} |
33 | 38 |
|
34 | 39 | {% if clinicReadyProgrammes.length > 1 %} |
35 | | - {# Let the user choose which programmes to invite for, based on availability of clinics #} |
| 40 | + {# |
| 41 | + The child is clinic-ready for multiple programmes, so we'll offer checkboxes to invite to all of them, |
| 42 | + regardless of clinic availability — but warn if any don't have clinics available |
| 43 | + #} |
36 | 44 | {{ checkboxes({ |
37 | 45 | fieldset: { |
38 | 46 | attributes: { |
|
44 | 52 | }) }} |
45 | 53 |
|
46 | 54 | {{ warningCallout({ |
47 | | - heading: __("patient.inviteToClinic.scheduledClinicWarning.multiple.title"), |
48 | | - text: __mf("patient.inviteToClinic.scheduledClinicWarning.multiple.description", |
| 55 | + heading: __("patient.inviteToClinic.scheduledClinicWarning.title"), |
| 56 | + text: __mf("patient.inviteToClinic.scheduledClinicWarning.description", |
49 | 57 | { |
50 | 58 | programmeNames: clinicReadyProgrammesWithoutClinics.names, |
51 | 59 | count: clinicReadyProgrammesWithoutClinics.count |
52 | 60 | }) | safe |
53 | 61 | }) if clinicReadyProgrammesWithoutClinics.count > 0 }} |
54 | 62 | {% else %} |
55 | 63 | {# |
56 | | - There must be only 1 clinic ready programme, so only show the paragraph about number of clinics |
| 64 | + There must be exactly 1 clinic-ready programme, so only show the paragraph about number of clinics |
57 | 65 | for this one programme if there actually are some. Otherwise, lean on the warning callout. |
58 | 66 | #} |
59 | | - {% if clinicReadyProgrammesWithoutClinics.length === 0 %} |
60 | | - {{ __mf("patient.inviteToClinic.clinicCount.paragraph", |
| 67 | + {% if clinicReadyProgrammesWithoutClinics.count === 0 %} |
| 68 | + {# Tell the user how many clinics are available for this child's one clinic-ready programme #} |
| 69 | + {{ __mf("patient.inviteToClinic.clinicCount.someParagraph", |
61 | 70 | { |
62 | 71 | programmeName: clinicReadyProgrammes[0].programme.name | replace("Flu", "flu"), |
63 | 72 | count: clinicReadyProgrammes[0].scheduledClinicCount |
64 | | - }) }} |
| 73 | + }) | nhsukMarkdown }} |
65 | 74 | {% else %} |
66 | | - {{ warningCallout({ |
67 | | - heading: __("patient.inviteToClinic.scheduledClinicWarning.single.title"), |
68 | | - text: __mf("patient.inviteToClinic.scheduledClinicWarning.single.description", |
| 75 | + {# Tell the user there are NO clinics available for this child's one clinic-ready programme #} |
| 76 | + {{ __("patient.inviteToClinic.clinicCount.noneParagraph", |
69 | 77 | { |
70 | | - programmeNames: clinicReadyProgrammesWithoutClinics.names, |
71 | | - count: clinicReadyProgrammesWithoutClinics.count |
72 | | - }) | safe |
73 | | - }) if clinicReadyProgrammesWithoutClinics.count > 0 }} |
| 78 | + programmeName: clinicReadyProgrammesWithoutClinics.names |
| 79 | + }) | nhsukMarkdown |
| 80 | + }} |
74 | 81 | {% endif %} |
75 | 82 |
|
76 | 83 | {# Fake the user's selection of a checkbox for this programme #} |
77 | 84 | <input type="hidden" id="clinicProgramme_ids" name="clinicProgramme_ids" value="{{clinicReadyProgrammes[0].programme_id}}" /> |
78 | 85 | {% endif %} |
79 | 86 | {% endblock %} |
| 87 | + |
| 88 | +{% block afterForm %} |
| 89 | + {# Include a link to back out if there are no clinics available for the clinic-ready programmes #} |
| 90 | + {% if clinicReadyProgrammes.length === clinicReadyProgrammesWithoutClinics.count %} |
| 91 | + {{ appButtonGroup({ |
| 92 | + buttons: [{ |
| 93 | + text: confirmButtonText, |
| 94 | + variant: confirmButtonVariant |
| 95 | + }], |
| 96 | + links: [{ |
| 97 | + text: __("patient.inviteToClinic.cancel"), |
| 98 | + href: paths.back |
| 99 | + }] |
| 100 | + }) }} |
| 101 | + {% else %} |
| 102 | + {{ super() }} |
| 103 | + {% endif %} |
| 104 | +{% endblock %} |
| 105 | + |
0 commit comments