generated from DFE-Digital/govuk-rails-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CPNPQ-2470] Edge case application details page (#2158)
* [CPDNPQ-2470] Application in review details page * [CPDNPQ-2470] Add ability to edit application notes
- Loading branch information
Showing
8 changed files
with
275 additions
and
6 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
app/controllers/npq_separation/admin/applications/notes_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,32 @@ | ||
# frozen_string_literal: true | ||
|
||
module NpqSeparation | ||
module Admin | ||
module Applications | ||
class NotesController < NpqSeparation::AdminController | ||
before_action :set_application | ||
|
||
def edit; end | ||
|
||
def update | ||
if @application.update(notes_params) | ||
flash[:success] = "Notes updated." | ||
redirect_to npq_separation_admin_application_review_path(@application) | ||
else | ||
render :edit | ||
end | ||
end | ||
|
||
private | ||
|
||
def notes_params | ||
params.require(:application).permit(:notes) | ||
end | ||
|
||
def set_application | ||
@application = Application.find(params[:id]) | ||
end | ||
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
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
17 changes: 17 additions & 0 deletions
17
app/views/npq_separation/admin/applications/notes/edit.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,17 @@ | ||
<h1 class="govuk-heading-xl"><%= @application.user.full_name %></h1> | ||
|
||
<%= form_with model: @application, url: npq_separation_admin_applications_notes_path(@application) do |f| %> | ||
<%= f.govuk_error_summary %> | ||
|
||
<%= | ||
f.govuk_text_area :notes, | ||
label: { text: 'Notes about changes to this registration', size: "m" }, | ||
hint: { text: "Please add the date and your initials when adding a note, and add above any existing notes. Notes are for internal use only." }, | ||
max_chars: 1_000 | ||
%> | ||
|
||
<div class="govuk-button-group"> | ||
<%= f.govuk_submit "Update notes" %> | ||
<%= govuk_link_to "Cancel", npq_separation_admin_application_review_path(@application) %> | ||
</div> | ||
<% 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
129 changes: 129 additions & 0 deletions
129
app/views/npq_separation/admin/applications/reviews/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,129 @@ | ||
<h1 class="govuk-heading-l"><%= @application.user.full_name %></h1> | ||
|
||
<p class="govuk-body govuk-!-margin-bottom-2"> | ||
<strong>Applicant ID:</strong> | ||
<%= @application.user.ecf_id %> | ||
</p> | ||
|
||
<p class="govuk-body govuk-!-margin-bottom-2"> | ||
<strong>Email:</strong> | ||
<%= @application.user.email %> | ||
</p> | ||
|
||
<p class="govuk-body govuk-!-margin-bottom-2"> | ||
<strong>Date of birth:</strong> | ||
<%= @application.user.date_of_birth.to_fs(:govuk_short) %> | ||
| | ||
<strong>National Insurance:</strong> | ||
<%= @application.user.national_insurance_number.presence || 'Not provided' %> | ||
</p> | ||
|
||
<p class="govuk-body govuk-!-margin-bottom-2"> | ||
<strong>TRN:</strong> | ||
<%= @application.user.trn %> | ||
<%= boolean_red_green_tag(@application.user.trn_verified?, @application.user.trn_verified? ? "Validated" : "Not validated") %> | ||
</p> | ||
|
||
<p class="govuk-body govuk-!-margin-bottom-6"> | ||
<strong>Get an Identity ID:</strong> | ||
<%= @application.user.uid.presence || 'Not set' %> | ||
</p> | ||
|
||
<%= | ||
govuk_summary_list(card: { title: "Course details" }) do |sl| | ||
sl.with_row do |row| | ||
row.with_key(text: "NPQ course") | ||
row.with_value(text: "#{@application.course.name} (#{@application.course.short_code})") | ||
end | ||
sl.with_row do |row| | ||
row.with_key(text: "Provider") | ||
row.with_value(text: @application.lead_provider.name) | ||
end | ||
sl.with_row do |row| | ||
row.with_key(text: "Provider approval status") | ||
row.with_value(text: lead_provider_approval_status_badge(@application.lead_provider_approval_status)) | ||
end | ||
end | ||
%> | ||
|
||
<%= | ||
govuk_summary_list(card: { title: "Funding details" }) do |sl| | ||
sl.with_row do |row| | ||
row.with_key(text: "Eligible for funding") | ||
row.with_value(text: boolean_red_green_tag(@application.eligible_for_funding)) | ||
row.with_action(text: "Change", href: new_npq_separation_admin_applications_change_funding_eligibility_path(@application)) | ||
end | ||
sl.with_row do |row| | ||
row.with_key(text: "Funded place") | ||
row.with_value(text: boolean_red_green_nil_tag(@application.funded_place)) | ||
end | ||
sl.with_row do |row| | ||
row.with_key(text: "Notes") | ||
row.with_value(text: @application.notes) | ||
row.with_action(text: "Change", href: edit_npq_separation_admin_applications_notes_path(@application)) | ||
end | ||
end | ||
%> | ||
|
||
<%= | ||
govuk_summary_list(card: { title: "Work details" }) do |sl| | ||
sl.with_row do |row| | ||
row.with_key(text: "Works in England") | ||
row.with_value(text: boolean_red_green_tag(@application.teacher_catchment == "england")) | ||
end | ||
sl.with_row do |row| | ||
row.with_key(text: "Work setting") | ||
row.with_value(text: @application.work_setting.try(:humanize)) | ||
end | ||
sl.with_row do |row| | ||
row.with_key(text: "Employment type") | ||
row.with_value(text: @application.employment_type.try(:humanize)) | ||
end | ||
sl.with_row do |row| | ||
row.with_key(text: "Employer name") | ||
row.with_value(text: @application.employer_name_to_display) | ||
end | ||
sl.with_row do |row| | ||
row.with_key(text: "Role") | ||
row.with_value(text: @application.employment_role) | ||
end | ||
end | ||
%> | ||
|
||
<%= | ||
govuk_summary_list(card: { title: "Schedule" }) do |sl| | ||
sl.with_row do |row| | ||
row.with_key(text: "Cohort") | ||
row.with_value(text: @application.cohort.start_year) | ||
end | ||
sl.with_row do |row| | ||
row.with_key(text: "Schedule identifier") | ||
row.with_value(text: @application.schedule.try(:identifier)) | ||
end | ||
end | ||
%> | ||
|
||
<%= | ||
govuk_summary_list(card: { title: "Registration details" }) do |sl| | ||
sl.with_row do |row| | ||
row.with_key(text: "Participant ID") | ||
row.with_value(text: @application.user.ecf_id) | ||
end | ||
sl.with_row do |row| | ||
row.with_key(text: "Application ID") | ||
row.with_value(text: @application.ecf_id) | ||
end | ||
sl.with_row do |row| | ||
row.with_key(text: "Registration submission date") | ||
row.with_value(text: @application.created_at.to_fs(:govuk_short)) | ||
end | ||
sl.with_row do |row| | ||
row.with_key(text: "Last updated date") | ||
row.with_value(text: @application.updated_at.to_fs(:govuk_short)) | ||
end | ||
end | ||
%> | ||
|
||
<%= govuk_details(summary_text: "View registration as it appears on the Lead Provider API V3") do %> | ||
<pre class="govuk-!-font-size-16" style="overflow: auto;"><code><%= JSON.pretty_generate API::ApplicationSerializer.render_as_hash(@application, view: :v3, root: "data") %></code></pre> | ||
<% 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
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