@@ -687,6 +687,25 @@ class DashboardController extends Controller
...
@@ -687,6 +687,25 @@ class DashboardController extends Controller
publicfunctionapproval(Request$request)
publicfunctionapproval(Request$request)
{
{
if($request->action==2&&$request->remarks==null)
{
// dd('reject & tak komen');
$profile=Tproject::where('id',$request->tpid)
->with('team')
->first();
// dd($profile);
$tpid=$profile->id;
$year=$profile->tp_year;
$month=$profile->tp_month;
$phase=$profile->tp_phase;
$bod=Users::find(Auth::id());
returnredirect()->route('timesheet::dashboard.approvalaction',compact('profile','bod','tpid','year','month','phase'))->with('warning','You wanted to reject the submission. Kindly give remarks for staff references. Thank you 😊');
}
// dd($request);
$bod=Users::find(Auth::id());
$bod=Users::find(Auth::id());
$today=Carbon::today()->toDateString();
$today=Carbon::today()->toDateString();
...
@@ -731,7 +750,7 @@ class DashboardController extends Controller
...
@@ -731,7 +750,7 @@ class DashboardController extends Controller
->update(
->update(
[
[
'tm_timesheet_master_sts'=>4,
'tm_timesheet_master_sts'=>4,
'tm_verified_at'=>$today
'tm_approved_at'=>$today
]);
]);
}
}
...
@@ -758,9 +777,12 @@ class DashboardController extends Controller
...
@@ -758,9 +777,12 @@ class DashboardController extends Controller
$checkrejected=Tproject::where('fk_tm_id',$tmid)
$checkrejected=Tproject::where('fk_tm_id',$tmid)
->where('tp_timesheet_sts',5)
->where('tp_timesheet_sts',5)
->first();
->get();
$allrejected=Tproject::where('fk_tm_id',$tmid)
->get();
if($checkrejected){
if(count($checkrejected)==count($allrejected)){
Ts_master::where('id',$tmid)
Ts_master::where('id',$tmid)
->update(
->update(
[
[
...
@@ -769,7 +791,6 @@ class DashboardController extends Controller
...
@@ -769,7 +791,6 @@ class DashboardController extends Controller
]);
]);
}
}
returnredirect()->route('timesheet::dashboard.timesheetApproval',compact('month','phase'))->withErrors('Staff project has been rejected with remarks');
returnredirect()->route('timesheet::dashboard.timesheetApproval',compact('month','phase'))->withErrors('Staff project has been rejected with remarks');