-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CoC Confirmation Decision to Route 11 (#866)
* Add confirm success decision to match route 11 * script to destroy route 11 matches unless on production * rubocop * rubocop * code review updates * clean up match decision subway map * Update app/views/matches/_current_step_info.haml Co-authored-by: Elliot <[email protected]> --------- Co-authored-by: Elliot <[email protected]>
- Loading branch information
Showing
9 changed files
with
191 additions
and
18 deletions.
There are no files selected for viewing
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
107 changes: 107 additions & 0 deletions
107
app/models/match_decisions/eleven/eleven_confirm_match_success_dnd_staff.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,107 @@ | ||
### | ||
# Copyright 2016 - 2024 Green River Data Analysis, LLC | ||
# | ||
# License detail: https://github.com/greenriver/boston-cas/blob/production/LICENSE.md | ||
### | ||
|
||
module MatchDecisions::Eleven | ||
class ElevenConfirmMatchSuccessDndStaff < ::MatchDecisions::Base | ||
include MatchDecisions::AcceptsDeclineReason | ||
include MatchDecisions::RouteElevenDeclineReasons | ||
include MatchDecisions::RouteElevenCancelReasons | ||
|
||
def to_partial_path | ||
'match_decisions/eleven/confirm_match_success_dnd_staff' | ||
end | ||
|
||
def statuses | ||
{ | ||
pending: 'Pending', | ||
confirmed: 'Confirmed', | ||
declined: 'Declined', | ||
canceled: 'Canceled', | ||
back: 'Pending', | ||
} | ||
end | ||
|
||
def label | ||
label_for_status status | ||
end | ||
|
||
def label_for_status status | ||
case status.to_sym | ||
when :pending then "#{Translation.translate('CoC Eleven')} to confirm match success" | ||
when :confirmed then "#{Translation.translate('CoC Eleven')} confirms match success" | ||
when :rejected, :declined then "Match rejected by #{Translation.translate('CoC Eleven')}. Reason: #{decline_reason_name}" | ||
when :canceled then canceled_status_label | ||
when :back then backup_status_label | ||
end | ||
end | ||
|
||
def started? | ||
status&.to_sym == :confirmed | ||
end | ||
|
||
def step_name | ||
"#{Translation.translate('CoC Eleven')} Review Match Success" | ||
end | ||
|
||
def actor_type | ||
Translation.translate('CoC Eleven') | ||
end | ||
|
||
def contact_actor_type | ||
:dnd_staff_contacts | ||
end | ||
|
||
def initialize_decision! send_notifications: true | ||
super(send_notifications: send_notifications) | ||
update status: 'pending' | ||
send_notifications_for_step if send_notifications | ||
end | ||
|
||
def notifications_for_this_step | ||
@notifications_for_this_step ||= [].tap do |m| | ||
m << Notifications::Eleven::ConfirmMatchSuccessDndStaff | ||
end | ||
end | ||
|
||
def accessible_by? contact | ||
contact&.user_can_reject_matches? || contact&.user_can_approve_matches? | ||
end | ||
|
||
def to_param | ||
:eleven_confirm_match_success_dnd_staff | ||
end | ||
|
||
private def note_present_if_status_rejected | ||
errors.add :note, 'Please note why the match is declined.' if note.blank? && status == 'rejected' | ||
end | ||
|
||
class StatusCallbacks < StatusCallbacks | ||
def pending | ||
end | ||
|
||
def confirmed | ||
Notifications::MatchSuccessConfirmed.create_for_match! match | ||
match.succeeded!(user: user) | ||
end | ||
|
||
def declined | ||
Notifications::MatchDeclined.create_for_match! match | ||
match.rejected! | ||
end | ||
|
||
def canceled | ||
Notifications::MatchCanceled.create_for_match! match | ||
match.canceled! | ||
end | ||
|
||
def rejected | ||
Notifications::MatchRejected.create_for_match! match | ||
match.rejected! | ||
end | ||
end | ||
private_constant :StatusCallbacks | ||
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
23 changes: 23 additions & 0 deletions
23
app/models/notifications/eleven/confirm_match_success_dnd_staff.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,23 @@ | ||
### | ||
# Copyright 2016 - 2024 Green River Data Analysis, LLC | ||
# | ||
# License detail: https://github.com/greenriver/boston-cas/blob/production/LICENSE.md | ||
### | ||
|
||
module Notifications::Eleven | ||
class ConfirmMatchSuccessDndStaff < ::Notifications::Base | ||
def self.create_for_match! match | ||
match.dnd_staff_contacts.each do |contact| | ||
create! match: match, recipient: contact | ||
end | ||
end | ||
|
||
def decision | ||
match.eleven_confirm_match_success_dnd_staff_decision | ||
end | ||
|
||
def event_label | ||
"#{Translation.translate('CoC Eleven')} Staff notified of successful match and asked to give final confirmation." | ||
end | ||
end | ||
end |
18 changes: 18 additions & 0 deletions
18
app/views/match_decisions/eleven/_confirm_match_success_dnd_staff.haml
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,18 @@ | ||
.match-decision.c-card.c-card--flush.card--block | ||
.c-card__content | ||
= simple_form_for @decision, url: access_context.match_decision_path(@match, @decision) do |form| | ||
.o-pre-choose | ||
.form-inputs | ||
.row | ||
.col-md-6 | ||
= form.input :note, as: :text, input_html: {rows: 4, disabled: !(@decision.editable?)} | ||
.o-choose.o-choose--flush | ||
.o-choose__choice{class: ('o-choose__choice--disabled' if [email protected]?)} | ||
%header | ||
.o-choose__title | ||
.c-choice-icon.c-choice-icon--confirm.mr-4 | ||
%h3 Confirm Match | ||
.o-choose__content | ||
%p Confirming match success will complete the match and remove the client and voucher/unit from future matching. | ||
= render 'match_decisions/continue_button', text: 'Confirm Match Success', icon: 'checkmark', button_attributes: { class: 'btn btn-success', data: {submit_param_name: 'decision[status]', submit_param_value: 'confirmed'}, disabled: !(@decision.editable?) } | ||
= render 'match_decisions/decline_and_cancel_backup_actions', form: form |
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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
.d-flex.mb-5.align-items-end.flex-wrap | ||
- if @match.current_decision.present? | ||
.d-flex.flex-column | ||
.summary-readout.mb-3 | ||
.summary-readout--tile | ||
%h3.h4 Current Step | ||
%h1.h2 | ||
-if [email protected]_status[:name] == "In Progress" | ||
= match.overall_status[:name] | ||
-else | ||
= @match.current_decision.step_name | ||
.summary-readout--tile | ||
%h3.h4 Assigned To | ||
%h1.h2 | ||
= @match.current_decision.try(:actor_type) || 'N/A' | ||
= render 'match_list_base/current_step', match: @match | ||
- else | ||
- if @match.current_decision.blank? | ||
= render 'matches/restrictions_on_reopening' | ||
.d-flex.mb-5.align-items-end.flex-wrap | ||
.d-flex.flex-column | ||
.summary-readout.mb-3 | ||
.summary-readout--tile | ||
%h3.h4 Current Step | ||
%h1.h2 | ||
-if @match.overall_status[:name] != "In Progress" | ||
= @match.overall_status[:name] | ||
-else | ||
= @match.current_decision.step_name | ||
.summary-readout--tile | ||
%h3.h4 Assigned To | ||
%h1.h2 | ||
= @match.current_decision&.try(:actor_type) || 'N/A' | ||
= render 'match_list_base/current_step', match: @match | ||
%div.ml-auto | ||
- if @match.can_create_overall_note?(access_context.current_contact) | ||
.btn-label.btn-label__primary | ||
|
17 changes: 17 additions & 0 deletions
17
app/views/notifications_mailer/eleven_confirm_match_success_dnd_staff.text.haml
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 @@ | ||
Hello #{@contact.full_name}, | ||
\ | ||
= "The match now requires final approval from #{Translation.translate('CoC Eleven')} staff to complete." | ||
\ | ||
Please review the details of the match and note final approval here: | ||
#{notification_match_decision_url @notification, @match, @decision} | ||
\ | ||
= render 'client_details' | ||
\ | ||
= render 'location_details' | ||
\ | ||
= render 'program_details' | ||
\ | ||
\ | ||
\ | ||
\ | ||
= render 'email_footer' |
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,5 @@ | ||
class DestroyRouteElevenMatches < ActiveRecord::Migration[7.0] | ||
def up | ||
ClientOpportunityMatch.joins(:match_route).where(match_routes: { type: 'MatchRoutes::Eleven' }).destroy_all unless Rails.env.production? | ||
end | ||
end |