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