Commit 0db6efdd by Azhan Hannan

New note page, display table form and saved. Required.

parent fe414e0d
...@@ -28,26 +28,41 @@ ...@@ -28,26 +28,41 @@
<div class="ui unstackable segment"> <div class="ui unstackable segment">
<a class="ui blue left ribbon label">Senarai Notes</a> <a class="ui blue left ribbon label">Senarai Notes</a>
<br><br> <br><br>
@if(data_get($staff,'fk_lkp_department') == 7) @if(data_get($staff,'fk_lkp_department') == 7)
<button class="right floated aligned ui olive compact labeled icon button" id="uploadmodal"> <button type="button" class="right floated aligned ui olive compact labeled icon button" id="uploadmodal">
<i class="file icon"></i> <i class="file icon"></i>
Upload File Upload File
</button> </button>
@endif @endif
<a href="{{ route('timesheet::form.penambahannote') }}" class="right floated aligned ui orange compact labeled icon button">
<form class="ui form horizontal" action="{{ route('timesheet::form.savenote') }}" method="POST">
{{csrf_field()}}
<input type="hidden" name="year" value="{{$year}}">
<input type="hidden" name="month" value="{{$month}}">
<input type="hidden" name="phase" value="{{$phase}}">
<input type="hidden" name="tmid" value="{{$fk_tm_id}}">
<!-- <a href="{{ route('timesheet::form.penambahannote') }}" class="right floated aligned ui orange compact labeled icon button">
<i class="plus icon"></i>Add New Notes <i class="plus icon"></i>Add New Notes
</a> </a> -->
<button class="center aligned ui purple compact labeled icon button" onclick="window.location.href='{{ route('timesheet::form.overheadForm', ['phase' => $phase, 'month' => $month]) }}';"> <button type="submit" class="right floated aligned ui orange compact button">
Save
</button>
<button type="button" class="center aligned ui purple compact labeled icon button" onclick="window.location.href='{{ route('timesheet::form.overheadForm', ['phase' => $phase, 'month' => $month]) }}';">
<i class="angle double left icon"></i> <i class="angle double left icon"></i>
Overhead Form Overhead Form
</button> </button>
<button class="center aligned ui pink compact right labeled icon button" onclick="window.location.href='{{ route('timesheet::dashboard.timesheetViewer', ['phase' => $phase, 'month' => $month, 'year' => $year]) }}';">
<button type="button" class="center aligned ui pink compact right labeled icon button" onclick="window.location.href='{{ route('timesheet::dashboard.timesheetViewer', ['phase' => $phase, 'month' => $month, 'year' => $year]) }}';">
<i class="angle double right icon"></i> <i class="angle double right icon"></i>
Timesheet Viewer Timesheet Viewer
</button> </button>
<table class="ui celled padded table"> <table class="ui celled structured table unstackable">
<thead> <thead>
<tr> <tr>
<th style="width: 3%;">No</th> <th style="width: 3%;">No</th>
...@@ -57,17 +72,40 @@ ...@@ -57,17 +72,40 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach($notes as $key => $value) @foreach($onotes as $key => $value)
<tr>
<td>{{$key+1}} </td>
<td class="single line">
<input type="hidden" name="date[{{$key}}]" value="{{data_get($value,'td_date')}}">
{{data_get($value,'td_date')}}
</td>
<td class="single line">
<input type="hidden" name="oid[{{$key}}]" value="{{data_get($value,'fk_o_id')}}">
{{data_get($value,'td_overhead_desc')}}
</td>
<td class="single line">
@if(data_get($value,'td_overhead_note'))
<input type="text" name="note[{{$key}}]" value="{{data_get($value,'td_overhead_note')}}" required="required">
@else
<input type="text" name="note[{{$key}}]" placeholder="Fill in the notes for your overhead task" required="required">
@endif
</td>
</tr>
@endforeach
<!-- @foreach($notes as $key => $value)
<tr> <tr>
<td>{{$key+1}} </td> <td>{{$key+1}} </td>
<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_desc') }} </td>
<td>{{ data_get($value,'td_overhead_note') }} </td> <td>{{ data_get($value,'td_overhead_note') }} </td>
</tr> </tr>
@endforeach @endforeach -->
</tbody> </tbody>
</table> </table>
</form>
</div> </div>
@endsection @endsection
......
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
<label>Description</label> <label>Description</label>
<textarea name="description" cols="30" rows="10"></textarea> <textarea name="description" cols="30" rows="10"></textarea>
</div> </div>
<button class="ui button" type="submit">Submit</button> <button class="ui primary button" type="submit">Submit</button>
</form> </form>
</div> </div>
@endsection @endsection
\ No newline at end of file
...@@ -23,7 +23,9 @@ ...@@ -23,7 +23,9 @@
</div> </div>
<button class="ui green button" type="submit">Update</button> <button class="ui green button" type="submit">Update</button>
<button class="center aligned ui olive button" type="button" onclick="window.location.href='{{ route('timesheet::maintenance.senaraiOverhead') }}';">
Back
</button>
</form> </form>
</div> </div>
@endsection @endsection
\ No newline at end of file
...@@ -8,17 +8,19 @@ ...@@ -8,17 +8,19 @@
{{csrf_field()}} {{csrf_field()}}
<div class="field"> <div class="field">
<label>Overhead Lookup</label> <label>Overhead Lookup</label>
<input type="text" name="overheadlookup" placeholder="Enter new lookup overhead"> <input type="text" name="overheadlookup" placeholder="Enter new lookup overhead" required=required>
</div> </div>
<div class="field"> <div class="field">
<label>Overhead Status</label> <label>Overhead Status</label>
<select name="status" class="ui fluid dropdown"> <select name="status" class="ui fluid dropdown">
<option value="">Overhead Status</option>
<option value="1">Active</option> <option value="1">Active</option>
<option value="0">Inactive</option> <option value="0">Inactive</option>
</select> </select>
</div> </div>
<button class="ui blue button" type="submit">Add</button> <button class="ui blue button" type="submit">Add</button>
<button class="center aligned ui olive button" type="button" onclick="window.location.href='{{ route('timesheet::maintenance.senaraiOverhead') }}';">
Back
</button>
</form> </form>
</div> </div>
@endsection @endsection
\ No newline at end of file
...@@ -79,6 +79,7 @@ Route::group( ...@@ -79,6 +79,7 @@ Route::group(
Route::get('notelist',['uses' => 'FormController@notelist', 'as' => 'form.notelist']); Route::get('notelist',['uses' => 'FormController@notelist', 'as' => 'form.notelist']);
Route::get('penambahannote',['uses' => 'FormController@penambahannote', 'as' => 'form.penambahannote']); Route::get('penambahannote',['uses' => 'FormController@penambahannote', 'as' => 'form.penambahannote']);
Route::post('addnote', ['uses' => 'FormController@addnote', 'as' => 'form.addnote']); Route::post('addnote', ['uses' => 'FormController@addnote', 'as' => 'form.addnote']);
Route::post('savenote', ['uses' => 'FormController@savenote', 'as' => 'form.savenote']);
Route::get('filterChargeable',['uses' => 'FormController@filterChargeable', 'as' => 'form.filterChargeable']); Route::get('filterChargeable',['uses' => 'FormController@filterChargeable', 'as' => 'form.filterChargeable']);
Route::get('filterOverhead',['uses' => 'FormController@filterOverhead', 'as' => 'form.filterOverhead']); Route::get('filterOverhead',['uses' => 'FormController@filterOverhead', 'as' => 'form.filterOverhead']);
Route::get('filterNotes',['uses' => 'FormController@filterNotes', 'as' => 'form.filterNotes']); Route::get('filterNotes',['uses' => 'FormController@filterNotes', 'as' => 'form.filterNotes']);
......
...@@ -790,6 +790,7 @@ class FormController extends Controller ...@@ -790,6 +790,7 @@ class FormController extends Controller
foreach ($value as $keyday => $day) foreach ($value as $keyday => $day)
{ {
if($day){
$date = $request->year.'-'.$request->month.'-'.sprintf('%02d', $keyday); $date = $request->year.'-'.$request->month.'-'.sprintf('%02d', $keyday);
$checkTimesheetDetail = Ts_detail::where('fk_o_id', $projectid) $checkTimesheetDetail = Ts_detail::where('fk_o_id', $projectid)
...@@ -805,13 +806,16 @@ class FormController extends Controller ...@@ -805,13 +806,16 @@ class FormController extends Controller
$valuehour = 0; $valuehour = 0;
} }
if($checkTimesheetDetail) if($valuehour == "NaN")
{ {
$valuehour = null;
}
if($checkTimesheetDetail)
{
$checkTimesheetDetail->td_hours = $valuehour; $checkTimesheetDetail->td_hours = $valuehour;
$checkTimesheetDetail->updated_by = $userId; $checkTimesheetDetail->updated_by = $userId;
$checkTimesheetDetail->update(); $checkTimesheetDetail->update();
} }
else else
{ {
...@@ -835,9 +839,6 @@ class FormController extends Controller ...@@ -835,9 +839,6 @@ class FormController extends Controller
$tmdetail->td_timesheet_sts = 1; $tmdetail->td_timesheet_sts = 1;
$tmdetail->save(); $tmdetail->save();
}
}
$checktproject = Tproject::where('fk_tm_id', $tmasterid) $checktproject = Tproject::where('fk_tm_id', $tmasterid)
->where('fk_o_id', $projectid) ->where('fk_o_id', $projectid)
->first(); ->first();
...@@ -873,6 +874,10 @@ class FormController extends Controller ...@@ -873,6 +874,10 @@ class FormController extends Controller
} }
} }
}
}
}
$sumdetailhour = Ts_detail::where('td_project_type', $overhead) $sumdetailhour = Ts_detail::where('td_project_type', $overhead)
->where('fk_tm_id', $tmasterid) ->where('fk_tm_id', $tmasterid)
...@@ -884,7 +889,7 @@ class FormController extends Controller ...@@ -884,7 +889,7 @@ class FormController extends Controller
$checktotalhours->tm_overhead_days = $sumdetailhour/8.0; $checktotalhours->tm_overhead_days = $sumdetailhour/8.0;
$checktotalhours->update(); $checktotalhours->update();
return redirect()->route('timesheet::form.overheadForm', ['phase' => $request->phase, 'month' =>$request->month,'year',$request->year])->with('success', 'Timesheet Updated'); return redirect()->route('timesheet::form.overheadForm', ['phase' => $request->phase, 'month' =>$request->month,'year',$request->year])->with('success', 'Overhead form updated! Kindly update your notes accordingly before proceed with timesheet submission. Thank you 😊');
} }
public function addOverheadDescription(Request $request) public function addOverheadDescription(Request $request)
...@@ -971,6 +976,8 @@ class FormController extends Controller ...@@ -971,6 +976,8 @@ class FormController extends Controller
public function notelist(Request $request) public function notelist(Request $request)
{ {
// dd($request);
$overhead = 3; $overhead = 3;
$userId = Users::find(Auth::id()) $userId = Users::find(Auth::id())
...@@ -1018,7 +1025,16 @@ class FormController extends Controller ...@@ -1018,7 +1025,16 @@ class FormController extends Controller
$fk_tm_id = null; $fk_tm_id = null;
} }
return view('timesheet::form.notelist', compact('notes', 'phase', 'month', 'year', 'fk_tm_id', 'staff')); $onotes = Ts_detail::where('fk_tm_id', $checknotelist->id)
->where('td_project_type', $overhead)
->whereNotNull('td_hours')
->orderby('td_date')
->get();
// dd($list);
return view('timesheet::form.notelist', compact('notes', 'phase', 'month', 'year', 'fk_tm_id', 'staff', 'onotes'));
} }
public function penambahannote() public function penambahannote()
...@@ -1103,6 +1119,63 @@ class FormController extends Controller ...@@ -1103,6 +1119,63 @@ class FormController extends Controller
return redirect()->route('timesheet::form.notelist', ['year'=> $data->tm_year, 'month' =>$data->tm_month, 'phase' => $data->tm_phase, 'fk_tm_id' => $data->fk_tm_id])->with('success', 'Note Added');; return redirect()->route('timesheet::form.notelist', ['year'=> $data->tm_year, 'month' =>$data->tm_month, 'phase' => $data->tm_phase, 'fk_tm_id' => $data->fk_tm_id])->with('success', 'Note Added');;
} }
public function savenote(Request $request)
{
// dd($request->note[0]);
$overhead = 3;
$userId = Users::find(Auth::id())
->u_staffID;
$check = Ts_detail::where('tm_year', $request->year)
->where('tm_month', $request->month)
->where('tm_phase', $request->phase)
->where('fk_tm_id', $request->tmid)
->where('td_project_type', $overhead)
->where('tm_staff_id', $userId)
->orderby('td_date')
->first();
$td = Ts_detail::where('tm_year', $request->year)
->where('tm_month', $request->month)
->where('tm_phase', $request->phase)
->where('fk_tm_id', $request->tmid)
->where('td_project_type', $overhead)
->where('tm_staff_id', $userId)
->orderby('td_date')
->get();
// dd($td);
if(isset($request->phase))
{
$phase = $request->phase;
}
if(isset($request->month))
{
$month = $request->month;
}
if(isset($request->year))
{
$year = $request->year;
}
if($check) {
foreach ($td as $key => $tdetail) {
$tdetail->td_overhead_note = $request->note[$key];
$tdetail->save();
}
return redirect()->route('timesheet::form.notelist', ['year'=> $year, 'month' =>$month, 'phase' => $phase, 'fk_tm_id' => $request->fk_tm_id])->with('success', 'Notes Updated!');
}
else
{
return redirect()->route('timesheet::form.notelist', ['year'=> $year, 'month' =>$month, 'phase' => $phase, 'fk_tm_id' => $request->fk_tm_id])->with('warning', 'No data to update. Kindly update your overehead form first. Thank you!');
}
}
/** /**
* undocumented function * undocumented function
......
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