first commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<!-- Recent Members -->
|
||||
|
||||
<div class="panel panel-flat" style="background-color: #ffffff; height: 380px;">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Farm records generated daily - last 10 days [SG]</h6>
|
||||
|
||||
</div>
|
||||
<?= $records_generated_daily_SG ?>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="panel panel-flat" style="background-color: #ffffff; height: 380px;">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Farm records generated daily - last 10 days [US]</h6>
|
||||
|
||||
</div>
|
||||
<?= $records_generated_daily_US ?>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,151 @@
|
||||
<div class="block rad-0">
|
||||
<h2>Cards clicked report</h2>
|
||||
</div>
|
||||
<div class="block">
|
||||
<form method="get" action="/bkoreport/cards_clicked_report" onsubmit="return fnSubmitFormReport();">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-3 text-right">
|
||||
<?= $card_category ?>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" id="date_range" name="date_range"
|
||||
value="<?= $date_range ?? '' ?>" style="width: 100%" autocomplete="off"
|
||||
placeholder="Select or input date range"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="btn-group">
|
||||
<!-- <input type="submit" class="btn btn-primary btn-xs" value="Filter">-->
|
||||
<input type="button" onclick="fn_export_csv();" class="btn btn-info btn-xs" value="Export CSV">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
<div class="table-responsive">
|
||||
<table id="tblReport" class="table table-striped table-hover table-bordered table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Card id</th>
|
||||
<th>Count of cards</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.block {
|
||||
background-color: #FFF;
|
||||
padding: 10px;
|
||||
box-shadow: rgba(57, 70, 78, 0.15) 0px 0px 1px 0px;
|
||||
}
|
||||
|
||||
.rad-0 {
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
|
||||
.block:nth-child(1) h2 {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.block:nth-child(1) {
|
||||
padding: 2px 10px;
|
||||
}
|
||||
|
||||
.block:nth-child(2) {
|
||||
margin-top: 5px;
|
||||
padding: 20px 10px 0px 10px;
|
||||
}
|
||||
|
||||
.block:nth-child(3) {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.pt-6 {
|
||||
padding-top: 6px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
const $date_range = $('input[name="date_range"]');
|
||||
$date_range.daterangepicker({
|
||||
opens: 'right',
|
||||
autoUpdateInput: false,
|
||||
locale: {
|
||||
cancelLabel: 'Clear'
|
||||
},
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'Last 60 Days': [moment().subtract(59, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
|
||||
'Two months ago': [moment().subtract(2, 'month').startOf('month'), moment().subtract(2, 'month').endOf('month')]
|
||||
},
|
||||
alwaysShowCalendars: true
|
||||
});
|
||||
$date_range.on('apply.daterangepicker', function (ev, picker) {
|
||||
$(this).val(picker.startDate.format('MM/DD/YYYY') + ' - ' + picker.endDate.format('MM/DD/YYYY'));
|
||||
fnSubmitFormReport();
|
||||
});
|
||||
|
||||
$date_range.on('cancel.daterangepicker', function (ev, picker) {
|
||||
$(this).val('');
|
||||
});
|
||||
|
||||
$('select[name="card_category"]').change(function(){
|
||||
fnSubmitFormReport();
|
||||
});
|
||||
window.tblReport = null;
|
||||
window.date_range_value = '';
|
||||
$(function () {
|
||||
window.tblReport = $('#tblReport').DataTable({
|
||||
"responsive": true,
|
||||
"processing":true,
|
||||
"serverSide":true,
|
||||
'ajax': {
|
||||
'url': '/bkoreport/cards_clicked_report_datatables',
|
||||
"type": "POST",
|
||||
"data": {
|
||||
"date_range": function() { return window.date_range_value },
|
||||
"card_category": function() { return $('select[name="card_category"]').val() }
|
||||
}
|
||||
},
|
||||
"order": [[0, "asc"]],
|
||||
"columnDefs": [
|
||||
{"orderable": true, "targets": [0,1, 2]},
|
||||
{"orderable": false, "targets": []}
|
||||
],
|
||||
"pageLength": 25,
|
||||
"lengthMenu": [10, 25, 50, 100, 200, 500, 1000],
|
||||
'columns': [
|
||||
{data: 'title'},
|
||||
{data: 'card_id'},
|
||||
{data: 'cards_total'}
|
||||
],
|
||||
'language': {
|
||||
'loadingRecords': ' ',
|
||||
'processing': 'Loading...'
|
||||
}
|
||||
});
|
||||
});
|
||||
//filter clicked
|
||||
function fnSubmitFormReport(){
|
||||
window.date_range_value = $("#date_range").val();
|
||||
window.tblReport.ajax.reload(false);
|
||||
return false;
|
||||
}
|
||||
function fn_export_csv(){
|
||||
window.location.assign("/bkoreport/cards_clicked_report_export_csv");
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,110 @@
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-4">
|
||||
<!-- Recent Members -->
|
||||
<div class="panel panel-flat" style="background-color:#CEE0D7;">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Platforms</h6>
|
||||
<div class="heading-elements">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="device_platforms" class="table-responsive">
|
||||
<canvas id="canvas_device_platforms_chart"></canvas>
|
||||
<?=$device_platforms?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
<!-- Recent Members -->
|
||||
<div class="panel panel-flat" style="background-color:#CEE0D7;">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Models</h6>
|
||||
<div class="heading-elements">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="device_models" class="table-responsive">
|
||||
<canvas id="canvas_device_models_chart"></canvas>
|
||||
<?=$device_models?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-lg-4">
|
||||
<!-- Recent Members -->
|
||||
<div class="panel panel-flat" style="background-color:#CEE0D7;">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Manufacturers</h6>
|
||||
<div class="heading-elements">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="device_manufacturers" class="table-responsive">
|
||||
<canvas id="canvas_device_manufacturers_chart"></canvas>
|
||||
<?=$device_manufacturers?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
|
||||
$(function() {
|
||||
var ctxPlatforms = document.getElementById("canvas_device_platforms_chart");
|
||||
var platformsPieChart = new Chart(ctxPlatforms, {
|
||||
type: 'doughnut',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [<?=implode(',',$device_platforms_values)?>],
|
||||
backgroundColor: ["#0074D9", "#FF4136", "#2ECC40", "#FF851B", "#7FDBFF", "#B10DC9", "#FFDC00", "#001f3f", "#39CCCC", "#01FF70", "#85144b", "#F012BE", "#3D9970", "#111111", "#AAAAAA"]
|
||||
}],
|
||||
labels: ['<?=implode("','",$device_platforms_labels)?>']
|
||||
},
|
||||
options: {
|
||||
|
||||
}
|
||||
});
|
||||
var ctxModels = document.getElementById("canvas_device_models_chart");
|
||||
var modelsPieChart = new Chart(ctxModels, {
|
||||
type: 'doughnut',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [<?=implode(',',$device_models_values)?>],
|
||||
backgroundColor: ["#0074D9", "#FF4136", "#2ECC40", "#FF851B", "#7FDBFF", "#B10DC9", "#FFDC00", "#001f3f", "#39CCCC", "#01FF70", "#85144b", "#F012BE", "#3D9970", "#111111", "#AAAAAA"]
|
||||
}],
|
||||
labels: ['<?=implode("','",$device_models_labels)?>']
|
||||
},
|
||||
options: {
|
||||
|
||||
}
|
||||
});
|
||||
var ctxManufactures = document.getElementById("canvas_device_manufacturers_chart");
|
||||
var manufacturersPieChart = new Chart(ctxManufactures, {
|
||||
type: 'doughnut',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [<?=implode(',',$device_manufacturers_values)?>],
|
||||
backgroundColor: ["#0074D9", "#FF4136", "#2ECC40", "#FF851B", "#7FDBFF", "#B10DC9", "#FFDC00", "#001f3f", "#39CCCC", "#01FF70", "#85144b", "#F012BE", "#3D9970", "#111111", "#AAAAAA"]
|
||||
}],
|
||||
labels: ['<?=implode("','",$device_manufacturers_labels)?>']
|
||||
},
|
||||
options: {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//initMap();
|
||||
// -->
|
||||
</script>
|
||||
@@ -0,0 +1,217 @@
|
||||
<h1>Heatmap</h1>
|
||||
<br/>
|
||||
<style>
|
||||
/* Always set the map height explicitly to define the size of the div
|
||||
* element that contains the map. */
|
||||
#map {
|
||||
height: 625px;
|
||||
}
|
||||
/* Optional: Makes the sample page fill the window. */
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
#floating-panel {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: 25%;
|
||||
z-index: 5;
|
||||
background-color: #fff;
|
||||
padding: 5px;
|
||||
border: 1px solid #999;
|
||||
text-align: center;
|
||||
font-family: 'Roboto','sans-serif';
|
||||
line-height: 30px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
#floating-panel {
|
||||
background-color: #fff;
|
||||
border: 1px solid #999;
|
||||
left: 25%;
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
z-index: 5;
|
||||
}
|
||||
</style>
|
||||
<div id="floating-panel">
|
||||
<button onclick="toggleHeatmap()">Toggle Heatmap</button>
|
||||
<button onclick="changeGradient()">Change gradient</button>
|
||||
<button onclick="changeRadius()">Change radius</button>
|
||||
<button onclick="changeOpacity()">Change opacity</button>
|
||||
</div>
|
||||
<div id="map"></div>
|
||||
<script>
|
||||
|
||||
// This example requires the Visualization library. Include the libraries=visualization
|
||||
// parameter when you first load the API. For example:
|
||||
// <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=visualization">
|
||||
|
||||
var map, heatmap;
|
||||
|
||||
function initMap() {
|
||||
map = new google.maps.Map(document.getElementById('map'), {
|
||||
zoom: 12,
|
||||
center: {lat: <?=$center_lat?>, lng: <?=$center_lng?>},
|
||||
mapTypeId: 'roadmap'
|
||||
});
|
||||
|
||||
heatmap = new google.maps.visualization.HeatmapLayer({
|
||||
data: getPoints(),
|
||||
map: map
|
||||
});
|
||||
|
||||
var iconBase =
|
||||
'https://developers.google.com/maps/documentation/javascript/examples/full/images/';
|
||||
var icons = {
|
||||
parking: {
|
||||
icon: iconBase + 'parking_lot_maps.png'
|
||||
},
|
||||
library: {
|
||||
icon: iconBase + 'library_maps.png'
|
||||
},
|
||||
info: {
|
||||
icon: iconBase + 'info-i_maps.png'
|
||||
}
|
||||
};
|
||||
var icon = {
|
||||
url: '/assets/images/pin-673-443159.png',
|
||||
size: new google.maps.Size(30, 40),
|
||||
scaledSize: new google.maps.Size(30, 40)
|
||||
};
|
||||
var features = []; //getParkings();
|
||||
// Create markers.
|
||||
for (var i = 0; i < features.length; i++) {
|
||||
var marker = new google.maps.Marker({
|
||||
position: features[i].position,
|
||||
icon: icon, /*icons['parking'].icon,*/ /*features[i].type].icon,*/
|
||||
title: features[i].provider + '\r\n' + features[i].name + '\r\n' + features[i].description,
|
||||
map: map
|
||||
});
|
||||
};
|
||||
var toplocations = getTopLocations();
|
||||
for (var i = 0; i <toplocations.length; i++) {
|
||||
var marker = new google.maps.Marker({
|
||||
position: toplocations[i].position,
|
||||
icon: icons['library'].icon, /*features[i].type].icon,*/
|
||||
title: 'Total ' + toplocations[i].count,
|
||||
map: map
|
||||
});
|
||||
}
|
||||
customSettings();
|
||||
}
|
||||
|
||||
function toggleHeatmap() {
|
||||
heatmap.setMap(heatmap.getMap() ? null : map);
|
||||
}
|
||||
|
||||
function changeGradient() {
|
||||
var gradient = [
|
||||
'rgba(0, 255, 255, 0)',
|
||||
'rgba(0, 255, 255, 1)',
|
||||
'rgba(0, 191, 255, 1)',
|
||||
'rgba(0, 127, 255, 1)',
|
||||
'rgba(0, 63, 255, 1)',
|
||||
'rgba(0, 0, 255, 1)',
|
||||
'rgba(0, 0, 223, 1)',
|
||||
'rgba(0, 0, 191, 1)',
|
||||
'rgba(0, 0, 159, 1)',
|
||||
'rgba(0, 0, 127, 1)',
|
||||
'rgba(63, 0, 91, 1)',
|
||||
'rgba(127, 0, 63, 1)',
|
||||
'rgba(191, 0, 31, 1)',
|
||||
'rgba(255, 0, 0, 1)'
|
||||
]
|
||||
heatmap.set('gradient', heatmap.get('gradient') ? null : gradient);
|
||||
}
|
||||
|
||||
function changeRadius() {
|
||||
heatmap.set('radius', heatmap.get('radius') ? null : 50);
|
||||
}
|
||||
|
||||
function changeOpacity() {
|
||||
heatmap.set('opacity', heatmap.get('opacity') ? null : 0.2);
|
||||
}
|
||||
|
||||
// Heatmap data: 500 Points
|
||||
function getPoints() {
|
||||
return [
|
||||
<?
|
||||
foreach ($top_locations as $f) {
|
||||
if ($f["total"]>1) {
|
||||
for ($i=0;$i<$f["total"];$i++) {
|
||||
echo "new google.maps.LatLng(".$f["lat"].",".$f["lng"]."),\n";
|
||||
}
|
||||
} else {
|
||||
echo "new google.maps.LatLng(".$f["lat"].",".$f["lng"]."),\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
];
|
||||
}
|
||||
|
||||
function getTopLocations() {
|
||||
return [
|
||||
<? $i=0; foreach ($top_locations as $f) { ?>
|
||||
{position: new google.maps.LatLng(<?=$f["lat"].",".$f["lng"]?>), count: <?=$f["total"]?>},
|
||||
<? $i++; if ($i>10) break; } ?>
|
||||
];
|
||||
}
|
||||
function getParkings() {
|
||||
return [<?
|
||||
$handle = fopen("application/models/parking.txt", "r");
|
||||
while (($line = fgets($handle)) !== false) {
|
||||
echo "{position: new google.maps.LatLng(".trim(str_replace('position: {lat:','',str_replace('lng:','',str_replace('},','',$line))))."),";
|
||||
echo " provider: \"\", name: \"\", description: \"\"},\n";
|
||||
}
|
||||
fclose($handle);?>];
|
||||
}
|
||||
</script>
|
||||
Showing <?php echo count($top_locations); ?> result(s)
|
||||
<script async defer
|
||||
src="https://maps.googleapis.com/maps/api/js?key=<?=$googleKey?>&libraries=visualization&callback=initMap">
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// $(function() {
|
||||
// Handler for .ready() called.
|
||||
function customSettings() {
|
||||
heatmap.set('radius', 30);
|
||||
var gradient = [
|
||||
'rgba(0, 255, 255, 0)',
|
||||
'rgba(0, 255, 255, 1)',
|
||||
'rgba(0, 191, 255, 1)',
|
||||
'rgba(0, 127, 255, 1)',
|
||||
'rgba(0, 63, 255, 1)',
|
||||
'rgba(0, 0, 255, 1)',
|
||||
'rgba(0, 0, 223, 1)',
|
||||
'rgba(0, 0, 191, 1)',
|
||||
'rgba(0, 0, 159, 1)',
|
||||
'rgba(0, 0, 127, 1)',
|
||||
'rgba(63, 0, 91, 1)',
|
||||
'rgba(127, 0, 63, 1)',
|
||||
'rgba(191, 0, 31, 1)',
|
||||
'rgba(255, 0, 0, 1)'
|
||||
]
|
||||
heatmap.set('gradient', gradient);
|
||||
}
|
||||
//});
|
||||
/*
|
||||
<button onclick="toggleHeatmap()">Toggle Heatmap</button>
|
||||
<button onclick="changeGradient()">Change gradient</button>
|
||||
<button onclick="changeRadius()">Change radius</button>
|
||||
<button onclick="changeOpacity()">Change opacity</button>
|
||||
*/
|
||||
</script>
|
||||
<h1>Top locations</h1>
|
||||
<table>
|
||||
<tr><th>Total</th><th>Latitude</th><th>Longitude</th></tr>
|
||||
<? foreach ($top_locations as $f) { ?>
|
||||
<tr align=right>
|
||||
<td><?=$f["total"]?></td>
|
||||
<td><?=$f["lat"]?></td>
|
||||
<td><?=$f["lng"]?></td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
</table>
|
||||
@@ -0,0 +1,173 @@
|
||||
<style>
|
||||
#vendor_cost{
|
||||
padding: 4px;
|
||||
}
|
||||
#vendor_cost h3{
|
||||
font-size: 16px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
#vendor_cost h4{
|
||||
font-size: 14px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
#vendor_cost .pad{
|
||||
padding: 10px;
|
||||
}
|
||||
#vendor_cost .panel{
|
||||
border: none;
|
||||
}
|
||||
a.selected{
|
||||
background-color: yellow;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
<div>
|
||||
<form method="GET" action="/bkoreport/surgereport">
|
||||
<div class="row">
|
||||
<div class="col-xs-4 col-md-3">
|
||||
<label for="">Travel date</label>
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
name="travel_date"
|
||||
value="<?= set_value('travel_date', date('Y-m-d', strtotime('-30 days')).' - '.date('Y-m-d')) ?>"
|
||||
readonly>
|
||||
</div>
|
||||
<div class="col-xs-4 col-md-3">
|
||||
<label for="">Duration from</label>
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
name="duration_from"
|
||||
value="<?= set_value('duration_from') ?>" >
|
||||
<div class="invalid-feedback text-danger">
|
||||
<?php echo form_error('duration_from') ? form_error('duration_from') : '' ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4 col-md-3">
|
||||
<label for="">Duration to</label>
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
name="duration_to"
|
||||
value="<?= set_value('duration_to') ?>">
|
||||
<div class="invalid-feedback text-danger">
|
||||
<?php echo form_error('duration_to') ? form_error('duration_to') : '' ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4 col-md-3">
|
||||
<label for="">Distance from</label>
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
name="distance_from"
|
||||
value="<?= set_value('distance_from') ?>">
|
||||
<div class="invalid-feedback text-danger">
|
||||
<?php echo form_error('distance_from') ? form_error('distance_from') : '' ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4 col-md-3">
|
||||
<label for="">Distance to</label>
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
name="distance_to"
|
||||
value="<?= set_value('distance_to') ?>">
|
||||
<div class="invalid-feedback text-danger">
|
||||
<?php echo form_error('distance_to') ? form_error('distance_to') : '' ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4 col-md-3">
|
||||
<label for="">Cost from</label>
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
name="cost_from"
|
||||
value="<?= set_value('cost_from') ?>">
|
||||
<div class="invalid-feedback text-danger">
|
||||
<?php echo form_error('cost_from') ? form_error('cost_from') : '' ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4 col-md-3">
|
||||
<label for="">Cost to</label>
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
name="cost_to"
|
||||
value="<?= set_value('cost_to') ?>">
|
||||
<div class="invalid-feedback text-danger">
|
||||
<?php echo form_error('cost_to') ? form_error('cost_to') : '' ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4 col-md-3">
|
||||
<label for="">Email (comma separated)</label>
|
||||
<textarea
|
||||
class="form-control"
|
||||
placeholder="Multiple values field (comma separated)"
|
||||
rows="4"
|
||||
name="email"><?= set_value('email') ?></textarea>
|
||||
<div class="invalid-feedback text-danger">
|
||||
<?php echo form_error('email') ? form_error('email') : '' ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" m-y-sm">
|
||||
<button type="submit" class="btn btn-primary btn-sm">Search</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="m-y-sm"><?= $pagination_link ?: '' ?></div>
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
<div class="panel panel-flat" style="background-color:#CEE0D7;">
|
||||
<div id="vendor_count" class="table-responsive">
|
||||
<?=$report_parsedemail?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="m-y-sm"><?= $pagination_link ?: '' ?></div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2">
|
||||
<div class="panel panel-flat">
|
||||
<div id="vendor_cost" class="table-responsive">
|
||||
<div class="pad">...</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$( document ).ready(function() {
|
||||
/** date range picker */
|
||||
let datepickerOptions = {
|
||||
autoUpdateInput: false,
|
||||
locale: {
|
||||
format: 'YYYY-MM-DD',
|
||||
cancelLabel: 'Clear'
|
||||
}
|
||||
};
|
||||
|
||||
let travelDateEl = $('input[name="travel_date"]');
|
||||
const travelDateVal = travelDateEl.val();
|
||||
if (travelDateVal == '') {
|
||||
datepickerOptions.startDate = moment().subtract(30, 'days').format('YYYY-MM-DD');
|
||||
datepickerOptions.endDate = moment().format('YYYY-MM-DD');
|
||||
}
|
||||
travelDateEl.daterangepicker(datepickerOptions);
|
||||
|
||||
travelDateEl.on('apply.daterangepicker', function(ev, picker) {
|
||||
$(this).val(picker.startDate.format('YYYY-MM-DD') + ' - ' + picker.endDate.format('YYYY-MM-DD'));
|
||||
});
|
||||
|
||||
travelDateEl.on('cancel.daterangepicker', function(ev, picker) {
|
||||
travelDateEl.val('');
|
||||
});
|
||||
});
|
||||
const $vendor_cost = $('#vendor_cost');
|
||||
function showTripInsights(member_id, trackedemail_item_id, that){
|
||||
$('.showTripInsights').removeClass('selected');
|
||||
$(that).addClass('selected');
|
||||
$vendor_cost.html('<div class="pad">Insights Loading...</div>');
|
||||
$.get(`/bkoreport/tripinsights?member_id=${member_id}&id=${trackedemail_item_id}`, function(data){
|
||||
//console.log(member_id, trackedemail_item_id, data);
|
||||
$vendor_cost.html(data);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-7">
|
||||
<!-- Recent Members -->
|
||||
|
||||
<div class="panel panel-flat" style="background-color:#CEE0D7;">
|
||||
<form method="post" action="?" autocomplete="off">
|
||||
<fieldset>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Last Run: </td>
|
||||
<td><input type="text" class="form-control" style="width:100px;" id="from_last_run" name="from_last_run" value="<?= isset($oauth2_pulls_params['from_last_run']) ? $oauth2_pulls_params['from_last_run'] : '' ?>"></td>
|
||||
<td> - </td>
|
||||
<td><input type="text" class="form-control" style="width:100px;" id="to_last_run" name="to_last_run" value="<?= isset($oauth2_pulls_params['to_last_run']) ? $oauth2_pulls_params['to_last_run'] : '' ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Elapsed: </td>
|
||||
<td><input type="text" class="form-control" style="width:100px;" id="from_elapsed" name="from_elapsed" value="<?= isset($oauth2_pulls_params['from_elapsed']) ? $oauth2_pulls_params['from_elapsed'] : '' ?>"></td>
|
||||
<td> - </td>
|
||||
<td><input type="text" class="form-control" style="width:100px;" id="to_elapsed" name="to_elapsed" value="<?= isset($oauth2_pulls_params['to_elapsed']) ? $oauth2_pulls_params['to_elapsed'] : '' ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Oauth2 Token ID: </td>
|
||||
<td><input type="text" class="form-control" style="width:100px;" id="oauth2_token_id" name="oauth2_token_id" value="<?= isset($oauth2_pulls_params['oauth2_token_id']) ? $oauth2_pulls_params['oauth2_token_id'] : '' ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Member ID: </td>
|
||||
<td><input type="text" class="form-control" style="width:100px;" id="member_id" name="member_id" value="<?= isset($oauth2_pulls_params['member_id']) ? $oauth2_pulls_params['member_id'] : '' ?>"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div>
|
||||
<label for="email" style="margin-right: 6rem;">Email:</label>
|
||||
<input type="text" class="form-control" style="width:217px; display: inline-block" id="email" name="email" value="<?= isset($oauth2_pulls_params['email']) ? $oauth2_pulls_params['email'] : '' ?>">
|
||||
</div>
|
||||
<input type="submit" name="filter" value="Filter" />
|
||||
</fieldset>
|
||||
</form>
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">OAuth2 pulls Gmail</h6>
|
||||
<div class="heading-elements">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="oauth2_pulls" class="table-responsive">
|
||||
<?= $oauth2_pulls_links ?>
|
||||
<?= $oauth2_pulls ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
|
||||
<?php if ($member_id > 0) { ?>
|
||||
<div class="col-lg-5">
|
||||
<!-- Recent Members -->
|
||||
<div class="panel panel-flat" style="background-color:#CEE0D7;">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">OAuth2 threads (latest) for <?= $member["member"] ?></h6>
|
||||
<div class="heading-elements">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="oauth2_threads" class="table-responsive">
|
||||
<div align="center">
|
||||
<h1>Duration</h1>
|
||||
</div>
|
||||
<canvas id="canvas_oauth2_threads_duration_chart"></canvas>
|
||||
<div align="center">
|
||||
<h1>Count</h1>
|
||||
</div>
|
||||
<canvas id="canvas_oauth2_threads_count_chart"></canvas>
|
||||
<?= $oauth2_threads ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/assets/js/plugins/pickers/datepicker.js"></script>
|
||||
<script type="text/javascript">
|
||||
function viewStats(member_id) {
|
||||
if (member_id != null && member_id > 0) {
|
||||
document.location = '/member/viewLocateMember?member_id=' + member_id;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function viewPulls(member_id, oauth2_token_id) {
|
||||
if (member_id != null && member_id > 0 && oauth2_token_id != null && oauth2_token_id > 0) {
|
||||
document.location = '?member_id=' + member_id + '&oauth2_token_id=' + oauth2_token_id;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('input[name="filter"]').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$(this).closest('form').attr('action', '/bkoreport/oauth2pulls/0').submit();
|
||||
})
|
||||
|
||||
// Datepicker
|
||||
$("input[name='from_last_run']").datepicker({
|
||||
defaultDate: "+1w",
|
||||
changeMonth: true,
|
||||
numberOfMonths: 3,
|
||||
format: "yyyy-mm-dd",
|
||||
onClose: function(selectedDate) {
|
||||
$("#from_last_run").datepicker("option", "minDate", selectedDate);
|
||||
}
|
||||
});
|
||||
|
||||
$("input[name='to_last_run']").datepicker({
|
||||
defaultDate: "+1w",
|
||||
changeMonth: true,
|
||||
numberOfMonths: 3,
|
||||
format: "yyyy-mm-dd",
|
||||
onClose: function(selectedDate) {
|
||||
$("input[name='to_last_run']").datepicker("option", "minDate", selectedDate);
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var ctxDuration = document.getElementById("canvas_oauth2_threads_duration_chart");
|
||||
var durationPieChart = new Chart(ctxDuration, {
|
||||
type: 'doughnut',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [<?= isset($oauth2_threads_duration_values)
|
||||
? implode(',', $oauth2_threads_duration_values)
|
||||
: "" ?>],
|
||||
backgroundColor: ["#0074D9", "#FF4136", "#2ECC40", "#FF851B", "#7FDBFF", "#B10DC9", "#FFDC00", "#001f3f", "#39CCCC", "#01FF70", "#85144b", "#F012BE", "#3D9970", "#111111", "#AAAAAA"]
|
||||
}],
|
||||
labels: ['<?= implode("','", $oauth2_threads_duration_labels) ?>']
|
||||
},
|
||||
options: {
|
||||
|
||||
}
|
||||
});
|
||||
var ctxCount = document.getElementById("canvas_oauth2_threads_count_chart");
|
||||
var countPieChart = new Chart(ctxCount, {
|
||||
type: 'doughnut',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [<?= implode(',', $oauth2_threads_count_values) ?>],
|
||||
backgroundColor: ["#0074D9", "#FF4136", "#2ECC40", "#FF851B", "#7FDBFF", "#B10DC9", "#FFDC00", "#001f3f", "#39CCCC", "#01FF70", "#85144b", "#F012BE", "#3D9970", "#111111", "#AAAAAA"]
|
||||
}],
|
||||
labels: ['<?= implode("','", $oauth2_threads_count_labels) ?>']
|
||||
},
|
||||
options: {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//initMap();
|
||||
// -->
|
||||
</script>
|
||||
@@ -0,0 +1,520 @@
|
||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
|
||||
<link rel="stylesheet" href="/assets/css/query-builder.default.min.css">
|
||||
<div id="overlay" style="display:none;">
|
||||
<div class="spinner"></div>
|
||||
<br />
|
||||
Importing...
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-11">
|
||||
<div class="panel panel-flat">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Get Quote</h6>
|
||||
<div class="heading-elements">
|
||||
<a href="/bkoreport/quote">Recent</a>
|
||||
| <a href="/bkoreport/quotes">Aggregate</a>
|
||||
| <a href="/bkoreport/totalquotes">Total</a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="getquote" class="table-responsive" style="background-color:#CEE0D7;">
|
||||
<div style="margin-left:20px;width:800px;">
|
||||
<span style="color:red"><b><?=isset($message) ? $message : '' ?></b></span>
|
||||
<form method="get" action="/bkoreport/quote" id="search-form">
|
||||
<input type="hidden" name="from" id="from" value="<?= isset($from) ? $from : '' ?>">
|
||||
<input type="hidden" name="to" id="to" value="<?= isset($to) ? $to : '' ?>">
|
||||
<fieldset>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<th style="text-align:right;">Origin:</th>
|
||||
<td><input type="text" class="form-control" name="address_from" id="autofrom" value="<?= isset($address_from) ? $address_from : '' ?>" size="20"></td>
|
||||
<th style="text-align:right;">Country:</th>
|
||||
<td><?= $card_country ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="text-align:right;">Destination:</th>
|
||||
<td><input type="text" class="form-control" name="address_to" id="autoto" value="<?= isset($address_to) ? $address_to : '' ?>" size="20"></td>
|
||||
<th style="text-align:right;">Provider:</th>
|
||||
<td><?= $card_transport_provider ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="text-align:right;">Quote Source: </th>
|
||||
<td><?= $card_prefill ?></td>
|
||||
<td colspan="2" style="text-align:right;">
|
||||
<input type="button" name="quote" data-action="quote" value="Quote" />
|
||||
<input type="button" name="filter" data-action="quote" value="Filter" />
|
||||
<input type="button" name="export" data-action="exportCSV" value="Export" /></td>
|
||||
</tr>
|
||||
<tr></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<input type="hidden" id="sql_raw" name="sql_raw" value="<?= isset($sql_raw) ? $sql_raw : '' ?>">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="query-builder">
|
||||
<div id="builder"></div>
|
||||
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary parse-sql" data-target="import_export" data-stmt="false" id="btn-parse-sql">
|
||||
Apply
|
||||
</button>
|
||||
<button class="btn btn-warning reset" id="btn-reset" data-target="basic">Reset</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="container">
|
||||
<div class="import-group">
|
||||
<form id="form-upload">
|
||||
<div class="member">
|
||||
<label>Member ID</label>
|
||||
<input type="text" class="form-control" name="member_id" maxlength=10>
|
||||
</div>
|
||||
<div class="file-upload">
|
||||
<span id="pickfiles">[Choose files]</span>
|
||||
<input type="button" id="btn-upload" class="btn btn-warning btn-sm" value="Upload">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id="filelist"></div>
|
||||
<div id="import-message"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<!-- Recent Members -->
|
||||
<div class="panel panel-flat" style="background-color:#CEE0D7;">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Recent Quotes</h6>
|
||||
<div class="heading-elements">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?= $link ?>
|
||||
<div id="quotes" class="table-responsive">
|
||||
<?= $quotes_table ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function checkQuote(id, btn) {
|
||||
if (id > 0) {
|
||||
//document.location = '/bkoreport/checkQuote?id='+id;
|
||||
btn.disabled = true;
|
||||
$.ajax({
|
||||
url: "/bkoreport/checkQuote?id=" + id
|
||||
}).done(function(data) {
|
||||
btn.disabled = false;
|
||||
$('#check' + id).html(data);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- jQuery UI -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
|
||||
<script type='text/javascript'>
|
||||
$(document).ready(function() {
|
||||
console.log('aaaa');
|
||||
// Initialize
|
||||
$("#autofrom").autocomplete({
|
||||
source: function(request, response) {
|
||||
console.log('bbbb');
|
||||
// Fetch data
|
||||
$.ajax({
|
||||
url: "/bkoreport/addresssearch",
|
||||
type: 'post',
|
||||
dataType: "json",
|
||||
data: {
|
||||
search: request.term
|
||||
},
|
||||
success: function(data) {
|
||||
response(data);
|
||||
},
|
||||
error: function(data) {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
select: function(event, ui) {
|
||||
// Set selection
|
||||
$('#autofrom').val(ui.item.label); // display the selected text
|
||||
$('#from').val(ui.item.value); // save selected id to input
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$("#autoto").autocomplete({
|
||||
source: function(request, response) {
|
||||
// Fetch data
|
||||
$.ajax({
|
||||
url: "/bkoreport/addresssearch",
|
||||
type: 'post',
|
||||
dataType: "json",
|
||||
data: {
|
||||
search: request.term
|
||||
},
|
||||
success: function(data) {
|
||||
response(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
select: function(event, ui) {
|
||||
// Set selection
|
||||
$('#autoto').val(ui.item.label); // display the selected text
|
||||
$('#to').val(ui.item.value); // save selected id to input
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<script src="/assets/js/query-builder.standalone.min.js"></script>
|
||||
<script src="/assets/js/plugins/pickers/datepicker.js"></script>
|
||||
<script src="/assets/js/app.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
let DOMCACHESTORE = {};
|
||||
DOMCACHE = {
|
||||
get: function(selector, force) {
|
||||
if (DOMCACHESTORE[selector] !== undefined && !force) {
|
||||
return DOMCACHESTORE[selector];
|
||||
}
|
||||
|
||||
DOMCACHESTORE[selector] = $(selector);
|
||||
return DOMCACHESTORE[selector];
|
||||
}
|
||||
};
|
||||
|
||||
const _filters = [
|
||||
{
|
||||
id: 'a.id',
|
||||
label: 'ID',
|
||||
type: 'integer'
|
||||
},
|
||||
{
|
||||
id: 'transport_provider_id',
|
||||
type: 'integer'
|
||||
},
|
||||
{
|
||||
id: 'automation_id',
|
||||
type: 'integer'
|
||||
},
|
||||
{
|
||||
id: 'cost_raw',
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
id: 'cost',
|
||||
type: 'double'
|
||||
},
|
||||
{
|
||||
id: 'DATE(created)',
|
||||
label: 'created',
|
||||
type: 'date',
|
||||
placeholder: '____-__-__',
|
||||
validation: {
|
||||
format: 'YYYY/MM/DD'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'DATE(completed)',
|
||||
label: 'completed',
|
||||
type: 'date',
|
||||
placeholder: '____-__-__',
|
||||
validation: {
|
||||
format: 'YYYY/MM/DD'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'member_id',
|
||||
type: 'integer'
|
||||
},
|
||||
{
|
||||
id: 'location_start_id',
|
||||
type: 'integer'
|
||||
},
|
||||
{
|
||||
id: 'location_end_id',
|
||||
type: 'integer'
|
||||
},
|
||||
{
|
||||
id: 'quote_group_id',
|
||||
type: 'integer'
|
||||
},
|
||||
{
|
||||
id: 'a.prefill',
|
||||
label: 'Data Source',
|
||||
type: 'string',
|
||||
input: 'select',
|
||||
values: {
|
||||
'f' : 'Application',
|
||||
't': 'Automatic'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'pool',
|
||||
type: 'integer'
|
||||
},
|
||||
{
|
||||
id: 'DATE(travel_date)',
|
||||
label: 'travel_date',
|
||||
type: 'date',
|
||||
placeholder: '____-__-__',
|
||||
validation: {
|
||||
format: 'YYYY/MM/DD'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
let init_builder_query = {
|
||||
filters: _filters,
|
||||
}
|
||||
|
||||
// If sql_raw is empty then clear localstorage
|
||||
if (window.getURLParameter(window.location.href, 'sql_raw') === null) {
|
||||
window.localStorage.clear();
|
||||
}
|
||||
|
||||
const rule_basics =
|
||||
JSON.parse(window.localStorage.getItem('rules'));
|
||||
|
||||
if (rule_basics) {
|
||||
init_builder_query.rules = rule_basics;
|
||||
}
|
||||
|
||||
DOMCACHE.get('#builder').queryBuilder(init_builder_query)
|
||||
|
||||
$('#btn-parse-sql').on('click', function() {
|
||||
const result = DOMCACHE.get('#builder').queryBuilder('getSQL');
|
||||
|
||||
window.localStorage.setItem(
|
||||
'rules',
|
||||
JSON.stringify(DOMCACHE.get('#builder').queryBuilder('getRules'))
|
||||
);
|
||||
|
||||
if (result.sql.length) {
|
||||
DOMCACHE
|
||||
.get('#search-form')
|
||||
.children('#sql_raw')
|
||||
.val(result.sql);
|
||||
DOMCACHE
|
||||
.get('#search-form')
|
||||
.attr('action', 'quote')
|
||||
.submit();
|
||||
}
|
||||
});
|
||||
|
||||
$('#btn-reset').on('click', function() {
|
||||
DOMCACHE.get('#builder').queryBuilder('reset');
|
||||
$('#sql_raw').val('');
|
||||
});
|
||||
|
||||
// Fix for Bootstrap Datepicker
|
||||
DOMCACHE.get('#builder').on('afterUpdateRuleValue.queryBuilder', function(e, rule) {
|
||||
const date_picker = [
|
||||
'created',
|
||||
'completed',
|
||||
'travel_date'
|
||||
]
|
||||
|
||||
if (date_picker.indexOf(rule.filter.label) !== -1) {
|
||||
addDatePicker(rule.$el.find('.rule-value-container input'));
|
||||
}
|
||||
})
|
||||
|
||||
DOMCACHE.get('#search-form').on('click', 'input[type="button"]', function() {
|
||||
const action = $(this).data('action');
|
||||
DOMCACHE.get('#search-form').attr('action', `/bkoreport/${action}`).submit();
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<!-- upload and import file -->
|
||||
<script src="/assets/js/plupload.full.min.js"></script>
|
||||
<script>
|
||||
window.addEventListener("load", function() {
|
||||
let uploader = new plupload.Uploader({
|
||||
runtimes: 'html5',
|
||||
browse_button: 'pickfiles',
|
||||
container: document.getElementById('container'),
|
||||
url: '/bkoreport/upload',
|
||||
chunk_size: '200kb',
|
||||
max_retries: 2,
|
||||
filters: {
|
||||
max_file_size: '50mb',
|
||||
mime_types: [{
|
||||
title: "CSV files",
|
||||
extensions: "csv"
|
||||
}]
|
||||
},
|
||||
init: {
|
||||
PostInit: function() {
|
||||
document.getElementById('filelist').innerHTML = '';
|
||||
},
|
||||
FilesAdded: function(up, files) {
|
||||
$("#import-message").text('');
|
||||
plupload.each(files, function(file) {
|
||||
document.getElementById('filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>';
|
||||
});
|
||||
},
|
||||
UploadProgress: function(up, file) {
|
||||
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
|
||||
},
|
||||
Error: function(up, err) {
|
||||
// DO YOUR ERROR HANDLING!
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
uploader.bind('FileUploaded', function() {
|
||||
// After file uploaded , send signal to insert all records
|
||||
removeFile();
|
||||
$('#overlay').fadeIn();
|
||||
$.ajax({
|
||||
url: '/bkoreport/importCSV',
|
||||
method: 'POST',
|
||||
dataType: 'JSON',
|
||||
data: {
|
||||
'member_id' : $('input[name="member_id"]').val()
|
||||
},
|
||||
success: function(data) {
|
||||
$("#import-message").text(data.message);
|
||||
},
|
||||
error: function(err) {
|
||||
$("#import-message").text('Something went wrong !!!');
|
||||
},
|
||||
complete: function() {
|
||||
$('#overlay').fadeOut();
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
uploader.init()
|
||||
|
||||
function removeFile() {
|
||||
$.each(uploader.files, function (i, file) {
|
||||
if (file) {
|
||||
uploader.removeFile(file);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// validate upload form
|
||||
$("#form-upload").validate({
|
||||
rules: {
|
||||
member_id: {
|
||||
required: true,
|
||||
number: true
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
member_id: {
|
||||
required: 'Please input Member ID',
|
||||
number: 'Please input number'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#btn-upload').on('click', function(e) {
|
||||
$('#import-message').text('');
|
||||
|
||||
if (uploader.files.length === 0) {
|
||||
$('#import-message').text('Please choose a file !!!');
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! uploader.files[0].size) {
|
||||
$('#import-message').text('File is empty');
|
||||
removeFile();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! $("#form-upload").valid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
uploader.start();
|
||||
})
|
||||
|
||||
});
|
||||
</script>
|
||||
<!-- upload and import file -->
|
||||
<style>
|
||||
#query-builder {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.btn-group {
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
#overlay {
|
||||
background: #ffffff;
|
||||
color: #666666;
|
||||
position: fixed;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
z-index: 5000;
|
||||
top: 0;
|
||||
left: 0;
|
||||
float: left;
|
||||
text-align: center;
|
||||
padding-top: 25%;
|
||||
opacity: .80;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
margin: 0 auto;
|
||||
height: 64px;
|
||||
width: 64px;
|
||||
animation: rotate 0.8s infinite linear;
|
||||
border: 5px solid firebrick;
|
||||
border-right-color: transparent;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
@keyframes rotate {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
#form-upload {
|
||||
justify-content: space-between;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
margin-bottom: 1rem;
|
||||
width: 33rem;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
input[name='member_id'] {
|
||||
width: 16rem;
|
||||
}
|
||||
|
||||
.file-upload {
|
||||
position: absolute;
|
||||
left: 17rem;
|
||||
top: 3.2rem;
|
||||
}
|
||||
|
||||
.import-group {
|
||||
padding: 10px;
|
||||
padding-bottom: 6px;
|
||||
border: 1px solid #dcc896;
|
||||
background: rgba(250,240,210,.5);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,124 @@
|
||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-12">
|
||||
<!-- Recent Members -->
|
||||
<div class="panel panel-flat" style="background-color:#CEE0D7;">
|
||||
|
||||
<form method="post" action="?">
|
||||
<fieldset>
|
||||
<table>
|
||||
<tr>
|
||||
<td>From</td>
|
||||
<td><input type="hidden" id="from" name="from" value="<?= $from ?>"><input type="text" name="autofrom" id="autofrom" class="form-control" style="width:400px;" value="<?= $autofrom ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>To</td>
|
||||
<td><input type="hidden" id="to" name="to" value="<?= $to ?>"><input type="text" name="autoto" id="autoto" class="form-control" style="width:400px;" value="<?= $autoto ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Origin Country</td>
|
||||
<td><?= $card_from_country ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Dest Country</td>
|
||||
<td><?= $card_to_country ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Origin Postal</td>
|
||||
<td><input type="text" class="form-control" style="width:400px;" id="from_postal" name="from_postal" value="<?= $from_postal ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Dest Postal</td>
|
||||
<td><input type="text" class="form-control" style="width:400px;" id="to_postal" name="to_postal" value="<?= $to_postal ?>"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="submit" value="Filter" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Quotes</h6>
|
||||
<div class="heading-elements">
|
||||
<a href="/bkoreport/quote">Recent</a>
|
||||
| <a href="/bkoreport/quotes">Aggregate</a>
|
||||
| <a href="/bkoreport/totalquotes">Total</a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="quotes" class="table-responsive">
|
||||
<?= $links ?>
|
||||
<?= $quotes_table ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function viewQuotes(from, to) {
|
||||
if (from > 0 && to > 0) {
|
||||
document.location = '/bkoadmin/compare?from=' + from + '&to=' + to;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
<!-- jQuery UI -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
|
||||
<script type='text/javascript'>
|
||||
$(document).ready(function() {
|
||||
console.log('aaaa');
|
||||
// Initialize
|
||||
$("#autofrom").autocomplete({
|
||||
source: function(request, response) {
|
||||
console.log('bbbb');
|
||||
// Fetch data
|
||||
$.ajax({
|
||||
url: "/bkoreport/addresssearch",
|
||||
type: 'post',
|
||||
dataType: "json",
|
||||
data: {
|
||||
search: request.term
|
||||
},
|
||||
success: function(data) {
|
||||
response(data);
|
||||
},
|
||||
error: function(data) {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
select: function(event, ui) {
|
||||
// Set selection
|
||||
$('#autofrom').val(ui.item.label); // display the selected text
|
||||
$('#from').val(ui.item.value); // save selected id to input
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$("#autoto").autocomplete({
|
||||
source: function(request, response) {
|
||||
// Fetch data
|
||||
$.ajax({
|
||||
url: "/bkoreport/addresssearch",
|
||||
type: 'post',
|
||||
dataType: "json",
|
||||
data: {
|
||||
search: request.term
|
||||
},
|
||||
success: function(data) {
|
||||
response(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
select: function(event, ui) {
|
||||
// Set selection
|
||||
$('#autoto').val(ui.item.label); // display the selected text
|
||||
$('#to').val(ui.item.value); // save selected id to input
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-7">
|
||||
<!-- Recent Members -->
|
||||
<div class="panel panel-flat" style="background-color:#CEE0D7;">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Total Quotes</h6>
|
||||
<div class="heading-elements">
|
||||
<a href="/bkoreport/quote">Recent</a>
|
||||
| <a href="/bkoreport/quotes">Aggregate</a>
|
||||
| <a href="/bkoreport/totalquotes">Total</a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="total_quotes" class="table-responsive">
|
||||
<form method="post">
|
||||
<select name="days">
|
||||
<option value="1">Past 1 day</option>
|
||||
<option value="7"<?=$days==7?" selected":""?>>Past 7 days</option>
|
||||
<option value="30"<?=$days==30?" selected":""?>>Past 30 days</option>
|
||||
<option value="60"<?=$days==60?" selected":""?>>Past 60 days</option>
|
||||
<option value="90"<?=$days==90?" selected":""?>>Past 90 days</option>
|
||||
<option value="180"<?=$days==180?" selected":""?>>Past 180 days</option>
|
||||
<option value="365"<?=$days==365?" selected":""?>>Past 365 days</option>
|
||||
</select>
|
||||
<input type="submit" name="quotes" value="Show"/>
|
||||
</form>
|
||||
<?=$total_quotes_table?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<!-- Recent Members -->
|
||||
<div class="panel panel-flat">
|
||||
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Insights</h6>
|
||||
<div class="heading-elements">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="insights" class="table-responsive">
|
||||
<?php foreach ($payload["insights"] as $insight) { ?>
|
||||
<h3><?= $insight["name"] ?></h3>
|
||||
<?php if (array_key_exists("trip", $insight) && is_array($insight["trip"]) && count($insight["trip"]) > 0) { ?>
|
||||
<h4>Trip</h4>
|
||||
<ul>
|
||||
<li><b>Date:</b> <?= $insight["trip"]["travel_date"] ?> </li>
|
||||
<li><b>From:</b> <?= $insight["trip"]["location_start_address"] ?> </li>
|
||||
<li><b>To:</b> <?= $insight["trip"]["location_end_address"] ?> </li>
|
||||
<li><b>Cost:</b> <?= $insight["trip"]["cost_raw"] ?> </li>
|
||||
<li><b>Distance:</b> <?= $insight["trip"]["distance"] ?> </li>
|
||||
<li><b>Duration:</b> <?= $insight["trip"]["duration"] ?> </li>
|
||||
<li><b>Vendor:</b> <?= $insight["trip"]["transport_provder_name"] ?> </li>
|
||||
<li><b>Category:</b> <?= $insight["trip"]["category"] ?> </li>
|
||||
<li><b>Is surge:</b> <?= $insight["trip"]["surge_price"] ?> </li>
|
||||
<li><b>Cheaper:</b> <?= $insight["trip"]["cheaper_alternative"] ?> </li>
|
||||
<li><b>Min cost:</b> <?= $insight["trip"]["min_cost"] ?></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<?php } ?>
|
||||
<h3>Alternatives</h3>
|
||||
<?php if (array_key_exists("alternatives", $insight) && is_array($insight["alternatives"]) && count($insight["alternatives"]) > 0) { ?>
|
||||
<?php foreach ($insight["alternatives"] as $alternative) { ?>
|
||||
<hr size=-1 color="black">
|
||||
<ul>
|
||||
<li><b>Date:</b> <?= $alternative["travel_date"] ?> </li>
|
||||
<li><b>From:</b> <?= $alternative["location_start_address"] ?> </li>
|
||||
<li><b>To:</b> <?= $alternative["location_end_address"] ?> </li>
|
||||
<li><b>Cost:</b> <?= $alternative["cost_raw"] ?> </li>
|
||||
<li><b>Distance:</b> <?= $alternative["distance"] ?> </li>
|
||||
<li><b>Duration:</b> <?= $alternative["duration"] ?> </li>
|
||||
<li><b>Vendor:</b> <?= $alternative["transport_provder_name"] ?> </li>
|
||||
<li><b>Category:</b> <?= $alternative["category"] ?> </li>
|
||||
</ul>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<div class="pad">No alternatives found at the moment.</div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-4">
|
||||
<!-- Recent Members -->
|
||||
<div class="panel panel-flat" style="background-color:#CEE0D7;">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Count by Vendor</h6>
|
||||
<div class="heading-elements">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="vendor_count" class="table-responsive">
|
||||
<canvas id="canvas_vendor_count_chart"></canvas>
|
||||
<?=$vendor_count?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
<!-- Recent Members -->
|
||||
<div class="panel panel-flat" style="background-color:#CEE0D7;">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Cost by Vendor</h6>
|
||||
<div class="heading-elements">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="vendor_cost" class="table-responsive">
|
||||
<canvas id="canvas_vendor_cost_chart"></canvas>
|
||||
<?=$vendor_cost?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-lg-4">
|
||||
<!-- Recent Members -->
|
||||
<div class="panel panel-flat" style="background-color:#CEE0D7;">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Members by Vendor</h6>
|
||||
<div class="heading-elements">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="vendor_members" class="table-responsive">
|
||||
<canvas id="canvas_vendor_members_chart"></canvas>
|
||||
<?=$vendor_members?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
|
||||
$(function() {
|
||||
var ctxCount = document.getElementById("canvas_vendor_count_chart");
|
||||
var countPieChart = new Chart(ctxCount, {
|
||||
type: 'doughnut',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [<?=implode(',',$vendor_count_values)?>],
|
||||
backgroundColor: ["#0074D9", "#FF4136", "#2ECC40", "#FF851B", "#7FDBFF", "#B10DC9", "#FFDC00", "#001f3f", "#39CCCC", "#01FF70", "#85144b", "#F012BE", "#3D9970", "#111111", "#AAAAAA"]
|
||||
}],
|
||||
labels: ['<?=implode("','",$vendor_count_labels)?>']
|
||||
},
|
||||
options: {
|
||||
|
||||
}
|
||||
});
|
||||
var ctxCost = document.getElementById("canvas_vendor_cost_chart");
|
||||
var costPieChart = new Chart(ctxCost, {
|
||||
type: 'doughnut',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [<?=implode(',',$vendor_cost_values)?>],
|
||||
backgroundColor: ["#0074D9", "#FF4136", "#2ECC40", "#FF851B", "#7FDBFF", "#B10DC9", "#FFDC00", "#001f3f", "#39CCCC", "#01FF70", "#85144b", "#F012BE", "#3D9970", "#111111", "#AAAAAA"]
|
||||
}],
|
||||
labels: ['<?=implode("','",$vendor_cost_labels)?>']
|
||||
},
|
||||
options: {
|
||||
|
||||
}
|
||||
});
|
||||
var ctxMembers = document.getElementById("canvas_vendor_members_chart");
|
||||
var memebersPieChart = new Chart(ctxMembers, {
|
||||
type: 'doughnut',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [<?=implode(',',$vendor_members_values)?>],
|
||||
backgroundColor: ["#0074D9", "#FF4136", "#2ECC40", "#FF851B", "#7FDBFF", "#B10DC9", "#FFDC00", "#001f3f", "#39CCCC", "#01FF70", "#85144b", "#F012BE", "#3D9970", "#111111", "#AAAAAA"]
|
||||
}],
|
||||
labels: ['<?=implode("','",$vendor_members_labels)?>']
|
||||
},
|
||||
options: {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//initMap();
|
||||
// -->
|
||||
</script>
|
||||
@@ -0,0 +1,262 @@
|
||||
<!-- include css -->
|
||||
<link href="/assets/css/reports/signup_email_report.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<?php
|
||||
$startdate = isset( $_GET['startdate'] ) ? str_replace( '-', '/', $_GET['startdate'] ) : null;
|
||||
$enddate = isset( $_GET['enddate'] ) ? str_replace( '-', '/', $_GET['enddate'] ) : null;
|
||||
?>
|
||||
<div class="wrap-form-date-range-filter" style="max-width: 400px; margin-bottom: 20px;">
|
||||
<form name="range-date-filter" method="GET" action="/bkoreport/signup_email_report">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
|
||||
<input type="text" class="form-control inp-filter-date" placeholder="Search" value="<?php if ( $startdate and $enddate ) echo $startdate . ' - ' . $enddate; ?>">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" type="submit">
|
||||
<i class="glyphicon glyphicon-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-2">
|
||||
<div class="panel panel-flat" style="background-color:#CEE0D7;">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Signup Email Report</h6>
|
||||
<div class="heading-elements"></div>
|
||||
</div>
|
||||
<table class="table table-striped table-hover table-bordered table-condensed" style="font-size:10px;">
|
||||
<thead class="bg-indigo">
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Count</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if ( $signup_emails ): ?>
|
||||
<?php foreach ( $signup_emails as $item ): ?>
|
||||
<?php
|
||||
// $email = call_user_func_array( 'array_merge', $item['email'] );
|
||||
// $count = count( $email );
|
||||
// $content = implode( "<br/>", $email );
|
||||
// array_push( $counts, $count );
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $item['day']; ?></td>
|
||||
<td><a href="#" type="button" class="btn explode" data-toggle="modal" data-date="<?php echo $item['day']; ?>"><?php echo $item['count']; ?></a></td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
<?php endif ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-10">
|
||||
<canvas id="signup-emails-charts"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Popup - list emails detail -->
|
||||
<div class="modal fade" id="explode" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document" style="width: 80%;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Email Details</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div id="pagination" style="margin-left: 20px; margin-top: 20px;"></div>
|
||||
<div class="modal-body" id="table-content"></div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ( $signup_emails ): ?>
|
||||
<?php
|
||||
$labels = array_map( function( $e ) {return "'$e'"; }, array_column( $signup_emails, 'day') );
|
||||
$counts = array_map( function( $e ) {return "'$e'"; }, array_column( $signup_emails, 'count') );
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
(function( $ ) {
|
||||
$(function() {
|
||||
var buildchart = {
|
||||
targ: document.getElementById('signup-emails-charts'),
|
||||
init: function() {
|
||||
if ( !this.targ ) return;
|
||||
this.build();
|
||||
},
|
||||
build: function() {
|
||||
var ctx = this.targ.getContext('2d');
|
||||
var chart = new Chart(ctx, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: [<?php echo implode( ', ', $labels ); ?>],
|
||||
datasets: [{
|
||||
data: [<?php echo implode( ', ', $counts ); ?>],
|
||||
backgroundColor: '#d6ebfb',
|
||||
borderWidth: 1,
|
||||
}],
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
plugins: { labels: { render: 'value' } },
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
beginAtZero: true,
|
||||
userCallback: function( label, index, labels ) {
|
||||
if ( Math.floor(label) === label ) {
|
||||
return label;
|
||||
}
|
||||
}
|
||||
},
|
||||
}]
|
||||
},
|
||||
title: {
|
||||
display: true,
|
||||
fontSize: 18,
|
||||
padding: 20,
|
||||
text: 'Signup Email Report <?php echo ( $startdate and $enddate ) ? 'from ' . $startdate . ' - to ' . $enddate : 'in last month'; ?>'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
buildchart.init();
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
<?php endif ?>
|
||||
<script type="text/javascript">
|
||||
(function( $ ) {
|
||||
$(function() {
|
||||
var daterange = {
|
||||
targ: $('.inp-filter-date'),
|
||||
form: $('form[name="range-date-filter"]'),
|
||||
init: function() {
|
||||
if ( !this.targ ) return;
|
||||
this.rangeDateInputInit();
|
||||
// submit date range filter
|
||||
this.submitFilter();
|
||||
},
|
||||
rangeDateInputInit: function() {
|
||||
this.targ.daterangepicker({
|
||||
opens: 'right',
|
||||
autoUpdateInput: false,
|
||||
locale: {
|
||||
cancelLabel: 'Clear'
|
||||
},
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'Last 60 Days': [moment().subtract(59, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
|
||||
'Two months ago': [moment().subtract(2, 'month').startOf('month'), moment().subtract(2, 'month').endOf('month')]
|
||||
},
|
||||
alwaysShowCalendars: true
|
||||
}, function(start, end, label) {
|
||||
$('.calendar.left').find('th.month').next().addClass('next available').html('<i class="icon-arrow-right32"></i>');
|
||||
});
|
||||
|
||||
this.targ.on('apply.daterangepicker', function(ev, picker) {
|
||||
$(this).val(picker.startDate.format('MM/DD/YYYY') + ' - ' + picker.endDate.format('MM/DD/YYYY'));
|
||||
});
|
||||
|
||||
this.targ.on('cancel.daterangepicker', function(ev, picker) {
|
||||
$(this).val('');
|
||||
});
|
||||
},
|
||||
submitFilter: function() {
|
||||
this.form.on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
var _this = $(this),
|
||||
input = _this.find( daterange.targ ),
|
||||
startdate,
|
||||
enddate;
|
||||
|
||||
if ( input.val().length <= 0 ) {
|
||||
startdate = null;
|
||||
enddate = null;
|
||||
window.location.replace( '/bkoreport/signup_email_report/' );
|
||||
} else {
|
||||
var rangeDate = input.val().split('-');
|
||||
startdate = $.trim( rangeDate[0].replaceAll('/', '-') );
|
||||
enddate = $.trim( rangeDate[1].replaceAll('/', '-') );
|
||||
window.location.href = '/bkoreport/signup_email_report/?startdate=' + startdate +'&enddate='+ enddate;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
daterange.init();
|
||||
|
||||
// run popup
|
||||
$(document).on('click', '.explode', function(event) {
|
||||
var date = $(this).attr('data-date');
|
||||
$('#explode').find('.modal-body').attr( 'data-content', date );
|
||||
$('#explode').modal( {cache:false}, 'show' );
|
||||
});
|
||||
|
||||
$(document).on('shown.bs.modal', function(event) {
|
||||
var date = $('#explode').find('.modal-body').attr( 'data-content' );
|
||||
showTable( date );
|
||||
});
|
||||
|
||||
// pagination
|
||||
$(document).on('click', '#pagination>ul>li>a', function(event) {
|
||||
event.preventDefault();
|
||||
var url = $(this).attr('href');
|
||||
$.ajax({
|
||||
url: url,
|
||||
})
|
||||
.done(function( res ) {
|
||||
$('#table-content').html( res.results );
|
||||
$('#pagination').html( res.pagination.link );
|
||||
})
|
||||
.fail(function( err ) {
|
||||
console.log( err );
|
||||
})
|
||||
.always(function() {
|
||||
console.log("complete");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function showTable( date ) {
|
||||
try {
|
||||
$.ajax({
|
||||
url: '/bkoreport/signup_email_report_details/',
|
||||
type: 'GET',
|
||||
data: {
|
||||
date: date,
|
||||
},
|
||||
dataType: 'json'
|
||||
})
|
||||
.done(function( res ) {
|
||||
// create datatable
|
||||
$('#table-content').html( res.results );
|
||||
$('#pagination').html( res.pagination.link );
|
||||
})
|
||||
.fail(function( err ) {
|
||||
console.log( err );
|
||||
})
|
||||
.always(function() {
|
||||
console.log("complete");
|
||||
});
|
||||
} catch ( err ) {
|
||||
alert( err );
|
||||
}
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
Reference in New Issue
Block a user