Commit 45fda661 by Azhan Hannan

checking note before submit timesheet.

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