From 8389afbf5a96e4b3efd154367b5823a6bd722906 Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Sat, 29 Nov 2025 10:40:41 +0530 Subject: [PATCH 1/2] FIX_User Model la Brach field Implemented --- app/Controllers/UserController.php | 5 + app/Models/UserModel.php | 1 + app/Views/UserList.php | 47 ++- app/Views/frontend_content_list2.php | 319 ++++++++++++++++++ .../policy_transaction_inception_list.php | 4 +- app/Views/ticket_type_modal.php | 9 +- 6 files changed, 378 insertions(+), 7 deletions(-) create mode 100644 app/Views/frontend_content_list2.php diff --git a/app/Controllers/UserController.php b/app/Controllers/UserController.php index ea0e4fb8..ee62c702 100755 --- a/app/Controllers/UserController.php +++ b/app/Controllers/UserController.php @@ -20,6 +20,7 @@ use App\Models\AuthHistoryModel; use App\Models\UserActivityHistoryModel; use App\Models\PartnerStaffModel; use App\Models\PartnerManagerIncentiveFileModel; +use App\Models\NhanceBranchModel; class UserController extends AdminController @@ -36,6 +37,7 @@ class UserController extends AdminController protected $userActivityHistoryModel; protected $partnerStaffModel; protected $partnerManagerIncentiveFileModel; + protected $nhanceBranchModel; public function __construct() { @@ -51,6 +53,7 @@ class UserController extends AdminController $this->userActivityHistoryModel = new UserActivityHistoryModel(); $this->partnerStaffModel = new PartnerStaffModel(); $this->partnerManagerIncentiveFileModel = new PartnerManagerIncentiveFileModel(); + $this->nhanceBranchModel = new NhanceBranchModel(); } public function list() @@ -63,6 +66,7 @@ class UserController extends AdminController // print_r($data); die; $data['roleData'] = $this->roleModel->select('id, role')->findAll(); $data['teamData'] = $this->teamModel->select('id, name')->where('is_active',1)->findAll(); + $data['NHanceBranchData'] = $this->nhanceBranchModel->select('id, branch_name')->where('is_active',1)->findAll(); $this->loadLayout('UserList', $data); } @@ -70,6 +74,7 @@ class UserController extends AdminController public function create() { $this->myLogger->logme('error', 'User create function called'); + dd($this->request->getPost()); $teams = $this->request->getPost('team'); //if this is get method return to user creation page diff --git a/app/Models/UserModel.php b/app/Models/UserModel.php index 8a5eff7d..20baa54c 100755 --- a/app/Models/UserModel.php +++ b/app/Models/UserModel.php @@ -27,6 +27,7 @@ class UserModel extends Model "updated_by", "updated_at", "is_active", + "nhance_branch_id", ]; // Dates diff --git a/app/Views/UserList.php b/app/Views/UserList.php index 01db38eb..94442753 100755 --- a/app/Views/UserList.php +++ b/app/Views/UserList.php @@ -487,6 +487,18 @@ table.dataTable tbody td {
+
+
+ + +
+
+
@@ -850,6 +862,13 @@ table.dataTable tbody td { var table; $(document).ready(function () { + $('#nhance_branch_id').select2(); + + $('#nhance_branch_id') + .val(null) // ✅ MUST be null + .trigger('change.select2'); // ✅ correct trigger + + var incentiveMonthPicker = flatpickr("#incentive_month", { dateFormat: "Y-m-d", // real value stored (hidden) altInput: true, // show a user-friendly display @@ -988,6 +1007,18 @@ table.dataTable tbody td { } }); + // IMPORTANT — DataTables draw event REF: TTS + table.on('draw.dt', function () { + + let rowCount = $('#scroll-horizontal-datatable').DataTable().rows({ filter: 'applied' }).count(); + + if (rowCount <= 2) { + $('.dataTables_scrollBody').css('overflow', 'inherit'); + } else { + $('.dataTables_scrollBody').css('overflow', 'auto'); + } + }); + $('#team').multiselect({ @@ -1027,7 +1058,8 @@ table.dataTable tbody td { type: "GET", dataType: 'json', success: function (res) { - console.log(res) + console.log(":():",res); + console.log(":():",res.data.nhance_branch_id); $('#updateModal').modal('show'); $('#role').val('') $('#UserForm').attr('action', ''); @@ -1038,6 +1070,18 @@ table.dataTable tbody td { $('#mobile').val(res.data.mobile); $('#emp_code').val(res.data.emp_code); $('#role option[value="' + res.data.role + '"]').prop('selected', true); + if (res.data.nhance_branch_id !== null && + res.data.nhance_branch_id !== "" && + res.data.nhance_branch_id !== 0) { + $('#nhance_branch_id') + .val(res.data.nhance_branch_id) + .trigger('change.select2'); // ✅ correct trigger + } else { + $('#nhance_branch_id') + .val(null) // ✅ MUST be null + .trigger('change.select2'); // ✅ correct trigger + } + $('#btnSubmit').html('Update'); $.each(res.userTeamData, function(index, item) { @@ -1774,6 +1818,7 @@ table.dataTable tbody td { $('#email').val(''); $('#mobile').val(''); $('#emp_code').val(''); + $('#nhance_branch_id').val('0'); $('#UserForm').attr('action', ''); let myModal = new bootstrap.Modal(document.getElementById('con-close-modal')); myModal.show(); // open modal diff --git a/app/Views/frontend_content_list2.php b/app/Views/frontend_content_list2.php new file mode 100644 index 00000000..4c867152 --- /dev/null +++ b/app/Views/frontend_content_list2.php @@ -0,0 +1,319 @@ + + + +
+
+
+
+ + + + + + + + + + + + + + + $row) { ?> + + + + + + + + + + + + + + + + +
S.No.TypeContent SectionHeadingAction
+ +
No data available
+
+
+
+
+ + + + + + diff --git a/app/Views/policy_transaction_inception_list.php b/app/Views/policy_transaction_inception_list.php index 4a0b6e29..64c113fe 100644 --- a/app/Views/policy_transaction_inception_list.php +++ b/app/Views/policy_transaction_inception_list.php @@ -317,7 +317,7 @@ table.dataTable tbody td { - + @@ -328,7 +328,7 @@ table.dataTable tbody td { - +