Commit 7bb79950 by Azhan Hannan

dashboardstaff

parent 4313c072
...@@ -162,7 +162,6 @@ ...@@ -162,7 +162,6 @@
@endforeach @endforeach
</div> </div>
</div> </div>
@endsection @endsection
@push('script') @push('script')
......
@extends('ui::layouts.app') @extends('ui::layouts.app')
@section('content') @section('content')
<?php
$admin = count($staffs->where('fk_lkp_department', 1));
$tms = count($staffs->where('fk_lkp_department', 2));
$pss = count($staffs->where('fk_lkp_department', 3));
$pms = count($staffs->where('fk_lkp_department', 4));
$pcs = count($staffs->where('fk_lkp_department', 5));
$spd = count($staffs->where('fk_lkp_department', 6));
$bdd = count($staffs->where('fk_lkp_department', 7));
// dd($data);
$dataPoints = array(
array("label"=> "ADMIN", "y"=> $admin),
array("label"=> "TMS", "y"=> $tms),
array("label"=> "PSS", "y"=> $pss),
array("label"=> "PMS", "y"=> $pms),
array("label"=> "PCS", "y"=> $pcs),
array("label"=> "SPD", "y"=> $spd),
array("label"=> "BDD", "y"=> $bdd)
);
?>
<!-- <div class="ui segment">
<div class="row">
<div class="col">
<canvas id="myChart"></canvas>
</div>
</div>
</div>
<div class="ui segment"> <div class="ui segment">
<div class="row"> <a class="ui blue left ribbon label">Welcome Back</a>
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
</div>
</div> -->
<div class="ui segment">
<!-- <a class="ui blue left ribbon label">Welcome Back</a>
<br> <br>
<br> <br>
--><!-- <div class="column sixteen wide"> <!-- <div class="column sixteen wide">
<div class="ui cards four doubling"> <div class="ui cards four doubling">
<a href="/home" class="ui card"> <a href="/home" class="ui card">
<div class="content"> <div class="content">
...@@ -70,8 +34,8 @@ $dataPoints = array( ...@@ -70,8 +34,8 @@ $dataPoints = array(
</div> </div>
</a> </a>
</div> </div>
</div> --> </div>
<!-- <br> --> <br> -->
<a class="ui teal left ribbon label">Timesheet Status</a> <a class="ui teal left ribbon label">Timesheet Status</a>
<br> <br>
<table class="ui unstackable celled table"> <table class="ui unstackable celled table">
...@@ -123,63 +87,105 @@ $dataPoints = array( ...@@ -123,63 +87,105 @@ $dataPoints = array(
<!-- <br> --> <!-- <br> -->
</div> </div>
@endsection @foreach($timesheet as $key => $value)
<?php dd($value); ?>
<div class="ui styled fluid accordion">
<?php $page = 1; ?>
<div class="title">
<table class="ui unstackable celled table">
<thead>
<tr>
<th style="width: 60%" class="text-center">{{data_get($value,'tm_year')}} - {{ date("F", mktime(0, 0, 0, data_get($value,'tm_month'), 10)) }} - Phase {{data_get($value,'tm_phase')}}</th>
<th style="width: 15%;" class="center aligned">{{data_get($value,'tm_timesheet_master_sts')}}</th>
<th style="width: 13%" class="text-center">Submitted on: {{data_get($value,'tm_submission_at')}}</th>
<th style="width: 12%" class="text-center">
<button class="center aligned ui blue icon button">View</button>
</th>
</tr>
</thead>
</table>
</div>
@push('script') <?php
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script> $chargeable = $projects->where('tp_project_type', 1);
$overhead = $projects->where('tp_project_type', 3);
// dump($chargeable);
// dd($overhead);
?>
<script> <div class="content" style="padding-top: 0px;">
<!-- chargeable -->
<table class="ui unstackable celled table">
<thead>
<tr>
<th style="width: 10%;">Project Code</th>
<th style="width: 15;">Project Name</th>
<th style="width: 10%;" class="center aligned">Total Hours</th>
<th style="width: 10%;" class="center aligned">Total Days</th>
<th style="width: 15%">PM Remarks</th>
<th style="width: 15%">PD Remarks</th>
<th style="width: 13%" class="text-center">Status</th>
<th style="width: 12%;" class="text-center">Action</th>
</tr>
</thead>
@if($chargeable)
<?php
$prjchargeable = $chargeable;
?>
@foreach($prjchargeable as $key => $tpcharge)
<tr>
<td style="width: 10%;">p_project_code</td>
<td style="width: 15;">p_project_description</td>
<td style="width: 10%;" class="center aligned">tp_hours</td>
<td style="width: 10%;" class="center aligned">tp_hours/8</td>
<td style="width: 15%">pm remark</td>
<td style="width: 15%">pd remark</td>
<td style="width: 13%" class="text-center">status</td>
<td style="width: 12%;" class="text-center">
<button class="center aligned ui green icon button">Resubmit</button>
</td>
</tr>
@endforeach
@endif
</table>
<!-- overhead -->
<table class="ui unstackable celled table">
<thead>
<tr>
<th style="width: 25%;">Overhead</th>
<th style="width: 10%;" class="center aligned">Total Hours</th>
<th style="width: 10%;" class="center aligned">Total Days</th>
<th style="width: 15%;">Hod Remarks</th>
<th style="width: 15%;">Bod Remarks</th>
<th style="width: 13%;" class="text-center">Status</th>
<th style="width: 12%;" class="text-center">Action</th>
</tr>
</thead>
@if($overhead)
@foreach($overhead as $key => $tpoverhead)
<tr>
<td style="width: 25;">tp_project_name</td>
<td style="width: 10%;" class="center aligned">tp_hours</td>
<td style="width: 10%;" class="center aligned">tp_hours/8</td>
<td style="width: 15%;">Hod remarks</td>
<td style="width: 15%;">Bod remarks</td>
<td style="width: 13%;" class="text-center">status</td>
<td style="width: 12%;" class="text-center">
<button class="center aligned ui green icon button">Resubmit</button>
</td>
</tr>
@endforeach
@endif
</table>
</div>
</div>
@endforeach
const data = { @endsection
labels: [
'Admin',
'TMS',
'PSS'
],
datasets: [{
label: 'My First Dataset',
data: [100, 150, 200],
backgroundColor: [
'rgb(255, 99, 132)',
'rgb(54, 162, 235)',
'rgb(255, 205, 86)'
],
hoverOffset: 4
}]
};
new Chart("myChart", {
type: "doughnut",
data: data,
});
</script>
@push('script')
<script> <script>
$('.ui.accordion').accordion();
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
exportEnabled: true,
title:{
text: "Percentage of 3F Staffs"
},
subtitles: [{
text: "--------"
}],
data: [{
type: "pie",
showInLegend: "true",
legendText: "{label}",
indexLabelFontSize: 16,
indexLabel: "{label} - #percent%",
yValueFormatString: "#,##",
dataPoints: <?php echo json_encode($dataPoints, JSON_NUMERIC_CHECK); ?>
}]
});
chart.render();
}
</script> </script>
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
@endpush @endpush
\ No newline at end of file
...@@ -181,7 +181,11 @@ class DashboardController extends Controller ...@@ -181,7 +181,11 @@ class DashboardController extends Controller
->orderby('tm_month', 'DESC') ->orderby('tm_month', 'DESC')
->orderby('tm_phase', 'DESC') ->orderby('tm_phase', 'DESC')
->get(); ->get();
// dd($timesheet);
$projects = Tproject::where('staffid', $staffid)
->where('tp_year', date('Y'))
->get();
// dd($projects);
$user = Users::where('name', 'like', '%'.$keyword.'%') $user = Users::where('name', 'like', '%'.$keyword.'%')
->orWhere( ->orWhere(
...@@ -190,7 +194,7 @@ class DashboardController extends Controller ...@@ -190,7 +194,7 @@ class DashboardController extends Controller
} }
)->paginate(15); )->paginate(15);
return view('timesheet::dashboard.dashboardstaff',compact('user', 'timesheet', 'staffs')); return view('timesheet::dashboard.dashboardstaff',compact('user', 'timesheet', 'staffs', 'projects'));
}if ($roleid == '3') { }if ($roleid == '3') {
...@@ -900,7 +904,7 @@ class DashboardController extends Controller ...@@ -900,7 +904,7 @@ class DashboardController extends Controller
->with('attachement') ->with('attachement')
->first(); ->first();
$chargeableproject = Tproject::where('fk_tm_id', $check->id) $chargeableproject = Tproject::where('fk_tm_id', data_get($check,'id'))
->where('tp_project_type', 1) ->where('tp_project_type', 1)
->with('project') ->with('project')
->get(); ->get();
...@@ -997,11 +1001,6 @@ class DashboardController extends Controller ...@@ -997,11 +1001,6 @@ class DashboardController extends Controller
public function tsubmit(Request $request) public function tsubmit(Request $request)
{ {
$checktpnull = Tproject::where('fk_tm_id', $request->id)
->where('tp_hours', '0')
->first();
dd($request);
$roleid = auth()->user()->roles['0']->id; $roleid = auth()->user()->roles['0']->id;
$user = Staff_info::where('fk_users', Auth::id())->first(); $user = Staff_info::where('fk_users', Auth::id())->first();
// dd($user); // dd($user);
......
...@@ -307,6 +307,7 @@ class FormController extends Controller ...@@ -307,6 +307,7 @@ class FormController extends Controller
$zeroedproject = Tproject::where('fk_tm_id', $tmasterid) $zeroedproject = Tproject::where('fk_tm_id', $tmasterid)
->where('td_project', $projectid) ->where('td_project', $projectid)
->where('tp_hours', 0)
->first(); ->first();
if ($zeroedproject) if ($zeroedproject)
......
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