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') ->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client_docs.id', $doc_id)->get()->getRow(); ->where('client_docs.id', $doc_id)->get()->getRow();
$documentUrl = base_url(); $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>'; $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 ') // $businessData = $this->BranchModel->select('branches.* , business.business_name ')
// ->join('business', 'branches.business_id = business.business_id', 'left') // ->join('business', 'branches.business_id = business.business_id', 'left')
@ -782,16 +783,17 @@ class MasterController extends BaseController
public function rememeber_notification() public function rememeber_notification()
{ {
try { // try {
$doc_id = $this->request->getPost('doc_id'); $doc_id = $this->request->getPost('doc_id');
$MailHelper = new MailHelper(); $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') $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_branch', 'client_docs.client_branch_id = client_branch.id', 'left')
->join('client', 'client_branch.client_id = client.client_id', 'left') ->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client_docs.id', $doc_id)->get()->getRow(); ->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>'; $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 ') $businessData = $this->BranchModel->select('branches.* , business.business_name ')
->join('business', 'branches.business_id = business.business_id', 'left') ->join('business', 'branches.business_id = business.business_id', 'left')
@ -799,7 +801,6 @@ class MasterController extends BaseController
->get()->getRow(); ->get()->getRow();
$subject = 'BB-Sign Verify Document'; $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; $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); $MailHelper->send_url_email($clientData->email , $businessData->email, $subject, $message);
$notificationHelper = new NotificationHelper(); $notificationHelper = new NotificationHelper();
$number = '91'.$clientData->mobile_no; // Replace with dynamic recipient number $number = '91'.$clientData->mobile_no; // Replace with dynamic recipient number
@ -808,9 +809,9 @@ class MasterController extends BaseController
//$notificationHelper->sendWhatsAppMessage($number, $whatsApp_message, $url); //$notificationHelper->sendWhatsAppMessage($number, $whatsApp_message, $url);
} }
return $this->respond(['success' => true, 'data' => 'Remember Send Successfully']); return $this->respond(['success' => true, 'data' => 'Remember Send Successfully']);
} catch (\Exception $exception) { // } catch (\Exception $exception) {
return $this->response->setJSON(['status' => 'failed','code' => 500,'data' => $exception],500); // return $this->response->setJSON(['status' => 'failed','code' => 500,'data' => $exception],500);
} // }
} }
public function doc_generate_otp() public function doc_generate_otp()
@ -857,12 +858,6 @@ class MasterController extends BaseController
try { try {
$id = $this->request->getPost('doc_id'); $id = $this->request->getPost('doc_id');
$otp = $this->request->getPost('otp'); $otp = $this->request->getPost('otp');
$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')){ if($this->session->has('is_client_logged_in')){
$logged_user = $this->session->get('is_client_logged_in'); $logged_user = $this->session->get('is_client_logged_in');
$statusData['is_staff'] = 0; $statusData['is_staff'] = 0;
@ -875,6 +870,15 @@ class MasterController extends BaseController
$statusData['status'] = 'Approved'; $statusData['status'] = 'Approved';
$statusData['note'] = $this->request->getPost('clientIp'); $statusData['note'] = $this->request->getPost('clientIp');
$this->DocsStatusModel->insert($statusData); $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($update){ if($update){
return json_encode(true); return json_encode(true);
} }