CHANGE_SMS_NOTIFICATION_COMPIT: AADHAVAN

This commit is contained in:
aadhavan valli 2024-07-01 12:17:00 +05:30
parent 7bce186c76
commit 7be64a1db8
8 changed files with 51 additions and 17 deletions

7
.env
View File

@ -74,3 +74,10 @@ database.default.port = 3306
WAAI_INSTANCE = '666FEE6738696'
WAAI_TOKEN = '666fd862df687'
API_KEY = 'HgvlULWCIrs'; // Your API key
DLT_Template_ID = '1105171896608602869'; // DLT Template ID
SENDER_ID = 'LDRCHN'; // Sender ID
SERVICE_NAME = 'TEMPLATE_BASED'; // Service name

View File

@ -204,7 +204,7 @@ class ClientController extends BaseController
if($client_branch_data['sms'] == 1){
try {
$notificationHelper->sendSms();
$notificationHelper->sendSms('91'. $client_branch_data['mobile_no'], $client_branch_data['name'], $otp, '', 'login_otp','');
// return $this->respond(['success' => true, 'otp' => $otp]);
} catch (\Exception $e) {
return $this->respond(['Error' => $e->getMessage()]);

View File

@ -845,7 +845,9 @@ class MasterController extends BaseController
->where('client_docs.id', $doc_id)->get()->getRow();
$documentUrl = base_url();
$url = '<a href="' . $documentUrl . '">Preview and Approve Document</a>';
helper('url');
$url ='<a href="' . generate_signed_url('preview', ['doc_id'=>md5($doc_id)], 100) . '">Preview and Approve Document</a>';
// $url = '<a href="' . $documentUrl . '">Preview and Approve Document</a>';
$businessData = $this->BranchModel->select('branches.* , business.business_name ')
->join('business', 'branches.business_id = business.business_id', 'left')
@ -870,7 +872,7 @@ class MasterController extends BaseController
}
if($clientData->sms == 1){
$notificationHelper->sendSms();
$notificationHelper->sendSms($number, $clientData->name . "," . $businessData->business_name, '', $url, 'change_doc_status','');
}
@ -913,7 +915,10 @@ class MasterController extends BaseController
->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client_docs.id', $doc_id)->get()->getRow();
$url = '<a href="'.base_url().'">Click here</a>';
helper('url');
$url ='<a href="' . generate_signed_url('preview', ['doc_id'=>md5($doc_id)], 100) . '">Preview and Approve Document</a>';
// $url = '<a href="'.base_url().'">Click here</a>';
$businessData = $this->BranchModel->select('branches.* , business.business_name ')
->join('business', 'branches.business_id = business.business_id', 'left')
@ -933,7 +938,7 @@ class MasterController extends BaseController
}
if($clientData->sms == 1){
$notificationHelper->sendSms();
$notificationHelper->sendSms($number, $clientData->name . "," . $businessData->business_name, '', $url, 'rememeber_message', '');
}
return $this->respond(['success' => true, 'data' => 'Remember Send Successfully']);
@ -956,6 +961,16 @@ class MasterController extends BaseController
$id = $this->request->getPost('doc_id');
$otp = mt_rand(100000, 999999);
$data = ['otp' => $otp];
$clint_full_data = $this->ClientDocsModel->select('client_docs.* , services.service_name , service_group.group_name , client_branch.name as client_branch_name , client.name as client_name')
->join('template', 'template.template_id = client_docs.template_id', 'left')
->join('services', 'services.service_id = template.service_id', 'left')
->join('service_group', 'service_group.service_group_id = template.service_group_id', 'left')
->join('client_branch', 'client_branch.id = client_docs.client_branch_id', 'left')
->join('client', 'client.client_id = client_branch.client_id', 'left')
->where('client_docs.id', $id)
->first();
print_r($clint_full_data);die;
$update = $this->ClientDocsModel->update($id, $data);
if($update){
@ -969,7 +984,7 @@ class MasterController extends BaseController
}
if($client_data['sms'] == 1){
$notificationHelper->sendSms();
$notificationHelper->sendSms($number, $client_data['name'] , $otp, '', 'doc_verify',$clint_full_data);
}
return $this->respond(['success' => true, 'otp' => $otp]);

