c
This commit is contained in:
@@ -51,7 +51,8 @@
|
||||
foreach($rows as $row){
|
||||
$nameParts = explode(" ", $row['name']);
|
||||
$firstInitial = substr($nameParts[0], 0, 1);
|
||||
$lastInitial = substr($nameParts[count($nameParts) - 1], 0, 1);
|
||||
$lastInitial = substr($nameParts[1], 0, 1);
|
||||
// $lastInitial = substr($nameParts[count($nameParts) - 1], 0, 1);
|
||||
$name_letter = $firstInitial.$lastInitial;
|
||||
if($row['status'] == 'New'){$conditional_background_color = 'background-color: #FFD9D9; border: 1px solid #FB5555; border-radius: 5px; color: #FB5555;';}
|
||||
elseif($row['status'] == 'Contacted'){$conditional_background_color = 'background-color: #D4FFFF; border: 1px solid #2C9C9C; border-radius: 5px; color: #2C9C9C;';}
|
||||
@@ -59,8 +60,8 @@
|
||||
elseif($row['status'] == 'Converted'){$conditional_background_color = 'background-color: #D4FDE7; border: 1px solid #40916C; border-radius: 5px; color: #40916C;';}
|
||||
elseif($row['status'] == 'Warm'){$conditional_background_color = 'background-color: #FFD9D9; border: 1px solid #FB5555; border-radius: 5px; color: #FB5555;';}
|
||||
?>
|
||||
<div class="responsive-flex p-6 space-x-4">
|
||||
<form method="post">
|
||||
<div class="grid grid-cols-1 lg:grid-cols-3 p-6 space-x-4">
|
||||
<form method="post" class="w-full lg:col-span-2">
|
||||
<div class="flex flex-col">
|
||||
<div class="flex flex-col bg-[#F6F6F6] rounded-xl">
|
||||
<div class="grid grid-cols-3 p-3 border-b-2 border-[#D9D9D9] space-x-6" style="text-align: left;">
|
||||
@@ -90,20 +91,42 @@
|
||||
<p style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;"><?php echo $row['formname']; ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-3 p-3 border-b-2 border-[#D9D9D9] space-x-6" style="text-align: left;">
|
||||
<div>
|
||||
<p><b>Country</b></p>
|
||||
<select class="w-full" name="" id="country" onchange="fetchStates()" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;">
|
||||
<option selected value="<?php echo $row['country']; ?>"><?php echo $row['country']; ?></option>
|
||||
</select>
|
||||
<input type="hidden" name="country" id="getCountryName">
|
||||
</div>
|
||||
<?php
|
||||
$countryapiUrl = 'https://api.siliconpin.com/v3/list/country/';
|
||||
$countryhandle = fopen($countryapiUrl, 'rb');
|
||||
if ($countryhandle === false) {
|
||||
echo 'Unable to open URL';
|
||||
} else {
|
||||
$jsonResponse = stream_get_contents($countryhandle);
|
||||
fclose($countryhandle);
|
||||
$countrys = json_decode($jsonResponse, true);
|
||||
if ($countrys === null) {
|
||||
echo 'Error decoding JSON from API';
|
||||
} else {
|
||||
$lead_country = $conn->prepare("SELECT `country` FROM `cleads` WHERE `id` = :id");
|
||||
$lead_country->bindParam(':id', $_GET["id"]);
|
||||
$lead_country->execute();
|
||||
$lcountry = $lead_country->fetch(PDO::FETCH_COLUMN);
|
||||
$country = json_decode($lcountry);
|
||||
echo '<div>
|
||||
<p><b>Country</b></p>
|
||||
<select onchange="fetchStates();" id="country" name="country" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px; width: 100%;"><option value="0">-Select-</option>';
|
||||
foreach ($countrys as $countryItem) {
|
||||
$isSelected = $countryItem["iso2"] === $lcountry;
|
||||
echo '<option id="country" '.($isSelected ? 'selected' : '').' value="'.$countryItem["iso2"].'">'.$countryItem["name"].'</option>';
|
||||
}
|
||||
echo '</select>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<p><b>State</b></p>
|
||||
<select class="w-full" name="" id="state" onchange="fetchCities()" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;">
|
||||
<select class="w-full" name="state" id="state" onchange="fetchCities()" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;">
|
||||
<option selected value="<?php echo $row['state']; ?>"><?php echo $row['state']; ?></option>
|
||||
</select>
|
||||
<input type="hidden" name="state" id="getStateName">
|
||||
</div>
|
||||
<div>
|
||||
<p><b>City</b></p>
|
||||
@@ -168,6 +191,37 @@
|
||||
<p><b>Follow Update</b></p>
|
||||
<input class="w-full" type="date" name="date" id="date" value="<?php echo $row['date']; ?>" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px;" />
|
||||
</div>
|
||||
<div>
|
||||
<p><b>Assign to</b></p>
|
||||
<select id="user" name="user" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px; width: 100%;">
|
||||
<option value="0">-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 email FROM users");
|
||||
$stmt->execute();
|
||||
$usersRows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
$stmtCleads = $conn->prepare("SELECT user FROM cleads WHERE id = :id");
|
||||
$stmtCleads->bindParam(':id', $_GET['id']);
|
||||
$stmtCleads->execute();
|
||||
$usersCleads = $stmtCleads->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
$selectedEmails = [];
|
||||
foreach($usersCleads as $userEmail){
|
||||
$selectedEmails[] = $userEmail['user'];
|
||||
}
|
||||
foreach($usersRows as $userData){
|
||||
$isUserSelected = in_array($userData['email'], $selectedEmails) ? 'selected' : '';
|
||||
echo '<option value="'.$userData['email'].'" '.$isUserSelected.'>'.$userData['email'].'</option>';
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
};
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div style="padding: 10px; ">
|
||||
<input type="submit" id="update_data" name="update_data" value="Update" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); color: #fff; border-radius: 6px; padding: 10px 30px 10px 30px; float: right; cursor: pointer;" />
|
||||
@@ -175,10 +229,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="flex flex-col div-custom-margin" style="" >
|
||||
<div class="flex flex-col div-custom-margin" style="width: 100%;" >
|
||||
<div class="bg-[#F6F6F6] rounded-xl p-3">
|
||||
<div class="flex flex-row place-content-between" style="border-bottom: 2px solid #7E8299; border-style: dashed; padding-bottom: 3px;">
|
||||
<p style="font-size: 25px; font-weight: bold;">Comments: <span><?php echo$totalRecords; ?></span></p>
|
||||
<p style="font-size: 25px; font-weight: bold;">Comments: <span><?php echo $totalRecords; ?></span></p>
|
||||
<button id="toggleButton" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); color: #fff; border-radius: 6px; padding: 6px 20px 6px 20px;">Add Comment</button>
|
||||
</div>
|
||||
<div>
|
||||
@@ -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 = '<option value="">Select Country</option>';
|
||||
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 = '<option value="">Select Country</option>';
|
||||
// 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');
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(isset($_POST['delete_records']) && isset($_SESSION['user_type']) && $_SESSION['user_type'] == 'admin') {
|
||||
if(isset($_POST['selected_records']) && !empty($_POST['selected_records'])) {
|
||||
$selectedIds = $_POST['selected_records'];
|
||||
try {
|
||||
$delete_placeholders = rtrim(str_repeat('?,', count($selectedIds)), ',');
|
||||
$stmt = $conn->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();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<p class="text-[28px] font-bold p-4">Lead Management</p>
|
||||
<div id="page-body" class="flex flex-row place-content-between px-4">
|
||||
@@ -150,6 +168,11 @@
|
||||
<button class="rounded-r-lg text-[#fff] p-1.5" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%);" type="submit"><i class="fa fa-search"></i></button>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
if(isset($_SESSION['user_type']) && $_SESSION['user_type'] == 'admin'){
|
||||
echo '<p onclick="deleteCofermation();" class="rounded-lg h-fit py-2 px-6 text-[#fff] text-center" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); cursor: pointer;">Delete</p>';
|
||||
}
|
||||
?>
|
||||
<button onclick="toggleDisplay();" class="rounded-lg p-2 h-fit text-[#fff]" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center;">Add Leads</button>
|
||||
</div>
|
||||
|
||||
@@ -157,7 +180,18 @@
|
||||
<table class="bg-[#fff] text-[#3F4254] rounded-lg font-bold" style="width: 100%;" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center border-b-2 p-3">BV</th>
|
||||
<?php
|
||||
if(isset($_SESSION['user_type']) && $_SESSION['user_type'] == 'admin')
|
||||
echo ' <th class="text-center border-b-2 p-3">
|
||||
<div class="delete-confirm" id="delete-button" style="display: none;">
|
||||
<p>Are you sure you want to delete this lead?</p>
|
||||
<div class="flex flex-row space-x-4">
|
||||
<p onclick="deleteCofermation();" class="rounded-lg p-2 text-[#443780] mr-4" style="border: 2px solid #443780; cursor: pointer;">No</p>
|
||||
<button class="rounded-lg p-3 text-[#fff]" type="submit" name="delete_records" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%);">Yes</button>
|
||||
</div>
|
||||
</div>
|
||||
</th>';
|
||||
?>
|
||||
<th class="text-center border-b-2 p-3">Quick Action</th>
|
||||
<th class="text-center border-b-2 p-3">Name</th>
|
||||
<th class="text-center border-b-2 p-3">ID</th>
|
||||
@@ -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 "<p class='px-4'>".$resultsPerPage." Out of ".$totalRows." Leads </p>";
|
||||
else echo "<p class='px-4'>".$totalRows." Leads </p>";
|
||||
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 = '<div class="flex flex-row"><p>'.$row['status'].'</p><select class="focus: outline-none " style="'.$conditional_background_color.' border: none;"><option>Option 1</option><option>Option 2</option></select></div>';}elseif($row['status'] != 'Warm'){$conditional_status = $row['status'];}
|
||||
?>
|
||||
<tr>
|
||||
<td class="border-y-2 p-2"><?php echo $lead['business_type'] ?></td>
|
||||
<td class="border-y-2 p-2">
|
||||
<div class="flex flex-row justify-center place-items-center">
|
||||
<div class="xzmdropdown-wrapper">
|
||||
@@ -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";
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -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'
|
||||
<div class="bg-white p-4 flex items-center flex-wrap">
|
||||
<nav aria-label="Page navigation">
|
||||
<ul class="flex flex-row ">
|
||||
<li><button class="px-4 py-2 text-[#443780] border border-[#443780] rounded-l-lg" > '; if($page>1) echo '<a href="?',$backPage,'"><','</a>'; echo ' </button></li>
|
||||
<li><button class="px-4 py-2 text-white border-y border-[#443780]" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%);"> '.$page.' </button></li>
|
||||
<li><button class="px-4 py-2 text-[#443780] border border-[#443780] rounded-r-lg" > '; if($page<$totalPages) echo '<a href="?',$nextkPage,'">>','</a>'; echo ' </button></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
';
|
||||
|
||||
// echo $totalPages;
|
||||
echo'<div class="flex flex-row justify-end">
|
||||
<button class="px-4 py-2 text-[#443780] border border-[#443780] rounded-l-lg" > '; if($page>1) echo '<a href="?',$backPage,'"><','</a>'; echo ' </button>
|
||||
<button class="px-4 py-2 text-white border-y border-[#443780]" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%);"> '.$page.' </button>
|
||||
<button class="px-4 py-2 text-[#443780] border border-[#443780] rounded-r-lg" > '; if($page<$totalPages) echo '<a href="?',$nextkPage,'">>','</a>'; echo ' </button>
|
||||
</div>';
|
||||
|
||||
?>
|
||||
|
||||
<!-- New Lead Form Section -->
|
||||
<div id="add-lead-form" class="add-lead-form">
|
||||
<div class="flex flex-row place-content-between p-2" style="border-bottom: 2px solid #464E5F; border-style: dashed;">
|
||||
@@ -474,7 +506,17 @@ echo'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function deleteCofermation(){
|
||||
let deleteButton = document.getElementById('delete-button');
|
||||
let leadID = document.getElementById('<?php if(isset($lead['id'])) echo $lead['id']; ?>').value; //getting Err: here
|
||||
if(leadID != null){
|
||||
if(deleteButton.style.display === 'flex'){
|
||||
deleteButton.style.display = 'none';
|
||||
}else{
|
||||
deleteButton.style.display = 'flex'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@@ -505,4 +547,15 @@ echo'
|
||||
}
|
||||
}
|
||||
|
||||
.delete-confirm{
|
||||
position: fixed;
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
background-color: #E6E5F4;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
padding: 40px 50px 40px 50px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
@@ -28,20 +28,6 @@
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['status_id']) && $_POST['status_id']){
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("UPDATE appointment SET view_status = 1 WHERE id = :status_id AND email = :email");
|
||||
$stmt->bindParam(':status_id', $_POST['status_id']);
|
||||
$stmt->bindParam(':email', $_SESSION['email']);
|
||||
$stmt->execute();
|
||||
$saved_message = "Appointment updated successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
@@ -52,19 +38,26 @@
|
||||
$stmt->execute();
|
||||
$appt_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
foreach($appt_data as $appt){
|
||||
$leadID = json_decode($appt['leadid']);
|
||||
if($appt['view_status'] == 0){
|
||||
$notification_bg = 'background: #F5F4FFE8;';
|
||||
$notification_batch = '<div style="width: 8px; height: 8px; background-color: red; border-radius: 50%;"></div>';
|
||||
$clickButton = '';
|
||||
}elseif($appt['view_status'] == 1){
|
||||
$notification_bg = 'background: #fff;';
|
||||
$notification_batch = '<div style="width: 8px; height: 8px; background-color: #fff; border-radius: 50%;"></div>';
|
||||
$clickButton = 'disabled';
|
||||
}
|
||||
?> <div class="p-2">
|
||||
<form method="post">
|
||||
<button type="submit" class="w-full text-left">
|
||||
<button type="submit" class="w-full text-left" <?php echo $clickButton; ?>>
|
||||
<div class="flex flex-col w-full p-2 rounded-md shadow" style="border: 3px solid #F5F4FFE8; <?php echo $notification_bg; ?>">
|
||||
<div class="flex flex-row place-items-center">🕑 Reminders for <span><?php echo $appt['name'] ?> </span> <?php echo $notification_batch; ?></div>
|
||||
<p><?php echo $appt['appt_date']; ?></p>
|
||||
<div class="flex flex-row place-items-center justify-between">
|
||||
<div class="flex flex-row place-items-center">🕑 Reminders for <?php echo $appt['name'].' '. $notification_batch; ?></div>
|
||||
|
||||
<div><?php echo $appt['appt_date']; ?></div>
|
||||
</div>
|
||||
<p><?php echo $appt['date']; ?></p>
|
||||
<input type="hidden" name="status_id" value="<?php echo $appt['id'] ?>" />
|
||||
</div>
|
||||
</button>
|
||||
@@ -77,5 +70,21 @@
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
};
|
||||
|
||||
|
||||
if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['status_id']) && $_POST['status_id']){
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("UPDATE appointment SET view_status = 1 WHERE id = :status_id AND email = :email");
|
||||
$stmt->bindParam(':status_id', $_POST['status_id']);
|
||||
$stmt->bindParam(':email', $_SESSION['email']);
|
||||
$stmt->execute();
|
||||
// $saved_message = "Appointment upd ated successfully";
|
||||
echo '<script>window.location.href="/edit-lead/?id='.$leadID.'" </script>';
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
</div>
|
||||
Reference in New Issue
Block a user