FIX_RFQ_MODULE
This commit is contained in:
parent
ea9fb8dbc7
commit
91cc9f812c
@ -64,6 +64,9 @@ class LeadsController extends BaseController
|
||||
protected $clientType;
|
||||
protected $leadType;
|
||||
protected $leadsStatus;
|
||||
protected $claim_type_for_gpa;
|
||||
protected $cause_of_death;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -96,6 +99,19 @@ class LeadsController extends BaseController
|
||||
'completed_with_corrections' => 'Completed with Corrections',
|
||||
'completed_without_corrections' => 'Completed w/o Corrections',
|
||||
];
|
||||
$this->claim_type_for_gpa = [
|
||||
'accident_death' => 'Accident Death',
|
||||
'permanent_total_disablement' => 'Permanent Total Disablement',
|
||||
'permanent_partial_disablement' => 'Permanent Partial Disablement',
|
||||
'temporary_total_disablement_benefit' => 'Temporary Total Disablement benefit'
|
||||
];
|
||||
|
||||
$this->cause_of_death = [
|
||||
'natural_death' => 'Natural Death',
|
||||
'suicide' => 'Suicide',
|
||||
'accident' => 'Accident'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function viewLeadsList()
|
||||
@ -123,7 +139,7 @@ class LeadsController extends BaseController
|
||||
// Fetch insurer and TPA branch data
|
||||
$data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
||||
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
|
||||
|
||||
// print_r($data['tpa']);die();
|
||||
// Fetch sales team members who are active in team 5
|
||||
$data['salse_team'] = $this->userModel
|
||||
->select('user_profiles.*')
|
||||
@ -134,7 +150,10 @@ class LeadsController extends BaseController
|
||||
->findAll();
|
||||
|
||||
// dd($data);
|
||||
|
||||
$data['lastFiveYears'] = $this->getLastFiveFinancialYears();
|
||||
$data['gpaClaimType'] = $this->claim_type_for_gpa;
|
||||
$data['causeOfDeath'] = $this->cause_of_death;
|
||||
// dd($lastFiveYears);
|
||||
if ($this->request->is('get')) {
|
||||
// Fetch leads data
|
||||
$data ['lead_data_list'] = $this->leadsModel->getLeadDataForLising();
|
||||
@ -270,7 +289,25 @@ class LeadsController extends BaseController
|
||||
|
||||
$last_3_years_claims = null;
|
||||
if($value != 2){
|
||||
$last_3_years_claims = $data['finyear'];
|
||||
$last_3_years_claims = [];
|
||||
$finyear = json_decode($data['finyear']);
|
||||
|
||||
foreach ($finyear as $year){
|
||||
$received_policy_type = ($year->finyear[0]->policy_type);
|
||||
if ($value == $received_policy_type){
|
||||
array_push($last_3_years_claims,$year);
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
// print_r($last_3_years_claims);
|
||||
|
||||
// $last_3_years_claims = json_encode($last_3_years_claims);
|
||||
}
|
||||
$last_3_years_claims = json_encode($last_3_years_claims);
|
||||
// print_r($last_3_years_claims);
|
||||
// die();
|
||||
|
||||
// $last_3_years_claims = $data['finyear'];
|
||||
}
|
||||
|
||||
$processedData[] = [
|
||||
@ -338,7 +375,7 @@ class LeadsController extends BaseController
|
||||
'notes' => $data['notes'] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
// print_r($processedData);die();
|
||||
return $processedData;
|
||||
}
|
||||
|
||||
@ -2103,4 +2140,26 @@ class LeadsController extends BaseController
|
||||
|
||||
|
||||
}
|
||||
function getLastFiveFinancialYears() {
|
||||
$currentYear = date('Y');
|
||||
$currentMonth = date('m');
|
||||
|
||||
// In India, the financial year starts from April (04)
|
||||
if ($currentMonth < 4) {
|
||||
$currentYear--; // Adjust year if it's Jan-Mar
|
||||
}
|
||||
|
||||
$financialYears = [];
|
||||
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$startYear = $currentYear - $i - 1;
|
||||
$endYear = $currentYear - $i;
|
||||
$financialYears[] = "$startYear-$endYear";
|
||||
}
|
||||
|
||||
return $financialYears;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -161,28 +161,29 @@ table.dataTable tbody td {
|
||||
<script>
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
const table = document.getElementById("tickets-table");
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
// Get the original dropdown items
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
// Create new dropdown with proper background and spacing
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
// Copy inner content while maintaining icon alignment
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
// Clone the items but remove their original click handlers
|
||||
const items = originalDropdown.querySelectorAll('.dropdown-item');
|
||||
items.forEach(item => {
|
||||
const newItem = item.cloneNode(true);
|
||||
// Preserve the attributes but remove the onclick
|
||||
newItem.removeAttribute('onclick');
|
||||
customDropdown.appendChild(newItem);
|
||||
});
|
||||
|
||||
return customDropdown;
|
||||
}
|
||||
|
||||
let activeDropdown = null;
|
||||
|
||||
// Add click event listener to rows
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const customDropdown = createCustomDropdown(row);
|
||||
if (!customDropdown) return;
|
||||
@ -195,46 +196,49 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide any active dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
}
|
||||
|
||||
// Get click position
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
// Position the dropdown with some offset
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||
|
||||
// Set as active dropdown
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Preserve click handlers and add auto-close
|
||||
// Handle clicks on dropdown items
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// Get the data-id and other attributes from the original button
|
||||
const originalItem = row.querySelector(`.dropdown-item[data-id="${this.getAttribute('data-id')}"]`);
|
||||
|
||||
// For edit functionality
|
||||
if (this.classList.contains('btnEdit')) {
|
||||
const id = this.getAttribute('data-id');
|
||||
if (id) {
|
||||
getLeadsDataForEdit(id);
|
||||
}
|
||||
}
|
||||
|
||||
// For RFQ links
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
if (href && href !== '#' && !this.classList.contains('btnEdit')) {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
// Close the dropdown after handling the click
|
||||
// Close the dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -281,7 +285,7 @@ $(document).ready(function(){
|
||||
|
||||
$('#client_id').select2();
|
||||
$('#client_branch_id').select2();
|
||||
$('#source_policy_id').select2();
|
||||
// $('#source_policy_id').select2();
|
||||
$('#salse_person_id').select2({
|
||||
placeholder: "Select Salse Person",
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user