210 lines
10 KiB
PHP
210 lines
10 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 class="loader text-white">
|
|
<i class="mdi mdi-loading mdi-spin mdi-48px" aria-hidden="true"></i><br />Loading
|
|
</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-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h4 class="header-title mb-2"></h4>
|
|
<div class="row">
|
|
<div class="col-md-4">
|
|
<div class="row mb-3">
|
|
<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>
|
|
|
|
<div class="widget-chart text-center" dir="ltr">
|
|
|
|
@switch(true)
|
|
@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>{{ $user->metrics->{$metric->id} }}</td>
|
|
<td>{{ $user->metric_points->{$metric->id} }}</td>
|
|
@endforeach
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
@endif
|
|
</div> <!-- .table-responsive -->
|
|
</div> <!-- end collapse-->
|
|
@break
|
|
@endswitch
|
|
|
|
</div>
|
|
</div>
|
|
</div> <!-- end card -->
|
|
</div> <!-- end col-->
|
|
</div>
|
|
<!-- end row -->
|
|
</div>
|
|
</div> <!-- container -->
|
|
<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);
|
|
}
|
|
</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()
|
|
});
|
|
|
|
|
|
|
|
$('#export').click(function(){
|
|
//$("#pageloader").fadeIn();
|
|
let href = new URL(window.location.href);
|
|
window.location.href = href.origin + '/metricreport/export' + href.search
|
|
})
|
|
// $('#export').click(function(){
|
|
// let href = new URL(window.location.href);
|
|
// $('.loader').show()
|
|
// $.get( href.origin + '/metricreport/export' + href.search + '&download=1&s3=1', function( data ) {
|
|
// console.log(data)
|
|
// $('.loader').hide()
|
|
// $('#graph-wrapper').prepend('<div class="button-list pe-xl-4 d-grid"><a href="" download class="btn btn--md btn-pink waves-effect waves-light">Download Report</a></div>');
|
|
// });
|
|
// })
|
|
$('#email-export').click(function(){
|
|
$("#pageloader").fadeIn();
|
|
let href = new URL(window.location.href);
|
|
$.get( href.origin + '/metricreport/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> |