feat: initial foundation for collaborative canteen ordering system in vanilla PHP

This commit is contained in:
2026-08-27 17:29:13 +07:00
commit 5effce30cb
52 changed files with 4915 additions and 0 deletions
+76
View File
@@ -0,0 +1,76 @@
<div class="page-header">
<div>
<h1 class="page-title">Active Food &amp; Canteen Sessions</h1>
<p class="page-subtitle">Join an active lunch session or host your own food order for the team</p>
</div>
<div>
<a href="/sessions/create" class="btn btn-primary"> Start a Food Session</a>
</div>
</div>
<?php if (empty($activeSessions)): ?>
<div class="card" style="text-align: center; padding: 4rem 2rem;">
<div style="font-size: 3rem; margin-bottom: 0.75rem;">🍱</div>
<h2 style="font-size: 1.25rem; font-weight: 700; color: var(--text-main);">No Active Food Sessions Right Now</h2>
<p style="color: var(--text-muted); margin-top: 0.5rem; max-width: 400px; margin-left: auto; margin-right: auto;">
Anyone can start a session! Click below to post today's canteen menu or coordinate a team food run.
</p>
<div style="margin-top: 1.5rem;">
<a href="/sessions/create" class="btn btn-primary"> Start New Food Session</a>
</div>
</div>
<?php else: ?>
<div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 1.5rem; margin-bottom: 2.5rem;">
<?php foreach ($activeSessions as $session): ?>
<div class="card" style="display: flex; flex-direction: column; height: 100%; border: 1px solid var(--border-color); transition: transform 0.15s ease, box-shadow 0.15s ease;">
<div class="card-header" style="background: white; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: flex-start;">
<div>
<span class="badge badge-<?= match($session['status']) {
'open' => 'completed',
'closed' => 'warning',
'arrived' => 'processing',
default => 'neutral'
} ?>" style="font-size: 0.75rem; margin-bottom: 0.4rem;">
<?= strtoupper(e($session['status'])) ?>
</span>
<h2 style="font-size: 1.15rem; font-weight: 700; color: var(--text-main); margin-top: 0.2rem;">
<a href="/sessions/<?= e($session['id']) ?>" style="text-decoration: none; color: inherit;">
<?= e($session['title']) ?>
</a>
</h2>
</div>
</div>
<div class="card-body" style="flex: 1; display: flex; flex-direction: column; gap: 0.75rem;">
<div style="font-size: 0.9rem; color: var(--text-muted);">
🏢 Canteen: <strong><?= e($session['canteen_name']) ?></strong>
</div>
<div style="font-size: 0.85rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.4rem;">
<span>👤 Hosted by:</span>
<strong><?= e($session['creator_name']) ?></strong>
<span style="font-size: 0.75rem; background: #f1f5f9; padding: 0.1rem 0.35rem; border-radius: var(--radius-sm);">@<?= e($session['creator_username']) ?></span>
</div>
<?php if (!empty($session['notes'])): ?>
<div style="font-size: 0.825rem; color: #1e40af; background: #eff6ff; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); border-left: 3px solid #3b82f6;">
📢 <?= e($session['notes']) ?>
</div>
<?php endif; ?>
<div style="display: flex; gap: 1rem; margin-top: auto; padding-top: 0.75rem; border-top: 1px dashed var(--border-color); font-size: 0.85rem; color: var(--text-muted);">
<div>👥 <strong><?= e($session['order_count']) ?></strong> ordered</div>
<div>🍱 <strong><?= e($session['menu_count']) ?></strong> menu items</div>
</div>
</div>
<div class="card-footer" style="background: #f8fafc; display: flex; justify-content: space-between; align-items: center;">
<span style="font-size: 0.8rem; color: var(--text-muted);"><?= date('M d, Y', strtotime($session['session_date'])) ?></span>
<a href="/sessions/<?= e($session['id']) ?>" class="btn btn-primary btn-sm">
<?= $session['status'] === 'open' ? '🍱 View & Order &rarr;' : '📋 View Live Board &rarr;' ?>
</a>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>