From aaf4f0c553dea12d8546703332d7ad75f8fb36b7 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Wed, 10 Jul 2024 09:24:53 +0530 Subject: [PATCH] CHANGE_MAIL_APPROVE : AADHAVAN --- app/Controllers/MasterController.php | 42 +++++++++++++++------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 7b5ee1a..90f429d 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -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 ='Preview and Approve Document'; // $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 ='Preview and Approve Document'; $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 . ",
" . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve.

" . $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); }