Commit 6b07bca0 by hannan

overhead maintenance screen and non-chargeable form

parent 816246a0
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class DropOIdColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('overhead', function (Blueprint $table) {
$table->dropColumn('o_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('overhead', function (Blueprint $table) {
$table->integer('o_id')->nullable()->unsigned();
});
}
}
@extends('ui::layouts.app')
@section('content')
<style>
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Firefox */
input[type=number] {
-moz-appearance: textfield;
}
</style>
<div class="ui segment">
<a class="ui blue left ribbon label">Chargeable Form</a>
<br>
<br>
<form class="ui form">
<div class="field">
<div class="four fields">
<div class="two wide field">
<label>Day</label>
<input type="text" placeholder="Day" value="{{$day}} ">
</div>
<div class="two wide field">
<label>Month</label>
<input type="text" placeholder="Month" value="{{$month}} ">
</div>
<div class="two wide field">
<label>Year</label>
<input type="text" placeholder="Year" value="{{$year}} ">
</div>
<!-- <div class="two wide field">
<label>Phase</label>
<select class="ui fluid dropdown">
<option value="">{{$phase}}</option>
<option value="1">1</option>
<option value="2">2</option>
</div> -->
</div>
</div>
</form>
<br>
<form class="ui form" action="{{ route('timesheet::dashboard.savechargeablehours' )}}" method="POST">
{{csrf_field()}}
<input type="hidden" name="userId" value="{{$userId}}">
<input type="hidden" name="year" value="{{$year}}">
<input type="hidden" name="month" value="{{$month}}">
<input type="hidden" name="phase" value="{{$phase}}">
<table class="ui celled structured table">
<thead>
<tr>
<th colspan="2">Chargeable</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>
Save
</button>
</th>
</tr>
<tr>
<th class="single line">Project Code</th>
<th class="single line">Project Name</th>
@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>
</tr>
</thead>
<tbody>
@foreach($projectlist as $key => $project)
<?php $total = 0; ?>
<tr>
<td class="single line">
{{$project['td_project_code']}}
</td>
<td class="single line">
{{$project['td_project_name']}}
</td>
@if($phase == 1)
@for($i = 0; $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 += $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){{$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; $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 += $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){{$valuehour->td_hours}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{$project['td_project']}}');">
</td>
@endfor
@endif
<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}}>
</td>
</tr>
@endforeach
</tbody>
</table>
</form>
<br>
@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" onclick="phase1($phase);" id="phase1">
<i class="angle double left icon"></i>
Phase 1
</button>
@endif
</div>
@endsection
@push('script')
<script>
var phase = 0;
function phase2(p)
{
phase = p;
phase = phase+1;
document.getElementById('phase2') = phase;
}
function phase1(p)
{
phase = p;
phase = phase-1;
document.getElementById('phase1') = phase;
}
</script>
<script>
function onlynumber(evt)
{
var theEvent = evt || window.event;
var key = theEvent.keyCode || theEvent.which;
key = String.fromCharCode(key);
var regex = /[0-9]|\./;
if( !regex.test(key) )
{
theEvent.returnValue = false;
if(theEvent.preventDefault) theEvent.preventDefault();
}
}
</script>
<script>
$().ready(function() {
});
function limiter(input,pid) {
var currenttotal = 0;
if (input.value < 0) input.value = 0;
if (input.value > 24) input.value = 24;
input.value = parseFloat(parseFloat(input.value).toFixed(1));
for(var i = 0; i < 32; i++){
var value = 0;
var hourValue = document.getElementById('hour['+pid+']['+i+']');
if(hourValue){
hourValue = hourValue.value;
value = parseFloat(parseFloat(hourValue).toFixed(1));
console.log(isNaN(value));
if(isNaN(value)){
value = 0;
}
if(typeof value === 'number'){
// console.log(value);
currenttotal += value;
}
}
}
console.log("currenttotal --> " + currenttotal);
// var currentTtotal = document.getElementById('total-'+pid).value;
// var total = document.getElementById('total-'+pid).value;
// if(total == null || total == 0){
// total = 0;
// }else{
// total = document.getElementById('total-'+pid).value;
// }
// if (input.value < 0) input.value = 0;
// if (input.value > 24) input.value = 24
// else total = Number(input.value)+Number(currentTtotal);
document.getElementById('total-'+pid).value = currenttotal;
}
</script>
@endpush
\ No newline at end of file
@extends('ui::layouts.app')
@section('content')
<div class="ui segment">
<a class="ui blue left ribbon label">Edit Project Team</a>
<br><br>
<form class="ui form" action="{{ route('timesheet::dashboard.updateprojectteam')}}" method="POST">
{{csrf_field()}}
<input type="hidden" name="id" value="{{$team->id}} ">
<input type="hidden" name="pid" value="{{$team->fk_project_id}} ">
<div class="field">
<label for="projectteam">Project Team</label>
<input onselect="myDepartment()" type="text" name="projectteam" value="{{$team->pt_team}}">
</div>
<div class="field">
<label>Project Status</label>
<select name="status" class="ui fluid dropdown">
<option value="">Project Status</option>
<option value="1">Active</option>
<option value="2">Inactive</option>
</select>
</div>
<button class="ui blue button" type="submit">Update</button>
<button class="ui green button" type="button" onclick="window.location.href='{{ route('timesheet::dashboard.senaraiProjectTeam', ['id'=> $pid] ) }} ';">Back</button>
</form>
</div>
@endsection
\ No newline at end of file
...@@ -17,7 +17,7 @@ input[type=number] { ...@@ -17,7 +17,7 @@ input[type=number] {
</style> </style>
<div class="ui segment"> <div class="ui segment">
<a class="ui blue left ribbon label">Chargeable Form</a> <a class="ui blue left ribbon label">Non Chargeable Form</a>
<br> <br>
<hr> <hr>
Day = {{$day}} <br> Day = {{$day}} <br>
...@@ -35,7 +35,7 @@ input[type=number] { ...@@ -35,7 +35,7 @@ input[type=number] {
<table class="ui celled structured table"> <table class="ui celled structured table">
<thead> <thead>
<tr> <tr>
<th colspan="2">Chargeable</th> <th colspan="2">Non-Chargeable</th>
<th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th> <th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
<th> <th>
<button type="submit" class="fluid center aligned ui blue compact labeled icon button"> <button type="submit" class="fluid center aligned ui blue compact labeled icon button">
...@@ -79,8 +79,6 @@ input[type=number] { ...@@ -79,8 +79,6 @@ input[type=number] {
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
<?php <?php
$valuehour = ''; $valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1); $date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
...@@ -90,6 +88,7 @@ input[type=number] { ...@@ -90,6 +88,7 @@ input[type=number] {
$valuehour = $hour->where('td_date','=',$date) $valuehour = $hour->where('td_date','=',$date)
->where('td_project',$project['td_project']) ->where('td_project',$project['td_project'])
->where('tm_phase',$phase) ->where('tm_phase',$phase)
// ->where('td_project_type',$nonchargeable)
->first(); ->first();
$total += $valuehour->td_hours; $total += $valuehour->td_hours;
...@@ -226,21 +225,8 @@ input[type=number] { ...@@ -226,21 +225,8 @@ input[type=number] {
console.log("currenttotal --> " + currenttotal); console.log("currenttotal --> " + currenttotal);
// var currentTtotal = document.getElementById('total-'+pid).value;
// var total = document.getElementById('total-'+pid).value;
// if(total == null || total == 0){
// total = 0;
// }else{
// total = document.getElementById('total-'+pid).value;
// }
// if (input.value < 0) input.value = 0;
// if (input.value > 24) input.value = 24
// else total = Number(input.value)+Number(currentTtotal);
document.getElementById('total-'+pid).value = currenttotal; document.getElementById('total-'+pid).value = currenttotal;
} }
</script> </script>
@endpush @endpush
\ No newline at end of file
@extends('ui::layouts.app')
@section('content')
<div class="ui segment">
<a class="ui blue left ribbon label">Add New Overhead Lookup</a>
<br><br>
<form class="ui form" action="{{ route('timesheet::dashboard.addoverheadlookup' )}}" method="POST">
{{csrf_field()}}
<div class="field">
<label>Overhead Lookup</label>
<input type="text" name="overheadlookup" placeholder="Enter new lookup overhead">
</div>
<div class="field">
<label>Overhead Status</label>
<select name="status" class="ui fluid dropdown">
<option value="">Overhead Status</option>
<option value="1">Active</option>
<option value="2">Inactive</option>
</select>
</div>
<button class="ui button" type="submit">Submit</button>
</form>
</div>
@endsection
\ No newline at end of file
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
</div> </div>
<button class="ui button" type="submit">Submit</button> <button class="ui button" type="submit">Submit</button>
</form> </form>
</div> </div>
@endsection
@endsection \ No newline at end of file
...@@ -43,10 +43,9 @@ ...@@ -43,10 +43,9 @@
</select> </select>
</div> </div>
<button class="ui blue button" type="submit">Save</button> <button class="ui blue button" type="submit">Save</button>
<button class="ui green button" type="button" onclick="window.location.href='';">Back</button> <button class="ui green button" type="button" onclick="window.location.href='{{ route('timesheet::dashboard.senaraiProjectTeam', ['id'=> $pid] ) }} ';">Back</button>
</form> </form>
</div> </div>
<!-- <p id="demo"></p> -->
@endsection @endsection
...@@ -59,8 +58,6 @@ function myDepartment() { ...@@ -59,8 +58,6 @@ function myDepartment() {
<script> <script>
function selectDepartment(i) { function selectDepartment(i) {
// var selectBox = document.getElementById("department");
// var selectedValue = selectBox.options[selectBox.selectedIndex].value;
alert(i); alert(i);
} }
</script> </script>
......
@extends('ui::layouts.app')
@section('content')
<div class="ui segment">
<a class="ui blue left ribbon label">Senarai Overhead</a>
<a href="{{ route('timesheet::dashboard.penambahanOverhead')}} " class="ui right floated small primary labeled icon button"><i class="plus icon"></i>Penambahan Lookup Overhead
</a>
<br>
<table class="ui celled padded table">
<thead>
<tr>
<th>No</th>
<th>Overhead Lookup</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@foreach($overheads as $key => $overhead)
<tr>
<td>{{$key+1}} </td>
<td>{{$overhead['lkp_overhead']}} </td>
<td>{{$overhead['status']}} </td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
\ No newline at end of file
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<td>{{$project['projectname']}} </td> <td>{{$project['projectname']}} </td>
<td>{{$project['projectteam']}} </td> <td>{{$project['projectteam']}} </td>
<td>{{$project['status']}} </td> <td>{{$project['status']}} </td>
<td><a href="">Edit</a></td> <td><a href="{{ route('timesheet::dashboard.editprojectteam', ['id' => $project['id']])}} ">Edit</a></td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
......
...@@ -10,7 +10,6 @@ Route::group( ...@@ -10,7 +10,6 @@ Route::group(
function () { function () {
Route::get('home',['uses' => 'DashboardController@index', 'as' => 'dashboard.index']); Route::get('home',['uses' => 'DashboardController@index', 'as' => 'dashboard.index']);
Route::get('pengurusan',['uses' => 'DashboardController@pengurusan', 'as' => 'dashboard.pengurusan']);
Route::get('senaraiProject',['uses' => 'DashboardController@senaraiProject', 'as' => 'dashboard.senaraiProject']); Route::get('senaraiProject',['uses' => 'DashboardController@senaraiProject', 'as' => 'dashboard.senaraiProject']);
Route::get('penambahanProject',['uses' => 'DashboardController@penambahanProject', 'as' => 'dashboard.penambahanProject']); Route::get('penambahanProject',['uses' => 'DashboardController@penambahanProject', 'as' => 'dashboard.penambahanProject']);
...@@ -18,9 +17,16 @@ Route::group( ...@@ -18,9 +17,16 @@ Route::group(
Route::get('penambahanProjectTeam',['uses' => 'DashboardController@penambahanProjectTeam', 'as' => 'dashboard.penambahanProjectTeam']); Route::get('penambahanProjectTeam',['uses' => 'DashboardController@penambahanProjectTeam', 'as' => 'dashboard.penambahanProjectTeam']);
Route::post('addnewproject',['uses' => 'DashboardController@addnewproject', 'as' => 'dashboard.addnewproject']); Route::post('addnewproject',['uses' => 'DashboardController@addnewproject', 'as' => 'dashboard.addnewproject']);
Route::post('addprojectteam',['uses' => 'DashboardController@addprojectteam', 'as' => 'dashboard.addprojectteam']); Route::post('addprojectteam',['uses' => 'DashboardController@addprojectteam', 'as' => 'dashboard.addprojectteam']);
Route::get('editprojectteam',['uses' => 'DashboardController@editprojectteam', 'as' => 'dashboard.editprojectteam']);
Route::post('updateprojectteam',['uses' => 'DashboardController@updateprojectteam', 'as' => 'dashboard.updateprojectteam']);
Route::get('senaraiOverhead',['uses' => 'DashboardController@senaraiOverhead', 'as' => 'dashboard.senaraiOverhead']);
Route::get('penambahanOverhead',['uses' => 'DashboardController@penambahanOverhead', 'as' => 'dashboard.penambahanOverhead']);
Route::post('addoverheadlookup',['uses' => 'DashboardController@addoverheadlookup', 'as' => 'dashboard.addoverheadlookup']);
Route::get('chargeableForm',['uses' => 'DashboardController@chargeableForm', 'as' => 'dashboard.chargeableForm']);
Route::get('nonChargeableForm',['uses' => 'DashboardController@nonChargeableForm', 'as' => 'dashboard.nonChargeableForm']);
Route::get('overheadForm',['uses' => 'DashboardController@overheadForm', 'as' => 'dashboard.overheadForm']);
Route::get('perkhidmatan',['uses' => 'DashboardController@perkhidmatan', 'as' => 'dashboard.perkhidmatan']);
Route::get('borangBolehCaj',['uses' => 'DashboardController@borangBolehCaj', 'as' => 'dashboard.borangBolehCaj']);
Route::get('kalendarCharge',['uses' => 'DashboardController@kalendarCharge', 'as' => 'dashboard.kalendarCharge']); Route::get('kalendarCharge',['uses' => 'DashboardController@kalendarCharge', 'as' => 'dashboard.kalendarCharge']);
Route::get('kalendarNonCharge',['uses' => 'DashboardController@kalendarNonCharge', 'as' => 'dashboard.kalendarNonCharge']); Route::get('kalendarNonCharge',['uses' => 'DashboardController@kalendarNonCharge', 'as' => 'dashboard.kalendarNonCharge']);
Route::get('kalendar',['uses' => 'DashboardController@kalendar', 'as' => 'dashboard.kalendar']); Route::get('kalendar',['uses' => 'DashboardController@kalendar', 'as' => 'dashboard.kalendar']);
...@@ -31,6 +37,12 @@ Route::group( ...@@ -31,6 +37,12 @@ Route::group(
Route::get('timesheet_viewer',['uses' => 'DashboardController@timesheetViewer', 'as' => 'dashboard.timesheetViewer']); Route::get('timesheet_viewer',['uses' => 'DashboardController@timesheetViewer', 'as' => 'dashboard.timesheetViewer']);
Route::post('savechargeablehours',['uses' => 'DashboardController@savechargeablehours', 'as' => 'dashboard.savechargeablehours']); Route::post('savechargeablehours',['uses' => 'DashboardController@savechargeablehours', 'as' => 'dashboard.savechargeablehours']);
Route::get('pengurusan',['uses' => 'DashboardController@pengurusan', 'as' => 'dashboard.pengurusan']);
Route::get('perkhidmatan',['uses' => 'DashboardController@perkhidmatan', 'as' => 'dashboard.perkhidmatan']);
} }
); );
......
...@@ -12,6 +12,7 @@ use Portal\Timesheet\Model\Project; ...@@ -12,6 +12,7 @@ use Portal\Timesheet\Model\Project;
use Portal\Timesheet\Model\Department; use Portal\Timesheet\Model\Department;
use Portal\Timesheet\Model\Pteam; use Portal\Timesheet\Model\Pteam;
use Portal\Timesheet\Model\Staff_info; use Portal\Timesheet\Model\Staff_info;
use Portal\Timesheet\Model\Overhead;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Input;
use File; use File;
...@@ -137,6 +138,7 @@ class DashboardController extends Controller ...@@ -137,6 +138,7 @@ class DashboardController extends Controller
'projectname' => $value->pt_project_description, 'projectname' => $value->pt_project_description,
'projectteam' => $value->pt_team, 'projectteam' => $value->pt_team,
'status' => $value->pt_project_task_sts, 'status' => $value->pt_project_task_sts,
'pid' => $value->fk_project_id,
]; ];
} }
...@@ -146,6 +148,7 @@ class DashboardController extends Controller ...@@ -146,6 +148,7 @@ class DashboardController extends Controller
public function penambahanProjectTeam(Request $request) public function penambahanProjectTeam(Request $request)
{ {
$pid = $request->id;
$project = Project::where('id', $request->id)->first(); //find($request->id); $project = Project::where('id', $request->id)->first(); //find($request->id);
$departments = Department::all() $departments = Department::all()
...@@ -158,7 +161,7 @@ class DashboardController extends Controller ...@@ -158,7 +161,7 @@ class DashboardController extends Controller
// dd($value->id); // dd($value->id);
} }
return view('timesheet::dashboard.penambahanProjectTeam', compact('project', 'departments', 'staffs')); return view('timesheet::dashboard.penambahanProjectTeam', compact('project', 'departments', 'staffs', 'pid'));
} }
public function addprojectteam(Request $request) public function addprojectteam(Request $request)
...@@ -186,20 +189,44 @@ class DashboardController extends Controller ...@@ -186,20 +189,44 @@ class DashboardController extends Controller
$pt->save(); $pt->save();
} }
// dd($request->staffId);
return redirect()->route('timesheet::dashboard.penambahanProjectTeam');
}
// $data = new Pteam; public function editprojectteam(Request $request)
// $data->fk_project_id = $project->id; {
// // $data->pt_team = $staff->fullname; $team = Pteam::where('id', $request->id)
// $data->pt_staff_id = explode(',', $request->staffId); ->first();
// $data->pt_project_description = $project->p_project_description; $pid = $team->fk_project_id;
// $data->pt_project_task_sts = $request->status;
// $data->updated_by = $user->u_staffID;
// $data->save();
return redirect()->route('timesheet::dashboard.penambahanProjectTeam'); return view('timesheet::dashboard.editprojectteam', compact('team', 'pid'));
}
public function updateprojectteam(Request $request)
{
$pid = $request->pid;
$user = Users::where('id', Auth::id())
->first();
$team = Pteam::where('id', $request->id)->first();
$team->pt_project_task_sts = $request->status;
$team->update();
$project = Pteam::where('fk_project_id',$request->pid)->get();
$projectlist = [];
foreach ($project as $key => $value) {
$projectlist[] = [
'id' => $value->id,
'projectcode' => $value->toProject->p_project_code,
'projectname' => $value->pt_project_description,
'projectteam' => $value->pt_team,
'status' => $value->pt_project_task_sts,
];
}
return view('timesheet::dashboard.senaraiProjectTeam', compact('projectlist', 'project', 'pid'));
} }
public function perkhidmatan() public function perkhidmatan()
...@@ -207,13 +234,13 @@ class DashboardController extends Controller ...@@ -207,13 +234,13 @@ class DashboardController extends Controller
return view('timesheet::dashboard.perkhidmatan'); return view('timesheet::dashboard.perkhidmatan');
} }
public function borangBolehCaj(Request $request) public function chargeableForm(Request $request)
{ {
$userId = Auth::id(); $userId = Auth::id();
$user = users::where('id', Auth::id())->first(); $user = users::where('id', Auth::id())->first();
$project = Pteam::where('pt_staff_id',$user->u_staffID)->get(); $project = Pteam::where('pt_staff_id',$user->u_staffID)->get();
// dd($project);
$projectlist = []; $projectlist = [];
// nanti project code query dari table project: // nanti project code query dari table project:
...@@ -284,9 +311,92 @@ class DashboardController extends Controller ...@@ -284,9 +311,92 @@ class DashboardController extends Controller
} }
return view('timesheet::dashboard.borangBolehCaj', compact('projectlist','userId','month','phase','daymonth','year','day','hour')); return view('timesheet::dashboard.chargeableForm', compact('projectlist','userId','month','phase','daymonth','year','day','hour'));
} }
public function nonchargeableForm()
{
$userId = Auth::id();
$user = users::where('id', Auth::id())->first();
$project = Pteam::where('pt_staff_id',$user->u_staffID)->get();
$nonchargeable = 2;
// dd($project);
$projectlist = [];
// nanti project code query dari table project:
foreach ($project as $key => $value) {
$projectlist[] = [
'td_project' => $value->fk_project_id,
'td_project_code' => $value->toProject->p_project_code,
'td_project_name' => $value->toProject->p_project_description,
];
}
//sample dulu
$phase = 1;
$month = date('n');
$year = date('Y');
$day = date('j');
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 detail hours, kuar form edit, kalau belum, kuar form create
$user = users::where('id', Auth::id())->first();
// dd($user);
// check timesheet master
$check = Ts_master::where('tm_staff_id', $user->u_staffID)
->where('tm_year', $year)
->where('tm_month', $month)
->where('tm_phase', $phase)
->first();
// dd($check);
//kalau ada, dia gi ke edit
if($check)
{
$hour = Ts_detail::where('fk_tm_id', $check->id)
// ->where('td_project_type', $nonchargeable)
// ->with('project:p_project_code')
->get();
// dd($hour);
}
//klu xde g create.php
else
{
$hour = null;
}
return view('timesheet::dashboard.nonchargeableForm', compact('projectlist','userId','month','phase','daymonth','year','day','hour', 'nonchargeable'));
}
public function kalendarCharge() public function kalendarCharge()
{ {
return view('timesheet::dashboard.kalendarCharge'); return view('timesheet::dashboard.kalendarCharge');
...@@ -417,8 +527,46 @@ class DashboardController extends Controller ...@@ -417,8 +527,46 @@ class DashboardController extends Controller
// return redirect::to('mobile/profile'); // return redirect::to('mobile/profile');
return redirect()->route('timesheet::dashboard.borangBolehCaj', ['phase' => $request->phase, 'month' =>$request->month,'year',$request->year])->with('success', 'Timesheet Updated'); return redirect()->route('timesheet::dashboard.chargeableForm', ['phase' => $request->phase, 'month' =>$request->month,'year',$request->year])->with('success', 'Timesheet Updated');
}
public function senaraiOverhead()
{
$overhead = Overhead::all();
$overheads = [];
foreach ($overhead as $key => $value) {
$overheads[] = [
'id' => $value->id,
'lkp_overhead' => $value->o_overhead_desc,
'status' => $value->o_overhead_sts,
];
}
return view('timesheet::dashboard.senaraiOverhead', compact('overheads'));
}
public function penambahanOverhead()
{
return view('timesheet::dashboard.penambahanOverhead');
}
public function addoverheadlookup(Request $request)
{
$user = Users::where('id', Auth::id())
->first();
$data = new Overhead;
$data->o_overhead_desc = $request->overheadlookup;
$data->o_overhead_sts = $request->status;
$data->updated_by = $user->u_staffID;
$data->save();
return redirect()->route('timesheet::dashboard.senaraiOverhead');
} }
public function timesheetApproval() public function timesheetApproval()
......
...@@ -92,12 +92,21 @@ class ServiceProvider extends BaseServiceProvider ...@@ -92,12 +92,21 @@ class ServiceProvider extends BaseServiceProvider
->data('icon', 'users icon') ->data('icon', 'users icon')
->active('pengurusan/*') ->active('pengurusan/*')
->data('permission', Permission::pengurusan); ->data('permission', Permission::pengurusan);
$pengurusanProject->add(__('Senarai Overhead'), route('timesheet::dashboard.senaraiOverhead'))
->data('icon', 'users icon')
->active('pengurusan/*')
->data('permission', Permission::pengurusan);
$pengurusanProject->add(__('Penambahan Overhead'), route('timesheet::dashboard.penambahanOverhead'))
->data('icon', 'users icon')
->active('pengurusan/*')
->data('permission', Permission::pengurusan);
$calendar = $this->app['laravolt.menu']->add(__('Kalendar'))->data('icon', 'calendar alternate'); $calendar = $this->app['laravolt.menu']->add(__('Kalendar'))->data('icon', 'calendar alternate');
$calendar->add(__('Kalendar'), route('timesheet::dashboard.kalendar')) $calendar->add(__('Kalendar'), route('timesheet::dashboard.kalendar'))
->data('icon', 'calendar alternate outline') ->data('icon', 'calendar alternate outline')
->active('kalendar/*') ->active('kalendar/*')
->data('permission', Permission::calendar ); ->data('permission', Permission::calendar );
// $calendar->add(__('Chargeable'), route('timesheet::dashboard.kalendarCharge')) // $calendar->add(__('Chargeable'), route('timesheet::dashboard.kalendarCharge'))
// ->data('icon', 'calendar alternate outline') // ->data('icon', 'calendar alternate outline')
// ->active('kalendarCharge/*') // ->active('kalendarCharge/*')
...@@ -109,16 +118,20 @@ class ServiceProvider extends BaseServiceProvider ...@@ -109,16 +118,20 @@ class ServiceProvider extends BaseServiceProvider
// ->data('permission', Permission::kehadiran); // ->data('permission', Permission::kehadiran);
$form = $this->app['laravolt.menu']->add(__('Borang'))->data('icon', 'align justify'); $form = $this->app['laravolt.menu']->add(__('Borang'))->data('icon', 'align justify');
$form->add(__('Borang Chargeable'), url('/borangBolehCaj/')) $form->add(__('Borang Chargeable'), url('/chargeableForm/'))
->data('icon', 'circle outline') ->data('icon', 'circle outline')
->active('borangBolehCaj/*') ->active('chargeableForm/*')
->data('permission', Permission::kehadiran); ->data('permission', Permission::kehadiran);
$form->add(__('Borang Non-Chargeable')) $form->add(__('Borang Non-Chargeable'), route('timesheet::dashboard.nonChargeableForm'))
->data('icon', 'circle outline'); ->data('icon', 'circle outline')
->active('nonChargeableForm/*')
->data('permission', Permission::kehadiran);
$form->add(__('Overhed')) $form->add(__('Overhead'), route('timesheet::dashboard.overheadForm'))
->data('icon', 'circle outline'); ->data('icon', 'circle outline')
->active('overheadForm/*')
->data('permission', Permission::kehadiran);
// $menu->add(__('Maklumat Cuti'), route('ecuti::quota.index')) // $menu->add(__('Maklumat Cuti'), route('ecuti::quota.index'))
// ->data('icon', 'circle outline') // ->data('icon', 'circle outline')
......
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