-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathngo_dashboard.php
240 lines (216 loc) · 8.85 KB
/
ngo_dashboard.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<?php
session_start();
if (!isset($_SESSION['user_id']) || $_SESSION['org_type'] !== 'ngo') {
header("Location: index.html");
exit;
}
require 'db_connection.php';
$sql = "SELECT * FROM food_donations WHERE status = 'pending'";
$result = $conn->query($sql);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NGO Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="icon" href="Screenshot 2024-11-23 154406.png" type="image/x-icon" />
<link rel="stylesheet" href="css/style.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<style>
/* Add background image to the body */
body {
background-image: url('file.jpg');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
color: white;
}
/* Optional: Add a background overlay with blur */
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
filter: blur(5px);
z-index: -1;
}
/* Button Styling */
.claim-btn {
background-color: #007bff;
color: white;
padding: 10px 20px;
font-size: 16px;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.claim-btn:hover {
background-color: #0056b3;
}
/* Table Styling */
.table th, .table td {
text-align: center;
color: white;
}
.table-striped tbody tr:nth-child(odd) {
background-color: rgba(0, 0, 0, 0.5);
}
/* Navbar Styling */
.navbar {
background-color: rgba(0, 0, 0, 0.7);
}
.navbar-brand, .nav-link {
color: white !important;
}
.navbar-brand:hover, .nav-link:hover {
color: #ff5722 !important;
}
/* Footer Styling */
footer {
background-color: rgba(0, 0, 0, 0.7);
color: white;
padding: 20px 0;
margin-top: 50px;
}
footer .social a {
margin: 0 10px;
color: white;
font-size: 24px;
text-decoration: none;
}
footer .social a:hover {
color: #ff5722;
}
</style>
</head>
<body>
<!-- Background overlay -->
<div class="overlay"></div>
<header class="header">
<div class="container">
<nav class="navbar navbar-expand-lg navbar-dark">
<a class="navbar-brand d-flex align-items-center" href="#home">
<img src="img/pplogo.png" alt="PlatePromise Logo" style="width: 40px; height: 40px; margin-right: 10px;">
PlatePromise
</a>
<a class="navbar-brand" href="#home"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="ngo_dashboard.php">Dashboard</a>
</li>
<li class="nav-item">
<a class="nav-link" href="donations.php">Manage Donations</a>
</li>
<li class="nav-item">
<a class="nav-link" href="reports.php">Reports</a>
</li>
<li class="nav-item">
<a class="nav-link" href="logout.php">Logout</a>
</li>
</ul>
</div>
</nav>
</div>
</header>
<!-- Main Content -->
<div class="container mt-5">
<h1 class="text-center mb-4">Available Donations</h1>
<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Restaurant ID</th>
<th>Restaurant Name</th>
<th>Food Name</th>
<th>Quantity</th>
<th>Description</th>
<th>Location</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php while ($row = $result->fetch_assoc()) { ?>
<tr>
<td><?php echo htmlspecialchars($row['restaurant_id']); ?></td>
<td><?php echo htmlspecialchars($row['restaurant_name']); ?></td>
<td><?php echo htmlspecialchars($row['food_name']); ?></td>
<td><?php echo htmlspecialchars($row['quantity']); ?></td>
<td><?php echo htmlspecialchars($row['description']); ?></td>
<td><?php echo htmlspecialchars($row['location']); ?></td>
<td>
<button class="claim-btn" data-id="<?php echo $row['id']; ?>">Claim</button>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<!-- Footer -->
<footer>
<div class="container">
<div class="row">
<div class="col-lg-4">
<h4>PlatePromise NGO</h4>
<p>Address: 3, Near IT Park, Mahatma Gandhi Road, Bengaluru 560001</p>
<p>Contact No: <a href="tel:+91 986593359">+91 986593359</a></p>
<p>Email: <a href="mailto:[email protected]">[email protected]</a></p>
</div>
<div class="col-lg-4">
<h4>Important Links</h4>
<ul>
<li><a href="ngo_dashboard.php">Dashboard</a></li>
<li><a href="donations.php">Manage Donations</a></li>
<li><a href="reports.php">Reports</a></li>
<li><a href="contact.php">Contact Us</a></li>
</ul>
</div>
<div class="col-lg-4">
<h4>Follow Us</h4>
<div class="social">
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-instagram"></i></a>
<a href="#"><i class="fa fa-twitter"></i></a>
</div>
</div>
</div>
</div>
</footer>
<!-- JavaScript to handle Claim button -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
// When a claim button is clicked
$('.claim-btn').click(function() {
var donationId = $(this).data('id'); // Get the donation ID from the button's data-id attribute
// Send an AJAX request to update the donation status
$.ajax({
url: 'update_donation_status.php', // The PHP file to handle the request
method: 'POST',
data: { id: donationId }, // Send the donation ID to the PHP file
success: function(response) {
// If the request is successful, update the table or show a success message
if (response == 'success') {
alert('Donation claimed successfully!');
location.reload(); // Reload the page to reflect the updated status
} else {
alert('Error claiming donation');
}
}
});
});
});
</script>
</body>
</html>