FIX_SalesTracker3

This commit is contained in:
sanjeev.p 2026-02-26 09:51:35 +05:30
parent 57ff91a9c8
commit 6f3032d20d
2 changed files with 19 additions and 9 deletions

View File

@ -431,8 +431,7 @@ function resetFlatpicker(){
const activityIcons = { Call: "📞", Email: "✉️", Meeting: "📅", Visit: "🚗",Demo: "🎬", Share: "📄", Todo: "" };
const salesManagerIds = <?= json_encode($sales_manager_ids ?? []) ?>;
console.log("***********************");
console.log(salesManagerIds);return;
const API = '<?= base_url('sales') ?>';
let filter = 'all';
let lead_id = null;
@ -1124,8 +1123,9 @@ document.getElementById('do_follow').addEventListener('change', function () {
selectedFollowUpActivityType = ''; // Reset global variable
}
});
document.getElementById('btnSaveContact').onclick = async (e) => {
const btnSaveContact = document.getElementById('btnSaveContact');
if (btnSaveContact) {
btnSaveContact.onclick = async (e) => {
e.preventDefault(); // Prevent accidental form submission
// 1. Get and Trim Values
@ -1229,9 +1229,12 @@ document.getElementById('btnSaveContact').onclick = async (e) => {
console.error("Fetch Error:", error);
toastr.error('Network error or server is unreachable.');
}
};
};
}
document.getElementById('savedContactsContainer').onclick = async (e) => {
const savedContactsContainer = document.getElementById('savedContactsContainer');
if (savedContactsContainer) {
savedContactsContainer.onclick = async (e) => {
// Check if the clicked element is a Remove button
if (e.target.classList.contains('btnRemoveContact')) {
const btn = e.target;
@ -1262,6 +1265,7 @@ document.getElementById('savedContactsContainer').onclick = async (e) => {
}
}
};
}
function convertDBFormatted(input) {

View File

@ -1580,7 +1580,9 @@ document.getElementById('do_follow').addEventListener('change', function () {
}
});
document.getElementById('btnSaveContact').onclick = async (e) => {
const btnSaveContact = document.getElementById('btnSaveContact');
if (btnSaveContact) {
btnSaveContact.onclick = async (e) => {
// Use .value instead of .val()
let name = document.getElementById('contact_name').value.trim();
let mobile = document.getElementById('contact_mobile').value.trim();
@ -1677,8 +1679,11 @@ document.getElementById('btnSaveContact').onclick = async (e) => {
toastr.error('An error occurred');
}
};
document.getElementById('savedContactsContainer').onclick = async (e) => {
}
const savedContactsContainer = document.getElementById('savedContactsContainer');
if (savedContactsContainer) {
savedContactsContainer.onclick = async (e) => {
// Check if the clicked element is a Remove button
if (e.target.classList.contains('btnRemoveContact')) {
const btn = e.target;
@ -1709,6 +1714,7 @@ document.getElementById('savedContactsContainer').onclick = async (e) => {
}
}
};
}
async function openEditLeadModal(id) {
// 1. Reset UI State