diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 34830575..c7e9beaf 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -4564,11 +4564,11 @@ class ClientController extends AdminController // Additional logic for non-individual clients (client_type != 2) $branch_insert = null; if ($client_type != 2) { - $unit[] = $postData['short_name'] . '-' . 001; + $unit[] = $postData['short_name'] . '-' . $postData['branch_code'] ?? 001; $branch_data = [ 'client_id' => $client_insert, 'branch_name' => $postData['branch_name'], - 'branch_code' => 001, + 'branch_code' => $postData['branch_code'] ?? 001, 'gst' => $postData['gst'], 'units' => json_encode($unit) ?? null, ]; @@ -4580,6 +4580,7 @@ class ClientController extends AdminController 'contact_type' => 'client', 'name' => $postData['name'], 'email' => $postData['email'], + 'mobile' => $postData['mobile'] ?? null, ]; $this->levelContactModel->insert($contact_data); } diff --git a/app/Views/leads_form_handler.php b/app/Views/leads_form_handler.php index c21a4637..477e610b 100644 --- a/app/Views/leads_form_handler.php +++ b/app/Views/leads_form_handler.php @@ -189,7 +189,7 @@ if (isset($selected_lead_type)) { $('#leads_form').hide() } - function getClientAndBranchAndPolicy() { + function getClientAndBranchAndPolicy(append = true) { console.log('getClientAndBranchAndPolicy function called') @@ -204,7 +204,9 @@ if (isset($selected_lead_type)) { client_list = res.client_data; branch_list = res.branch_data; policy_list = res.policy_data; - appendClients(res.client_data); + if(append == true){ + appendClients(res.client_data); + } } else { console.log('No data found'); } @@ -217,7 +219,7 @@ if (isset($selected_lead_type)) { }); } - function appendClients(data) { + function appendClients(data, client_id = null) { // console.log("lead_type",lead_type.value); $('#client_id').empty(); @@ -249,13 +251,17 @@ if (isset($selected_lead_type)) { class: (item.client_type == 1) ? 'group' : (item.client_type == 2) ? 'individual' : '' }); + if (client_id == item.id) { + option.attr('selected', true); + } + $('#client_id').append(option); } }); } - function appendBranch(data) { + function appendBranch(data, branch_id = null) { $('#client_branch_id').empty(); @@ -270,6 +276,11 @@ if (isset($selected_lead_type)) { value: item.id, text: item.branch_name }); + + if (branch_id == item.id) { + option.attr('selected', true); + } + $('#client_branch_id').append(option); }); } @@ -336,6 +347,8 @@ if (isset($selected_lead_type)) { $("#client_short_name").val(shortName); if (client_id == 'add_client') { + + $(this).val("").select2(); // alert("Hello"); var myModal = new bootstrap.Modal(document.getElementById('upload_enrollment_model')); myModal.show(); diff --git a/app/Views/newClientModal-old.php b/app/Views/newClientModal-old.php new file mode 100644 index 00000000..387578c9 --- /dev/null +++ b/app/Views/newClientModal-old.php @@ -0,0 +1,312 @@ + +