From 3c351f4f34b408ea815600268a8981709aa98d54 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Sat, 15 Jun 2024 09:03:15 +0530 Subject: [PATCH] Client feedback : GWM --- app/Config/Routes.php | 1 + app/Controllers/MasterController.php | 26 +++ app/Models/ClientDocsModel.php | 6 +- app/Models/StaffModel.php | 3 +- app/Views/edit_shared_doc.php | 327 +++++++++++++++++++++++++++ app/Views/share_docs.php | 14 +- app/Views/template_form.php | 38 +++- app/Views/template_list.php | 8 +- 8 files changed, 409 insertions(+), 14 deletions(-) create mode 100644 app/Views/edit_shared_doc.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index f517640..ec60f64 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -70,6 +70,7 @@ use CodeIgniter\Router\RouteCollection; $routes->post('doc_generate_otp','MasterController::doc_generate_otp'); $routes->post('doc_verify_otp','MasterController::doc_verify_otp'); $routes->post('download_doc','MasterController::download_doc'); + $routes->match(['get','post'],'shared_document_edit','MasterController::shared_document_edit'); diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 60cad9c..4e45857 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -300,6 +300,32 @@ class MasterController extends BaseController } + public function shared_document_edit() + { + if(!$this->session->has('is_staff_logged_in')){ return redirect()->to(base_url().'staff'); } + if($this->request->getmethod() == 'POST') + { + $data = $this->request->getVar(); + $id = $this->request->getVar('id'); + unset($data['id']); + $this->ClientDocsModel->where('id', $id )->set($data)->update(); + return $this->response->setJSON(['success' => true ]); + + }else{ + + $id = $this->request->getVar('doc_id'); + $data['templateData'] = $this->ClientDocsModel->where('md5(id)',$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('edit_shared_doc',$data); + echo view('layout/footer'); + + } + + + } + public function get_service_data() { diff --git a/app/Models/ClientDocsModel.php b/app/Models/ClientDocsModel.php index f930988..557c294 100644 --- a/app/Models/ClientDocsModel.php +++ b/app/Models/ClientDocsModel.php @@ -38,9 +38,9 @@ class ClientDocsModel extends Model $this->select('client_docs.is_approved ,client_docs.id as doc_id,client_docs.client_branch_id ,client_docs.updated_at,client_docs.ip_address,template.template_name,client_docs.body_html ,client_docs.is_active,client_docs.document_name, services.service_name , business.header_html, business.footer_html'); - $this->join('template', 'template.template_id = client_docs.template_id'); - $this->join('services', 'services.service_id = template.service_id'); - $this->join('business', 'business.business_id = template.template_header_business'); + $this->join('template', 'template.template_id = client_docs.template_id','left'); + $this->join('services', 'services.service_id = template.service_id','left'); + $this->join('business', 'business.business_id = template.template_header_business','left'); $this->where('client_docs.id', $doc_id); return $this->get()->getRow(); diff --git a/app/Models/StaffModel.php b/app/Models/StaffModel.php index e6a5428..b20869e 100644 --- a/app/Models/StaffModel.php +++ b/app/Models/StaffModel.php @@ -49,8 +49,7 @@ class StaffModel extends Model ->select('staff.*, business.business_name AS business_name, branches.branch_name AS branch_name') ->join('business', 'business.business_id = staff.business_id') ->join('branches', 'branches.branch_id = staff.branch_id') - ->where('staff.staff_id != ', $is_staff_logged_in) - ->where('staff.branch_id', $logged_in_staff_branch_id); + ->where('staff.staff_id != ', $is_staff_logged_in); // Execute the query and fetch results as an array $result = $query->get()->getResultArray(); diff --git a/app/Views/edit_shared_doc.php b/app/Views/edit_shared_doc.php new file mode 100644 index 0000000..5966b0f --- /dev/null +++ b/app/Views/edit_shared_doc.php @@ -0,0 +1,327 @@ + + + + + +
+ +
+ + +
+
+
+
+

Edit Document

+
+ + +
+
+
+
+
+ + + +
+
+
+ +
+
+ +
+
+ +
+ + + +
+ +
+ +
+ + +
+
+ +
+ + + + + + +
+
+
+
+ + +
+ + +
+ +
+ + + + + + + + +'> + + + + + + + + + diff --git a/app/Views/share_docs.php b/app/Views/share_docs.php index ff4ea61..b050d48 100644 --- a/app/Views/share_docs.php +++ b/app/Views/share_docs.php @@ -85,8 +85,18 @@ @@ -290,6 +292,32 @@ $("#service_group_id").on("change", function() $("#savedata").on("click", function() { + + + var service_group_id = $('#service_group_id').val(); + var service_id = $('#service_id').val(); + var template_name = $('#template_name').val(); + var template_header_business = $('#template_header_business').val(); + + + // Check if required fields are filled + if (!service_group_id) { + toastr.warning('Service Group is required', 'Warning'); + return; + } + if (!service_id) { + toastr.warning('Service is required', 'Warning'); + return; + } + if (!template_header_business) { + toastr.warning('Template Header and Footer is required', 'Warning'); + return; + } + if (!template_name) { + toastr.warning('Template Name is required', 'Warning'); + return; + } + var body_html = $('#summernote-basic').summernote('code'); formData ={ service_group_id : $('#service_group_id').val(), diff --git a/app/Views/template_list.php b/app/Views/template_list.php index a394e04..3d43d2b 100644 --- a/app/Views/template_list.php +++ b/app/Views/template_list.php @@ -58,12 +58,16 @@