diff --git a/app/Http/Controllers/Contact/AccidentController.php b/app/Http/Controllers/Contact/AccidentController.php index 95a08a52..548ad8b2 100755 --- a/app/Http/Controllers/Contact/AccidentController.php +++ b/app/Http/Controllers/Contact/AccidentController.php @@ -59,7 +59,15 @@ public function process(AccidentRequest $request) 'severity_email' => AccidentRequest::$Severities[$request->get('severity')], ]); - Mail::to(config('bts.emails.safety.accident_reports'))->queue(new AccidentReport($request->all())); + Mail::to(config('bts.emails.safety.accident_reports'))->queue( + new AccidentReport($request->all()) + ); + if ($request->get('monitor_email')) + { + Mail::to($request->get('monitor_email'), $request->get('monitor_name'))->queue( + new AccidentReport($request->all()) + ); + } Mail::to($request->get('contact_email'), $request->get('contact_name'))->queue( new AccidentReportReceipt($request->all()), ); diff --git a/app/Http/Requests/Contact/AccidentRequest.php b/app/Http/Requests/Contact/AccidentRequest.php index 1e6b4dff..2eba308e 100755 --- a/app/Http/Requests/Contact/AccidentRequest.php +++ b/app/Http/Requests/Contact/AccidentRequest.php @@ -66,6 +66,8 @@ public function rules() 'absence_details' => 'required_if:severity,1,2,3', 'details' => 'required', 'injured_name' => 'required', + 'monitor_name' => 'required_if:severity,1', + 'monitor_email' => 'nullable|required_if:severity,1|email', 'contact_name' => 'required', 'contact_email' => 'required|email', 'contact_phone' => 'required|phone', @@ -92,6 +94,9 @@ public function messages() 'absence_details.required_if' => 'Please enter any details of their absence from employment or studies', 'details.required' => 'Please provide the accident details', 'injured_name.required' => 'Please provide the name of the injured party', + 'monitor_name.required_if' => 'Please provide the name of someone monitoring the injured party', + 'monitor_email.required_if' => 'Please provide an email address for the monitor', + 'monitor_email.email' => 'Please provide a valid email address for the monitor', 'contact_name.required' => 'Please provide the name of the contact person', 'contact_email.required' => 'Please provide an email address for the contact', 'contact_email.email' => 'Please provide a valid email address', diff --git a/app/Mail/Contact/AccidentReportReceipt.php b/app/Mail/Contact/AccidentReportReceipt.php index a12895f0..e8c8c444 100755 --- a/app/Mail/Contact/AccidentReportReceipt.php +++ b/app/Mail/Contact/AccidentReportReceipt.php @@ -29,7 +29,7 @@ public function __construct(array $data) * Build the message. * @return $this */ - public function build() + public function build() { [$forename] = explode(' ', $this->report['contact_name']); diff --git a/config/bts.php b/config/bts.php index 2dc4adb8..1691dd00 100755 --- a/config/bts.php +++ b/config/bts.php @@ -54,13 +54,13 @@ 'safety' => [ 'accident_reports' => [ - 'committee@bts-crew.com', + 'chair@bts-crew.com', 'safety@bts-crew.com', 'P.Hawker@bath.ac.uk', 'su-healthandsafety@bath.ac.uk', ], 'accident_receipt' => ['safety@bts-crew.com'], - 'near_miss_reports' => ['committee@bts-crew.com', 'safety@bts-crew.com', 'su-healthandsafety@bath.ac.uk'], + 'near_miss_reports' => ['chair@bts-crew.com', 'safety@bts-crew.com', 'su-healthandsafety@bath.ac.uk'], ], 'training' => [ diff --git a/resources/views/contact/accident.blade.php b/resources/views/contact/accident.blade.php index 075653f2..9c4b7eb6 100755 --- a/resources/views/contact/accident.blade.php +++ b/resources/views/contact/accident.blade.php @@ -7,7 +7,7 @@ @section('content')

Use this form to report an accident that occurred during a Backstage-supported event or activity. Please note that this form is automatically sent to the - Students' Union as well as Backstage.

+ Chair, Training & Safety and the Students' Union. It may be shared with other committee members as necessary.

{!! Form::open() !!}
@@ -84,6 +84,34 @@ @InputError('person_type_other')
+
+ Monitor Contact Details + +

The details of someone who agrees to monitor the injuried party's condition following the injury. They will be sent a copy of this report.

+ +
+ {!! Form::label('monitor_name', 'Name:') !!} +
+ + + + {!! Form::text('monitor_name', null, ['placeholder' => 'The name of the contact']) !!} +
+ @InputError('monitor_name') +
+ + +
+ {!! Form::label('monitor_email', 'Email:') !!} +
+ + + + {!! Form::text('monitor_email', null, ['placeholder' => 'Their email address']) !!} +
+ @InputError('monitor_email') +
+
Contact Details diff --git a/resources/views/contact/near-miss.blade.php b/resources/views/contact/near-miss.blade.php index d77e606a..ad469919 100644 --- a/resources/views/contact/near-miss.blade.php +++ b/resources/views/contact/near-miss.blade.php @@ -8,8 +8,8 @@ @section('content')

Use this form to report an incident that occurred during a Backstage-supported event or activity which could have led to an injury. If an injury did occur, please use the {!! link_to_route('contact.accident', 'accident reporting form') !!} instead.

-

This email is sent to the Committee and SU H&S inbox, and is only used to help improve the safety of the society and its - members.

+

This email is sent to the Chair, Training & Safety and the Students' Union. It will only be used to help improve the safety of the society and its + members. Your report may be shared with other committee members as necessary.

{!! Form::open() !!}
Incident Details diff --git a/resources/views/emails/contact/_accident.blade.php b/resources/views/emails/contact/_accident.blade.php index c824fdef..4e84666f 100755 --- a/resources/views/emails/contact/_accident.blade.php +++ b/resources/views/emails/contact/_accident.blade.php @@ -12,6 +12,12 @@ **Name:** {{ $report['injured_name'] }}
**Category:** {{ $report['person_type_email'] }}
+@if(@$report['monitor_name']) +## Monitoring contact details +**Name:** {{ $report['monitor_name'] }}
+**Email:** {{ $report['monitor_email'] }}
+@endif + ## Contact details **Name:** {{ $report['contact_name'] }}
**Email:** [{{ $report['contact_email'] }}](mailto:{{ $report['contact_email'] }})