From 6f3032d20d9e7d5351558841c6ee3cc6fb022c99 Mon Sep 17 00:00:00 2001 From: "sanjeev.p" Date: Thu, 26 Feb 2026 09:51:35 +0530 Subject: [PATCH] FIX_SalesTracker3 --- app/Views/sales/activity_view.php | 16 ++++++++++------ app/Views/sales/tracker_view.php | 12 +++++++++--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/Views/sales/activity_view.php b/app/Views/sales/activity_view.php index b997a73f..46833e9f 100644 --- a/app/Views/sales/activity_view.php +++ b/app/Views/sales/activity_view.php @@ -431,8 +431,7 @@ function resetFlatpicker(){ const activityIcons = { Call: "📞", Email: "✉️", Meeting: "📅", Visit: "🚗",Demo: "🎬", Share: "📄", Todo: "✓" }; const salesManagerIds = ; -console.log("***********************"); -console.log(salesManagerIds);return; + const API = ''; 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) { diff --git a/app/Views/sales/tracker_view.php b/app/Views/sales/tracker_view.php index 389ec1a1..3ceb43a6 100644 --- a/app/Views/sales/tracker_view.php +++ b/app/Views/sales/tracker_view.php @@ -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