CHANGE_MAIL_APPROVE : AADHAVAN

This commit is contained in:
aadhavan valli 2024-07-10 09:24:53 +05:30
parent d2e142ae3b
commit aaf4f0c553

View File

@ -733,7 +733,8 @@ class MasterController extends BaseController
->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client_docs.id', $doc_id)->get()->getRow();
$documentUrl = base_url();
helper('url');
// helper('url');
$url ='<a href="' . generate_signed_url('preview', ['doc_id'=> md5($doc_id)], 36000) . '">Preview and Approve Document</a>';
// $businessData = $this->BranchModel->select('branches.* , business.business_name ')
// ->join('business', 'branches.business_id = business.business_id', 'left')
@ -782,16 +783,17 @@ class MasterController extends BaseController
public function rememeber_notification()
{
try {
// try {
$doc_id = $this->request->getPost('doc_id');
$MailHelper = new MailHelper();
// print_r($this->session->get());die;
$clientData = $this->ClientDocsModel->select('client.name as client_name, client_branch.email, client_branch.mobile_no')
->join('client_branch', 'client_docs.client_branch_id = client_branch.id', 'left')
->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client_docs.id', $doc_id)->get()->getRow();
helper('url');
// helper('url');
$url ='<a href="' . generate_signed_url('preview', ['doc_id'=>md5($doc_id)], 100) . '">Preview and Approve Document</a>';
$businessData = $this->BranchModel->select('branches.* , business.business_name ')
->join('business', 'branches.business_id = business.business_id', 'left')
@ -799,7 +801,6 @@ class MasterController extends BaseController
->get()->getRow();
$subject = 'BB-Sign Verify Document';
$message = "Dear " . $clientData->client_name . ",<br>" . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve.<br><br>" . $url;
$MailHelper->send_url_email($clientData->email , $businessData->email, $subject, $message);
$notificationHelper = new NotificationHelper();
$number = '91'.$clientData->mobile_no; // Replace with dynamic recipient number
@ -808,9 +809,9 @@ class MasterController extends BaseController
//$notificationHelper->sendWhatsAppMessage($number, $whatsApp_message, $url);
}
return $this->respond(['success' => true, 'data' => 'Remember Send Successfully']);
} catch (\Exception $exception) {
return $this->response->setJSON(['status' => 'failed','code' => 500,'data' => $exception],500);
}
// } catch (\Exception $exception) {
// return $this->response->setJSON(['status' => 'failed','code' => 500,'data' => $exception],500);
// }
}
public function doc_generate_otp()
@ -857,24 +858,27 @@ class MasterController extends BaseController
try {
$id = $this->request->getPost('doc_id');
$otp = $this->request->getPost('otp');
if($this->session->has('is_client_logged_in')){
$logged_user = $this->session->get('is_client_logged_in');
$statusData['is_staff'] = 0;
}else{
$logged_user = $this->session->get('is_staff_logged_in');
$statusData['is_staff'] = 1;
}
$statusData['client_docs_id'] = $id;
$statusData['created_by'] = $logged_user;
$statusData['status'] = 'Approved';
$statusData['note'] = $this->request->getPost('clientIp');
$this->DocsStatusModel->insert($statusData);
$client_doc_data = $this->ClientDocsModel->where('id', $id )->where('otp', $otp)->first();
$data = ['otp' =>'' ,'rejection_reason' =>''];
if($client_doc_data){
$data['is_approved'] = $this->request->getPost('is_approved');
$data['ip_address'] = $this->request->getPost('clientIp');
$update = $this->ClientDocsModel->update($id , $data);
if($this->session->has('is_client_logged_in')){
$logged_user = $this->session->get('is_client_logged_in');
$statusData['is_staff'] = 0;
}else{
$logged_user = $this->session->get('is_staff_logged_in');
$statusData['is_staff'] = 1;
}
$statusData['client_docs_id'] = $id;
$statusData['created_by'] = $logged_user;
$statusData['status'] = 'Approved';
$statusData['note'] = $this->request->getPost('clientIp');
$this->DocsStatusModel->insert($statusData);
if($update){
return json_encode(true);
}