From b11caf9cc0f2098114d53750ce181804f6807c31 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Wed, 5 Jun 2024 14:49:52 +0530 Subject: [PATCH] Review Changes : GWM --- app/Config/Routes.php | 1 + app/Controllers/MasterController.php | 34 +++++++++++++++++--------- app/Helpers/MailHelper.php | 35 ++++++++++++--------------- app/Models/ClientDocsModel.php | 2 +- app/Views/client_docs_preview.php | 8 ++++-- app/Views/client_form.php | 4 +-- app/Views/client_home.php | 6 +++-- app/Views/docs_shared_with_client.php | 6 ++--- app/Views/staff_form.php | 31 ------------------------ app/Views/template_form.php | 12 +++------ 10 files changed, 60 insertions(+), 79 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 8927442..641e884 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -45,6 +45,7 @@ use CodeIgniter\Router\RouteCollection; $routes->match(['get','post'],'/template_create','MasterController::template_create'); $routes->match(['get','post'],'/template_edit','MasterController::template_edit'); $routes->match(['get','post'],'/template_preview','MasterController::template_preview'); + $routes->match(['get','post'],'/shared_docs_list','MasterController::shared_docs_list'); $routes->match(['get','post'],'/get_templates','MasterController::get_templates'); $routes->match(['get','post'],'/create_docs','MasterController::create_docs'); diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index f6cd91c..7655370 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -8,6 +8,8 @@ use App\Models\TemplateModel; use App\Models\StaffModel; use App\Models\ClientDocsModel; use App\Models\ClientModel; +use App\Models\BusinessModel; +use App\Models\BranchModel; class MasterController extends BaseController @@ -18,6 +20,8 @@ class MasterController extends BaseController protected $StaffModel; protected $ClientDocsModel; protected $ClientModel; + protected $BusinessModel; + protected $BranchModel; public function __construct() { @@ -27,18 +31,18 @@ class MasterController extends BaseController $this->StaffModel = new StaffModel(); $this->ClientDocsModel = new ClientDocsModel(); $this->ClientModel = new ClientModel(); + $this->BusinessModel = new BusinessModel(); + $this->BranchModel = new BranchModel(); } public function test() { - if(!$this->session->has('is_staff_logged_in')){ return redirect()->to(base_url().'staff'); } - $data['serviceList'] = $this->ServiceModel->findAll(); - - $staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow(); - echo view('layout/header', ['Data'=>$staffdata]); - echo view('test',$data); - echo view('layout/footer'); + $businessData = $this->BranchModel->select('branches.* , business.business_name ') + ->join('business', 'branches.business_id = business.business_id', 'left') + ->where('branches.branch_id',$this->session->get('logged_in_staff_branch_id')) + ->get()->getRow(); + dd($businessData); } @@ -274,11 +278,19 @@ class MasterController extends BaseController ]; if($is_active == 1){ $MailHelper = new MailHelper(); - $email = $this->ClientDocsModel - ->join('client', 'client_docs.client_id = client.client_id', 'left') - ->where('id', $doc_id)->get()->getRow()->email; + + $clientData = $this->ClientDocsModel + ->join('client', 'client_docs.client_id = client.client_id', 'left') + ->where('id', $doc_id)->get()->getRow(); + $url = 'Click here'; - $MailHelper->send_url_email($email , $url ); + + $businessData = $this->BranchModel->select('branches.* , business.business_name ') + ->join('business', 'branches.business_id = business.business_id', 'left') + ->where('branches.branch_id',$this->session->get('logged_in_staff_branch_id')) + ->get()->getRow(); + + $MailHelper->send_url_email($clientData->email , $url , $clientData->name , $businessData->business_name, $businessData->email); } $updated = $this->ClientDocsModel->update($doc_id, $data); diff --git a/app/Helpers/MailHelper.php b/app/Helpers/MailHelper.php index 30492b2..3e4c943 100644 --- a/app/Helpers/MailHelper.php +++ b/app/Helpers/MailHelper.php @@ -1,22 +1,18 @@ - We have a request for document verification. -
-
- ".$url; + + $message = "Dear " . $client_name . ",
" . $business_name . " has requested your approval for a document. Please click the link below to preview and approve.

