c
This commit is contained in:
@@ -2,28 +2,74 @@
|
||||
require_once('.hta_config/crm_config.php');
|
||||
require_once('.htac_header.php');
|
||||
require_once('.htac_nav.php');
|
||||
?>
|
||||
<div>
|
||||
<div class="flex flex-row place-content-between">
|
||||
<p>Notifications</p>
|
||||
<button>Mark all as read</button>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['mark_all_read']) && $_POST['mark_all_read']){
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("SELECT * FROM appointment");
|
||||
// $stmt->bindParam(':leadid', $_GET['id']);
|
||||
$stmt = $conn->prepare("UPDATE appointment SET view_status = 1 WHERE view_status = 0 AND email = :email");
|
||||
$stmt->bindParam(':email', $_SESSION['email']);
|
||||
$stmt->execute();
|
||||
$saved_message = "Appointment updated successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
<form method="post">
|
||||
<div>
|
||||
<div class="flex flex-row place-content-between py-2" style="border-bottom: 2px solid #A0A2AB; border-style: dashed;">
|
||||
<p class="text-[25px] font-bold">Notifications</p>
|
||||
<div>
|
||||
<a href="/notifications?tab=past" class="text-[#6F6BFF]">Past Notifications</a> |
|
||||
<input name="mark_all_read" type="submit" value="Mark all as read" class="text-[#6F6BFF] pr-6 cursor-pointer " />
|
||||
</div>
|
||||
</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);
|
||||
$oneWeekAgo = date('Y-m-d', strtotime('-1 week'));
|
||||
$stmt = $conn->prepare("SELECT * FROM appointment WHERE email = :email AND appt_date > :appoinment_expiry ORDER BY appt_date ASC");
|
||||
$stmt->bindParam(':email', $_SESSION['email']);
|
||||
$stmt->bindParam(':appoinment_expiry', $oneWeekAgo);
|
||||
$stmt->execute();
|
||||
$appt_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
foreach($appt_data as $appt){
|
||||
?>
|
||||
<div class="flex flex-row">
|
||||
<div class="flex flex-col">
|
||||
<p>Reminders for <span><?php echo $appt['name'] ?></span></p>
|
||||
<p><?php echo date("Y/m/d"); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
if($appt['view_status'] == 0){
|
||||
$notification_bg = 'background: #F5F4FFE8;';
|
||||
$notification_batch = '<div style="width: 8px; height: 8px; background-color: red; border-radius: 50%;"></div>';
|
||||
}elseif($appt['view_status'] == 1){
|
||||
$notification_bg = 'background: #fff;';
|
||||
$notification_batch = '<div style="width: 8px; height: 8px; background-color: #fff; border-radius: 50%;"></div>';
|
||||
}
|
||||
?> <div class="p-2">
|
||||
<form method="post">
|
||||
<button type="submit" class="w-full text-left">
|
||||
<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>
|
||||
<input type="hidden" name="status_id" value="<?php echo $appt['id'] ?>" />
|
||||
</div>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user