diff --git a/app/Config/Routes.php b/app/Config/Routes.php index f517640..7f52cce 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -39,6 +39,7 @@ use CodeIgniter\Router\RouteCollection; $routes->post('doc_rejection','ClientController::doc_rejection'); $routes->match(['get','post'],'/client_branch_list','ClientController::client_branch_list'); $routes->post('add_client_branch','ClientController::add_client_branch'); + $routes->post('edit_client_branch','ClientController::edit_client_branch'); $routes->get('get_client_branch/(:any)','ClientController::get_client_branch/$1'); $routes->post('status_client_branch','ClientController::status_client_branch'); $routes->post('client_upload','ClientController::client_upload'); @@ -70,6 +71,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/ClientController.php b/app/Controllers/ClientController.php index c7b0993..2448925 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -305,13 +305,32 @@ class ClientController extends BaseController public function add_client_branch() { - $data = $this->request->getPost(); + $gst = $this->request->getPost('gst_no'); + $client_branch = $this->ClientBranchModel->where('gst_no', $gst)->first(); + if($client_branch){ + return json_encode(false); + }else{ + $data = $this->request->getPost(); - $this->ClientBranchModel->insert($data); - - return; + $this->ClientBranchModel->insert($data); + return json_encode(true); + } } + public function edit_client_branch() + { + $id = $this->request->getPost('id'); + + $data = $this->request->getPost(); + + $this->ClientBranchModel->update($id, $data); + + return json_encode('update'); + + } + + + public function get_client_branch($branch_id) { if ($branch_id) { 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 df51a88..557c294 100644 --- a/app/Models/ClientDocsModel.php +++ b/app/Models/ClientDocsModel.php @@ -37,10 +37,10 @@ class ClientDocsModel extends Model public function docPreview($doc_id){ - $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, 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->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','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/branch_list.php b/app/Views/branch_list.php index 491d8f5..4f1a7cd 100644 --- a/app/Views/branch_list.php +++ b/app/Views/branch_list.php @@ -38,7 +38,7 @@ Address City State - Postal Code + PIN Code Contact Status Action @@ -56,7 +56,7 @@ - + @@ -182,7 +182,7 @@
- +
@@ -228,7 +228,7 @@ address: $('#address').val(), city: $('#city').val(), state: $('#state').val(), - postal_code: $('#postal_code').val(), + pin_code: $('#pin_code').val(), mobile_no: $('#mobile_no').val() }; @@ -280,7 +280,7 @@ $('#address').val(response.address); $('#branch_id').val(response.branch_id); $('#city').val(response.city); - $('#postal_code').val(response.postal_code); + $('#pin_code').val(response.pin_code); $('#state').val(response.state); $('#country').val(response.country); $('#state_code').val(response.state_code); diff --git a/app/Views/business.php b/app/Views/business.php index 9c10843..b2b3e49 100644 --- a/app/Views/business.php +++ b/app/Views/business.php @@ -114,7 +114,7 @@
- +
diff --git a/app/Views/client_branch_list.php b/app/Views/client_branch_list.php index f989392..f5ac84f 100644 --- a/app/Views/client_branch_list.php +++ b/app/Views/client_branch_list.php @@ -13,7 +13,7 @@

Client Branch List

@@ -39,7 +39,7 @@ Address City State - Postal Code + Pin Code Mobile No Active Action @@ -67,7 +67,7 @@