-
Comments:
+
Comments:
@@ -246,7 +300,6 @@
$stmt->bindParam(':leadid', $_GET['id']);
$stmt->bindParam(':comment', $_POST['comment']);
$stmt->execute();
-
$saved_message = "New Appointment save successfully";
} catch(PDOException $e) {
echo "Error: " . $e->getMessage();
@@ -414,45 +467,38 @@ copyButtons.forEach(button => {
const inputId = button.getAttribute('data-input-id');
const inputElement = document.getElementById(inputId);
if (inputElement && inputElement.value) {
- navigator.clipboard.writeText(inputElement.value)
- .then(() => {
- button.classList.add('copied');
- setTimeout(() => {
- button.classList.remove('copied');
- }, 1000);
- })
- .catch(err => {
- console.error('Unable to copy:', err);
- });
+ navigator.clipboard.writeText(inputElement.value)
+ .then(() => {
+ button.classList.add('copied');
+ setTimeout(() => {
+ button.classList.remove('copied');
+ }, 1000);
+ })
+ .catch(err => {
+ console.error('Unable to copy:', err);
+ });
}
});
});
- // Function to fetch countries and populate the country dropdown
- function fetchCountries() {
- fetch('https://api.siliconpin.com/v3/list/country/')
- .then(res => res.json())
- .then(data => {
- const countryDropdown = document.getElementById('country');
- countryDropdown.innerHTML = '
';
- data.forEach(country => {
- const option = document.createElement('option');
- option.value = country.iso2;
- option.text = country.name;
- countryDropdown.appendChild(option);
- });
- });
- }
- function myCountry() {
- let getCountryNameFrom = document.getElementById('country');
- let selectedOption = getCountryNameFrom.options[getCountryNameFrom.selectedIndex].text;
- document.getElementById('getCountryName').value = selectedOption;
- // console.log(selectedOption);
- }
+
+ // function fetchCountries() {
+ // fetch('https://api.siliconpin.com/v3/list/country/')
+ // .then(res => res.json())
+ // .then(data => {
+ // const countryDropdown = document.getElementById('country');
+ // countryDropdown.innerHTML = '
';
+ // data.forEach(country => {
+ // const option = document.createElement('option');
+ // option.value = country.iso2;
+ // option.text = country.name;
+ // countryDropdown.appendChild(option);
+ // });
+ // });
+ // }
function fetchStates() {
- myCountry();
const selectedCountry = document.getElementById('country').value;
fetch(`https://api.siliconpin.com/v3/list/country/state/?country=${selectedCountry}`)
.then(res => res.json())
@@ -467,15 +513,8 @@ copyButtons.forEach(button => {
});
});
}
- function myState() {
- let getCountryNameFrom = document.getElementById('state');
- let selectedOption = getCountryNameFrom.options[getCountryNameFrom.selectedIndex].text;
- document.getElementById('getStateName').value = selectedOption;
- // console.log(selectedOption);
- }
function fetchCities() {
- myState();
const selectedCountry = document.getElementById('country').value;
const selectedState = document.getElementById('state').value;
fetch(`https://api.siliconpin.com/v3/list/country/city/?country=${selectedCountry}&state=${selectedState}`)
@@ -491,7 +530,7 @@ copyButtons.forEach(button => {
});
});
}
- fetchCountries();
+ // fetchCountries();
let nameID = document.getElementById('name');
let addressID = document.getElementById('address');
let countryID = document.getElementById('country');
diff --git a/.hta_slug/my-leads.php b/.hta_slug/my-leads.php
index e71957e..168feb0 100644
--- a/.hta_slug/my-leads.php
+++ b/.hta_slug/my-leads.php
@@ -60,6 +60,7 @@
require_once('.hta_config/crm_config.php');
require_once('.htac_header.php');
require_once('.htac_nav.php');
+ // deleteCofermation()
$today_date = date("Y-m-d");
$next_day = date("Y-m-d", strtotime("+1 day"));
$yesterday = date("Y-m-d", strtotime("-1 day"));
@@ -111,6 +112,23 @@
echo "Error: " . $e->getMessage();
}
}
+?>
+prepare("DELETE FROM cleads WHERE id IN ($delete_placeholders)");
+ foreach($selectedIds as $key => $id) {
+ $stmt->bindValue($key + 1, $id, PDO::PARAM_INT);
+ }
+ $stmt->execute();
+ } catch(PDOException $e) {
+ echo "Error: " . $e->getMessage();
+ }
+ }
+ }
?>
Lead Management
@@ -150,6 +168,11 @@
+ Delete';
+ }
+ ?>
@@ -157,7 +180,18 @@
- | BV |
+
+
+ ';
+ ?>
Quick Action |
Name |
ID |
@@ -185,33 +219,37 @@
$placeholderString = implode(',', array_fill(0, count($accessArray), '?'));
//first query to get the total number for pagination
- $sql= "SELECT COUNT(*) FROM cleads WHERE state IN (".$_SESSION["states"].") AND business_type LIKE :businessVertical AND (name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm OR email LIKE :searchTerm ) AND time BETWEEN :start_date AND :end_date ";
+ $parts = explode(',', $_SESSION["states"]);
+ $quotedParts = array_map(function($item) { return "'" . $item . "'";}, $parts);
+ $newStr = implode(',', $quotedParts);
+
+ $sql= "SELECT COUNT(*) FROM cleads WHERE state IN ($newStr) OR user LIKE :user AND business_type LIKE :businessVertical AND (name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm OR email LIKE :searchTerm ) AND time BETWEEN :start_date AND :end_date ";
$stmt = $conn->prepare($sql);
$stmt->bindValue(':businessVertical', $businessVertical);
$stmt->bindValue(':searchTerm', "%".$searchTerm."%");
$stmt->bindValue(':start_date', $start_date);
$stmt->bindValue(':end_date', $end_date);
+ $stmt->bindValue(':user', $_SESSION["email"]);
$stmt->execute();
$totalRows = $stmt->fetchColumn();
// second & final query to get the page_view data
- //SELECT * FROM cleads WHERE state IN ('HR', 'TR', 'MP', 'CT', 'LA', 'international');
- $sql = "SELECT * FROM cleads WHERE business_type LIKE :businessVertical AND (name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm OR email LIKE :searchTerm ) AND time BETWEEN :start_date AND :end_date ORDER BY id DESC LIMIT :limit OFFSET :offset";
+
+ $sql = "SELECT * FROM cleads WHERE state IN ($newStr) OR user LIKE :user AND business_type LIKE :businessVertical AND (name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm OR email LIKE :searchTerm ) AND time BETWEEN :start_date AND :end_date ORDER BY id DESC LIMIT :limit OFFSET :offset";
$stmt = $conn->prepare($sql);
$stmt->bindValue(':businessVertical', $businessVertical, PDO::PARAM_STR );
$stmt->bindValue(':searchTerm', "%$searchTerm%"); // PDO::PARAM_STR is the default data type binding so is not needed
$stmt->bindValue(':start_date', $start_date);
$stmt->bindValue(':end_date', $end_date);
+ $stmt->bindValue(':user', $_SESSION["email"]);
$stmt->bindValue(':limit', $resultsPerPage, PDO::PARAM_INT);
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
$stmt->execute();
$leads = $stmt->fetchAll(PDO::FETCH_ASSOC);
$totalResults = count($leads);
$totalPages = ceil($totalRows / $resultsPerPage);
-
if($resultsPerPage <= $totalRows) echo "".$resultsPerPage." Out of ".$totalRows." Leads
";
else echo "".$totalRows." Leads
";
- var_dump($_SESSION["states"]);
// Status Conditional Color
foreach($leads as $lead){
$only_date =isset($lead['time']) ? substr($lead['time'], 0, 10): 'Not Available';
@@ -225,7 +263,6 @@
// if($row['status'] == 'Warm'){$conditional_status = ''.$row['status'].'
';}elseif($row['status'] != 'Warm'){$conditional_status = $row['status'];}
?>
- |
@@ -278,7 +315,7 @@
$execution_time = ($end_time - $start_time);
// Output execution time
- // echo "Page executed in: " . $execution_time . " seconds";
+ echo "Page executed in: " . $execution_time . " seconds";
?>
|
@@ -289,20 +326,15 @@
$getParams = $_GET; unset($getParams['page']); $getParams['page'] = $page-1; $backPage= http_build_query($getParams); unset($getParams['page']);
$getParams['page'] = $page+1; $nextkPage= http_build_query($getParams);
-echo'
-
-
-
-';
+
+// echo $totalPages;
+echo'
+
+
+
+
';
?>
-