From 348d9ead063891caa8a9cbd4e5111277e611b46a Mon Sep 17 00:00:00 2001 From: bitbucket Date: Thu, 13 Jun 2024 09:36:52 +0530 Subject: [PATCH] GWM --- app/Controllers/BusinessController.php | 30 ++--- app/Controllers/MasterController.php | 5 +- app/Models/BusinessModel.php | 2 +- app/Models/TemplateModel.php | 2 +- app/Views/business_form.php | 146 ++++++++++++++++--------- app/Views/business_list.php | 95 ++-------------- app/Views/template_form.php | 75 +++++++------ 7 files changed, 158 insertions(+), 197 deletions(-) diff --git a/app/Controllers/BusinessController.php b/app/Controllers/BusinessController.php index 489142e..0378f75 100644 --- a/app/Controllers/BusinessController.php +++ b/app/Controllers/BusinessController.php @@ -42,7 +42,6 @@ class BusinessController extends BaseController if ($business_id === '0') { - $data['business'] = []; $data['page_name']="Add Business"; } else if ($business_id !== '0') { @@ -86,39 +85,26 @@ class BusinessController extends BaseController { $BusinessModel = new BusinessModel(); - $uploadFilePath = ROOTPATH . 'public/uploads/'; - - $data = [ - 'business_name' => $this->request->getPost('businessname'), - 'letter_header' => $this->request->getPost('letter_header'), - 'isactive' => 1 - ]; - // print_r($this->request->getFile('business_logo'));die; - if($this->request->getFile('business_logo')){ - $file_name = $this->file_Upload($this->request->getFile('business_logo'), $uploadFilePath); - if($file_name){ - $data['logo'] = $file_name; - } - } - + $business_id = $this->request->getPost('business_id'); + $data = $this->request->getPost(); - if (!empty($business_id)) { + if ($business_id != '') { $BusinessModel->update($business_id, $data); + return $this->response->setJSON(['success' => true ]); + } else { $BusinessModel->insert($data); + return $this->response->setJSON(['success' => true ]); } - if (session()->get('logged_user_role') == "Administrator") { - return redirect()->to('new_business/'.session()->get("logged_user_business_id")); - }else{ - return redirect()->to('business_list'); - } + } + public function delete_business($business_id) { $model = new BusinessModel(); diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 7d6eb7a..416bdb2 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -14,6 +14,7 @@ use App\Models\ServiceGroupModel; use App\Models\ClientBranchModel; use App\Models\DocsStatusModel; + class MasterController extends BaseController { public $session; @@ -29,6 +30,7 @@ class MasterController extends BaseController protected $DocsStatusModel; + public function __construct() { $this->session = session(); @@ -42,6 +44,7 @@ class MasterController extends BaseController $this->ServiceGroupModel = new ServiceGroupModel(); $this->ClientBranchModel = new ClientBranchModel(); $this->DocsStatusModel = new DocsStatusModel(); + } @@ -212,7 +215,7 @@ class MasterController extends BaseController $id = $this->request->getVar('service_id'); $data['AllServiceGroupData'] = $this->ServiceGroupModel->findAll(); - //$data['AllServiceData'] = $this->ServiceModel->where('branch_id',$this->session->get('logged_in_staff_branch_id'))->findAll(); + $data['AllBusinessData'] = $this->BusinessModel->findAll(); $staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow(); echo view('layout/header', ['Data'=>$staffdata]); diff --git a/app/Models/BusinessModel.php b/app/Models/BusinessModel.php index f418a88..201c41c 100644 --- a/app/Models/BusinessModel.php +++ b/app/Models/BusinessModel.php @@ -5,7 +5,7 @@ class BusinessModel extends Model { protected $table = 'business'; protected $primaryKey = 'business_id'; - protected $allowedFields = ['business_id','business_unique_id','branch_unique_id','logo', 'business_name','isactive','letter_header']; + protected $allowedFields = ['business_id','business_unique_id','branch_unique_id','logo', 'business_name','isactive','letter_header','header_html','footer_html']; public function getBusinessById($business_id) { return $this->db->table('business')->where('business_id', $business_id)->get()->getRowArray(); diff --git a/app/Models/TemplateModel.php b/app/Models/TemplateModel.php index 8d8cb24..bded52c 100644 --- a/app/Models/TemplateModel.php +++ b/app/Models/TemplateModel.php @@ -7,7 +7,7 @@ class TemplateModel extends Model protected $table = 'template'; protected $primaryKey = 'template_id'; - protected $allowedFields = ['service_group_id','service_id','template_name','header_type','body_text','body_html', 'is_active' ,'created_by','updated_by']; + protected $allowedFields = ['service_group_id','service_id','template_name','template_header_business','header_type','body_text','body_html', 'is_active' ,'created_by','updated_by']; diff --git a/app/Views/business_form.php b/app/Views/business_form.php index 04ab28a..ee2a0c2 100644 --- a/app/Views/business_form.php +++ b/app/Views/business_form.php @@ -24,27 +24,44 @@ -
-
+
+
+
- - -
" method="post"> +
-
+
- +
+ +
+ + +
+
+ +
+ + + +
+
- - + + + '> + '> + +
+
@@ -55,56 +72,83 @@
diff --git a/app/Views/business_list.php b/app/Views/business_list.php index 922c5f0..c6d3298 100644 --- a/app/Views/business_list.php +++ b/app/Views/business_list.php @@ -12,9 +12,9 @@

Business List

@@ -53,10 +53,10 @@