Updated: Vehicle list hides "Set as default" for default vehicle and improves styling
All checks were successful
Build and Deploy Zola Website / build_and_deploy (push) Successful in 12s
All checks were successful
Build and Deploy Zola Website / build_and_deploy (push) Successful in 12s
This commit is contained in:
parent
6df1f6574a
commit
652b04bfa1
@ -35,7 +35,7 @@ class Vehicle {
|
||||
}
|
||||
|
||||
public function getVehiclesByUser($user_id) {
|
||||
$stmt = $this->db->prepare("SELECT id, name, registration_plate, fuel_type, note, created_at FROM vehicles WHERE user_id = ?");
|
||||
$stmt = $this->db->prepare("SELECT id, name, registration_plate, fuel_type, note, is_default, created_at FROM vehicles WHERE user_id = ?");
|
||||
$stmt->bind_param("i", $user_id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
@ -14,18 +14,20 @@
|
||||
<p><?= htmlspecialchars($vehicle['fuel_type']) ?></p>
|
||||
<p><?= htmlspecialchars($vehicle['note'] ?? "") ?></p>
|
||||
|
||||
<div class="actions">
|
||||
<div class="vehicle-actions">
|
||||
<br>
|
||||
<form method="POST" action="/vehicles/delete">
|
||||
<input type="number" name="vehicle_id" value="<?= $vehicle['id'] ?>" style="display: none">
|
||||
<input type="submit" value="Delete vehicle" class="btn-danger">
|
||||
</form>
|
||||
|
||||
<?php if(!$vehicle['is_default']): ?>
|
||||
<br>
|
||||
<form method="POST" action="/vehicles/default">
|
||||
<input type="number" name="vehicle_id" value="<?= $vehicle['id'] ?>" style="display: none">
|
||||
<input type="submit" value="Set as default" class="btn-primary">
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
@ -27,3 +27,10 @@
|
||||
align-items: center;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.vehicle-actions {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: .5rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user