Commit 45fda661 by Azhan Hannan

checking note before submit timesheet.

parent 088f7387
......@@ -352,18 +352,20 @@
<table id="printtable5" class="ui celled structured table unstackable">
<thead>
<tr>
<th colspan="2" class="center aligned">Notes</th>
<th colspan="3" class="center aligned">Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 14%;">Date</td>
<td style="width: 10%;">Date</td>
<td style="width: 17%;">Overhead</td>
<td>Description</td>
</tr>
@if($notes)
@foreach($notes as $key => $value)
<tr>
<td>{{ data_get($value,'td_date') }}</td>
<td>{{ data_get($value,'td_overhead_desc') }}</td>
<td>{{ data_get($value,'td_overhead_note') }}</td>
</tr>
@endforeach
......@@ -598,7 +600,7 @@
@else
@if($check != null)
<button type="button" class="ui green button" onclick="window.location.href='{{ route('timesheet::dashboard.tsubmit',[ 'tid'=> $check->id, 'totalot'=> $totalot, 'totalchargehrs'=>$totalchargehrs,'totaloverheadhrs'=>$totaloverheadhrs ]) }}';">Submit</button>
<button type="button" class="ui green button" onclick="window.location.href='{{ route('timesheet::dashboard.tsubmit',[ 'tid'=> $check->id, 'totalot'=> $totalot, 'totalchargehrs'=>$totalchargehrs,'totaloverheadhrs'=>$totaloverheadhrs, 'phase' => $phase, 'month' => $month, 'year' => $year ]) }}';">Submit</button>
@else
<button type="button" class="ui disabled green button">Submit</button>
@endif
......
......@@ -561,6 +561,18 @@ class DashboardController extends Controller
public function tsubmit(Request $request)
{
$checknotes = Ts_detail::where('fk_tm_id', $request->tid)
->whereNotNull('td_hours')
->get();
foreach ($checknotes as $key => $value) {
if($value->td_overhead_note == null)
{
return redirect()->route('timesheet::form.notelist', ['year' => $request->year, 'month'=> $request->month, 'phase'=> $request->phase, 'fk_tm_id'=> $request->tid ])->withSuccess('Kindly fill in and save your notes before submit your timesheet. Thank you 😊');
}
}
$today = Carbon::today()->toDateString();
$submit = 2;
......@@ -580,6 +592,7 @@ class DashboardController extends Controller
$tp = Tproject::where('fk_tm_id', $request->tid)
->update(['tp_timesheet_sts' => 2]);
return redirect()->route('timesheet::dashboard.index')->withSuccess('Timesheet has been submitted!');
}
......
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