Changes
This commit is contained in:
parent
51a9a8f307
commit
e00147c0b1
|
|
@ -50,6 +50,7 @@ class MetricreportController extends Controller
|
|||
$post = $request->except('_token');
|
||||
//echo '<pre>';print_r($post); exit;
|
||||
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module.'/view', $post);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
if($post['type'] == 'trend' && $post['chart'] == 'tabularperuser') {
|
||||
|
||||
|
||||
|
|
@ -117,6 +118,28 @@ class MetricreportController extends Controller
|
|||
}
|
||||
}
|
||||
break;
|
||||
case 'details':
|
||||
if($response->data->graph->chart == 'tabular') {
|
||||
$headers = ['User', 'Designation', 'Zone', 'Region', "Area", "Territory"];
|
||||
foreach($response->data->graph->values->metrics as $metric) {
|
||||
$headers[] = $metric->metric;
|
||||
}
|
||||
$exceldata[] = $headers;
|
||||
foreach($response->data->graph->values->users as $user) {
|
||||
$row = [];
|
||||
$row[] = $user->name;
|
||||
$row[] = $user->designation;
|
||||
$row[] = isset($user->positions->Zone) ? $user->positions->Zone : '-';
|
||||
$row[] = isset($user->positions->Region) ? $user->positions->Region : '-';
|
||||
$row[] = isset($user->positions->Area) ? $user->positions->Area : '-';
|
||||
$row[] = isset($user->positions->Territory) ? $user->positions->Territory : '-';
|
||||
foreach($response->data->graph->values->metrics as $metric) {
|
||||
$row[] = isset($metric->stats->{$user->id}) ? $metric->stats->{$user->id} : '-';
|
||||
}
|
||||
$exceldata[] = $row;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
//echo '<pre>'; print_r($exceldata); exit;
|
||||
if(isset($post['email']) && $post['email'] == 1) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
<p class="text-muted"><i class="mdi mdi-calendar" aria-hidden="true"></i> {{$graph->valid_from}} to {{$graph->valid_till}}</p>
|
||||
</div>
|
||||
<div class="col-4 text-end">
|
||||
@if(in_array($post['type'], ['trend','leaderboard']) || ($post['type'] == 'graphical' && $graph->type == 'grouped') )
|
||||
@if(in_array($post['type'], ['trend','leaderboard']) || ($post['type'] == 'graphical' && $graph->type == 'grouped') || ($post['type'] == 'details' && $graph->chart == 'tabular') )
|
||||
<button class="btn btn-dark btn-xs" id="export">Export</button>
|
||||
<button class="btn btn-warning btn-xs" id="email-export">Send me Email</button>
|
||||
@endif
|
||||
|
|
@ -165,6 +165,41 @@
|
|||
</div> <!-- .table-responsive -->
|
||||
</div> <!-- end collapse-->
|
||||
@break
|
||||
@case($post['type'] == 'details' && $graph->chart == 'tabular')
|
||||
<div id="cardCollpase4" class="collapse pt-3 show">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-centered table-nowrap table-borderless mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th colspan="2">User</th>
|
||||
<th>Zone</th>
|
||||
<th>Region</th>
|
||||
<th>Area</th>
|
||||
<th>Territory</th>
|
||||
@foreach($graph->values->metrics as $metric)
|
||||
<th>{{$metric->metric}}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($graph->values->users as $user)
|
||||
<tr>
|
||||
<td><img src="{{$user->avatar}}" class="avatar-sm rounded-circle"></td>
|
||||
<td>{{$user->name}} <br/>{{$user->designation}}</td>
|
||||
<td>{{ isset($user->positions->Zone) ? $user->positions->Zone : '-' }}</td>
|
||||
<td>{{ isset($user->positions->Region) ? $user->positions->Region : '-' }}</td>
|
||||
<td>{{ isset($user->positions->Area) ? $user->positions->Area : '-' }}</td>
|
||||
<td>{{ isset($user->positions->Territory) ? $user->positions->Territory : '-' }}</td>
|
||||
@foreach($graph->values->metrics as $metric)
|
||||
<td>{{ isset($metric->stats->{$user->id}) ? $metric->stats->{$user->id} : '-' }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- .table-responsive -->
|
||||
</div> <!-- end collapse-->
|
||||
@break
|
||||
@default
|
||||
<div id="chart-{{$graph->id}}" class="mt-0" data-colors="#f1556c"></div>
|
||||
@if($post['type'] == 'value' || ($post['type'] == 'graphical' && $graph->chart = 'percentile' && $graph->type == 'simple' ))
|
||||
|
|
|
|||
Loading…
Reference in New Issue