Commit b691ec19 by Azhan Hannan

changes

parent 317a92fd
...@@ -66,6 +66,12 @@ input[type=number] { ...@@ -66,6 +66,12 @@ input[type=number] {
</th> </th>
</tr> </tr>
<tr> <tr>
<?php
$cday = [];
for ($i=0; $i < $daymonth; $i++) {
$cday[] = 0;
}
?>
@if($phase == 1) @if($phase == 1)
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
...@@ -96,8 +102,13 @@ input[type=number] { ...@@ -96,8 +102,13 @@ input[type=number] {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php
$all = 0;
$lasttd = count($projectlist);
?>
@foreach($projectlist as $key => $project) @foreach($projectlist as $key => $project)
<?php $total = 0; ?> <?php $total = 0;?>
<tr> <tr>
<td class="single line"> <td class="single line">
{{ $project['td_project_code']}} {{ $project['td_project_code']}}
...@@ -126,8 +137,7 @@ input[type=number] { ...@@ -126,8 +137,7 @@ input[type=number] {
?> ?>
<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" 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
@else @else
...@@ -154,11 +164,35 @@ input[type=number] { ...@@ -154,11 +164,35 @@ input[type=number] {
@endfor @endfor
@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 class="center aligned" type="text" name="total-{{$project['td_project']}}" id="total-{{$key+1}}" style="padding-right: 4px;padding-left: 4px;" readonly="readonly" value={{$total}}>
</td> </td>
</tr> </tr>
<?php $all += $total; ?>
@endforeach @endforeach
</tbody> </tbody>
<!-- <tfoot>
<tr>
<th colspan="2">
Total Hours
</th>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<th>
<input class="center aligned" type="text" name="thour-{{$project['td_project']}}" id="thours[{{$i+1}}][{{$key+1}}]" style="padding-right: 4px;padding-left: 4px;" readonly="readonly" value="{{$cday[$i]}}">
</th>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<th>
<input class="center aligned" type="text" name="thour-{{$project['td_project']}}" id="thours[{{$i+1}}][{{$key+1}}]" style="padding-right: 4px;padding-left: 4px;" readonly="readonly" value="{{$cday[$i]}}">
</th>
@endfor
@endif
<th>
<input class="center aligned" type="text" onkeypress="onlynumber(event)" name="all" id="all" readonly="readonly" value="{{$all}}">
</th>
</tr>
</tfoot> -->
</table> </table>
@if($projectlist == []) @if($projectlist == [])
<button type="submit" class="ui right floated aligned ui blue compact labeled icon button"> <button type="submit" class="ui right floated aligned ui blue compact labeled icon button">
...@@ -204,9 +238,10 @@ input[type=number] { ...@@ -204,9 +238,10 @@ input[type=number] {
}); });
function limiter(input,pid) { function limiter(input,pid,lasttd,key) {
var currenttotal = 0; var currenttotal = 0;
var all = 0;
if (input.value < 0) input.value = 0; if (input.value < 0) input.value = 0;
if (input.value > 24) input.value = 24; if (input.value > 24) input.value = 24;
...@@ -221,24 +256,32 @@ input[type=number] { ...@@ -221,24 +256,32 @@ input[type=number] {
hourValue = hourValue.value; hourValue = hourValue.value;
value = parseFloat(parseFloat(hourValue).toFixed(1)); value = parseFloat(parseFloat(hourValue).toFixed(1));
console.log(isNaN(value)); // console.log(isNaN(value));
if(isNaN(value)){ if(isNaN(value)){
value = 0; value = 0;
} }
if(typeof value === 'number'){ if(typeof value === 'number'){
// console.log(value);
currenttotal += value; currenttotal += value;
} }
} }
} }
console.log("currenttotal --> " + currenttotal); // console.log("currenttotal --> " + currenttotal);
document.getElementById('total-'+key).value = currenttotal;
document.getElementById('total-'+pid).value = currenttotal; var y = 0;
for(var j = 1; j < key+1; j++){
var allid = document.getElementById('total-'+j);
if (document.getElementById('total-'+j)) {
y = document.getElementById('total-'+j).value;
value = parseFloat(parseFloat(y).toFixed(1));
all += value;
}
}
console.log(all);
document.getElementById('all').value = all;
} }
</script> </script>
......
...@@ -17,7 +17,9 @@ ...@@ -17,7 +17,9 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $limit = count($limitrole); ?> <?php $limit = count($limitrole);
// dd($limitrole);
?>
@foreach($role as $key => $value) @foreach($role as $key => $value)
<tr> <tr>
......
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