settin qr orders
This commit is contained in:
parent
7886680cd0
commit
9a50d0a34e
@ -31,8 +31,11 @@ if (!$table) {
|
||||
die("Table not found.");
|
||||
}
|
||||
|
||||
// Fetch Areas for Dropdown
|
||||
$areas = $pdo->query("SELECT id, name FROM areas ORDER BY name ASC")->fetchAll();
|
||||
// Fetch Areas for Dropdown (with outlet names)
|
||||
$areas = $pdo->query("SELECT areas.id, areas.name, outlets.name as outlet_name
|
||||
FROM areas
|
||||
JOIN outlets ON areas.outlet_id = outlets.id
|
||||
ORDER BY outlets.name ASC, areas.name ASC")->fetchAll();
|
||||
|
||||
include 'includes/header.php';
|
||||
?>
|
||||
@ -53,12 +56,12 @@ include 'includes/header.php';
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Area</label>
|
||||
<label class="form-label">Area (Sorted by Outlet)</label>
|
||||
<select name="area_id" class="form-select" required>
|
||||
<option value="">Select Area</option>
|
||||
<?php foreach ($areas as $area): ?>
|
||||
<option value="<?= $area['id'] ?>" <?= $area['id'] == $table['area_id'] ? 'selected' : '' ?>>
|
||||
<?= htmlspecialchars($area['name']) ?>
|
||||
<?= htmlspecialchars($area['outlet_name']) ?> » <?= htmlspecialchars($area['name']) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
@ -15,17 +15,21 @@ if (isset($_GET['delete'])) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Fetch tables with area names
|
||||
$query = "SELECT tables.*, areas.name as area_name
|
||||
// Fetch tables with area and outlet names
|
||||
$query = "SELECT tables.*, areas.name as area_name, outlets.name as outlet_name
|
||||
FROM tables
|
||||
LEFT JOIN areas ON tables.area_id = areas.id
|
||||
LEFT JOIN outlets ON areas.outlet_id = outlets.id
|
||||
ORDER BY tables.id DESC";
|
||||
|
||||
$tables_pagination = paginate_query($pdo, $query);
|
||||
$tables = $tables_pagination['data'];
|
||||
|
||||
// Fetch areas for dropdown
|
||||
$areas = $pdo->query("SELECT id, name FROM areas ORDER BY name ASC")->fetchAll();
|
||||
// Fetch areas for dropdown (with outlet names)
|
||||
$areas = $pdo->query("SELECT areas.id, areas.name, outlets.name as outlet_name
|
||||
FROM areas
|
||||
JOIN outlets ON areas.outlet_id = outlets.id
|
||||
ORDER BY outlets.name ASC, areas.name ASC")->fetchAll();
|
||||
|
||||
include 'includes/header.php';
|
||||
|
||||
@ -58,7 +62,7 @@ $baseUrl = $protocol . $host . ($dir === '/' ? '' : $dir) . '/qorder.php';
|
||||
<tr>
|
||||
<th class="ps-4">ID</th>
|
||||
<th>Name</th>
|
||||
<th>Area</th>
|
||||
<th>Outlet / Area</th>
|
||||
<th>Capacity</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
@ -70,7 +74,10 @@ $baseUrl = $protocol . $host . ($dir === '/' ? '' : $dir) . '/qorder.php';
|
||||
<tr>
|
||||
<td class="ps-4 fw-medium">#<?= $table['id'] ?></td>
|
||||
<td class="fw-bold"><?= htmlspecialchars($table['name']) ?></td>
|
||||
<td><span class="badge bg-secondary"><?= htmlspecialchars($table['area_name'] ?? 'N/A') ?></span></td>
|
||||
<td>
|
||||
<span class="badge bg-info text-dark"><?= htmlspecialchars($table['outlet_name'] ?? 'N/A') ?></span>
|
||||
<span class="badge bg-secondary"><?= htmlspecialchars($table['area_name'] ?? 'N/A') ?></span>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($table['capacity']) ?> pax</td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-dark me-1"
|
||||
@ -114,11 +121,11 @@ $baseUrl = $protocol . $host . ($dir === '/' ? '' : $dir) . '/qorder.php';
|
||||
<input type="text" name="name" class="form-control" placeholder="e.g. T1, Window 5" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Area</label>
|
||||
<label class="form-label">Area (Sorted by Outlet)</label>
|
||||
<select name="area_id" class="form-select" required>
|
||||
<option value="">Select Area</option>
|
||||
<?php foreach ($areas as $area): ?>
|
||||
<option value="<?= $area['id'] ?>"><?= htmlspecialchars($area['name']) ?></option>
|
||||
<option value="<?= $area['id'] ?>"><?= htmlspecialchars($area['outlet_name']) ?> » <?= htmlspecialchars($area['name']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user