Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
Gowtham M 2026-02-21 11:49:09 +05:30
commit 78aab2055d
7 changed files with 56 additions and 33 deletions

View File

@ -783,19 +783,11 @@ class ClientController extends AdminController
]
],
// 'cd_ac_no' => [
// 'rules' => 'required|regex_match[/^[a-zA-Z0-9\/_\\-]+$/]',
// 'errors' => [
// 'required' => 'Account number is required',
// 'regex_match' => 'Account number can only contain letters, numbers, slashes (/), underscores (_), and hyphens (-)',
// ]
// ],
'cd_ac_no' => [
'rules' => 'required|numeric',
'rules' => 'required|regex_match[/^[a-zA-Z0-9\/\-_]+$/]',
'errors' => [
'required' => 'CD Account number is required.',
'numeric' => 'CD Account number must contain only numbers.',
'required' => 'CD Account number is required.',
'regex_match' => 'CD Account number can only contain letters, numbers, hyphens(-), underscores(_), and slashes(/).',
]
],

View File

@ -336,9 +336,9 @@ class EmployeeController extends AdminController
//endof validation process
if (isset($result['error_summary']) && count($result['error_summary'])) {
if(!empty($post_data)){
return ['status' => false, 'message' => 'file rejected with errors', 'file_id' => $file_id];
return ['status' => false, 'message' => 'File rejected with errors', 'file_id' => $file_id];
}else{
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'file rejected with errors'], 200);
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'File rejected with errors'], 200);
}
}
} else //if file size greater than 1 add the file as job

View File

@ -3,6 +3,7 @@
namespace App\Models;
use CodeIgniter\Model;
use Kint;
class PolicyTransactionModel extends Model
{
@ -3168,9 +3169,10 @@
pt.installment,
nhance_branch.branch_name as nhance_branch,
DATE_FORMAT(pt.policy_issue_date, '%d %b %Y') AS policy_issue_date,
DATE_FORMAT(pcsd.pt_policy_issue_date, '%d %b %Y') AS policy_issue_date,
DATE_FORMAT(pcsd.pt_policy_issue_date, '%b %Y') AS policy_issue_month,
pt.month as statement_month,
DATE_FORMAT(pcsd.pt_policy_issue_date, '%b %Y') AS statement_year_month,
pcsd.pt_policy_issue_date as statement_month,
'no statement uploaded' AS statement_uploaded,
@ -3331,8 +3333,9 @@
pt.installment,
nhance_branch.branch_name as nhance_branch,
DATE_FORMAT(pt.policy_issue_date, '%d %b %Y') AS policy_issue_date,
DATE_FORMAT(pcsd.pt_policy_issue_date, '%d %b %Y') AS policy_issue_date,
DATE_FORMAT(IF(insq.month IS NULL, pcsd.pt_policy_issue_date, insq.month),'%b %Y') AS policy_issue_month,
DATE_FORMAT(insq.month, '%b %Y') AS statement_year_month,
insq.month as statement_month,
'statement uploaded' AS statement_uploaded,
@ -3392,7 +3395,7 @@
(pcsd.agreed_tp_per + pcsd.agreed_tep_per) AS agreed_tp_or_ter_per,
CASE
WHEN insq.month = pt.month THEN pcsd.exp_amt
WHEN DATE_FORMAT(insq.month, '%Y-%m') = DATE_FORMAT(pcsd.pt_policy_issue_date, '%Y-%m') THEN pcsd.exp_amt
ELSE 0
END AS total_irda_amt_2,
@ -3521,8 +3524,9 @@
pt.installment,
nhance_branch.branch_name as nhance_branch,
DATE_FORMAT(pt.policy_issue_date, '%d %b %Y') AS policy_issue_date,
DATE_FORMAT(pcsd.pt_policy_issue_date, '%d %b %Y') AS policy_issue_date,
DATE_FORMAT(IF(insq.month IS NULL, pcsd.pt_policy_issue_date, insq.month),'%b %Y') AS policy_issue_month,
DATE_FORMAT(insq.month, '%b %Y') AS statement_year_month,
insq.month as statement_month,
'statement uploaded' AS statement_uploaded,
@ -3704,7 +3708,7 @@
// $countofalldata = count($result);
// dd($result);
// Kint::dump($result);
// dd($this->db->getLastQuery()->getQuery());
$keys = [];
@ -3732,7 +3736,7 @@
// ✅ Stable key (NO reward flag)
$key = implode('|', [
$row['statement_month'],
$row['statement_year_month'],
$row['insurer_name'],
$row['policy_no'],
$endorsement_number,
@ -3753,7 +3757,7 @@
// Reindex final output
$result = array_values($filtered);
// dd($countofalldata, $result);
// dd($result);
// --------------------------------------------------------------------------------------------------------
@ -3776,7 +3780,7 @@
}
}
// dd($totalIrdaMap);
// dd($totalBilled, $totalIrdaMap);
$ptSeen = [];
$final = [];
@ -3785,8 +3789,10 @@
$ptId = $row['pt_id'].'-'.$row['insurer_id'];
if (!isset($ptSeen[$ptId])) {
// First entry → set unbilled amount
$row['unbilled_amount'] = (float) (($totalIrdaMap[$ptId] ?? 0) - ($totalBilled[$ptId] ?? 0)) ?? '0.00';
$row['unbilled_amount'] = round(
(float) (($totalIrdaMap[$ptId] ?? 0) - ($totalBilled[$ptId] ?? 0)),
2
);
$ptSeen[$ptId] = true;
} else {
// Other entries → zero

View File

@ -287,6 +287,8 @@ input:checked + .slider:before {
var message = (PrimaryKey === '') ? 'Client General Info Created successfully' : 'Client General Info Updated successfully';
toastr.success(message, 'Success');
$submitButton.prop('disabled', false);
let client_name = res.data.client_name ? (' - ' + res.data.client_name) : '';
$('#client_heading').text(client_name);
}, 1000);
}

