-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add low-fi induction recoreding for ABs
- Loading branch information
1 parent
fce595b
commit d066ec4
Showing
7 changed files
with
102 additions
and
4 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
app/controllers/appropriate_bodies/teachers/record_outcome_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
module AppropriateBodies | ||
module Teachers | ||
class RecordOutcomeController < AppropriateBodiesController | ||
def new | ||
@teacher = Teacher.find(params[:ab_teacher_id]) | ||
|
||
@pending_induction_submission = PendingInductionSubmission.new | ||
end | ||
|
||
def create | ||
@teacher = Teacher.find(params[:ab_teacher_id]) | ||
@pending_induction_submission = PendingInductionSubmission.new( | ||
**pending_induction_submission_params, | ||
**pending_induction_submission_attributes | ||
) | ||
|
||
record_outcome = AppropriateBodies::RecordOutcome.new(appropriate_body: @appropriate_body, pending_induction_submission: @pending_induction_submission) | ||
|
||
PendingInductionSubmission.transaction do | ||
if @pending_induction_submission.save(context: :record_outcome) && record_outcome.record_outcome! | ||
redirect_to ab_teacher_record_outcome_path(@teacher) | ||
else | ||
render :new | ||
end | ||
end | ||
end | ||
|
||
def show | ||
@teacher = Teacher.find(params[:ab_teacher_id]) | ||
end | ||
|
||
private | ||
|
||
def pending_induction_submission_params | ||
params.require(:pending_induction_submission).permit(:finished_on, :number_of_terms, :outcome) | ||
end | ||
|
||
def pending_induction_submission_attributes | ||
{ appropriate_body_id: @appropriate_body.id, trn: @teacher.trn } | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module AppropriateBodies | ||
class RecordOutcome | ||
def initialize(appropriate_body:, pending_induction_submission:) | ||
@appropriate_body = appropriate_body | ||
@pending_induction_submission = pending_induction_submission | ||
end | ||
|
||
def record_outcome! | ||
# FIXME: implement a proper release process here, | ||
# it needs to close the open inductoin | ||
# period and send an update to TRS with the | ||
# outcome and finish date | ||
|
||
true | ||
end | ||
end | ||
end |
28 changes: 28 additions & 0 deletions
28
app/views/appropriate_bodies/teachers/record_outcome/new.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<% page_data(title: "Record outcome for #{Teachers::Name.new(@teacher).full_name}", error: @pending_induction_submission.errors.any?) %> | ||
<%= form_with(model: @pending_induction_submission, url: ab_teacher_record_outcome_path(@teacher), method: 'post') do |form| %> | ||
<%= form.govuk_error_summary %> | ||
<%= | ||
form.govuk_date_field :finished_on, | ||
legend: { | ||
text: "When did #{Teachers::Name.new(@teacher).full_name} finish their induction with you?" | ||
} | ||
%> | ||
<%= | ||
form.govuk_number_field :number_of_terms, | ||
width: 4, | ||
label: { | ||
size: 'm', | ||
text: "How many terms of induction did #{Teachers::Name.new(@teacher).full_name} spend with you?" | ||
} | ||
%> | ||
<%= | ||
form.govuk_collection_radio_buttons :outcome, induction_outcome_choices, :identifier, :name, | ||
legend: { text: "What was the outcome of #{Teachers::Name.new(@teacher).full_name}'s induction?", size: 'm' } | ||
%> | ||
<%= form.govuk_submit %> | ||
<% end %> |
10 changes: 10 additions & 0 deletions
10
app/views/appropriate_bodies/teachers/record_outcome/show.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<% page_data( | ||
title: "#{Teachers::Name.new(@teacher).full_name}'s induction outcome has been recorded", | ||
header: false) | ||
%> | ||
<%= | ||
govuk_panel(title_text: "Success", text: "#{Teachers::Name.new(@teacher).full_name} has finished their induction") | ||
%> | ||
<%= govuk_button_link_to("Return to the homepage", ab_path, secondary: true) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters