FIX_BDS_POPUP_AND OTHERS : RV
This commit is contained in:
parent
bbc3aa7e04
commit
16d4af035d
@ -4229,6 +4229,7 @@ class ClientController extends AdminController
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
$client_branch_id = $this->request->getGet('client_branch_id');
|
||||
$policy_type_id = $this->request->getGet('policy_type_id');
|
||||
$client_type = $this->request->getGet('client_type');
|
||||
|
||||
$data = $this->clientPolicyModel
|
||||
->select("
|
||||
@ -4247,20 +4248,37 @@ class ClientController extends AdminController
|
||||
->first();
|
||||
|
||||
if ($data) {
|
||||
if ($data['client_id'] == $client_id && $data['client_branch_id'] == $client_branch_id) {
|
||||
|
||||
if ($data['policy_type_id'] == $policy_type_id) {
|
||||
return $this->respond(['status' => true, 'data' => $data, 'code' => 200, 'received_data' => $received_data], 200);
|
||||
if ($client_type == 1) {
|
||||
if ($data['client_id'] == $client_id && $data['client_branch_id'] == $client_branch_id) {
|
||||
|
||||
if ($data['policy_type_id'] == $policy_type_id) {
|
||||
return $this->respond(['status' => true, 'data' => $data, 'code' => 200, 'received_data' => $received_data], 200);
|
||||
} else {
|
||||
$policy_type = $this->policyTypeModel->where('id', $policy_type_id)->first();
|
||||
$message = 'This policy number is mapped to the selected client with policy type: ' . (!empty($data['policy_type']) ? $data['policy_type'] : 'N/A') . '. You selected: ' . (!empty($policy_type['policy_type']) ? $policy_type['policy_type'] : 'N/A') . '. Please check.';
|
||||
return $this->respond(['status' => true, 'data' => $data, 'code' => 409, "message" => $message, 'received_data' => $received_data], 200);
|
||||
}
|
||||
} else {
|
||||
$policy_type = $this->policyTypeModel->where('id', $policy_type_id)->first();
|
||||
$message = 'This policy number is mapped to the selected client with policy type: ' . (!empty($data['policy_type']) ? $data['policy_type'] : 'N/A') . '. You selected: ' . (!empty($policy_type['policy_type']) ? $policy_type['policy_type'] : 'N/A') . '. Please check.';
|
||||
return $this->respond(['status' => true, 'data' => $data, 'code' => 409, "message" => $message, 'received_data' => $received_data], 200);
|
||||
$message = 'This policy number is already linked to another client' . (!empty($data['client_name']) ? '. Client name : ' . $data['client_name'] : '') . '. Please check';
|
||||
return $this->respond(['status' => true, 'code' => 409, "message" => $message, 'received_data' => $received_data, 'db_data' => $data], 200);
|
||||
}
|
||||
|
||||
} else {
|
||||
$message = 'This policy number is already linked to another client' . (!empty($data['client_name']) ? '. Client name : ' . $data['client_name'] : '') . '. Please check';
|
||||
return $this->respond(['status' => true, 'code' => 409, "message" => $message, 'received_data' => $received_data, 'db_data' => $data], 200);
|
||||
if ($data['client_id'] == $client_id) {
|
||||
|
||||
if ($data['policy_type_id'] == $policy_type_id) {
|
||||
return $this->respond(['status' => true, 'data' => $data, 'code' => 200, 'received_data' => $received_data], 200);
|
||||
} else {
|
||||
$policy_type = $this->policyTypeModel->where('id', $policy_type_id)->first();
|
||||
$message = 'This policy number is mapped to the selected client with policy type: ' . (!empty($data['policy_type']) ? $data['policy_type'] : 'N/A') . '. You selected: ' . (!empty($policy_type['policy_type']) ? $policy_type['policy_type'] : 'N/A') . '. Please check.';
|
||||
return $this->respond(['status' => true, 'data' => $data, 'code' => 409, "message" => $message, 'received_data' => $received_data], 200);
|
||||
}
|
||||
} else {
|
||||
$message = 'This policy number is already linked to another client' . (!empty($data['client_name']) ? '. Client name : ' . $data['client_name'] : '') . '. Please check';
|
||||
return $this->respond(['status' => true, 'code' => 409, "message" => $message, 'received_data' => $received_data, 'db_data' => $data], 200);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'message' => 'No Data Found', 'code' => 404, 'received_data' => $received_data], 200);
|
||||
}
|
||||
@ -5082,6 +5100,17 @@ class ClientController extends AdminController
|
||||
// $return_value = check_cd_entry_exist($baseWhere);
|
||||
// dd($return_value);
|
||||
|
||||
|
||||
|
||||
|
||||
// $param = "533454";
|
||||
// $type = 'emp_code';
|
||||
// $client_policy_id = 64;
|
||||
// $client_id = 51;
|
||||
|
||||
// $result = $this->getTheEmpDataForClaimSearchByMobile($param, $type, $client_policy_id, $client_id);
|
||||
// dd($result);
|
||||
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
@ -5262,9 +5291,9 @@ class ClientController extends AdminController
|
||||
$query->where('employees.client_id', $client_id);
|
||||
}
|
||||
|
||||
if (!empty($client_policy_id)) {
|
||||
$query->where('employee_polices.client_policy_id', $client_policy_id);
|
||||
}
|
||||
// if (!empty($client_policy_id)) {
|
||||
// $query->where('employee_polices.client_policy_id', $client_policy_id);
|
||||
// }
|
||||
|
||||
$query->groupBy('employees.id')
|
||||
->orderBy('employees.id', 'DESC');
|
||||
@ -5285,7 +5314,7 @@ class ClientController extends AdminController
|
||||
|
||||
if(!empty($data) && count($data) > 0){
|
||||
|
||||
$memberData = $this->employeeModel->getEmployeeByEmployeeCode($data['emp_code'], $data['policy_id'], $client_id);
|
||||
$memberData = $this->employeeModel->getEmployeeByEmployeeCode($data['emp_code'], null, $client_id);
|
||||
$acms_datas = $this->employeeModel->getAcmUsingClientID($data['client_id']);
|
||||
// if(!empty($acms_datas)){
|
||||
// $acms = $acms_datas;
|
||||
|
||||
@ -1360,7 +1360,7 @@ class LeadsController extends BaseController
|
||||
$rowNumber = 1;
|
||||
|
||||
$mergeRange1 = "A{$rowNumber}:B{$rowNumber}";
|
||||
$sheet->mergeCells($mergeRange1);
|
||||
// $sheet->mergeCells($mergeRange1);
|
||||
$sheet->setCellValue("A{$rowNumber}", "Nhance India Insurance Broking Pvt Ltd");
|
||||
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
||||
'font' => [
|
||||
@ -1374,9 +1374,8 @@ class LeadsController extends BaseController
|
||||
]);
|
||||
|
||||
// Apply center alignment to the cell
|
||||
$sheet->getStyle("C{$rowNumber}")->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||
$sheet->getStyle("C{$rowNumber}")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||
|
||||
// $sheet->getStyle("C{$rowNumber}")->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||
// $sheet->getStyle("C{$rowNumber}")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||
|
||||
$rowNumber = $rowNumber + 1;
|
||||
|
||||
@ -1388,22 +1387,22 @@ class LeadsController extends BaseController
|
||||
|
||||
// Merge A:B for key and C:D for value
|
||||
$mergeRangeKey = "A{$rowNumber}:B{$rowNumber}";
|
||||
$mergeRangeValue = "C{$rowNumber}";
|
||||
// $mergeRangeValue = "C{$rowNumber}";
|
||||
$sheet->mergeCells($mergeRangeKey);
|
||||
$sheet->mergeCells($mergeRangeValue);
|
||||
// $sheet->mergeCells($mergeRangeValue);
|
||||
|
||||
// Set values in merged cells
|
||||
$sheet->setCellValue("A{$rowNumber}", $key);
|
||||
$sheet->setCellValue("C{$rowNumber}", $value);
|
||||
|
||||
// Apply styles for alignment and bold text in A:B
|
||||
$sheet->getStyle($mergeRangeKey)->applyFromArray([
|
||||
'font' => ['bold' => true],
|
||||
'alignment' => [
|
||||
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
|
||||
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
|
||||
],
|
||||
]);
|
||||
// // Apply styles for alignment and bold text in A:B
|
||||
// $sheet->getStyle($mergeRangeKey)->applyFromArray([
|
||||
// 'font' => ['bold' => true],
|
||||
// 'alignment' => [
|
||||
// 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
|
||||
// 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
|
||||
// ],
|
||||
// ]);
|
||||
|
||||
// Apply bold style to B column if the key is "Insured"
|
||||
if ($key == "Insured") {
|
||||
@ -1419,7 +1418,7 @@ class LeadsController extends BaseController
|
||||
$rowNumber++;
|
||||
}
|
||||
|
||||
// // Set column width based on max content length (adjusted for padding)
|
||||
// Set column width based on max content length (adjusted for padding)
|
||||
$sheet->getColumnDimension('A')->setWidth($maxWidthA * 1.2);
|
||||
// $sheet->getColumnDimension('B')->setWidth($maxWidthA * 1.5);
|
||||
$sheet->getColumnDimension('C')->setWidth(35);
|
||||
@ -1470,13 +1469,14 @@ class LeadsController extends BaseController
|
||||
$sheet->mergeCells($mergeRange);
|
||||
$rowNumber_for_remove_quote_asked = $rowNumber;
|
||||
$rowNumber = $rowNumber + 1;
|
||||
|
||||
if ($type == 2) {
|
||||
$subHeaderRow = $rowNumber + 1;
|
||||
} else {
|
||||
$subHeaderRow = $rowNumber_for_remove_quote_asked;
|
||||
}
|
||||
$columnLetter = 'A';
|
||||
|
||||
$columnLetter = 'A';
|
||||
$header_actual_count = 0;
|
||||
foreach ($headers as $header) {
|
||||
// Kint::dump($header);
|
||||
@ -1561,8 +1561,6 @@ class LeadsController extends BaseController
|
||||
$sheet->getColumnDimension('B')->setWidth(35);
|
||||
}
|
||||
|
||||
// die();
|
||||
|
||||
// Apply border to the header range
|
||||
$prevColumn1 = $this->getPreviousColumn($columnLetter);
|
||||
$headerRange = "A{$rowNumber}:" . "{$prevColumn1}" . "{$subHeaderRow}";
|
||||
@ -1584,6 +1582,7 @@ class LeadsController extends BaseController
|
||||
} else {
|
||||
$rowNumber = $subHeaderRow + 2;
|
||||
}
|
||||
|
||||
// dd($rowNumber);
|
||||
$column_data = $data['table_data']['data'];
|
||||
$serial_no = 1;
|
||||
@ -1627,36 +1626,37 @@ class LeadsController extends BaseController
|
||||
|
||||
// Add premium data
|
||||
// dd($data);
|
||||
$labelArray = ["Premium", "GST (%)", "GST Amount (₹)", "Total"];
|
||||
// $labelArray = ["Premium", "GST (%)", "GST Amount (₹)", "Total"];
|
||||
$labelArray = ["Premium", "GST Amount (₹)", "Total"];
|
||||
$premiumData = $data['premium_data']['data'];
|
||||
$premium = [$labelArray[0]];
|
||||
$gst = [$labelArray[1]];
|
||||
$gstAmt = [$labelArray[2]];
|
||||
$total = [$labelArray[3]];
|
||||
// $premium = [$labelArray[0]];
|
||||
// $gst = [$labelArray[1]];
|
||||
// $gstAmt = [$labelArray[1]];
|
||||
// $total = [$labelArray[2]];
|
||||
|
||||
foreach ($premiumData as $proposal => $insurers) {
|
||||
if ($proposal != 'Particulars') {
|
||||
foreach ($insurers as $insurer => $values) {
|
||||
if($insurer == 'Quote Asked'){
|
||||
$premium[] = "";
|
||||
$gst[] = "";
|
||||
$gstAmt[] = "";
|
||||
$total[] = "";
|
||||
$premium[] = $labelArray[0];
|
||||
// $gst[] = "";
|
||||
$gstAmt[] = $labelArray[1];
|
||||
$total[] = $labelArray[2];
|
||||
}else{
|
||||
$premium[] = formatIndianCurrency($values[$labelArray[0]]);
|
||||
$gst[] = $values[$labelArray[1]];
|
||||
$gstAmt[] = formatIndianCurrency($values[$labelArray[2]]);
|
||||
$total[] = formatIndianCurrency($values[$labelArray[3]]);
|
||||
// $gst[] = $values[$labelArray[1]];
|
||||
$gstAmt[] = formatIndianCurrency($values[$labelArray[1]]);
|
||||
$total[] = formatIndianCurrency($values[$labelArray[2]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ([$premium, $gst, $gstAmt, $total] as $index => $rowData) {
|
||||
$columnLetter = 'B';
|
||||
foreach ([$premium, $gstAmt, $total] as $index => $rowData) {
|
||||
$columnLetter = 'C';
|
||||
foreach ($rowData as $key => $value) {
|
||||
$sheet->setCellValue("{$columnLetter}{$rowNumber}", $value);
|
||||
if ($key === 0) {
|
||||
if (in_array($value, $labelArray)) {
|
||||
$sheet->getStyle("{$columnLetter}{$rowNumber}")->applyFromArray(['font' => ['bold' => true,],]);
|
||||
}
|
||||
$columnLetter++;
|
||||
@ -1669,7 +1669,8 @@ class LeadsController extends BaseController
|
||||
} else {
|
||||
$prevColumn3 = $this->getPreviousColumn($columnLetter, 2);
|
||||
}
|
||||
$premiumRange = "B" . ($rowNumber - 4) . ":" . "{$prevColumn3}" . ($rowNumber - 1);
|
||||
|
||||
$premiumRange = "C" . ($rowNumber - 3) . ":" . "{$prevColumn3}" . ($rowNumber - 1);
|
||||
// dd($premiumRange);
|
||||
|
||||
$sheet->getStyle($premiumRange)->applyFromArray([
|
||||
@ -1682,9 +1683,7 @@ class LeadsController extends BaseController
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
//set imgage and align the row and column
|
||||
// Kint::dump($columnLetter);
|
||||
if ($type == 2) {
|
||||
if ($is_placement == true) {
|
||||
$columnLetter_img = $this->getPreviousColumn($columnLetter);
|
||||
@ -1694,7 +1693,6 @@ class LeadsController extends BaseController
|
||||
} else {
|
||||
$columnLetter_img = $this->getPreviousColumn($columnLetter);
|
||||
}
|
||||
// dd($columnLetter_img);
|
||||
|
||||
$company_name = $this->getPreviousColumn($columnLetter_img);
|
||||
$mergeRange1 = "A1:{$company_name}1";
|
||||
@ -1722,39 +1720,19 @@ class LeadsController extends BaseController
|
||||
$drawing->setPath($path);
|
||||
$drawing->setCoordinates("{$columnLetter_img}1"); // Set position in column B
|
||||
$drawing->setHeight(35); // Adjust image
|
||||
$columnWidth = $sheet->getColumnDimension("C")->getWidth(); // e.g., 20
|
||||
$cellPixelWidth = $columnWidth * 7; // Approximate conversion (1 unit ≈ 7 pixels)
|
||||
$imagePixelWidth = 250; // Approximate width of your image (in pixels)
|
||||
|
||||
$offsetX = max(0, ($cellPixelWidth - $imagePixelWidth) / 2);
|
||||
$offsetX = $offsetX + 97;
|
||||
// dd($length);
|
||||
if ($length >= 4) {
|
||||
$offsetX = 65;
|
||||
} else if ($length == 3) {
|
||||
$offsetX = 65;
|
||||
}
|
||||
|
||||
// Center align the image in the cell
|
||||
$offsetX = 35;
|
||||
$drawing->setOffsetX($offsetX); // Adjust horizontal offset
|
||||
$drawing->setOffsetY(10); // Adjust vertical offset
|
||||
$drawing->setWorksheet($sheet);
|
||||
|
||||
//end
|
||||
|
||||
|
||||
// Auto-size columns
|
||||
// foreach ($sheet->getColumnIterator() as $column) {
|
||||
// $sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true);
|
||||
// }
|
||||
|
||||
$dataRange = $sheet->calculateWorksheetDimension();
|
||||
|
||||
$sheet->getStyle($dataRange)->getAlignment()
|
||||
->setHorizontal(Alignment::HORIZONTAL_CENTER)
|
||||
->setVertical(Alignment::VERTICAL_CENTER)
|
||||
->setWrapText(true);
|
||||
|
||||
$sheet->getStyle($dataRange)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER)->setVertical(Alignment::VERTICAL_CENTER)->setWrapText(true);
|
||||
$sheet->getStyle('A1')->applyFromArray([
|
||||
'alignment' => [
|
||||
'wrapText' => false, // Disables text wrapping for A1
|
||||
@ -1791,8 +1769,6 @@ class LeadsController extends BaseController
|
||||
],
|
||||
]);
|
||||
|
||||
|
||||
|
||||
// Set filename
|
||||
$string = ($type == 2) ? ($is_placement == true ? 'Placement' : 'QCR') : 'RFQ';
|
||||
$current_year = date('Y');
|
||||
@ -1809,7 +1785,6 @@ class LeadsController extends BaseController
|
||||
$filename = "{$rfq_data['client_name']}_{$rfq_data['policy_type']}_{$string}_" . $policy_year . '_' . '.xlsx';
|
||||
}
|
||||
|
||||
|
||||
// Save to temporary location
|
||||
$uploadFilePath = WRITEPATH . 'tmp/' . $filename;
|
||||
$writer = new Xlsx($spreadsheet);
|
||||
@ -4026,7 +4001,7 @@ class LeadsController extends BaseController
|
||||
$offsetX = max(0, ($cellPixelWidth - $imagePixelWidth) / 2);
|
||||
$offsetX = $offsetX + 97;
|
||||
if ($length >= 4) {
|
||||
$offsetX = 50;
|
||||
$offsetX = 35;
|
||||
} else if ($length == 3) {
|
||||
$offsetX = 140;
|
||||
}
|
||||
|
||||
@ -302,9 +302,9 @@
|
||||
|
||||
});
|
||||
|
||||
fetchMessages();
|
||||
// fetchMessages();
|
||||
|
||||
setInterval(fetchMessages, 60000); // Fetch messages every sixty seconds
|
||||
// setInterval(fetchMessages, 60000); // Fetch messages every sixty seconds
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
@ -823,6 +823,7 @@
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
function formatDate(dateString)
|
||||
{
|
||||
// Parse the input date string
|
||||
@ -863,6 +864,7 @@
|
||||
|
||||
return currentTime;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
@ -166,8 +166,8 @@
|
||||
|
||||
let form_type = $(this).data('id') || 0;
|
||||
|
||||
console.log('onsubmit event', this)
|
||||
console.log('onsubmit event get data value',form_type)
|
||||
console.log('onsubmit event', this);
|
||||
console.log('onsubmit event get data value',form_type);
|
||||
console.log('client_type', $('#client_type').val());
|
||||
|
||||
event.preventDefault();
|
||||
@ -180,8 +180,6 @@
|
||||
$('#gst').removeAttr('required');
|
||||
}
|
||||
|
||||
|
||||
isClientFormSubmitting = true;
|
||||
var isValid = $('#client_form').parsley().validate();
|
||||
|
||||
if (!isValid) {
|
||||
@ -199,6 +197,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
isClientFormSubmitting = true;
|
||||
|
||||
form_action = '<?= base_url("util/createClientWithMinimalData"); ?>';
|
||||
|
||||
@ -289,6 +288,7 @@
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
isClientFormSubmitting = false;
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
|
||||
@ -1163,6 +1163,7 @@
|
||||
|
||||
var team_id = [];
|
||||
let isClientFormSubmitting = false;
|
||||
let isVehicleFormSubmitting = false;
|
||||
var insurer_count_array = [];
|
||||
|
||||
$(document).ready(function(){
|
||||
@ -1172,19 +1173,32 @@ $(document).ready(function(){
|
||||
// keyboard: false
|
||||
// })
|
||||
|
||||
isClientFormSubmitting = true;
|
||||
document.getElementById('vehicle_form').addEventListener('reset', function(event) {
|
||||
console.log('vehicle_form reset called', event.type);
|
||||
if(isVehicleFormSubmitting == false){
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('client_form').addEventListener('reset', function(event) {
|
||||
console.log('client_form reset called', event.type);
|
||||
if(isClientFormSubmitting == false){
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#upload_enrollment_model').on('hide.bs.modal', function (e) {
|
||||
|
||||
console.log('Attempting to hide #upload_enrollment_model modal');
|
||||
|
||||
let policy_type_id = $('#policy_type_id').val();
|
||||
console.log('policy_type_id:', policy_type_id);
|
||||
|
||||
// Only handle custom behavior for policy_type_id = 8
|
||||
if (policy_type_id == 8) {
|
||||
console.log('policy_type_id is 8 — custom handling begins.');
|
||||
let shouldClose = false;
|
||||
if(isClientFormSubmitting == false){
|
||||
|
||||
const shouldClose = confirm("Are you sure you want to close? Unsaved changes will be lost.");
|
||||
shouldClose = confirm("Are you sure you want to close? Unsaved changes will be lost.");
|
||||
// const shouldClose = true; // Always true, can be changed to confirm() if needed
|
||||
console.log('User confirmation result:', shouldClose);
|
||||
|
||||
@ -1194,26 +1208,50 @@ $(document).ready(function(){
|
||||
$('#client_form')[0].reset();
|
||||
console.log('#client_form reset successfully.');
|
||||
|
||||
$('#client_form').removeAttr('data-id');
|
||||
console.log('data-id attribute removed from #client_form.');
|
||||
if (policy_type_id == 8) {
|
||||
$('#client_form').removeAttr('data-id');
|
||||
console.log('data-id attribute removed from #client_form.');
|
||||
|
||||
console.log('Opening #vehicle_modal.');
|
||||
const vehicleModal = new bootstrap.Modal(document.getElementById('vehicle_modal'));
|
||||
vehicleModal.show();
|
||||
console.log('Opening #vehicle_modal.');
|
||||
const vehicleModal = new bootstrap.Modal(document.getElementById('vehicle_modal'));
|
||||
vehicleModal.show();
|
||||
|
||||
console.log('Setting form data for #vehicle_form from localStorage.');
|
||||
setFormDataFromLocalStorage("#vehicle_form", "vehicleFormData");
|
||||
console.log('Setting form data for #vehicle_form from localStorage.');
|
||||
setFormDataFromLocalStorage("#vehicle_form", "vehicleFormData");
|
||||
|
||||
}else {
|
||||
console.log('policy_type_id is not 8 — proceeding with default modal behavior.');
|
||||
}
|
||||
|
||||
} else {
|
||||
console.log('User cancelled closing. Preventing modal from hiding.');
|
||||
e.preventDefault(); // stops modal from closing
|
||||
}
|
||||
|
||||
} else {
|
||||
console.log('policy_type_id is not 8 — proceeding with default modal behavior.');
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$('#vehicle_modal').on('hide.bs.modal', function (e) {
|
||||
|
||||
console.log('Attempting to hide #vehicle_modal modal');
|
||||
|
||||
if(isVehicleFormSubmitting == false){
|
||||
|
||||
const shouldClose = confirm("Are you sure you want to close? Unsaved changes will be lost.");
|
||||
console.log('User confirmation result:', shouldClose);
|
||||
|
||||
if (!shouldClose) {
|
||||
console.log('User cancelled closing. Preventing modal from hiding.');
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#aadhar').attr('data-parsley-required', 'false');
|
||||
$('#aadhar').removeAttr('required');
|
||||
|
||||
@ -1331,6 +1369,7 @@ $(document).ready(function(){
|
||||
|
||||
if($('#client_type').val()){
|
||||
|
||||
isVehicleFormSubmitting = true;
|
||||
$('#vehicle_close_btn').click();
|
||||
|
||||
if ($('#client_type').val() == 2) {
|
||||
@ -1375,6 +1414,8 @@ $(document).ready(function(){
|
||||
var myModal = new bootstrap.Modal(document.getElementById('upload_enrollment_model'));
|
||||
myModal.show();
|
||||
|
||||
isVehicleFormSubmitting = false;
|
||||
|
||||
}else{
|
||||
|
||||
toastr.warning('Please select the Owner type', 'WARNING');
|
||||
@ -3418,6 +3459,8 @@ $("#vehicle_form").submit(function(event) {
|
||||
return ;
|
||||
}
|
||||
|
||||
isVehicleFormSubmitting = true;
|
||||
|
||||
form_action = '<?= base_url("util/createVehicleWithMinimalData"); ?>';
|
||||
|
||||
$('.loader').fadeIn();
|
||||
@ -3467,10 +3510,12 @@ $("#vehicle_form").submit(function(event) {
|
||||
|
||||
$('#vehicle_form')[0].reset();
|
||||
$('.close').click();
|
||||
isVehicleFormSubmitting = false;
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
isVehicleFormSubmitting = false;
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
@ -3868,13 +3913,16 @@ $('#policy_no').change(function(){
|
||||
var policy_no = $(this).val();
|
||||
policy_no = policy_no.trim();
|
||||
let client_id = $('#client_id').val()?.trim();
|
||||
let client_type = $('#client_type').val()?.trim();
|
||||
let client_branch_id = $('#client_branch_id').val()?.trim();
|
||||
let policy_type_id = $('#policy_type_id').val()?.trim();
|
||||
|
||||
if (!client_id || !client_branch_id || !policy_type_id) {
|
||||
toastr.warning('Please select the policy type, client and branch', "WARNING");
|
||||
$('#policy_no').val('');
|
||||
return;
|
||||
if(client_type == 1){
|
||||
toastr.warning('Please select the policy type, client and branch', "WARNING");
|
||||
$('#policy_no').val('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$pt_id = $('#policy_tranction_policy_number').val();
|
||||
@ -3884,7 +3932,7 @@ $('#policy_no').change(function(){
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('util/get_client_policy_data_using_policy_no/');?>',
|
||||
type: "GET",
|
||||
data : { policy_no : policy_no, client_id : client_id, client_branch_id : client_branch_id, policy_type_id : policy_type_id},
|
||||
data : { policy_no : policy_no, client_id : client_id, client_branch_id : client_branch_id, policy_type_id : policy_type_id, client_type : client_type},
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user