Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
f1860e80e2
@ -915,6 +915,8 @@ $routes->group('sales', function($routes) {
|
|||||||
|
|
||||||
$routes->get('loadactivities', 'SalesController::loadactivities');
|
$routes->get('loadactivities', 'SalesController::loadactivities');
|
||||||
|
|
||||||
|
$routes->get('loadtargets', 'SalesController::loadtargets');
|
||||||
|
|
||||||
$routes->get('page/(:segment)', 'SalesController::noPage/$1');
|
$routes->get('page/(:segment)', 'SalesController::noPage/$1');
|
||||||
|
|
||||||
// Get all leads with filters
|
// Get all leads with filters
|
||||||
|
|||||||
@ -844,6 +844,8 @@ class MediAssistApiController extends BaseController
|
|||||||
->get()
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
|
|
||||||
|
log_message('error','MEDI_ASSIST - Claim Status started | for ticket count: ' . count($TicketData));
|
||||||
|
|
||||||
// dd($TicketData);
|
// dd($TicketData);
|
||||||
|
|
||||||
if (!$TicketData) {
|
if (!$TicketData) {
|
||||||
@ -890,7 +892,11 @@ class MediAssistApiController extends BaseController
|
|||||||
|
|
||||||
if ($response['status'] != true || empty($response['data']['claimsData'][0])) {
|
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));
|
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
|
// Extract Claim Status
|
||||||
|
|||||||
@ -53,6 +53,15 @@ class SalesController extends BaseController
|
|||||||
return $this->loadLayout('sales/activity_view', $data);
|
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
|
* HELPER: Fetches Sales Managers based on the logged-in user's role and branch
|
||||||
*/
|
*/
|
||||||
@ -1001,7 +1010,7 @@ class SalesController extends BaseController
|
|||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'target' => $targetAmount,
|
'target_amt' => $targetAmount,
|
||||||
'achieved' => $achievedAmount,
|
'achieved' => $achievedAmount,
|
||||||
'remaining' => $remainingAmount,
|
'remaining' => $remainingAmount,
|
||||||
'percent' => $achievementPercent,
|
'percent' => $achievementPercent,
|
||||||
|
|||||||
@ -567,6 +567,8 @@ class VidalApiController extends BaseController
|
|||||||
|
|
||||||
// dd($TicketData);
|
// dd($TicketData);
|
||||||
|
|
||||||
|
log_message('error', "VIDAL - Claim Status | Total tickets fetched for status update: " . count($TicketData));
|
||||||
|
|
||||||
if (!$TicketData) {
|
if (!$TicketData) {
|
||||||
log_message('error', "VIDAL - Claim Status | Claims not found to update status");
|
log_message('error', "VIDAL - Claim Status | Claims not found to update status");
|
||||||
return $this->response->setJSON(['status' => false,'message' => 'Claims not found' ]);
|
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])) {
|
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));
|
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
|
// Extract claim status
|
||||||
|
|||||||
@ -2104,6 +2104,11 @@
|
|||||||
<!-- <li>
|
<!-- <li>
|
||||||
<a href="<?= base_url('sales/page/Team') ?>"><i class="ri-bar-chart-line"></i> Sales Team </a>
|
<a href="<?= base_url('sales/page/Team') ?>"><i class="ri-bar-chart-line"></i> Sales Team </a>
|
||||||
</li> -->
|
</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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@ -452,6 +452,33 @@
|
|||||||
policyEnd.attr("id", end_date_id);
|
policyEnd.attr("id", end_date_id);
|
||||||
$("label[for='policy_end_date'], label[for^='policy_end_date_']").attr("for", end_date_id);
|
$("label[for='policy_end_date'], label[for^='policy_end_date_']").attr("for", end_date_id);
|
||||||
}, 3000);
|
}, 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>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -1241,6 +1268,15 @@
|
|||||||
var lead_type = $('#lead_type').val();
|
var lead_type = $('#lead_type').val();
|
||||||
leadTypeBsedHideAndShow(lead_type)
|
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();
|
$('#insurer_' + increment).select2();
|
||||||
$('#tpa_' + increment).select2();
|
$('#tpa_' + increment).select2();
|
||||||
$('#proposed_insurer_' + increment).select2();
|
$('#proposed_insurer_' + increment).select2();
|
||||||
|
|||||||
@ -432,6 +432,42 @@
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<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() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,8 @@
|
|||||||
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; color: #333; }
|
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; }
|
.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 { 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: #ff5722; transform: translateY(-1px); }
|
.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 { 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-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;}
|
.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 */
|
||||||
.filter-tabs { display: flex; gap: 10px; padding: 20px 30px; }
|
.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 { 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 */
|
/* Leads Grid */
|
||||||
.lead-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; /* responsive */ gap: 15px; }
|
.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() {
|
$('.searchable').each(function() {
|
||||||
let parentModal = $(this).closest('.modal');
|
let parentModal = $(this).closest('.modal');
|
||||||
$(this).select2({
|
$(this).select2({
|
||||||
placeholder: "Select User",
|
placeholder: "Select..",
|
||||||
dropdownParent: parentModal.length ? parentModal : $(document.body)
|
dropdownParent: parentModal.length ? parentModal : $(document.body)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -461,6 +461,7 @@ function closeModal(id) {
|
|||||||
selectedType = 'Call';
|
selectedType = 'Call';
|
||||||
$('#typeButtons .d_activity_type').removeClass('active');
|
$('#typeButtons .d_activity_type').removeClass('active');
|
||||||
$('#typeButtons .d_activity_type[data-type="Call"]').addClass('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)
|
// Specific cleanup for "Complete" modal (hidden follow-up sections)
|
||||||
@ -652,7 +653,6 @@ async function fetchActivities(isLoadMore = false) {
|
|||||||
|
|
||||||
// 2. Detail Logic
|
// 2. Detail Logic
|
||||||
async function viewDetail(id) {
|
async function viewDetail(id) {
|
||||||
console.log("i am here");
|
|
||||||
lead_id = id;
|
lead_id = id;
|
||||||
let res = await fetch(`${API}/leads/${id}`);
|
let res = await fetch(`${API}/leads/${id}`);
|
||||||
let json = await res.json();
|
let json = await res.json();
|
||||||
@ -741,6 +741,7 @@ function renderCard(opps) {
|
|||||||
function renderTimeline(acts) {
|
function renderTimeline(acts) {
|
||||||
const cont = document.getElementById('timelineContainer');
|
const cont = document.getElementById('timelineContainer');
|
||||||
|
|
||||||
|
|
||||||
if (acts.length === 0) {
|
if (acts.length === 0) {
|
||||||
cont.classList.add('no-line');
|
cont.classList.add('no-line');
|
||||||
} else {
|
} else {
|
||||||
@ -786,6 +787,7 @@ function renderTimeline(acts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openActivityModal() {
|
function openActivityModal() {
|
||||||
|
|
||||||
document.getElementById('act_owner').value = global_lead_assigned_to;
|
document.getElementById('act_owner').value = global_lead_assigned_to;
|
||||||
document.getElementById('act_owner').dispatchEvent(new Event('change'));
|
document.getElementById('act_owner').dispatchEvent(new Event('change'));
|
||||||
document.getElementById('act_lead_id').value = lead_id;
|
document.getElementById('act_lead_id').value = lead_id;
|
||||||
@ -908,7 +910,7 @@ document.getElementById('activityForm').onsubmit = async (e) => {
|
|||||||
toastr.success('Activity Created Successfully');
|
toastr.success('Activity Created Successfully');
|
||||||
closeModal('activityModal');
|
closeModal('activityModal');
|
||||||
if (flag === "frompopup") {
|
if (flag === "frompopup") {
|
||||||
viewDetail(document.getElementById('act_lead_id').value);
|
viewDetail(actLead);
|
||||||
} else {
|
} else {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,7 +86,7 @@
|
|||||||
|
|
||||||
<div class="target-card">
|
<div class="target-card">
|
||||||
<div style="font-size:11px; color:#999; letter-spacing: 1px; font-weight: 600;">YEARLY TARGET</div>
|
<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 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;">
|
<div class="chart-circle" style="position: absolute; right: 40px; top: 35px; width: 75px; height: 75px;">
|
||||||
|
|||||||
@ -5,13 +5,13 @@
|
|||||||
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
|
.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; } */
|
/* .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 { 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: #ff5722; transform: translateY(-1px); }
|
.btn-primary:hover { background: #02a8b5; transform: translateY(-1px); }
|
||||||
|
|
||||||
/* Filter Tabs */
|
/* Filter Tabs */
|
||||||
.filter-tabs { display: flex; gap: 10px; padding: 20px 30px; }
|
.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 { 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 */
|
/* Leads Grid */
|
||||||
.lead-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; /* responsive */ gap: 15px; }
|
.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() {
|
$('.searchable').each(function() {
|
||||||
let parentModal = $(this).closest('.modal');
|
let parentModal = $(this).closest('.modal');
|
||||||
$(this).select2({
|
$(this).select2({
|
||||||
placeholder: "Select User",
|
placeholder: "Select..",
|
||||||
dropdownParent: parentModal.length ? parentModal : $(document.body)
|
dropdownParent: parentModal.length ? parentModal : $(document.body)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1592,7 +1592,7 @@ if (btnSaveContact) {
|
|||||||
// Use .value instead of .val()
|
// Use .value instead of .val()
|
||||||
let name = document.getElementById('contact_name').value.trim();
|
let name = document.getElementById('contact_name').value.trim();
|
||||||
let mobile = document.getElementById('contact_mobile').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) {
|
if (!name || !mobile) {
|
||||||
return toastr.warning('Please enter both contact person name and mobile number.');
|
return toastr.warning('Please enter both contact person name and mobile number.');
|
||||||
@ -1607,7 +1607,7 @@ if (btnSaveContact) {
|
|||||||
body: JSON.stringify(payload)
|
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) {
|
if (res.ok) {
|
||||||
// Clear inputs
|
// Clear inputs
|
||||||
@ -1620,16 +1620,16 @@ if (btnSaveContact) {
|
|||||||
|
|
||||||
// Create the HTML string
|
// Create the HTML string
|
||||||
let contactHtml = `
|
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;"
|
style="background: #f8f8f8; border-radius: 8px;"
|
||||||
data-id="${result.data.contact_id}">
|
data-id="${contactResult.data.contact_id}">
|
||||||
<div>
|
<div>
|
||||||
<div class="fw-bold">${result.data.name}</div>
|
<div class="fw-bold">${contactResult.data.name}</div>
|
||||||
<div class="text-muted">${result.data.mobile}</div>
|
<div class="text-muted">${contactResult.data.mobile}</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="btn btn-danger btn-sm btnRemoveContact"
|
class="btn btn-danger btn-sm btnRemoveContact"
|
||||||
data-id="${result.data.contact_id}">
|
data-id="${contactResult.data.contact_id}">
|
||||||
Remove
|
Remove
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -1637,19 +1637,19 @@ if (btnSaveContact) {
|
|||||||
|
|
||||||
// <button type="button"
|
// <button type="button"
|
||||||
// class="btn btn-secondary btn-sm btnEditContact"
|
// class="btn btn-secondary btn-sm btnEditContact"
|
||||||
// data-id="${result.data.contact_id}">
|
// data-id="${contactResult.data.contact_id}">
|
||||||
// Update
|
// Update
|
||||||
// </button>
|
// </button>
|
||||||
// Append to container using Vanilla JS
|
// Append to container using Vanilla JS
|
||||||
document.getElementById('savedContactsContainer').insertAdjacentHTML('beforeend', contactHtml);
|
document.getElementById('savedContactsContainer').insertAdjacentHTML('beforeend', contactHtml);
|
||||||
toastr.success('Contact saved successfully');
|
toastr.success('Contact saved successfully');
|
||||||
} else {
|
} else {
|
||||||
let err = await res.json();
|
|
||||||
if (res.status === 400) {
|
if (res.status === 400) {
|
||||||
let errorMessages = "";
|
let errorMessages = "";
|
||||||
let seenMessages = [];
|
let seenMessages = [];
|
||||||
if (err.messages) {
|
if (contactResult.messages) {
|
||||||
Object.entries(err.messages).forEach(([field, message]) => {
|
Object.entries(contactResult.messages).forEach(([field, message]) => {
|
||||||
let inputElement = $('[name="' + field + '"]');
|
let inputElement = $('[name="' + field + '"]');
|
||||||
|
|
||||||
if (inputElement.length > 0) {
|
if (inputElement.length > 0) {
|
||||||
@ -1673,11 +1673,11 @@ if (btnSaveContact) {
|
|||||||
});
|
});
|
||||||
toastr.error(errorMessages, 'Validation Error', { allowHtml: true });
|
toastr.error(errorMessages, 'Validation Error', { allowHtml: true });
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(err.message || 'Validation failed', 'Warning');
|
toastr.warning(contactResult.message || 'Validation failed', 'Warning');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
toastr.error(err.message || 'Error adding lead');
|
toastr.error(contactResult.message || 'Error adding lead');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user