This commit is contained in:
Suvodip
2024-05-08 22:07:11 +05:30
parent 72f4f36cb5
commit 1ba7ea57eb
3 changed files with 194 additions and 93 deletions

View File

@@ -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 &nbsp;<span><?php echo $appt['name'] ?> </span>&nbsp; <?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 &nbsp;<?php echo $appt['name'].'&nbsp;&nbsp;'. $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>