diff --git a/app/Config/Routes.php b/app/Config/Routes.php index f1b0d84..e19a251 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -42,6 +42,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'],'/test','MasterController::test'); diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 1eb3304..d07734b 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -6,6 +6,8 @@ use App\Helpers\MailHelper; use App\Models\ServiceModel; use App\Models\TemplateModel; use App\Models\StaffModel; +use App\Models\ClientDocsModel; +use App\Models\ClientModel; class MasterController extends BaseController @@ -14,6 +16,8 @@ class MasterController extends BaseController protected $ServiceModel; protected $TemplateModel; protected $StaffModel; + protected $ClientDocsModel; + protected $ClientModel; public function __construct() { @@ -21,6 +25,8 @@ class MasterController extends BaseController $this->ServiceModel = new ServiceModel(); $this->TemplateModel = new TemplateModel(); $this->StaffModel = new StaffModel(); + $this->ClientDocsModel = new ClientDocsModel(); + $this->ClientModel = new ClientModel(); } @@ -190,6 +196,41 @@ class MasterController extends BaseController } + public function shared_docs_list() + { + if(!$this->session->has('is_staff_logged_in')){ return redirect()->to(base_url().'staff'); } + + if($this->request->getmethod() == 'POST') + { + $templateData = $this->request->getVar(); + + if($this->request->getVar('template_id') != 'null'){ + $id = $this->request->getVar('template_id'); + unset($templateData['template_id']); + $this->TemplateModel->where('template_id', $id )->set($templateData)->update(); + return $this->response->setJSON(['success' => true , 'service_id' =>$this->request->getVar('service_id')]); + }else{ + unset($templateData['template_id']); + $this->TemplateModel->insert($templateData); + return $this->response->setJSON(['success' => true , 'service_id' =>$this->request->getVar('service_id')]); + } + + + + }else{ + + $client_id = $this->request->getVar('client_id'); + $data['doc_list'] = $this->ClientDocsModel->getTemplate($client_id); + + $data['clientdata'] = $this->ClientModel->where('client_id', $client_id)->get()->getRow(); + + $staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow(); + echo view('layout/header', ['Data'=>$staffdata]); + echo view('docs_shared_with_client',$data); + echo view('layout/footer'); + } + } + // str_replace("%name%","Gowtham",$data['templateData']->body_html); diff --git a/app/Controllers/StaffController.php b/app/Controllers/StaffController.php index 7789d82..a51d0e6 100644 --- a/app/Controllers/StaffController.php +++ b/app/Controllers/StaffController.php @@ -156,7 +156,9 @@ class StaffController extends BaseController if(!$this->session->has('is_staff_logged_in')){ return redirect()->to(base_url().'staff'); } - $data['clientList'] = $this->ClientModel->findAll(); + $data['clientList'] = $this->ClientModel->select('client.* , COUNT(client_docs.id) as docs_count') + ->join('client_docs', 'client.client_id = client_docs.client_id', 'left') + ->findAll(); $staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow(); echo view('layout/header', ['Data'=>$staffdata]); diff --git a/app/Views/client_list.php b/app/Views/client_list.php index 3497b1a..e3b9e60 100644 --- a/app/Views/client_list.php +++ b/app/Views/client_list.php @@ -35,6 +35,7 @@ PAN Mobile Email + Shared Docs Status Action @@ -50,6 +51,7 @@ + Active @@ -66,7 +68,8 @@ Deactivate Activate - + + Documents diff --git a/app/Views/docs_shared_with_client.php b/app/Views/docs_shared_with_client.php new file mode 100644 index 0000000..79fbef2 --- /dev/null +++ b/app/Views/docs_shared_with_client.php @@ -0,0 +1,99 @@ + + + + +
+ +
+ + +
+
+
+

Docs Shared With name; ?>

+
+
+
+ + +
+
+ + + +
+
+
+
+ + + + + + + + + + + + + + + $value) { ?> + + + + + + + + + + + +
TemplateStatusAction
+ + Approved + + Pending Approval + + Rejected + + + Preview
+ +
+
+
+
+ + + +
+ +
+ + + + + + + + + + + \ No newline at end of file