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

This commit is contained in:
VENKATESHWARAN 2025-02-25 16:20:30 +05:30
commit 4dbdb4ae7d
3 changed files with 85 additions and 75 deletions

View File

@ -2539,19 +2539,19 @@ class EmployeeRestController extends AdminController
if($ClientPolicyValue['policy_type_id'] == 1) if($ClientPolicyValue['policy_type_id'] == 1)
{ {
$data['policy_terms'] = $this->policyTermsFiter($terms,'gpa'); $data['policy_terms'] = $this->policyTermsFiter($terms,'gpa');
$data['department_id'] = 2; $data['ticket_type_id'] = 2;
}else if($ClientPolicyValue['policy_type_id'] == 6) }else if($ClientPolicyValue['policy_type_id'] == 6)
{ {
$data['policy_terms'] = $this->policyTermsFiter($terms,'gpa'); $data['policy_terms'] = $this->policyTermsFiter($terms,'gpa');
$data['department_id'] = 3; $data['ticket_type_id'] = 3;
}else if($ClientPolicyValue['policy_type_id'] == 7) }else if($ClientPolicyValue['policy_type_id'] == 7)
{ {
$data['policy_terms'] = $this->policyTermsFiter($terms,'gpa'); $data['policy_terms'] = $this->policyTermsFiter($terms,'gpa');
$data['department_id'] = 4; $data['ticket_type_id'] = 4;
}else }else
{ {
$data['policy_terms'] = $this->policyTermsFiter($terms,'gmc'); $data['policy_terms'] = $this->policyTermsFiter($terms,'gmc');
$data['department_id'] = 1; $data['ticket_type_id'] = 1;
} }
$data['client_id'] = $ClientPolicyValue['client_id']; $data['client_id'] = $ClientPolicyValue['client_id'];
@ -3251,6 +3251,8 @@ class EmployeeRestController extends AdminController
$modeOFIntimate = $this->ticketController->modeOFIntimate; $modeOFIntimate = $this->ticketController->modeOFIntimate;
$claimType = $this->ticketController->claimType; $claimType = $this->ticketController->claimType;
$relationshipType = $this->ticketController->relationshipType; $relationshipType = $this->ticketController->relationshipType;
$ticketTypeArray = $this->ticketController->ticketType;
$emp_id = $this->request->getGet('emp_id'); $emp_id = $this->request->getGet('emp_id');
$ticket_type = $this->request->getGet('ticket_type') ?? null; $ticket_type = $this->request->getGet('ticket_type') ?? null;
@ -3291,6 +3293,8 @@ class EmployeeRestController extends AdminController
$claimPrimaryTypey = "2"; $claimPrimaryTypey = "2";
} }
$ticket_data[$key]['claim_type_value'] = $claimType[$claimPrimaryTypey][$value['claim_type']] ?? null; $ticket_data[$key]['claim_type_value'] = $claimType[$claimPrimaryTypey][$value['claim_type']] ?? null;
$ticket_data[$key]['ticket_policy_type'] = $ticketTypeArray[$value['ticket_type_id']] ?? null;
} }
} }

View File

