FEAT_FILTER ADDED IN SEND EXPIRY MESSAGE
This commit is contained in:
parent
3038e19ca6
commit
7027d8bdbf
@ -98,7 +98,7 @@ $routes->get("subscribers_list/", "Subscription::index");
|
|||||||
$routes->get("new_subscription_invoice/(:any)", "Invoice::new_subscription_invoice/$1");
|
$routes->get("new_subscription_invoice/(:any)", "Invoice::new_subscription_invoice/$1");
|
||||||
$routes->post("add_subscription/", "Subscription::add_subscription/");
|
$routes->post("add_subscription/", "Subscription::add_subscription/");
|
||||||
$routes->post('subscription/download_details', 'Subscription::download_details');
|
$routes->post('subscription/download_details', 'Subscription::download_details');
|
||||||
$routes->get("notify_the_expiry_subscribers/", "Subscription::notify_the_expiry_subscribers");
|
$routes->match(['get','post'],"notify_the_expiry_subscribers/", "Subscription::notify_the_expiry_subscribers");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -666,7 +666,7 @@ class Customer extends BaseController
|
|||||||
$result = $model->storeCustomerAddresses($billingData, $shippingData);
|
$result = $model->storeCustomerAddresses($billingData, $shippingData);
|
||||||
|
|
||||||
if (!empty($result['billing_addr_id']) && !empty($result['shipping_addr_id'])) {
|
if (!empty($result['billing_addr_id']) && !empty($result['shipping_addr_id'])) {
|
||||||
$results = ['status' => true, 'message' => 'New addresses saved successfully', 'cus_id' =>$this->request->getPost('customer_id'),"billing_addr_id"=>$result['billing_addr_id'],"shipping_addr_id"=>$result['shipping_addr_id']];
|
$results = ['status' => true, 'message' => 'New Address Saved Successfully', 'cus_id' =>$this->request->getPost('customer_id'),"billing_addr_id"=>$result['billing_addr_id'],"shipping_addr_id"=>$result['shipping_addr_id']];
|
||||||
} else {
|
} else {
|
||||||
$results = ['status' => false, 'message' => 'Failed to save New addresses'];
|
$results = ['status' => false, 'message' => 'Failed to save New addresses'];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ use App\Models\CustomerModel;
|
|||||||
use App\Models\SubscriptionModel;
|
use App\Models\SubscriptionModel;
|
||||||
use App\Models\SchemeModel;
|
use App\Models\SchemeModel;
|
||||||
use App\Models\InvoiceModel;
|
use App\Models\InvoiceModel;
|
||||||
|
use App\Models\NotificationModel;
|
||||||
use Mpdf\Mpdf;
|
use Mpdf\Mpdf;
|
||||||
|
|
||||||
class Subscription extends BaseController
|
class Subscription extends BaseController
|
||||||
@ -298,7 +299,20 @@ public function download_details()
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function notify_the_expiry_subscribers(){
|
public function notify_the_expiry_subscribers(){
|
||||||
|
if ($this->request->is('post')){
|
||||||
|
$dateParts = explode(' - ', $this->request->getPost('date'));
|
||||||
|
$fromDate = $dateParts[0];
|
||||||
|
$toDate = $dateParts[1];
|
||||||
|
$from_date = \DateTime::createFromFormat('d/m/Y', $fromDate);
|
||||||
|
$to_date = \DateTime::createFromFormat('d/m/Y', $toDate);
|
||||||
|
$model = new NotificationModel();
|
||||||
|
$response['data'] = $model->get_email_data($from_date->format('Y-m-d'), $to_date->format('Y-m-d'));
|
||||||
|
// log_message('info','Selected from date is '.$from_date);
|
||||||
|
$response['selected_data'] = $this->request->getPost('date');
|
||||||
|
return $this->response->setJson($response);
|
||||||
|
}
|
||||||
$data['page_name'] = 'Notify the Expiry Subscribers';
|
$data['page_name'] = 'Notify the Expiry Subscribers';
|
||||||
|
$data['selected_data'] = '';
|
||||||
$this->render_page('notify_the_expiry_subscribers',$data);
|
$this->render_page('notify_the_expiry_subscribers',$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -348,6 +348,24 @@ public function getExpDate2(){
|
|||||||
->get()->getResultArray();
|
->get()->getResultArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function get_email_data($f_date = null , $t_date = null){
|
||||||
|
$builder = $this->db->table('notification_history_parents as nhp');
|
||||||
|
$builder->select('nhp.*, nhc.*, nc.*,C.first_name,C.last_name,C.email, S.sub_id,S.membership_id, DATEDIFF(S.to_subscription, CURDATE()) AS countdays');
|
||||||
|
$builder->join('notification_history_children as nhc', 'nhc.fkid = nhp.id');
|
||||||
|
$builder->join('notification_campaign as nc', 'nc.campaign_id = nhp.campaign_id');
|
||||||
|
$builder->join('customers as C', 'C.customer_id = nhc.customer_id');
|
||||||
|
$builder->join('subscription as S', 'S.sub_id = nhc.subscription_id');
|
||||||
|
$builder->where('nhp.start_date_time >=', $f_date);
|
||||||
|
$builder->where('nhp.start_date_time <=', $t_date);
|
||||||
|
$builder->whereIn('nhp.campaign_id', [1, 2]);
|
||||||
|
$builder->where('nc.isactive', 1);
|
||||||
|
|
||||||
|
$query = $builder->get();
|
||||||
|
$results = $query->getResult();
|
||||||
|
log_message('info',json_encode($results));
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -381,6 +381,7 @@ public function getQueryforSubscriptionDetailsBySchemeName($flag,$condition, $va
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -847,7 +847,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="quick_billing_country"> Country</label>
|
<label for="quick_billing_country"> Country<span class="text-danger"> *</span></label>
|
||||||
<select class="form-control" id="quick_billing_country">
|
<select class="form-control" id="quick_billing_country">
|
||||||
<option value="">Select Country</option>
|
<option value="">Select Country</option>
|
||||||
</select>
|
</select>
|
||||||
@ -889,7 +889,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="quick_shipping_country"> Country</label>
|
<label for="quick_shipping_country"> Country<span class="text-danger"> *</span></label>
|
||||||
<select class="form-control" id="quick_shipping_country">
|
<select class="form-control" id="quick_shipping_country">
|
||||||
<option value="">Select Country</option>
|
<option value="">Select Country</option>
|
||||||
</select>
|
</select>
|
||||||
@ -1401,6 +1401,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
|
|||||||
|
|
||||||
$("#editAddressesCheckbox").on("change", function() {
|
$("#editAddressesCheckbox").on("change", function() {
|
||||||
if ($(this).is(":checked")) {
|
if ($(this).is(":checked")) {
|
||||||
|
$('#quick_shipping_country').attr('required',true);
|
||||||
|
|
||||||
// $("#storeBillingAddress").prop("readonly", false);
|
// $("#storeBillingAddress").prop("readonly", false);
|
||||||
$("#storeBillingAddress").prop("readonly", true);
|
$("#storeBillingAddress").prop("readonly", true);
|
||||||
@ -1512,7 +1513,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
|
|||||||
console.log("cFAFAFAbbb",cb);
|
console.log("cFAFAFAbbb",cb);
|
||||||
$.each(cb, function(k, v) {
|
$.each(cb, function(k, v) {
|
||||||
var state = v.state_name ? v.state_name : v.state;
|
var state = v.state_name ? v.state_name : v.state;
|
||||||
state = v.postal_code ? state + v.postal_code : state;
|
state = v.postal_code ? state +' ' + v.postal_code : state;
|
||||||
v.address_1 ? customer_billing_addressDetails.push(v.address_1 + " " + v.address_2) : "";
|
v.address_1 ? customer_billing_addressDetails.push(v.address_1 + " " + v.address_2) : "";
|
||||||
v.city ? customer_billing_addressDetails.push(v.city) : "";
|
v.city ? customer_billing_addressDetails.push(v.city) : "";
|
||||||
state ? customer_billing_addressDetails.push(state) : "";
|
state ? customer_billing_addressDetails.push(state) : "";
|
||||||
@ -1582,7 +1583,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
|
|||||||
if (cs.length > 0) {
|
if (cs.length > 0) {
|
||||||
$.each(cs, function(k, v) {
|
$.each(cs, function(k, v) {
|
||||||
var state = v.state_name ? v.state_name : v.state;
|
var state = v.state_name ? v.state_name : v.state;
|
||||||
state = v.postal_code ? state + v.postal_code : state;
|
state = v.postal_code ? state + ' ' + v.postal_code : state;
|
||||||
v.address_1 ? customer_shipping_addressDetails.push(v.address_1 + " " + v.address_2) : "";
|
v.address_1 ? customer_shipping_addressDetails.push(v.address_1 + " " + v.address_2) : "";
|
||||||
v.city ? customer_shipping_addressDetails.push(v.city) : "";
|
v.city ? customer_shipping_addressDetails.push(v.city) : "";
|
||||||
state ? customer_shipping_addressDetails.push(state) : "";
|
state ? customer_shipping_addressDetails.push(state) : "";
|
||||||
@ -2032,7 +2033,8 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
|
|||||||
const formattedShippingAddress = [
|
const formattedShippingAddress = [
|
||||||
saddress1 + " " + (saddress2 || ""),
|
saddress1 + " " + (saddress2 || ""),
|
||||||
scity,
|
scity,
|
||||||
(sstate ? sstate + szip : ""),
|
(sstate ? sstate : ""),
|
||||||
|
szip,
|
||||||
scountry
|
scountry
|
||||||
]
|
]
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
|
|||||||
@ -8,27 +8,54 @@
|
|||||||
<input type="number" class="form-control" id="params" name="params" placeholder="Number of Days" required />
|
<input type="number" class="form-control" id="params" name="params" placeholder="Number of Days" required />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3"><?php $selected_data = '';?>
|
|
||||||
<input id = 'date_picker' class="form-control input-daterange-datepicker" type="text" name="date" value="<?php echo $selected_data; ?>" />
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<button type="button" id="callajax" class="btn btn-primary" onclick="sendsms()">Send Message</button>
|
<button type="button" id="callajax" class="btn btn-primary" onclick="sendsms()">Send Message</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<input id = 'date_picker' class="form-control input-daterange-datepicker" type="text" name="date" value="<?php echo $selected_data; ?>" />
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<button type="submit" class="btn btn-primary" onclick="generateData()">Generate Report</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<br>
|
<br>
|
||||||
<div class="col-md-12" style="margin: 15px;" id="target-div"></div>
|
<div class="col-md-12" style="margin: 15px;" id="target-div"></div>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- end card body-->
|
<div id="modal_table">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table id="datatable-buttons" class="table table-striped nowrap w-100">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th hidden>id</th>
|
||||||
|
<th>Customer Name</th>
|
||||||
|
<th>Sent Date</th>
|
||||||
|
<th>Membership ID</th>
|
||||||
|
<th>Email/Mobile</th>
|
||||||
|
<th>Mode</th>
|
||||||
|
<th>Status</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="table-body">
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div></div></div></div> <!-- end card body-->
|
||||||
</div> <!-- end card -->
|
</div> <!-- end card -->
|
||||||
</div><!-- end col-->
|
</div><!-- end col--><!-- end row-->
|
||||||
</div><!-- end row-->
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var $select_data = '<?php echo $selected_data; ?>';
|
$('#modal_table').hide();
|
||||||
|
$('#datatable-buttons').DataTable({
|
||||||
|
"dom": 'frtip',
|
||||||
|
"ordering": false,
|
||||||
|
"paging": true,
|
||||||
|
"searching": true,
|
||||||
|
"autoWidth":true
|
||||||
|
});
|
||||||
|
var $select_data = '<?php echo $selected_data; ?>';
|
||||||
var dateRangeFilter = $('input.input-daterange-datepicker').daterangepicker({
|
var dateRangeFilter = $('input.input-daterange-datepicker').daterangepicker({
|
||||||
locale: {
|
locale: {
|
||||||
format: 'DD/MM/YYYY',
|
format: 'DD/MM/YYYY',
|
||||||
@ -49,8 +76,6 @@
|
|||||||
$(this).val('');
|
$(this).val('');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
@ -94,4 +119,48 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generateData(){
|
||||||
|
var date = $("#date_picker").val();
|
||||||
|
console.log(date);
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: '<?= base_url('notify_the_expiry_subscribers') ?>',
|
||||||
|
data: {
|
||||||
|
date: date
|
||||||
|
},
|
||||||
|
success: function(response){
|
||||||
|
console.log(response);
|
||||||
|
var data = response.data;
|
||||||
|
var table = $('#datatable-buttons').DataTable();
|
||||||
|
var tableBody = $('#table-body');
|
||||||
|
table.clear();
|
||||||
|
tableBody.empty();
|
||||||
|
if (data && data.length > 0) {
|
||||||
|
data.forEach(function(item) {
|
||||||
|
var status = (item.receiving_status == 1) ? 'Success' : 'Fail';
|
||||||
|
table.row.add([
|
||||||
|
item.first_name + ' ' + item.last_name,
|
||||||
|
item.sent_time,
|
||||||
|
item.membership_id,
|
||||||
|
item.receiving_entity,
|
||||||
|
item.mode,
|
||||||
|
status
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
table.draw();
|
||||||
|
$('#modal_table').show();
|
||||||
|
// table.draw();
|
||||||
|
} else {
|
||||||
|
tableBody.append('<tr><td colspan="6" class="text-center">No data available</td></tr>');
|
||||||
|
table.draw();
|
||||||
|
$('#modal_table').show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error){
|
||||||
|
console.error("Ajax Error: ", error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -78,19 +78,19 @@
|
|||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<!-- Add checkboxes for each column -->
|
<!-- Add checkboxes for each column -->
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<input type="checkbox" class="form-check-input column-toggle" data-column="1" checked> Book Name
|
<input type="checkbox" class="form-check-input column-toggle" data-column="1" checked> Invoice Date
|
||||||
</div><br>
|
</div><br>
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<input type="checkbox" class="form-check-input column-toggle" data-column="2" checked> Author
|
<input type="checkbox" class="form-check-input column-toggle" data-column="2" checked> Book Name
|
||||||
</div><br>
|
</div><br>
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<input type="checkbox" class="form-check-input column-toggle" data-column="3" checked> Cost
|
<input type="checkbox" class="form-check-input column-toggle" data-column="3" checked> Author
|
||||||
</div><br>
|
</div><br>
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<input type="checkbox" class="form-check-input column-toggle" data-column="4" checked> Published By
|
<input type="checkbox" class="form-check-input column-toggle" data-column="4" checked> Published By
|
||||||
</div><br>
|
</div><br>
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<input type="checkbox" class="form-check-input column-toggle" data-column="5" checked> Inv Date
|
<input type="checkbox" class="form-check-input column-toggle" data-column="5" checked> Cost
|
||||||
</div><br>
|
</div><br>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user