diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 3b6c054..206e38f 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 cf1b1a6..0661005 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;
+ }
@@ -55,8 +59,8 @@
-
| Template | +Document | +Shared 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 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |