Skip to content

Commit

Permalink
View rescheduled appointment
Browse files Browse the repository at this point in the history
  • Loading branch information
marcocolluramoj committed Sep 24, 2024
1 parent 08aed21 commit 9f0e75f
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 13 deletions.
13 changes: 9 additions & 4 deletions server/routes/appointments/appointmentsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,8 @@ export default class AppointmentsController {
async viewSupplierAssessmentFeedback(
req: Request,
res: Response,
userType: 'service-provider' | 'probation-practitioner'
userType: 'service-provider' | 'probation-practitioner',
rescheduled: boolean
): Promise<void> {
const { user } = res.locals
const { accessToken } = user.token
Expand Down Expand Up @@ -939,7 +940,8 @@ export default class AppointmentsController {
serviceUser,
userType,
referralId,
true
true,
rescheduled
)
const view = new SubmittedFeedbackView(presenter)

Expand Down Expand Up @@ -1456,7 +1458,8 @@ export default class AppointmentsController {
async viewSubmittedActionPlanSessionFeedback(
req: Request,
res: Response,
userType: 'service-provider' | 'probation-practitioner'
userType: 'service-provider' | 'probation-practitioner',
rescheduled: boolean
): Promise<void> {
const { accessToken } = res.locals.user.token
const { sessionNumber, actionPlanId, appointmentId } = req.params
Expand Down Expand Up @@ -1498,7 +1501,8 @@ export default class AppointmentsController {
serviceUser,
userType,
referral.id,
false
false,
rescheduled
)
const view = new SubmittedFeedbackView(presenter)

Expand Down Expand Up @@ -1532,6 +1536,7 @@ export default class AppointmentsController {
'probation-practitioner',
referral.id,
false,
false,
null
)
const view = new SubmittedFeedbackView(presenter)
Expand Down
13 changes: 10 additions & 3 deletions server/routes/probationPractitionerRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ export default function probationPractitionerRoutes(router: Router, services: Se
get(
router,
'/referrals/:referralId/session/:sessionNumber/appointment/:appointmentId/post-session-feedback',
(req, res) => appointmentsController.viewSubmittedActionPlanSessionFeedback(req, res, 'probation-practitioner')
(req, res) =>
appointmentsController.viewSubmittedActionPlanSessionFeedback(req, res, 'probation-practitioner', false)
)
get(router, '/referrals/:referralId/session/:sessionNumber/appointment/:appointmentId/rescheduled', (req, res) =>
appointmentsController.viewSubmittedActionPlanSessionFeedback(req, res, 'probation-practitioner', true)
)
get(router, '/action-plan/:actionPlanId', (req, res) =>
probationPractitionerReferralsController.viewActionPlanById(req, res)
Expand Down Expand Up @@ -229,10 +233,13 @@ export default function probationPractitionerRoutes(router: Router, services: Se
appointmentsController.showSupplierAssessmentAppointment(req, res, 'probation-practitioner')
)
get(router, '/referrals/:referralId/supplier-assessment/post-assessment-feedback', (req, res) =>
appointmentsController.viewSupplierAssessmentFeedback(req, res, 'probation-practitioner')
appointmentsController.viewSupplierAssessmentFeedback(req, res, 'probation-practitioner', false)
)
get(router, '/referrals/:referralId/supplier-assessment/post-assessment-feedback/:appointmentId', (req, res) =>
appointmentsController.viewSupplierAssessmentFeedback(req, res, 'probation-practitioner')
appointmentsController.viewSupplierAssessmentFeedback(req, res, 'probation-practitioner', false)
)
get(router, '/referrals/:referralId/supplier-assessment/rescheduled/appointment/:appointmentId', (req, res) =>
appointmentsController.viewSupplierAssessmentFeedback(req, res, 'service-provider', true)
)
get(router, '/referrals/:id/action-plan', (req, res) =>
probationPractitionerReferralsController.viewLatestActionPlan(req, res)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ export default class InterventionProgressPresenter {
const viewHref = `/service-provider/action-plan/${this.actionPlan!.id}/session/${
appointment.sessionNumber
}/appointment/${appointment.appointmentId}/post-session-feedback`
const viewRescheduledHref = `/service-provider/action-plan/${this.actionPlan!.id}/session/${
appointment.sessionNumber
}/appointment/${appointment.appointmentId}/rescheduled`
const editHref = `/service-provider/action-plan/${this.actionPlan!.id}/sessions/${
appointment.sessionNumber
}/edit/start`
Expand Down Expand Up @@ -261,7 +264,7 @@ export default class InterventionProgressPresenter {
links = [
{
text: 'View appointment details',
href: viewHref,
href: viewRescheduledHref,
},
]
break
Expand Down Expand Up @@ -381,7 +384,9 @@ export default class InterventionProgressPresenter {
return [
{
text: 'View appointment details',
href: `/service-provider/referrals/${this.referral.id}/supplier-assessment/appointment/${appointment!.id}`,
href: `/service-provider/referrals/${this.referral.id}/supplier-assessment/rescheduled/appointment/${
appointment!.id
}`,
},
]
case SessionStatus.awaitingFeedback:
Expand Down
12 changes: 9 additions & 3 deletions server/routes/serviceProviderRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,10 @@ export default function serviceProviderRoutes(
get(
router,
'/action-plan/:actionPlanId/session/:sessionNumber/appointment/:appointmentId/post-session-feedback',
(req, res) => appointmentsController.viewSubmittedActionPlanSessionFeedback(req, res, 'service-provider')
(req, res) => appointmentsController.viewSubmittedActionPlanSessionFeedback(req, res, 'service-provider', false)
)
get(router, '/action-plan/:actionPlanId/session/:sessionNumber/appointment/:appointmentId/rescheduled', (req, res) =>
appointmentsController.viewSubmittedActionPlanSessionFeedback(req, res, 'service-provider', true)
)
get(router, '/end-of-service-report/:id', (req, res) =>
serviceProviderReferralsController.viewEndOfServiceReport(req, res)
Expand Down Expand Up @@ -341,11 +344,14 @@ export default function serviceProviderRoutes(
appointmentsController.submitSupplierAssessmentFeedback(req, res)
)
get(router, '/referrals/:referralId/supplier-assessment/post-assessment-feedback', (req, res) =>
appointmentsController.viewSupplierAssessmentFeedback(req, res, 'service-provider')
appointmentsController.viewSupplierAssessmentFeedback(req, res, 'service-provider', false)
)
// This needs to go last in the `/post-assessment-feedback` urls to prevent clashes between the :appointmentId and other suffixes.
get(router, '/referrals/:referralId/supplier-assessment/post-assessment-feedback/:appointmentId', (req, res) =>
appointmentsController.viewSupplierAssessmentFeedback(req, res, 'service-provider')
appointmentsController.viewSupplierAssessmentFeedback(req, res, 'service-provider', false)
)
get(router, '/referrals/:referralId/supplier-assessment/rescheduled/appointment/:appointmentId', (req, res) =>
appointmentsController.viewSupplierAssessmentFeedback(req, res, 'service-provider', true)
)

get(router, '/referrals/:id/action-plan', (req, res) => serviceProviderReferralsController.viewActionPlan(req, res))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe(SubmittedFeedbackPresenter, () => {
serviceUser,
userType,
referralId,
false,
false
)
expect(presenter.text).toMatchObject({
Expand All @@ -30,6 +31,7 @@ describe(SubmittedFeedbackPresenter, () => {
serviceUser,
userType,
referralId,
false,
false
)
expect(presenter.text).toMatchObject({
Expand All @@ -48,6 +50,7 @@ describe(SubmittedFeedbackPresenter, () => {
serviceUser,
'probation-practitioner',
'test-referral-id',
false,
false
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default class SubmittedFeedbackPresenter {
private readonly userType: 'probation-practitioner' | 'service-provider',
private readonly referralId: string,
private readonly isSupplierAssessmentAppointment: boolean,
private readonly isRescheduledAppointment: boolean,
private readonly actionPlanId: string | null = null
) {
this.feedbackAnswersPresenter = new FeedbackAnswersPresenter(
Expand Down
4 changes: 3 additions & 1 deletion server/views/shared/viewSubmittedPostSessionFeedback.njk
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
{% block formSection %}
{{ govukSummaryList(sessionDetailsSummaryListArgs) }}
<br>
{% include "../partials/postSessionFeedbackResponses.njk" %}
{% if not presenter.isRescheduledAppointment %}
{% include "../partials/postSessionFeedbackResponses.njk" %}
{% endif %}
{% endblock %}

0 comments on commit 9f0e75f

Please sign in to comment.