330 lines
18 KiB
PHP
330 lines
18 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
@include('layouts.shared/title-meta', ['title' => "Report"])
|
|
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
|
<link href="{{asset('assets/libs/flatpickr/flatpickr.min.css')}}" rel="stylesheet" type="text/css" />
|
|
<link href="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.css')}}" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body class="loading" style="background:#fff">
|
|
<div id="pageloader">
|
|
<img src="{{asset('assets/images/loader-large.gif')}}" alt="processing..." />
|
|
</div>
|
|
<div class="card p-2" id="graph-wrapper">
|
|
<div class="card-body p-0">
|
|
|
|
<!-- start page title -->
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="page-title-box">
|
|
<h4 class="page-title">Campaign Report</h4>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- end page title -->
|
|
|
|
<div class="row" id="graph-wrapper">
|
|
<div class="col-md-8 text-center">
|
|
<div class="button-list">
|
|
<a href="/campaignreport/report?id={{$post->id}}&type=details&chart=tabular&period=month-0" class="btn {{($post->type == 'details' ) ? 'btn-soft-warning' : 'btn-soft-blue' }} btn-rounded">Details</a>
|
|
<a href="/campaignreport/report?id={{$post->id}}&type=leaderboard&chart=leaderboard&period=month-0" class="btn {{($post->type == 'leaderboard' ) ? 'btn-soft-warning' : 'btn-soft-blue' }} btn-rounded">Leaderboard</a>
|
|
<a href="/campaignreport/report?id={{$post->id}}&type=myteam&chart=myteam&period=month-0" class="btn {{($post->type == 'myteam' ) ? 'btn-soft-warning' : 'btn-soft-blue' }} btn-rounded">My Team</a>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 text-end mt-2">
|
|
<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>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div class="row mt-3 mb-2">
|
|
<label for="period" class="col-6 col-xl-5 col-form-label">Select Period</label>
|
|
<div class="col-6 col-xl-7">
|
|
<select class="form-control" id="period" name="period">
|
|
@foreach($periods as $v)
|
|
<option value="{{$v->value}}" {{$post->period == $v->value ? "selected":""}}>{{$v->label}}</option>
|
|
@endforeach
|
|
<option value="custom-date" {{$post->period == $v->value ? "selected":""}}>Custom Date</option>
|
|
</select>
|
|
<div class="input-group input-group-sm" id="period-daterange-wrapper">
|
|
<input type="text" class="form-control border" id="period-daterange">
|
|
<span class="input-group-text bg-blue border-blue text-white" id="custom-date-submit">
|
|
<i class="mdi mdi-arrow-right-bold"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="col-12">
|
|
@switch(true)
|
|
@case($post->type == 'leaderboard')
|
|
<div class="btn-group mb-2">
|
|
<button type="button" class="btn btn-info leaderboard-prev" {{isset($post->level) && $base_level==$post->level?'disabled':''}}><i class="mdi mdi-play mdi-rotate-180 mdi-18px"></i></button>
|
|
<button type="button" class="btn btn-info">Level {{$users[0]->level}}</button>
|
|
<button type="button" class="btn btn-info leaderboard-next" {{$users[0]->level==1?'disabled':''}}><i class="mdi mdi-play mdi-18px"></i></button>
|
|
</div>
|
|
|
|
<div id="cardCollpase4" class="collapse pt-3 show">
|
|
<div class="table-responsive">
|
|
@if(isset($users))
|
|
<table class="table table-centered table-nowrap table-borderless mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>Rank</th>
|
|
<th colspan="2">User</th>
|
|
<th>Employee Code</th>
|
|
<th>Zone</th>
|
|
<th>Region</th>
|
|
<th>Area</th>
|
|
<th>Territory</th>
|
|
|
|
<th>Total Units</th>
|
|
<th>Total Points</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($users as $user)
|
|
<tr>
|
|
<td><img src="https://ui-avatars.com/api/?background=FFFFFF&name={{$user->rank}}" class="avatar-md"></td>
|
|
<td><img src="{{isset($user->user_info->avatar) ? $user->user_info->avatar : ''}}" class="avatar-sm rounded-circle"></td>
|
|
<td>{{ $user->user_info->name }} <br/>{{$user->user_info->designation}}</td>
|
|
<td>{{ isset($user->user_info->employee_code) ? $user->user_info->employee_code:''}}</td>
|
|
<td>{{ isset($user->user_info->positions->Zone) ? $user->user_info->positions->Zone : '-' }}</td>
|
|
<td>{{ isset($user->user_info->positions->Region) ? $user->user_info->positions->Region : '-' }}</td>
|
|
<td>{{ isset($user->user_info->positions->Area) ? $user->user_info->positions->Area : '-' }}</td>
|
|
<td>{{ isset($user->user_info->positions->Territory) ? $user->user_info->positions->Territory : '-' }}</td>
|
|
<td>{{ $user->units }}</td>
|
|
<td>{{ $user->total }}</td>
|
|
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
@endif
|
|
</div> <!-- .table-responsive -->
|
|
</div> <!-- end collapse-->
|
|
@break
|
|
@case($post->type == 'details')
|
|
<div id="cardCollpase4" class="collapse pt-3 show">
|
|
<div class="table-responsive">
|
|
@if(isset($users))
|
|
<table class="table table-centered table-nowrap table-borderless mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th colspan="2">User</th>
|
|
<th>Employee Code</th>
|
|
<th>Zone</th>
|
|
<th>Region</th>
|
|
<th>Area</th>
|
|
<th>Territory</th>
|
|
<th>Rank</th>
|
|
<th>Total Units</th>
|
|
<th>Total Points</th>
|
|
@foreach($metrics as $metric)
|
|
<th>{{$metric->name}} Units</th>
|
|
<th>{{$metric->name}} Points</th>
|
|
@endforeach
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($users as $user)
|
|
<tr>
|
|
<td><img src="{{isset($user->user_info->avatar) ? $user->user_info->avatar : ''}}" class="avatar-sm rounded-circle"></td>
|
|
<td>{{ $user->user_info->name }} <br/>{{$user->user_info->designation}}</td>
|
|
<td>{{ isset($user->user_info->employee_code) ? $user->user_info->employee_code:''}}</td>
|
|
<td>{{ isset($user->user_info->positions->Zone) ? $user->user_info->positions->Zone : '-' }}</td>
|
|
<td>{{ isset($user->user_info->positions->Region) ? $user->user_info->positions->Region : '-' }}</td>
|
|
<td>{{ isset($user->user_info->positions->Area) ? $user->user_info->positions->Area : '-' }}</td>
|
|
<td>{{ isset($user->user_info->positions->Territory) ? $user->user_info->positions->Territory : '-' }}</td>
|
|
<td>{{ $user->rank }}</td>
|
|
<td>{{ $user->units }}</td>
|
|
<td>{{ $user->total }}</td>
|
|
@foreach($metrics as $metric)
|
|
<td>{{ isset($user->metrics->{$metric->id}) ? $user->metrics->{$metric->id} : '-' }}</td>
|
|
<td>{{ isset($user->metric_points->{$metric->id}) ? $user->metric_points->{$metric->id} : '-' }}</td>
|
|
@endforeach
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
@endif
|
|
</div> <!-- .table-responsive -->
|
|
</div> <!-- end collapse-->
|
|
@break
|
|
@case($post->type == 'myteam')
|
|
@if(isset($users) && isset($users[0]->level))
|
|
<div class="btn-group mb-2">
|
|
<button type="button" class="btn btn-info leaderboard-prev" {{isset($post->level) && $base_level==$post->level?'disabled':''}}><i class="mdi mdi-play mdi-rotate-180 mdi-18px"></i></button>
|
|
<button type="button" class="btn btn-info">Level {{$users[0]->level}}</button>
|
|
<button type="button" class="btn btn-info leaderboard-next" {{$users[0]->level==1?'disabled':''}}><i class="mdi mdi-play mdi-18px"></i></button>
|
|
</div>
|
|
@endif
|
|
<div id="cardCollpase4" class="collapse pt-3 show">
|
|
<div class="table-responsive">
|
|
@if(isset($users))
|
|
<table class="table table-centered table-nowrap table-borderless mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>Rank</th>
|
|
<th colspan="2">User</th>
|
|
<th>Employee Code</th>
|
|
<th>Zone</th>
|
|
<th>Region</th>
|
|
<th>Area</th>
|
|
<th>Territory</th>
|
|
|
|
<th>Total Units</th>
|
|
<th>Total Points</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($users as $user)
|
|
<tr>
|
|
<td><img src="https://ui-avatars.com/api/?background=FFFFFF&name={{$user->rank}}" class="avatar-md"></td>
|
|
<td><img src="{{isset($user->user_info->avatar) ? $user->user_info->avatar : ''}}" class="avatar-sm rounded-circle"></td>
|
|
<td>{{ $user->user_info->name }} <br/>{{$user->user_info->designation}}</td>
|
|
<td>{{ isset($user->user_info->employee_code) ? $user->user_info->employee_code:''}}</td>
|
|
<td>{{ isset($user->user_info->positions->Zone) ? $user->user_info->positions->Zone : '-' }}</td>
|
|
<td>{{ isset($user->user_info->positions->Region) ? $user->user_info->positions->Region : '-' }}</td>
|
|
<td>{{ isset($user->user_info->positions->Area) ? $user->user_info->positions->Area : '-' }}</td>
|
|
<td>{{ isset($user->user_info->positions->Territory) ? $user->user_info->positions->Territory : '-' }}</td>
|
|
<td>{{ $user->units }}</td>
|
|
<td>{{ $user->total }}</td>
|
|
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
@endif
|
|
</div> <!-- .table-responsive -->
|
|
</div> <!-- end collapse-->
|
|
@break
|
|
@endswitch
|
|
</div>
|
|
</div>
|
|
|
|
</div> <!-- end col-->
|
|
</div>
|
|
<!-- end row -->
|
|
|
|
<style type="text/css">
|
|
.btn-xs {border-radius: 6px!important;}
|
|
.underline {border-bottom: 2px solid #B9B970;}
|
|
.loader{
|
|
position: absolute;
|
|
height: 100vh;
|
|
width: 100vw;
|
|
z-index: 999;
|
|
background-color: rgba(0,0,0,0.5);
|
|
padding-top: calc(50vh - 24px);
|
|
padding-left: calc(50vw - 24px);
|
|
}
|
|
#pageloader {
|
|
background: rgba( 255, 255, 255, 0.8 );
|
|
display: none;
|
|
height: 100%;
|
|
position: fixed;
|
|
width: 100%;
|
|
z-index: 9999;
|
|
}
|
|
|
|
#pageloader img {
|
|
left: 50%;
|
|
margin-left: -32px;
|
|
margin-top: -32px;
|
|
position: absolute;
|
|
top: 50%;
|
|
}
|
|
</style>
|
|
|
|
<!-- end container -->
|
|
@include('layouts.shared/footer-script')
|
|
<!-- third party js -->
|
|
<script src="{{asset('assets/libs/flatpickr/flatpickr.min.js')}}"></script>
|
|
<script src="{{asset('assets/libs/apexcharts/apexcharts.min.js')}}"></script>
|
|
<!-- third party js ends -->
|
|
|
|
<script type="text/javascript">
|
|
jQuery(document).ready(function($){
|
|
$('.loader').hide()
|
|
$('#period-daterange-wrapper').hide()
|
|
$('#period').change(function(){
|
|
if($(this).val() == 'custom-date') {
|
|
$('#period-daterange-wrapper').show()
|
|
} else {
|
|
$('#period-daterange-wrapper').hide()
|
|
$("#pageloader").fadeIn();
|
|
let href = new URL(window.location.href);
|
|
href.searchParams.delete('refresh')
|
|
href.searchParams.set('period', $(this).val() );
|
|
window.location.href = href.toString()
|
|
}
|
|
});
|
|
|
|
$('#period-daterange').flatpickr({
|
|
altInput: true,
|
|
mode: "range",
|
|
altFormat: "F j, y",
|
|
defaultDate: 'today'
|
|
});
|
|
|
|
$('#custom-date-submit').click(function(){
|
|
$("#pageloader").fadeIn();
|
|
let href = new URL(window.location.href);
|
|
href.searchParams.delete('refresh')
|
|
href.searchParams.set('period', $('#period').val() );
|
|
href.searchParams.set('dates', $('#period-daterange').val().replace(" to ", "--"))
|
|
window.location.href = href.toString()
|
|
})
|
|
|
|
$('#graph-wrapper .button-list a').click(function(event) {
|
|
event.preventDefault();
|
|
$("#pageloader").fadeIn();
|
|
console.log($(this).attr('href'))
|
|
let href = new URL(document.location.origin + $(this).attr('href'));
|
|
href.searchParams.delete('refresh')
|
|
href.searchParams.set('period', $('#period').val() );
|
|
window.location.href = href.toString()
|
|
});
|
|
|
|
@if(isset($users) && isset($users[0]->level) && $post->type == 'leaderboard' || $post->type == 'myteam')
|
|
$('.leaderboard-next').click(function(){
|
|
$("#pageloader").fadeIn();
|
|
let href = new URL(window.location.href);
|
|
href.searchParams.delete('refresh')
|
|
href.searchParams.set('level', {{$users[0]->level}}-1 );
|
|
window.location.href = href.toString()
|
|
})
|
|
$('.leaderboard-prev').click(function(){
|
|
$("#pageloader").fadeIn();
|
|
let href = new URL(window.location.href);
|
|
href.searchParams.delete('refresh')
|
|
href.searchParams.set('level', {{$users[0]->level}}+1 );
|
|
window.location.href = href.toString()
|
|
})
|
|
@endif
|
|
|
|
$('#export').click(function(){
|
|
//$("#pageloader").fadeIn();
|
|
let href = new URL(window.location.href);
|
|
window.location.href = href.origin + '/campaignreport/export' + href.search
|
|
})
|
|
$('#email-export').click(function(){
|
|
$("#pageloader").fadeIn();
|
|
let href = new URL(window.location.href);
|
|
$.get( href.origin + '/campaignreport/export' + href.search + '&email=1', function( data ) {
|
|
$("#pageloader").fadeOut();
|
|
alert( "Email has been sent to your email id." );
|
|
});
|
|
})
|
|
$('#refresh-data').click(function(){
|
|
$("#pageloader").fadeIn();
|
|
window.location.href = '{!! request()->fullUrlWithQuery(['refresh' => true]) !!}'
|
|
})
|
|
|
|
|
|
});
|
|
|
|
</script> |