Commit 4f801480 by fezrul

update sample array form

parent 9328b545
......@@ -19,13 +19,18 @@ input[type=number] {
<div class="ui segment">
<a class="ui blue left ribbon label">Chargeable Form</a>
<br><br>
<hr>
Timesheet for {{$month}} , phase {{$phase}}
<br>
<hr>
<form class="ui form" action="{{ url('saveHours' )}}" method="POST">
{{csrf_field()}}
<table class="ui celled structured table">
<thead>
<tr>
<th colspan="2">Chargeable</th>
<th colspan="15" 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="center aligned ui blue compact labeled icon button">
<i class="save icon"></i>
......@@ -33,12 +38,28 @@ input[type=number] {
</button>
</th>
</tr>
<tr>
<th >Project Code</th>
<th >Project Name</th>
@for($i = 0; $i < 15 ; $i++)
<th>{{$i+1}}</th>
@endfor
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<th>{{$i+1}}</th>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<th>{{$i+1}}</th>
@endfor
@endif
<th >Total Hours</th>
</tr>
<tr>
......@@ -46,23 +67,43 @@ input[type=number] {
</tr>
</thead>
<tbody>
@foreach($samplequery as $key => $project)
<tr>
<td>
{{$projectcode}}
{{$project['pcode']}}
</td>
<td>
{{$projectname}}
</td>
@for($i = 0; $i < 15 ; $i++)
<td >
<input type="number" onkeypress="onlynumber(event)" name="tm_chargeable_hrs" min="0" max="24" style="padding-right: 4px;padding-left: 4px;" onchange="limiter(this);">
{{$project['pname']}}
</td>
@endfor
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<td >
<input type="text" onkeypress="onlynumber(event)" name="hour[{{$project['pid']}}][{{$i+1}}]" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this);">
</td>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<td >
<input type="text" onkeypress="onlynumber(event)" name="hour[{{$project['pid']}}][{{$i+1}}]" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this);">
</td>
@endfor
@endif
<td>
<input type="number" onkeypress="onlynumber(event)" name="" style="padding-right: 4px;padding-left: 4px;" onchange="limiter(this);" readonly="">
</td>
</tr>
@endforeach
</tbody>
......
......@@ -75,11 +75,72 @@ class DashboardController extends Controller
return view('timesheet::dashboard.perkhidmatan');
}
public function borangBolehCaj()
public function borangBolehCaj(Request $request)
{
$projectcode = 'Project Code';
$projectname = 'Project Name';
return view('timesheet::dashboard.borangBolehCaj', compact('projectcode', 'projectname'));
// nanti project code query dari table project:
//
$samplequery[] = [
'pcode' => 'LHD2021',
'pname' => 'APIM',
'pid' => '1',
];
$samplequery[] = [
'pcode' => 'LHD20212',
'pname' => 'SMART',
'pid' => '2',
];
//sample dulu
$phase = 1;
$month = date('n');
$year = date('Y');
if(isset($request->phase))
{
$phase = $request->phase;
}
if(isset($request->month))
{
$month = $request->month;
}
if(isset($request->year))
{
$year = $request->year;
}
$daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year);
// dd($phase);
//check dlam db, kalau dah ada, kuar form edit, kalau belum, kuar form create
// $check = TimeSheetMaster::where('tm_staff_id',='id yg tgh login',)
//->where('tm_month', = $month)
//->year('dfsdf')
//->whereNotNull('tm_chargeable_hrs')->first();
//if(check)
//dia g ke edit, klu xde g create.php
//kalau ada juga = bawak data details
return view('timesheet::dashboard.borangBolehCaj', compact('projectcode', 'projectname','month','phase','samplequery','daymonth'));
}
public function kalendarCharge()
......@@ -99,12 +160,18 @@ class DashboardController extends Controller
public function saveHours(Request $request)
{
// dd($request);
dd($request);
//first = check dah ade ke belum
//mula2 masuk dalam table master untuk dapat id master.php
//pakai id master untuk update ke detail.
$data = new Ts_master;
$data -> tm_chargeable_hrs = $request -> tm_chargeable_hrs;
$data -> save();
return redirect('home');
// $data = new Ts_master;
// $data -> tm_chargeable_hrs = $request -> tm_chargeable_hrs;
// $data -> save();
// return redirect('home');
}
}
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