-
Notifications
You must be signed in to change notification settings - Fork 0
/
Manager_Requests.php
132 lines (101 loc) · 3.86 KB
/
Manager_Requests.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
include 'database_connect.php';
if (isset($_POST['OK'])) {
$id_request=$_POST['id_request'];
$query1="update request_appointement
set status='accept' where id=$id_request";
$sql_select_request = "select * from request_appointement where id=$id_request";
$Result_requ = mysqli_query($conn, $sql_select_request);
while ($row_requ = mysqli_fetch_object($Result_requ))
{
$servise=$row_requ->service;
$day=$row_requ->day;
$time=$row_requ->time;
}
$upadate_avalilable= "UPDATE appaintments_available
SET status='Booked' WHERE day='$day' and time='$time' and services='$servise'";
$run=mysqli_query($conn, $query1);
if ($run) {
echo "<script>alert('Request Accepted')</script>";
}
else{
echo "<script>alert('Request Declined')</script>";
}
$run2=mysqli_query($conn, $upadate_avalilable);
}
if (isset($_POST['NO'])) {
$id_request=$_POST['id_request'];
$query="delete from request_appointement where id=$id_request";
$run=mysqli_query($conn,$query);
if ($run) {
echo "<script>alert('Request Deleted')</script>";
}
else{
echo "<script>alert('Request Is Not Deleted')</script>";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Happy Paws Clinic </title>
<link rel ="stylesheet" href="css//Manager_Requests_Style.css">
</head>
<body class="Request_body">
<?php include 'header.php'?>
<!-- The header of the page -->
<!-------------------------------------------------------------->
<!-- Title -->
<h1 class="title">
Appointments Requests
</h1>
<!-- List of Requests -->
<div class="List">
<ul>
<?php
$sele= "SELECT request_appointement.id, request_appointement.pet,request_appointement.user_id,pets.image
FROM request_appointement
INNER JOIN pets ON request_appointement.pet = pets.name and request_appointement.user_id=pets.user_id
where request_appointement.status='waiting' ;";
// $sql_select_request = "select * from request_appointement where status='waiting'";
$Result_request = mysqli_query($conn, $sele);
$count=1;
while ($row_request = mysqli_fetch_object($Result_request))
{
$name_pet=$row_request->pet;
$id_=$row_request->id;
$id_user=$row_request->user_id;
$image=$row_request->image;
echo '
<form action="#" method="POST">
<div >
<li id="liDog" style=" background-size: 150px; margin-top: 60px;background-image: url(images//'.$image.');"> '.$count.'-Appointment Request
<div class="icon">
<a href="PetProfileRequest.php?id_user='.$id_user.'&pet='.$name_pet.'">
<img src="image/paw.png" class="icons" width="30" height="30" alt="view profile"></a>
<a href="RequestView.php?id_request='.$id_.'">
<img src="image/visit.png" class="icons" width="30" height="30" alt="view request"></a>
<a >
<button type = "submit" name="OK" class = "Yes_No">
<input type="text" name="id_request" value="'.$id_.'" hidden="hidden">
<img src="image/accept.png" class="icons" width="30" height="30" alt="accept Request"></button>
</a>
<a >
<button type = "submit" name="NO" class = "Yes_No">
<input type="text" name="id_request" value="'.$id_.'" hidden="hidden">
<img src="image/decline.png" class="icons" width="30" height="30" alt="decline request">
</button>
</a>
</div>
</li>
</div>
</form>
';
$count=$count+1;
}
?>
</ul>
</div>
</body>
</html>