Commit 107f86fb by Azhan Hannan

flow verification revamped,project verification. checking.

parent 45fda661
...@@ -24,5 +24,7 @@ final class Permission extends Enum ...@@ -24,5 +24,7 @@ final class Permission extends Enum
const laporan = 'laporan'; const laporan = 'laporan';
const projek = 'projek'; const projek = 'projek';
const perananprojek = 'perananprojek'; const perananprojek = 'perananprojek';
const pmverify = 'pmverify';
const pdapproval = 'pdapproval';
} }
@extends('timesheet::layouts.filtermonthphase')
@section('action')
<form class="ui form" action="{{ route('timesheet::dashboard.pmverifyselectmonthphase') }}" method="POST">
@endsection
\ No newline at end of file
@extends('ui::layouts.app')
@section('content')
<div class="ui segment">
<div class="ui blue left ribbon label">
Chargeable Project Verification
</div>
<br>
<br>
<div class="ui styled fluid accordion">
@foreach($profile as $key => $staff)
<div class="title">
<table class="ui unstackable celled table">
<thead>
<tr>
<th style="width: 60%;"><i class="dropdown icon"></i>{{ data_get($staff,'fullname') }}</th>
<th style="width: 15%;" class="center aligned">
<?php
// dd($profile);
$status = $staff->status;
$verified = count(data_get($profile[$key], 'countchargeable')->where('tp_timesheet_sts', 3));
$allproject = count(data_get($profile[$key], 'countchargeable'));
?>
@if($status == 1 || $status == null) In Preparation
@elseif($verified == $allproject) <i class="green check icon"></i> Verified by PM
@elseif($status == 2) <i class="red attention icon"></i> Submitted
@elseif($status == 4) <i class="green check icon"></i>Verified by BOD
@elseif($status == 5) <i class="red attention icon"></i>Dissaproved by BOD
@elseif($status == 6) <i class="red attention icon"></i>Rejected by HOD/HOU
@elseif($status == 7) <i class="red attention icon"></i>Rejected by HR
@endif
</th>
<th style="width: 13%" class="text-center">Submitted on: {{data_get($staff,'submission')}}</th>
<th style="width: 12%" class="text-center">
<button class="center aligned ui blue icon button" onclick="window.location.href='{{ route('timesheet::dashboard.timesheetViewer', [ 'user'=>data_get($staff,'staff_id') ,'phase' => $phase, 'month' => $month, 'year' => $year]) }}';" target='_blank'>View</button>
</th>
</tr>
</thead>
</table>
</div>
<div class="content" style="padding-top: 0px;">
<table class="ui unstackable celled table">
<thead>
<tr>
<th style="width: 10%;">Project Code</th>
<th style="width: 10;">Project Name</th>
<th style="width: 10%;" class="center aligned">Total Hours</th>
<th style="width: 10%;" class="center aligned">Total Days</th>
<th style="width: 30%">Remarks</th>
<th style="width: 13%" class="text-center">Status</th>
<th style="width: 12%;" class="text-center">Action</th>
</tr>
</thead>
@foreach($details as $key => $detail)
@if(data_get($detail,'staffid') == data_get($staff, 'staff_id'))
<tr>
<td style="width: 10%;">{{data_get($detail, 'project.p_project_code')}}</td>
<td style="width: 10;">{{data_get($detail, 'project.p_project_description')}}</td>
<td style="width: 10%;" class="center aligned">{{data_get($detail, 'tp_hours')}}</td>
<td style="width: 10%;" class="center aligned">{{data_get($detail, 'tp_hours')/8}}</td>
<td style="width: 30%">{{data_get($detail, 'verifier_remark')}}</td>
<td style="width: 13%" class="text-center">
@if(data_get($detail, 'tp_timesheet_sts') == 1 || data_get($detail, 'tp_timesheet_sts') == null) In Preparation
@elseif(data_get($detail, 'tp_timesheet_sts') == 2) <i class="red attention icon"></i> Submitted
@elseif(data_get($detail, 'tp_timesheet_sts') == 3) <i class="green check icon"></i> Verified by HOD/HOU
@elseif(data_get($detail, 'tp_timesheet_sts') == 4) <i class="green check icon"></i>Verified by BOD
@elseif(data_get($detail, 'tp_timesheet_sts') == 5) <i class="red attention icon"></i>Dissaproved by BOD
@elseif(data_get($detail, 'tp_timesheet_sts') == 6) <i class="red attention icon"></i>Rejected by HOD/HOU
@elseif(data_get($detail, 'tp_timesheet_sts') == 7) <i class="red attention icon"></i>Rejected by HR
@endif
</td>
<td style="width: 12%;" class="text-center">
@if((data_get($detail, 'tp_timesheet_sts') == 2) || (data_get($detail, 'tp_timesheet_sts') == 6))
<button class="center aligned ui green icon button" onclick="window.location.href='{{route('timesheet::dashboard.projectaction', ['tpid'=>data_get($detail, 'id'), 'phase'=>$phase, 'month'=>$month, 'year'=>$year]) }})';">Verify | Reject</button>
@else
<button class="center aligned ui green icon button disabled">Verify | Reject</button>
@endif
</td>
</tr>
@endif
@endforeach
</table>
</div>
@endforeach
</div>
</div>
@endsection
@push('script')
<script>
$('.ui.accordion').accordion();
</script>
@endpush
\ No newline at end of file
@extends('ui::layouts.app')
@section('content')
<div class="ui segment">
<a class="ui blue left ribbon label">{{data_get($profile, 'project.p_project_description')}}</a>
<br><br>
<form action="{{ route('timesheet::dashboard.verify') }}" method="POST" class="ui form">
{{csrf_field()}}
<input type="hidden" name="tpid" value="{{ data_get($profile,'id') }}">
<input type="hidden" name="tmid" value="{{ data_get($profile,'fk_tm_id') }}">
<input type="hidden" name="pid" value="{{ data_get($profile,'td_project') }}">
<div class="six wide field">
<label>Staff Name</label>
<input type="text" readonly="readonly" value="{{ data_get($profile,'team.fullname') }}">
</div>
<div class="three fields">
<div class="two wide field">
<label>Year</label>
<input type="text" readonly="readonly" value="{{ data_get($profile,'tp_year') }}">
</div>
<div class="two wide field">
<label>Month</label>
<input type="text" readonly="readonly" value="{{ data_get($profile,'tp_month') }}">
</div>
<div class="two wide field">
<label>Phase</label>
<input type="text" readonly="readonly" value="{{ data_get($profile,'tp_phase') }}">
</div>
</div>
<div class="two fields">
<div class="six wide field">
<input type="hidden" name="verifier" value="{{ data_get($pm,'id') }}">
<label>Project Manager</label>
<input type="text" readonly="readonly" value="{{ data_get($pm,'name') }}">
</div>
<div class="three wide field">
<label>Action</label>
<select class="ui fluid dropdown" name="action">
<option value="1">Verify</option>
<option value="2">Reject</option>
</select>
</div>
</div>
<div class="field">
<label>Remarks</label>
<textarea name="remarks"></textarea>
</div>
<button class="ui primary button" type="submit">Submit</button>
</form>
</div>
@endsection
\ No newline at end of file
...@@ -21,16 +21,22 @@ Route::group( ...@@ -21,16 +21,22 @@ Route::group(
//timesheet //timesheet
Route::get('timesheetApproval',['uses' => 'DashboardController@timesheetApproval', 'as' => 'dashboard.timesheetApproval']); Route::get('timesheetApproval',['uses' => 'DashboardController@timesheetApproval', 'as' => 'dashboard.timesheetApproval']);
Route::get('timesheetReport',['uses' => 'DashboardController@timesheetReport', 'as' => 'dashboard.timesheetReport']); Route::get('timesheetReport',['uses' => 'DashboardController@timesheetReport', 'as' => 'dashboard.timesheetReport']);
Route::get('projectVerify',['uses' => 'DashboardController@projectVerify', 'as' => 'dashboard.projectVerify']);
Route::get('timesheetReview',['uses' => 'DashboardController@timesheetReview', 'as' => 'dashboard.timesheetReview']); Route::get('timesheetReview',['uses' => 'DashboardController@timesheetReview', 'as' => 'dashboard.timesheetReview']);
Route::get('timesheetViewer',['uses' => 'DashboardController@timesheetViewer', 'as' => 'dashboard.timesheetViewer']); Route::get('timesheetViewer',['uses' => 'DashboardController@timesheetViewer', 'as' => 'dashboard.timesheetViewer']);
Route::get('filterProjectVerify',['uses' => 'DashboardController@filterProjectVerify', 'as' => 'dashboard.filterProjectVerify']);
Route::get('filterReview',['uses' => 'DashboardController@filterReview', 'as' => 'dashboard.filterReview']); Route::get('filterReview',['uses' => 'DashboardController@filterReview', 'as' => 'dashboard.filterReview']);
Route::get('filterViewer',['uses' => 'DashboardController@filterViewer', 'as' => 'dashboard.filterViewer']); Route::get('filterViewer',['uses' => 'DashboardController@filterViewer', 'as' => 'dashboard.filterViewer']);
Route::get('filterApproval',['uses' => 'DashboardController@filterApproval', 'as' => 'dashboard.filterApproval']); Route::get('filterApproval',['uses' => 'DashboardController@filterApproval', 'as' => 'dashboard.filterApproval']);
Route::post('pmverifyselectmonthphase', ['uses' => 'DashboardController@pmverifyselectmonthphase', 'as' => 'dashboard.pmverifyselectmonthphase']);
Route::post('reviewselectmonthphase', ['uses' => 'DashboardController@reviewselectmonthphase', 'as' => 'dashboard.reviewselectmonthphase']); Route::post('reviewselectmonthphase', ['uses' => 'DashboardController@reviewselectmonthphase', 'as' => 'dashboard.reviewselectmonthphase']);
Route::post('viewerselectmonthphase', ['uses' => 'DashboardController@viewerselectmonthphase', 'as' => 'dashboard.viewerselectmonthphase']); Route::post('viewerselectmonthphase', ['uses' => 'DashboardController@viewerselectmonthphase', 'as' => 'dashboard.viewerselectmonthphase']);
Route::post('approvalselectmonthphase', ['uses' => 'DashboardController@approvalselectmonthphase', 'as' => 'dashboard.approvalselectmonthphase']); Route::post('approvalselectmonthphase', ['uses' => 'DashboardController@approvalselectmonthphase', 'as' => 'dashboard.approvalselectmonthphase']);
Route::get('tsubmit', ['uses' => 'DashboardController@tsubmit', 'as' => 'dashboard.tsubmit']); Route::get('tsubmit', ['uses' => 'DashboardController@tsubmit', 'as' => 'dashboard.tsubmit']);
Route::get('revaction', ['uses' => 'DashboardController@revaction', 'as' => 'dashboard.revaction']); Route::get('revaction', ['uses' => 'DashboardController@revaction', 'as' => 'dashboard.revaction']);
Route::get('projectaction', ['uses' => 'DashboardController@projectaction', 'as' => 'dashboard.projectaction']);
Route::get('approvalaction', ['uses' => 'DashboardController@approvalaction', 'as' => 'dashboard.approvalaction']); Route::get('approvalaction', ['uses' => 'DashboardController@approvalaction', 'as' => 'dashboard.approvalaction']);
Route::post('verify', ['uses' => 'DashboardController@verify', 'as' => 'dashboard.verify']); Route::post('verify', ['uses' => 'DashboardController@verify', 'as' => 'dashboard.verify']);
Route::post('approval', ['uses' => 'DashboardController@approval', 'as' => 'dashboard.approval']); Route::post('approval', ['uses' => 'DashboardController@approval', 'as' => 'dashboard.approval']);
......
...@@ -18,6 +18,8 @@ use Portal\Timesheet\Model\Role; ...@@ -18,6 +18,8 @@ use Portal\Timesheet\Model\Role;
use Portal\Timesheet\Model\VwViewer; use Portal\Timesheet\Model\VwViewer;
use Portal\Timesheet\Model\VwReviewProfile; use Portal\Timesheet\Model\VwReviewProfile;
use Portal\Timesheet\Model\VwReviewDetails; use Portal\Timesheet\Model\VwReviewDetails;
use Portal\Timesheet\Model\VwChargeableVerification;
use Portal\Timesheet\Model\VwChargeableReview;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Input;
use File; use File;
...@@ -106,6 +108,20 @@ class DashboardController extends Controller ...@@ -106,6 +108,20 @@ class DashboardController extends Controller
return view('timesheet::dashboard.filterViewer', compact('month', 'curryear', 'currmonth')); return view('timesheet::dashboard.filterViewer', compact('month', 'curryear', 'currmonth'));
} }
public function filterProjectVerify()
{
$currmonth = date('n');
$curryear = date('Y');
$month = [];
for ($m=1; $m<=12; $m++) {
$month[] = date('F', mktime(0,0,0,$m, 1, date('Y')));
}
return view('timesheet::dashboard.filterProjectVerify', compact('month', 'curryear', 'currmonth'));
}
public function filterReview() public function filterReview()
{ {
$currmonth = date('n'); $currmonth = date('n');
...@@ -139,6 +155,11 @@ class DashboardController extends Controller ...@@ -139,6 +155,11 @@ class DashboardController extends Controller
return redirect()->route('timesheet::dashboard.timesheetViewer', ['phase' => $request->phase, 'month' =>$request->month]); return redirect()->route('timesheet::dashboard.timesheetViewer', ['phase' => $request->phase, 'month' =>$request->month]);
} }
public function pmverifyselectmonthphase(Request $request){
return redirect()->route('timesheet::dashboard.projectVerify', ['phase' => $request->phase, 'month' =>$request->month]);
}
public function reviewselectmonthphase(Request $request){ public function reviewselectmonthphase(Request $request){
return redirect()->route('timesheet::dashboard.timesheetReview', ['phase' => $request->phase, 'month' =>$request->month]); return redirect()->route('timesheet::dashboard.timesheetReview', ['phase' => $request->phase, 'month' =>$request->month]);
...@@ -214,6 +235,53 @@ class DashboardController extends Controller ...@@ -214,6 +235,53 @@ class DashboardController extends Controller
return view('timesheet::dashboard.timesheetReport'); return view('timesheet::dashboard.timesheetReport');
} }
public function projectVerify(Request $request)
{
$verifier = Users::find(Auth::id());
// dd($verifier);
$curryear = date('Y');
if ($request->year) {
$curryear = $request->year;
}
$year = date('Y');
if(isset($request->phase))
{
$phase = $request->phase;
}
if(isset($request->month))
{
$month = $request->month;
}
if(isset($request->year))
{
$year = $request->year;
}
$profile = VwChargeableVerification::select('tmid', 'staff_id', 'year', 'month', 'phase', 'status', 'submission', 'fullname', 'roleid', 'pmstaffid')
->where('pmstaffid', $verifier->u_staffID)
->where('year', $curryear)
->where('month', $month)
->where('phase', $phase)
->distinct('staff_id')
->orderby('roleid')
->with('countchargeable')
->get();
$details = Tproject::where('tp_year', $curryear)
->where('tp_month', $month)
->where('tp_phase', $phase)
->where('tp_pm', $verifier->u_staffID)
->with('project')
->with('pm')
->get();
// dd($details);
return view('timesheet::dashboard.projectVerify', compact('profile', 'details', 'year', 'month', 'phase'));
}
public function timesheetReview(Request $request) public function timesheetReview(Request $request)
{ {
// dd($request->phase); // dd($request->phase);
...@@ -283,55 +351,95 @@ class DashboardController extends Controller ...@@ -283,55 +351,95 @@ class DashboardController extends Controller
return view('timesheet::dashboard.revaction', compact('profile', 'hod')); return view('timesheet::dashboard.revaction', compact('profile', 'hod'));
} }
public function projectaction(Request $request)
{
$profile = Tproject::where('id', $request->tpid)
->with('team')
->with('project')
->first();
// dd($profile);
$pm = Users::find(Auth::id());
return view('timesheet::dashboard.projectaction', compact('profile', 'pm'));
}
public function verify(Request $request) public function verify(Request $request)
{ {
// dd($request); $pm = Users::find(Auth::id());
$hod = Users::find(Auth::id());
$today = Carbon::today()->toDateString(); $today = Carbon::today()->toDateString();
$profile = VwReviewProfile::where('hod_id', $hod->id) $profile = Tproject::where('id', $request->tpid)
->where('tmid', $request->tmid) ->first();
->first();
$month = $profile->tm_month; // dd($profile);
$phase = $profile->tm_phase;
$month = $profile->tp_month;
$phase = $profile->tp_phase;
if ($request->action == 1) { if ($request->action == 1) {
$ts = Ts_master::where('id', $request->tmid)
->update( $profile->tp_timesheet_sts = 3;
[ $profile->tp_verified_by = $request->verifier;
'tm_timesheet_master_sts' => 3, $profile->tp_verified_at = $today;
'tm_verified_at' => $today, $profile->verifier_remark = data_get($request,'remarks');
'tm_verified_by' => $request->verifier, $profile->save();
'hod_remarks' => $request->remarks
]);
$td = Ts_detail::where('fk_tm_id', $request->tmid) $td = Ts_detail::where('fk_tm_id', $request->tmid)
->where('td_project', $request->pid)
->update([ 'td_timesheet_sts' => 3 ]); ->update([ 'td_timesheet_sts' => 3 ]);
$tp = Tproject::where('fk_tm_id', $request->tmid) $checkapproved = Tproject::where('fk_tm_id', $request->tmid)
->update(['tp_timesheet_sts' => 3]); ->where('tp_timesheet_sts', 3)
->get();
$allproject = Tproject::where('fk_tm_id', $request->tmid)
->get();
return redirect()->route('timesheet::dashboard.timesheetReview', compact('month', 'phase'))->withSuccess('Staff Timesheet has been verify'); if(count($allproject) == count($checkapproved)){
$ts = Ts_master::where('id', $request->tmid)
->update(
[
'tm_timesheet_master_sts' => 3,
'tm_verified_at' => $today
]);
}
return redirect()->route('timesheet::dashboard.projectVerify', compact('month', 'phase'))->withSuccess('Staff project has been verified.');
} else { } else {
$ts = Ts_master::where('id', $request->tmid)
->update( $profile->tp_timesheet_sts = 6;
[ $profile->tp_verified_by = $request->verifier;
'tm_timesheet_master_sts' => 6, $profile->tp_verified_at = $today;
'hod_rejected_at' => $today, $profile->verifier_remark = data_get($request,'remarks');
'hod_remarks' => $request->remarks $profile->save();
]);
$td = Ts_detail::where('fk_tm_id', $request->tmid) $td = Ts_detail::where('fk_tm_id', $request->tmid)
->where('td_project', $request->pid)
->update([ 'td_timesheet_sts' => 6 ]); ->update([ 'td_timesheet_sts' => 6 ]);
$tp = Tproject::where('fk_tm_id', $request->tmid) $tp = Tproject::where('fk_tm_id', $request->tmid)
->update(['tp_timesheet_sts' => 6]); ->update(['tp_timesheet_sts' => 6]);
return redirect()->route('timesheet::dashboard.timesheetReview', compact('month', 'phase'))->withErrors('Timesheet has been rejected with remarks'); $checkrejected = Tproject::where('fk_tm_id', $request->tmid)
->where('tp_timesheet_sts', 6)
->get();
if($checkrejected){
$ts = Ts_master::where('id', $request->tmid)
->update(
[
'tm_timesheet_master_sts' => 6,
'hod_rejected_at' => $today,
]);
}
return redirect()->route('timesheet::dashboard.projectVerify', compact('month', 'phase'))->withErrors('Staff project has been rejected with remarks');
} }
} }
...@@ -563,7 +671,9 @@ class DashboardController extends Controller ...@@ -563,7 +671,9 @@ class DashboardController extends Controller
$checknotes = Ts_detail::where('fk_tm_id', $request->tid) $checknotes = Ts_detail::where('fk_tm_id', $request->tid)
->whereNotNull('td_hours') ->whereNotNull('td_hours')
->where('td_project_type', 3)
->get(); ->get();
// dd($checknotes);
foreach ($checknotes as $key => $value) { foreach ($checknotes as $key => $value) {
if($value->td_overhead_note == null) if($value->td_overhead_note == null)
......
...@@ -297,7 +297,8 @@ class FormController extends Controller ...@@ -297,7 +297,8 @@ class FormController extends Controller
$tpdetail->tp_project_name = $project->p_project_description; $tpdetail->tp_project_name = $project->p_project_description;
$tpdetail->tp_hours = $checkhours->sum('td_hours'); $tpdetail->tp_hours = $checkhours->sum('td_hours');
$tpdetail->tp_pm = $project->p_project_task_team; $tpdetail->tp_pm = $project->p_project_task_team;
$tpdetail->tp_pd = $project->p_project_director;
$tpdetail->tp_timesheet_sts = 1; $tpdetail->tp_timesheet_sts = 1;
$tpdetail->updated_by = $userId; $tpdetail->updated_by = $userId;
$tpdetail->save(); $tpdetail->save();
......
...@@ -20,6 +20,22 @@ class Tproject extends Model ...@@ -20,6 +20,22 @@ class Tproject extends Model
* @return void * @return void
* @author * @author
**/ **/
public function project()
{
return $this->hasOne('Portal\Timesheet\Model\Project','id','td_project');
}
public function pm()
{
return $this->hasOne('Portal\Timesheet\Model\Staff_info','staff_id','tp_pm');
}
public function team()
{
return $this->hasOne('Portal\Timesheet\Model\Staff_info','staff_id','staffid');
}
public function info() public function info()
{ {
......
<?php
namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class VwChargeableReview extends Model
{
use Notifiable;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'vw_chargeable_review';
/**
* undocumented function
*
* @return void
* @author
**/
public function info()
{
}
}
<?php
namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class VwChargeableVerification extends Model
{
use Notifiable;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'vw_chargeable_verification';
/**
* undocumented function
*
* @return void
* @author
**/
public function countchargeable()
{
return $this->hasMany('Portal\Timesheet\Model\Tproject','fk_tm_id','tmid')->where('tp_project_type', 1);
}
public function info()
{
}
}
...@@ -86,14 +86,22 @@ class ServiceProvider extends BaseServiceProvider ...@@ -86,14 +86,22 @@ class ServiceProvider extends BaseServiceProvider
->data('icon', 'calendar alternate outline icon') ->data('icon', 'calendar alternate outline icon')
->active('timesheetViewer/*') ->active('timesheetViewer/*')
->data('permission', Permission::tsviewer); ->data('permission', Permission::tsviewer);
$form->add(__('Timesheet Review'), route('timesheet::dashboard.filterReview')) $form->add(__('Chargeable Verification'), route('timesheet::dashboard.filterProjectVerify'))
->data('icon', 'calendar alternate outline icon')
->active('timesheetApproval/*')
->data('permission', Permission::pmverify);
$form->add(__('Chargeable Approval'))
->data('icon', 'calendar alternate outline icon')
->active('timesheetApproval/*')
->data('permission', Permission::pdapproval);
$form->add(__('Overhead Review'), route('timesheet::dashboard.filterReview'))
->data('icon', 'calendar alternate outline icon') ->data('icon', 'calendar alternate outline icon')
->active('timesheetReview/*') ->active('timesheetReview/*')
->data('permission', Permission::kehadiran); ->data('permission', Permission::kehadiran);
$form->add(__('Timesheet Approval'), route('timesheet::dashboard.filterApproval')) $form->add(__('Overhead Approval'), route('timesheet::dashboard.filterApproval'))
->data('icon', 'calendar alternate outline icon') ->data('icon', 'calendar alternate outline icon')
->active('timesheetApproval/*') ->active('timesheetApproval/*')
->data('permission', Permission::kehadiran); ->data('permission', Permission::kehadiran);
$laporan = $this->app['laravolt.menu']->add(__('Report'))->data('icon', 'align justify'); $laporan = $this->app['laravolt.menu']->add(__('Report'))->data('icon', 'align justify');
$laporan->add(__('Report Summary'), route('timesheet::report.ringkasanLaporan')) $laporan->add(__('Report Summary'), route('timesheet::report.ringkasanLaporan'))
......
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