Commit 89c1ae9a by hannan

add notes as overhead description

parent e5d26e5a
......@@ -136,7 +136,6 @@
@endif
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<?php
......@@ -207,10 +206,79 @@
@endif
<td>Total Hours</td>
</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>
<tfoot>
<th colspan="@if($phase == 1) 17 @else {{$daymonth-13}} @endif">Total</th>
<th>20</th>
<th>@if($totalnonchargehrs){{ $totalnonchargehrs }}@else 0 @endif</th>
</tfoot>
</table>
</div>
......@@ -327,6 +395,12 @@
<td style="width: 13.5%;">Date</td>
<td>Description</td>
</tr>
@foreach($notes as $key => $value)
<tr>
<td>{{ $value->td_date }}</td>
<td>{{ $value->td_overhead_note }}</td>
</tr>
@endforeach
</tbody>
</table>
</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] {
Overhead Description
</div>
<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()}}
<input type="hidden" name="userId" value="{{$userId}}">
<input type="hidden" name="year" value="{{$year}}">
......@@ -86,6 +86,11 @@ input[type=number] {
Description
</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">
{{csrf_field()}}
<input type="hidden" name="userId" value="{{$userId}}">
......@@ -97,7 +102,7 @@ input[type=number] {
<thead>
<tr>
<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>
<button type="submit" class="fluid center aligned ui blue compact labeled icon button">
<i class="save icon"></i>
......@@ -112,13 +117,11 @@ input[type=number] {
@for($i = 0; $i < 15 ; $i++)
<th>{{$i+1}}</th>
@endfor
@else
{{ $daymonth }}
@else
@for($i = 15; $i < $daymonth; $i++)
<th>{{$i+1}}</th>
@endfor
@endif
<th>Description</th>
<th>Total Hours</th>
</tr>
</thead>
......@@ -154,26 +157,6 @@ 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']}}');">
</td>
@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
@for($i = 15; $i < $daymonth; $i++)
......@@ -197,25 +180,6 @@ 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']}}');">
</td>
@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
<td>
......
@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(
Route::post('savenonchargeablehours',['uses' => 'FormController@savenonchargeablehours', 'as' => 'form.savenonchargeablehours']);
Route::post('saveoverheadhours',['uses' => 'FormController@saveoverheadhours', 'as' => 'form.saveoverheadhours']);
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
Route::post('addnonchargeabletask',['uses' => 'FormController@addnonchargeabletask', 'as' => 'form.addnonchargeabletask']);
......
......@@ -135,10 +135,17 @@ class DashboardController extends Controller
->where('pt_project_type', $chargeable)
->get();
$nonchargeableproject = Pteam::where('pt_staff_id',$user->staff_id)
->where('pt_project_type', $nonchargeable)
->get();
$overheadproject = Overhead::where('o_overhead_sts',1)
->get();
->get();
$chargeablelist = [];
$nonchargeablelist = [];
$overheadlist = [];
foreach($chargeableproject as $key => $value) {
......@@ -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) {
$overheadlist[] = [
......@@ -175,14 +193,34 @@ class DashboardController extends Controller
$chargehour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $chargeable)
// ->where('td_hours', '!=', 0)
->get();
$nonchargehour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $nonchargeable)
// ->where('td_hours', '!=', 0)
->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)
->where('td_project_type', $overhead)
// ->where('td_hours', '!=', 0)
->get();
}
......@@ -198,7 +236,17 @@ class DashboardController extends Controller
$totalnonchargehrs = $check->tm_nonchargeable_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'));
}
......
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