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

This commit is contained in:
velz 2026-02-27 12:05:46 +05:30
commit f1860e80e2
10 changed files with 130 additions and 27 deletions

View File

@ -914,6 +914,8 @@ $routes->group('sales', function($routes) {
$routes->get('/', 'SalesController::index');
$routes->get('loadactivities', 'SalesController::loadactivities');
$routes->get('loadtargets', 'SalesController::loadtargets');
$routes->get('page/(:segment)', 'SalesController::noPage/$1');

View File

@ -844,6 +844,8 @@ class MediAssistApiController extends BaseController
->get()
->getResultArray();
log_message('error','MEDI_ASSIST - Claim Status started | for ticket count: ' . count($TicketData));
// dd($TicketData);
if (!$TicketData) {
@ -890,7 +892,11 @@ class MediAssistApiController extends BaseController
if ($response['status'] != true || empty($response['data']['claimsData'][0])) {
log_message('error','MEDI_ASSIST - Claim Status FAILED | for ticket ID: ' . $claimId.' | response: '.json_encode($response));
$error_data[$claimId][['status' => false,'message' => 'API call failed.','data' => $response]];
$error_data[$claimId] = [
'response' => $response,
'body' => $body
];
continue; // skip to next ticket
}
// Extract Claim Status

View File

@ -53,6 +53,15 @@ class SalesController extends BaseController
return $this->loadLayout('sales/activity_view', $data);
}
public function loadtargets(){
$data = $this->getSalesStaffData();
$data['tab_name'] = 'Team Target';
$data['page_name'] = 'Team Target';
return $this->loadLayout('sales/target_view', $data);
}
/**
* HELPER: Fetches Sales Managers based on the logged-in user's role and branch
*/
@ -1001,7 +1010,7 @@ class SalesController extends BaseController
->findAll();
$data = [
'target' => $targetAmount,
'target_amt' => $targetAmount,
'achieved' => $achievedAmount,
'remaining' => $remainingAmount,
'percent' => $achievementPercent,

View File

@ -567,6 +567,8 @@ class VidalApiController extends BaseController
// dd($TicketData);
log_message('error', "VIDAL - Claim Status | Total tickets fetched for status update: " . count($TicketData));
if (!$TicketData) {
log_message('error', "VIDAL - Claim Status | Claims not found to update status");
return $this->response->setJSON(['status' => false,'message' => 'Claims not found' ]);
@ -599,7 +601,12 @@ class VidalApiController extends BaseController
if ($response['status'] != true || empty($response['data']['data']['claims'][0])) {
log_message('error', 'VIDAL - Claim Status FAILED | for ticket ID: ' . $claimId.' | response: '.json_encode($response));
$error_data[$claimId][['status' => false,'message' => 'API call failed.','data' => $response]];
$error_data[$claimId] = [
'status' => false,
'message' => 'API call failed.',
'data' => $response
];
continue;
}
// Extract claim status

View File

@ -2104,6 +2104,11 @@
<!-- <li>
<a href="<?= base_url('sales/page/Team') ?>"><i class="ri-bar-chart-line"></i> Sales Team </a>
</li> -->
<?php if (in_array(get_role_id(), [1, 5])){ ?>
<li>
<a href="<?= base_url('sales/loadtargets') ?>"><i class="ri-group-2-fill"></i> Team Targets </a>
</li>
<?php } ?>
</ul>
</div>
</li>

View File

@ -452,6 +452,33 @@
policyEnd.attr("id", end_date_id);
$("label[for='policy_end_date'], label[for^='policy_end_date_']").attr("for", end_date_id);
}, 3000);
$(document).ready(function() {
$('#salse_person_id').parsley({
errorsContainer: function(ParsleyField) {
if (ParsleyField.$element.hasClass('select2-hidden-accessible')) {
return ParsleyField.$element.siblings('.select2-container');
}
return ParsleyField.$element;
}
});
$('#client_id').parsley({
errorsContainer: function(ParsleyField) {
if (ParsleyField.$element.hasClass('select2-hidden-accessible')) {
return ParsleyField.$element.siblings('.select2-container');
}
return ParsleyField.$element;
}
});
$('#client_branch_id').parsley({
errorsContainer: function(ParsleyField) {
if (ParsleyField.$element.hasClass('select2-hidden-accessible')) {
return ParsleyField.$element.siblings('.select2-container');
}
return ParsleyField.$element;
}
});
});
</script>
<script>
@ -1241,6 +1268,15 @@
var lead_type = $('#lead_type').val();
leadTypeBsedHideAndShow(lead_type)
$('#policy_type_id_' + increment).parsley({
errorsContainer: function(ParsleyField) {
if (ParsleyField.$element.hasClass('select2-hidden-accessible')) {
return ParsleyField.$element.siblings('.select2-container');
}
return ParsleyField.$element;
}
});
$('#insurer_' + increment).select2();
$('#tpa_' + increment).select2();
$('#proposed_insurer_' + increment).select2();

View File

@ -432,6 +432,42 @@
<script>
$(document).ready(function() {
$('#salse_person_id').parsley({
errorsContainer: function(ParsleyField) {
if (ParsleyField.$element.hasClass('select2-hidden-accessible')) {
return ParsleyField.$element.siblings('.select2-container');
}
return ParsleyField.$element;
}
});
$('#client_id').parsley({
errorsContainer: function(ParsleyField) {
if (ParsleyField.$element.hasClass('select2-hidden-accessible')) {
return ParsleyField.$element.siblings('.select2-container');
}
return ParsleyField.$element;
}
});
$('#client_branch_id').parsley({
errorsContainer: function(ParsleyField) {
if (ParsleyField.$element.hasClass('select2-hidden-accessible')) {
return ParsleyField.$element.siblings('.select2-container');
}
return ParsleyField.$element;
}
});
$('#policy_type_id').parsley({
errorsContainer: function(ParsleyField) {
if (ParsleyField.$element.hasClass('select2-hidden-accessible')) {
return ParsleyField.$element.siblings('.select2-container');
}
return ParsleyField.$element;
}
});
});
$(document).ready(function() {

View File

@ -4,8 +4,8 @@
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; color: #333; }
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.btn-primary { background: #ff6b35; color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.2s; }
.btn-primary:hover { background: #ff5722; transform: translateY(-1px); }
.btn-primary { background: #02a8b5; color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.2s; }
.btn-primary:hover { background: #02a8b5; transform: translateY(-1px); }
.btn-complete { background: #4caf50; color: white; border: none;padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; transition: all 0.2s;}
.btn-complete:hover { background: #4caf50; transform: translateY(-1px); }
.btn-view { background: #f0f0f0; color: #666; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; transition: all 0.2s;}
@ -14,7 +14,7 @@
/* Filter Tabs */
.filter-tabs { display: flex; gap: 10px; padding: 20px 30px; }
.tab { padding: 10px 20px; border-radius: 20px; cursor: pointer; font-size: 14px; background: white; color: #666; border: 1px solid #e0e0e0; transition: all 0.2s; }
.tab.active { background: #ff6b35; color: white; border-color: #ff6b35; }
.tab.active { background: #02a8b5; color: white; border-color: #02a8b5; }
/* Leads Grid */
.lead-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; /* responsive */ gap: 15px; }
@ -406,7 +406,7 @@ $(document).ready(function() {
$('.searchable').each(function() {
let parentModal = $(this).closest('.modal');
$(this).select2({
placeholder: "Select User",
placeholder: "Select..",
dropdownParent: parentModal.length ? parentModal : $(document.body)
});
});
@ -461,6 +461,7 @@ function closeModal(id) {
selectedType = 'Call';
$('#typeButtons .d_activity_type').removeClass('active');
$('#typeButtons .d_activity_type[data-type="Call"]').addClass('active');
fetchActivities(); // now i called because of Refresh the page .......
}
// Specific cleanup for "Complete" modal (hidden follow-up sections)
@ -652,7 +653,6 @@ async function fetchActivities(isLoadMore = false) {
// 2. Detail Logic
async function viewDetail(id) {
console.log("i am here");
lead_id = id;
let res = await fetch(`${API}/leads/${id}`);
let json = await res.json();
@ -740,6 +740,7 @@ function renderCard(opps) {
function renderTimeline(acts) {
const cont = document.getElementById('timelineContainer');
if (acts.length === 0) {
cont.classList.add('no-line');
@ -786,6 +787,7 @@ function renderTimeline(acts) {
}
function openActivityModal() {
document.getElementById('act_owner').value = global_lead_assigned_to;
document.getElementById('act_owner').dispatchEvent(new Event('change'));
document.getElementById('act_lead_id').value = lead_id;
@ -908,7 +910,7 @@ document.getElementById('activityForm').onsubmit = async (e) => {
toastr.success('Activity Created Successfully');
closeModal('activityModal');
if (flag === "frompopup") {
viewDetail(document.getElementById('act_lead_id').value);
viewDetail(actLead);
} else {
window.location.reload();
}

View File

@ -86,7 +86,7 @@
<div class="target-card">
<div style="font-size:11px; color:#999; letter-spacing: 1px; font-weight: 600;">YEARLY TARGET</div>
<div class="target-amount"><?= number_format($target / 100000, 1) ?>L</div>
<div class="target-amount"><?= number_format($target_amt / 100000, 1) ?>L</div>
<div style="font-size:12px; color:#777;"><?= $display_fin_years ?></div>
<div class="chart-circle" style="position: absolute; right: 40px; top: 35px; width: 75px; height: 75px;">

View File

@ -5,13 +5,13 @@
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
/* .top-bar { background: white; padding: 15px 30px; border-bottom: 1px solid #e0e0e0; display: flex; justify-content: space-between; align-items: center; } */
.btn-primary { background: #ff6b35; color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.2s; }
.btn-primary:hover { background: #ff5722; transform: translateY(-1px); }
.btn-primary { background: #02a8b5; color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.2s; }
.btn-primary:hover { background: #02a8b5; transform: translateY(-1px); }
/* Filter Tabs */
.filter-tabs { display: flex; gap: 10px; padding: 20px 30px; }
.tab { padding: 10px 20px; border-radius: 20px; cursor: pointer; font-size: 14px; background: white; color: #666; border: 1px solid #e0e0e0; transition: all 0.2s; }
.tab.active { background: #ff6b35; color: white; border-color: #ff6b35; }
.tab.active { background: #02a8b5; color: white; border-color: #02a8b5; }
/* Leads Grid */
.lead-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; /* responsive */ gap: 15px; }
@ -604,7 +604,7 @@ $(document).ready(function() {
$('.searchable').each(function() {
let parentModal = $(this).closest('.modal');
$(this).select2({
placeholder: "Select User",
placeholder: "Select..",
dropdownParent: parentModal.length ? parentModal : $(document.body)
});
});
@ -1592,7 +1592,7 @@ if (btnSaveContact) {
// Use .value instead of .val()
let name = document.getElementById('contact_name').value.trim();
let mobile = document.getElementById('contact_mobile').value.trim();
let lead_id = document.getElementById('lead_id').value.trim();
let lead_id = document.getElementById('hidden_lead_id').value.trim();
if (!name || !mobile) {
return toastr.warning('Please enter both contact person name and mobile number.');
@ -1607,7 +1607,7 @@ if (btnSaveContact) {
body: JSON.stringify(payload)
});
const result = await res.json(); // Get the response body
const contactResult = await res.json(); // Get the response body
if (res.ok) {
// Clear inputs
@ -1620,16 +1620,16 @@ if (btnSaveContact) {
// Create the HTML string
let contactHtml = `
<div class="contact-card d-flex justify-content-between align-items-center mb-2 p-2"
<div class="contact-card d-flex justify-content-between align-items-center mb-2 p-3"
style="background: #f8f8f8; border-radius: 8px;"
data-id="${result.data.contact_id}">
data-id="${contactResult.data.contact_id}">
<div>
<div class="fw-bold">${result.data.name}</div>
<div class="text-muted">${result.data.mobile}</div>
<div class="fw-bold">${contactResult.data.name}</div>
<div class="text-muted">${contactResult.data.mobile}</div>
</div>
<button type="button"
class="btn btn-danger btn-sm btnRemoveContact"
data-id="${result.data.contact_id}">
data-id="${contactResult.data.contact_id}">
Remove
</button>
</div>
@ -1637,19 +1637,19 @@ if (btnSaveContact) {
// <button type="button"
// class="btn btn-secondary btn-sm btnEditContact"
// data-id="${result.data.contact_id}">
// data-id="${contactResult.data.contact_id}">
// Update
// </button>
// Append to container using Vanilla JS
document.getElementById('savedContactsContainer').insertAdjacentHTML('beforeend', contactHtml);
toastr.success('Contact saved successfully');
} else {
let err = await res.json();
if (res.status === 400) {
let errorMessages = "";
let seenMessages = [];
if (err.messages) {
Object.entries(err.messages).forEach(([field, message]) => {
if (contactResult.messages) {
Object.entries(contactResult.messages).forEach(([field, message]) => {
let inputElement = $('[name="' + field + '"]');
if (inputElement.length > 0) {
@ -1673,11 +1673,11 @@ if (btnSaveContact) {
});
toastr.error(errorMessages, 'Validation Error', { allowHtml: true });
} else {
toastr.warning(err.message || 'Validation failed', 'Warning');
toastr.warning(contactResult.message || 'Validation failed', 'Warning');
}
}
else {
toastr.error(err.message || 'Error adding lead');
toastr.error(contactResult.message || 'Error adding lead');
}
}
} catch (error) {