60 lines
2.9 KiB
PHP
60 lines
2.9 KiB
PHP
<?php
|
|
require __DIR__ . '/db.php';
|
|
|
|
$places = $pdo->query("
|
|
SELECT
|
|
p.id AS place_id,
|
|
p.name AS place_name,
|
|
p.woj,
|
|
s.id AS shop_id,
|
|
s.address,
|
|
s.open_hours
|
|
FROM salon_places p
|
|
LEFT JOIN shops s ON s.place_id = p.id
|
|
ORDER BY p.id DESC, s.id ASC")->fetchAll();
|
|
|
|
include __DIR__ . '/components/header.php';
|
|
?>
|
|
|
|
<div class="max-w-6xl mx-auto px-4 mt-8">
|
|
<div class="flex justify-between items-center mb-6">
|
|
<h1 class="text-3xl font-bold text-gray-800">Lista miejsc / salonów</h1>
|
|
<a href="pages/add.php" class="bg-green-600 hover:bg-green-700 text-white px-5 py-2 rounded shadow transition-all">
|
|
+ Dodaj
|
|
</a>
|
|
</div>
|
|
|
|
<div class="overflow-x-auto bg-white rounded shadow-lg">
|
|
<table class="min-w-full divide-y divide-gray-200">
|
|
<thead class="bg-gray-100 sticky top-0">
|
|
<tr>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Nazwa</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Woj</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Adres</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Akcje</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="bg-white divide-y divide-gray-200">
|
|
<?php foreach ($places as $p): ?>
|
|
<tr class="hover:bg-gray-50 transition-colors">
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-700"><?= $p['place_id'] ?></td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"><?= htmlspecialchars($p['place_name']) ?></td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-700"><?= $p['woj'] ?: '—' ?></td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-700"><?= $p['address'] ?: '—' ?></td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm flex gap-2">
|
|
<a href="pages/edit.php?id=<?= $p['place_id'] ?>"
|
|
class="bg-blue-600 hover:bg-blue-700 text-white px-3 py-1 rounded-md shadow transition-colors">Edytuj</a>
|
|
<a href="actions/delete.php?id=<?= $p['place_id'] ?>"
|
|
onclick="return confirm('Usunąć?')"
|
|
class="bg-red-600 hover:bg-red-700 text-white px-3 py-1 rounded-md shadow transition-colors">Usuń</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include __DIR__ . '/components/footer.php'; ?>
|