View File

@ -87,8 +87,9 @@ class TestController extends Controller
public function protectedPage(){
$doc_id = $this->request->getVar('doc_id');
$data['docData'] = $this->ClientDocsModel->docPreview($doc_id);
$data['expires'] = $this->request->getVar('expires');
$data['clientData'] = $this->ClientBranchModel->select('client.name , client.pan_no ,client_branch.gst_no , client_branch.mobile_no , client_branch.email , client_branch.address , client_branch.country , client_branch.state , client_branch.city , client_branch.pin_code ')
->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client_branch.id',$data['docData']->client_branch_id)

View File

@ -81,15 +81,24 @@ class NotificationHelper
return true;
}
public function sendSms()
public function sendSms($number, $name= '', $otp='', $url ='', $message_type_name, $clint_full_data='')
{
$apiKey = 'HgvlULWCIrs'; // Your API key
$apiKey = getenv('API_KEY'); // Your API key
// $mobileNumbers = '919894638731'; // Recipient mobile numbers
$mobileNumbers = '916379103977'; // Recipient mobile numbers
$DLTTemplateID = '1105171896608602869'; // DLT Template ID
$senderId = 'LDRAJ'; // Sender ID
$message = 'Dear Gowtham, 986532 is OTP to approve Service group for service name purposes.';
$serviceName = 'TEMPLATE_BASED'; // Service name
$mobileNumbers = $number; // Recipient mobile numbers
$DLTTemplateID = getenv('DLT_Template_ID'); // DLT Template ID
$senderId = getenv('SENDER_ID'); // Sender ID
if($message_type_name == 'login_otp'){
$message = 'Login OTP is: ' . $otp;
}else if($message_type_name == 'change_doc_status'){
$message = "Dear " . $name . " has requested your approval for a document. Please click the link below to preview and approve." ;
}else if($message_type_name == 'rememeber_message'){
$message = "Dear " . $name . " has requested your approval for a document. Please click the link below to preview and approve. \n\nClick here - " . $url; ;
}else if($message_type_name == 'doc_verify'){
$message = 'Dear'. $name .',' . $otp . 'is OTP to approve '. $clint_full_data['group_name'] .' for '. $clint_full_data['service_name'] .' purposes.';
}
$serviceName = getenv('SERVICE_NAME'); // Service name
// URL encode the message
$encodedMessage = urlencode($message);

View File

@ -234,7 +234,9 @@
return ;
}
if($('#business').val() == 0){
event.preventDefault();
toastr.warning('Select Business');
$('#business').focus();
return;
}
var formData = {

View File

@ -60,8 +60,9 @@
</h4>
<div class="page-title-right">
<!-- <a onclick="window.history.back()" class="btn btn-secondary waves-effect waves-light" > Close </a> -->
<?php if(!isset($expires)){ ?>
<a onclick="window.history.back()" class="btn waves-effect waves-light" style="color: #fff;background-color: #6c757d;border-color: #6c757d;" > Close </a>
<?php } ?>
<?php if(isset($_SESSION['is_staff_logged_in']) && $_SESSION['is_staff_logged_in']) {
if( $docData->is_active == 1 && $docData->is_approved == 0){ ?>
<a data-id="<?php echo $docData->doc_id; ?>" data-isactive="<?php echo $docData->is_active; ?>" title="revert" onclick="statusChange(this)" class="btn btn-warning waves-effect waves-light"> Revert </a>

View File

@ -124,8 +124,7 @@
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="<?php echo base_url().'client_docs_preview?doc_id='.$value['id']; ?>" >
<a class="dropdown-item" href="<?php echo base_url().'client_docs_preview?doc_id='.md5($value['id']); ?>" >
<i class='mdi mdi-eye-outline mr-1' style="margin-right: 16px !important;margin-left: 5px;"></i>Preview
</a>
<?php if ($value['is_approved'] != 1){ ?>