diff --git a/app/Controllers/BusinessController.php b/app/Controllers/BusinessController.php index 47b7ee4..3c8d217 100644 --- a/app/Controllers/BusinessController.php +++ b/app/Controllers/BusinessController.php @@ -45,7 +45,6 @@ class BusinessController extends BaseController if ($business_id === '0') { - $data['business'] = []; $data['page_name']="Add Business"; } else if ($business_id !== '0') { @@ -89,39 +88,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 3d03fb6..52ab0a0 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -36,6 +36,7 @@ class MasterController extends BaseController use ResponseTrait; + public function __construct() { $this->session = session(); @@ -49,6 +50,7 @@ class MasterController extends BaseController $this->ServiceGroupModel = new ServiceGroupModel(); $this->ClientBranchModel = new ClientBranchModel(); $this->DocsStatusModel = new DocsStatusModel(); + } @@ -219,7 +221,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 333ed9d..418d7fa 100644 --- a/app/Views/business_list.php +++ b/app/Views/business_list.php @@ -12,9 +12,9 @@

Business List

@@ -95,59 +95,6 @@ - @@ -157,13 +104,6 @@ \ No newline at end of file diff --git a/app/Views/template_form.php b/app/Views/template_form.php index 073018c..379560c 100644 --- a/app/Views/template_form.php +++ b/app/Views/template_form.php @@ -38,7 +38,7 @@
-
+
-
+
-
- +
+ '>
+
+ + +
+
@@ -207,6 +217,7 @@ $("#savedata").on("click", function() service_group_id : $('#service_group_id').val(), service_id : $('#service_id').val(), template_id : $('#template_id').val(), + template_header_business : $('#template_header_business').val(), template_name : $('#template_name').val(), body_text : $('.note-editable > p:first').text(), body_html : $('.note-codable').val(), @@ -247,37 +258,35 @@ $("#savedata").on("click", function() $(document).ready(function() { + $('#summernote-basic').summernote({ + toolbar: [ + // [groupName, [list of button]] + ['style', ['style']], + ['font', ['bold', 'italic', 'underline', 'clear' ]], + ['fontname', ['fontname']], + ['color', ['color']], + ['para', ['ul', 'ol', 'paragraph' , 'height']], + ['table', ['table']], + ['insert', [ 'picture']], + ['view', ['fullscreen', 'codeview', 'help']], + ['mybutton', ['customButton']] // Custom button group + ], - - $('#summernote-basic').summernote({ - toolbar: [ - // [groupName, [list of button]] - ['style', ['style']], - ['font', ['bold', 'italic', 'underline', 'clear' ]], - ['fontname', ['fontname']], - ['color', ['color']], - ['para', ['ul', 'ol', 'paragraph' , 'height']], - ['table', ['table']], - ['insert', [ 'picture']], - ['view', ['fullscreen', 'codeview', 'help']], - ['mybutton', ['customButton']] // Custom button group - ], - - buttons: { - customButton: function() { - var ui = $.summernote.ui; - // create button - var button = ui.button({ - contents: ' Place Holders', - tooltip: 'Client Details Place Holders', - click: function() { - $('#customModal').modal('show'); - } - }); - return button.render(); + buttons: { + customButton: function() { + var ui = $.summernote.ui; + // create button + var button = ui.button({ + contents: ' Place Holders', + tooltip: 'Client Details Place Holders', + click: function() { + $('#customModal').modal('show'); + } + }); + return button.render(); + } } - } - }); + }); setTimeout(() => {