Commit 33820873 by Azhan Hannan

JIKA PM SELECT ‘Reject’, wajib isi Remarks *, dan tak lepas submit selagi tak…

JIKA PM SELECT ‘Reject’, wajib isi Remarks *, dan tak lepas submit selagi tak isi remarks. Expectation:Selepas resubmit ke PM, Paparkan popup message ‘Timesheet has been resubmit  to Project Manager’.
parent 273839ff
...@@ -55,8 +55,8 @@ ...@@ -55,8 +55,8 @@
@elseif(data_get($value,'tm_timesheet_master_sts') == 2) <i class="green check icon"></i> Submitted @elseif(data_get($value,'tm_timesheet_master_sts') == 2) <i class="green check icon"></i> Submitted
@elseif(data_get($value,'tm_timesheet_master_sts') == 3) <i class="green check icon"></i> Verified by PM @elseif(data_get($value,'tm_timesheet_master_sts') == 3) <i class="green check icon"></i> Verified by PM
@elseif(data_get($value,'tm_timesheet_master_sts') == 4) <i class="green check icon"></i> Approved by PD @elseif(data_get($value,'tm_timesheet_master_sts') == 4) <i class="green check icon"></i> Approved by PD
@elseif(data_get($value,'tm_timesheet_master_sts') == 5) <i class="green check icon"></i> Rejected by PD @elseif(data_get($value,'tm_timesheet_master_sts') == 5) <i class="red attention icon"></i> Rejected by PD
@elseif(data_get($value,'tm_timesheet_master_sts') == 6) <i class="green check icon"></i> Rejected by PM @elseif(data_get($value,'tm_timesheet_master_sts') == 6) <i class="red attention icon"></i> Rejected by PM
@endif @endif
</th> </th>
<th style="width: 13%" class="text-center">Submitted on: {{data_get($value,'tm_submission_at')}}</th> <th style="width: 13%" class="text-center">Submitted on: {{data_get($value,'tm_submission_at')}}</th>
......
...@@ -120,7 +120,7 @@ class DashboardController extends Controller ...@@ -120,7 +120,7 @@ class DashboardController extends Controller
$profile = VwChargeableVerification::select('tmid', 'staff_id', 'year', 'month', 'phase', 'status', 'submission', 'fullname', 'roleid', 'pmstaffid') $profile = VwChargeableVerification::select('tmid', 'staff_id', 'year', 'month', 'phase', 'status', 'submission', 'fullname', 'roleid', 'pmstaffid')
->where('pmstaffid', $verifier->u_staffID) ->where('pmstaffid', $verifier->u_staffID)
->where('status', 2) ->whereIn('status', [2,6])
// ->groupby('staff_id') // ->groupby('staff_id')
->distinct('staff_id') ->distinct('staff_id')
->orderby('year', 'desc') ->orderby('year', 'desc')
...@@ -146,7 +146,7 @@ class DashboardController extends Controller ...@@ -146,7 +146,7 @@ class DashboardController extends Controller
$profile = VwChargeableVerification::select('tmid', 'staff_id', 'year', 'month', 'phase', 'status', 'submission', 'fullname', 'roleid', 'pmstaffid', 'dept') $profile = VwChargeableVerification::select('tmid', 'staff_id', 'year', 'month', 'phase', 'status', 'submission', 'fullname', 'roleid', 'pmstaffid', 'dept')
->where('pmstaffid', $verifier->u_staffID) ->where('pmstaffid', $verifier->u_staffID)
->where('status', 2) ->whereIn('status', [2,6])
->distinct('staff_id') ->distinct('staff_id')
->orderby('roleid') ->orderby('roleid')
->with('countchargeable') ->with('countchargeable')
...@@ -514,7 +514,7 @@ class DashboardController extends Controller ...@@ -514,7 +514,7 @@ class DashboardController extends Controller
$pm = Users::find(Auth::id()); $pm = Users::find(Auth::id());
if(data_get($request,'page') == 1){ if(data_get($request,'page') == 1){
return redirect()->route('timesheet::dashboard.index'); return redirect()->route('timesheet::dashboard.index')->withWarning('You wanted to rejected the project submission. Kindly give remarks for team references. Thank you 😊');
} }
return redirect()->route('timesheet::dashboard.projectaction', compact('profile', 'pm', 'tpid', 'year', 'month', 'phase'))->with('warning', 'You wanted to rejected the project submission. Kindly give remarks for team references. Thank you 😊'); return redirect()->route('timesheet::dashboard.projectaction', compact('profile', 'pm', 'tpid', 'year', 'month', 'phase'))->with('warning', 'You wanted to rejected the project submission. Kindly give remarks for team references. Thank you 😊');
......
...@@ -1537,6 +1537,8 @@ class FormController extends Controller ...@@ -1537,6 +1537,8 @@ class FormController extends Controller
public function resubmit(Request $request) public function resubmit(Request $request)
{ {
$roleid = auth()->user()->roles['0']->id;
// dd($request); // dd($request);
$profile = Tproject::where('id', $request->tpid) $profile = Tproject::where('id', $request->tpid)
...@@ -1593,37 +1595,52 @@ class FormController extends Controller ...@@ -1593,37 +1595,52 @@ class FormController extends Controller
$valuehour = 0; $valuehour = 0;
} }
// dd($checkTimesheetDetail); if($valuehour == 0)
if($checkTimesheetDetail)
{ {
$checkTimesheetDetail->td_hours = $valuehour; if($checkTimesheetDetail)
$checkTimesheetDetail->updated_by = $userId; {
$checkTimesheetDetail->save();
$checkTimesheetDetail->td_hours = $valuehour;
$checkTimesheetDetail->updated_by = $userId;
$checkTimesheetDetail->save();
} }
else }
else
{ {
if($checkTimesheetDetail)
$tmdetail = new Ts_detail; {
$tmdetail->td_date = $date; $checkTimesheetDetail->td_hours = $valuehour;
$tmdetail->td_project = $projectid; $checkTimesheetDetail->updated_by = $userId;
$tmdetail->fk_tm_id = $tmasterid; $checkTimesheetDetail->save();
$tmdetail->tm_staff_id = $userId;
$tmdetail->tm_month = $check->tm_month;
$tmdetail->tm_year = $check->tm_year;
$tmdetail->tm_phase = $check->tm_phase;
$tmdetail->td_project_type = $chargeable;
$project = Project::where('id', $projectid) }
->first(); else
{
$tmdetail = new Ts_detail;
$tmdetail->td_date = $date;
$tmdetail->td_project = $projectid;
$tmdetail->fk_tm_id = $tmasterid;
$tmdetail->tm_staff_id = $userId;
$tmdetail->tm_month = $check->tm_month;
$tmdetail->tm_year = $check->tm_year;
$tmdetail->tm_phase = $check->tm_phase;
$tmdetail->td_project_type = $chargeable;
$project = Project::where('id', $projectid)
->first();
$tmdetail->td_project_name = $project->p_project_description;
$tmdetail->td_hours = $valuehour;
$tmdetail->td_timesheet_sts = 2;
$tmdetail->updated_by = $userId;
$tmdetail->save();
$tmdetail->td_project_name = $project->p_project_description; }
$tmdetail->td_hours = $valuehour;
$tmdetail->td_timesheet_sts = 1;
$tmdetail->updated_by = $userId;
$tmdetail->save();
} }
} }
$checktproject = Tproject::where('fk_tm_id', $tmasterid) $checktproject = Tproject::where('fk_tm_id', $tmasterid)
...@@ -1663,21 +1680,27 @@ class FormController extends Controller ...@@ -1663,21 +1680,27 @@ class FormController extends Controller
} }
$zeroedproject = Tproject::where('fk_tm_id', $tmasterid) $zeroedproject = Tproject::where('id', data_get($request,'tpid'))
->where('td_project', $projectid)
->where('tp_hours', 0) ->where('tp_hours', 0)
->first(); ->first();
// dd($request->tpid);
Ts_detail::where('fk_tm_id', $tmasterid)
->where('td_project', data_get($zeroedproject,'td_project'))
->where('td_hours', 0)
->delete();
if ($zeroedproject) if ($zeroedproject)
{ {
Tproject::where('fk_tm_id', $tmasterid) Tproject::where('id', $request->tpid)
->where('td_project', $projectid)
->delete(); ->delete();
Ts_detail::where('fk_tm_id', $tmasterid) Ts_detail::where('fk_tm_id', $tmasterid)
->where('td_project', $projectid) ->where('td_project', data_get($zeroedproject,'td_project'))
// ->where('td_hours', 0)
->delete(); ->delete();
} }
// dd($datasat);
} }
$sumdetailhour = Ts_detail::where('td_project_type', $chargeable) $sumdetailhour = Ts_detail::where('td_project_type', $chargeable)
...@@ -1698,7 +1721,7 @@ class FormController extends Controller ...@@ -1698,7 +1721,7 @@ class FormController extends Controller
->where('td_project', $profile->td_project) ->where('td_project', $profile->td_project)
->update(['td_timesheet_sts' => 2]); ->update(['td_timesheet_sts' => 2]);
return redirect()->route('timesheet::dashboard.index'); return redirect()->route('timesheet::dashboard.index')->withSuccess('Timesheet has been resubmit to Project Manager');
} }
public function resubmitoverhead(Request $request) public function resubmitoverhead(Request $request)
......
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