From 8b418099232a35923913385b06f6287e2dc0143a Mon Sep 17 00:00:00 2001 From: "sanjeev.p" Date: Mon, 15 Dec 2025 18:47:55 +0530 Subject: [PATCH] FIX_KYC Deleted Issues Fixed --- app/Controllers/ClientController.php | 4 +++- app/Views/client_kyc_2.php | 26 +++++++++++++++++++++++++- app/Views/client_kyc_single_table.php | 3 ++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index d5370b02..9a29156a 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -1099,6 +1099,8 @@ class ClientController extends AdminController $kyc_id = $this->request->getPost('id'); $client_id = $this->request->getPost('client_id'); + // echo "KID".$kyc_id; + // echo "CID".$client_id; if (empty($kyc_id)) { return $this->respond(['status' => false, 'code' => 400, 'message' => 'Missing document ID.'], 200); @@ -1107,7 +1109,7 @@ class ClientController extends AdminController $updateData['is_active'] = $this->request->getPost('is_active'); $delete = $this->clientKYCDocsModel->update($kyc_id, $updateData); - + // $delete = 1; if ($delete) { $html = $this->generateKycSingleTable($client_id); $dropdown = $this->fetch_dropdown($client_id); diff --git a/app/Views/client_kyc_2.php b/app/Views/client_kyc_2.php index 8a2ce5ed..b0240572 100755 --- a/app/Views/client_kyc_2.php +++ b/app/Views/client_kyc_2.php @@ -35,7 +35,7 @@
-
@@ -318,5 +318,29 @@ }); } + // Centralized Validation Function + function validateFile(fileInput) { + var file = fileInput.files[0]; + if (!file) { + return true; // No file selected, considered valid or neutral + } + + var type = file.type; + + // Check if the type is PDF or starts with 'image/' + if (type === 'application/pdf' || type.startsWith('image/')) { + return true; // Valid + } + + // Invalid format + toastr.warning('Invalid file format. Only PDF or Image files are allowed.', 'WARNING!'); + $(fileInput).val(''); // clear file + return false; // Invalid + } + + // Attach the centralized handler to BOTH classes + $(document).on('change', '.file-input, .edit_file-input', function () { + validateFile(this); + }); \ No newline at end of file diff --git a/app/Views/client_kyc_single_table.php b/app/Views/client_kyc_single_table.php index 4982bcdf..cae36927 100644 --- a/app/Views/client_kyc_single_table.php +++ b/app/Views/client_kyc_single_table.php @@ -24,6 +24,7 @@ @@ -45,7 +46,7 @@