diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 3ab8eeb..e4f7baa 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -273,21 +273,7 @@ class ClientController extends BaseController $staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow(); $data['business_list'] = $this->BusinessModel->findAll(); - $business_id = $this->session->get('logged_in_staff_business_id'); - $business_id_check = 0; - foreach ($data['clientBranchList'] as $index => $value) { - foreach (json_decode($value['business_id']) as $key => $values) { - if($values == $business_id){ - $business_id_check = $business_id; - } - } - if($business_id_check != 0){ - $data['clientBranchList'][$index] =$value; - }else{ - unset($data['clientBranchList'][$index]); // Remove the element completely - } - $business_id_check = 0; - } + echo view('layout/header', ['Data'=>$staffdata]); echo view('client_branch_list',$data); echo view('layout/footer'); diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 408b7f0..f83c7a1 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -118,22 +118,6 @@ class MasterController extends BaseController $data['serviceGroupList'][$key] = $value; } - $business_id = $this->session->get('logged_in_staff_business_id'); - $business_id_check = 0; - foreach ($data['serviceGroupList'] as $index => $value) { - foreach (json_decode($value['business_id']) as $key => $values) { - if($values == $business_id){ - $business_id_check = $business_id; - } - } - if($business_id_check != 0){ - $data['serviceGroupList'][$index] =$value; - }else{ - unset($data['serviceGroupList'][$index]); // Remove the element completely - } - $business_id_check = 0; - } - // dd($data); echo view('layout/header', ['Data'=>$staffdata]); echo view('service_group_list',$data); echo view('layout/footer'); @@ -177,21 +161,7 @@ class MasterController extends BaseController ->groupBy('services.service_id') ->orderBy('services.service_group_id') ->findAll(); - $business_id = $this->session->get('logged_in_staff_business_id'); - $business_id_check = 0; - foreach ($data['serviceList'] as $index => $value) { - foreach (json_decode($value['business_id']) as $key => $values) { - if($values == $business_id){ - $business_id_check = $business_id; - } - } - if($business_id_check != 0){ - $data['serviceList'][$index] =$value; - }else{ - unset($data['serviceList'][$index]); // Remove the element completely - } - $business_id_check = 0; - } + $data['serviceGroupData'] = $this->ServiceGroupModel->where('is_active',1)->findall(); $staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow(); $data['business_list'] = $this->BusinessModel->findAll(); @@ -239,21 +209,7 @@ class MasterController extends BaseController ->findAll(); $staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow(); $data['business_list'] = $this->BusinessModel->findAll(); - $business_id = $this->session->get('logged_in_staff_business_id'); - $business_id_check = 0; - foreach ($data['templateData'] as $index => $value) { - foreach (json_decode($value['business_id']) as $key => $values) { - if($values == $business_id){ - $business_id_check = $business_id; - } - } - if($business_id_check != 0){ - $data['templateData'][$index] =$value; - }else{ - unset($data['templateData'][$index]); // Remove the element completely - } - $business_id_check = 0; - } + echo view('layout/header', ['Data'=>$staffdata]); echo view('template_list',$data); echo view('layout/footer'); diff --git a/app/Controllers/StaffController.php b/app/Controllers/StaffController.php index 7e836b6..a949d7e 100644 --- a/app/Controllers/StaffController.php +++ b/app/Controllers/StaffController.php @@ -99,21 +99,7 @@ class StaffController extends BaseController $staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow(); $data['business_list'] = $this->BusinessModel->findAll(); - $business_id = $this->session->get('logged_in_staff_business_id'); - $business_id_check = 0; - foreach ($data['staffList'] as $index => $value) { - foreach (json_decode($value['business_id']) as $key => $values) { - if($values == $business_id){ - $business_id_check = $business_id; - } - } - if($business_id_check != 0){ - $data['staffList'][$index] =$value; - }else{ - unset($data['staffList'][$index]); // Remove the element completely - } - $business_id_check = 0; - } + echo view('layout/header', ['Data'=>$staffdata]); echo view('staff_list',$data); echo view('layout/footer'); @@ -191,7 +177,7 @@ class StaffController extends BaseController { if(!$this->session->has('is_staff_logged_in')){ return redirect()->to(base_url().'staff'); } $business_id = $this->session->get('logged_in_staff_business_id'); - $data['clientListForList'] = $this->ClientModel->where('business_id',$business_id)->findAll(); + $data['clientListForList'] = $this->ClientModel->findAll(); $data['clientList'] = $this->ClientModel->select('client.*, service_group.business_id') ->join('client_branch', 'client_branch.client_id = client.client_id') ->join('client_docs', 'client_docs.client_branch_id = client_branch.id') @@ -202,20 +188,7 @@ class StaffController extends BaseController ->get() ->getRow(); $data['business_list'] = $this->BusinessModel->findAll(); - $business_id_check = 0; - foreach ($data['clientList'] as $index => $value) { - foreach (json_decode($value['business_id']) as $key => $values) { - if($values == $business_id){ - $business_id_check = $business_id; - } - } - if($business_id_check != 0){ - $data['clientList'][$index] =$value; - }else{ - unset($data['clientList'][$index]); // Remove the element completely - } - $business_id_check = 0; - } + echo view('layout/header', ['Data'=>$staffdata]); echo view('client_list',$data); echo view('layout/footer');