Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion app/Http/Controllers/Contact/AccidentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
);
Expand Down
5 changes: 5 additions & 0 deletions app/Http/Requests/Contact/AccidentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion app/Mail/Contact/AccidentReportReceipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

Expand Down
4 changes: 2 additions & 2 deletions config/bts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down
30 changes: 29 additions & 1 deletion resources/views/contact/accident.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@section('content')
<p>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.</p>
Chair, Training & Safety and the Students' Union. It may be shared with other committee members as necessary.</p>

{!! Form::open() !!}
<fieldset>
Expand Down Expand Up @@ -84,6 +84,34 @@
@InputError('person_type_other')
</div>
</fieldset>
<fieldset data-visibility-input="severity" data-visibility-value="1">
<legend>Monitor Contact Details</legend>

<p>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.</p>
<!-- Name -->
<div class="form-group @InputClass('monitor_name')">
{!! Form::label('monitor_name', 'Name:') !!}
<div class="input-group">
<span class="input-group-addon">
<span class="fa fa-user"></span>
</span>
{!! Form::text('monitor_name', null, ['placeholder' => 'The name of the contact']) !!}
</div>
@InputError('monitor_name')
</div>

<!-- Email -->
<div class="form-group @InputClass('monitor_email')">
{!! Form::label('monitor_email', 'Email:') !!}
<div class="input-group">
<span class="input-group-addon">
<span class="fa fa-at"></span>
</span>
{!! Form::text('monitor_email', null, ['placeholder' => 'Their email address']) !!}
</div>
@InputError('monitor_email')
</div>
</fieldset>
<fieldset>
<legend>Contact Details</legend>

Expand Down
4 changes: 2 additions & 2 deletions resources/views/contact/near-miss.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
@section('content')
<p>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.</p>
<p>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.</p>
<p>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.</p>
{!! Form::open() !!}
<fieldset>
<legend>Incident Details</legend>
Expand Down
6 changes: 6 additions & 0 deletions resources/views/emails/contact/_accident.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
**Name:** {{ $report['injured_name'] }}<br>
**Category:** {{ $report['person_type_email'] }}<br>

@if(@$report['monitor_name'])
## Monitoring contact details
**Name:** {{ $report['monitor_name'] }}<br>
**Email:** {{ $report['monitor_email'] }}<br>
@endif

## Contact details
**Name:** {{ $report['contact_name'] }}<br>
**Email:** [{{ $report['contact_email'] }}](mailto:{{ $report['contact_email'] }})<br>
Expand Down
Loading