Commit 410b316d by hannan

using suitable table to display overhead notes

parent dcd3e5d7
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
<a class="ui blue left ribbon label">Pengguna</a> <a class="ui blue left ribbon label">Pengguna</a>
<br> <br>
<br> <br>
{!! {!!
Suitable::source($user) Suitable::source($user)
->title(__('Senarai Pengguna')) ->title(__('Senarai Pengguna'))
......
...@@ -16,6 +16,21 @@ input[type=number] { ...@@ -16,6 +16,21 @@ input[type=number] {
} }
</style> </style>
<div class="ui small modal view">
{!!
Suitable::source($viewDesc)
->title(__('View Overhead Description'))
->columns([
new \Laravolt\Suitable\Columns\Numbering(__('No')),
['header' => __('date'), 'field' => 'td_date'],
['header' => __('task'), 'field' => 'td_overhead_desc'],
['header' => __('notes'), 'field' => 'td_overhead_note'],
['header' => __('action'), ]
])
->render()
!!}
</div>
<div class="ui tiny modal description"> <div class="ui tiny modal description">
<div class="header"> <div class="header">
Overhead Description Overhead Description
...@@ -30,7 +45,7 @@ input[type=number] { ...@@ -30,7 +45,7 @@ input[type=number] {
<div class="two fields"> <div class="two fields">
<div class="six wide field"> <div class="six wide field">
<label>Task</label> <label>Task</label>
<select class="ui search dropdown" name="task" required="required"> <select class="" name="task" required="required">
<option value="">Task</option> <option value="">Task</option>
@foreach($project as $key =>$value) @foreach($project as $key =>$value)
<option value="{{$value->o_overhead_desc}}">{{$value->o_overhead_desc}}</option> <option value="{{$value->o_overhead_desc}}">{{$value->o_overhead_desc}}</option>
...@@ -129,25 +144,50 @@ input[type=number] { ...@@ -129,25 +144,50 @@ input[type=number] {
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
<?php <?php
$valuehour = ''; $valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1); $date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($hour) if($hour)
{ {
$valuehour = $hour->where('td_date','=',$date) $valuehour = $hour->where('td_date','=',$date)
->where('fk_o_id',$project['td_project']) ->where('fk_o_id',$project['td_project'])
->where('tm_phase',$phase) ->where('tm_phase',$phase)
->first(); ->first();
$total += data_get($valuehour,'td_hours'); $total += data_get($valuehour,'td_hours');
} }
?> ?>
<td > <td >
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="@if($valuehour){{$valuehour->td_hours}}@else @endif" min="0" max="24" size="2" style="padding:2px;margin:unset" onchange="limiter(this,'{{$project['td_project']}}');"> <input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="@if($valuehour){{$valuehour->td_hours}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{$project['td_project']}}');">
</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();
# code...
} else {
$note = null;
}
// dd($note);
?>
<td class="ui center aligned">
@if($note)
<i class="bordered green eye icon" id="view"></i>
<i class="bordered yellow pencil icon"></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++)
<?php <?php
...@@ -169,11 +209,10 @@ input[type=number] { ...@@ -169,11 +209,10 @@ input[type=number] {
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="@if($valuehour){{$valuehour->td_hours}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{$project['td_project']}}');"> <input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="@if($valuehour){{$valuehour->td_hours}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{$project['td_project']}}');">
</td> </td>
@endfor @endfor
@endif
<td> <td>
<div > display desc phase 2
</div>
</td> </td>
@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}}>
</td> </td>
...@@ -203,6 +242,23 @@ input[type=number] { ...@@ -203,6 +242,23 @@ input[type=number] {
<script> <script>
$(function(){ $(function(){
$("#view").click(function()
{
$(".view").modal('show');
});
$(".view").modal(
{
closable: true
});
$(".view").modal('attach events', '.close.button');
});
</script>
<script>
$(function(){
$("#description").click(function() $("#description").click(function()
{ {
$(".description").modal('show'); $(".description").modal('show');
......
...@@ -54,7 +54,7 @@ class DashboardController extends Controller ...@@ -54,7 +54,7 @@ class DashboardController extends Controller
function ($query) use ($keyword) { function ($query) use ($keyword) {
$query->where('email', 'like', '%'.$keyword.'%'); $query->where('email', 'like', '%'.$keyword.'%');
} }
)->paginate(4); )->paginate(15);
return view('timesheet::dashboard.staff',compact('user')); return view('timesheet::dashboard.staff',compact('user'));
......
...@@ -595,7 +595,11 @@ class FormController extends Controller ...@@ -595,7 +595,11 @@ class FormController extends Controller
{ {
$hour = null; $hour = null;
} }
return view('timesheet::form.overheadForm', compact('projectlist','userId','month','phase','daymonth','year','day','hour', 'project'));
$viewDesc = Ts_detail::where('td_overhead_note', '!=', null)
->paginate(8);
return view('timesheet::form.overheadForm', compact('projectlist','userId','month','phase','daymonth','year','day','hour', 'project', 'viewDesc'));
} }
public function saveoverheadhours(Request $request) public function saveoverheadhours(Request $request)
...@@ -700,6 +704,7 @@ class FormController extends Controller ...@@ -700,6 +704,7 @@ class FormController extends Controller
// /lepas save (); // /lepas save ();
} }
} }
} }
...@@ -750,44 +755,40 @@ class FormController extends Controller ...@@ -750,44 +755,40 @@ class FormController extends Controller
$checkTimesheetDetail = Ts_detail::where('td_date', $request->date) $checkTimesheetDetail = Ts_detail::where('td_date', $request->date)
->where('td_overhead_desc', $request->task) ->where('td_overhead_desc', $request->task)
->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)
->where('tm_staff_id', $userId) ->where('tm_staff_id', $userId)
->first(); ->first();
if($checkTimesheetDetail){ if($checkTimesheetDetail){
dd('ada, update column');
$checkTimesheetDetail->td_overhead_note = $request->description; $checkTimesheetDetail->td_overhead_note = $request->description;
$checkTimesheetDetail->updated_by = $userId;
$checkTimesheetDetail->update(); $checkTimesheetDetail->update();
} else { } else {
$pname = Overhead::where('o_overhead_desc', $request->task)
$pname = Overhead::where('o_overhead_desc', $request->description)
->first(); ->first();
// dd($request);
dd($pname);
$data = new Ts_detail; $data = new Ts_detail;
$data->td_date = $request->date; $data->td_date = $request->date;
$data->fk_o_id = $pname->id; $data->fk_o_id = $pname->id;
$data->fk_tm_id = $tmasterid; $data->fk_tm_id = $tmasterid;
$data->tm_staff_id = $userId; $data->tm_staff_id = $userId;
$data->tm_month = $request->tm_month; $data->tm_month = $request->month;
$data->tm_year = $request->tm_year; $data->tm_year = $request->year;
$data->tm_phase = $request->tm_phase; $data->tm_phase = $request->phase;
$data->td_project_type = $overhead; $data->td_project_type = $overhead;
$data->updated_by = $userId; $data->updated_by = $userId;
$data->td_overhead_desc = $request->description; $data->td_overhead_note = $request->description;
$data->td_overhead_desc = $request->task;
$data->save(); $data->save();
} }
return redirect()->route('timesheet::form.overheadForm')->with('success', 'Timesheet Updated');
// $data = Ts_detail::where('td_date', $request->date) // $data = Ts_detail::where('td_date', $request->date)
// ->where('') // ->where('')
......
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