@extends('layouts.vertical', ["page_title"=> "Dashboard", "mode" => $mode ?? "", "demo" => $demo ?? ""]) @section('css') @endsection @section('content')
processing...

Metric Report

{{$graph->name}}

@php $showUserAttrs = ($graph->show_user_attributes ?? 'no') === 'yes'; $userAttrs = ($showUserAttrs && isset($graph->user_attributes) && is_array($graph->user_attributes)) ? $graph->user_attributes : []; $userAttrLabels = $user_attribute_labels ?? []; @endphp

{!!$graph->agg_type == 'team' ? '' : '' !!} {{ucwords($graph->agg_type)}} Report

{{ucwords($graph->type)}} Metric

Report Validity: {{$graph->valid_from}} to {{$graph->valid_till}}

Date Range Selected: {{$graph->first_day}} to {{$graph->last_day}}

@if((in_array($post['type'], ['trend','leaderboard']) && !in_array($post['chart'], ['line', 'bar']) ) || ($post['type'] == 'graphical' && $graph->type == 'grouped') || ($post['type'] == 'details' && $graph->chart == 'tabular') || ($post['type'] == 'contacts' && $graph->chart == 'contacts') || ($post['type'] == 'scoreboard' && $graph->chart == 'leaderboard') || ($post['type'] == 'incremental' && $graph->chart == 'incremental') ) @endif
@foreach($charts as $chart) @if(sizeof($chart->charts)>0) {{$chart->name}} @endif @endforeach
@php $dates = isset($post['dates'])?explode('--', $post['dates']):["",""]; @endphp
@foreach($charts as $chart) @if($chart->type == $post['type'] && sizeof($chart->charts) > 1) @foreach($chart->charts as $ch) {{ucwords($ch)}} @endforeach @endif @endforeach
@switch(true) @case($graph->chart == 'leaderboard')
@if($graph->agg_type == 'team') @if(sizeof($breadcrumbs) == 0)
@else @endif @endif
@if($post['type'] == 'leaderboard' && $graph->agg_type == 'team' && $graph->current_level > 1) @endif @if($graph->agg_type != 'team' || $post['type'] != 'leaderboard')@endif @foreach($userAttrs as $attr) @endforeach @foreach($graph->metrics as $val) @if(isset($val->is_visible) && $val->is_visible) @endif @endforeach @php $leader_id = ''; @endphp @foreach($graph->values as $i => $val) @if($leader_id != $val->user->id) @if($post['type'] == 'leaderboard' && $graph->agg_type == 'team' && $graph->current_level > 1) @endif @if($graph->agg_type != 'team' || $post['type'] != 'leaderboard') @endif @foreach($userAttrs as $attr) @endforeach @if($graph->type == 'verses') @foreach($graph->metrics as $m) @if(isset($m->is_visible) && $m->is_visible) @php $statVal = isset($val->stats->{$m->metric}) ? $val->stats->{$m->metric} : (isset($val->stats->{$m->display}) ? $val->stats->{$m->display} : null); @endphp @endif @endforeach @else @foreach($graph->metrics as $m) @if(isset($m->is_visible) && $m->is_visible) @php $statVal = isset($val->stats->{$m->metric}) ? $val->stats->{$m->metric} : (isset($val->stats->{$m->display}) ? $val->stats->{$m->display} : null); @endphp @endif @endforeach @endif @endif @php $leader_id = $val->user->id; @endphp @endforeach
View ChildsRankUser Employee Code Designation{{ $userAttrLabels[$attr] ?? ucwords(str_replace('_', ' ', $attr)) }}Zone Region Area Territory Active User {{$val->display}}
{{ isset($val->user->name) ? $val->user->name : '' }} {{ isset($val->user->employee_code) ? $val->user->employee_code : '-' }} {{ isset($val->user->designation) ? $val->user->designation : '-' }} {{ $val->user->{$attr} ?? '-' }}{{ isset($val->user->positions->Zone) ? $val->user->positions->Zone : (isset($val->user->positions->Country) ? $val->user->positions->Country : '-' ) }} {{ isset($val->user->positions->Region) ? $val->user->positions->Region : '-' }} {{ isset($val->user->positions->Area) ? $val->user->positions->Area : '-' }} {{ isset($val->user->positions->Territory) ? $val->user->positions->Territory : '-' }}{{ $statVal !== null ? $statVal : '-' }}{{ isset($val->stats->ucount) ? $val->stats->ucount : '0' }} {{ $statVal !== null ? $statVal : '-' }}
@break @case($graph->type == 'simple' && $post['type'] == 'trend' && $graph->chart == 'tabular')
@foreach($graph->values as $i => $val) @endforeach
Periods {{$graph->label}}
{{$val->x}} {{$val->y}}
@break @case($graph->type == 'grouped' && $post['type'] == 'trend' && $graph->chart == 'tabular')
@foreach($graph->values as $met) @endforeach @foreach($graph->values[0]->stats as $i => $stat) @foreach($graph->values as $met) @endforeach @endforeach
Periods{{$met->metric}}
{{$stat->x}}{{isset($met->stats[$i])?$met->stats[$i]->y:0}}
@break @case($post['type'] == 'details' && $graph->chart == 'tabular')
@if(isset($graph->values->metrics)) @foreach($userAttrs as $attr) @endforeach @if(!isset($graph->show_positions) || (isset($graph->show_positions) && $graph->show_positions)) @endif @foreach($graph->values->metrics as $metric) @endforeach @foreach($graph->values->users as $user) @foreach($userAttrs as $attr) @endforeach @if(!isset($graph->show_positions) || (isset($graph->show_positions) && $graph->show_positions)) @endif @foreach($graph->values->metrics as $metric) @endforeach
User Employee Code{{ $userAttrLabels[$attr] ?? ucwords(str_replace('_', ' ', $attr)) }}Zone Region Area TerritoryRole{{$metric->metric}}
{{ isset($user->name) ? $user->name : '-' }}
{{isset($user->designation) ? $user->designation : '-'}}
{{ isset($user->employee_code) ? $user->employee_code:''}}{{ $user->{$attr} ?? '-' }}{{ isset($user->positions->Zone) ? $user->positions->Zone : '-' }} {{ isset($user->positions->Region) ? $user->positions->Region : '-' }} {{ isset($user->positions->Area) ? $user->positions->Area : '-' }} {{ isset($user->positions->Territory) ? $user->positions->Territory : '-' }}{{ isset($user->roles) ? (is_array($user->roles) ? implode(',', $user->roles) : $user->roles) : '-' }}{{ isset($metric->stats->{$user->id}) ? $metric->stats->{$user->id} : '-' }} @endforeach
@endif
@break @case($post['type'] == 'contacts' && $graph->chart == 'contacts')
@if(isset($graph->values->metrics)) @foreach($graph->contact_attributes as $attr) @endforeach @foreach($graph->values->metrics as $metric) @if(isset($metric->is_visible) && $metric->is_visible) @endif @endforeach @foreach($graph->values->contacts as $contact) @foreach($graph->contact_attributes as $attr) @endforeach @php $user = isset($graph->values->users->{$contact->id}) ? $graph->values->users->{$contact->id} : false; @endphp @if($user) @else @endif @foreach($graph->values->metrics as $metric) @if(isset($metric->is_visible) && $metric->is_visible) @endif @endforeach @endforeach
Doctor MSL Code{{ $contact_attribute_labels[$attr] ?? ucwords($attr) }}User Employee Code Zone Region Area Territory{{$metric->metric}}
{{ $contact->name }} {{ $contact->msl_code }}{{ isset($contact->{$attr}) ? $contact->{$attr} : '' }}{{ $user->name }}
{{$user->designation}}
{{ isset($user->employee_code) ? $user->employee_code:''}} {{ isset($user->positions->Zone) ? $user->positions->Zone : '-' }} {{ isset($user->positions->Region) ? $user->positions->Region : '-' }} {{ isset($user->positions->Area) ? $user->positions->Area : '-' }} {{ isset($user->positions->Territory) ? $user->positions->Territory : '-' }}- - - - - -{{ isset($metric->stats->{$contact->id}) ? $metric->stats->{$contact->id} : '-' }}
@endif
@break @case($post['type'] == 'trend' && $graph->type == 'verses' && $graph->chart == 'tabular' )
@foreach($graph->values[0]->stats as $i => $val) @endforeach
Periods Actual Target Percent
{{$val->x}} {{$val->actual}} {{$val->target}} {{$val->y}}%
@break @case($post['type'] == 'incremental' && $graph->chart == 'incremental')
@if(isset($graph->values->metrics)) @php $period = explode('-', $post['period'])[0]; $interval = 'P1D'; if($period == 'week') { $interval = 'P1W'; } elseif($period == 'month') { $interval = 'P1M'; } $first_day = strtotime($graph->first_day); $last_day = strtotime($graph->last_day); $start = new DateTime($graph->first_day); $end = new DateTime($graph->last_day); $interval = new DateInterval($interval); $periods = new DatePeriod($start, $interval, $end); $colspan = 0; foreach($periods as $date) { $colspan++; } @endphp @if(!isset($graph->show_positions) || (isset($graph->show_positions) && $graph->show_positions)) @endif @foreach($graph->values->metrics as $metric) @endforeach @foreach($graph->values->metrics as $metric) @foreach($periods as $date) @endforeach @endforeach @foreach($graph->values->users as $user) @if(!isset($graph->show_positions) || (isset($graph->show_positions) && $graph->show_positions)) @endif @foreach($graph->values->metrics as $metric) @foreach($periods as $date) @endforeach @endforeach @endforeach
User Employee CodeZone Region Area TerritoryRole{{$metric->metric}}
{{ $date->format('d M Y') }}
{{ $user->name }}
{{$user->designation}}
{{ isset($user->employee_code) ? $user->employee_code:''}}{{ isset($user->positions->Zone) ? $user->positions->Zone : '-' }} {{ isset($user->positions->Region) ? $user->positions->Region : '-' }} {{ isset($user->positions->Area) ? $user->positions->Area : '-' }} {{ isset($user->positions->Territory) ? $user->positions->Territory : '-' }}{{ isset($user->roles) ? (is_array($user->roles) ? implode(',', $user->roles) : $user->roles) : '-' }}{{ isset($metric->stats->{$user->id}->{$date->getTimestamp().'000'}) ? $metric->stats->{$user->id}->{$date->getTimestamp().'000'} : '-' }}
@endif
@break @default
@if(($post['type'] == 'value' && $graph->type != 'verses') || ($post['type'] == 'graphical' && $graph->chart = 'percentile' && $graph->type == 'simple' ))
{{ $graph->type == 'simple' ? $graph->label : 'Total ' . $graph->name }}

{{$graph->value}}

@endif @if(($post['type'] == 'graphical' || $post['type'] == 'value') && $graph->type == 'verses' )
{{ $graph->type == 'simple' ? $graph->label : 'Total ' . $graph->name }}

{{$graph->value}} / {{$graph->max}}

@endif @if($post['type'] == 'trend' && $graph->type == 'verses' )
@foreach($graph->values[0]->stats as $i => $val) @endforeach
Periods Actual Target
{{$val->x}} {{$val->actual}} {{$val->target}}
@endif @break @endswitch
@endsection @section('script') @endsection