Commit e7b1cc02 by Azhan Hannan

Email notification for staff when rejected by hod pm pmhod and bod

parent bf22482b
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class BodRejectProject extends Mailable
{
use Queueable, SerializesModels;
public $data_email;
public $data_timesheet;
public $data_project;
public $data_overheads;
public $emailcc;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($data_email, $data_timesheet, $data_project, $data_overheads, $emailcc)
{
$this->data_email = $data_email;
$this->data_timesheet = $data_timesheet;
$this->data_project = $data_project;
$this->data_overheads = $data_overheads;
$this->emailcc = $emailcc;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->subject($this->data_email['subject'])
->from($this->data_email['sender_name'])
->markdown('mail.content.BodRejectProject');
}
}
...@@ -13,16 +13,20 @@ class PmRejectProject extends Mailable ...@@ -13,16 +13,20 @@ class PmRejectProject extends Mailable
public $data_email; public $data_email;
public $data_timesheet; public $data_timesheet;
public $data_project;
public $data_overheads;
/** /**
* Create a new message instance. * Create a new message instance.
* *
* @return void * @return void
*/ */
public function __construct($data_email, $data_timesheet) public function __construct($data_email, $data_timesheet, $data_project, $data_overheads)
{ {
$this->data_email = $data_email; $this->data_email = $data_email;
$this->data_timesheet = $data_timesheet; $this->data_timesheet = $data_timesheet;
$this->data_project = $data_project;
$this->data_overheads = $data_overheads;
} }
/** /**
......
...@@ -467,10 +467,10 @@ ...@@ -467,10 +467,10 @@
</td> </td>
<td style="width: 12%;" class="text-center single line"> <td style="width: 12%;" class="text-center single line">
@if(data_get($tp, 'tp_timesheet_sts') == 2) @if(data_get($tp, 'tp_timesheet_sts') == 2)
<button class="center aligned ui green icon button" onclick="window.location.href='{{route('timesheet::dashboard.revaction', ['tpid'=>data_get($tp, 'id'), 'phase'=>data_get($tp, 'tp_phase'), 'month'=>data_get($tp, 'tp_month'), 'year'=>data_get($tp, 'tp_year') ]) }}';">Verify | Reject</button> <button class="center aligned ui green icon button" onclick="window.location.href='{{route('timesheet::dashboard.revaction', ['tpid'=>data_get($tp, 'id'), 'phase'=>data_get($tp, 'tp_phase'), 'month'=>data_get($tp, 'tp_month'), 'year'=>data_get($tp, 'tp_year') ]) }}';" type="button">Verify | Reject</button>
@else @else
<!-- <button class="center aligned ui green icon button disabled">Verify | Reject</button> --> <!-- <button class="center aligned ui green icon button disabled">Verify | Reject</button> -->
<a class="center aligned ui blue icon button" onclick="window.location.href='{{ route('timesheet::dashboard.timesheetViewer', [ 'user'=>data_get($staff,'staff_id') ,'phase' => data_get($staff,'phase'), 'month' => data_get($staff,'month'), 'year' => data_get($staff,'year')]) }}';" target='_blank'>View</a> <a class="center aligned ui blue icon button" onclick="window.location.href='{{ route('timesheet::dashboard.timesheetViewer', [ 'user'=>data_get($staff,'staff_id') ,'phase' => data_get($staff,'phase'), 'month' => data_get($staff,'month'), 'year' => data_get($staff,'year')]) }}';" type="button" target='_blank'>View</a>
@endif @endif
</td> </td>
......
...@@ -350,7 +350,7 @@ ...@@ -350,7 +350,7 @@
@endforeach @endforeach
<div class="two fields"> <div class="two fields">
<div class="field"> <div class="field">
<input type="hidden" name="approval" value="{{ data_get($pm,'id') }}"> <input type="hidden" name="verifier" value="{{ data_get($pm,'id') }}">
<label>Verifier</label> <label>Verifier</label>
<input type="text" readonly="readonly" value="{{ data_get($pm,'name') }}"> <input type="text" readonly="readonly" value="{{ data_get($pm,'name') }}">
</div> </div>
......
...@@ -1132,8 +1132,8 @@ class MaintenanceController extends Controller ...@@ -1132,8 +1132,8 @@ class MaintenanceController extends Controller
'status' => data_get($project,'p_project_sts'), 'status' => data_get($project,'p_project_sts'),
]; ];
Mail::to($mailTo)->send(new AddProjectTeam($data_email, $data_staffs)); // Mail::to($mailTo)->send(new AddProjectTeam($data_email, $data_staffs));
// return new AddProjectTeam($data_email, $data_staffs); return new AddProjectTeam($data_email, $data_staffs);
return redirect()->route('timesheet::maintenance.senaraiProjectTeam', compact('id'))->withSuccess('You have successfully added all project team. The list of project team have been forwarded to the Project Director.'); return redirect()->route('timesheet::maintenance.senaraiProjectTeam', compact('id'))->withSuccess('You have successfully added all project team. The list of project team have been forwarded to the Project Director.');
} }
......
...@@ -34,4 +34,9 @@ class Ts_master extends Model ...@@ -34,4 +34,9 @@ class Ts_master extends Model
return $this->belongsTo('Portal\Timesheet\Model\Staff_info','staff_id','tm_staff_id'); return $this->belongsTo('Portal\Timesheet\Model\Staff_info','staff_id','tm_staff_id');
} }
public function staffs()
{
return $this->hasOne('Portal\Timesheet\Model\Staff_info','staff_id','tm_staff_id');
}
} }
@component('mail::message') @component('mail::message')
@if(count($data_overheads) > 0 && count($data_project) == 0)
# Your overhead has been rejected!
@elseif(count($data_overheads) == 0 && count($data_project) > 0)
# Your project has been rejected! # Your project has been rejected!
@else
# Your projects & overhead has been rejected!
@endif
Assalamualaikum w.b.t Dato' /Datin /En /Pn / Cik Assalamualaikum w.b.t Dato' /Datin /En /Pn / Cik
{!! ucwords(strtolower($data_email['staffname'])) !!} {!! ucwords(strtolower($data_email['staffname'])) !!}
We would like to inform you as one of your timesheet project namely, {!! $data_email['projectname'] !!}, has been rejected. We would like to inform you as your
@if(count($data_overheads) > 0 && count($data_project) == 0)
overhead has been rejected.
@elseif(count($data_overheads) == 0 && count($data_project) > 0)
timesheet @if(count($data_project) == 1) project has @else projects have @endif been rejected.
@else
projects & overhead has been rejected.
@endif
The details of timesheet submission is as below: <br> The details of timesheet submission is as below: <br>
<table style="border: black 1px solid; font-size: 16px; text-align: center; width: 150%;" id="project"> <table style="border: black 1px solid; font-size: 16px; text-align: center; width: 150%;" id="project">
...@@ -27,6 +44,9 @@ The details of timesheet submission is as below: <br> ...@@ -27,6 +44,9 @@ The details of timesheet submission is as below: <br>
</tbody> </tbody>
</table> </table>
<br> <br>
@if(count($data_project) > 0)
The details of the project rejection is as below: <br> The details of the project rejection is as below: <br>
<table style="border: black 1px solid; font-size: 16px; text-align: center; width: 150%;" id="project"> <table style="border: black 1px solid; font-size: 16px; text-align: center; width: 150%;" id="project">
<thead> <thead>
...@@ -38,17 +58,49 @@ The details of the project rejection is as below: <br> ...@@ -38,17 +58,49 @@ The details of the project rejection is as below: <br>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach($data_project as $key => $project)
<tr>
<td style="border: black 1px solid;">{!! $project['pcode'] !!} </td>
<td style="border: black 1px solid;">{!! $project['projectname'] !!}</td>
@if($key==0)
<td style="border: black 1px solid;" rowspan="{{count($data_project)}}">{!! ucwords(strtolower($project['projectmanager'])) !!}</td>
<td style="border: black 1px solid;" rowspan="{{count($data_project)}}">{!! ucwords(strtolower($project['remarks'])) !!}</td>
@endif
</tr>
@endforeach
</tbody>
</table>
<br>
@endif
@if(count($data_overheads) > 0)
The details of the rejected overhead is as below: <br>
<table style="border: black 1px solid; font-size: 16px; text-align: center; width: 150%;" id="project">
<thead>
<tr> <tr>
<td style="border: black 1px solid;">{!! $data_email['pcode'] !!} </td> <th style="border: black 1px solid;">Overhead</th>
<td style="border: black 1px solid;">{!! ucwords(strtolower($data_email['projectname'])) !!}</td> <th style="border: black 1px solid;">Rejected By</th>
<td style="border: black 1px solid;">{!! ucwords(strtolower($data_email['projectmanager'])) !!}</td> <th style="border: black 1px solid;">Remarks</th>
<td style="border: black 1px solid;">{!! ucwords(strtolower($data_email['remarks'])) !!}</td>
</tr> </tr>
</thead>
<tbody>
@foreach($data_overheads as $key => $overhead)
<tr>
<td style="border: black 1px solid;">{!! $overhead['projectname'] !!}</td>
@if($key==0)
<td style="border: black 1px solid;" rowspan="{{count($data_overheads)}}">{!! ucwords(strtolower($overhead['hod'])) !!}</td>
<td style="border: black 1px solid;" rowspan="{{count($data_overheads)}}">{!! ucwords(strtolower($overhead['remarks'])) !!}</td>
@endif
</tr>
@endforeach
</tbody> </tbody>
</table> </table>
<br> <br>
Thank you. <br>
@endif
Thank you. <br>
<!-- <br> --> <!-- <br> -->
--- ---
<br> <br>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment