diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 659f80b..e1f2782 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -63,6 +63,7 @@ use CodeIgniter\Router\RouteCollection; $routes->match(['get','post'],'/get_templates','MasterController::get_templates'); $routes->match(['get','post'],'/create_docs','MasterController::create_docs'); $routes->match(['get','post'],'/client_docs_preview','MasterController::client_docs_preview'); + $routes->get('client_docs_histroy/(:any)','MasterController::client_docs_histroy/$1'); $routes->match(['get','post'],'/change_doc_status','MasterController::change_doc_status'); $routes->match(['get','post'],'/test','MasterController::test'); $routes->post('doc_generate_otp','MasterController::doc_generate_otp'); diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index ef278d8..536d093 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -272,7 +272,7 @@ class MasterController extends BaseController ->where('client.business_id',$this->session->get('logged_in_staff_business_id')) ->findAll(); $data['serviceGroupData'] = $this->ServiceGroupModel->findAll(); - + // print_r($data['doc_list']);die; $staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow(); echo view('layout/header', ['Data'=>$staffdata]); echo view('share_docs',$data); @@ -351,6 +351,64 @@ class MasterController extends BaseController } + public function client_docs_histroy($doc_id) + { + if($this->session->has('is_staff_logged_in')){ + $userData = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow(); + }else if($this->session->has('is_client_logged_in')){ + $userData = $this->ClientBranchModel->where('id',$this->session->get('is_client_logged_in'))->get()->getRow(); + } + + $data['docData'] = $this->ClientDocsModel->docPreview($doc_id); + + // Fetch the document history + $clientDocHistory = $this->DocsStatusModel->select('*') + ->where('client_docs_id', $doc_id) + ->get() + ->getResult(); + + // Initialize an array to store the augmented results + $augmentedHistory = []; + + foreach ($clientDocHistory as $history) { + if ($history->is_staff == 1) { + // Fetch staff details + $staffDetails = $this->StaffModel->select('name, email') // Adjust the columns as needed + ->where('staff_id', $history->created_by) + ->get() + ->getRow(); + $history->creator_details = $staffDetails; + $history->creator_type = 'staff'; + } else { + // Fetch client details + $clientDetails = $this->ClientBranchModel->select('name, email') // Adjust the columns as needed + ->where('id', $history->created_by) + ->get() + ->getRow(); + $history->creator_details = $clientDetails; + $history->creator_type = 'client'; + } + + // Add the augmented history to the array + $augmentedHistory[] = $history; + } + + // Assign the augmented history to the data array + $data['client_doc_history'] = $augmentedHistory; + + // Debug output + // echo "
";
+ // print_r($data['client_doc_history']);
+ // die;
+ return json_encode($data);
+
+ // echo view('layout/header', ['Data'=>$userData]);
+ // echo view('doc_history',$data);
+ // echo view('layout/footer');
+
+ }
+
+
public function change_doc_status()
{
try {
@@ -408,7 +466,7 @@ class MasterController extends BaseController
try {
$mobile_no = $this->request->getPost('mobile_no');
- $client_data = $this->ClientModel->where('mobile_no', $mobile_no )->first();
+ $client_data = $this->ClientBranchModel->where('mobile_no', $mobile_no )->first();
if($client_data){
diff --git a/app/Views/client_home.php b/app/Views/client_home.php
index eef8183..aba2f67 100644
--- a/app/Views/client_home.php
+++ b/app/Views/client_home.php
@@ -57,7 +57,15 @@
- Preview
+
+
+
@@ -79,8 +87,107 @@
+
+
+
+
+
diff --git a/app/Views/share_docs.php b/app/Views/share_docs.php
index b9230bc..a4a0eca 100644
--- a/app/Views/share_docs.php
+++ b/app/Views/share_docs.php
@@ -56,7 +56,7 @@
$value) { ?>
-
+
@@ -80,7 +80,7 @@