Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
7cfa40d7c8
@ -448,6 +448,8 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("create", "PolicyTransactionController::createEndorsementPolicy");
|
||||
$routes->get("list/(:any)", "PolicyTransactionController::getEndorsementDataForEdit/$1");
|
||||
$routes->get("remove/(:any)", "PolicyTransactionController::removeCDMaster/$1");
|
||||
$routes->get("list2", "PolicyTransactionController::viewEndorsement2");
|
||||
$routes->get("list2/(:any)", "PolicyTransactionController::getEndorsementDataForEdit2/$1");
|
||||
});
|
||||
|
||||
$routes->group("report", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
@ -2078,6 +2078,100 @@
|
||||
$this->loadLayout('policy_transaction_endorsement_list', $data);
|
||||
}
|
||||
|
||||
public function viewEndorsement2()
|
||||
{
|
||||
// echo '<pre>';
|
||||
// !dd($this->getEndorsementDataForEdit(17));
|
||||
$bds_edit_pt_id = $this->request->getGet('pt_id') ?? null;
|
||||
$data['tab_name'] = 'Endorsements';
|
||||
$data['page_name'] = 'Endorsements';
|
||||
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
$data['issuer_branch'] = $this->nhanceBranchModel->where('is_active', 1)->findAll();
|
||||
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
|
||||
|
||||
$data['policy_status'] = [
|
||||
'under_process' => 'Under Process',
|
||||
'client_pending' => 'Client Pending',
|
||||
'insurer_pending' => 'Insurer Pending',
|
||||
'co_insurer_pending' => 'Co-Insurer Pending',
|
||||
'tpa_pending' => 'TPA Pending',
|
||||
'validated' => 'Validated',
|
||||
'cancelled' => 'Cancelled',
|
||||
'instalment_pending' => 'Instalment Pending',
|
||||
'completed' => 'Completed',
|
||||
];
|
||||
|
||||
$data['invoice_status'] = [
|
||||
'yet_to_generate' => 'Pending',
|
||||
'generated' => 'Generated',
|
||||
'send' => 'Sent',
|
||||
'recived' => 'Payment Received',
|
||||
];
|
||||
|
||||
$data['action_type'] = [
|
||||
'addition' => 'Addition',
|
||||
'deletion' => 'Deletion',
|
||||
'addition_deletion' => 'Addition & Deletion',
|
||||
'si_enhancement' => 'SI Enhancement',
|
||||
'combo_a_d_si' => 'Combo A, D & SI',
|
||||
'correction' => 'Correction',
|
||||
'baby_addition' => 'Baby Addition',
|
||||
'policy_instalment' => 'Policy Instalment',
|
||||
'addition_inception' => 'Addition-Inception',
|
||||
'bds_correction' => 'BDS Correction',
|
||||
'policy_correction' => 'Policy Correction',
|
||||
'policy_cancellation' => 'Policy Cancellation',
|
||||
];
|
||||
|
||||
$data['date_type'] = [
|
||||
'policy_issue_date' => 'Policy Issue Date',
|
||||
'policy_start_date' => 'Policy Start Date',
|
||||
'policy_end_date' => 'Policy End Date',
|
||||
];
|
||||
|
||||
//filter datas
|
||||
$start_date = $this->request->getGet('start_date');
|
||||
$end_date = $this->request->getGet('end_date');
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
$insurer_id = $this->request->getGet('insurer_id');
|
||||
$policy_type_id = $this->request->getGet('policy_type_id');
|
||||
$date_type = $this->request->getGet('date_type');
|
||||
$issuer = $this->request->getGet('issuer');
|
||||
$status = $this->request->getGet('status');
|
||||
|
||||
$start_date = (!isset($start_date) || $start_date === '' || $start_date === null) ? 0 : $start_date;
|
||||
$end_date = (!isset($end_date) || $end_date === '' || $end_date === null) ? 0 : $end_date;
|
||||
|
||||
$client_id = (!isset($client_id) || $client_id === '' || $client_id === null) ? 0 : $client_id;
|
||||
$insurer_id = (!isset($insurer_id) || $insurer_id === '' || $insurer_id === null) ? 0 : $insurer_id;
|
||||
$policy_type_id = (!isset($policy_type_id) || $policy_type_id === '' || $policy_type_id === null) ? 0 : $policy_type_id;
|
||||
$date_type = (!isset($date_type) || $date_type === '' || $date_type === null) ? 0 : $date_type;
|
||||
$issuer = (!isset($issuer) || $issuer === '' || $issuer === null) ? 0 : $issuer;
|
||||
$status = (!isset($issuer) || $status === '' || $status === null) ? 0 : $status;
|
||||
|
||||
if($bds_edit_pt_id == null){
|
||||
$data['endorsement_data_list'] = $this->policyTransactionModel->getEndorsementTranctionListData($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status);
|
||||
}else{
|
||||
$data['endorsement_data_list'] = [];
|
||||
}
|
||||
$data['client'] = $this->clientModel->where('is_active', 1)->findAll();
|
||||
$data['policy_types'] = $this->policyTypeModel->where('is_active', 1)->findAll();
|
||||
|
||||
$data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll();
|
||||
// $data['tpa'] = $this->tpaModel->where('is_active', 1)->findAll();
|
||||
$data['insurer_branch'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
||||
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
|
||||
list($policyList, $policyListByClient) = $this->getPolicyForEndorsment();
|
||||
|
||||
$data['endorsementPolicies'] = $policyList;
|
||||
$data['endorsementPolicyListByClient'] = $policyListByClient;
|
||||
|
||||
// dd($data);
|
||||
// print_r($data['endorsementPolicies']);die();
|
||||
|
||||
$this->loadLayout('policy_transaction_endorsement_list_2', $data);
|
||||
}
|
||||
|
||||
public function createEndorsementPolicy()
|
||||
{
|
||||
$id = $this->request->getPost('id');
|
||||
@ -2515,6 +2609,220 @@
|
||||
}
|
||||
}
|
||||
|
||||
public function getEndorsementDataForEdit2($id)
|
||||
{
|
||||
$data = $this->policyTransactionModel
|
||||
->select('
|
||||
policy_transaction.*,
|
||||
clients.short_name as client_short_name,
|
||||
clients.client_type,
|
||||
(
|
||||
select last_action_date
|
||||
from policy_transaction_status
|
||||
where policy_tran_id = policy_transaction.id
|
||||
and status = policy_transaction.status
|
||||
order by id desc
|
||||
limit 1
|
||||
|
||||
) as last_action_date
|
||||
')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id')
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
->where('policy_transaction.id', $id)
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->orderBy('id', 'asc')
|
||||
->first();
|
||||
|
||||
$pt_id = null;
|
||||
|
||||
if(!empty($data)){
|
||||
$inception_data = $this->policyTransactionModel
|
||||
->where('policy_no', $data['policy_no'])
|
||||
->where('client_id', $data['client_id'])
|
||||
->where('action_type', 'inception')
|
||||
->first();
|
||||
$pt_id = $inception_data['id'];
|
||||
}
|
||||
|
||||
if (!empty($data['policy_start_date'])) {
|
||||
$data['policy_start_date'] = change_date_format($data['policy_start_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if (!empty($data['policy_end_date'])) {
|
||||
$data['policy_end_date'] = change_date_format($data['policy_end_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if (!empty($data['data_received_date'])) {
|
||||
$data['data_received_date'] = change_date_format($data['data_received_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if (!empty($data['policy_issue_date'])) {
|
||||
$data['policy_issue_date'] = change_date_format($data['policy_issue_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if (!empty($data['endorse_eff_date'])) {
|
||||
$data['endorse_eff_date'] = change_date_format($data['endorse_eff_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if (!empty($data['install_due_date'])) {
|
||||
$data['install_due_date'] = change_date_format($data['install_due_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if (!empty($data['last_action_date'])) {
|
||||
$data['last_action_date'] = change_date_format($data['last_action_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if (!empty($data['month'])) {
|
||||
$data['month'] = change_date_format($data['month'], 'Y-m-d', 'M/Y');
|
||||
}
|
||||
|
||||
// print_r($data); die;
|
||||
|
||||
//get PT Co-Share Details
|
||||
$data['pt_co_share_details'] = $this->PTCOShareDetailsModel
|
||||
|
||||
->select("
|
||||
pt_co_share_details.*,
|
||||
|
||||
(
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_stmt_details.co_share_id = pt_co_share_details.id
|
||||
AND co_share_stmt_details.is_active = 1
|
||||
) AS record_count,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_bp_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_bp_amount,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tp_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tp_amount,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tep_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tep_amount,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_bp_per)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_bp_percentage,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tp_per)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tp_percentage,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tep_per)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tep_percentage,
|
||||
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_bp_brokerage_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_bp_brokerage_amount,
|
||||
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tp_brokerage_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tp_brokerage_amount,
|
||||
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tep_brokerage_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tep_brokerage_amount,
|
||||
|
||||
DATE_FORMAT(pt_policy_issue_date, '%d/%m/%Y') AS pt_policy_issue_date
|
||||
|
||||
")
|
||||
->where('pt_id', $id)
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'asc')
|
||||
->findAll();
|
||||
|
||||
// print_r($data['endorse_eff_date']); die;
|
||||
|
||||
$pt_bp_amt = $this->PTCOShareDetailsModel
|
||||
->select('bp_amt, amount')
|
||||
->where('pt_id', $id)
|
||||
->where('co_share_type', 1)
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
// dd(db_connect()->getLastQuery() ,$pt_bp_amt);
|
||||
$data['base_cd_amount'] = $pt_bp_amt['amount'] ?? null;
|
||||
|
||||
if ($data) {
|
||||
return $this->respond(['status' => true, 'data' => $data, 'pt_id' => $pt_id], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false], 200);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
//file upload function
|
||||
|
||||
@ -2047,6 +2047,12 @@
|
||||
<span> Policy 2</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/endorsement/list2') ?>">
|
||||
<i class="ri-file-edit-line"></i>
|
||||
<span> Endorsement 2</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
2995
app/Views/policy_transaction_endorsement_form_2.php
Normal file
2995
app/Views/policy_transaction_endorsement_form_2.php
Normal file
File diff suppressed because it is too large
Load Diff
1036
app/Views/policy_transaction_endorsement_list_2.php
Normal file
1036
app/Views/policy_transaction_endorsement_list_2.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -718,10 +718,9 @@
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label class="card_label_4">Base Premium</label>
|
||||
<input type="text" class="form-control right-align-input" id="base_premium" name="base_premium" oninput="" onkeypress="return onlyNumbers(event)" onchange="setBPValue(this.value)">
|
||||
<label class="card_label_4">Base Premium<span id="base_danger" class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control right-align-input" id="base_premium" name="base_premium" oninput="" onkeypress="return onlyNumbers(event)" onchange="setBPValue(this.value)" required>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-3 hidetp">
|
||||
<label class="card_label_5">TP Premium</label>
|
||||
@ -1831,11 +1830,6 @@
|
||||
|
||||
// $('#cd_ac_no_for_edit').val(res.data.cd_ac_no);
|
||||
$('#cd_ac_pk_for_leader').val(res.data.cd_ac_pk);
|
||||
|
||||
// $('#entity_type_id').val(res.data.entity_type_id);
|
||||
// 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
|
||||
@ -1843,133 +1837,6 @@
|
||||
$('#tbody').empty();
|
||||
$('#tbody').append(res.data.client_kyc_single_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);
|
||||
@ -2045,6 +1912,18 @@
|
||||
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);
|
||||
let s = res.data.policy_start_date.split('/'); // ["DD","MM","YYYY"]
|
||||
let e = res.data.policy_end_date.split('/'); // ["DD","MM","YYYY"]
|
||||
|
||||
let start = new Date(s[2], s[1] - 1, s[0]); // YYYY, MM-1, DD
|
||||
let end = new Date(e[2], e[1] - 1, e[0]);
|
||||
let months = (end.getFullYear() - start.getFullYear()) * 12 + (end.getMonth() - start.getMonth());
|
||||
if (end.getDate() >= start.getDate()) { months += 1; }
|
||||
let yearDiff = Math.ceil(months / 12);
|
||||
// let yearDiff = (parseInt(e[2]) - parseInt(s[2])) + 1;
|
||||
console.log("yearDiff =", yearDiff);
|
||||
if (yearDiff > 1) { updateInsurerTitles(yearDiff); }
|
||||
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
@ -3657,6 +3536,17 @@
|
||||
co_share_type.forEach((value, index) => {
|
||||
formData.append(`co_share_type[${index}]`, value);
|
||||
});
|
||||
|
||||
let bp = document.getElementById("base_premium").value;
|
||||
let tp = document.getElementById("tp_premium").value;
|
||||
let ter = document.getElementById("ter_premium").value;
|
||||
|
||||
for (let i = 0; i < insurerCount; i++) {
|
||||
formData.append(`base_premium[${i}]`, bp);
|
||||
formData.append(`tp_premium[${i}]`, tp);
|
||||
formData.append(`ter_premium[${i}]`, ter);
|
||||
}
|
||||
|
||||
//covert date to mysql format
|
||||
// alert(formData.get('policy_issue_date'));
|
||||
|
||||
@ -4427,7 +4317,7 @@
|
||||
let cardHTML = `<div class="p-1 mb-2 insurer-card" id="insurerCardContainer_${insurerCount}" data-count="${insurerCount}">
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center border-bottom pb-2 mb-3">
|
||||
<div class="fw-bold text-primary">Insurer - ${insurerCount}</div>
|
||||
<div class="fw-bold text-primary insurer-card-title">Insurer - ${insurerCount}</div>
|
||||
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
${showAdd}
|
||||
@ -4492,7 +4382,7 @@
|
||||
<div class="form-row mb-2">
|
||||
<div class="col-md-4 mb-2 card_group_35">
|
||||
<label class="card_label_35">Policy No</label>
|
||||
<input type="text" class="form-control follower_policy_no" id="follower_policy_no_${insurerCount}" name="follower_policy_no[]" onchange="validateInput(this, 'client_policy', 'policy_no')" readonly>
|
||||
<input type="text" class="form-control follower_policy_no" id="follower_policy_no_${insurerCount}" name="follower_policy_no[]" onchange="validateInput(this, 'client_policy', 'policy_no')">
|
||||
</div>
|
||||
<div class="col-md-4 mb-2 card_group_40">
|
||||
<label class="card_label_40"> Policy Issue Date </label>
|
||||
@ -4774,6 +4664,9 @@
|
||||
</div>`;
|
||||
|
||||
$('#allInsurerCards').append(cardHTML);
|
||||
setBPValue($('#base_premium').val());
|
||||
setTEPValue($('#ter_premium').val());
|
||||
setTPValue($('#tp_premium').val());
|
||||
|
||||
|
||||
$('#follow_insurer_id_' + insurerCount).select2();
|
||||
@ -4891,8 +4784,27 @@
|
||||
}
|
||||
|
||||
console.log("UpdatedCa:", insurerCount);
|
||||
updateInsurerTitles(yearDiff);
|
||||
}
|
||||
|
||||
function updateInsurerTitles(yearDiff) {
|
||||
|
||||
$(".insurer-card-title").each(function (index) {
|
||||
let cardIndex = index + 1;
|
||||
|
||||
// Base title: Insurer - X
|
||||
let title = `Insurer - ${cardIndex}`;
|
||||
|
||||
// Add "(Year X)" only for the first yearDiff cards
|
||||
if (cardIndex <= yearDiff) {
|
||||
title += ` (Year ${cardIndex})`;
|
||||
}
|
||||
|
||||
$(this).text(title);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function resetInsurerCards() {
|
||||
@ -6714,9 +6626,11 @@
|
||||
}
|
||||
|
||||
function setBPValue(inputValue) {
|
||||
const bpValueField = document.querySelector('.bp_value');
|
||||
if (bpValueField) {
|
||||
bpValueField.value = inputValue;
|
||||
let bpValueField = document.querySelectorAll('.bp_value');
|
||||
|
||||
if(bpValueField){
|
||||
bpValueField.forEach((field) => { field.value = inputValue; });
|
||||
console.log("Updated", bpValueField.length, "hidden base premiums");
|
||||
} else {
|
||||
console.error("Error: Element with class '.bp_value' not found.");
|
||||
}
|
||||
@ -6724,9 +6638,11 @@
|
||||
}
|
||||
|
||||
function setTPValue(inputValue) {
|
||||
const tpValueField = document.querySelector('.tp_value');
|
||||
let tpValueField = document.querySelectorAll('.tp_value');
|
||||
|
||||
if (tpValueField) {
|
||||
tpValueField.value = inputValue;
|
||||
tpValueField.forEach((field) => { field.value = inputValue; });
|
||||
console.log("Updated", tpValueFields.length, "hidden tp premiums");
|
||||
} else {
|
||||
console.error("Error: Element with class '.tp_value' not found.");
|
||||
}
|
||||
@ -6734,9 +6650,11 @@
|
||||
}
|
||||
|
||||
function setTEPValue(inputValue) {
|
||||
const tepValueField = document.querySelector('.tep_value');
|
||||
let tepValueField = document.querySelectorAll('.ter_value');
|
||||
tepValueField.forEach((field) => { field.value = inputValue; });
|
||||
if (tepValueField) {
|
||||
tepValueField.value = inputValue;
|
||||
console.log("Updated", tepValueField.length, "hidden tep premiums");
|
||||
} else {
|
||||
console.error("Error: Element with class '.tep_value' not found.");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user