ps
This commit is contained in:
parent
d741aa6c73
commit
66a9163422
@ -114,6 +114,9 @@ define('order_column', ["invoice_id","wp_api_order_id","invoice_child_id"]);
|
||||
|
||||
define('order_child','invoiceitems');
|
||||
define('order_child_column', ["invoice_id","wp_api_line_items_id","customer_id"]);
|
||||
|
||||
|
||||
define('WAAI_TOKEN', '650be030cedb3');
|
||||
define('WAAI_INSTANCE', '650C383B67BC7');
|
||||
define('SEND_WAAI_URL', 'https://waai.in/api/send');
|
||||
|
||||
|
||||
|
||||
@ -104,11 +104,10 @@ $routes->add('approve_invoice/(:num)', 'Invoice::approve_invoice/$1');
|
||||
$routes->get('generate_invoice_pdf/(:num)', 'Invoice::generate_invoice_pdf/$1');
|
||||
|
||||
|
||||
# Api integration Routes
|
||||
# Notifications Routes
|
||||
$routes->get('send_whatsapp_message/', 'Notifications::send_whatsapp_message');
|
||||
$routes->post('whatsapp_notifications/', 'Notifications::whatsapp_notifications');
|
||||
|
||||
$routes->match(['post', 'get'], 'custom_notifications', 'Notifications::mail_notifications');
|
||||
$routes->post('whatsapp_custom_notifications/', 'Notifications::whatsapp_custom_notifications');
|
||||
$routes->match(['post', 'get'], 'mail_custom_notifications', 'Notifications::mail_custom_notifications');
|
||||
|
||||
# Api integration Routes
|
||||
$routes->post('api/(:any)', 'ApiIntegration::api_integration/$1');
|
||||
|
||||
@ -45,20 +45,23 @@ class Notifications extends BaseController
|
||||
public function send_whatsapp_message() {
|
||||
helper('apiIntegration');
|
||||
$params = (object) Null;
|
||||
$this->access_token = "650be030cedb3";
|
||||
// $this->instance_id = $this->get_whatsapp_instance();
|
||||
$this->instance_id = "650C383B67BC7";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
$this->logger->info("Whatsapp : sending message instance id = ".$this->instance_id);
|
||||
$params->number = 916369084112;
|
||||
$params->type = "text";
|
||||
$params->message = "TestingFromVBPYUIO";
|
||||
$params->instance_id = $this->instance_id;
|
||||
$params->access_token = $this->access_token;
|
||||
$params->instance_id = WAAI_TOKEN;
|
||||
$params->access_token = WAAI_INSTANCE;
|
||||
$this->logger->info("Whatsapp : sending message request type b4 = ".gettype($params));
|
||||
//$url = "https://waai.in/api/send?number=916369084112&type=text&message=helper&instance_id=650C383B67BC7&access_token=650be030cedb3";
|
||||
$url = "https://waai.in/api/send";
|
||||
$message = perform_whatsapp_request($url,"POST",$params);
|
||||
$message = perform_whatsapp_request($url,"POST",$params);
|
||||
// https://waai.in/api/send?number=91639084112&type=text&message=helper&instance_id=650C383B67BC7&access_token=650be030cedb3/r/n{"status":"success","message":{"key":{"remoteJid":"91639084112@c.us","fromMe":true,"id":"BAE540383CE30F06"},"message":{"extendedTextMessage":{"text":"helper"}},"messageTimestamp":"1695362314"}}
|
||||
// {"status":"success","message":{"key":{"remoteJid":"916369084112@c.us","fromMe":true,"id":"BAE500BBE10A0AC0"},"message":{"extendedTextMessage":{"text":"TestingFromVBP"}},"messageTimestamp":"1695362020"}}
|
||||
// {"status":"error","message":"Access token is required"}
|
||||
@ -72,7 +75,7 @@ class Notifications extends BaseController
|
||||
|
||||
|
||||
## Email Section :
|
||||
public function mail_notifications()
|
||||
public function mail_custom_notifications()
|
||||
{ $successMessage = session()->getFlashdata('success');
|
||||
$validationErrors = session()->getFlashdata('error');
|
||||
$data['page_name'] = 'Custom Notifications';
|
||||
@ -106,22 +109,21 @@ class Notifications extends BaseController
|
||||
if ($email->send()) {
|
||||
$this->logger->info('Email sent successfully');
|
||||
$successMessage = 'Email sent successfully';
|
||||
$data['successMessage'] = $successMessage;
|
||||
} else {
|
||||
throw new \Exception('Email not sent. Please try again.');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error('Error sending email: ' . $e->getMessage());
|
||||
$validationErrors = 'Error sending email: ' . $e->getMessage();
|
||||
$data['validationErrors'] = $validationErrors;
|
||||
}
|
||||
}
|
||||
|
||||
$data['successMessage'] = $successMessage;
|
||||
$data['validationErrors'] = $validationErrors;
|
||||
|
||||
$this->render_page('notifications_form', $data);
|
||||
}
|
||||
|
||||
public function whatsapp_notifications(){
|
||||
public function whatsapp_custom_notifications(){
|
||||
$successMessage = session()->getFlashdata('success');
|
||||
$validationErrors = session()->getFlashdata('error');
|
||||
$data['page_name'] = 'Custom Notifications';
|
||||
@ -136,29 +138,21 @@ class Notifications extends BaseController
|
||||
try {
|
||||
$this->logger->info("Whatsapp : sending message instance id = ".$this->instance_id);
|
||||
$params->number = (int)'91'.$records['mobile'];
|
||||
$params->type = "text";
|
||||
$params->type = $records['type'] == "" ? "text" : $records['type'];
|
||||
$params->instance_id = WAAI_INSTANCE;
|
||||
$params->access_token = WAAI_TOKEN;
|
||||
$params->message = $records['description'];
|
||||
$params->instance_id = $this->instance_id;
|
||||
$params->access_token = $this->access_token;
|
||||
if($records['type'] == 'media'){ $params->media_url = $records['media_url'];}
|
||||
$this->logger->info("Whatsapp : sending message request type b4 = ".gettype($params));
|
||||
//$url = "https://waai.in/api/send?number=916369084112&type=text&message=helper&instance_id=650C383B67BC7&access_token=650be030cedb3";
|
||||
$url = "https://waai.in/api/send";
|
||||
$successMessage = perform_whatsapp_request($url,"POST",$params);
|
||||
// https://waai.in/api/send?number=91639084112&type=text&message=helper&instance_id=650C383B67BC7&access_token=650be030cedb3/r/n{"status":"success","message":{"key":{"remoteJid":"91639084112@c.us","fromMe":true,"id":"BAE540383CE30F06"},"message":{"extendedTextMessage":{"text":"helper"}},"messageTimestamp":"1695362314"}}
|
||||
// {"status":"success","message":{"key":{"remoteJid":"916369084112@c.us","fromMe":true,"id":"BAE500BBE10A0AC0"},"message":{"extendedTextMessage":{"text":"TestingFromVBP"}},"messageTimestamp":"1695362020"}}
|
||||
// {"status":"error","message":"Access token is required"}
|
||||
|
||||
$successMessage = perform_whatsapp_request(SEND_WAAI_URL,"POST",$params);
|
||||
$this->logger->info("Whatsapp : Reponse = ".$successMessage);
|
||||
$data['successMessage'] = $successMessage;
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("An error occurred: " . $e->getMessage());
|
||||
$validationErrors = "An error occurred: " . $e->getMessage();
|
||||
$data['validationErrors'] = $validationErrors;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$data['successMessage'] = $successMessage;
|
||||
$data['validationErrors'] = $validationErrors;
|
||||
|
||||
}
|
||||
$this->render_page('notifications_form', $data);
|
||||
}
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
function perform_whatsapp_request($url,$method,$data){
|
||||
log_message('INFO',"PerformWhatsappRequest : request url = ".$url);
|
||||
log_message('INFO',"PerformWhatsappRequest : request data type = ".$data);
|
||||
log_message('INFO',"PerformWhatsappRequest : method = ".$method);
|
||||
// log_message('INFO',"PerformWhatsappRequest : request url = ".$url);
|
||||
// log_message('INFO',"PerformWhatsappRequest : request data type = ".$data);
|
||||
// log_message('INFO',"PerformWhatsappRequest : method = ".$method);
|
||||
try{
|
||||
$curl = curl_init();
|
||||
$headers = array('Content-Type:application/json');
|
||||
@ -28,19 +28,19 @@ function perform_whatsapp_request($url,$method,$data){
|
||||
curl_setopt( $curl,CURLOPT_RETURNTRANSFER, true );
|
||||
curl_setopt( $curl,CURLOPT_SSL_VERIFYPEER, true );
|
||||
$curl_exec = curl_exec($curl);
|
||||
log_message('INFO',"PerformWhatsappRequest : reponse = ".$curl_exec);
|
||||
// log_message('INFO',"PerformWhatsappRequest : reponse = ".$curl_exec);
|
||||
$http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
if ($http_status === 200) {
|
||||
$result = json_decode($curl_exec);
|
||||
if ($result->status === "error") {
|
||||
log_message('ERROR',"PerformWhatsappRequest : error = ".$result->message);
|
||||
// log_message('ERROR',"PerformWhatsappRequest : error = ".$result->message);
|
||||
throw new Exception($result->message);
|
||||
}else{
|
||||
$final_result = "Success";
|
||||
}
|
||||
}else{
|
||||
$curl_errno= curl_errno($curl);
|
||||
log_message('ERROR',"PerformWhatsappRequest : curl error = ".$curl_errno);
|
||||
// log_message('ERROR',"PerformWhatsappRequest : curl error = ".$curl_errno);
|
||||
throw new Error("Errno returned ".$curl_errno);
|
||||
}
|
||||
curl_close($curl);
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<div class="row">
|
||||
<div class="col-xl-3 col-md-6">
|
||||
<a href="<?= base_url()."send_whatsapp_message"; ?>" class="btn btn-success waves-effect"> <span> <i class="mdi mdi-gesture-swipe-down"></i></span> Whatsapp Api integration </a>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
|
||||
@ -1,165 +1,190 @@
|
||||
<style>
|
||||
/* Show the form section by default */
|
||||
#mailFormDiv {display: none;}
|
||||
#whatsappFormDiv {display: none;}
|
||||
/* Show the form section by default */
|
||||
#mailFormDiv { display: none; }
|
||||
#whatsappFormDiv { display: none; }
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="col-xl-4 col-sm-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="media">
|
||||
<div class="avatar-md mr-5">
|
||||
<div class="avatar-title bg-light rounded-circle">
|
||||
<img src="<?= base_url()."public/assets/images/brands/gmail.png"?>" alt="logo" class="avatar-sm rounded-circle">
|
||||
</div>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<h4 style="margin: 18px 0;"><a id="showMailForm" class="text-dark">Mail Custom Notification</a></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-4 col-sm-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="media">
|
||||
<div class="avatar-md mr-5">
|
||||
<div class="avatar-title bg-light rounded-circle">
|
||||
<img src="<?= base_url()."public/assets/images/brands/whatsapp.png"?>" alt="logo" class="avatar-sm rounded-circle">
|
||||
</div>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<h4 style="margin: 18px 0;"><a id="showWhatsappForm" class="text-dark">Whatsapp Custom Notification</a></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<a class="dropdown-icon-item" id="showMailLink">
|
||||
<img src="<?= base_url() . "public/assets/images/brands/gmail.png" ?>" alt="mail">
|
||||
<span>Mail Custom Notification</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col">
|
||||
<a class="dropdown-icon-item" id="showWhatsappLink">
|
||||
<img src="<?= base_url() . "public/assets/images/brands/whatsapp.png" ?>" alt="whatsapp">
|
||||
<span>Whatsapp Custom Notification</span>
|
||||
</a>
|
||||
</div>
|
||||
<!-- <div class="col">
|
||||
<a class="dropdown-icon-item" href="<?= base_url()."send_whatsapp_message"; ?>">
|
||||
<img src="<?= base_url() . "public/assets/images/brands/whatsapp.png" ?>" alt="whatsapp">
|
||||
<span>Whatsapp Static Notification</span>
|
||||
</a>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="mailFormDiv" class="row">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title"><?= "Mail Custom Notification" ?></h4>
|
||||
<?php if (isset($validationErrors)) : ?>
|
||||
<span class="widget-simple text-center">
|
||||
<div class="media-body align-self-center font-24 avatar-title">
|
||||
<p style="color: #f1556c!important;" class="mt-0" style><?= $validationErrors; ?></p>
|
||||
</div>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<h4 class="header-title"><?= $page_name; ?></h4>
|
||||
</br>
|
||||
<div id="textDiv">
|
||||
<span class="widget-simple text-center">
|
||||
<div class="media-body align-self-center font-24 avatar-title">
|
||||
<?php if (isset($validationErrors)) { ?>
|
||||
<p style="color: #f1556c!important;" class="mt-0" style><?= $validationErrors; ?></p>
|
||||
<?php } elseif (isset($successMessage)) { ?>
|
||||
<p style="color: #0aef14!important;" class="mt-0" style><?= $successMessage; ?></p>
|
||||
<?php } else { ?>
|
||||
<p style="color: #0a0a0a!important;" class="mt-0" style><?= "Please Choose Your Choice....."; ?></p>
|
||||
<?php } ?>
|
||||
|
||||
<form role="form" class="parsley-examples" method="POST" enctype="multipart/form-data" action="<?= base_url() . "mail_notifications"; ?>">
|
||||
<div class="form-group row">
|
||||
<label for="recipient" class="col-4 col-form-label">Recipient Email</label>
|
||||
<div class="col-7">
|
||||
<input type="email" placeholder="Recipient Email" class="form-control" id="recipient" name="recipient" parsley-type="email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="CC" class="col-4 col-form-label">CC</label>
|
||||
<div class="col-7">
|
||||
<input type="text" placeholder="Enter multiple email addresses separated by commas" class="form-control" id="CC" name="carboncopy">
|
||||
</span>
|
||||
</div>
|
||||
<div id="mailFormDiv">
|
||||
<form role="form" class="parsley-examples" method="POST" enctype="multipart/form-data" action="<?= base_url() . "mail_custom_notifications"; ?>">
|
||||
<div class="form-group row">
|
||||
<label for="recipient" class="col-4 col-form-label">Recipient Email</label>
|
||||
<div class="col-7">
|
||||
<input type="email" placeholder="Recipient Email" class="form-control" id="recipient" name="recipient" parsley-type="email">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="BCC" class="col-4 col-form-label">BCC</label>
|
||||
<div class="col-7">
|
||||
<input type="text" placeholder="Enter multiple email addresses separated by commas" class="form-control" id="BCC" name="blindcarboncopy">
|
||||
<div class="form-group row">
|
||||
<label for="CC" class="col-4 col-form-label">CC</label>
|
||||
<div class="col-7">
|
||||
<input type="text" placeholder="Enter multiple email addresses separated by commas" class="form-control" id="CC" name="carboncopy">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="subject" class="col-4 col-form-label">subject</label>
|
||||
<div class="col-7">
|
||||
<input type="text" placeholder="Subject" class="form-control" id="subject" name="subject">
|
||||
<div class="form-group row">
|
||||
<label for="BCC" class="col-4 col-form-label">BCC</label>
|
||||
<div class="col-7">
|
||||
<input type="text" placeholder="Enter multiple email addresses separated by commas" class="form-control" id="BCC" name="blindcarboncopy">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="body" class="col-4 col-form-label">Body</label>
|
||||
<div class="col-7">
|
||||
<textarea id="summernote-basic" name="description" class="form-control" rows="7">
|
||||
<div class="form-group row">
|
||||
<label for="subject" class="col-4 col-form-label">subject</label>
|
||||
<div class="col-7">
|
||||
<input type="text" placeholder="Subject" class="form-control" id="subject" name="subject">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="body" class="col-4 col-form-label">Body</label>
|
||||
<div class="col-7">
|
||||
<textarea id="summernote-basic" name="description" class="form-control" rows="7">
|
||||
<h5>Hello {User}, </h5>
|
||||
<p>We create simple, flat & responsive custom mail template.</p>
|
||||
<p>Please, write text here!</p>
|
||||
</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1">
|
||||
Send
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1">
|
||||
Send
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div> <!-- end card-body-->
|
||||
</div> <!-- end card-->
|
||||
</div><!-- end col -->
|
||||
</div><!-- end row -->
|
||||
|
||||
<div id="whatsappFormDiv" class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title"><?= "Whatsapp Custom Notification" ?></h4>
|
||||
<?php if (isset($validationErrors)) : ?>
|
||||
<span class="widget-simple text-center">
|
||||
<div class="media-body align-self-center font-24 avatar-title">
|
||||
<p style="color: #f1556c!important;" class="mt-0" style><?= $validationErrors; ?></p>
|
||||
</div>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<form role="form" class="parsley-examples" method="POST" enctype="multipart/form-data" action="<?= base_url() . "whatsapp_notifications"; ?>">
|
||||
<div class="form-group row">
|
||||
<label for="mobile" class="col-4 col-form-label">Mobile Number</label>
|
||||
<div class="col-7">
|
||||
<input type="number" placeholder="Mobile Number" class="form-control" id="recipient" name="mobile">
|
||||
</form>
|
||||
</div>
|
||||
<div id="whatsappFormDiv">
|
||||
<form role="form" class="parsley-examples" method="POST" enctype="multipart/form-data" action="<?= base_url() . "whatsapp_custom_notifications"; ?>">
|
||||
<div class="form-group row">
|
||||
<label for="mobile" class="col-4 col-form-label">Mobile Number</label>
|
||||
<div class="col-7">
|
||||
<input type="number" placeholder="Mobile Number" class="form-control" id="mobile" name="mobile">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="body" class="col-4 col-form-label">Message</label>
|
||||
<div class="col-7">
|
||||
<textarea id="summernote-basic" name="description" class="form-control" rows="7">
|
||||
<h5>Hello {User}, </h5>
|
||||
<p>We create simple, flat & responsive custom whatsapp template.</p>
|
||||
<p>Please, write text here!</p>
|
||||
</textarea>
|
||||
<div class="form-group row">
|
||||
<label for="type" class="col-4 col-form-label">Message Type</label>
|
||||
<div class="col-7">
|
||||
<select class="form-control" id="type" name="type">
|
||||
<option value=null>Choose your Message Type</option>
|
||||
<option value="text">Text</option>
|
||||
<option value="media">Media</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="fields-for-mediaurl" style="display: none;">
|
||||
<div class="form-group row">
|
||||
<label for="media_url" class="col-4 col-form-label">Media Url</label>
|
||||
<div class="col-7">
|
||||
<input type="text" placeholder="Media URL" class="form-control" id="media_url" name="media_url">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="message" class="col-4 col-form-label">Message</label>
|
||||
<div class="col-7">
|
||||
<textarea id="message" name="description" class="form-control" rows="5">Hello {User},Please,write text here!</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1">
|
||||
Send
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1">
|
||||
Send
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
</div>
|
||||
</div> <!-- end card-body-->
|
||||
</div> <!-- end card-->
|
||||
</div><!-- end col -->
|
||||
</div><!-- end row -->
|
||||
|
||||
<script>
|
||||
|
||||
const showMailFormLink = document.getElementById('showMailForm');
|
||||
const mailFormDiv = document.getElementById('mailFormDiv');
|
||||
const textDiv = document.getElementById('textDiv');
|
||||
|
||||
const showWhatsappFormLink = document.getElementById('showWhatsappForm');
|
||||
const whatsappFormDiv = document.getElementById('whatsappFormDiv');
|
||||
const showMailLink = document.getElementById('showMailLink');
|
||||
const mailFormDiv = document.getElementById('mailFormDiv');
|
||||
|
||||
// Add a click event listener to the link
|
||||
showMailFormLink.addEventListener('click', function () {
|
||||
// Toggle the display of the div
|
||||
mailFormDiv.style.display = (mailFormDiv.style.display === 'none') ? 'block' : 'none';
|
||||
whatsappFormDiv.style.display = 'none';
|
||||
});
|
||||
const showWhatsappLink = document.getElementById('showWhatsappLink');
|
||||
const whatsappFormDiv = document.getElementById('whatsappFormDiv');
|
||||
|
||||
// Add a click event listener to the link
|
||||
showWhatsappFormLink.addEventListener('click', function () {
|
||||
// Toggle the display of the div
|
||||
mailFormDiv.style.display = 'none';
|
||||
whatsappFormDiv.style.display = (whatsappFormDiv.style.display === 'none') ? 'block' : 'none';
|
||||
});
|
||||
// Add a click event listener to the link
|
||||
showMailLink.addEventListener('click', function() {
|
||||
// Toggle the display of the div
|
||||
// mailFormDiv.style.display = (mailFormDiv.style.display === 'none') ? 'block' : 'none';
|
||||
mailFormDiv.style.display = 'block';
|
||||
whatsappFormDiv.style.display = 'none';
|
||||
textDiv.style.display = 'none';
|
||||
const elements = document.getElementsByClassName("header-title");
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
elements[i].textContent = "Mail Custom Notification";
|
||||
}
|
||||
});
|
||||
|
||||
// Add a click event listener to the link
|
||||
showWhatsappLink.addEventListener('click', function() {
|
||||
// Toggle the display of the div
|
||||
mailFormDiv.style.display = 'none';
|
||||
textDiv.style.display = 'none';
|
||||
// whatsappFormDiv.style.display = (whatsappFormDiv.style.display === 'none') ? 'block' : 'none';
|
||||
whatsappFormDiv.style.display = 'block';
|
||||
const elements = document.getElementsByClassName("header-title");
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
elements[i].textContent = "Whatsapp Custom Notification";
|
||||
}
|
||||
});
|
||||
|
||||
// Get references to the dropdown and field divs
|
||||
const dropdown = document.getElementById("type");
|
||||
const fieldsForMediaURL = document.getElementById("fields-for-mediaurl");
|
||||
|
||||
// Add a change event listener to the dropdown
|
||||
dropdown.addEventListener("change", function() {
|
||||
// Determine which option is selected and show the corresponding fields
|
||||
const selectedOption = dropdown.value;
|
||||
if (selectedOption === "media") {
|
||||
fieldsForMediaURL.style.display = "block";
|
||||
} else {
|
||||
fieldsForMediaURL.style.display = "none";
|
||||
document.getElementById("media_url").value = "";
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
@ -188,7 +188,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url()."custom_notifications"; ?>">
|
||||
<a href="<?= base_url()."mail_custom_notifications"; ?>">
|
||||
<i class="ri-notification-3-fill"></i>
|
||||
<span> Custom Notifications </span>
|
||||
</a>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user