@ -684,16 +684,17 @@ class TicketMasterModel extends Model
//api //api
public function get_ticket_data($emp_id, $ticket_type = null, $ticket_id = null) public function get_ticket_data($emp_id, $ticket_type = null, $ticket_id = null)
{ {
$query = $this->select('*') $query = $this->select('ticket_master.*, tms.mail_subject as subject')
->where('is_active', 1) ->join('ticket_messages tms', 'ticket_master.id = tms.ticket_id', 'left')
->where('emp_id', $emp_id); ->where('ticket_master.is_active', 1)
->where('ticket_master.emp_id', $emp_id);
if (!empty($ticket_id)) { if (!empty($ticket_id)) {
$query->where('id', $ticket_id); $query->where('ticket_master.id', $ticket_id);
} }
if (!empty($ticket_type)) { if (!empty($ticket_type)) {
$query->where('ticket_type_id', $ticket_type); $query->where('ticket_master.ticket_type_id', $ticket_type);
} }
$data = $query->findAll(); $data = $query->findAll();

View File

@ -319,7 +319,7 @@ table.dataTable tbody td {
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')"> <a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit <i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
</a> </a>
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removePolicyTransaction(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')"> <a class="dropdown-item delete" data-id="<?= $row['id'];?>" onclick="removePolicyTransaction(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete <i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
</a> </a>
</div> </div>
@ -370,25 +370,25 @@ table.dataTable tbody td {
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
const table = document.getElementById("tickets-table"); const table = document.getElementById("tickets-table");
// Create custom dropdown
function createCustomDropdown(row) { function createCustomDropdown(row) {
// Get the original dropdown items
const originalDropdown = row.querySelector('.dropdown-menu'); const originalDropdown = row.querySelector('.dropdown-menu');
if (!originalDropdown) return null; if (!originalDropdown) return null;
// Create new dropdown with proper background and spacing
const customDropdown = document.createElement('div'); const customDropdown = document.createElement('div');
customDropdown.className = 'custom-dropdown-menu'; customDropdown.className = 'custom-dropdown-menu';
// Copy inner content while maintaining icon alignment const items = originalDropdown.querySelectorAll('.dropdown-item');
customDropdown.innerHTML = originalDropdown.innerHTML; items.forEach(item => {
const newItem = item.cloneNode(true);
newItem.removeAttribute('onclick');
customDropdown.appendChild(newItem);
});
return customDropdown; return customDropdown;
} }
let activeDropdown = null; let activeDropdown = null;
// Add click event listener to rows
table.querySelectorAll("tbody tr").forEach(row => { table.querySelectorAll("tbody tr").forEach(row => {
const customDropdown = createCustomDropdown(row); const customDropdown = createCustomDropdown(row);
if (!customDropdown) return; if (!customDropdown) return;
@ -401,51 +401,56 @@ document.addEventListener("DOMContentLoaded", function () {
return; return;
} }
// Hide any active dropdown // Close any existing dropdown
if (activeDropdown) { if (activeDropdown && activeDropdown !== customDropdown) {
activeDropdown.style.display = 'none'; activeDropdown.style.display = 'none';
} }
// Get click position
const rect = event.target.getBoundingClientRect(); const rect = event.target.getBoundingClientRect();
// Position the dropdown with some offset
customDropdown.style.display = 'block'; customDropdown.style.display = 'block';
customDropdown.style.position = 'fixed'; customDropdown.style.position = 'fixed';
customDropdown.style.left = `${rect.left}px`; 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; activeDropdown = customDropdown;
event.stopPropagation(); event.stopPropagation();
}); });
// Preserve click handlers and add auto-close // Handle clicks on dropdown items
customDropdown.querySelectorAll('.dropdown-item').forEach(item => { customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
item.addEventListener('click', function(e) { item.addEventListener('click', function(e) {
const onclickAttr = this.getAttribute('onclick'); e.preventDefault();
if (onclickAttr) { e.stopPropagation();
eval(onclickAttr);
}
const id = this.getAttribute('data-id');
// Handle edit button
if (this.classList.contains('btnEdit') && id) {
getPolicyTransactionDataForEdit(id);
}
// Handle delete button
else if (this.classList.contains('delete') && id) {
removePolicyTransaction(this, id);
}
// Handle other links
else {
const href = this.getAttribute('href'); const href = this.getAttribute('href');
if (href && href !== '#') { if (href && href !== '#' && href !== 'javascript: void(0);') {
window.location.href = href; window.location.href = href;
} }
}
// Close the dropdown after handling the click // Close dropdown
if (activeDropdown) { if (activeDropdown) {
activeDropdown.style.display = 'none'; activeDropdown.style.display = 'none';
activeDropdown = null; activeDropdown = null;
} }
}, { once: true });
e.stopPropagation();
});
}); });
}); });
// Close dropdown when clicking outside // Close dropdown on outside click
document.addEventListener("click", function() { document.addEventListener("click", function() {
if (activeDropdown) { if (activeDropdown) {
activeDropdown.style.display = 'none'; activeDropdown.style.display = 'none';
@ -1486,7 +1491,7 @@ function onlyNumbers(event)
<script> <script>
$(document).ready(function() { $(document).ready(function() {
getURLParams() // getURLParams()
$('#client_id_for_search').select2(); $('#client_id_for_search').select2();
$('#insurer_id_for_search').select2(); $('#insurer_id_for_search').select2();
$('#policy_type_for_search').select2(); $('#policy_type_for_search').select2();
@ -1531,50 +1536,50 @@ function objectToQueryString(obj)
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&'); return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
} }
function getURLParams() // function getURLParams()
{ // {
const url = new URL(window.location.href); // const url = new URL(window.location.href);
const params = new URLSearchParams(url.search); // const params = new URLSearchParams(url.search);
const startDate = params.get('start_date') || 0; // Default to 0 if not found // const startDate = params.get('start_date') || 0; // Default to 0 if not found
const endDate = params.get('end_date') || 0; // Default to 0 if not found // const endDate = params.get('end_date') || 0; // Default to 0 if not found
const client_id = params.get('client_id') || 0; // Default to 0 if not found // const client_id = params.get('client_id') || 0; // Default to 0 if not found
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found // const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found // const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
const date_type = params.get('date_type') || 0; // Default to 0 if not found // const date_type = params.get('date_type') || 0; // Default to 0 if not found
const issuer = params.get('issuer') || 0; // Default to 0 if not found // const issuer = params.get('issuer') || 0; // Default to 0 if not found
const status = params.get('status') || 0; // Default to 0 if not found // const status = params.get('status') || 0; // Default to 0 if not found
hideDateField(date_type) // hideDateField(date_type)
// console.log('startDate', startDate) // // console.log('startDate', startDate)
// console.log('endDate', endDate) // // console.log('endDate', endDate)
// console.log('client_id', client_id) // // console.log('client_id', client_id)
// console.log('insurer_id', insurer_id) // // console.log('insurer_id', insurer_id)
// console.log('policy_type_id', policy_type_id) // // console.log('policy_type_id', policy_type_id)
// console.log('date_type', date_type) // // console.log('date_type', date_type)
// console.log('issuer', issuer) // // console.log('issuer', issuer)
// console.log('status', status) // // console.log('status', status)
// Log the values or use them as needed // // Log the values or use them as needed
// console.log('Start Date:', startDate); // // console.log('Start Date:', startDate);
// console.log('End Date:', endDate); // // console.log('End Date:', endDate);
if (startDate != 0 && endDate != 0) { // if (startDate != 0 && endDate != 0) {
setTimeout(function(){ // setTimeout(function(){
$('#start_date').val(startDate) // $('#start_date').val(startDate)
$('#end_date').val(endDate) // $('#end_date').val(endDate)
$('#client_id_for_search').val(client_id).change() // $('#client_id_for_search').val(client_id).change()
$('#insurer_id_for_search').val(insurer_id).change() // $('#insurer_id_for_search').val(insurer_id).change()
$('#policy_type_for_search').val(policy_type_id).change() // $('#policy_type_for_search').val(policy_type_id).change()
$('#date_type').val(date_type) // $('#date_type').val(date_type)
$('#issuer_for_search').val(issuer) // $('#issuer_for_search').val(issuer)
$('#policy_status_for_search').val(status) // $('#policy_status_for_search').val(status)
},1000) // },1000)
} // }
} // }
$(function() { $(function() {