FIX_policy KYC Docs redesigned

This commit is contained in:
venba-Inspriron-3558 2025-12-05 09:48:53 +05:30
parent 959f6620bd
commit 9cac014d44
9 changed files with 756 additions and 35 deletions

View File

@ -162,6 +162,11 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
$routes->post("edit", "ClientController::editClientKYCInfo");
$routes->get("list/(:any)", "ClientController::getKycDocsById/$1");
$routes->get("delete/(:any)", "ClientController::deleteClientKycDocs/$1");
$routes->post("create_2", "ClientController::createClientKYCInfo_2");
$routes->post("edit_2", "ClientController::editClientKYCInfo_2");
$routes->post("delete_2", "ClientController::deleteClientKycDocs_2/$1");
});
$routes->group("premimum", ["filter" => "authMVC"], function ($routes) {

View File

@ -1005,6 +1005,153 @@ class ClientController extends AdminController
public function createClientKYCInfo_2()
{
$this->myLogger->logme('error', 'create Client kyc function called');
$data = $this->request->getPost();
$uploadedFile = $this->request->getFile('file_name');
if ($uploadedFile && $uploadedFile->isValid() && !$uploadedFile->hasMoved()) {
$this->myLogger->logme('info', 'File is valid and ready to move.');
} else {
$this->myLogger->logme('error', 'File failed validation or was not uploaded.');
}
$uploadFilePath = WRITEPATH . 'uploads/client_kyc_documents';
$File = file_Upload($uploadedFile, $uploadFilePath);
$this->myLogger->logme('info', 'Result of file_Upload: ' . $File);
unset($data['file_name']);
if (!empty($File)) { $data['file_name'] = $File; }
$data['created_by'] = get_session_userid();
$insert = $this->clientKYCDocsModel->insert($data);
if ($insert) {
$html = $this->generateKycSingleTable($data['client_id']);
$dropdown = $this->fetch_dropdown($data['client_id']);
return $this->respond(['status' => true, 'code' => 200, 'file_name' => $File, 'html' => $html,'dropdown'=>$dropdown], 200);
} else {
$this->myLogger->logme('error', 'Database insert failed.');
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to add document'], 200);
}
}
public function editClientKYCInfo_2()
{
$kyc_id = $this->request->getPost('id');
$client_id = $this->request->getPost('client_id');
$old_file_name = $this->request->getPost('old_file_name');
$uploadedFile = $this->request->getFile('file_name');
$new_file_name = null;
$uploadFilePath = WRITEPATH . 'uploads/client_kyc_documents';
if ($uploadedFile && $uploadedFile->isValid() && !$uploadedFile->hasMoved()) {
$new_file_name = file_Upload($uploadedFile, $uploadFilePath);
if (!empty($new_file_name)) {
$updateData['file_name'] = $new_file_name;
// Delete the old file from the storage if it exists
// if (!empty($old_file_name)) {
// $old_file_path = $uploadFilePath . '/' . $old_file_name;
// if (file_exists($old_file_path)) {
// unlink($old_file_path);
// // Optionally delete from G-Drive here if applicable
// }
// }
} else {
// New file upload failed
return $this->respond(['status' => false, 'code' => 500, 'message' => 'New file upload failed on server.'], 200);
}
}
// 2. Perform the database update
if (!empty($updateData)) {
$updateData['updated_by'] = get_session_userid();
$update = $this->clientKYCDocsModel->update($kyc_id, $updateData);
$html = $this->generateKycSingleTable($client_id);
$dropdown = $this->fetch_dropdown($client_id);
if ($update) {
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Document updated successfully.','html' => $html,'dropdown' => $dropdown], 200);
}
} else {
return $this->respond(['status' => true, 'code' => 200, 'message' => 'No changes detected. Document remains the same.'], 200);
}
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Database update failed or record not found.'], 200);
}
public function deleteClientKycDocs_2()
{
$kyc_id = $this->request->getPost('id');
$client_id = $this->request->getPost('client_id');
if (empty($kyc_id)) {
return $this->respond(['status' => false, 'code' => 400, 'message' => 'Missing document ID.'], 200);
}
$updateData['updated_by'] = get_session_userid();
$updateData['is_active'] = $this->request->getPost('is_active');
$delete = $this->clientKYCDocsModel->update($kyc_id, $updateData);
if ($delete) {
$html = $this->generateKycSingleTable($client_id);
$dropdown = $this->fetch_dropdown($client_id);
return $this->respond(['status' => true, 'code' => 200, 'id' => $kyc_id, 'message' => 'Document successfully deactivated.','html' => $html,'dropdown' => $dropdown], 200);
} else {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update record (ID not found or DB error).'], 200);
}
}
public function fetch_dropdown($client_id){
$db = db_connect();
$submitted_ids_subquery = $db->table('client_kyc_documents ckd')
->select('ckd.kyc_doc_type_id')
->where('ckd.client_id', $client_id)
->where('ckd.is_active', 1)
->getCompiledSelect();
$result = $db->table('kyc_docs kd')
->select('kd.*')
->join('clients c', 'kd.kyc_type_id = c.entity_type_id')
->where('c.id', $client_id)
->where("kd.kyc_type_id NOT IN ({$submitted_ids_subquery})")
->groupBy('kd.id')
->get()
->getResultArray();
$dropdown = '<option value="">Select Document</option>';
$dropdown .= '<option value="other">Additional Document</option>';
foreach ($result as $row) {
$dropdown .= '<option value="' . esc($row['kyc_type_id']) . '">'
. esc($row['file_name']) .
'</option>';
}
return $dropdown;
}
public function createClientRelation()
{
@ -2361,6 +2508,36 @@ class ClientController extends AdminController
}
public function generateKycSingleTable($client_id)
{
$result['ckdlist'] = db_connect()->table('client_kyc_documents ckd')
->select("ckd.id,ckd.client_id,ckd.kyc_doc_type_id,ckd.file_name,kd.file_name AS kd_docs_name,ckd.other_docs_name,ckd.vehicle_id,ckd.is_active,
CASE
WHEN ckd.kyc_doc_type_id IS NULL
OR ckd.kyc_doc_type_id = 0
OR ckd.kyc_doc_type_id = ''
THEN ckd.other_docs_name
ELSE kd.file_name
END AS ui_docs_name")
->join('kyc_docs kd','ckd.kyc_doc_type_id = kd.kyc_type_id','left')
->where('ckd.client_id',$client_id)
->where('ckd.is_active',1)
->groupBy('ckd.id')
->get()
->getResultArray();
$result['client_id'] = $client_id;
$table = view('client_kyc_single_table', $result);
return $table;
// print_r($table); die;
}
public function getPolicesByInsurerId($id = null)
{
$this->myLogger->logme('error', 'getPolicesByInsurerId function called');

View File

@ -994,6 +994,7 @@
$clientController = new ClientController();
$data['client_kyc_primary_table'] = $clientController->generateKycPrimaryTable($data['client_id']);
$data['client_kyc_other_table'] = $clientController->generateKycOthersTable($data['client_id']);
// $data['client_kyc_single_table'] = $clientController->generateKycSingleTable($data['client_id']);
$data['entity_type_id'] = $client_data['entity_type_id'];
return $this->respondSuccess($insert, "Policy transaction created successfully", $data);
@ -1056,6 +1057,7 @@
$clientController = new ClientController();
$data['client_kyc_primary_table'] = $clientController->generateKycPrimaryTable($data['client_id']);
$data['client_kyc_other_table'] = $clientController->generateKycOthersTable($data['client_id']);
// $data['client_kyc_single_table'] = $clientController->generateKycSingleTable($data['client_id']);
$data['entity_type_id'] = $client_data['entity_type_id'];
@ -1624,6 +1626,8 @@
$clientController = new ClientController();
$data['client_kyc_primary_table'] = $clientController->generateKycPrimaryTable($data['client_id']);
$data['client_kyc_other_table'] = $clientController->generateKycOthersTable($data['client_id']);
$data['client_kyc_single_table'] = $clientController->generateKycSingleTable($data['client_id']);
$data['client_kyc_dd_data'] = $clientController->fetch_dropdown($data['client_id']);
$data['vehicle_docs'] = $this->clientKYCDocsModel
->where('client_id', $data['client_id'])
@ -1894,6 +1898,7 @@
$clientController = new ClientController();
$data['client_kyc_primary_table'] = $clientController->generateKycPrimaryTable($data['client_id']);
$data['client_kyc_other_table'] = $clientController->generateKycOthersTable($data['client_id']);
$data['client_kyc_single_table'] = $clientController->generateKycSingleTable($data['client_id']);
$data['vehicle_docs'] = $this->clientKYCDocsModel
->where('client_id', $data['client_id'])

322
app/Views/client_kyc_2.php Executable file
View File

@ -0,0 +1,322 @@
<style> .card-body{ margin-top: 0px !important; } </style>
<div class="tab-pane fade" id="KYC-DOC-tab">
<div id="others">
<div class="col-lg-12 col-sm-12 col-md-12">
<div class="card" style="margin-bottom: unset">
<div class="card-body"
style="margin-top: 0px !important;
margin-bottom: 0px !important;
padding-top: 0px !important;
padding-bottom: 0px !important;">
<h3>Documents</h3>
<form role="form" class="parsley-examples" method="post" id="kyc_form_add"
enctype="multipart/form-data">
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" name="PrimaryKey" id="kyc_PrimaryKey" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
<input type="hidden" name="client_id" id="client_id_kyc" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
<input type="hidden" name="kyc_doc_type_id" value="">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-3">
<label for="document_select">Document Name<span class="text-danger">*</span></label>
<select class="form-control document-select" id="docs_type_id" name="docs_type_id" required onchange="handleDocumentSelectChange(this)">
<option value="">Select Document</option>
<option value="other">Additional Document</option>
</select>
</div>
<div class="form-group col-md-3 other-docs-name-group" style="display:none;">
<label for="other_docs_name">Enter Document Name<span class="text-danger">*</span></label>
<input type="text" class="form-control other-docs-name-input" name="other_docs_name" placeholder="Enter file name">
</div>
<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"
style="box-shadow: none !important; outline: none !important; border: none; height: unset !important;padding: 0px !important;background: transparent !important;">
</div>
<div class="form-group col-md-3" style="<?= isset($client['id']) ? 'margin-top: 41px;' : 'margin-top: 30px;' ?>">
<button type="submit" class="btn btn-sm waves-effect waves-light mr-1"id="btnSubmit">Save</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div> <!-- end col-->
</div> <!-- end row -->
<div class="col-lg-12">
<div class="card" id="collapseOne">
<div class="card-body">
<div class="table-responsive">
<table data-custom-table-css="second-table" id="kyc_table" class="table table-sm mb-0">
<thead>
<tr>
<th>S. No</th>
<th>Document Name</th>
<th>File Name</th>
<th>Action</th>
</tr>
</thead>
<tbody id="tbody">
<?= isset($client_kyc_single_table) ? $client_kyc_single_table : "" ?>
</tbody>
</table>
</div> <!-- end table-responsive-->
</div>
</div> <!-- end card -->
</div> <!-- end col -->
</div>
<!-- end -->
<script>
var kycPrimaryKey = $('#client_id_kyc').val();
function handleDocumentSelectChange(selectElement) {
var $row = $(selectElement).closest('.form-row');
var $otherDocsGroup = $row.find('.other-docs-name-group');
var $otherDocsInput = $row.find('.other-docs-name-input');
var $fileInputGroup = $row.find('.file-input-group');
if (selectElement.value === 'other') {
$otherDocsGroup.removeClass('d-none').show();
$otherDocsInput.prop('required', true);
$fileInputGroup.removeClass('col-md-3 col-md-4').addClass('col-md-3');
} else {
$otherDocsGroup.addClass('d-none').hide();
$otherDocsInput.prop('required', false).val('');
$fileInputGroup.removeClass('col-md-3 col-md-4').addClass('col-md-4');
}
}
// Attach the change handler to all dropdowns
$(document).on('change', '.document-select', function() {
handleDocumentSelectChange(this);
});
$(document).ready(function(){
$("#kyc_form_add")[0].reset();
kycPrimaryKey = $('#kyc_PrimaryKey').val();
$('.document-select').each(function() {
handleDocumentSelectChange(this);
});
})
// ADD BUTTON---
$('#kyc_form_add').on('submit', function (e) {
e.preventDefault();
var docSelect = $('#docs_type_id');
var fileInput = $('#kyc_docs_file');
if (docSelect.val() === '' || fileInput[0].files.length === 0) {
toastr.error("Please select a document name and browser a file.");
return;
}
addKycDoc();
});
// ADD Functionality ---
function addKycDoc() {
var form = document.getElementById('kyc_form_add');
var formData = new FormData(form);
var docTypeVal = $('#docs_type_id').val();
// ✅ Correct handling
if (docTypeVal === 'other') {
formData.set('kyc_doc_type_id', '');
formData.set('other_docs_name', $('.other-docs-name-input').val());
} else {
formData.set('kyc_doc_type_id', docTypeVal);
formData.set('other_docs_name', '');
}
formData.set('client_id', $('#client_id_kyc').val());
formData.set('is_active', 1);
var fileInput = $('#kyc_docs_file')[0].files[0];
if (fileInput) {
formData.set('file_name', fileInput);
}
$('.loader').fadeIn();
$.ajax({
url: '<?= base_url("client/kyc/create_2"); ?>',
type: 'POST',
data: formData,
processData: false,
contentType: false,
dataType: 'json',
success: function (res) {
$('.loader').fadeOut();
if (res.status) {
$('#other_docs').html(res.data);
toastr.success('Document added successfully');
$('.other-docs-name-group').addClass('d-none');
$('.other-docs-name-input').val('');
$('#docs_type_id').empty();
$('#docs_type_id').append(res.dropdown);
$('#tbody').empty();
$('#tbody').append(res.html);
$('#kyc_form_add')[0].reset();
} else {
toastr.warning('Failed to add document');
}
},
error: function () {
$('.loader').fadeOut();
toastr.error('Upload error');
}
});
}
$(document).ready(function() {
// EDIT BUTTON---
$(document).on('click', '.btn-edit-kyc', function() {
let id = $(this).data('id');
$(`#data_row_${id}`).addClass('d-none');
$(`#edit_row_${id}`).removeClass('d-none');
});
// CANCEL BUTTON IN EDIT ---
$(document).on('click', '.btn-cancel-kyc', function() {
let id = $(this).data('id');
$(`#edit_row_${id}`).addClass('d-none');
$(`#data_row_${id}`).removeClass('d-none');
$(`#kyc_form_${id}`)[0].reset();
});
// UPDATE CLICK HANDLER ---
$(document).on('click', '.btn-update-kyc', function() {
let id = $(this).data('id');
var client_id = $(this).data('client_id');
var formElement = $(this).closest('form')[0]; // Fails if button isn't inside the form
updateKycDocWithForm(formElement, client_id);
});
});
// UPDATE Functionality ---
function updateKycDocWithForm(formElement, client_id) {
var formData = new FormData(formElement); // Use the element directly
formData.set('client_id', client_id);
let id = formData.get('id');
let fileInput = $(`#kyc_docs_file_${id}`)[0].files[0];
if (!fileInput) { console.log("file input not available here"); }
$('.loader').fadeIn();
$.ajax({
url: '<?= base_url("client/kyc/edit_2"); ?>',
type: 'POST',
data: formData,
processData: false,
contentType: false,
dataType: 'json',
success: function (res) {
$('.loader').fadeOut();
if (res.status) {
$(`#edit_row_${id}`).addClass('d-none');
$(`#data_row_${id}`).removeClass('d-none');
$('#docs_type_id').empty();
$('#docs_type_id').append(res.dropdown);
$('#tbody').empty();
$('#tbody').append(res.html);
toastr.success('Document updated successfully');
} else {
toastr.warning('Update failed: ' + (res.message || 'Server did not return a status message'));
}
},
error: function (xhr, status, error) {
$('.loader').fadeOut();
toastr.error('Server error: Check server logs for details.');
}
});
}
// SOFT DELETE CLICK HANDLER ---
$(document).on('click', '.btn-delete-kyc', function () {
var kyc_id = $(this).attr('data-id');
var client_id = $(this).attr('data-client_id');
Swal.fire({
title: "Are you sure?",
text: "You won't be able to revert this!",
icon: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: "Yes, delete it!"
}).then((result) => {
if (result.isConfirmed) {
deleteKycDoc(kyc_id, client_id);
}
});
});
// SOFT DELETE Functionality ---
function deleteKycDoc(kyc_id,client_id) {
var formData = new FormData();
formData.append('is_active', 0);
formData.append('id', kyc_id);
formData.append('client_id', client_id);
$('.loader').fadeIn();
$.ajax({
url: '<?= base_url("client/kyc/delete_2"); ?>',
type: 'POST',
data: formData,
processData: false,
contentType: false,
dataType: 'json',
success: function (res) {
$('.loader').fadeOut();
if (res.status) {
$('#docs_type_id').empty();
$('#docs_type_id').append(res.dropdown);
$('#tbody').empty();
$('#tbody').append(res.html);
toastr.success('Document deleted successfully');
} else {
toastr.warning('Delete failed: ' + (res.message || 'Server error.'));
}
},
error: function () {
$('.loader').fadeOut();
toastr.error('Server error!');
}
});
}
</script>

View File

@ -0,0 +1,70 @@
<?php if (empty($ckdlist)) : ?>
<tr>
<td colspan="4" class="text-center text-muted">No data found</td>
</tr>
<?php else : ?>
<?php foreach ($ckdlist as $index => $value) :
$sno = $index + 1;
$fileName = !empty($value['file_name']) ? $value['file_name'] : '-';
?>
<tr id="data_row_<?= $value['id'] ?>">
<td><?= $sno ?></td>
<td><?= esc($value['ui_docs_name']) ?></td>
<td><?= esc($fileName) ?></td>
<td>
<a id="download_<?= esc($value['id']); ?>" data-id="<?= esc($value['id']); ?>" data-file="<?= $fileName ?>"
class="mdi mdi-download mr-1 btn-download-kyc" style="font-size:18px;" download></a>
<a class="mdi mdi-pencil mr-1 btn-edit-kyc"
data-id="<?= $value['id'] ?>"
data-client_id="<?= $value['client_id'] ?>"
data-old_file_name="<?= $fileName ?>"
data-kyc_doc_type_id="<?= $value['kyc_doc_type_id'] ?>"
style="font-size:18px;"></a>
<a class="mdi mdi-delete mr-1 btn-delete-kyc"
data-id="<?= $value['id'] ?>"
style="font-size:18px;"></a>
</td>
</tr>
<!-- EDIT ROW -->
<tr id="edit_row_<?= $value['id'] ?>" class="d-none">
<td colspan="4">
<form id="kyc_form_<?= $value['id'] ?>" class="kyc-edit-form">
<input type="hidden" name="id" value="<?= $value['id'] ?>">
<input type="hidden" name="client_id" value="<?= $value['client_id'] ?>">
<input type="hidden" name="old_file_name" value="<?= $fileName ?>">
<div class="row align-items-end">
<div class="col-md-8">
<label>
Change File - <?= esc($value['ui_docs_name']) ?>
(<?= esc($fileName) ?>)
</label>
<input type="file"
name="file_name"
id="kyc_docs_file_<?= $value['id'] ?>"
class="form-control"
style="box-shadow:none!important; outline:none!important; border:none; height:unset!important;padding: 0px !important;background: transparent !important;">
</div>
<div class="col-md-2">
<button type="button" class="btn btn-primary btn-sm btn-update-kyc w-100"
data-id="<?= $value['id'] ?>"
data-client_id="<?= $value['client_id'] ?>">Update</button>
</div>
<div class="col-md-2">
<button type="button"
class="btn btn-secondary btn-sm btn-cancel-kyc w-100"
data-id="<?= $value['id'] ?>">
Cancel
</button>
</div>
</div>
</form>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -1890,9 +1890,9 @@
<li>
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
</li>
<li>
<!-- <li>
<a href="<?= base_url('/policy_tranction/inception/list2') ?>">Policy 2</a>
</li>
</li> -->
<li>
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
</li>
@ -2040,6 +2040,14 @@
</li>
<?php } ?>
<?php if (in_array(get_role_id(), [1, 5]) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()))) { ?>
<li>
<a href="<?= base_url('/policy_tranction/inception/list2') ?>">
<i class="ri-barcode-line"></i>
<span> Policy 2</span>
</a>
</li>
<?php } ?>
</ul>
</div>
</li>

View File

@ -873,8 +873,8 @@
</div>
</div>
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1">Submit</button>
<div class="form-group d-flex justify-content-end m-b-0" id="hide_smbt_btn">
<button type="submit" class="btn btn-primary waves-effect waves-light">Submit</button>
</div>
</form>
</div>
@ -1788,7 +1788,7 @@
if (res.status == true) {
hide_list_show_add();
hide_list_show_add_2();
var page_title = 'Edit Policy' + (res.data.client_short_name || res.data.policy_type || res.data.policy_no ?
' - ' + [res.data.client_short_name, res.data.policy_type, res.data.policy_no]
@ -1811,12 +1811,140 @@
// getKYCEntityDocument(res.data.entity_type_id, res.data.client_id);
// appendKycTableListData(res.data.client_kyc);
// please don't forgot this ==> look at here please don't don't forgot
$('#docs_type_id').empty(); // ✅ clear old options
$('#docs_type_id').append(res.data.client_kyc_dd_data);
$('#tbody').empty();
$('#tbody').append(res.data.client_kyc_primary_table);
$('#tbody').append(res.data.client_kyc_single_table);
$('#other_docs').empty();
$('#other_docs').append(res.data.client_kyc_other_table);
// let tbody = $('#tbody');
// tbody.empty(); // ✅ Always clear first
// let ckdlist = res.data.client_kyc_document_list;
// if (!ckdlist || ckdlist.length === 0) {
// // ✅ Show single merged row when no data
// let emptyRow = `
// <tr>
// <td colspan="4" class="text-center text-muted">
// No data found
// </td>
// </tr>
// `;
// tbody.append(emptyRow);
// // return; // ✅ Stop further execution
// }
// else{
// $.each(ckdlist, function (index, value) {
// let sno = index + 1;
// // ✅ If kyc_doc_type_id is null → use other_docs_name
// let docName = (value.kyc_doc_type_id === null || value.kyc_doc_type_id === '')
// ? value.other_docs_name
// : value.kyc_doc_type_id;
// let fileName = value.file_name ? value.file_name : '-';
// let downloadBtn = `
// <a id="download_${value.id}"
// data-id="${value.id}"
// data-file="${value.file_name}"
// class="mdi mdi-download mr-1 btn-download-kyc"
// style="font-size:18px;">
// </a>
// `;
// // Inside your $.each(list, function (index, value) { ... }) loop
// let editBtn = `<a href="javascript:void(0);"
// id="edit_${value.id}"
// class="mdi mdi-pencil mr-1 btn-edit-kyc"
// style="font-size:18px;"
// data-id="${value.id}"
// data-client_id="${value.client_id}"
// data-old_file_name="${value.file_name}"
// data-kyc_doc_type_id="${value.kyc_doc_type_id}">
// </a>`;
// // The edit UI block to be toggled
// let editUI = `
// <tr id="edit_row_${value.id}" class="d-none">
// <td colspan="4">
// <form id="kyc_form_${value.id}" class="kyc-edit-form">
// <input type="hidden" id="kyc_id_${value.id}" name="id" value="${value.id}">
// <input type="hidden" id="client_id_${value.id}" name="client_id" value="${value.client_id}">
// <input type="hidden" id="old_file_name_${value.id}" name="old_file_name" value="${value.file_name}">
// <div class="row align-items-end">
// <div class="col-md-8">
// <label for="kyc_docs_file_${value.id}">Change File - ${value.ui_docs_name} (${fileName}) </label>
// <input type="file"
// id="kyc_docs_file_${value.id}"
// name="file_name"
// class="form-control"
// style="box-shadow:none!important;
// outline:none!important;
// border:none;
// height:unset!important;
// padding:0!important;
// background:transparent!important;">
// </div>
// <div class="col-md-2">
// <button type="button"
// class="btn btn-primary btn-sm btn-update-kyc w-100"
// data-id="${value.id}">
// Update
// </button>
// </div>
// <div class="col-md-2">
// <button type="button"
// class="btn btn-secondary btn-sm btn-cancel-kyc w-100"
// data-id="${value.id}">
// Cancel
// </button>
// </div>
// </div>
// </form>
// </td>
// </tr>
// `;
// let deleteBtn = `
// <a id="delete_${value.id}"
// data-id="${value.id}"
// class="mdi mdi-delete mr-1 btn-delete-kyc"
// style="font-size:18px;"
// download>
// </a>`;
// let row = `
// <tr id="data_row_${value.id}"> <td>${sno}</td>
// <td>${value.ui_docs_name}</td>
// <td>${fileName}</td>
// <td>
// ${downloadBtn}
// ${editBtn}
// ${deleteBtn}
// </td>
// </tr>
// ${editUI} `;
// tbody.append(row);
// });
// }
// // docs_type_id
// // res.data.client_kyc_dd_data
// Setting values to correct fields
$('#policy_tranction_primarykey').val(res.data.id);
@ -1888,6 +2016,7 @@
if (res.data.pt_co_share_details) {
if (!res.data.pt_co_share_details[0].follower_policy_no) {res.data.pt_co_share_details[0].follower_policy_no = res.data.policy_no;}
setTimeout(function() {
// populateTable(res.data.pt_co_share_details, res.data.cd_ac_pk);
populateCards(res.data.pt_co_share_details, res.data.cd_ac_pk);
@ -1985,7 +2114,7 @@
$('#cop_yes').prop('checked', true);
$('.add-insurer-button').removeClass('d-none');
$('.payby').removeClass('d-none');
$('.card_group_2').removeClass('d-none');
$('.card_group_2').show();
$('.card_group_3').removeClass('d-none');
$('.card_group_7').removeClass('d-none');
$('.card_group_35').removeClass('d-none');
@ -1993,7 +2122,7 @@
$('#cop_yes').prop('checked', false);
$('.add-insurer-button').addClass('d-none');
$('.payby').addClass('d-none');
$('.card_group_2').addClass('d-none');
$('.card_group_2').hide();
$('.card_group_3').addClass('d-none');
$('.card_group_7').addClass('d-none');
$('.card_group_35').addClass('d-none');
@ -3202,7 +3331,6 @@
}
});
}else{
console.error('Client type Not found')
console.log('client_type', client_type);
}
}else{
@ -3547,7 +3675,7 @@
if (res.data.pt_co_share_details && res.data.pt_co_share_details.length > 0) {
$('#tab_content').empty()
// $('#tab_content').empty()
count = 0
$.each(res.data.pt_co_share_details, function(index, item) {
// appendNewTab(item);
@ -3743,7 +3871,7 @@
$('.card_group_2').show()
$('.card_group_3').show()
$('.card_group_7').show()
$('.card_group_35').show()
$('.card_group_35').removeClass('d-none');
var selectedOption = $('#policy_type_id').find('option:selected');
var bap = selectedOption.data('bap');
@ -3804,7 +3932,7 @@
$('.card_group_2').hide()
$('.card_group_3').hide()
$('.card_group_7').hide()
$('.card_group_35').hide()
$('.card_group_35').addClass('d-none');
$('.hidecoter').hide()
$('.hidecotp').hide()
@ -4427,21 +4555,21 @@
<div class="col-4"><label class="card_label_14">Agreed (%)</label></div>
<div class="col-4 card_group_14">
<div class="input-wrap mr-2">
<span class="input-prefix">BP </span>
<span class="input-prefix">BP &nbsp; </span>
<input type="text" class="form-control right-align-input input-content" id="agreed_bp_${insurerCount}" name="agreed_bp[]" oninput="validateRange(this);" onkeypress="return onlyNumbers(event)">
<span class="input-symbol">%</span>
</div>
</div>
<div class="col-4 card_group_15 hidetp">
<div class="input-wrap mr-2">
<span class="input-prefix">TP </span>
<span class="input-prefix">TP &nbsp; </span>
<input type="text" class="form-control right-align-input input-content" id="agreed_tp_${insurerCount}" name="agreed_tp[]" oninput="validateRange(this);" onkeypress="return onlyNumbers(event)">
<span class="input-symbol">%</span>
</div>
</div>
<div class="col-4 card_group_16 hideter" style="display:none;">
<div class="input-wrap">
<span class="input-prefix">TEP </span>
<span class="input-prefix">TEP &nbsp; </span>
<input type="text" class="form-control right-align-input input-content" id="agreed_ter_${insurerCount}" name="agreed_ter[]" oninput="validateRange(this);" onkeypress="return onlyNumbers(event)">
<span class="input-symbol">%</span>
</div>
@ -4504,21 +4632,21 @@
<div class="col-4 card_group_24">
<div class="input-wrap mr-2">
<span class="input-prefix">BP &nbsp;</span>
<input type="text" class="form-control readonly-select right-align-input input-content" id="actual_bp_amt_${insurerCount}" name="actual_bp_amt[]" onchange="actualAmountCalculation('${insurerCount}', 'bp_amt_for_calc')" onkeypress="return onlyNumbers(event)">
<input type="text" class="form-control readonly-select right-align-input input-content" id="actual_bp_per_${insurerCount}" name="actual_bp_per[]" onchange="actualAmountCalculation('${insurerCount}', 'bp_per')" onkeypress="return onlyNumbers(event)">
<span class="input-symbol">%</span>
</div>
</div>
<div class="col-4 card_group_22 hidetp">
<div class="input-wrap mr-2">
<span class="input-prefix">TP &nbsp;</span>
<input type="text" class="form-control readonly-select right-align-input input-content" id="actual_tp_amt_${insurerCount}" name="actual_tp_amt[]" onchange="actualAmountCalculation('${insurerCount}', 'tp_amt_for_calc')" onkeypress="return onlyNumbers(event)">
<input type="text" class="form-control readonly-select right-align-input input-content" id="actual_tp_per_${insurerCount}" name="actual_tp_per[]" onchange="actualAmountCalculation('${insurerCount}', 'tp_per')" onkeypress="return onlyNumbers(event)">
<span class="input-symbol">%</span>
</div>
</div>
<div class="col-4 card_group_23 hideter" style="display:none;">
<div class="input-wrap">
<span class="input-prefix">TEP &nbsp;</span>
<input type="text" class="form-control readonly-select right-align-input input-content" id="actual_tep_amt_${insurerCount}" name="actual_tep_amt[]" onchange="actualAmountCalculation('${insurerCount}', 'tep_amt_for_calc')" onkeypress="return onlyNumbers(event)">
<input type="text" class="form-control readonly-select right-align-input input-content" id="actual_tep_per_${insurerCount}" name="actual_tp_per[]" onchange="actualAmountCalculation('${insurerCount}', 'tep_per')" onkeypress="return onlyNumbers(event)">
<span class="input-symbol">%</span>
</div>
</div>
@ -4631,7 +4759,7 @@
$('.card_group_2').show();
$('.card_group_3').show();
$('.card_group_7').show();
$('.card_group_35').show();
$('.card_group_35').removeClass('d-none');
}
insurer_count_array.push(insurerCount);
@ -4793,7 +4921,7 @@
.change()
.toggleClass('readonly-select', disable_td);
if (data.co_share_type == 1) {
if ($('#cop_yes').is(':checked')) {
$('.card_group_2').show();
getCdAmount(cd_ac_pk, cardIndex);
}
@ -4932,7 +5060,7 @@
console.log("Previous Page URL:", previousUrl);
if (pt_id != 0) {
hide_list_show_add();
hide_list_show_add_2();
setTimeout(() =>
getPolicyTransactionDataForEditPolicy(pt_id),
1500); // Reduced timeout

View File

@ -286,7 +286,7 @@ table.dataTable tbody td {
</div>
<div class="col-3" id="status_change" style="text-align: right; position: relative;top: 56px; left: 291px;">
<!-- <button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" onclick="hide_list_show_add();">Add</button> -->
<!-- <button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" onclick="hide_list_show_add_2();">Add</button> -->
</div>
</div>
<div>
@ -575,7 +575,7 @@ $(document).ready(function() {
text: '<i class="mdi mdi-plus" ></i><span class=" btn-custom"> Add </span>',
className: 'btn app-btn-primary mr-2',
action: function (e, dt, node, config) {
hide_list_show_add();
hide_list_show_add_2();
addInsurerColumn() ;
}
},
@ -688,8 +688,9 @@ $(document).ready(function(){
//--------------------------------------------------------------------------------------------------------
function hide_list_show_add()
{
function hide_list_show_add_2()
{
$('#pt_onboarding2').show();
$('#page_title').text('Add Policy')
$('#inception_form_id')[0].reset();
$('#client_id').val('').change().prop('disabled', false);
@ -711,7 +712,7 @@ function hide_list_show_add()
$('.current_date').hide()
$('#invoice_no').attr('required', false)
$('#pt_onboarding').show()
$('#inception_list').hide()
$('#inception_filter').hide()
$('#policyholdernamediv').hide();
@ -720,11 +721,12 @@ function hide_list_show_add()
function show_list_hide_add()
{
$('#pt_onboarding').hide()
$('#pt_onboarding2').hide();
$('#inception_list').show()
$('#inception_filter').show();
$('#nav_pills').empty()
$('#tab_content').empty()
$('#nav_pills').empty();
// $('#tab_content').empty();
count = 0
}

View File

@ -1,4 +1,4 @@
<div class="row" id="pt_onboarding" style="position: relative; bottom: 25px; display:none;">
<div class="row" id="pt_onboarding2" style="position: relative; bottom: 25px;">
<div class="col-xl-12">
<div class="card-body">
<div class="tab-wrapper position-relative">
@ -38,10 +38,10 @@
</div>
<div class="tab-content">
<?php include('policy_transaction_inception_form_2.php'); ?>
<?php include('drive_file_upload.php'); ?>
<?php include('client_kyc.php'); ?>
<?php include('vehicle_docs.php'); ?>
<?php include('drive_file_upload.php'); ?>
<?php include('client_kyc_2.php'); ?>
<?php include('policy_transaction_inception_form_2.php'); ?>
</div>
</div>
</div>
@ -49,8 +49,12 @@
<script>
$(document).ready(function() {
$('#pt_onboarding2').show();
$('#general_tab').tab('show');
$('#kyc_tab').on('click', function(e) {
var ptId = $('#policy_tranction_primarykey').val();