diff --git a/app/Config/Routes.php b/app/Config/Routes.php index ec60f64..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'); 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/Views/branch_list.php b/app/Views/branch_list.php index 57ff9be..4f1a7cd 100644 --- a/app/Views/branch_list.php +++ b/app/Views/branch_list.php @@ -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 @@