Commit 89c1ae9a by hannan

add notes as overhead description

parent e5d26e5a
...@@ -136,7 +136,6 @@ ...@@ -136,7 +136,6 @@
@endif @endif
@endfor @endfor
@else @else
@for($i = 15; $i < $daymonth; $i++) @for($i = 15; $i < $daymonth; $i++)
<?php <?php
...@@ -207,10 +206,79 @@ ...@@ -207,10 +206,79 @@
@endif @endif
<td>Total Hours</td> <td>Total Hours</td>
</tr> </tr>
@foreach($nonchargeablelist as $key => $projectnonchargeable)
<?php $total = 0; ?>
<tr>
<td style="width: 3%;"></td>
<td style="width: 23%;">{{ $projectnonchargeable['pname']}}</td>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<?php
$valnonchargehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($nonchargehour)
{
$valnonchargehour = $nonchargehour->where('td_date','=',$date)
->where('td_project',$projectnonchargeable['pid'])
->where('tm_phase',$phase)
->first();
$total += data_get($valnonchargehour,'td_hours');
}
?>
@if($valnonchargehour)
<td>{{ $valnonchargehour->td_hours }}</td>
@else
<td></td>
@endif
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<?php
$valnonchargehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($nonchargehour)
{
$valnonchargehour = $nonchargehour->where('td_date','=',$date)
->where('td_project',$projectnonchargeable['pid'])
->where('tm_phase',$phase)
->first();
$total += data_get($valnonchargehour,'td_hours');
}
?>
@if($valnonchargehour)
<td>{{ $valnonchargehour->td_hours }}</td>
@else
<td></td>
@endif
@endfor
@endif
@if($valnonchargehour)
<td>{{ $total }}</td>
@else
<td>0</td>
@endif
</tr>
@endforeach
</tbody> </tbody>
<tfoot> <tfoot>
<th colspan="@if($phase == 1) 17 @else {{$daymonth-13}} @endif">Total</th> <th colspan="@if($phase == 1) 17 @else {{$daymonth-13}} @endif">Total</th>
<th>20</th> <th>@if($totalnonchargehrs){{ $totalnonchargehrs }}@else 0 @endif</th>
</tfoot> </tfoot>
</table> </table>
</div> </div>
...@@ -327,6 +395,12 @@ ...@@ -327,6 +395,12 @@
<td style="width: 13.5%;">Date</td> <td style="width: 13.5%;">Date</td>
<td>Description</td> <td>Description</td>
</tr> </tr>
@foreach($notes as $key => $value)
<tr>
<td>{{ $value->td_date }}</td>
<td>{{ $value->td_overhead_note }}</td>
</tr>
@endforeach
</tbody> </tbody>
</table> </table>
</div> </div>
......
@extends('ui::layouts.app')
@section('content')
<div class="ui unstackable segment">
<a class="ui blue left ribbon label">Senarai Notes</a>
<a href="{{ route('timesheet::form.penambahannote') }}" class="ui right floated small primary labeled icon button">
<i class="plus icon"></i>Add New Project
</a><br>
<table class="ui celled padded table">
<thead>
<tr>
<th style="width: 3%;">No</th>
<th style="width: 10%;">Date</th>
<th style="width: 20%;">Task</th>
<th>Description</th>
</tr>
</thead>
<tbody>
@foreach($notes as $key => $value)
<tr>
<td>{{$key+1}} </td>
<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
</tbody>
<tfoot>
<tr>
<th colspan="6">
<div class="ui right floated pagination menu">
<a class="icon item">
<i class="left chevron icon"></i>
</a>
<a class="item">1</a>
<a class="item">2</a>
<a class="item">3</a>
<a class="item">4</a>
<a class="icon item">
<i class="right chevron icon"></i>
</a>
</div>
</th>
</tr>
</tfoot>
</table>
</div>
@endsection
...@@ -26,7 +26,7 @@ input[type=number] { ...@@ -26,7 +26,7 @@ input[type=number] {
Overhead Description Overhead Description
</div> </div>
<div class="content"> <div class="content">
<form class="ui form" action="{{ route('timesheet::form.addOverheadDescription' )}}" method="POST"> <form class="ui form" action="{{ route('timesheet::form.addOverheadDescription') }}" method="POST">
{{csrf_field()}} {{csrf_field()}}
<input type="hidden" name="userId" value="{{$userId}}"> <input type="hidden" name="userId" value="{{$userId}}">
<input type="hidden" name="year" value="{{$year}}"> <input type="hidden" name="year" value="{{$year}}">
...@@ -86,6 +86,11 @@ input[type=number] { ...@@ -86,6 +86,11 @@ input[type=number] {
Description Description
</button> </button>
<button class="center aligned ui yellow compact labeled icon button" id="notes" onclick="window.location.href='{{ route('timesheet::form.notelist', ['year'=> $year, 'month'=> $month, 'phase'=> $phase, 'fk_tm_id'=> $check->id] ) }} ';">
<i class="plus icon"></i>
Notes
</button>
<form class="ui form" action="{{ route('timesheet::form.saveoverheadhours' )}}" method="POST"> <form class="ui form" action="{{ route('timesheet::form.saveoverheadhours' )}}" method="POST">
{{csrf_field()}} {{csrf_field()}}
<input type="hidden" name="userId" value="{{$userId}}"> <input type="hidden" name="userId" value="{{$userId}}">
...@@ -97,7 +102,7 @@ input[type=number] { ...@@ -97,7 +102,7 @@ input[type=number] {
<thead> <thead>
<tr> <tr>
<th>Overhead</th> <th>Overhead</th>
<th colspan="@if($phase == 1) 16 @else {{$daymonth-14}} @endif" class="center aligned">Date</th> <th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
<th> <th>
<button type="submit" class="fluid center aligned ui blue compact labeled icon button"> <button type="submit" class="fluid center aligned ui blue compact labeled icon button">
<i class="save icon"></i> <i class="save icon"></i>
...@@ -113,12 +118,10 @@ input[type=number] { ...@@ -113,12 +118,10 @@ input[type=number] {
<th>{{$i+1}}</th> <th>{{$i+1}}</th>
@endfor @endfor
@else @else
{{ $daymonth }}
@for($i = 15; $i < $daymonth; $i++) @for($i = 15; $i < $daymonth; $i++)
<th>{{$i+1}}</th> <th>{{$i+1}}</th>
@endfor @endfor
@endif @endif
<th>Description</th>
<th>Total Hours</th> <th>Total Hours</th>
</tr> </tr>
</thead> </thead>
...@@ -155,26 +158,6 @@ input[type=number] { ...@@ -155,26 +158,6 @@ input[type=number] {
</td> </td>
@endfor @endfor
<?php
if ($hour) {
$note = $hour->where('td_overhead_desc', $project['td_project_name'])
->where('tm_phase', $phase)
->where('td_overhead_note', '!=', null)
->first();
} else {
$note = null;
}
?>
<td class="ui center aligned">
@if($note)
<i class="bordered green eye icon view_button" data-overheadid="{{ $project['td_project'] }}" data-month="{{ $month }}" data-year="{{ $year }}" data-tmstaffid="{{ $userId }}" data-phase="{{ $phase }}"></i>
@else
<i class="bordered disabled red eye slash icon"></i>
@endif
</td>
@else @else
@for($i = 15; $i < $daymonth; $i++) @for($i = 15; $i < $daymonth; $i++)
...@@ -198,25 +181,6 @@ input[type=number] { ...@@ -198,25 +181,6 @@ input[type=number] {
</td> </td>
@endfor @endfor
<?php
if ($hour) {
$note = $hour->where('td_overhead_desc', $project['td_project_name'])
->where('tm_phase', $phase)
->where('td_overhead_note', '!=', null)
->first();
} else {
$note = null;
}
?>
<td class="ui center aligned">
@if($note)
<i class="bordered green eye icon view_button" data-overheadid="{{ $project['td_project'] }}" data-month="{{ $month }}" data-year="{{ $year }}" data-tmstaffid="{{ $userId }}"></i>
@else
<i class="bordered disabled red eye slash icon"></i>
@endif
</td>
@endif @endif
<td> <td>
<input type="text" onkeypress="onlynumber(event)" name="total-{{$project['td_project']}}" id="total-{{$project['td_project']}}" style="padding-right: 4px;padding-left: 4px;" onchange="limiter(this,'{{$project['td_project']}}');" readonly="" value={{$total}}> <input type="text" onkeypress="onlynumber(event)" name="total-{{$project['td_project']}}" id="total-{{$project['td_project']}}" style="padding-right: 4px;padding-left: 4px;" onchange="limiter(this,'{{$project['td_project']}}');" readonly="" value={{$total}}>
......
@extends('ui::layouts.app')
@section('content')
<div class="ui segment">
<a class="ui blue left ribbon label">Penambahan Note</a>
<br><br>
<form class="ui form" action="{{ route('timesheet::form.addnote') }}" method="POST">
{{csrf_field()}}
<div class="two fields">
<div class="three wide field">
<label>Date</label>
<input type="Date" name="date">
</div>
<div class="three wide field">
<label>Task</label>
<select name="task" class="ui fluid dropdown">
@foreach($task as $key => $value)
<option value="{{$value->id}}">{{$value->o_overhead_desc}}</option>
@endforeach
</select>
</div>
</div>
<div class="field">
<label>Description</label>
<textarea name="description" cols="30" rows="10"></textarea>
</div>
<button class="ui button" type="submit">Submit</button>
</form>
</div>
@endsection
\ No newline at end of file
...@@ -47,6 +47,9 @@ Route::group( ...@@ -47,6 +47,9 @@ Route::group(
Route::post('savenonchargeablehours',['uses' => 'FormController@savenonchargeablehours', 'as' => 'form.savenonchargeablehours']); Route::post('savenonchargeablehours',['uses' => 'FormController@savenonchargeablehours', 'as' => 'form.savenonchargeablehours']);
Route::post('saveoverheadhours',['uses' => 'FormController@saveoverheadhours', 'as' => 'form.saveoverheadhours']); Route::post('saveoverheadhours',['uses' => 'FormController@saveoverheadhours', 'as' => 'form.saveoverheadhours']);
Route::post('addOverheadDescription',['uses' => 'FormController@addOverheadDescription', 'as' => 'form.addOverheadDescription']); Route::post('addOverheadDescription',['uses' => 'FormController@addOverheadDescription', 'as' => 'form.addOverheadDescription']);
Route::get('notelist',['uses' => 'FormController@notelist', 'as' => 'form.notelist']);
Route::get('penambahannote',['uses' => 'FormController@penambahannote', 'as' => 'form.penambahannote']);
Route::post('addnote', ['uses' => 'FormController@addnote', 'as' => 'form.addnote']);
// nonChargeableForm // nonChargeableForm
Route::post('addnonchargeabletask',['uses' => 'FormController@addnonchargeabletask', 'as' => 'form.addnonchargeabletask']); Route::post('addnonchargeabletask',['uses' => 'FormController@addnonchargeabletask', 'as' => 'form.addnonchargeabletask']);
......
...@@ -135,10 +135,17 @@ class DashboardController extends Controller ...@@ -135,10 +135,17 @@ class DashboardController extends Controller
->where('pt_project_type', $chargeable) ->where('pt_project_type', $chargeable)
->get(); ->get();
$nonchargeableproject = Pteam::where('pt_staff_id',$user->staff_id)
->where('pt_project_type', $nonchargeable)
->get();
$overheadproject = Overhead::where('o_overhead_sts',1) $overheadproject = Overhead::where('o_overhead_sts',1)
->get(); ->get();
$chargeablelist = []; $chargeablelist = [];
$nonchargeablelist = [];
$overheadlist = []; $overheadlist = [];
foreach($chargeableproject as $key => $value) { foreach($chargeableproject as $key => $value) {
...@@ -153,6 +160,17 @@ class DashboardController extends Controller ...@@ -153,6 +160,17 @@ class DashboardController extends Controller
} }
foreach ($nonchargeableproject as $key => $value) {
$nonchargeablelist[] = [
'pid' => $value->fk_project_id,
'pname' => $value->toProject->p_project_description,
];
}
foreach ($overheadproject as $key => $value) { foreach ($overheadproject as $key => $value) {
$overheadlist[] = [ $overheadlist[] = [
...@@ -175,14 +193,34 @@ class DashboardController extends Controller ...@@ -175,14 +193,34 @@ class DashboardController extends Controller
$chargehour = Ts_detail::where('fk_tm_id',$check->id) $chargehour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $chargeable) ->where('td_project_type', $chargeable)
// ->where('td_hours', '!=', 0)
->get(); ->get();
$nonchargehour = Ts_detail::where('fk_tm_id',$check->id) $nonchargehour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $nonchargeable) ->where('td_project_type', $nonchargeable)
// ->where('td_hours', '!=', 0)
->get(); ->get();
// $filledoverhead = Ts_detail::where('fk_tm_id',$check->id)
// ->where('td_project_type', $overhead)
// // ->where('td_hours', '!=', 0)
// ->get();
// foreach ($filledoverhead as $key => $value) {
// $temp[$key] =
// if($overheadlist[$key] != $overheadlist[$key+1]) {
// $overheadlist[] = [
// 'pid' => $value->fk_o_id,
// 'pname' => $value->td_overhead_desc,
// ];
// }
// }
// dd($overheadlist);
$overheadhour = Ts_detail::where('fk_tm_id',$check->id) $overheadhour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $overhead) ->where('td_project_type', $overhead)
// ->where('td_hours', '!=', 0)
->get(); ->get();
} }
...@@ -198,7 +236,17 @@ class DashboardController extends Controller ...@@ -198,7 +236,17 @@ class DashboardController extends Controller
$totalnonchargehrs = $check->tm_nonchargeable_hrs; $totalnonchargehrs = $check->tm_nonchargeable_hrs;
$totaloverheadhrs = $check->tm_overhead_hrs; $totaloverheadhrs = $check->tm_overhead_hrs;
return view('timesheet::dashboard.timesheetViewer', compact('user', 'dept', 'hod', 'phase', 'month', 'year', 'day', 'strMonth', 'daymonth', 'chargeablelist', 'overheadlist', 'chargehour', 'totalchargehrs', 'totalnonchargehrs', 'totaloverheadhrs', 'overheadhour')); $notes = Ts_detail::where('tm_year', $year)
->where('tm_month', $month)
->where('tm_phase', $phase)
->where('fk_tm_id', $check->id)
->where('tm_staff_id', $user->staff_id)
->where('td_project_type', $overhead)
->whereNotNull('td_overhead_note')
->orderby('td_date')
->get();
return view('timesheet::dashboard.timesheetViewer', compact('user', 'dept', 'hod', 'phase', 'month', 'year', 'day', 'strMonth', 'daymonth', 'chargeablelist', 'nonchargeablelist', 'overheadlist', 'chargehour', 'nonchargehour', 'totalchargehrs', 'totalnonchargehrs', 'totaloverheadhrs', 'overheadhour', 'notes'));
} }
......
...@@ -33,16 +33,12 @@ class FormController extends Controller ...@@ -33,16 +33,12 @@ class FormController extends Controller
$userId = users::find(Auth::id()) $userId = users::find(Auth::id())
->u_staffID; ->u_staffID;
// dd($userId);
$project = Pteam::where('pt_staff_id',$userId) $project = Pteam::where('pt_staff_id',$userId)
->where('pt_project_type', $chargeable) ->where('pt_project_type', $chargeable)
->get(); ->get();
$projectlist = []; $projectlist = [];
// nanti project code query dari table project:
foreach ($project as $key => $value) { foreach ($project as $key => $value) {
$projectlist[] = [ $projectlist[] = [
...@@ -55,13 +51,17 @@ class FormController extends Controller ...@@ -55,13 +51,17 @@ class FormController extends Controller
} }
//sample dulu
$phase = 1; $phase = 1;
$month = date('n'); $month = date('n');
$year = date('Y'); $year = date('Y');
$day = date('j'); $day = date('j');
if ($day < 16) {
$phase = 1;
} else {
$phase = 2;
}
if(isset($request->phase)) if(isset($request->phase))
{ {
$phase = $request->phase; $phase = $request->phase;
...@@ -79,25 +79,17 @@ class FormController extends Controller ...@@ -79,25 +79,17 @@ class FormController extends Controller
$daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year); $daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year);
//check dlam db, kalau dah ada detail hours, kuar form edit, kalau belum, kuar form create
// check timesheet master
$check = Ts_master::where('tm_staff_id', $userId) $check = Ts_master::where('tm_staff_id', $userId)
->where('tm_year', $year) ->where('tm_year', $year)
->where('tm_month', $month) ->where('tm_month', $month)
->where('tm_phase', $phase) ->where('tm_phase', $phase)
->first(); ->first();
//kalau ada, dia gi ke edit
if($check) if($check)
{ {
$hour = Ts_detail::where('fk_tm_id',$check->id) $hour = Ts_detail::where('fk_tm_id',$check->id)
// ->with('project:p_project_code')
->get(); ->get();
// dd($hour);
} }
//klu xde g create.php
else else
{ {
$hour = null; $hour = null;
...@@ -108,27 +100,21 @@ class FormController extends Controller ...@@ -108,27 +100,21 @@ class FormController extends Controller
public function savechargeablehours(Request $request) public function savechargeablehours(Request $request)
{ {
// chargeable, project type 1.
$chargeable = 1; $chargeable = 1;
$userId = users::find(Auth::id()) $userId = users::find(Auth::id())
->u_staffID; ->u_staffID;
// check table master. untuk total chargeable hours.
$check = Ts_master::where('tm_staff_id', $userId) $check = Ts_master::where('tm_staff_id', $userId)
->where('tm_year', $request->year) ->where('tm_year', $request->year)
->where('tm_month', $request->month) ->where('tm_month', $request->month)
->where('tm_phase', $request->phase) ->where('tm_phase', $request->phase)
->first(); ->first();
//kalau ada, update().
//staff kena edit bila timesheet kena reject.
//kalau ada, biar dlu.
if($check) if($check)
{ {
} }
// kalau takda, save() baru.
else else
{ {
$check = new Ts_master; $check = new Ts_master;
...@@ -137,16 +123,11 @@ class FormController extends Controller ...@@ -137,16 +123,11 @@ class FormController extends Controller
$check->tm_month = $request->month; $check->tm_month = $request->month;
$check->tm_phase = $request->phase; $check->tm_phase = $request->phase;
$check->updated_by = $userId; $check->updated_by = $userId;
// $check ->tm_chargeable_hrs = ;
$check->save(); $check->save();
} }
$tmasterid = $check->id; $tmasterid = $check->id;
// semak detail dari form
// untuk project type : 1 = chargeable, 2 = nonchargeable, 3 = overhead;
// . . .
$detail = $request->hour; $detail = $request->hour;
...@@ -171,16 +152,15 @@ class FormController extends Controller ...@@ -171,16 +152,15 @@ class FormController extends Controller
if($checkTimesheetDetail) if($checkTimesheetDetail)
{ {
//update hours to null
$checkTimesheetDetail->td_hours = $valuehour; $checkTimesheetDetail->td_hours = $valuehour;
$checkTimesheetDetail->updated_by = $userId; $checkTimesheetDetail->updated_by = $userId;
$checkTimesheetDetail->update(); $checkTimesheetDetail->update();
} //kalau takde, isi semua. }
else else
{ {
//isi semua
$tmdetail = new Ts_detail; $tmdetail = new Ts_detail;
$tmdetail->td_date = $date; $tmdetail->td_date = $date;
$tmdetail->td_project = $projectid; $tmdetail->td_project = $projectid;
...@@ -199,11 +179,6 @@ class FormController extends Controller ...@@ -199,11 +179,6 @@ class FormController extends Controller
$tmdetail->updated_by = $userId; $tmdetail->updated_by = $userId;
$tmdetail->save(); $tmdetail->save();
//$tmdetail -> kjhdiwhdf;
//project = Project::where('id','project')->first();
//
// /lepas save ();
} }
...@@ -222,8 +197,6 @@ class FormController extends Controller ...@@ -222,8 +197,6 @@ class FormController extends Controller
$checktotalhours->tm_chargeable_days = $sumdetailhour/8.0; $checktotalhours->tm_chargeable_days = $sumdetailhour/8.0;
$checktotalhours->update(); $checktotalhours->update();
// return redirect::to('mobile/profile');
return redirect()->route('timesheet::form.chargeableForm', ['phase' => $request->phase, 'month' =>$request->month,'year',$request->year])->with('success', 'Timesheet Updated'); return redirect()->route('timesheet::form.chargeableForm', ['phase' => $request->phase, 'month' =>$request->month,'year',$request->year])->with('success', 'Timesheet Updated');
} }
...@@ -242,7 +215,6 @@ class FormController extends Controller ...@@ -242,7 +215,6 @@ class FormController extends Controller
->get(); ->get();
$projectlist = []; $projectlist = [];
// nanti project code query dari table project:
foreach ($project as $key => $value) { foreach ($project as $key => $value) {
...@@ -255,13 +227,17 @@ class FormController extends Controller ...@@ -255,13 +227,17 @@ class FormController extends Controller
} }
//sample dulu
$phase = 1; $phase = 1;
$month = date('n'); $month = date('n');
$year = date('Y'); $year = date('Y');
$day = date('j'); $day = date('j');
if ($day < 16) {
$phase = 1;
} else {
$phase = 2;
}
if(isset($request->phase)) if(isset($request->phase))
{ {
$phase = $request->phase; $phase = $request->phase;
...@@ -279,30 +255,23 @@ class FormController extends Controller ...@@ -279,30 +255,23 @@ class FormController extends Controller
$daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year); $daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year);
//check dlam db, kalau dah ada detail hours, kuar form edit, kalau belum, kuar form create
// check timesheet master
$check = Ts_master::where('tm_staff_id', $userId) $check = Ts_master::where('tm_staff_id', $userId)
->where('tm_year', $year) ->where('tm_year', $year)
->where('tm_month', $month) ->where('tm_month', $month)
->where('tm_phase', $phase) ->where('tm_phase', $phase)
->first(); ->first();
//kalau ada, dia gi ke edit
if($check) if($check)
{ {
$hour = Ts_detail::where('fk_tm_id',$check->id) $hour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $nonchargeable) ->where('td_project_type', $nonchargeable)
// ->with('project:p_project_code')
->get(); ->get();
// dd($hour);
} }
//klu xde g create.php
else else
{ {
$hour = null; $hour = null;
} }
return view('timesheet::form.nonChargeableForm', compact('projectlist','userId','month','phase','daymonth','year','day','hour','nonchargeables')); return view('timesheet::form.nonChargeableForm', compact('projectlist','userId','month','phase','daymonth','year','day','hour','nonchargeables'));
} }
...@@ -315,7 +284,7 @@ class FormController extends Controller ...@@ -315,7 +284,7 @@ class FormController extends Controller
if ($request->chargeableProject != null && $request->nonChargeableProject == null) { if ($request->chargeableProject != null && $request->nonChargeableProject == null) {
// dd('select only');
$project = Project::where('id', $request->chargeableProject) $project = Project::where('id', $request->chargeableProject)
->first(); ->first();
...@@ -330,7 +299,7 @@ class FormController extends Controller ...@@ -330,7 +299,7 @@ class FormController extends Controller
$data->save(); $data->save();
}else if ($request->chargeableProject != null && $request->nonChargeableProject != null) { }else if ($request->chargeableProject != null && $request->nonChargeableProject != null) {
// dd('select and input');
$project = Project::where('id', $request->chargeableProject) $project = Project::where('id', $request->chargeableProject)
->first(); ->first();
...@@ -556,6 +525,12 @@ class FormController extends Controller ...@@ -556,6 +525,12 @@ class FormController extends Controller
$year = date('Y'); $year = date('Y');
$day = date('j'); $day = date('j');
if ($day < 16) {
$phase = 1;
} else {
$phase = 2;
}
if(isset($request->phase)) if(isset($request->phase))
{ {
$phase = $request->phase; $phase = $request->phase;
...@@ -573,9 +548,6 @@ class FormController extends Controller ...@@ -573,9 +548,6 @@ class FormController extends Controller
$daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year); $daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year);
//check dlam db, kalau dah ada detail hours, kuar form edit, kalau belum, kuar form create
// check timesheet master
$check = Ts_master::where('tm_staff_id', $userId) $check = Ts_master::where('tm_staff_id', $userId)
->where('tm_year', $year) ->where('tm_year', $year)
->where('tm_month', $month) ->where('tm_month', $month)
...@@ -595,7 +567,9 @@ class FormController extends Controller ...@@ -595,7 +567,9 @@ class FormController extends Controller
$hour = null; $hour = null;
} }
return view('timesheet::form.overheadForm', compact('projectlist','userId','month','phase','daymonth','year','day','hour', 'project')); // dd($check->id);
return view('timesheet::form.overheadForm', compact('projectlist','userId','month','phase','daymonth','year','day','hour', 'project', 'check'));
} }
public function saveoverheadhours(Request $request) public function saveoverheadhours(Request $request)
...@@ -716,8 +690,6 @@ class FormController extends Controller ...@@ -716,8 +690,6 @@ class FormController extends Controller
$checktotalhours->tm_overhead_days = $sumdetailhour/8.0; $checktotalhours->tm_overhead_days = $sumdetailhour/8.0;
$checktotalhours->update(); $checktotalhours->update();
// return redirect::to('mobile/profile');
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', 'Timesheet Updated');
} }
...@@ -785,12 +757,6 @@ class FormController extends Controller ...@@ -785,12 +757,6 @@ class FormController extends Controller
} }
return redirect()->route('timesheet::form.overheadForm')->with('success', 'Timesheet Updated'); return redirect()->route('timesheet::form.overheadForm')->with('success', 'Timesheet Updated');
// $data = Ts_detail::where('td_date', $request->date)
// ->where('')
// $data = new ODesc;
} }
// public function loadnotes(Request $request) // public function loadnotes(Request $request)
...@@ -804,13 +770,54 @@ class FormController extends Controller ...@@ -804,13 +770,54 @@ class FormController extends Controller
->where('tm_staff_id', $staffid) ->where('tm_staff_id', $staffid)
->paginate(8); ->paginate(8);
// foreach ($Desc as $key => $value) { return view('timesheet::ajax.senarainotes', compact('viewDesc'));
// dd($key); }
// $viewDesc = $value;
// }
public function notelist(Request $request)
{
$overhead = 3;
return view('timesheet::ajax.senarainotes', compact('viewDesc')); $userId = Users::find(Auth::id())
->u_staffID;
$notes = Ts_detail::where('tm_year', $request->year)
->where('tm_month', $request->month)
->where('tm_phase', $request->phase)
->where('fk_tm_id', $request->fk_tm_id)
->where('tm_staff_id', $userId)
->where('td_project_type', $overhead)
->whereNotNull('td_overhead_note')
->orderby('td_date')
->get();
return view('timesheet::form.notelist', compact('notes'));
}
public function penambahannote()
{
$task = Overhead::where('o_overhead_sts', 1)->get();
// dd($task);
return view('timesheet::form.penambahannote', compact('task'));
}
public function addnote(Request $request)
{
$overhead = 3;
$userId = Users::find(Auth::id())
->u_staffID;
// dd($request);
$data = Ts_detail::where('tm_staff_id', $userId)
->where('td_project_type', $overhead)
->where('fk_o_id', $request->task)
->where('td_date', $request->date)
->first();
$data->td_overhead_note = $request->description;
$data->update();
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');;
} }
} }
\ No newline at end of file
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