" . $url; + try { $email = \Config\Services::email(); $email->setMailType('html'); - $email->setFrom('bbone@venbait.in', 'BB-Sign'); + $email->setFrom($branch_email, 'BB-Sign'); $email->setTo($email_id); @@ -77,8 +72,10 @@ class MailHelper $email->setMessage($message); if ($email->send()) { + self::$logger->info('Email Sent Successfully'); return json_encode(['status' => 'success','code' => 200, 'message'=>'Email Sent Successfully...','data' => $email_id,],200); } else { + self::$logger->error('Email Sent Failed'); return json_encode(['status' => 'failed','code' => 404,'message'=>'Email Sent Failed...','data' => $email_id ],404); } diff --git a/app/Models/ClientDocsModel.php b/app/Models/ClientDocsModel.php index 8b57945..265f2d0 100644 --- a/app/Models/ClientDocsModel.php +++ b/app/Models/ClientDocsModel.php @@ -14,7 +14,7 @@ class ClientDocsModel extends Model public function getTemplate($client_id){ - $this->select('template.template_name , template.template_id ,client_docs.is_approved ,client_docs.id as doc_id , services.service_name'); + $this->select('template.template_name , template.template_id ,client_docs.is_approved ,client_docs.id as doc_id ,client_docs.created_at , services.service_name'); $this->join('template', 'template.template_id = client_docs.template_id'); $this->join('services', 'services.service_id = template.service_id'); $this->where('client_docs.is_active', 1); diff --git a/app/Views/client_docs_preview.php b/app/Views/client_docs_preview.php index b7149bd..dcd1807 100644 --- a/app/Views/client_docs_preview.php +++ b/app/Views/client_docs_preview.php @@ -7,6 +7,10 @@ text-align: center; letter-spacing: 0.5rem; } + .file_approved { + border-top: 1px dotted #000; + padding-top: 3px; + }
@@ -47,8 +51,8 @@
-
- is_approved == 1){ echo 'Approved at '.date('d-m-Y H:i:s', strtotime($docData->updated_at)).' through OTP sent to '.$clientData->mobile_no.' from ip address '.$docData->ip_address; } ?> +
+ is_approved == 1){ echo '
Approved at '.date('d-m-Y H:i:s', strtotime($docData->updated_at)).' through OTP sent to '.$clientData->mobile_no.' from ip address '.$docData->ip_address.'
'; } ?>
diff --git a/app/Views/client_form.php b/app/Views/client_form.php index d02b9d6..7753c14 100644 --- a/app/Views/client_form.php +++ b/app/Views/client_form.php @@ -94,12 +94,12 @@
- +
- +
diff --git a/app/Views/client_home.php b/app/Views/client_home.php index 8ea6e48..eef8183 100644 --- a/app/Views/client_home.php +++ b/app/Views/client_home.php @@ -32,7 +32,8 @@ - + + @@ -44,7 +45,8 @@ $value) { ?> - + +
TemplateDocumentShared at Status Action
format('d-M-Y h:i A'); ?> Approved diff --git a/app/Views/docs_shared_with_client.php b/app/Views/docs_shared_with_client.php index 6779437..1c09e31 100644 --- a/app/Views/docs_shared_with_client.php +++ b/app/Views/docs_shared_with_client.php @@ -80,11 +80,11 @@ diff --git a/app/Views/staff_form.php b/app/Views/staff_form.php index 3e930db..ba8a2a8 100644 --- a/app/Views/staff_form.php +++ b/app/Views/staff_form.php @@ -91,37 +91,6 @@ -
- -
- - -
- -
- - -
- - - - -
- - -
- -
- - -
- -
- - -
- -
diff --git a/app/Views/template_form.php b/app/Views/template_form.php index 9b40de0..c5b0c30 100644 --- a/app/Views/template_form.php +++ b/app/Views/template_form.php @@ -34,22 +34,19 @@
-
+
-
+
'>
-
- - -
+
@@ -156,7 +153,6 @@ $("#savedata").on("click", function() service_id : $('#service_id').val(), template_id : $('#template_id').val(), template_name : $('#template_name').val(), - header_type : $('#header_type').val(), body_text : $('.note-editable > p:first').text(), body_html : $('.note-codable').val(), }; @@ -207,7 +203,7 @@ $(document).ready(function() { ['color', ['color']], ['para', ['ul', 'ol', 'paragraph' , 'height']], ['table', ['table']], - // ['insert', ['link', 'picture', 'video']], + ['insert', [ 'picture']], ['view', ['fullscreen', 'codeview', 'help']], ['mybutton', ['customButton']] // Custom button group ],