Commit 279534e5 by hannan

add enums permission "borang", and set dashboard for role 'staff'

parent fb69f16c
......@@ -19,5 +19,7 @@ final class Permission extends Enum
const kalendarNonCharge = 'kalendarNonCharge';
const kalendarOverhead = 'kalendarOverhead';
const calendar = 'calendar';
const borang = 'borang';
const tsviewer = 'tsviewer';
}
@extends('timesheet::layouts.filtermonthphase')
@section('action')
<form class="ui form" action="{{ route('timesheet::dashboard.viewerselectmonthphase') }}" method="POST">
@endsection
\ No newline at end of file
......@@ -39,6 +39,17 @@ input[type=number] {
</div>
</form>
<br>
@if($phase == 1)
<button class="center aligned ui green compact right labeled icon button" id="phase2" onclick="window.location.href='{{ route('timesheet::form.chargeableForm', ['phase' => 2, 'month' => $month, 'year' => $year]) }}';">
<i class="angle double right icon"></i>
Phase 2
</button>
@else
<button class="center aligned ui green compact labeled icon button" id="phase1" onclick="window.location.href='{{ route('timesheet::form.chargeableForm', ['phase' => 1, 'month' => $month, 'year' => $year]) }}';">
<i class="angle double left icon"></i>
Phase 1
</button>
@endif
<form class="ui form" action="{{ route('timesheet::form.savechargeablehours' )}}" method="POST">
{{csrf_field()}}
<input type="hidden" name="userId" value="{{$userId}}">
......@@ -51,10 +62,17 @@ input[type=number] {
<th colspan="2" rowspan="2" class="center aligned">Chargeable</th>
<th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
<th rowspan="2">
@if($projectlist == [])
<button type="submit" class="ui disabled fluid center aligned ui blue compact labeled icon button">
<i class="save icon"></i>
Save
</button>
@else
<button type="submit" class="fluid center aligned ui blue compact labeled icon button">
<i class="save icon"></i>
Save
</button>
@endif
</th>
</tr>
<tr>
......@@ -154,17 +172,10 @@ input[type=number] {
</table>
</form>
<br>
@if($phase == 1)
<button class="center aligned ui green compact right labeled icon button" id="phase2" onclick="window.location.href='{{ route('timesheet::form.chargeableForm', ['phase' => 2], ['month' => $month], ['year' => $year]) }}';">
<i class="angle double right icon"></i>
Phase 2
</button>
@else
<button class="center aligned ui green compact labeled icon button" id="phase1" onclick="window.location.href='{{ route('timesheet::form.chargeableForm', ['phase' => 1], ['month' => $month], ['year' => $year]) }}';">
<i class="angle double left icon"></i>
Phase 1
</button>
@endif
<button class="center aligned ui teal compact right labeled icon button" onclick="window.location.href='{{ route('timesheet::form.nonChargeableForm', ['phase' => $phase, 'month' => $month, 'year' => $year]) }}';">
<i class="angle double right icon"></i>
Non-Chargeable Form
</button>
</div>
@endsection
......
@extends('timesheet::layouts.filtermonthphase')
@section('action')
<form class="ui form" action="{{ route('timesheet::form.chargeableselectmonthphase') }}" method="POST">
@endsection
\ No newline at end of file
@extends('timesheet::layouts.filtermonthphase')
@section('action')
<form class="ui form" action="{{ route('timesheet::form.nonchargeableselectmonthphase') }}" method="POST">
@endsection
\ No newline at end of file
@extends('timesheet::layouts.filtermonthphase')
@section('action')
<form class="ui form" action="{{ route('timesheet::form.overheadselectmonthphase') }}" method="POST">
@endsection
\ No newline at end of file
......@@ -22,7 +22,10 @@ input[type=number] {
</div>
<div class="content">
<form class="ui form" action="{{ route('timesheet::form.addnonchargeabletask' )}}" method="POST">
{{csrf_field()}}
{{csrf_field()}}
<input type="hidden" name="month" value="{{ $month }}">
<input type="hidden" name="phase" value="{{ $phase }}">
<input type="hidden" name="year" value="{{ $year }}">
<div class="field">
<label>Select Task</label>
<div class="ui selection dropdown">
......@@ -43,7 +46,6 @@ input[type=number] {
<div class="field">
<label>Task Status</label>
<select name="status" class="ui fluid dropdown">
<option value="">Task Status</option>
<option value="1">Active</option>
<option value="0">Inactive</option>
</select>
......@@ -77,21 +79,24 @@ input[type=number] {
</div>
</form>
<br>
<button class="center aligned ui olive compact labeled icon button" id="task">
<i class="plus icon"></i>
Task
</button>
@if($phase == 1)
<button class="center aligned ui green compact right labeled icon button" id="phase2" onclick="window.location.href='{{ route('timesheet::form.nonChargeableForm', ['phase' => 2], ['month' => $month], ['year' => $year]) }}';">
<button class="center aligned ui green compact right labeled icon button" id="phase2" onclick="window.location.href='{{ route('timesheet::form.nonChargeableForm', ['phase' => 2, 'month' => $month, 'year' => $year]) }}';">
<i class="angle double right icon"></i>
Phase 2
</button>
@else
<button class="center aligned ui green compact labeled icon button" id="phase1" onclick="window.location.href='{{ route('timesheet::form.nonChargeableForm', ['phase' => 1], ['month' => $month], ['year' => $year]) }}';">
<button class="center aligned ui green compact labeled icon button" id="phase1" onclick="window.location.href='{{ route('timesheet::form.nonChargeableForm', ['phase' => 1, 'month' => $month, 'year' => $year]) }}';">
<i class="angle double left icon"></i>
Phase 1
</button>
@endif
<button class="center aligned ui olive compact labeled icon button" id="task">
<i class="plus icon"></i>
Task
</button>
<form class="ui form" action="{{ route('timesheet::form.savenonchargeablehours' )}}" method="POST">
{{csrf_field()}}
<input type="hidden" name="userId" value="{{$userId}}">
......@@ -104,10 +109,17 @@ input[type=number] {
<th rowspan="2" class="single line" class="center aligned">Non-Chargeable</th>
<th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
<th rowspan="2">
@if($projectlist == [])
<button type="submit" class="ui disabled fluid center aligned ui blue compact labeled icon button">
<i class="save icon"></i>
Save
</button>
@else
<button type="submit" class="fluid center aligned ui blue compact labeled icon button">
<i class="save icon"></i>
Save
</button>
@endif
</th>
</tr>
<tr>
......@@ -207,6 +219,14 @@ input[type=number] {
</table>
</form>
<br>
<button class="center aligned ui teal compact labeled icon button" onclick="window.location.href='{{ route('timesheet::form.chargeableForm', ['phase' => $phase, 'month' => $month, 'year' => $year]) }}';">
<i class="angle double left icon"></i>
Chargeable Form
</button>
<button class="center aligned ui teal compact right labeled icon button" onclick="window.location.href='{{ route('timesheet::form.overheadForm', ['phase' => $phase, 'month' => $month, 'year' => $year, 'fk_tm_id' => $fk_tm_id]) }}';">
<i class="angle double right icon"></i>
Overhead Form
</button>
</div>
@endsection
......
......@@ -46,6 +46,10 @@
</tr>
</tfoot>
</table>
<button class="center aligned ui teal compact labeled icon button" onclick="window.location.href='{{ route('timesheet::form.overheadForm', ['phase' => $phase, 'month' => $month]) }}';">
<i class="angle double left icon"></i>
Back
</button>
</div>
@endsection
......@@ -21,7 +21,7 @@ input[type=number] {
</div>
</div>
<div class="ui tiny modal description">
<!-- <div class="ui tiny modal description">
<div class="header">
Overhead Description
</div>
......@@ -55,7 +55,7 @@ input[type=number] {
<button class="ui blue button" type="submit">Submit</button>
</form>
</div>
</div>
</div> -->
<div class="ui segment">
<a class="ui blue left ribbon label">Overhead Form</a>
......@@ -81,16 +81,28 @@ input[type=number] {
</form>
<br>
<button class="center aligned ui green compact labeled icon button" id="description">
<!-- <button class="center aligned ui green compact labeled icon button" id="description">
<i class="plus icon"></i>
Description
</button>
</button> -->
@if($phase == 1)
<button class="center aligned ui green compact right labeled icon button" id="phase2" onclick="window.location.href='{{ route('timesheet::form.overheadForm', ['phase' => 2, 'month' => $month, 'year' => $year]) }}';">
<i class="angle double right icon"></i>
Phase 2
</button>
@else
<button class="center aligned ui green compact labeled icon button" id="phase1" onclick="window.location.href='{{ route('timesheet::form.overheadForm', ['phase' => 1, 'month' => $month,'year' => $year]) }}';">
<i class="angle double left icon"></i>
Phase 1
</button>
@endif
<button class="center aligned ui yellow compact labeled icon button" id="notes" onclick="window.location.href='{{ route('timesheet::form.notelist', ['year'=> $year, 'month'=> $month, 'phase'=> $phase, 'fk_tm_id'=> $check->id] ) }} ';">
<button class="center aligned ui yellow compact labeled icon button" id="notes" onclick="window.location.href='{{ route('timesheet::form.notelist', ['year'=> $year, 'month'=> $month, 'phase'=> $phase, 'fk_tm_id'=> $fk_tm_id] ) }} ';">
<i class="plus icon"></i>
Notes
</button>
<form class="ui form" action="{{ route('timesheet::form.saveoverheadhours' )}}" method="POST">
{{csrf_field()}}
<input type="hidden" name="userId" value="{{$userId}}">
......@@ -203,17 +215,14 @@ input[type=number] {
</table>
</form>
<br>
@if($phase == 1)
<button class="center aligned ui green compact right labeled icon button" id="phase2" onclick="window.location.href='{{ route('timesheet::form.overheadForm', ['phase' => 2], ['month' => $month], ['year' => $year]) }}';">
<i class="angle double right icon"></i>
Phase 2
</button>
@else
<button class="center aligned ui green compact labeled icon button" id="phase1" onclick="window.location.href='{{ route('timesheet::form.overheadForm', ['phase' => 1], ['month' => $month], ['year' => $year]) }}';">
<i class="angle double left icon"></i>
Phase 1
</button>
@endif
<button class="center aligned ui teal compact labeled icon button" onclick="window.location.href='{{ route('timesheet::form.nonChargeableForm', ['phase' => $phase, 'month' => $month, 'year' => $year]) }}';">
<i class="angle double left icon"></i>
Non-Chargeable Form
</button>
<button class="center aligned ui green compact right labeled icon button" onclick="window.location.href='{{ route('timesheet::dashboard.timesheetViewer', ['phase' => $phase, 'month' => $month, 'year' => $year]) }}';">
<i class="angle double right icon"></i>
Timesheet Viewer
</button>
</div>
......
@extends('ui::layouts.app')
@section('content')
<div class="ui segment">
<a class="ui blue left ribbon label">Select Month & Phase</a>
<br><br>
@yield('action')
{{csrf_field()}}
<div class="@if($currmonth == 1) three fields @else two fields @endif">
@if($currmonth == 1)
<div class="three wide field">
<label>Year</label>
<select name="year" class="ui fluid dropdown" required="required">
<option value="{{ $curryear-1 }}">{{ $curryear-1 }}</option>
<option value="{{ $curryear }}">{{ $curryear }}</option>
</select>
</div>
@endif
<div class="three wide field">
<label>Month</label>
<select name="month" class="ui fluid dropdown" required="required">
@foreach ($month as $key => $value)
<option value="{{ $key+1 }}">{{ $value }}</option>
@endforeach
</select>
</div>
<div class="three wide field">
<label>Phase</label>
<select name="phase" class="ui fluid dropdown" required="required">
<option value="1">1</option>
<option value="2">2</option>
</select>
</div>
</div>
<button class="ui button" type="submit">Submit</button>
</form>
</div>
@endsection
\ No newline at end of file
......@@ -25,7 +25,6 @@
<div class="field">
<label>Project Team Status</label>
<select name="status" class="ui fluid dropdown">
<option value="">Project Team Status</option>
<option value="1">Active</option>
<option value="0">Inactive</option>
</select>
......
......@@ -26,7 +26,10 @@
<td>{{ data_get($project,'projectname') }} </td>
<td>{{ data_get($project,'projectmanager') }} </td>
<td>{{ data_get($project,'status') }} </td>
<td><a href="{{ route('timesheet::maintenance.senaraiProjectTeam', ['id' => $project['id']]) }}">Project Team</a></td>
<td>
<button class="compact ui button" onclick="window.location.href='{{ route('timesheet::maintenance.senaraiProjectTeam', ['id' => $project['id']]) }}';">Team</button>
<button class="compact ui button" onclick="window.location.href='JavaScript:void(0)';">Edit</button>
</td>
</tr>
@endforeach
</tbody>
......
......@@ -52,6 +52,10 @@
</tr>
</tfoot>
</table>
<button class="center aligned ui teal compact labeled icon button" onclick="window.location.href='{{ route('timesheet::maintenance.senaraiProject', [ 'id' => $pid ]) }}';">
<i class="angle double left icon"></i>
Back
</button>
</div>
@endsection
......@@ -17,6 +17,8 @@ Route::group(
Route::get('timesheetReport',['uses' => 'DashboardController@timesheetReport', 'as' => 'dashboard.timesheetReport']);
Route::get('timesheetReview',['uses' => 'DashboardController@timesheetReview', 'as' => 'dashboard.timesheetReview']);
Route::get('timesheetViewer',['uses' => 'DashboardController@timesheetViewer', 'as' => 'dashboard.timesheetViewer']);
Route::get('filterViewer',['uses' => 'DashboardController@filterViewer', 'as' => 'dashboard.filterViewer']);
Route::post('viewerselectmonthphase', ['uses' => 'DashboardController@viewerselectmonthphase', 'as' => 'dashboard.viewerselectmonthphase']);
//maintenance
Route::get('senaraiProject',['uses' => 'MaintenanceController@senaraiProject', 'as' => 'maintenance.senaraiProject']);
......@@ -50,7 +52,13 @@ Route::group(
Route::get('notelist',['uses' => 'FormController@notelist', 'as' => 'form.notelist']);
Route::get('penambahannote',['uses' => 'FormController@penambahannote', 'as' => 'form.penambahannote']);
Route::post('addnote', ['uses' => 'FormController@addnote', 'as' => 'form.addnote']);
Route::get('filterChargeable',['uses' => 'FormController@filterChargeable', 'as' => 'form.filterChargeable']);
Route::get('filterNonChargeable',['uses' => 'FormController@filterNonChargeable', 'as' => 'form.filterNonChargeable']);
Route::get('filterOverhead',['uses' => 'FormController@filterOverhead', 'as' => 'form.filterOverhead']);
Route::post('chargeableselectmonthphase', ['uses' => 'FormController@chargeableselectmonthphase', 'as' => 'form.chargeableselectmonthphase']);
Route::post('nonchargeableselectmonthphase', ['uses' => 'FormController@nonchargeableselectmonthphase', 'as' => 'form.nonchargeableselectmonthphase']);
Route::post('overheadselectmonthphase', ['uses' => 'FormController@overheadselectmonthphase', 'as' => 'form.overheadselectmonthphase']);
// nonChargeableForm
Route::post('addnonchargeabletask',['uses' => 'FormController@addnonchargeabletask', 'as' => 'form.addnonchargeabletask']);
......
......@@ -70,6 +70,26 @@ class DashboardController extends Controller
}
}
public function filterViewer()
{
$currmonth = date('n');
// $currmonth = 1;
$curryear = date('Y');
$month = [];
for ($m=1; $m<=12; $m++) {
$month[] = date('F', mktime(0,0,0,$m, 1, date('Y')));
}
return view('timesheet::dashboard.filterViewer', compact('month', 'curryear', 'currmonth'));
}
public function viewerselectmonthphase(Request $request){
return redirect()->route('timesheet::dashboard.timesheetViewer', ['phase' => $request->phase, 'month' =>$request->month]);
}
public function timesheetApproval()
{
return view('timesheet::dashboard.timesheetApproval');
......@@ -96,19 +116,19 @@ class DashboardController extends Controller
$hod = Staff_info::find($user->penyokong)
->fullname;
$month = date('n');
// $month = date('n');
$year = date('Y');
$day = date('j');
// $day = date('j');
// $month = 7;
// $year = 2022;
// $day = 2;
if ($day < 16) {
$phase = 1;
} else {
$phase = 2;
}
// if ($day < 16) {
// $phase = 1;
// } else {
// $phase = 2;
// }
if(isset($request->phase))
{
......@@ -118,15 +138,14 @@ class DashboardController extends Controller
{
$month = $request->month;
}
if(isset($request->year))
{
$year = $request->year;
}
$daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year);
$myDate = $month.'/'.$day.'/'.$year;
$myDate = $month.'/'.'1'.'/'.$year;
$date = Carbon::createFromFormat('m/d/Y', $myDate);
$strdays = [];
......@@ -141,7 +160,6 @@ class DashboardController extends Controller
$strMonth = $date->format('F');
$chargeable = 1;
$nonchargeable = 2;
$overhead = 3;
......@@ -191,45 +209,69 @@ class DashboardController extends Controller
{
$chargehour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $chargeable)
// ->where('td_hours', '!=', 0)
->get();
->where('td_project_type', $chargeable)
// ->where('td_hours', '!=', 0)
->get();
$nonchargehour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $nonchargeable)
// ->where('td_hours', '!=', 0)
->get();
->where('td_project_type', $nonchargeable)
// ->where('td_hours', '!=', 0)
->get();
$overheadhour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $overhead)
->where('td_hours', '!=', 0)
->get();
->where('td_project_type', $overhead)
->where('td_hours', '!=', 0)
->get();
$tempOverhead = [];
// dd($tempOverhead);
$tempOverheadid = [];
$tempOverhead[0] = $overheadhour[0]->td_overhead_desc;
$tempOverheadid[0] = $overheadhour[0]->fk_o_id;
$j = 0;
for($i = 0; $i < count($overheadhour); $i++){
if ($tempOverhead[$j] == $overheadhour[$i]->td_overhead_desc) {
} else {
$j++;
$tempOverhead[$j] = $overheadhour[$i]->td_overhead_desc;
$tempOverheadid[$j] = $overheadhour[$i]->fk_o_id;
if(isset($overheadhour))
{
// dd('sini ke?');
$tempOverhead[0] = $overheadhour[0]->td_overhead_desc;
$tempOverheadid[0] = $overheadhour[0]->fk_o_id;
$j = 0;
for($i = 0; $i < count($overheadhour); $i++)
{
if ($tempOverhead[$j] == $overheadhour[$i]->td_overhead_desc) {
}
else
{
$j++;
$tempOverhead[$j] = $overheadhour[$i]->td_overhead_desc;
$tempOverheadid[$j] = $overheadhour[$i]->fk_o_id;
}
}
}
foreach ($tempOverhead as $key => $value) {
$overheadlist[] = [
'pid' => $tempOverheadid[$key],
'pname' => $tempOverhead[$key],
];
foreach ($tempOverhead as $key => $value) {
$overheadlist[] = [
'pid' => $tempOverheadid[$key],
'pname' => $tempOverhead[$key],
];
}
}
else
{
// dd('ke sini?');
}
$totalchargehrs = $check->tm_chargeable_hrs;
$totalnonchargehrs = $check->tm_nonchargeable_hrs;
$totaloverheadhrs = $check->tm_overhead_hrs;
$notes = Ts_detail::where('tm_year', $year)
->where('tm_month', $month)
->where('tm_phase', $phase)
->where('fk_tm_id', $check->id)
->where('tm_staff_id', $user->staff_id)
->where('td_project_type', $overhead)
->whereNotNull('td_overhead_note')
->orderby('td_date')
->get();
}
else
......@@ -238,23 +280,15 @@ class DashboardController extends Controller
$chargehour = null;
$nonchargehour = null;
$overheadhour = null;
$totalchargehrs = null;
$totalnonchargehrs = null;
$totaloverheadhrs = null;
$notes = null;
}
// dd($check);
$totalchargehrs = $check->tm_chargeable_hrs;
$totalnonchargehrs = $check->tm_nonchargeable_hrs;
$totaloverheadhrs = $check->tm_overhead_hrs;
$notes = Ts_detail::where('tm_year', $year)
->where('tm_month', $month)
->where('tm_phase', $phase)
->where('fk_tm_id', $check->id)
->where('tm_staff_id', $user->staff_id)
->where('td_project_type', $overhead)
->whereNotNull('td_overhead_note')
->orderby('td_date')
->get();
return view('timesheet::dashboard.timesheetViewer', compact('user', 'dept', 'hod', 'phase', 'month', 'year', 'day', 'strMonth', 'daymonth', 'chargeablelist', 'nonchargeablelist', 'overheadlist', 'chargehour', 'nonchargehour', 'totalchargehrs', 'totalnonchargehrs', 'totaloverheadhrs', 'overheadhour', 'notes', 'check', 'strdays'));
return view('timesheet::dashboard.timesheetViewer', compact('user', 'dept', 'hod', 'phase', 'month', 'year', 'strMonth', 'daymonth', 'chargeablelist', 'nonchargeablelist', 'overheadlist', 'chargehour', 'nonchargehour', 'totalchargehrs', 'totalnonchargehrs', 'totaloverheadhrs', 'overheadhour', 'notes', 'check', 'strdays'));
}
......
......@@ -26,6 +26,65 @@ use Auth;
class FormController extends Controller
{
public function filterChargeable()
{
$currmonth = date('n');
// $currmonth = 1;
$curryear = date('Y');
$month = [];
for ($m=1; $m<=12; $m++) {
$month[] = date('F', mktime(0,0,0,$m, 1, date('Y')));
}
return view('timesheet::form.filterChargeable', compact('month', 'currmonth', 'curryear'));
}
public function filterNonChargeable()
{
$currmonth = date('n');
$curryear = date('Y');
$month = [];
for ($m=1; $m<=12; $m++) {
$month[] = date('F', mktime(0,0,0,$m, 1, date('Y')));
}
return view('timesheet::form.filterNonChargeable', compact('month', 'currmonth', 'curryear'));
}
public function filterOverhead()
{
$currmonth = date('n');
$curryear = date('Y');
$month = [];
for ($m=1; $m<=12; $m++) {
$month[] = date('F', mktime(0,0,0,$m, 1, date('Y')));
}
return view('timesheet::form.filterOverhead', compact('month', 'currmonth', 'curryear'));
}
public function chargeableselectmonthphase(Request $request){
return redirect()->route('timesheet::form.chargeableForm', ['phase' => $request->phase, 'month' =>$request->month]);
}
public function nonchargeableselectmonthphase(Request $request){
return redirect()->route('timesheet::form.nonChargeableForm', ['phase' => $request->phase, 'month' =>$request->month]);
}
public function overheadselectmonthphase(Request $request){
return redirect()->route('timesheet::form.overheadForm', ['phase' => $request->phase, 'month' =>$request->month]);
}
public function chargeableForm(Request $request)
{
$chargeable = 1;
......@@ -51,16 +110,7 @@ class FormController extends Controller
}
$phase = 1;
$month = date('n');
$year = date('Y');
$day = date('j');
if ($day < 16) {
$phase = 1;
} else {
$phase = 2;
}
if(isset($request->phase))
{
......@@ -105,7 +155,9 @@ class FormController extends Controller
$hour = null;
}
return view('timesheet::form.chargeableForm', compact('projectlist','userId','month','phase','daymonth','year','day','hour', 'strdays'));
// dd($projectlist);
return view('timesheet::form.chargeableForm', compact('projectlist','userId','month','phase','daymonth','year', 'hour', 'strdays'));
}
public function savechargeablehours(Request $request)
......@@ -196,10 +248,8 @@ class FormController extends Controller
}
$sumdetailhour = Ts_detail::where('td_project_type', $chargeable)
->where('tm_year', $request->year)
->where('tm_month', $request->month)
->where('fk_tm_id', $tmasterid)
->where('tm_phase', $request->phase)
->where('tm_staff_id', $userId)
->sum('td_hours');
$checktotalhours = Ts_master::where('id', $tmasterid)->first();
......@@ -237,16 +287,7 @@ class FormController extends Controller
}
$phase = 1;
$month = date('n');
$year = date('Y');
$day = date('j');
if ($day < 16) {
$phase = 1;
} else {
$phase = 2;
}
if(isset($request->phase))
{
......@@ -292,11 +333,43 @@ class FormController extends Controller
$hour = null;
}
return view('timesheet::form.nonChargeableForm', compact('projectlist','userId','month','phase','daymonth','year','day','hour','nonchargeables','strdays'));
$checkoverhead = Ts_master::where('tm_staff_id', $userId)
->where('tm_year', $year)
->where('tm_month', $month)
->where('tm_phase', $phase)
->first();
if ($checkoverhead) {
$fk_tm_id = $checkoverhead->id;
}
else
{
$fk_tm_id = null;
}
return view('timesheet::form.nonChargeableForm', compact('projectlist','userId','month','phase','daymonth','year','hour','nonchargeables','strdays', 'fk_tm_id'));
}
public function addnonchargeabletask(Request $request)
{
// dd($request);
if(isset($request->phase))
{
$phase = $request->phase;
}
if(isset($request->month))
{
$month = $request->month;
dump($request->month);
}
if(isset($request->year))
{
$year = $request->year;
}
$nonchargeable = 2;
$user = Users::select('name','u_staffID')
->where('id',Auth::id())
......@@ -385,7 +458,7 @@ class FormController extends Controller
} else {
return redirect()->route('timesheet::form.nonChargeableForm')->withErrors('You did not select any task or enter any input!');
return redirect()->route('timesheet::form.nonChargeableForm', compact('month', 'year', 'phase'))->withErrors('You did not select any task or enter any input!');
}
......@@ -501,9 +574,10 @@ class FormController extends Controller
//update total ke master;
//buat query sum td_hours where condition :
$sumdetailhour = Ts_detail::where('td_project_type', $nonchargeable)
->where('tm_phase', $request->phase)
->sum('td_hours');
// checktotalhours
->where('fk_tm_id', $tmasterid)
->where('tm_phase', $request->phase)
->sum('td_hours');
// checktotalhours
$checktotalhours = Ts_master::where('id', $tmasterid)->first();
$checktotalhours->tm_nonchargeable_hrs = $sumdetailhour;
......@@ -538,18 +612,7 @@ class FormController extends Controller
}
//sample dulu
$phase = 1;
$month = date('n');
$year = date('Y');
$day = date('j');
if ($day < 16) {
$phase = 1;
} else {
$phase = 2;
}
if(isset($request->phase))
{
......@@ -578,28 +641,33 @@ class FormController extends Controller
}
$check = Ts_master::where('tm_staff_id', $userId)
$checkoverhead = Ts_master::where('tm_staff_id', $userId)
->where('tm_year', $year)
->where('tm_month', $month)
->where('tm_phase', $phase)
->first();
// dd($checkoverhead);
//kalau ada, dia gi ke edit
if($check)
if($checkoverhead)
{
$hour = Ts_detail::where('fk_tm_id',$check->id)
$hour = Ts_detail::where('fk_tm_id',$checkoverhead->id)
->get();
$fk_tm_id = $checkoverhead->id;
// dd($hour);
}
//klu xde g create.php
else
{
$hour = null;
$fk_tm_id = null;
}
// dd($check->id);
// dd($checkoverhead->id);
return view('timesheet::form.overheadForm', compact('projectlist','userId','month','phase','daymonth','year','day','hour', 'project', 'check', 'strdays'));
return view('timesheet::form.overheadForm', compact('projectlist','userId','month','phase','daymonth','year', 'hour', 'project', 'fk_tm_id', 'strdays'));
}
public function saveoverheadhours(Request $request)
......@@ -711,9 +779,13 @@ class FormController extends Controller
//update total ke master;
//buat query sum td_hours where condition :
$sumdetailhour = Ts_detail::where('td_project_type', $overhead)
->where('fk_tm_id', $tmasterid)
->where('tm_phase', $request->phase)
->sum('td_hours');
// checktotalhours
// dd($sumdetailhour);
// checktotalhours
$checktotalhours = Ts_master::where('id', $tmasterid)->first();
$checktotalhours->tm_overhead_hrs = $sumdetailhour;
......@@ -768,7 +840,6 @@ class FormController extends Controller
} else {
$pname = Overhead::where('o_overhead_desc', $request->task)
->first();
// dd($request);
$data = new Ts_detail;
$data->td_date = $request->date;
......@@ -805,6 +876,9 @@ class FormController extends Controller
public function notelist(Request $request)
{
$month = $request->month;
$phase = $request->phase;
$overhead = 3;
$userId = Users::find(Auth::id())
......@@ -820,7 +894,7 @@ class FormController extends Controller
->orderby('td_date')
->get();
return view('timesheet::form.notelist', compact('notes'));
return view('timesheet::form.notelist', compact('notes', 'phase', 'month'));
}
public function penambahannote()
......
......@@ -136,6 +136,7 @@ class MaintenanceController extends Controller
public function senaraiProjectTeam(Request $request)
{
// dd($request);
$chargeable = 1;
$pid = $request->id;
$project = Pteam::where('fk_project_id',$request->id)
......
......@@ -54,26 +54,44 @@ class ServiceProvider extends BaseServiceProvider
$dashboard->add(__('Halaman Utama'), url('/home/'))
->data('icon', 'tachometer alternate icon')
->active('home/*');
$dashboard->add(__('Timesheet Calendar'), route('timesheet::kalendar.kalendar'))
->data('icon', 'calendar alternate outline')
->active('kalendar/*')
->data('permission', Permission::kehadiran);
$dashboard->add(__('Timesheet Viewer'), route('timesheet::dashboard.timesheetViewer'))
// $dashboard->add(__('Timesheet Calendar'), route('timesheet::kalendar.kalendar'))
// ->data('icon', 'calendar alternate outline')
// ->active('kalendar/*')
// ->data('permission', Permission::calendar);
$form = $this->app['laravolt.menu'];
// $form = $this->app['laravolt.menu']->add(__('Borang'))->data('icon', 'align justify');
$form->add(__('Borang Chargeable'), route('timesheet::form.filterChargeable'))
->data('icon', 'circle outline')
->active('chargeableForm/*')
->data('permission', Permission::borang);
$form->add(__('Borang Non-Chargeable'), route('timesheet::form.filterNonChargeable'))
->data('icon', 'circle outline')
->active('nonChargeableForm/*')
->data('permission', Permission::borang);
$form->add(__('Borang Overhead'), route('timesheet::form.filterOverhead'))
->data('icon', 'circle outline')
->active('overheadForm/*')
->data('permission', Permission::borang);
$form->add(__('Timesheet Viewer'), route('timesheet::dashboard.filterViewer'))
->data('icon', 'eye icon')
->active('timesheetViewer/*')
->data('permission', Permission::kehadiran);
$dashboard->add(__('Timesheet Review'))
->data('permission', Permission::tsviewer);
$form->add(__('Timesheet Review'))
->data('icon', 'file alternate icon')
->active('timesheetReview/*')
->data('permission', Permission::kehadiran);
$dashboard->add(__('Timesheet Approval'))
$form->add(__('Timesheet Approval'))
->data('icon', 'check square icon')
->active('timesheetApproval/*')
->data('permission', Permission::kehadiran);
$dashboard->add(__('Timesheet Report'))
$form->add(__('Timesheet Report'))
->data('icon', 'file alternate icon')
->active('timesheetReport/*')
->data('permission', Permission::kehadiran);
->data('permission', Permission::kehadiran);
$pengurusanProject = $this->app['laravolt.menu']->add(__('Pengurusan Project'))->data('icon', 'align justify');
$pengurusanProject->add(__('Senarai Project'), route('timesheet::maintenance.senaraiProject'))
......@@ -111,27 +129,13 @@ class ServiceProvider extends BaseServiceProvider
// ->active('kalendarNonCharge/*')
// ->data('permission', Permission::kehadiran);
$form = $this->app['laravolt.menu']->add(__('Borang'))->data('icon', 'align justify');
$form->add(__('Borang Chargeable'), route('timesheet::form.chargeableForm'))
->data('icon', 'circle outline')
->active('chargeableForm/*')
->data('permission', Permission::kehadiran);
$form->add(__('Borang Non-Chargeable'), route('timesheet::form.nonChargeableForm'))
->data('icon', 'circle outline')
->active('nonChargeableForm/*')
->data('permission', Permission::kehadiran);
$form->add(__('Borang Overhead'), route('timesheet::form.overheadForm'))
->data('icon', 'circle outline')
->active('overheadForm/*')
->data('permission', Permission::kehadiran);
$calendar = $this->app['laravolt.menu']->add(__('Kalendar'))->data('icon', 'calendar alternate');
$calendar->add(__('Kalendar'), route('timesheet::kalendar.kalendar'))
->data('icon', 'calendar alternate outline')
->active('kalendar/*')
->data('permission', Permission::calendar );
// $calendar = $this->app['laravolt.menu']->add(__('Kalendar'))->data('icon', 'calendar alternate');
// $calendar->add(__('Kalendar'), route('timesheet::kalendar.kalendar'))
// ->data('icon', 'calendar alternate outline')
// ->active('kalendar/*')
// ->data('permission', Permission::calendar );
// $menu->add(__('Maklumat Cuti'), route('ecuti::quota.index'))
// ->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