Commit 7e31ead9 by Azhan Hannan

changes chargeable overhead form

parent e1278a7d
......@@ -53,11 +53,8 @@ input[type=number] {
// dd(count($lat));
?>
<th colspan="2" rowspan="2" class="center aligned">Chargeable</th>
@if(count($lat) > 0)
<th colspan="{{count($lat)}}" class="center aligned">Date</th>
@else
<!-- <th colspan="{{count($lat)}}" class="center aligned">Date</th> -->
<th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
@endif
<th rowspan="2">
<!-- @if($projectlist == [])
<button type="submit" class="ui disabled fluid center aligned ui blue compact labeled icon button">
......@@ -75,25 +72,34 @@ input[type=number] {
<tr>
@if(count($lat) > 0)
@foreach($lat as $key => $date)
@if(data_get($date,'day_type') == 1 )
<th>{{date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day']}}</th>
@if(data_get($date,'attendance_status') == 1)
<th class="center aligned">
{{ date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day'] }}
</th>
@else
<th style="background-color: #DCDCDC;">
{{date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day']}}
<th class="center aligned" style="background-color: #DCDCDC;">
{{ date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day'] }}
</th>
@endif
@endforeach
@if($phase == 1)
@for($i = count($lat); $i < 15 ; $i++)
<th class="center aligned">{{$i+1}}</th>
@endfor
@else
@for($i = 15+count($lat); $i < $daymonth; $i++)
<th class="center aligned">{{$i+1}}</th>
@endfor
@endif
@else
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<th>{{$i+1}}</th>
<th class="center aligned">{{$i+1}}</th>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<th>{{$i+1}}</th>
<th class="center aligned">{{$i+1}}</th>
@endfor
@endif
@endif
</tr>
......@@ -102,25 +108,35 @@ input[type=number] {
<th class="single line">Project Name</th>
@if(count($lat) > 0)
@foreach($lat as $key => $date)
@if(data_get($date,'day_type') == 1)
<th>
@if(data_get($date,'attendance_status') == 1)
<th class="center aligned">
{{ date('D', strtotime(data_get($date,'DATE')) ) }}
</th>
@else
<th style="background-color: #DCDCDC;">
<th class="center aligned" style="background-color: #DCDCDC;">
{{ date('D', strtotime(data_get($date,'DATE')) ) }}
</th>
@endif
@endforeach
@if($phase == 1)
@for($i = count($lat); $i < 15 ; $i++)
<th class="center aligned">{{ $strdays[$i] }}</th>
@endfor
@else
@for($i = 15+count($lat); $i < $daymonth; $i++)
<th class="center aligned">{{ $strdays[$i] }}</th>
@endfor
@endif
@else
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<th>{{ $strdays[$i] }}</th>
<th class="center aligned">{{ $strdays[$i] }}</th>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<th>{{ $strdays[$i] }}</th>
<th class="center aligned">{{ $strdays[$i] }}</th>
@endfor
@endif
......@@ -132,6 +148,7 @@ input[type=number] {
<?php
$all = 0;
$lasttd = count($projectlist);
// dd($lat);
?>
@foreach($projectlist as $key => $project)
......@@ -165,16 +182,62 @@ input[type=number] {
}
?>
@if(data_get($value,'day_type') == 1)
<td>
@if(data_get($value,'attendance_status') == 1)
<td class="center aligned">
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$day}}]" name="hour[{{$project['td_project']}}][{{$day}}]" value="@if($valuehour){{data_get($valuehour,'td_hours')}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{ $project['td_project'] }}');">
</td>
@else
<td style="background-color: #DCDCDC;">
<td class="center aligned" style="background-color: #DCDCDC;">
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$day}}]" name="hour[{{$project['td_project']}}][{{$day}}]" value="@if($valuehour){{data_get($valuehour,'td_hours')}}@else @endif" min="0" max="24" style="padding:2px;margin:unset;background-color: #DCDCDC;" onchange="limiter(this,'{{ $project['td_project'] }}');">
</td>
@endif
@endforeach
@if($phase == 1)
@for($i = count($lat); $i < 15 ; $i++)
<?php
$valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($hour)
{
$valuehour = $hour->where('td_date','=',$date)
->where('td_project',$project['td_project'])
->where('tm_phase',$phase)
->first();
$total += data_get($valuehour,'td_hours');
}
?>
<td>
<input class="center aligned" 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
@else
@for($i = 15+count($lat); $i < $daymonth; $i++)
<?php
$valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($hour)
{
$valuehour = $hour->where('td_date','=',$date)
->where('td_project',$project['td_project'])
->where('tm_phase',$phase)
->first();
$total += data_get($valuehour,'td_hours');
}
?>
<td>
<input class="center aligned" 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
@endif
@else
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
......@@ -196,7 +259,7 @@ input[type=number] {
?>
<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" style="padding:2px;margin:unset" onchange="limiter(this,'{{ $project['td_project'] }}');">
<input class="center aligned" 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
@else
......@@ -218,7 +281,7 @@ input[type=number] {
?>
<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" style="padding:2px;margin:unset" onchange="limiter(this,'{{$project['td_project']}}');">
<input class="center aligned" 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
@endif
......
......@@ -61,11 +61,9 @@ input[type=number] {
<thead>
<tr>
<th rowspan="3" class="center aligned">Overhead</th>
@if(count($lat) > 0)
<th colspan="{{count($lat)}}" class="center aligned">Date</th>
@else
<!-- <th colspan="{{count($lat)}}" class="center aligned">Date</th> -->
<th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
@endif
<th rowspan="2">
<!-- <button type="submit" class="fluid center aligned ui blue compact labeled icon button">
<i class="save icon"></i>
......@@ -76,22 +74,33 @@ input[type=number] {
<tr>
@if(count($lat) > 0)
@foreach($lat as $key => $date)
@if(data_get($date,'day_type') == 1 )
<th>{{date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day']}}</th>
@if(data_get($date,'attendance_status') == 1)
<th class="center aligned">
{{ date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day'] }}
</th>
@else
<th style="background-color: #DCDCDC;">
{{date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day']}}
<th class="center aligned" style="background-color: #DCDCDC;">
{{ date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day'] }}
</th>
@endif
@endforeach
@if($phase == 1)
@for($i = count($lat); $i < 15 ; $i++)
<th class="center aligned">{{$i+1}}</th>
@endfor
@else
@for($i = 15+count($lat); $i < $daymonth; $i++)
<th class="center aligned">{{$i+1}}</th>
@endfor
@endif
@else
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<th>{{$i+1}}</th>
<th class="center aligned">{{$i+1}}</th>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<th>{{$i+1}}</th>
<th class="center aligned">{{$i+1}}</th>
@endfor
@endif
@endif
......@@ -99,26 +108,37 @@ input[type=number] {
<tr>
@if(count($lat) > 0)
@foreach($lat as $key => $date)
@if(data_get($date,'day_type') == 1)
<th>
@if(data_get($date,'attendance_status') == 1)
<th class="center aligned">
{{ date('D', strtotime(data_get($date,'DATE')) ) }}
</th>
@else
<th style="background-color: #DCDCDC;">
<th class="center aligned" style="background-color: #DCDCDC;">
{{ date('D', strtotime(data_get($date,'DATE')) ) }}
</th>
@endif
@endforeach
@if($phase == 1)
@for($i = count($lat); $i < 15 ; $i++)
<th class="center aligned">{{ $strdays[$i] }}</th>
@endfor
@else
@for($i = 15+count($lat); $i < $daymonth; $i++)
<th class="center aligned">{{ $strdays[$i] }}</th>
@endfor
@endif
@else
<!-- <th>Task</th> -->
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<th>{{ $strdays[$i] }}</th>
<th class="center aligned">{{ $strdays[$i] }}</th>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<th>{{ $strdays[$i] }}</th>
<th class="center aligned">{{ $strdays[$i] }}</th>
@endfor
@endif
@endif
<th>Hours</th>
......@@ -154,16 +174,60 @@ input[type=number] {
}
?>
@if(data_get($value,'day_type') == 1)
<td>
@if(data_get($value,'attendance_status') == 1)
<td style="width: 5%;">
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$day}}]" name="hour[{{$project['td_project']}}][{{$day}}]" value="@if($valuehour){{$valuehour->td_hours}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{ $project['td_project'] }}');">
</td>
@else
<td style="background-color: #DCDCDC;">
<td style="width: 5%; background-color: #DCDCDC;">
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$day}}]" name="hour[{{$project['td_project']}}][{{$day}}]" value="@if($valuehour){{$valuehour->td_hours}}@else @endif" min="0" max="24" style="padding:2px;margin:unset;background-color: #DCDCDC;" onchange="limiter(this,'{{ $project['td_project'] }}');">
</td>
@endif
@endforeach
@if($phase == 1)
@for($i = count($lat); $i < 15 ; $i++)
<?php
$valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($hour)
{
$valuehour = $hour->where('td_date','=',$date)
->where('fk_o_id',$project['td_project'])
->where('tm_phase',$phase)
->first();
$total += data_get($valuehour,'td_hours');
}
?>
<td >
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="@if($valuehour){{data_get($valuehour,'td_hours')}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{$project['td_project']}}');">
</td>
@endfor
@else
@for($i = 15+count($lat); $i < $daymonth; $i++)
<?php
$valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($hour)
{
$valuehour = $hour->where('td_date','=',$date)
->where('fk_o_id',$project['td_project'])
->where('tm_phase',$phase)
->first();
$total += data_get($valuehour,'td_hours');
}
?>
<td>
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="@if($valuehour){{data_get($valuehour,'td_hours')}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{$project['td_project']}}');">
</td>
@endfor
@endif
@else
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
......
......@@ -200,9 +200,10 @@ class FormController extends Controller
$lat = LAttendance::where('staff_id', $userId)
->whereIn('DATE', $dt)
->groupby('DATE')
->get();
$lat = [];
// $lat = [];
// dd($lat);
// dd(date('w', strtotime(data_get($lat1,'DATE'))));
// dd(date_parse_from_format('Y-m-d', data_get($lat1,'DATE'))['day']);
......@@ -863,9 +864,10 @@ class FormController extends Controller
$lat = LAttendance::where('staff_id', $userId)
->whereIn('DATE', $dt)
->groupby('DATE')
->get();
$lat = [];
// $lat = [];
// dd($lat);
return view('timesheet::form.overheadForm', compact('checkoverhead','projectlist','userId','month','phase','daymonth','year', 'hour', 'project', 'fk_tm_id', 'strdays', 'lat'));
......
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