first commit
This commit is contained in:
@@ -0,0 +1,168 @@
|
||||
<div style="width:100%;">
|
||||
|
||||
<input type="hidden" id='member_id' name='e_trigger' value="<?= $e_trigger ?>" />
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2"><h3><?= $e_trigger ?> </h3></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">Dynamic Key: <h5><?= $dynamic_key ?> </h5></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th width="50px;" scope="row">Next Action</th>
|
||||
<td><?= $category_settings ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th width="50px;" scope="row">Override Card Text</th>
|
||||
<td><?= $override_text_combo ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th width="50px;" scope="row">Notification Title</th>
|
||||
<td><input type="text" class="form-control" name="notify_title" id="notify_title" value="<?= $notify_title??'' ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th width="50px;" scope="row">Expiration</th>
|
||||
<td><?= $expiration_combo ?></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<th width="50px;" scope="row">Action Card</th>
|
||||
<td><?= $card_settings ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="50px;" scope="row">Frequency</th>
|
||||
<td><?= $frequency_combo??'' ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="50px;" scope="row">Send Day</th>
|
||||
<td><?= $send_day_combo??'' ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="50px;" scope="row">Send Time</th>
|
||||
<td><?= $send_time_combo??'' ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th width="50px;" scope="row">Icon</th>
|
||||
<td><input type="text" class="form-control" name="icon" id="icon" value="<?= $icon??'' ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: right;">
|
||||
<button type="button" id="accb" onclick="updateTriggerItem('<?= $e_trigger ?>'); return true;" class="btn btn-info">Update</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2"><div id="updt_detail"> </div> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<form name="memberProfile" id="memberProfile" action="#">
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
function updateTriggerItem(e_trigger) {
|
||||
|
||||
var e = document.getElementById("category_settings");
|
||||
var category_settings = e.options[e.selectedIndex].value;
|
||||
|
||||
//alert(category_settings);
|
||||
|
||||
var f = document.getElementById("card_settings");
|
||||
var card_settings = f.options[f.selectedIndex].value;
|
||||
|
||||
|
||||
var e1 = document.getElementById("override_text");
|
||||
var override_text = e1.options[e1.selectedIndex].value;
|
||||
|
||||
var e2 = document.getElementById("expiration");
|
||||
var expiration = e2.options[e2.selectedIndex].value;
|
||||
|
||||
var eicon = document.getElementById("icon");
|
||||
var icon = eicon.value;
|
||||
|
||||
var enotify_title = document.getElementById("notify_title");
|
||||
var notify_title = enotify_title.value;
|
||||
|
||||
const frequency = document.getElementById("frequency").value || '';
|
||||
const send_day = document.getElementById("send_day").value || '';
|
||||
const send_time = document.getElementById("send_time").value || '';
|
||||
|
||||
// alert(card_settings);
|
||||
|
||||
if (category_settings == "") {
|
||||
alert("Please select next action");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (expiration == "") {
|
||||
alert("Please select expiration");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (card_settings == "") {
|
||||
alert("Please select action card");
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
//
|
||||
// alert(category_settings);
|
||||
*/
|
||||
$('#accb').prop('disabled', true);
|
||||
$('#updt_detail').html('Started Processing...');
|
||||
$.ajax({
|
||||
url: "/notifications/before_update_trigger?e_trigger=" + e_trigger+"&card_settings="+card_settings
|
||||
}).done(function (data) {
|
||||
var data = JSON.parse(data);
|
||||
var is_used = data.used;
|
||||
var force_update = false;
|
||||
if(is_used==true){
|
||||
var force_update = confirm(data.message);
|
||||
}
|
||||
console.log(is_used)
|
||||
if(force_update==true || is_used==false){
|
||||
$.ajax({
|
||||
url: "/notifications/update_trigger",
|
||||
method: "POST",
|
||||
data: {
|
||||
category_settings,
|
||||
e_trigger,
|
||||
card_settings,
|
||||
expiration,
|
||||
override_text,
|
||||
icon,
|
||||
notify_title,
|
||||
frequency,
|
||||
send_day,
|
||||
send_time
|
||||
},
|
||||
dataType: "html"
|
||||
}).done(function (data) {
|
||||
$('#updt_detail').html(data);
|
||||
$('#accb').prop('disabled', false);
|
||||
});
|
||||
}else{
|
||||
$('#updt_detail').html('');
|
||||
$('#accb').prop('disabled', false);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// -->
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<div class="panel panel-flat">
|
||||
<div class="jumbotron" style="background-color:#F3DFE5; padding:10px;">
|
||||
<h3>Notification Trigger Settings</h3>
|
||||
</div>
|
||||
<div class="col-lg-12" style="border-radius:5px;background-color:#f2f2f2">
|
||||
<form class="search-block" action="?" method="GET">
|
||||
<div class="form-group">
|
||||
<label for="trigger_id">Trigger ID</label>
|
||||
<input type="search" class="form-control" id="trigger_id" name="trigger_id" value='<?= isset($trigger_id) ? $trigger_id : '' ?>'>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="next_action">Next Action</label>
|
||||
<input type="search" class="form-control" id="next_action" name="next_action" value='<?= isset($next_action) ? $next_action : '' ?>'>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="card_key">Card Key</label>
|
||||
<input type="search" class="form-control" id="card_key" name="card_key" value='<?= isset($card_key) ? $card_key : '' ?>'>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email_template">Email Template</label>
|
||||
<input type="search" class="form-control" id="email_template" name="email_template" value='<?= isset($email_template) ? $email_template : '' ?>'>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="search_text">Send Email</label>
|
||||
<?= $card_send_mail ?>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="search_text">Send Notification</label>
|
||||
<?= $card_send_notification ?>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="search_text">Status</label>
|
||||
<?= $card_status ?>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="display: flex; align-self: center; margin-bottom: unset;">
|
||||
<button class="btn btn-primary btn-search" type="submit">Search</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?= $link ?>
|
||||
<div class="panel panel-white">
|
||||
<table style="max-width:100%" id="trigger-list" class="table table-striped table-hover table-bordered table-condensed">
|
||||
<thead class="bg-indigo">
|
||||
<th>ID</th>
|
||||
<th>Trigger ID</th>
|
||||
<th>Details</th>
|
||||
<th>Description</th>
|
||||
<th>Update</th>
|
||||
<th>Edit</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($trigger_table as $value) { ?>
|
||||
<tr>
|
||||
<td><?= $value['id'] ?></td>
|
||||
<td><?= $value['trigger_id'] ?></td>
|
||||
<td>
|
||||
<b>Next Action:</b> <?= $value['next_action'] ?><br>
|
||||
<b>Default Message:</b> <?= $value['message'] ?><br>
|
||||
<b>Card Key:</b> <?= $value['card_key'] ?><br>
|
||||
<b>Send Notification:</b> <?= $value['send_notification_text'] ?><br>
|
||||
<b>Send Email:</b> <?= $value['send_mail_text'] ?><br>
|
||||
<b>Email Template:</b> <?= $value['email_template'] ?><br>
|
||||
<b>Icon:</b> <?= $value['icon'] ?><br>
|
||||
<b>Notification Title:</b> <?= $value['notify_title']??'' ?><br>
|
||||
<hr>
|
||||
<b>Status:</b> <?= $value['status_text'] ?><br>
|
||||
</td>
|
||||
<td><?= $this->ckeditor->editor('index' . $value['id'], $value['action_detail']); ?></td>
|
||||
<td>
|
||||
<button type="button" id="index<?= $value['id'] ?>" class="btn btn-primary btn-update disable-pointer disabled">Update</button>
|
||||
<p class="messages text-center" id="message<?= $value['id'] ?>"></p>
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" id="edit_trig<?= $value['id'] ?>" onclick="editTriggerItem('<?= $value['trigger_id'] ?>'); return true;" class="btn btn-danger btn-edit">Edit</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3">
|
||||
<!-- Media library -->
|
||||
<div class="panel panel-white" id="set_detail">
|
||||
|
||||
</div>
|
||||
<!-- /media library -->
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="/assets/ckeditor/ckeditor.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('.btn-update').click(function (e) {
|
||||
let $this = $(this);
|
||||
$('.messages').text("");
|
||||
|
||||
e.preventDefault();
|
||||
$this.button("loading");
|
||||
|
||||
let id = $this.closest('tr').find('td:eq(0)').html();
|
||||
let description = CKEDITOR.instances['index' + id].getData();
|
||||
|
||||
$.ajax({
|
||||
url: '/notifications/update',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
'id': id,
|
||||
'description': description
|
||||
},
|
||||
success: function (response) {
|
||||
$('#message' + id).text(response.message);
|
||||
|
||||
if (response.code) {
|
||||
$('#message' + id).addClass('text-success');
|
||||
} else {
|
||||
$('#message' + id).addClass('text-danger');
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
$this.button("reset")
|
||||
.addClass('disable-pointer')
|
||||
.addClass('disabled');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Object.values(CKEDITOR.instances).forEach((item, idx) => {
|
||||
item.on('change', () => {
|
||||
$(`button[id="index${idx + 1}"]`)
|
||||
.removeClass('disable-pointer')
|
||||
.removeClass('disabled');
|
||||
})
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.disable-pointer {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.search-block {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
function editTriggerItem(trigger_id) {
|
||||
|
||||
// var e = document.getElementById("points_settings");
|
||||
// var points_settings = e.options[e.selectedIndex].value;
|
||||
|
||||
// alert(trigger_id);
|
||||
|
||||
// if (points_settings == "") {
|
||||
// alert("Please select a points settings");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
$('#edit_trig').prop('disabled', true);
|
||||
$('#set_detail').html('Processing...');
|
||||
$.ajax({
|
||||
url: "/notifications/editTrigger?trigger_id=" + trigger_id + "&member_id=0"
|
||||
}).done(function (data) {
|
||||
$('#set_detail').html(data);
|
||||
$('#edit_trig').prop('disabled', false);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
// -->
|
||||
</script>
|
||||
@@ -0,0 +1,125 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
<div>
|
||||
<form method="GET" action="/notifications/noticelist">
|
||||
<div class="row">
|
||||
<div class="col-xs-4 col-md-3">
|
||||
<label for="">From - To</label>
|
||||
<input type="text" class="form-control" name="from_to" value="<?= $params['from_to']??'' ?>" readonly>
|
||||
</div>
|
||||
<div class="col-xs-4 col-md-3">
|
||||
<label for="">Account email</label>
|
||||
<input type="text" class="form-control" name="account_email" value="<?= $params['account_email']??'' ?>">
|
||||
</div>
|
||||
<div class="col-xs-4 col-md-3">
|
||||
<label for="">Msg status</label>
|
||||
<select name="status" class="form-control">
|
||||
<option value="">Select a status</option>
|
||||
<?php foreach($notificationStatus as $statusId => $statusName): ?>
|
||||
<option
|
||||
value="<?php echo $statusId; ?>"
|
||||
<?= (isset($params['status']) && $params['status'] == $statusId) ? 'selected' : '' ?>
|
||||
><?php echo $statusName; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-xs-4 col-md-3">
|
||||
<label for="">Notice type</label>
|
||||
<select name="notice_type" class="form-control">
|
||||
<option value="">Select a notification type</option>
|
||||
<?php foreach($notificationTypes as $row): ?>
|
||||
<option
|
||||
value="<?php echo $row->notice_type; ?>"
|
||||
<?= (isset($params['notice_type']) && $params['notice_type'] == $row->notice_type) ? 'selected' : '' ?>
|
||||
><?php echo $row->description; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-4 col-md-3">
|
||||
<label for="">Trigger key</label>
|
||||
<input type="text" class="form-control" name="trigger_key" value="<?= $params['trigger_key']??'' ?>">
|
||||
</div>
|
||||
<div class="col-xs-4 col-md-3">
|
||||
<label for="">Email msg</label>
|
||||
<input type="text" class="form-control" name="email_msg" value="<?= $params['email_msg']??'' ?>">
|
||||
</div>
|
||||
<div class="col-xs-4 col-md-3">
|
||||
<label for="">Mode</label>
|
||||
<input type="text" class="form-control" name="mode" value="<?= $params['mode']??'' ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class=" m-y-sm">
|
||||
<button type="submit" class="btn btn-primary btn-sm">Search</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="m-y-sm"><?= $pagination_link ?></div>
|
||||
<div class="panel panel-flat">
|
||||
<?= $notification_table ?>
|
||||
</div>
|
||||
<div><?= $pagination_link ?></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 fromToElement = $('input[name="from_to"]');
|
||||
const fromToVal = fromToElement.val();
|
||||
if (fromToVal == '') {
|
||||
datepickerOptions.startDate = moment().subtract(7, 'days').format('YYYY-MM-DD');
|
||||
datepickerOptions.endDate = moment().format('YYYY-MM-DD');
|
||||
}
|
||||
fromToElement.daterangepicker(datepickerOptions);
|
||||
|
||||
fromToElement.on('apply.daterangepicker', function(ev, picker) {
|
||||
$(this).val(picker.startDate.format('YYYY-MM-DD') + ' - ' + picker.endDate.format('YYYY-MM-DD'));
|
||||
});
|
||||
|
||||
fromToElement.on('cancel.daterangepicker', function(ev, picker) {
|
||||
fromToElement.val('');
|
||||
});
|
||||
});
|
||||
|
||||
function pushNotification(notice_id, member_id) {
|
||||
// alert(notice_id);
|
||||
|
||||
$('#msgl' + notice_id).html('Processing...');
|
||||
$('#acc' + notice_id).prop('disabled', true);
|
||||
$.ajax({
|
||||
url: "/notifications/sendnotification?notice_id=" + notice_id + "&member_id=" + member_id
|
||||
}).done(function (data) {
|
||||
$('#msgl'+ notice_id).html(data);
|
||||
$('#acc' + notice_id).prop('disabled', false);
|
||||
});
|
||||
return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function pushCard(notice_id, member_id) {
|
||||
// alert(notice_id);
|
||||
|
||||
$('#msgl' + notice_id).html('Processing...');
|
||||
$('#acc' + notice_id).prop('disabled', true);
|
||||
$.ajax({
|
||||
url: "/notifications/generateCard?notice_id=" + notice_id + "&member_id=" + member_id
|
||||
}).done(function (data) {
|
||||
$('#msgl'+ notice_id).html(data);
|
||||
$('#acc' + notice_id).prop('disabled', false);
|
||||
});
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="panel panel-flat" style="background-color: #ffffff;">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Specifications : <a href="https://docs.google.com/spreadsheets/d/126V5fvi3xiENA1hoJo08z6SsjCPWIvBoIrmFaDWScc8/edit#gid=0">https://docs.google.com/spreadsheets/d/126V5fvi3xiENA1hoJo08z6SsjCPWIvBoIrmFaDWScc8/edit#gid=0</a> </h6>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-3">
|
||||
<div class="panel panel-flat" style="background-color: #ffffff; ">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Country Report[total pending by country]</h6>
|
||||
|
||||
</div>
|
||||
<?= $trigger_report_table ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="panel panel-flat" style="background-color: #ffffff; ">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Insight by Category - all time</h6>
|
||||
|
||||
</div>
|
||||
<?= $insight_report_table ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="panel panel-flat" style="background-color: #ffffff; ">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Insight by Category - pending</h6>
|
||||
|
||||
</div>
|
||||
<?= $insight_pending_report_table ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
|
||||
<div class="panel panel-flat" style="background-color: #ffffff;">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Insight by Category - Notification Completed</h6>
|
||||
|
||||
</div>
|
||||
<?= $insight_completed_report_table ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-3">
|
||||
|
||||
<div class="panel panel-flat" style="background-color: #ffffff;">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Country Report[total generated by country]</h6>
|
||||
|
||||
</div>
|
||||
<?= $country_report ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="panel panel-flat" style="background-color: #ffffff; ">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Country Report[total pending by country]</h6>
|
||||
|
||||
</div>
|
||||
<?= $trigger_report_table ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="panel panel-flat" style="background-color: #ffffff; ">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title">Country Completed Report[last 24 hrs]</h6>
|
||||
|
||||
</div>
|
||||
<?= $completed_report_table ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="panel panel-flat" style="background-color: #ffffff; ">
|
||||
<div class="panel-heading">
|
||||
<h6 class="panel-title"> . .. . . . . . </h6>
|
||||
|
||||
</div>
|
||||
NOT USED
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user