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() !!} +