diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 240a7dde..f8444717 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -281,16 +281,20 @@ class ClientController extends AdminController { $this->myLogger->logme('error','edit client general info function called'); $uploadFilePath = ROOTPATH . 'public/uploads/logo/'; + // print_r($this->request->getFile('client_logo'));die; $file_name = file_Upload($this->request->getFile('client_logo'), $uploadFilePath); $id = $this->request->getPost('PrimaryKey'); $data = $this->request->getPost(); $data['updated_by'] = get_session_userid(); + $data['client_logo'] = $file_name; + if (!isset($data['is_download_btn'])) { $data['is_download_btn'] = 0; } elseif ($data['is_download_btn']) { $data['is_download_btn'] = 1; } + // print_r($data);die; $update = $this->clientModel->update($id,$data); diff --git a/app/Views/client_basic_info.php b/app/Views/client_basic_info.php index 944faaec..696897b5 100644 --- a/app/Views/client_basic_info.php +++ b/app/Views/client_basic_info.php @@ -282,17 +282,20 @@ input:checked + .slider:before { }, 1000); } - $('#client_id').val(res.data.id); - $('#general_PrimaryKey').val(res.data.id); - $('#client_id_relation').val(res.data.id); - $('#relation_PrimaryKey').val(res.data.id); - $('#client_id_branch').val(res.data.id); - $('#client_id_for_client_branch').val(res.data.id); - $('#client_id_policy').val(res.data.id); - $('#policy_PrimaryKey').val(res.data.id); - $('#client_id_kyc').val(res.data.id); - $('#kyc_PrimaryKey').val(res.data.id); - $('#Client_id').val(res.data.id); + var idToUse = res.data.id ? res.data.id : res.data.PrimaryKey; + + $('#client_id').val(idToUse); + $('#general_PrimaryKey').val(idToUse); + $('#client_id_relation').val(idToUse); + $('#relation_PrimaryKey').val(idToUse); + $('#client_id_branch').val(idToUse); + $('#client_id_for_client_branch').val(idToUse); + $('#client_id_policy').val(idToUse); + $('#policy_PrimaryKey').val(idToUse); + $('#client_id_kyc').val(idToUse); + $('#kyc_PrimaryKey').val(idToUse); + $('#Client_id').val(idToUse); + $('#entity_type').val(res.data.entity_type_id); @@ -362,15 +365,22 @@ input:checked + .slider:before { } function PreviewImage() { - var oFReader = new FileReader(); - oFReader.readAsDataURL(document.getElementById("client_logo").files[0]); + var file = document.getElementById("client_logo").files[0]; + + if (file) { + if (file.size <= 200 * 1024) { // 200kb in bytes + var oFReader = new FileReader(); + oFReader.readAsDataURL(file); - oFReader.onload = function (oFREvent) { - document.getElementById("uploadPreview").src = oFREvent.target.result; - }; + oFReader.onload = function (oFREvent) { + document.getElementById("uploadPreview").src = oFREvent.target.result; + }; + } + } }; + // function validateFile(input) { // const file = input.files[0]; // const allowedExtensions = ["jpg", "jpeg", "png"]; @@ -394,8 +404,8 @@ input:checked + .slider:before { toastr.warning('Only JPG, JPEG, PNG files are allowed.', 'Invalid file type.'); document.getElementById("uploadPreview").src = ""; $("#uploadPreview").attr("src", "http://ssl.gstatic.com/accounts/ui/avatar_2x.png"); - input.value = ""; - return; + // input.value = ""; + // return; } // Check file size @@ -403,8 +413,8 @@ input:checked + .slider:before { if (fileSize > 200) { toastr.warning('Maximum file size allowed is 200KB.', 'File size exceeds limit.'); $("#uploadPreview").attr("src", "http://ssl.gstatic.com/accounts/ui/avatar_2x.png"); - input.value = ""; - return; + // input.value = ""; + // return; } // Check image dimensions @@ -413,8 +423,8 @@ input:checked + .slider:before { if (this.width !== 100 || this.height !== 100) { toastr.warning('Image dimensions should be 100x100 pixels.', 'Invalid image dimensions.'); $("#uploadPreview").attr("src", "http://ssl.gstatic.com/accounts/ui/avatar_2x.png"); - input.value = ""; - return; + // input.value = ""; + // return; } // If both size and dimensions are valid, you can proceed with your logic here // For example, you can display the image diff --git a/app/Views/client_branch.php b/app/Views/client_branch.php index fafb06ba..ddcb9670 100644 --- a/app/Views/client_branch.php +++ b/app/Views/client_branch.php @@ -200,6 +200,13 @@ $(document).ready(function () { $('#branch_city').val(''); $('#branch_form')[0].reset(); $('.ac').css('display', 'block'); + $('.parsley-errors-list').remove(); + + $('#branch_form').parsley().reset(); + + + + contactCount = 1 var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || []; @@ -316,7 +323,7 @@ $(document).ready(function () { $('.loader-mask').delay(350).fadeOut('slow'); }, 500); - console.log('branch contact : ',res.contact) + // console.log('branch contact : ',res.contact) $('#add_branch').show(); $('#branch_table').hide(); @@ -335,7 +342,7 @@ $(document).ready(function () { $('#designation').val(res.contact[0].designation); res.contact.shift(); - console.log(res.contact.length) + // console.log(res.contact.length) for (let index = 0; index < res.contact.length; index++) { const contact = res.contact[index]; if (contact !== undefined) { diff --git a/app/Views/client_deposit_list.php b/app/Views/client_deposit_list.php index a0246dce..634aa602 100644 --- a/app/Views/client_deposit_list.php +++ b/app/Views/client_deposit_list.php @@ -5,7 +5,7 @@
-

Client Deposit - client_name);?>

+

Client Deposit - client_name);?>