diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 10fb373c..31453be4 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -527,6 +527,7 @@ $routes->post("employeeRest/updateMpin", "RestAuthenticationController::updateMp $routes->post("employeeRest/getPostEmployeeDataForAuth", "RestAuthenticationController::getPostEmployeeDataForAuth"); // $routes->post("logHrActivity", "RestAuthenticationController::logHrActivity"); +$routes->get("employeeRest/getClientDetails", "EmployeeRestController::getClientDetails"); $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { @@ -551,7 +552,7 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { $routes->get("deleteDependence", "EmployeeRestController::deleteDependence"); $routes->get("getEmployeeAndDependenceByClientId", "EmployeeRestController::getEmployeeAndDependenceByClientId"); $routes->get("getClientPolicy", "EmployeeRestController::getClientPolicy"); - $routes->get("getClientDetails", "EmployeeRestController::getClientDetails"); + $routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy"); $routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn"); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 15df403f..ee7ae376 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -134,11 +134,11 @@ class ClientController extends AdminController public function validateDuplicateByClientBranch() { - $request = service('request'); - $value = $request->getPost('value'); - $clientId = $request->getPost('client_id'); - $branchId = $request->getPost('branch_id'); - $isDuplicate = $this->clientModel->isDuplicateByClientBranch($value, $clientId, $branchId); + $value = $this->request->getPost('value'); + $clientId = $this->request->getPost('client_id'); + $branchId = $this->request->getPost('branch_id'); + $field = $this->request->getPost('field'); + $isDuplicate = $this->clientModel->isDuplicateByClientBranch($value, $field, $clientId, $branchId); return $this->response->setJSON(['isDuplicate' => $isDuplicate]); } public function checkDuplicateTableFieldValue() diff --git a/app/Models/ClientModel.php b/app/Models/ClientModel.php index 09db986d..b84bfae1 100755 --- a/app/Models/ClientModel.php +++ b/app/Models/ClientModel.php @@ -226,12 +226,12 @@ class ClientModel extends Model return $result; } - public function isDuplicateByClientBranch($email, $clientId, $branchId) + public function isDuplicateByClientBranch($value, $field, $clientId, $branchId) { $builder = $this->db->table('level_contacts lc') ->select('lc.id') ->join('client_branch cb', 'lc.ref_id = cb.id', 'left') - ->where('lc.email', $email) + ->where('lc.'.$field, $value) ->where('lc.contact_type', 'client') ->where('cb.client_id', $clientId) ->where('lc.ref_id', $branchId) diff --git a/app/Views/client_branch.php b/app/Views/client_branch.php index b959254b..31e08346 100755 --- a/app/Views/client_branch.php +++ b/app/Views/client_branch.php @@ -198,12 +198,13 @@