Commit 2e58f616 by hannan

changes on total up hours for each project/rows for phase 2

parent 4e0e491e
......@@ -79,16 +79,20 @@ input[type=number] {
@for($i = 0; $i < 15 ; $i++)
<td >
@if($project['td_date'] == $i+1)
<input onblur="findTotal()" type="text" onkeypress="onlynumber(event)" name="hour[{{$project['td_project']}}][{{$i+1}}]" id="hour[{{$project['td_project']}}][{{$i+1}}]" value="{{$project['td_hours']}}" min="0" max="24" style="padding:2px;margin:unset;color:#A0A0A0;" onchange="limiter(this,'{{$project['td_project']}}');" readonly="readonly">
<input type="text" onkeypress="onlynumber(event)" name="hour[{{$project['td_project']}}][{{$i+1}}]" id="hour[{{$project['td_project']}}][{{$i+1}}]" value="{{$project['td_hours']}}" min="0" max="24" style="padding:2px;margin:unset;color:#A0A0A0;" onchange="limiter(this,'{{$project['td_project']}}');" readonly="readonly">
@else
<input onblur="findTotal()" type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="" 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="" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{$project['td_project']}}');">
@endif
</td>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<td >
<input type="text" onkeypress="onlynumber(event)" name="hour[{{$project['td_project']}}][{{$i+1}}]" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{$project['td_project']}}');">
@if($project['td_date'] == $i+1)
<input type="text" onkeypress="onlynumber(event)" name="hour[{{$project['td_project']}}][{{$i+1}}]" id="hour[{{$project['td_project']}}][{{$i+1}}]" value="{{$project['td_hours']}}" min="0" max="24" style="padding:2px;margin:unset;color:#A0A0A0;" onchange="limiter(this,'{{$project['td_project']}}');" readonly="readonly">
@else
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{$project['td_project']}}');">
@endif
</td>
@endfor
@endif
......@@ -99,7 +103,17 @@ input[type=number] {
@endforeach
</tbody>
</table>
@if($phase == 1)
<button class="center aligned ui green compact right labeled icon button" onclick="phase2($phase);" id="phase2">
<i class="angle double right icon"></i>
Phase 2
</button>
@else
<button class="center aligned ui green compact labeled icon button">
<i class="angle double left icon"></i>
Phase 1
</button>
@endif
</form>
</div>
......@@ -108,15 +122,13 @@ input[type=number] {
@push('script')
<script>
function findTotal(){
// var arr = document.getElementsByName('hour[{{$project['td_project']}}][{{$i+1}}]');
// var tot=0;
// for(var i=0;i<arr.length;i++){
// if(parseInt(arr[i].value))
// tot += parseInt(arr[i].value);
// }
// document.getElementById('total').value = tot;
}
var phase = 0;
function phase2(p)
{
phase = p;
phase++;
document.getElementById('phase2') = phase;
}
</script>
<script>
......@@ -139,11 +151,12 @@ input[type=number] {
</script>
<script>
$( document ).ready(function() {
$().ready(function() {
});
function limiter(input,pid) {
var currenttotal = 0;
if (input.value < 0) input.value = 0;
......@@ -166,7 +179,7 @@ input[type=number] {
}
if(typeof value === 'number'){
console.log(value);
// console.log(value);
currenttotal += value;
}
}
......
......@@ -16,7 +16,8 @@ Route::group(
Route::get('kalendarCharge',['uses' => 'DashboardController@kalendarCharge', 'as' => 'dashboard.kalendarCharge']);
Route::get('kalendarNonCharge',['uses' => 'DashboardController@kalendarNonCharge', 'as' => 'dashboard.kalendarNonCharge']);
Route::get('kalendar',['uses' => 'DashboardController@kalendar', 'as' => 'dashboard.kalendar']);
// Route::get('phase1/{phase}',['uses' => 'DashboardController@phase1', 'as' => 'dashboard.phase1']);
// Route::get('phase2/{phase}',['uses' => 'DashboardController@phase2', 'as' => 'dashboard.phase2']);
Route::post('saveHours',['uses' => 'DashboardController@saveHours', 'as' => 'dashboard.saveHours']);
}
......
......@@ -102,41 +102,40 @@ class DashboardController extends Controller
$sampleTimesheet_dtl[] = [
'td_id' => '2',
'td_id' => '1',
'td_date' => date('j-n-Y',strtotime('6/5/2022')),
'td_project' => '2',
'td_project' => '1',
'tm_id' => '1',
'tm_staff_id' => '1000',
'project_type' => '1',
'fk_o_id' => '',
'tm_month' => '6',
'tm_phase' => '1',
'td_project_code' => 'LHD2021',
'td_project_name' => 'APIM',
'td_hours' => '3',
'td_project_code' => 'LHD20212',
'td_project_name' => 'SMART',
'td_hours' => '5'
];
$sampleTimesheet_dtl[] = [
'td_id' => '1',
'td_id' => '2',
'td_date' => date('j-n-Y',strtotime('6/5/2022')),
'td_project' => '1',
'td_project' => '2',
'tm_id' => '1',
'tm_staff_id' => '1000',
'project_type' => '1',
'fk_o_id' => '',
'tm_month' => '6',
'tm_phase' => '1',
'td_project_code' => 'LHD20212',
'td_project_name' => 'SMART',
'td_hours' => '5'
'td_project_code' => 'LHD2021',
'td_project_name' => 'APIM',
'td_hours' => '3',
];
// dd($sampleTimesheet_dtl[0]['td_date']);
// if (day == $i+1)
......@@ -145,7 +144,7 @@ class DashboardController extends Controller
//sample dulu
$phase = 1;
$phase = 2;
$month = date('n');
$year = date('Y');
$day = date('j');
......@@ -218,6 +217,17 @@ class DashboardController extends Controller
// $data -> tm_chargeable_hrs = $request -> tm_chargeable_hrs;
// $data -> save();
// return redirect('home');
}
// public function phase1($phase)
// {
// $phase = $phase + 1;
// return view('timesheet::dashboard.borangBolehCaj', compact('phase'));
// }
// public function phase2($phase)
// {
// $phase = $phase - 1;
// return view('timesheet::dashboard.borangBolehCaj', compact('phase'));
// }
}
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