c
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("UPDATE cleads SET name = :name, email = :email, phone = :phone, date = :date, status = :status, user = :user, country = :country, state= :state, city = :city, address = :address, profession = :profession, coupon_code = :coupon_code, gender = :gender, warm_status = :warm_status WHERE id = :id");
|
||||
$stmt = $conn->prepare("UPDATE cleads SET name = :name, email = :email, phone = :phone, date = :date, status = :status, user = :user, country = :country, state= :state, city = :city, address = :address, profession = :profession, coupon_code = :coupon_code, gender = :gender, warm_status = :warm_status, business_type = :business_type WHERE id = :id");
|
||||
$stmt->bindParam(':name', $_POST['name']);
|
||||
$stmt->bindParam(':email', $_POST['email']);
|
||||
$stmt->bindParam(':phone', $_POST['phone']);
|
||||
@@ -32,6 +32,7 @@
|
||||
$stmt->bindParam(':coupon_code', $_POST['coupon_code']);
|
||||
$stmt->bindParam(':gender', $_POST['gender']);
|
||||
$stmt->bindParam(':warm_status', $_POST['warm_status']);
|
||||
$stmt->bindParam(':business_type', $_POST['business_type']);
|
||||
$stmt->bindParam(':id', $_GET['id']);
|
||||
$stmt->execute();
|
||||
|
||||
@@ -190,11 +191,35 @@
|
||||
<input class="w-full" type="text" name="profession" id="profession" value="<?php echo $row['profession']; ?>" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-2 p-3 border-b-2 border-[#D9D9D9] space-x-6" style="text-align: left;">
|
||||
<div class="grid grid-cols-3 p-3 border-b-2 border-[#D9D9D9] space-x-6" style="text-align: left;">
|
||||
<div>
|
||||
<p><b>Origin</b></p>
|
||||
<p style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;"><?php echo $row['origin'] ?: "No origin"; ?></p>
|
||||
</div>
|
||||
<div>
|
||||
<p><b>Verticals</b></p>
|
||||
<select class="w-full" name="business_type" id="business_type" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;">
|
||||
<option value="">-Select-</option>
|
||||
<?php
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("SELECT * FROM business_verticals");
|
||||
$stmt->execute();
|
||||
$businessRows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
foreach($businessRows as $businessVerticals) {
|
||||
// Check if the current business vertical is the one selected
|
||||
$isBVSelected = ($row['business_type'] == $businessVerticals['bv']) ? 'selected' : '';
|
||||
echo '<option value="'.$businessVerticals['bv'].'" '.$isBVSelected.'>'.$businessVerticals['bv'].'</option>';
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<p><b>Lead Status</b></p>
|
||||
<div class="flex flex-row">
|
||||
|
||||
@@ -101,9 +101,10 @@
|
||||
$state = $_POST['state'];
|
||||
$city = $_POST['city'];
|
||||
$address = $_POST['address'];
|
||||
$business_type = $_POST['business_type'];
|
||||
$status = 'New';
|
||||
try {
|
||||
$stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, origin, status, gender, profession, country, state, city, address ) VALUES (:name, :email, :phone, :formname, :note, :origin, :status, :gender, :profession, :country, :state, :city, :address)");
|
||||
$stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, origin, status, gender, profession, country, state, city, address, business_type ) VALUES (:name, :email, :phone, :formname, :note, :origin, :status, :gender, :profession, :country, :state, :city, :address, :business_type)");
|
||||
$stmt->bindParam(':name', $name);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':phone', $phone);
|
||||
@@ -117,6 +118,7 @@
|
||||
$stmt->bindParam(':state', $state);
|
||||
$stmt->bindParam(':city', $city);
|
||||
$stmt->bindParam(':address', $address);
|
||||
$stmt->bindParam(':business_type', $business_type);
|
||||
$stmt->execute();
|
||||
echo "Record added successfully";
|
||||
} catch(PDOException $e) {
|
||||
@@ -220,9 +222,13 @@
|
||||
try {
|
||||
$searchTerm =isset($_GET['search']) ? $_GET['search'] : "%";
|
||||
$businessVertical =isset($_GET['bv']) ? $_GET['bv'] : "%";
|
||||
$dateForFilter = date('Y-m-d');
|
||||
|
||||
// Add one day to the current date
|
||||
$new_date = date('Y-m-d', strtotime($dateForFilter . ' +1 day'));
|
||||
// echo $businessVertical;
|
||||
$start_date = isset($_GET['start_date']) ? $_GET['start_date'] : '2014-05-05';
|
||||
$end_date = isset($_GET['end_date']) ? $_GET['end_date'] : date('Y-m-d');
|
||||
$end_date = isset($_GET['end_date']) ? $_GET['end_date'] : $new_date;
|
||||
$start_time = microtime(true);
|
||||
$resultsPerPage = 200;
|
||||
$page =isset($_GET['page']) ? $_GET['page'] : 1;
|
||||
@@ -245,8 +251,8 @@
|
||||
|
||||
$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";
|
||||
$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(':businessVertical', "%".$businessVertical."%");
|
||||
$stmt->bindValue(':searchTerm', "%$searchTerm%");
|
||||
$stmt->bindValue(':start_date', $start_date);
|
||||
$stmt->bindValue(':end_date', $end_date);
|
||||
$stmt->bindValue(':limit', $resultsPerPage, PDO::PARAM_INT);
|
||||
@@ -380,7 +386,7 @@ echo'<div class="flex flex-row justify-between">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2">
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="origin">Origin:</label>
|
||||
<select class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="origin" id="origin" >
|
||||
<select class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" name="origin" id="origin" >
|
||||
<option value="Facebook Ads">Facebook Ads</option>
|
||||
<option value="Google Ads">Google Ads</option>
|
||||
<option value="Linkedin Ads">Linkedin Ads</option>
|
||||
@@ -394,6 +400,34 @@ echo'<div class="flex flex-row justify-between">
|
||||
<option value="Others">Others</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="business_type">Verticals:</label>
|
||||
<select id="business_type" name="business_type" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px; width: 100%;">
|
||||
<option value="0">-Select-</option>
|
||||
<?php
|
||||
try {
|
||||
// Database connection
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
// Prepare and execute query
|
||||
$stmt = $conn->prepare("SELECT * FROM business_verticals");
|
||||
$stmt->execute();
|
||||
$businessRows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// Assuming this array contains the selected business verticals
|
||||
$selectedBusinessVerticals = [$businessVerticals['bv']];
|
||||
|
||||
// Loop through the business verticals
|
||||
foreach($businessRows as $businessVerticals) {
|
||||
echo '<option value="'.$businessVerticals['bv'].'">'.$businessVerticals['bv'].'</option>';
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="note">Note:</label>
|
||||
|
||||
@@ -221,9 +221,13 @@
|
||||
try {
|
||||
$searchTerm =isset($_GET['search']) ? $_GET['search'] : "%";
|
||||
$businessVertical =isset($_GET['bv']) ? $_GET['bv'] : "%";
|
||||
$dateForFilter = date('Y-m-d');
|
||||
|
||||
// Add one day to the current date
|
||||
$new_date = date('Y-m-d', strtotime($dateForFilter . ' +1 day'));
|
||||
// echo $businessVertical;
|
||||
$start_date = isset($_GET['start_date']) ? $_GET['start_date'] : '2014-05-05';
|
||||
$end_date = isset($_GET['end_date']) ? $_GET['end_date'] : date('Y-m-d');
|
||||
$end_date = isset($_GET['end_date']) ? $_GET['end_date'] : $new_date;
|
||||
$start_time = microtime(true);
|
||||
$resultsPerPage = 200;
|
||||
$page =isset($_GET['page']) ? $_GET['page'] : 1;
|
||||
@@ -233,12 +237,14 @@
|
||||
$placeholderString = implode(',', array_fill(0, count($accessArray), '?'));
|
||||
|
||||
//first query to get the total number for pagination
|
||||
$sql= "SELECT COUNT(*) FROM cleads WHERE (name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm OR email LIKE :searchTerm ) AND time BETWEEN :start_date AND :end_date ";
|
||||
|
||||
// WHERE (name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm OR email LIKE :searchTerm ) AND time BETWEEN :start_date AND :end_date
|
||||
$sql= "SELECT COUNT(*) FROM cleads ";
|
||||
$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(':searchTerm', "%".$searchTerm."%");
|
||||
// $stmt->bindValue(':start_date', $start_date);
|
||||
// $stmt->bindValue(':end_date', $end_date);
|
||||
$stmt->execute();
|
||||
$totalRows = $stmt->fetchColumn();
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
<nav class="main-menu">
|
||||
<ul style="padding-top: 100px;">
|
||||
<li>
|
||||
<a href="/leads_all">
|
||||
<a href="/leads">
|
||||
<i class="fa fa-2x"><img src="/assets/all-lead.png" alt="" /></i>
|
||||
<span class="nav-text" style="text-transform: capitalize;">All Leads</span>
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user