193 lines
7.8 KiB
PHP
193 lines
7.8 KiB
PHP
@extends('layouts.vertical', ["page_title"=> "Dashboard", "mode" => $mode ?? "", "demo" => $demo ?? ""])
|
|
|
|
@section('css')
|
|
<!-- third party css -->
|
|
<link href="{{asset('assets/libs/flatpickr/flatpickr.min.css')}}" rel="stylesheet" type="text/css" />
|
|
<link href="{{asset('assets/libs/selectize/selectize.min.css')}}" rel="stylesheet" type="text/css" />
|
|
<!-- third party css end -->
|
|
@endsection
|
|
|
|
@section('content')
|
|
<div id="pageloader">
|
|
<img src="{{asset('assets/images/loader-large.gif')}}" alt="processing..." />
|
|
</div>
|
|
<!-- Start Content-->
|
|
<div class="container-fluid">
|
|
|
|
<!-- start page title -->
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="page-title-box">
|
|
<h4 class="page-title">Campaign Dashboard</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" dir="ltr">
|
|
<div id="cardCollpase4" class="collapse pt-3 show">
|
|
<div class="table-responsive">
|
|
@if(isset($user))
|
|
<table class="table table-centered table-nowrap table-borderless mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>Metric</th>
|
|
<th>Unit</th>
|
|
<th>Points</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($metrics as $metric)
|
|
<tr>
|
|
<td>{{$metric->name}}</td>
|
|
<td>{{ isset($user->metrics->{$metric->id}) ? $user->metrics->{$metric->id} : '-' }}</td>
|
|
<td>{{ isset($user->metric_points->{$metric->id}) ? $user->metric_points->{$metric->id} : '-' }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
@endif
|
|
</div> <!-- .table-responsive -->
|
|
</div> <!-- end collapse-->
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div> <!-- end card -->
|
|
</div> <!-- end col-->
|
|
</div>
|
|
<!-- end row -->
|
|
|
|
</div> <!-- container -->
|
|
<style type="text/css">
|
|
#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>
|
|
@endsection
|
|
|
|
@section('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($){
|
|
$('#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>
|
|
|
|
|
|
@endsection |