MERGE_BRANCH
This commit is contained in:
commit
c014222148
@ -98,6 +98,7 @@ $routes->get("subscribers_list/", "Subscription::index");
|
||||
$routes->get("new_subscription_invoice/(:any)", "Invoice::new_subscription_invoice/$1");
|
||||
$routes->post("add_subscription/", "Subscription::add_subscription/");
|
||||
$routes->post('subscription/download_details', 'Subscription::download_details');
|
||||
$routes->get("notify_the_expiry_subscribers/", "Subscription::notify_the_expiry_subscribers");
|
||||
|
||||
|
||||
|
||||
|
||||
@ -558,20 +558,23 @@ public function create_or_update_subscription($invoice_id,$invoice_status, $msg_
|
||||
'updated_by' => get_logged_user_id(),
|
||||
'is_renew' => $renewal,
|
||||
'membership_id'=>$membership_id,
|
||||
'status' =>1
|
||||
'status' =>1,
|
||||
'isactive' =>$invoice_status === 'Approved' ? 1 : 0
|
||||
];
|
||||
|
||||
|
||||
$check_existing_customer_id = $subModel->where('invoice_id',$invoice_id)->findAll();
|
||||
//dd($check_existing_customer_id);
|
||||
if($check_existing_customer_id){
|
||||
log_message('info',json_encode($subscription_data));
|
||||
$where = ['invoice_id'=>$invoice_id];
|
||||
$subModel->updateData($subscription_data,$where);//update the data
|
||||
}
|
||||
else{
|
||||
//insert the data
|
||||
$model->insertSubscriptionData($subscription_data,$invoice_status);
|
||||
}
|
||||
// if($check_existing_customer_id){
|
||||
// unset($data['created_by']);
|
||||
// log_message('info',json_encode($subscription_data));
|
||||
// $where = ['invoice_id'=>$invoice_id];
|
||||
// $subModel->updateData($subscription_data,$where);//update the data
|
||||
// }
|
||||
// else{
|
||||
// //insert the data
|
||||
// unset($data['updated_by']);
|
||||
$model->insertupdateSubscriptionData($subscription_data,$invoice_status);
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -571,9 +571,8 @@ class Notifications extends BaseController
|
||||
################################################################
|
||||
public function getExpCustomerDetail($window_time = null)
|
||||
{
|
||||
// Email flow only Whatsapp flow Deleted.
|
||||
$this->update_expired_members();
|
||||
echo "Hi, ";
|
||||
$response = "<pre> Hi, ";
|
||||
# Step 1: add the days to retrive the data//
|
||||
$providedDate = date('Y-m-d');
|
||||
$newDate = date('Y-m-d', strtotime($providedDate . ' + ' . $window_time . ' days'));
|
||||
@ -602,12 +601,17 @@ class Notifications extends BaseController
|
||||
$notification = new NotificationHelper();
|
||||
if (empty($queryResult)) {
|
||||
$this->logger->error("There is no customer expiring on date:{$newDate}");
|
||||
echo " There is no customer expiring. till dated :{$newDate}";
|
||||
$response .= " There is no customer expiring. till dated :{$newDate}";
|
||||
return;
|
||||
}
|
||||
|
||||
$emailTemplateName = $NotificationModel->getTempName('EXPIRY NOTIFY TEMPLATE EMAIL');
|
||||
echo "Started.<br> Customer expiring. till dated = ".date('d-m-Y', strtotime($newDate))." <br> There are ".count($queryResult)." persons <br>";
|
||||
$response .= "Started.<br> Customer expiring. till dated = ".date('d/m/Y', strtotime($newDate))." <br> There are ".count($queryResult)." persons <br>";
|
||||
if(!empty($queryResult)){
|
||||
usort($queryResult, function ($a, $b) {
|
||||
return $b['to_subscription'] <=> $a['to_subscription']; // Descending order
|
||||
});
|
||||
}
|
||||
foreach ($queryResult as $inx => $row) {
|
||||
$status = $row['status'];
|
||||
$userFirstName = $row['first_name'];
|
||||
@ -623,128 +627,254 @@ class Notifications extends BaseController
|
||||
$this->logger->error('There is no subcription Name');
|
||||
continue;
|
||||
}
|
||||
echo ($inx+1).") #".$customerId." - Person Name : ".$fullName." ----- ( Expiry on ". date('d-m-Y', strtotime($expirydate)).") <br>";
|
||||
$response .= ($inx+1).") #".$customerId." - Person Name : ".$fullName." ----- ( Expiry on ". date('d/m/Y', strtotime($expirydate)).") <br>";
|
||||
if ($status === 'Approved') {
|
||||
# EXPIRY NOTIFY TEMPLATE EMAIL
|
||||
$emailTemplateName = $NotificationModel->getTempName('EXPIRY NOTIFY TEMPLATE EMAIL');
|
||||
if(empty($row['email'])){
|
||||
echo ($inx+1).") Email Not Available <br>";
|
||||
continue;
|
||||
}
|
||||
# EXPIRY NOTIFY TEMPLATE EMAIL
|
||||
$emailTemplateName = $NotificationModel->getTempName('EXPIRY NOTIFY TEMPLATE EMAIL');
|
||||
if(empty($row['email'])){
|
||||
$response .= ($inx+1).") Email Not Available <br>";
|
||||
continue;
|
||||
}
|
||||
|
||||
$existingcheck = $NotificationModel->checkEmailAlreadyExisting($row['email'],$customerId);
|
||||
$check_existing = 0;
|
||||
$check_date = "";
|
||||
$check_diff_days = "";
|
||||
$existingcheck = $NotificationModel->checkEmailAlreadyExisting($row['email'],$customerId);
|
||||
$check_existing = 0;
|
||||
$check_date = "";
|
||||
$check_diff_days = "";
|
||||
|
||||
if(!empty($existingcheck)){
|
||||
if(!empty($existingcheck)){
|
||||
|
||||
foreach ($existingcheck as $i => $r) {
|
||||
if($r['receiving_status'] == 1){
|
||||
$check_existing = 1;
|
||||
$check_date = $r['sent_time'];
|
||||
$sentTimestamp = strtotime($r['sent_time']);
|
||||
$provedTimestamp = strtotime($providedDate);
|
||||
foreach ($existingcheck as $i => $r) {
|
||||
if($r['receiving_status'] == 1){
|
||||
$check_existing = 1;
|
||||
$check_date = $r['sent_time'];
|
||||
$sentTimestamp = strtotime($r['sent_time']);
|
||||
$provedTimestamp = strtotime($providedDate);
|
||||
|
||||
|
||||
$diffInSeconds = abs($provedTimestamp - $sentTimestamp);
|
||||
$diffInDays = $diffInSeconds / (60 * 60 * 24);
|
||||
|
||||
$diffInSeconds = abs($provedTimestamp - $sentTimestamp);
|
||||
$diffInDays = $diffInSeconds / (60 * 60 * 24);
|
||||
|
||||
$check_diff_days = $diffInDays;
|
||||
$check_diff_days = $diffInDays;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($check_existing){
|
||||
echo ($inx+1).") Email already send on - ".date('d-m-Y h:i A', strtotime($check_date))."<br>";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (count($emailTemplateName) && !empty($emailTemplateName)) {
|
||||
$campaign_id = 1;
|
||||
# Insertion on History Email Means Campaign ID 1 Hardcoded
|
||||
$history_parents_data = ['campaign_id' => $campaign_id,'status' => 0];
|
||||
$history_parent_id = $NotificationModel->save_notification_history_parents($history_parents_data);
|
||||
|
||||
# Step 4: Prepare email content based on the template
|
||||
$emailContent = $emailTemplateName[0]['message'];
|
||||
if (isset($fullName)) {
|
||||
$emailContent = str_replace("{USER_NAME}", $fullName, $emailContent);
|
||||
if($check_existing){
|
||||
$response .= ($inx+1).") Email already send on - ".date('d/m/Y h:i A', strtotime($check_date))."<br>";
|
||||
continue;
|
||||
}
|
||||
if (isset($schemename)) {
|
||||
$emailContent = str_replace("{SCHEME_NAME}", $schemename, $emailContent);
|
||||
}
|
||||
if (isset($expirydate)) {
|
||||
$expiryon = $expirydate ? date('d-m-Y', strtotime($expirydate)) : '';
|
||||
$emailContent = str_replace("{EXPIRY_DATE}", $expiryon, $emailContent);
|
||||
$replaceContent = (int)$countdays == 0 ? 'expires today, ' : 'expiring on ';
|
||||
$emailContent = str_replace("expiring on", $replaceContent, $emailContent);
|
||||
}
|
||||
if (isset($membership_id)) {
|
||||
$emailContent = str_replace("{RENEWAL_LINK}", base_url() . 'subscription_renewal/' . $membership_id, $emailContent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$emailData = [
|
||||
'template_name' => 'EXPIRY NOTIFY TEMPLATE EMAIL',
|
||||
'recipient_email' => $row['email'],
|
||||
'subject' => 'Your Subscription Expiry Notification',
|
||||
'description' => $emailContent,
|
||||
];
|
||||
|
||||
if (count($emailTemplateName) && !empty($emailTemplateName)) {
|
||||
$campaign_id = 1;
|
||||
# Insertion on History Email Means Campaign ID 1 Hardcoded
|
||||
$history_parents_data = ['campaign_id' => $campaign_id,'status' => 0];
|
||||
$history_parent_id = $NotificationModel->save_notification_history_parents($history_parents_data);
|
||||
|
||||
$history_child_data = [ 'fkid' => $history_parent_id,
|
||||
'customer_id' => $customerId,
|
||||
'receiving_entity' => $row['email'],
|
||||
'receiving_status' => 0,
|
||||
'message' => $emailContent];
|
||||
# Step 5: Insertion on History Child
|
||||
$history_child_id = $NotificationModel->save_notification_history_child($history_child_data);
|
||||
# Step 4: Prepare email content based on the template
|
||||
$emailContent = $emailTemplateName[0]['message'];
|
||||
if (isset($fullName)) {
|
||||
$emailContent = str_replace("{USER_NAME}", $fullName, $emailContent);
|
||||
}
|
||||
if (isset($schemename)) {
|
||||
$emailContent = str_replace("{SCHEME_NAME}", $schemename, $emailContent);
|
||||
}
|
||||
if (isset($expirydate)) {
|
||||
$expiryon = $expirydate ? date('d-m-Y', strtotime($expirydate)) : '';
|
||||
$emailContent = str_replace("{EXPIRY_DATE}", $expiryon, $emailContent);
|
||||
$replaceContent = (int)$countdays == 0 ? 'expires today, ' : 'expiring on ';
|
||||
$emailContent = str_replace("expiring on", $replaceContent, $emailContent);
|
||||
}
|
||||
if (isset($membership_id)) {
|
||||
$link = base_url() . 'subscription_renewal/' . $membership_id;
|
||||
$emailContent = str_replace("{RENEWAL_LINK}", '<a href="'.$link.'" target="blank" >'.$link.'</a>', $emailContent);
|
||||
}
|
||||
|
||||
|
||||
# Step 6:Send email using NotificationHelper
|
||||
$emailResult = $notification->sendEmail($emailData);
|
||||
|
||||
$this->logger->error("EXPIRAY NOTIFY TEMPLATE EMAIL Email CID = ".$customerId." ".json_encode($emailResult));
|
||||
|
||||
if (isset($emailResult['success'])) {
|
||||
$history_msg = 'Email sent successfully';
|
||||
$history_child_updatedata = ['receiving_status'=>1,'result'=>$history_msg];
|
||||
$history_child_where = ['fkid' => $history_parent_id,'id' => (int)$history_child_id];
|
||||
$history_child_statement = $NotificationModel->update_notification_history_child($history_child_updatedata,$history_child_where);
|
||||
$this->logger->error($history_child_statement);
|
||||
$emailData = [
|
||||
'template_name' => 'EXPIRY NOTIFY TEMPLATE EMAIL',
|
||||
'recipient_email' => $row['email'],
|
||||
'subject' => 'Your Subscription Expiry Notification',
|
||||
'description' => $emailContent,
|
||||
];
|
||||
|
||||
|
||||
$history_parent_statement = $NotificationModel->update_notification_history_parent_status(['status' => 1],$history_parent_id,$campaign_id);
|
||||
$this->logger->error($history_parent_statement);
|
||||
echo ($inx+1).") ".$history_msg."<br>";
|
||||
$history_child_data = [ 'fkid' => $history_parent_id,
|
||||
'customer_id' => $customerId,
|
||||
'receiving_entity' => $row['email'],
|
||||
'receiving_status' => 0,
|
||||
'message' => $emailContent];
|
||||
# Step 5: Insertion on History Child
|
||||
$history_child_id = $NotificationModel->save_notification_history_child($history_child_data);
|
||||
|
||||
# Step 6:Send email using NotificationHelper
|
||||
$emailResult = $notification->sendEmail($emailData);
|
||||
|
||||
$this->logger->error("EXPIRAY NOTIFY TEMPLATE EMAIL Email CID = ".$customerId." ".json_encode($emailResult));
|
||||
|
||||
if (isset($emailResult['success'])) {
|
||||
$history_msg = 'Email sent successfully';
|
||||
$history_child_updatedata = ['receiving_status'=>1,'result'=>$history_msg];
|
||||
$history_child_where = ['fkid' => $history_parent_id,'id' => (int)$history_child_id];
|
||||
$history_child_statement = $NotificationModel->update_notification_history_child($history_child_updatedata,$history_child_where);
|
||||
$this->logger->error($history_child_statement);
|
||||
|
||||
$history_parent_statement = $NotificationModel->update_notification_history_parent_status(['status' => 1],$history_parent_id,$campaign_id);
|
||||
$this->logger->error($history_parent_statement);
|
||||
$response .= ($inx+1).") ".$history_msg."<br>";
|
||||
} else {
|
||||
$history_msg = (strtolower(gettype($emailResult)) == "string" ? $emailResult : json_encode($emailResult)) ;
|
||||
$history_child_updatedata = ['receiving_status'=>0,'result'=>$history_msg];
|
||||
$history_child_where = ['fkid' => $history_parent_id,'id' => (int)$history_child_id];
|
||||
$history_child_statement = $NotificationModel->update_notification_history_child($history_child_updatedata,$history_child_where);
|
||||
$this->logger->error($history_child_statement);
|
||||
|
||||
$history_parent_statement = $NotificationModel->update_notification_history_parent_status(['status' => 1],$history_parent_id,$campaign_id);
|
||||
$this->logger->error($history_parent_statement);
|
||||
$response .= ($inx+1).") Failed to send email <br>";
|
||||
}
|
||||
} else {
|
||||
$history_msg = (strtolower(gettype($emailResult)) == "string" ? $emailResult : json_encode($emailResult)) ;
|
||||
$history_child_updatedata = ['receiving_status'=>0,'result'=>$history_msg];
|
||||
$history_child_where = ['fkid' => $history_parent_id,'id' => (int)$history_child_id];
|
||||
$history_child_statement = $NotificationModel->update_notification_history_child($history_child_updatedata,$history_child_where);
|
||||
$this->logger->error($history_child_statement);
|
||||
|
||||
$history_parent_statement = $NotificationModel->update_notification_history_parent_status(['status' => 1],$history_parent_id,$campaign_id);
|
||||
$this->logger->error($history_parent_statement);
|
||||
echo ($inx+1).") Failed to send email <br>";
|
||||
$history_msg = 'There is no email template found by the name of EXPIRY NOTIFY TEMPLATE EMAIL';
|
||||
// $receiving_status = 0 ;
|
||||
$this->logger->error($history_msg);
|
||||
$response .= $history_msg."<br>";
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
$history_msg = 'There is no email template found by the name of EXPIRY NOTIFY TEMPLATE EMAIL';
|
||||
// $receiving_status = 0 ;
|
||||
$this->logger->error($history_msg);
|
||||
echo $history_msg."<br>";
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
echo ($inx+1).") Staus = ".$status." <br>";
|
||||
$response .= ($inx+1).") Staus = ".$status." <br>";
|
||||
$this->logger->error("status is Draft");
|
||||
}
|
||||
# EXPIRY NOTIFY TEMPLATE EMAIL Closed
|
||||
if ($status === 'Approved') {
|
||||
$existingcheck2 = $NotificationModel->checkEmailAlreadyExisting($userMobileNumber,$customerId);
|
||||
$check_existing2 = 0;
|
||||
$check_date2 = "";
|
||||
$check_diff_days2 = "";
|
||||
if(!empty($existingcheck2)){
|
||||
|
||||
foreach ($existingcheck2 as $i2 => $r2) {
|
||||
if($r2['receiving_status'] == 1){
|
||||
$check_existing2 = 1;
|
||||
$check_date2 = $r2['sent_time'];
|
||||
$sentTimestamp2 = strtotime($r2['sent_time']);
|
||||
$provedTimestamp2 = strtotime($providedDate);
|
||||
|
||||
|
||||
$diffInSeconds2 = abs($provedTimestamp2 - $sentTimestamp2);
|
||||
$diffInDays2 = $diffInSeconds2 / (60 * 60 * 24);
|
||||
|
||||
$check_diff_days2 = $diffInDays2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($check_existing2){
|
||||
$response .= ($inx+1).") whatsapp already send ".$check_date2."<br>";
|
||||
continue;
|
||||
}
|
||||
# EXPIRY NOTIFY TEMPLATE WHATSAPP
|
||||
$whatsappTemplateName = $NotificationModel->getTempName('EXPIRY NOTIFY TEMPLATE WHATSAPP');
|
||||
// print_r($whatsappTemplateName);die;
|
||||
if ((count($whatsappTemplateName) > 0) && !empty($whatsappTemplateName)) {
|
||||
$campaign_id = 2; // hardcoded because static Template.
|
||||
$history_parents_data = ['campaign_id' => 2,'status' => 0];
|
||||
$history_parent_id = $NotificationModel->save_notification_history_parents($history_parents_data);
|
||||
if (empty($userMobileNumber)) {
|
||||
$history_msg = 'There is no subscriber mobile number';
|
||||
$history_child_updatedata = ['receiving_status'=>0,'result'=>$history_msg];
|
||||
$history_child_where = ['fkid' => $history_parent_id,'id' => (int)$history_child_id];
|
||||
$history_child_statement = $NotificationModel->update_notification_history_child($history_child_updatedata,$history_child_where);
|
||||
$this->logger->error($history_child_statement);
|
||||
|
||||
$history_parent_statement = $NotificationModel->update_notification_history_parent_status(['status' => 1],$history_parent_id,$campaign_id);
|
||||
$this->logger->error($history_parent_statement);
|
||||
$this->logger->error($history_msg);
|
||||
$response .= ($inx+1).") ".$history_msg."<br>";
|
||||
continue;
|
||||
}
|
||||
# Insertion on History Whatsapp Means Campaign ID 2 Hardcoded
|
||||
$history_parents_data = ['campaign_id' => 2,'status' => 0];
|
||||
$history_parent_id = $NotificationModel->save_notification_history_parents($history_parents_data);
|
||||
|
||||
# Step 7: Prepare whatsapp content based on the template
|
||||
$whatsappContent = $whatsappTemplateName[0]['message'];
|
||||
if (isset($fullName)) {
|
||||
$whatsappContent = str_replace("{USER_NAME}", $fullName, $whatsappContent);
|
||||
}
|
||||
if (isset($schemename)) {
|
||||
$whatsappContent = str_replace("{SCHEME_NAME}", $schemename, $whatsappContent);
|
||||
}
|
||||
if (isset($expirydate)) {
|
||||
$expiryon = $expirydate ? date('d-m-Y', strtotime($expirydate)) : '';
|
||||
$whatsappContent = str_replace("{EXPIRY_DATE}", $expiryon, $whatsappContent);
|
||||
}
|
||||
if (isset($customerId)) {
|
||||
$whatsappContent = str_replace("{RENEWAL_LINK}", base_url() . 'subscription_renewal/' . $customerId, $whatsappContent);
|
||||
}
|
||||
# Step 8: Insertion on History Child for whatsapp
|
||||
$history_child_data = [ 'fkid' => $history_parent_id,
|
||||
'customer_id' => $customerId,
|
||||
'receiving_entity' => $userMobileNumber,
|
||||
'receiving_status' => 0,
|
||||
'message' => strip_tags(ltrim($whatsappContent))];
|
||||
$history_child_id = $NotificationModel->save_notification_history_child($history_child_data);
|
||||
|
||||
|
||||
# Step 8: Send Whatsapp using NotificationHelper
|
||||
$params = (object) Null;
|
||||
$url = SEND_WAAI_URL;
|
||||
$params->number = (int)'91' . $userMobileNumber;
|
||||
$params->type = "text";
|
||||
$params->message = strip_tags(ltrim($whatsappContent));
|
||||
$params->instance_id = $_ENV['WAAI_INSTANCE'];
|
||||
$params->access_token = $_ENV['WAAI_TOKEN'];
|
||||
$this->logger->error("EXPIRAY NOTIFY TEMPLATE WHATSAPP Request = " . json_encode($params));
|
||||
$this->logger->error("EXPIRAY NOTIFY TEMPLATE WHATSAPP Request type b4 = " . gettype($params));
|
||||
$whatsapp_result = $notification->sendWhatsAppMessage($url, "POST", $params);
|
||||
$receiving_status = $whatsapp_result['receiving_status'];
|
||||
$history_msg = strtolower(gettype($whatsapp_result)) == "string" ? $whatsapp_result : json_encode($whatsapp_result['reponse']);
|
||||
$history_child_updatedata = ['receiving_status'=>$receiving_status,'result'=>$history_msg];
|
||||
$history_child_where = ['fkid' => $history_parent_id,'id' => (int)$history_child_id];
|
||||
$history_child_statement = $NotificationModel->update_notification_history_child($history_child_updatedata,$history_child_where);
|
||||
$this->logger->error($history_child_statement);
|
||||
|
||||
$history_parent_statement = $NotificationModel->update_notification_history_parent_status(['status' => 1],$history_parent_id,$campaign_id);
|
||||
$this->logger->error($history_parent_statement);
|
||||
$this->logger->error("EXPIRAY NOTIFY TEMPLATE WHATSAPP Reponse = " . $history_msg);
|
||||
|
||||
if(strtolower(gettype($whatsapp_result)) == "string"){
|
||||
$response .= ($inx+1).") ".$whatsapp_result."<br>";
|
||||
}
|
||||
else{
|
||||
$result = json_encode($whatsapp_result['reponse']);
|
||||
$decodedResult = json_decode($result, true);
|
||||
if ($decodedResult && isset($decodedResult['message']['key']['remoteJid'])) {
|
||||
$remoteJid = $decodedResult['message']['key']['remoteJid'];
|
||||
$this->logger->error("EXPIRAY NOTIFY TEMPLATE WHATSAPP Remote Jid = " . $remoteJid);
|
||||
$response .= ($inx+1).") Whatsapp sent successfully <br>";
|
||||
} else {
|
||||
// echo "Failed to extract remoteJid";
|
||||
$this->logger->error("EXPIRAY NOTIFY TEMPLATE WHATSAPP Failed to extract remoteJid ");
|
||||
$response .= ($inx+1).") Failed to send Whatsapp <br>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// $receiving_status = 0;
|
||||
$history_msg = 'There is no Whatsapp template found by the name of EXPIRAY NOTIFY TEMPLATE WHATSAPP ';
|
||||
$this->logger->error($history_msg);
|
||||
$response .= "There is no Whatsapp template <br>";
|
||||
continue;
|
||||
}
|
||||
# EXPIRY NOTIFY TEMPLATE WHATSAPP Closed
|
||||
}
|
||||
else{
|
||||
$this->logger->error("status is draft");
|
||||
}
|
||||
# Loop Closed
|
||||
echo "Process Completed <br>";
|
||||
}
|
||||
$response .= "Process Completed <br></pre>";
|
||||
return $this->response->setBody($response);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -281,9 +281,10 @@ public function download_details()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function notify_the_expiry_subscribers(){
|
||||
$data['page_name'] = 'Notify the Expiry Subscribers';
|
||||
$this->render_page('notify_the_expiry_subscribers',$data);
|
||||
}
|
||||
|
||||
}
|
||||
// public function generate_pdf()
|
||||
|
||||
@ -350,14 +350,14 @@ public function getJoinedData($where, $orderby = [])
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function insertSubscriptionData($data,$invoice_status)
|
||||
public function insertupdateSubscriptionData($data,$invoice_status)
|
||||
{
|
||||
if (!empty($data)) {
|
||||
$invoice_id = $data['invoice_id'];
|
||||
$customer_id = $data['customer_id'];
|
||||
$scheme_id = $data['scheme_id'];
|
||||
$data['isactive'] = $invoice_status === 'Approved' ? 1 : 0 ;
|
||||
$where = ['invoice_id' => $invoice_id,'customer_id' => $customer_id,'scheme_id' => $scheme_id];
|
||||
$where = ['invoice_id' => $invoice_id]; // invoice id refer with srinivasan // initally invoice id, scheme id and customer id
|
||||
$query = $this->db->table('subscription')->select('sub_id')->where($where)->get()->getRow();
|
||||
|
||||
if (!empty($query)) {
|
||||
|
||||
@ -25,18 +25,18 @@
|
||||
<?php if (session()->getFlashdata('success')) : ?>
|
||||
<div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
|
||||
<?php endif; ?>
|
||||
<form class="needs-validation" novalidate method="post" enctype="multipart/form-data" action="<?= base_url() . "insert_books"; ?>" id="myForm">
|
||||
<form class="parsley-examples needs-validation" novalidate method="post" enctype="multipart/form-data" action="<?= base_url() . "insert_books"; ?>" id="myForm">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="title" class="col-form-label">Book Name<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="title" name="title" value="<?= isset($details['title']) ? $details['title'] : '' ?>" placeholder="Book Name" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="author" class="col-form-label">Author<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="author" name="author" value="<?= isset($details['author']) ? $details['author'] : '' ?>" placeholder="Author" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
@ -44,12 +44,12 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="publisher" class="col-form-label">Publisher Name<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="publisher" name="publisher" placeholder="Publisher Name" value="<?= isset($details['publisher']) ? $details['publisher'] : '' ?>" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="publication_date" class="col-form-label">Publication Date<span class="text-danger"> *</span></label>
|
||||
<input type="date" class="form-control" id="publication_date" name="publication_date" value="<?= isset($details['publication_date']) ? $details['publication_date'] : '' ?>" max="<?= date('Y-m-d'); ?>" required placeholder="Publication Date">
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -61,7 +61,7 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="isbn_code" class="col-form-label">ISBN Code<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="isbn_code" name="isbn_code" value="<?= isset($details['isbn_code']) ? $details['isbn_code'] : '' ?>" placeholder="ISBN Code" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -77,7 +77,7 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="price" class="col-form-label">Price<span class="text-danger"> *</span></label>
|
||||
<input type="number" class="form-control" id="price" name="price" placeholder="Price" required value="<?= isset($details['price']) ? $details['price'] : '' ?>" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -183,19 +183,21 @@
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
var form = event.target;
|
||||
document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
var form = event.target;
|
||||
|
||||
if (form.checkValidity() === false) {
|
||||
// Check if form is valid
|
||||
if (!form.checkValidity()) {
|
||||
form.reportValidity(); // Display validation error messages
|
||||
event.preventDefault(); // Prevent form submission if it's not valid
|
||||
$('#submitBtn').prop('disabled', false); // Re-enable the button
|
||||
|
||||
form.reportValidity(); // Display validation error messages
|
||||
event.preventDefault(); // Prevent form submission if it's not valid
|
||||
$('#submitBtn').prop('disabled', false);
|
||||
} else {
|
||||
|
||||
$('#submitBtn').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
// Display custom alert message
|
||||
alert('Please fill out all required fields correctly.');
|
||||
} else {
|
||||
$('#submitBtn').prop('disabled', true); // Disable the button to prevent duplicate submissions
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
const DateInput = document.getElementById("publication_date");
|
||||
|
||||
@ -26,35 +26,31 @@
|
||||
<!-- Customer Details Tab -->
|
||||
<div class="tab-pane fade show active" id="customerDetails" role="tabpanel" aria-labelledby="customerDetails-tab">
|
||||
<!-- Customer details form fields -->
|
||||
<form class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_customer"; ?>" id="myForm" name="myForm" onsubmit="myFunction(event)">
|
||||
<form class="needs-validation parsley-examples" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_customer"; ?>" id="myForm" name="myForm" onsubmit="myFunction(event)">
|
||||
<!-- <img src="<?= base_url() . "public/assets/images/plugins/loading.gif" ?>" alt="loader1" style="display:none; height:30px; width:auto;" id="loaderImg"> -->
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="cfname" class="col-form-label">First Name<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="cfname" name="cfname" value="<?= isset($customer['first_name']) ? $customer['first_name'] : '' ?>" placeholder="First Name" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="csname" class="col-form-label">Last Name<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" name="csname" value="<?= isset($customer['last_name']) ? $customer['last_name'] : '' ?>" placeholder="Last Name" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
<input type="text" class="form-control" name="csname" value="<?= isset($customer['last_name']) ? $customer['last_name'] : '' ?>" placeholder="Last Name" required />
|
||||
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="cmail" class="col-form-label">Email</label>
|
||||
<input type="text" class="form-control" id="cmail" name="cmail" value="<?= isset($customer['email']) ? $customer['email'] : '' ?>" placeholder="Email" onkeyup="validateEmail(this.value)" onchange="checkExisting(this.value,'email','cmail')" />
|
||||
<label for="cmail" class="col-form-label">Email<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="cmail" name="cmail" value="<?= isset($customer['email']) ? $customer['email'] : '' ?>" placeholder="Email" onkeyup="validateEmail(this.value)" onchange="checkExisting(this.value,'email','cmail')" required />
|
||||
<span id="emailValidationMessage"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="cmobile" class="col-form-label">Mobile/Landline<span class="text-danger"> *</span></label>
|
||||
<div class="input-group mb-2">
|
||||
<div class="input-group-prepend">
|
||||
|
||||
</div>
|
||||
|
||||
<input type="text" class="form-control" id="cmobile" name="cmobile" value="<?= isset($customer['mobile_no']) ? $customer['mobile_no'] : '' ?>" placeholder="Mobile Number (Enter only numbers)" required minlength="10" onkeypress="return restriction(event)" onchange="checkExisting(this.value,'mobile_no','cmobile')" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
|
||||
<span id="mobileValidationMessage"></span>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
@ -111,12 +107,12 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="baddress1" class="col-form-label">Address 1<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="baddress1" name="baddress1[]" placeholder="Address (eg : 1234 Main St)" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="baddress2" class="col-form-label">Address 2<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="baddress2" name="baddress2[]" placeholder="Address (eg : 1234 Main St)" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
@ -130,13 +126,13 @@
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<div id="billinput" style="display: block">
|
||||
<label for="bistate" class="col-form-label">State</label>
|
||||
<input type="text" class="form-control" id="bistate" name="bistate[]" placeholder="State" />
|
||||
<!-- <div class="invalid-feedback"> Please provide. </div> -->
|
||||
|
||||
</div>
|
||||
<div id="billdropdown" style="display: none">
|
||||
<label for="bdstate" class="col-form-label">State</label>
|
||||
@ -155,12 +151,12 @@
|
||||
<div class="form-group col-md-3">
|
||||
<label for="bcity" class="col-form-label">City<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="bcity" name="bcity[]" placeholder="City" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="bzip" class="col-form-label">Postal Code<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="bzip" name="bzip[]" placeholder="Postal Code" required pattern="\d*" maxlength="10" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="bcustomer_address_id" name="bcustomer_address_id[]" placeholder="hidden for billing customer address id" />
|
||||
@ -183,12 +179,12 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="saddress1" class="col-form-label">Address 1<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="saddress1" name="saddress1[]" placeholder="Address (eg : 1234 Main St)" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="saddress2" class="col-form-label">Address 2<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="saddress2" name="saddress2[]" placeholder="Address (eg : 1234 Main St)" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
@ -203,7 +199,7 @@
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="" class="col-form-label">State</label>
|
||||
@ -221,12 +217,12 @@
|
||||
<div class="form-group col-md-3">
|
||||
<label for="scity" class="col-form-label">City<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="scity" name="scity[]" placeholder="City" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="szip" class="col-form-label">Postal Code<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="szip" name="szip[]" placeholder="Postal Code" required pattern="\d*" maxlength="10" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -555,17 +551,33 @@
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
var form = event.target;
|
||||
if (form.checkValidity() === false) {
|
||||
// document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
// var form = event.target;
|
||||
|
||||
// // Check if form is valid
|
||||
// if (!form.checkValidity()) {
|
||||
// event.preventDefault(); // Prevent form submission
|
||||
// form.reportValidity(); // Display validation error messages
|
||||
// $('#submitBtn').prop('disabled', false); // Re-enable the button
|
||||
// } else {
|
||||
// $('#submitBtn').prop('disabled', true); // Disable the button to prevent duplicate submissions
|
||||
// }
|
||||
// });
|
||||
document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
var form = event.target;
|
||||
|
||||
// Check if form is valid
|
||||
if (!form.checkValidity()) {
|
||||
event.preventDefault(); // Prevent form submission
|
||||
$('#submitBtn').prop('disabled', false); // Re-enable the button
|
||||
|
||||
// Display custom alert message
|
||||
alert('Please fill out all required fields correctly.');
|
||||
} else {
|
||||
$('#submitBtn').prop('disabled', true); // Disable the button to prevent duplicate submissions
|
||||
}
|
||||
});
|
||||
|
||||
form.reportValidity(); // Display validation error messages
|
||||
event.preventDefault(); // Prevent form submission if it's not valid
|
||||
$('#submitBtn').prop('disabled', false);
|
||||
} else {
|
||||
$('#submitBtn').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function validateEmail(email) {
|
||||
|
||||
@ -91,6 +91,21 @@ input[type=number] {
|
||||
z-index: 1050; /* Ensure it appears above other content */
|
||||
}
|
||||
|
||||
#invoiceDate~.parsley-errors-list{
|
||||
position: absolute;
|
||||
top:35px;
|
||||
}
|
||||
#customerName~.parsley-errors-list{
|
||||
position: relative;
|
||||
top: 70px !important;
|
||||
z-index: 0;
|
||||
}
|
||||
#loadShippingDropdown~.parsley-errors-list{
|
||||
position: relative;
|
||||
top: 70px !important;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
<?php $flag_name = $invoice_type === '1' ? " Books" : " Scheme";
|
||||
|
||||
@ -124,7 +139,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
|
||||
<div class="card-body">
|
||||
<br>
|
||||
<form method="POST" enctype="multipart/form-data" action="<?= base_url() . "save_invoice"; ?>" id="myForm">
|
||||
|
||||
<!-- class="parsley-examples" -->
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
@ -147,7 +162,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
|
||||
|
||||
<?php } else { ?>
|
||||
<label for="customerName">Customer Name<span class="text-danger"> *</span></label>
|
||||
<select class="form-control" id="customerName" name="customer_name" required data-toggle="select2" onchange="get_customer_billing_details(this.value); get_customer_membership_details(this.value)">
|
||||
<select class="form-control" id="customerName" name="customer_name" required data-toggle="select2" onchange="get_customer_billing_details(this.value); get_customer_membership_details(this.value)" >
|
||||
<option value="">Select a customer</option>
|
||||
<?php if ($invoice_type === '1') { // invoice means Add new costomers;
|
||||
?>
|
||||
@ -171,8 +186,8 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-5">
|
||||
<label for="loadShippingDropdown">Shipping Address</label>
|
||||
<select class="form-control" id="loadShippingDropdown" name="shipping_address_id" data-toggle="select2" onchange="get_customer_shipping_details(this.value)">
|
||||
<label for="loadShippingDropdown">Shipping Address<span class="text-danger"> *</span></label>
|
||||
<select class="form-control" id="loadShippingDropdown" name="shipping_address_id" data-toggle="select2" onchange="get_customer_shipping_details(this.value)" required>
|
||||
<option value="">Select an address</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -245,7 +260,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
|
||||
<label for="tosubcription">To Subscription<span class="text-danger"> *</span></label>
|
||||
<!-- <input type="date" class="form-control" id="tosubcription" name="to_subscription" value="<?= $formattedtosubdate; ?>" required> -->
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="tosubcription" name="to_subscription" value="<?= $formattedtosubdate; ?>" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true">
|
||||
<input type="text" class="form-control" id="tosubcription" name="to_subscription" value="<?= $formattedtosubdate; ?>" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true" required>
|
||||
<div class="input-group-append" style="margin-left: -11px;">
|
||||
<span class="input-group-text" style="background-color: #37cde6;color:#fff;">
|
||||
<i class="ri-calendar-event-fill" style="position: relative;left: 4px;"></i>
|
||||
@ -551,7 +566,6 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
|
||||
<div class="input-group-text">+91</div>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="cus_mobile_no" placeholder="Mobile Number (Enter only numbers)" maxlength="10" onkeypress="return restriction(event)" onchange="checkExisting(this.value,'mobile_no','cus_mobile_no')" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<span id="mobileValidationMessage"></span>
|
||||
</div>
|
||||
@ -723,7 +737,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bookName">Book Name<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="bookName" name="bookName" required>
|
||||
<input type="text" class="form-control" id="bookName" name="bookName" required />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bookPrice">Price<span class="text-danger"> *</span></label>
|
||||
@ -735,19 +749,16 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
|
||||
<div class="form-group col-md-6">
|
||||
<label for="publication_date" class="col-form-label">Publication Date<span class="text-danger"> *</span></label>
|
||||
<input type="date" class="form-control" id="publication_date" name="publication_date" value="<?= isset($details['publication_date']) ? $details['publication_date'] : '' ?>" max="<?= date('Y-m-d'); ?>" required placeholder="Publication Date">
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="isbn_code" class="col-form-label">ISBN Code</label>
|
||||
<input type="text" class="form-control" id="isbn_code" name="isbn_code" placeholder="ISBN Code" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="publisher" class="col-form-label">Publisher Name</label>
|
||||
<input type="text" class="form-control" id="publisher" name="publisher" placeholder="Publisher Name" value="<?= isset($details['publisher']) ? $details['publisher'] : '' ?>" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="publishers_code" class="col-form-label">Publisher Code<span class="text-danger"> *</span></label>
|
||||
@ -1697,13 +1708,18 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
|
||||
</script>
|
||||
<script>
|
||||
document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
console.log("submit event");
|
||||
var form = event.target;
|
||||
var status = document.getElementById('status').value;
|
||||
var invoice_type = document.getElementById('invoice_type').value;
|
||||
if (form.checkValidity() === false) {
|
||||
if (!form.checkValidity()) {
|
||||
form.reportValidity(); // Display validation error messages
|
||||
event.preventDefault(); // Prevent form submission if it's not valid
|
||||
this.classList.add('was-validated');
|
||||
|
||||
|
||||
if (status == "Draft") {
|
||||
alert('Please fill out all required fields correctly.');
|
||||
$('#saveDraftButton').prop('disabled', false);
|
||||
$('#saveApprovedButton').prop('disabled', false);
|
||||
$('#saveapproved').prop('disabled', false);
|
||||
|
||||
47
app/Views/notify_the_expiry_subscribers.php
Executable file
47
app/Views/notify_the_expiry_subscribers.php
Executable file
@ -0,0 +1,47 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body"><br>
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<input type="number" class="form-control" id="params" name="params" placeholder="Number of Days" required />
|
||||
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<button type="button" id="callajax" class="btn btn-primary" onclick="sendsms()">Send Message</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<br>
|
||||
<div class="col-md-12" style="margin: 15px;" id="target-div"></div>
|
||||
</div>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div><!-- end row-->
|
||||
<script>
|
||||
function sendsms(){
|
||||
var params = $("#params").val();
|
||||
|
||||
if(params && params > 0){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "<?= base_url() . 'getExpCustomerDetail/'?>"+params,
|
||||
success: function(response) {
|
||||
$('#target-div').html(response); // Insert raw HTML into the target div
|
||||
$("#params").val('');
|
||||
console.log(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error("AJAX Error:", error);
|
||||
}
|
||||
});
|
||||
|
||||
}else{
|
||||
alert("Invalid Numbers");
|
||||
$("#params").val('');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -4,7 +4,7 @@
|
||||
<div class="card-body">
|
||||
<h4 class="header-title"><?= $page_name; ?></h4>
|
||||
<p class="sub-header"> </p>
|
||||
<form class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_scheme"; ?>" id="myForm">
|
||||
<form class="parsley-examples needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_scheme"; ?>" id="myForm">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
@ -21,7 +21,7 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="sduration" class="col-form-label">Duration<span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" name="sduration" value="<?= isset($scheme['duration']) ? $scheme['duration'] : '' ?>" placeholder="Duration In Months(ex 1)" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="sku" class="col-form-label">SKU ID</label>
|
||||
@ -73,16 +73,18 @@
|
||||
<!-- end row -->
|
||||
<script>
|
||||
document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
var form = event.target;
|
||||
|
||||
if (form.checkValidity() === false) {
|
||||
|
||||
form.reportValidity(); // Display validation error messages
|
||||
event.preventDefault(); // Prevent form submission if it's not valid
|
||||
$('#submitBtn').prop('disabled', false);
|
||||
} else {
|
||||
|
||||
$('#submitBtn').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
var form = event.target;
|
||||
|
||||
// Check if form is valid
|
||||
if (!form.checkValidity()) {
|
||||
form.reportValidity(); // Display validation error messages
|
||||
event.preventDefault(); // Prevent form submission if it's not valid
|
||||
$('#submitBtn').prop('disabled', false); // Re-enable the button
|
||||
|
||||
// Display custom alert message
|
||||
alert('Please fill out all required fields correctly.');
|
||||
} else {
|
||||
$('#submitBtn').prop('disabled', true); // Disable the button to prevent duplicate submissions
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@ -86,7 +86,7 @@
|
||||
$message = "Expires in $daysRemaining days";
|
||||
} else {
|
||||
$class = 'text-success';
|
||||
$message = "Expired in $daysRemaining days";
|
||||
$message = "Expires in $daysRemaining days";
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
|
||||
@ -184,12 +184,30 @@
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'sadmin') : ?>
|
||||
<li>
|
||||
<li>
|
||||
<a href="#subscribersLayouts" data-toggle="collapse">
|
||||
<i class="ri-shield-user-line"></i>
|
||||
<span> Members </span>
|
||||
<span class="menu-arrow"></span>
|
||||
</a>
|
||||
<div class="collapse" id="subscribersLayouts">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="<?= base_url()."subscribers_list"; ?>">Membership list</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url()."notify_the_expiry_subscribers"; ?>">Send Expiry message</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<!-- <li>
|
||||
<a href="<?= base_url()."subscribers_list"; ?>">
|
||||
<i class="ri-shield-user-line"></i>
|
||||
<span>Members </span>
|
||||
</a>
|
||||
</li>
|
||||
</li> -->
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
|
||||
<li>
|
||||
|
||||
@ -237,17 +237,21 @@
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
|
||||
document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
var form = event.target;
|
||||
if (form.checkValidity() === false) {
|
||||
form.reportValidity(); // Display validation error messages
|
||||
event.preventDefault(); // Prevent form submission if it's not valid
|
||||
$('#submitBtn').prop('disabled', false);
|
||||
} else {
|
||||
$('#submitBtn').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
var form = event.target;
|
||||
|
||||
// Check if form is valid
|
||||
if (!form.checkValidity()) {
|
||||
form.reportValidity(); // Display validation error messages
|
||||
event.preventDefault(); // Prevent form submission if it's not valid
|
||||
$('#submitBtn').prop('disabled', false); // Re-enable the button
|
||||
|
||||
// Display custom alert message
|
||||
alert('Please fill out all required fields correctly.');
|
||||
} else {
|
||||
$('#submitBtn').prop('disabled', true); // Disable the button to prevent duplicate submissions
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<!-- Modify the existing JavaScript code -->
|
||||
<script>
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user