View File

@ -273,9 +273,9 @@
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Client Onboarding <?php if (isset($client)) {
<h4 style="position: relative;">Client Onboarding <span id="client_heading"><?php if (isset($client)) {
echo ' - ' . $client['client_name'];
} ?></h4>
} ?></h4></span>
</div>
<div class="col-6" style="text-align: right;">
<a href="<?= base_url("client/list"); ?>"><i class="mdi mdi-arrow-left" style="font-size: 17px;"></i></a>

View File

@ -2713,13 +2713,10 @@
if(allocg != 'EB'){
tp = parseFloat($('#tp_premium_' + input).val()) || 0;
}
// do not remove this commented item
// if(bap == 'Motor'){
// tp = parseFloat($('#tp_premium_' + input).val()) || 0;
// }
var tep = 0;
if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
// if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
if(allocg != 'EB'){
tep = parseFloat($('#ter_premium_' + input).val()) || 0;
}
@ -2732,7 +2729,8 @@
}
var cotep = 0;
if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
// if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
if(allocg != 'EB'){
cotep = parseFloat($('#co_ter_premium_' + input).val()) || 0;
}

View File

@ -461,9 +461,34 @@
location.reload();
},
error: function(xhr, status, error) {
toastr.error("Transaction save failed", "Error");
console.error(xhr.responseText);
console.error(status, error);
if (xhr.status === 400) {
let response = JSON.parse(xhr.responseText);
let errorMessages = "";
let seenMessages = []; // Array to store unique messages
if (response.errors) {
$.each(response.errors, function (field, message) {
if (!seenMessages.includes(message)) {
errorMessages += `• ${message}<br>`;
seenMessages.push(message); // Mark this message as "seen"
}
});
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
} else {
toastr.warning(response.message || 'Validation failed', 'Warning');
}
} else if (xhr.status === 403) {
let response = JSON.parse(xhr.responseText);
toastr.error(response.message, 'Security Policy');
} else if (xhr.status === 500) {
toastr.error('Something went wrong . Please try again later.', 'Server Error');
} else {
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
}
location.reload(); // Uncomment if you need to reload the page on error
}
});