first commit
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<div style="width:100%;">
|
||||
|
||||
<input type="hidden" id='member_id' name='member_id' value="<?= $member_id ?>" />
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2"><h3><?= $lastname ?> <?= $firstname ?> - <?=$email?></h3></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th width="50px;" scope="row">Select Points</th>
|
||||
<td><?= $points_settings ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: right;">
|
||||
<button type="button" id="accb" onclick="SendMemberPoints(<?= $member_id ?>); return true;" class="btn btn-info">Add Points</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><div id="set_detail"> </div> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<form name="memberProfile" id="memberProfile" action="#">
|
||||
|
||||
</form>
|
||||
|
||||
<h3>Points History</h3>
|
||||
<?= $points_recieved ?>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
function SendMemberPoints(member_id) {
|
||||
|
||||
var e = document.getElementById("points_settings");
|
||||
var points_settings = e.options[e.selectedIndex].value;
|
||||
|
||||
//alert(points_settings);
|
||||
|
||||
if (points_settings == "") {
|
||||
alert("Please select a points settings");
|
||||
return false;
|
||||
}
|
||||
|
||||
$('#accb').prop('disabled', true);
|
||||
$('#set_detail').html('Processing...');
|
||||
$.ajax({
|
||||
url: "/points/SendMemberPoints?point_key=" + points_settings + "&member_id=" + member_id
|
||||
}).done(function (data) {
|
||||
$('#set_detail').html(data);
|
||||
$('#accb').prop('disabled', false);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
// -->
|
||||
</script>
|
||||
@@ -0,0 +1,84 @@
|
||||
<!-- Dashboard content -->
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="panel panel-flat">
|
||||
<form method="get" action="/points/assignpoints" class="search-block">
|
||||
<div class="form-group">
|
||||
<label for="from_points">Points</label>
|
||||
<div class="search-by-date">
|
||||
<input style="width: 60px;" type="search" class="form-control" id="from_points" name="from_points" value='<?= isset($from_points) ? $from_points : '' ?>'>
|
||||
|
||||
<input style="width: 60px;" type="search" class="form-control" id="to_points" name="to_points" value='<?= isset($to_points) ? $to_points : '' ?>'>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<?= $find_select ?>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="search_text" value='<?= isset($search_text) ? $search_text : '' ?>'>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm btn-block">Refresh</button>
|
||||
</div>
|
||||
</form>
|
||||
<?= $link ?>
|
||||
<div class="table-responsive">
|
||||
<?= $points_report ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-flat">
|
||||
<div class="table-responsive"> </div>
|
||||
</div>
|
||||
<!-- /support tickets -->
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<!-- Recent Members -->
|
||||
<div class="panel panel-flat" style="background-color: #ccffff; height: 800px;">
|
||||
<div id="transp_detail">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">.</h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /dashboard content -->
|
||||
<script type="text/javascript">
|
||||
function pointMember(member_id) {
|
||||
|
||||
$('#transp_detail').html('Processing...');
|
||||
$('#acc' + member_id).prop('disabled', true);
|
||||
$.ajax({
|
||||
url: "/points/viewAssignDetail?proc=PROCESS&member_id=" + member_id
|
||||
}).done(function(data) {
|
||||
$('#transp_detail').html(data);
|
||||
$('#acc' + member_id).prop('disabled', false);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
//initMap();
|
||||
//
|
||||
</script>
|
||||
<style>
|
||||
.search-block {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-around;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.search-by-date {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.search-by-date input {
|
||||
width: 95px;
|
||||
}
|
||||
|
||||
.default_date {
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,136 @@
|
||||
<!-- Dashboard content -->
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<!-- Support tickets -->
|
||||
<div class="panel panel-flat">
|
||||
</div>
|
||||
<div class="panel panel-white">
|
||||
<form class="search-block" action="/points/index/" method="GET" autocomplete="off">
|
||||
<div class="search-block-item">
|
||||
<div class="form-group" style="width: 65px;">
|
||||
<label for="member_id">Member ID</label>
|
||||
<input type="search" class="form-control" id="member_id" name="member_id" value='<?= isset($member_id) ? $member_id : '' ?>'>
|
||||
</div>
|
||||
<div class="form-group" style="width:120px">
|
||||
<label for="title">Description</label>
|
||||
<input type="search" class="form-control" id="description" name="description" value='<?= isset($description) ? $description : '' ?>'>
|
||||
</div>
|
||||
<div class="form-group" style="width: 50px;">
|
||||
<label for="id">ID</label>
|
||||
<input type="search" class="form-control" id="id" name="id" value='<?= isset($id) ? $id : '' ?>'>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="from_points">Points</label>
|
||||
<div class="search-by-date">
|
||||
<input style="width: 60px;" type="search" class="form-control" id="from_points" name="from_points" value='<?= isset($from_points) ? $from_points : '' ?>'>
|
||||
|
||||
<input style="width: 60px;" type="search" class="form-control" id="to_points" name="to_points" value='<?= isset($to_points) ? $to_points : '' ?>'>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="search_text">Status</label>
|
||||
<?= $card_status ?>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="from_date">Added</label>
|
||||
<div class="default_date">
|
||||
<label for="default_date">One Last Month</label>
|
||||
<input type="checkbox" id="default_date" name="default_date" <?= $default_date === 'on' ? 'checked' : '' ?>>
|
||||
</div>
|
||||
<div class="search-by-date">
|
||||
<input type="search" class="form-control" id="from_date" name="from_date" value='<?= isset($from_date) ? $from_date : '' ?>'>
|
||||
|
||||
<input type="search" class="form-control" id="to_date" name="to_date" value='<?= isset($to_date) ? $to_date : '' ?>'>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="action_hidden" value="search" />
|
||||
<div class="form-group">
|
||||
<button class="btn btn-primary btn-search" type="submit">Search</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?= $link ?>
|
||||
<div class="panel panel-flat">
|
||||
<div class="table-responsive">
|
||||
<?= $points_report ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-flat">
|
||||
<div class="table-responsive"> </div>
|
||||
</div>
|
||||
<!-- /support tickets -->
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3">
|
||||
<!-- Recent Members -->
|
||||
<div class="panel panel-flat" style="background-color: #ccffff; height: 800px;">
|
||||
<div id="transp_detail">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Process</h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Recent Members -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /dashboard content -->
|
||||
<script src="/assets/js/plugins/pickers/datepicker.js"></script>
|
||||
<script src="/assets/js/app.js"></script>
|
||||
<script>
|
||||
$('document').ready(function() {
|
||||
function enableDateInput() {
|
||||
$('#from_date, #to_date').val('');
|
||||
$('#from_date, #to_date').prop('readonly', false);
|
||||
$('#from_date, #to_date').css('pointer-events', 'auto');
|
||||
}
|
||||
|
||||
function disableDateInput() {
|
||||
setDefaultDateWithMonths('.search-block', 1);
|
||||
$('#from_date, #to_date').prop('readonly', true);
|
||||
$('#from_date, #to_date').css('pointer-events', 'none');
|
||||
}
|
||||
|
||||
// add library datepicker
|
||||
addDatePicker('#from_date, #to_date');
|
||||
|
||||
// detect change of checkbox
|
||||
$('#default_date').on('change', function() {
|
||||
if ($(this).prop('checked')) {
|
||||
disableDateInput();
|
||||
} else {
|
||||
enableDateInput();
|
||||
}
|
||||
})
|
||||
|
||||
// When init page default date checked
|
||||
const checked = <?= $default_date === 'on' ? 'true' : 'false' ?>;
|
||||
if (checked) {
|
||||
disableDateInput();
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
.search-block-item {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.search-by-date {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.search-by-date input {
|
||||
width: 95px;
|
||||
}
|
||||
|
||||
.default_date {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.btn-search {
|
||||
top: 27px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,294 @@
|
||||
<style>
|
||||
#tblSummary tr.hidd{
|
||||
display: none;
|
||||
}
|
||||
.tippy{
|
||||
border-bottom: 1px dotted;
|
||||
}
|
||||
</style>
|
||||
<table class="table table-striped table-hover table-bordered table-condensed" id="tblSummary">
|
||||
<thead class="bg-indigo">
|
||||
<tr>
|
||||
<th>Location</th>
|
||||
<th>Points Assigned 24HRs</th>
|
||||
<th>Points Assigned Past 7 Days</th>
|
||||
<th>Points Assigned Past 14 Days</th>
|
||||
<th>Points Assigned Past 30 Days</th>
|
||||
<th>Points Assigned All Time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$s1 = $s2 = $s3 = $s4 = $s5 = 0;
|
||||
foreach ($data_report ?? [] as $item) {
|
||||
$s1 += $item['last_24_hrs'];
|
||||
$s2 += $item['last_7_days'];
|
||||
$s3 += $item['last_14_days'];
|
||||
$s4 += $item['last_30_days'];
|
||||
$s5 += $item['total_assigned_times'];
|
||||
?>
|
||||
<tr class="<?=$item['location']?> <?=(!in_array($item['location'],['SG','US','Unknown'])?'hidd':'')?>" >
|
||||
<td class="text-right">
|
||||
<?php
|
||||
if($item['location'] === 'Unknown'){
|
||||
echo '<span class="tippy" data-tippy-content="User has not provided GPS Permission">'.$item["location"].'</span>';
|
||||
}else{
|
||||
echo $item['location'];
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="text-right"><?= $item['last_24_hrs'] ?></td>
|
||||
<td class="text-right"><?= $item['last_7_days'] ?></td>
|
||||
<td class="text-right"><?= $item['last_14_days'] ?></td>
|
||||
<td class="text-right"><?= $item['last_30_days'] ?></td>
|
||||
<td class="text-right"><?= $item['total_assigned_times'] ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td colspan="100%" class="text-center">
|
||||
<a onclick="fnShowExpand(this)">...Expand...</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="background-color: #efefbf8c; opacity: 0.8; font-weight: bold">
|
||||
<td class="text-right"></td>
|
||||
<td class="text-right"><?=$s1?></td>
|
||||
<td class="text-right"><?=$s2?></td>
|
||||
<td class="text-right"><?=$s3?></td>
|
||||
<td class="text-right"><?=$s4?></td>
|
||||
<td class="text-right"><?=$s5?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="block" style="margin-top: 30px">
|
||||
<hr/>
|
||||
<form method="get" action="#" onsubmit="return fnSubmitFormReport();">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<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="Allocation Date"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" id="email" name="email" placeholder="Email" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<?= $country_filter ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<?= $point_key ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<?= $point_value ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<a class="btn btn-default" href="/points/systemicpointssummary">Reset</a>
|
||||
<input type="button" onclick="fn_export_csv();" class="btn btn-info btn-xs" value="Export CSV">
|
||||
</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>Allocation Date</th>
|
||||
<th>Sign-up Date</th>
|
||||
<th>Location</th>
|
||||
<th>User ID</th>
|
||||
<th>User Email</th>
|
||||
<th>Point Key</th>
|
||||
<th>Point Name</th>
|
||||
<th>Point Value</th
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://unpkg.com/@popperjs/core@2"></script>
|
||||
<script src="https://unpkg.com/tippy.js@6"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/tippy.js@6/animations/scale.css"/>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
tippy('.tippy', {
|
||||
content: 'Global content',
|
||||
animation: 'scale',
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const $date_range = $('input[name="date_range"]');
|
||||
$date_range.daterangepicker({
|
||||
opens: 'right',
|
||||
autoUpdateInput: false,
|
||||
locale: {
|
||||
cancelLabel: 'Clear'
|
||||
},
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Past 24 hours': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 14 Days': [moment().subtract(13, '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('');
|
||||
fnSubmitFormReport();
|
||||
});
|
||||
$date_range.on('show.daterangepicker', function (ev, picker) {
|
||||
$("#date_range").get(0).scrollIntoView();
|
||||
});
|
||||
|
||||
$('#country_filter').change(function () {
|
||||
fnSubmitFormReport();
|
||||
});
|
||||
|
||||
$('#point_key').change(function () {
|
||||
fnSubmitFormReport();
|
||||
});
|
||||
|
||||
$('#point_value').change(function () {
|
||||
fnSubmitFormReport();
|
||||
});
|
||||
|
||||
window.tblReport = null;
|
||||
window.date_range_value = '';
|
||||
window.country_filter = '';
|
||||
$(function () {
|
||||
window.tblReport = $('#tblReport').DataTable({
|
||||
"sDom": 'lrtip',
|
||||
"responsive": true,
|
||||
"processing": true,
|
||||
"serverSide": true,
|
||||
'ajax': {
|
||||
'url': '/points/getSystemicPointsDatatables',
|
||||
"type": "POST",
|
||||
"data": {
|
||||
"date_range": function () {
|
||||
return $("#date_range").val()
|
||||
},
|
||||
"email": function () {
|
||||
return $('#email').val()
|
||||
},
|
||||
"country_filter": function () {
|
||||
return $('#country_filter').val()
|
||||
},
|
||||
"point_key": function () {
|
||||
return $('#point_key').val()
|
||||
},
|
||||
"point_value": function () {
|
||||
return $('#point_value').val()
|
||||
},
|
||||
},
|
||||
"error": function (xhr, ajaxOptions, thrownError) {
|
||||
alert(thrownError);
|
||||
}
|
||||
},
|
||||
"order": [[1, "desc"]],
|
||||
"pageLength": 25,
|
||||
"lengthMenu": [10, 25, 50, 100, 200, 500, 1000],
|
||||
'columns': [
|
||||
{data: 'allocation_date'},
|
||||
{data: 'sign_up_date'},
|
||||
{data: 'country'},
|
||||
{data: 'member_id'},
|
||||
{data: 'email'},
|
||||
{data: 'point_key'},
|
||||
{data: 'name'},
|
||||
{data: 'points'}
|
||||
],
|
||||
'columnDefs': [
|
||||
{
|
||||
targets: 2,
|
||||
render: function (data, type, row, meta) {
|
||||
const _user_id = row.user_id;
|
||||
if (type === 'display' && data === 'Unknown') {
|
||||
return '<span class="tippy" data-tippy-content="User has not provided GPS Permission">'+data+'</span>';
|
||||
}
|
||||
return data;
|
||||
}
|
||||
},
|
||||
{
|
||||
targets: 3,
|
||||
render: function (data, type, row, meta) {
|
||||
if (type === 'display') {
|
||||
return `<a href="/member/viewLocateMember?member_id=${data}" target="_blank">${data}</a>`;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
},
|
||||
{"orderable": false, "targets": [4,5,6,7]}
|
||||
],
|
||||
});
|
||||
|
||||
window.tblReport.on( 'draw', function () {
|
||||
tippy('.tippy', {
|
||||
content: 'Global content',
|
||||
animation: 'scale',
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function fnShowExpand(that){
|
||||
const cur_text = $(that).text();
|
||||
$(that).text(cur_text == '...Expand...'?'Collapse':'...Expand...');
|
||||
$('#tblSummary').find('tr.hidd').toggle();
|
||||
}
|
||||
|
||||
function debounce(func, wait) {
|
||||
var timeout;
|
||||
|
||||
return function() {
|
||||
var context = this,
|
||||
args = arguments;
|
||||
|
||||
var executeFunction = function() {
|
||||
func.apply(context, args);
|
||||
};
|
||||
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(executeFunction, wait);
|
||||
};
|
||||
};
|
||||
|
||||
var handleSearchEmail = debounce(function (e) {
|
||||
fnSubmitFormReport();
|
||||
}, 500);
|
||||
|
||||
$('#email').on('keyup', handleSearchEmail);
|
||||
|
||||
//filter clicked
|
||||
function fnSubmitFormReport() {
|
||||
window.tblReport.ajax.reload(false);
|
||||
return false;
|
||||
}
|
||||
function fn_export_csv(){
|
||||
window.location.assign("/points/systemicPointsReportCSV");
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user