FIX_KYC Deleted Issues Fixed

This commit is contained in:
sanjeev.p 2025-12-15 18:47:55 +05:30
parent 919d15ed54
commit 8b41809923
3 changed files with 30 additions and 3 deletions

View File

@ -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);

View File

@ -35,7 +35,7 @@
<div class="form-group col-md-3 file-input-group">
<label for="file_input">Browser File<span class="text-danger">*</span></label>
<input type="file" class="form-control file-input" id="kyc_docs_file" name="file_name" required accept=".pdf, .jpeg, .jpg, .png"
<input type="file" class="form-control file-input" id="kyc_docs_file" name="file_name" required
style="box-shadow: none !important; outline: none !important; border: none; height: unset !important;padding: 0px !important;background: transparent !important;">
</div>
@ -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);
});
</script>

View File

@ -24,6 +24,7 @@
<a class="mdi mdi-delete mr-1 btn-delete-kyc"
data-id="<?= $value['id'] ?>"
data-client_id="<?= $value['client_id'] ?>"
style="font-size:18px;"></a>
</td>
</tr>
@ -45,7 +46,7 @@
<input type="file"
name="file_name"
id="kyc_docs_file_<?= $value['id'] ?>"
class="form-control"
class="form-control edit-file-input"
style="box-shadow:none!important; outline:none!important; border:none; height:unset!important;padding: 0px !important;background: transparent !important;">
</div>