-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
548 lines (494 loc) · 27 KB
/
Copy pathindex.html
File metadata and controls
548 lines (494 loc) · 27 KB
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SharePlate | Unified Platform</title>
<meta property="og:title" content="SharePlate">
<meta property="og:description" content="Connecting Surplus Food to Those in Need">
<meta property="og:image" content="https://papia-tech.github.io/SharePlate/SharePlate.jpg">
<meta property="og:url" content="https://papia-tech.github.io/SharePlate/">
<meta property="og:type" content="website">
<link rel="icon" type="image/png" sizes="32x32" href="Favicon.png">
<link rel="manifest" href="manifest.json">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&family=Merriweather:wght@400;700&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" />
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/mobilenet"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header class="header">
<div class="logo">
<i class="fa-solid fa-leaf"></i> Share<div class="plate">Plate</div>
</div>
<nav class="nav-links">
<div id="nav-home" class="nav-item active" onclick="showView('home')">Home</div>
<div id="nav-dashboard" class="nav-item" onclick="showView('dashboard')">Dashboard</div>
<div id="nav-browse" class="nav-item hide-for-restaurant" onclick="showView('browse')">Browse Food</div>
<div id="nav-how" class="nav-item" onclick="showView('how')">How it Works</div>
</nav>
<div class="header-actions">
<button id="theme-toggle" class="theme-toggle" title="Toggle Dark/Light Mode">
<i class="fa-solid fa-moon"></i>
</button>
<button class="profile-btn" onclick="toggleProfileModal(event)">
<i class="fa-solid fa-user-circle"></i>
</button>
<button id="pwaInstallBtn" class="nav-item"
style="display: block; background: #2d7a4d; color: white; border: none; font-weight: 600;">
Install App
</button>
</div>
</header>
<div class="container">
<div id="view-home" class="view-home">
<div class="hero-section">
<div class="hero-content">
<div class="tag"><i class="fa-solid fa-heart"></i> Reducing food waste</div>
<h1 class="hero-title">Connecting Surplus <span class="food">Food</span> to Those in <span
class="need">Need</span></h1>
<p class="hero-sub">A real-time platform that connects restaurants with surplus food to nearby NGOs
to
reduce waste and fight hunger effectively.</p>
<button class="dashboard-btn" onclick="showView('dashboard')">Go to Dashboard <i
class="fa-solid fa-arrow-right-long"></i></button>
</div>
<div class="hero-image"></div>
</div>
<div class="stats-banner">
<div class="stat-item">
<div class="stat-num">50K+</div>
<div class="stat-desc">Meals Served</div>
</div>
<div class="stat-item">
<div class="stat-num">200+</div>
<div class="stat-desc">Restaurants</div>
</div>
<div class="stat-item">
<div class="stat-num">50+</div>
<div class="stat-desc">NGO Partners</div>
</div>
</div>
<div class="why-section">
<div class="section-header">
<h2>Why SharePlate?</h2>
<p>Simple technology solving a complex problem.</p>
</div>
<div class="features-grid">
<div class="feature-card">
<div class="feature-icon"><i class="fa-solid fa-bolt"></i></div>
<h3>Real-Time Listing</h3>
<p>Restaurants can list surplus food in seconds. NGOs get instant notifications based on
location.
</p>
</div>
<div class="feature-card">
<div class="feature-icon"><i class="fa-solid fa-map-location-dot"></i></div>
<h3>Smart Matching</h3>
<p>Our algorithm matches food types and quantities to the nearest available NGO to ensure zero
waste.</p>
</div>
<div class="feature-card">
<div class="feature-icon"><i class="fa-solid fa-chart-pie"></i></div>
<h3>Impact Tracking</h3>
<p>Visualize your contribution to society. Track meals served and CO2 emissions prevented.</p>
</div>
</div>
</div>
<div class="faq-section">
<div class="section-header">
<h2>Frequently Asked Questions</h2>
</div>
<div class="faq-item">
<div class="faq-question">How does SharePlate work? <i class="fa-solid fa-chevron-down"></i></div>
<div class="faq-answer">Restaurants list surplus food, and nearby verified NGOs get notified to
claim
and pick it up within a set time window.</div>
</div>
<div class="faq-item">
<div class="faq-question">Is it free to use? <i class="fa-solid fa-chevron-down"></i></div>
<div class="faq-answer">Yes, SharePlate is completely free for both Restaurants and NGOs. Our
mission is
to reduce waste, not make profits.</div>
</div>
<div class="faq-item">
<div class="faq-question">How is food safety ensured? <i class="fa-solid fa-chevron-down"></i></div>
<div class="faq-answer">We only allow listings of freshly cooked surplus food. All pickups must
happen
within 2-4 hours of listing.</div>
</div>
</div>
<div class="footer">
<p>© 2025 SharePlate. All rights reserved.</p>
<div class="social-links">
<i class="fa-brands fa-square-instagram"></i>
<i class="fa-brands fa-square-facebook"></i>
<i class="fa-brands fa-linkedin"></i>
</div>
</div>
</div>
<div id="view-dashboard" class="hidden">
<div class="dashboard-header">
<div class="dashboard-text">
<h1 id="dashboard-title-text">Dashboard</h1>
<p id="dashboard-subtitle">Manage your food listings and track your impact.</p>
</div>
</div>
<div id="dashboard-restaurant-content">
<div id="stats-restaurant" class="stats-grid">
<div class="stat-card">
<div class="stat-icon"><i class="fa-solid fa-arrow-up-from-bracket"></i></div>
<div class="stat-number">0</div>
<div class="stat-label">Active Listings</div>
</div>
<div class="stat-card">
<div class="stat-icon"><i class="fa-regular fa-bell"></i></div>
<div class="stat-number">0</div>
<div class="stat-label">Pending Claims</div>
</div>
<div class="stat-card">
<div class="stat-icon"><i class="fa-regular fa-circle-check"></i></div>
<div class="stat-number">0</div>
<div class="stat-label">Completed</div>
</div>
<div class="stat-card">
<div class="stat-icon"><i class="fa-regular fa-heart"></i></div>
<div class="stat-number">0</div>
<div class="stat-label">Meals Shared</div>
</div>
</div>
<div class="add-listing-card" onclick="toggleCreateModal(true)">
<i class="fa-solid fa-arrow-up-from-bracket upload"></i>
<h3>Add New Food Listing</h3>
<p>Have surplus food? List it now and connect with NGOs in your area.</p>
<button class="create-btn">
<i class="fa-solid fa-plus"></i> Create Listing
</button>
</div>
<h2 class="section-title">My Active Listings</h2>
<div id="listingContainer">
<p>No listings yet. Use the form above to create one!</p>
</div>
</div>
<div id="dashboard-ngo-content" class="hidden">
<div id="stats-ngo" class="stats-grid">
<div class="stat-card">
<div class="stat-icon"><i class="fa-regular fa-clock"></i></div>
<div class="stat-number">0</div>
<div class="stat-label">Scheduled Pickups</div>
</div>
<div class="stat-card">
<div class="stat-icon"><i class="fa-solid fa-check-double"></i></div>
<div class="stat-number">0</div>
<div class="stat-label">Total Claimed</div>
</div>
<div class="stat-card">
<div class="stat-icon"><i class="fa-solid fa-utensils"></i></div>
<div class="stat-number">0</div>
<div class="stat-label">Meals Distributed</div>
</div>
<div class="stat-card">
<div class="stat-icon"><i class="fa-solid fa-people-group"></i></div>
<div class="stat-number">0</div>
<div class="stat-label">Partner Restaurants</div>
</div>
</div>
<h2 class="section-title">My Claims</h2>
<div id="claimsContainer">
<p>You have no active claims. Browse available food to claim items!</p>
</div>
</div>
</div>
<div id="view-browse" class="hidden">
<div class="browse-hero">
<h1>Browse Available Food</h1>
<p>Find surplus food near you that's available for pickup right now.</p>
</div>
<div class="controls-row">
<div class="search-wrapper">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="text" id="searchInput" class="search-input"
placeholder="Search restaurants or food name..." onkeyup="filterBrowse()">
</div>
<div class="filters">
<button class="filter-btn active" onclick="setFilter('All', this)">All</button>
<button class="filter-btn inactive" onclick="setFilter('Vegetarian', this)">Vegetarian</button>
<button class="filter-btn inactive" onclick="setFilter('Vegan', this)">Vegan</button>
<button class="filter-btn inactive" onclick="setFilter('Non-Veg', this)">Non-Veg</button>
</div>
</div>
<div class="listings-count">Showing <span id="count">0</span> listings</div>
<div class="food-grid" id="foodGrid"></div>
</div>
<div id="view-how" class="hidden">
<div class="hiw-hero">
<h1>Making Food Sharing Simple</h1>
<p>Whether you have food to give or mouths to feed, SharePlate connects you in three simple steps.</p>
</div>
<div class="role-toggle-container" id="hiw-toggle-container">
<div class="toggle-bg">
<button id="hiw-btn-rest" class="hiw-toggle-btn active" onclick="setHiwRole('restaurant')">For
Restaurants</button>
<button id="hiw-btn-ngo" class="hiw-toggle-btn inactive" onclick="setHiwRole('ngo')">For
NGOs</button>
</div>
</div>
<div id="hiw-flow-restaurant" class="steps-grid">
<div class="step-card">
<div class="step-number">1</div>
<div class="step-icon"><i class="fa-solid fa-cloud-arrow-up"></i></div>
<h3>List Surplus Food</h3>
<p>Quickly upload details about available food, including type, quantity, and pickup time window.
</p>
</div>
<div class="step-card">
<div class="step-number">2</div>
<div class="step-icon"><i class="fa-regular fa-bell"></i></div>
<h3>Get Matched</h3>
<p>Nearby verified NGOs receive instant notifications. Once claimed, you'll see the volunteer's
details.</p>
</div>
<div class="step-card">
<div class="step-number">3</div>
<div class="step-icon"><i class="fa-solid fa-hand-holding-heart"></i></div>
<h3>Verified Handover</h3>
<p>The volunteer arrives, verifies the code, and picks up the food. You get impact stats instantly.
</p>
</div>
</div>
<div id="hiw-flow-ngo" class="steps-grid hidden">
<div class="step-card">
<div class="step-number">1</div>
<div class="step-icon"><i class="fa-solid fa-magnifying-glass-location"></i></div>
<h3>Browse & Discover</h3>
<p>Search for available food donations nearby or get real-time alerts for your preferred food types.
</p>
</div>
<div class="step-card">
<div class="step-number">2</div>
<div class="step-icon"><i class="fa-regular fa-calendar-check"></i></div>
<h3>Claim & Schedule</h3>
<p>Claim the listing with one click. We'll generate a secure pickup code for your volunteer.</p>
</div>
<div class="step-card">
<div class="step-number">3</div>
<div class="step-icon"><i class="fa-solid fa-map-location-dot"></i></div>
<h3>Track & Pickup</h3>
<p>Assign a volunteer and track their journey live on our map until the food reaches your center.
</p>
</div>
</div>
<div class="features-section">
<h2>Why Choose SharePlate?</h2>
<div class="feature-grid">
<div class="feature-item">
<i class="fa-solid fa-bolt"></i>
<h4>Real-Time Connections</h4>
<p>Food is perishable. Our system prioritizes speed to ensure food reaches the hungry while it's
fresh.</p>
</div>
<div class="feature-item">
<i class="fa-solid fa-shield-halved"></i>
<h4>Safety First</h4>
<p>We verify all NGOs and Restaurants. Quality checks and time limits ensure food safety
standards.</p>
</div>
<div class="feature-item">
<i class="fa-solid fa-chart-line"></i>
<h4>Measurable Impact</h4>
<p>Track kilograms saved, meals served, and CO2 reduction with our comprehensive dashboard.</p>
</div>
</div>
</div>
</div>
</div>
<div id="profileModal" class="profile-modal-overlay hidden">
<div class="profile-modal">
<div class="modal-header">
<h2>Your Profile</h2>
<button class="modal-close-btn" onclick="toggleProfileModal(event)">×</button>
</div>
<div class="modal-body">
<div class="profile-avatar" id="profileAvatar">
<i class="fa-solid fa-leaf"></i>
<img id="profileImage" src="" class="hidden" alt="Profile Photo">
</div>
<div class="profile-photo-controls">
<label for="profile-photo-upload">
<i class="fa-solid fa-cloud-arrow-up"></i> Change Photo
</label>
<input type="file" id="profile-photo-upload" accept="image/*"
onchange="handleProfilePhotoUpload(this)">
</div>
<div class="profile-info" id="profileDisplayArea">
<p><strong>Name:</strong> <span id="profileName">Loading...</span></p>
<p><strong>Email:</strong> <span id="profileEmail" style="opacity: 0.7;">Loading...</span></p>
<p><strong>Role:</strong> <span id="profileRole">Loading...</span></p>
<button onclick="toggleEditProfile(true)" class="action-btn btn-edit"
style="width: 100%; margin-top: 15px;">
<i class="fa-solid fa-user-pen"></i> Edit Name
</button>
</div>
<div class="profile-info hidden" id="profileEditArea">
<p style="margin-bottom: 10px; font-size: 13px; color: var(--text-muted);">Update your display name:
</p>
<input type="text" id="editProfileName" class="search-input"
style="width: 100%; padding: 10px; margin-bottom: 15px;" placeholder="New Name">
<div style="display: flex; gap: 10px;">
<button onclick="saveProfileName()" class="create-btn"
style="flex: 1; padding: 10px;">Save</button>
<button onclick="toggleEditProfile(false)" class="action-btn btn-cancel"
style="flex: 1; padding: 10px;">Cancel</button>
</div>
</div>
<button onclick="logout()" class="btn-logout-modal">
<i class="fa-solid fa-right-from-bracket"></i> Sign Out
</button>
</div>
</div>
</div>
<div id="browseMapModal" class="profile-modal-overlay hidden">
<div class="profile-modal">
<div class="modal-header">
<h2 id="browseMapTitle">Restaurant Location</h2>
<button class="modal-close-btn" onclick="toggleBrowseMapModal(false)">×</button>
</div>
<div class="modal-body">
<div class="map-container" style="height: 250px; margin-bottom: 15px; border: none;">
<iframe id="browse-restaurant-map"
src="https://maps.google.com/maps?q=1600%20Amphitheatre%20Parkway,%20Mountain%20View,%20CA&t=&z=13&ie=UTF8&iwloc=&output=embed"
allowfullscreen="" loading="lazy"></iframe>
</div>
<p style="text-align: left; padding: 0 10px; font-size: 14px;">
<strong>Address:</strong> <span id="browseMapAddress">Loading...</span>
</p>
</div>
</div>
</div>
<div id="listingModal" class="listing-modal-overlay hidden">
<div class="listing-modal">
<div class="modal-header">
<h2 id="modal-title">Create Food Listing</h2>
<button class="modal-close-btn" onclick="toggleCreateModal(false)">×</button>
</div>
<div class="listing-form">
<div class="form-grid">
<input type="text" id="restaurant-name" placeholder="Restaurant Name" readonly
class="readonly-input">
<div class="phone-input-group">
<select id="country-code-select">
<option value="+91" selected>+91 (India)</option>
<option value="+1">+1 (USA)</option>
<option value="+44">+44 (UK)</option>
<option value="+61">+61 (AUS)</option>
<option value="+49">+49 (GER)</option>
</select>
<input type="text" id="restaurant-phone" placeholder="Phone Number (10 digits)">
</div>
<input type="text" id="dish-name" placeholder="Food Name (e.g., Lunch Buffet)">
<input type="number" id="portions-available" placeholder="Portions Available">
<select id="food-type">
<option value="Vegetarian">Vegetarian</option>
<option value="Non-Veg">Non-Veg</option>
<option value="Vegan">Vegan</option>
</select>
<label class="upload-wrapper" for="food-image-upload">
<i class="fa-solid fa-camera"></i>
<span id="file-name-display">Upload Food Image (Optional)</span>
<input type="file" id="food-image-upload" accept="image/*" onchange="updateFileName(this)">
</label>
<div class="map-wrapper form-group-full">
<div class="map-container">
<iframe id="restaurant-map"
src="https://maps.google.com/maps?q=1600%20Amphitheatre%20Parkway,%20Mountain%20View,%20CA&t=&z=13&ie=UTF8&iwloc=&output=embed"
allowfullscreen="" loading="lazy"></iframe>
</div>
<div class="address-input-container">
<input type="text" id="restaurant-address" placeholder="Restaurant Address">
<button type="button" class="location-btn" onclick="getCurrentLocation()"
title="Use Current Location">
<i class="fa-solid fa-location-crosshairs"></i>
</button>
</div>
<small id="location-status"
style="grid-column: 1 / -1; color: var(--text-muted); margin-top: 5px;">Enter address or use
location button.</small>
</div>
<textarea id="food-description" placeholder="Food Description" class="form-group-full"></textarea>
</div>
<button class="create-btn" style="margin-top: 20px;" onclick="addPost()" id="modal-submit-btn">
<i class="fa-solid fa-plus"></i> Post New Listing
</button>
<button class="action-btn btn-cancel hidden" id="cancel-edit-btn"
style="margin-top: 20px; margin-left:10px;" onclick="cancelEdit()">
Cancel Edit
</button>
</div>
</div>
</div>
<div id="customToast" class="hidden"></div>
<div id="customConfirmModal" class="profile-modal-overlay hidden">
<div class="profile-modal" style="max-width: 350px;">
<div class="modal-body" style="padding: 20px;">
<p id="confirmMessage" style="font-size: 16px; margin-bottom: 25px; font-weight: 500;">Are you sure?</p>
<div style="display: flex; justify-content: space-around; gap: 10px;">
<button class="action-btn btn-edit" id="confirmCancel" style="flex: 1;">Cancel</button>
<button class="action-btn btn-cancel" id="confirmOK" style="flex: 1;">OK</button>
</div>
</div>
</div>
</div>
<div id="ratingModal" class="profile-modal-overlay hidden">
<div class="profile-modal">
<div class="modal-header">
<h2>Rate the Restaurant</h2>
<button class="modal-close-btn" onclick="closeRatingModal()">×</button>
</div>
<div class="modal-body" style="text-align:center">
<p>How was your pickup experience?</p>
<div id="starContainer" class="star-rating">
<i class="fa-solid fa-star" data-value="1"></i>
<i class="fa-solid fa-star" data-value="2"></i>
<i class="fa-solid fa-star" data-value="3"></i>
<i class="fa-solid fa-star" data-value="4"></i>
<i class="fa-solid fa-star" data-value="5"></i>
</div>
<button class="create-btn" onclick="submitRating()">Submit Rating</button>
</div>
</div>
</div>
<script type="module" src="script.js"></script>
<script>
//for PWA install prompt
let deferredPrompt;
const installBtn = document.getElementById('pwaInstallBtn');
// Register Service Worker
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('./sw.js');
});
}
// Handle Install Prompt
window.addEventListener('beforeinstallprompt', (e) => {
e.preventDefault();
deferredPrompt = e;
installBtn.style.display = 'block';
});
installBtn.addEventListener('click', async () => {
if (deferredPrompt) {
deferredPrompt.prompt();
const { outcome } = await deferredPrompt.userChoice;
if (outcome === 'accepted') installBtn.style.display = 'none';
deferredPrompt = null;
}
});
</script>
</body>
</html>