-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 276: Add vehicle functionality 🚗 * 276: Car management 2.0 * 276: add dates to vehicles * 276: add feature handling * 276: remove unused migration flie --------- Co-authored-by: Atmos4 <[email protected]>
- Loading branch information
1 parent
37817e0
commit 3b3e671
Showing
14 changed files
with
554 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
restrict_access(); | ||
|
||
$form = new Validator(action: "confirm-delete"); | ||
|
||
$event_id = get_route_param("event_id"); | ||
$vehicle_id = get_route_param("vehicle_id"); | ||
$event = em()->find(Event::class, $event_id); | ||
$vehicle = em()->find(Vehicle::class, $vehicle_id); | ||
if (!$event) { | ||
force_404("the event of id $event_id doesn't exist"); | ||
} | ||
if (!$vehicle) { | ||
force_404("the vehicle of id $vehicle_id doesn't exist"); | ||
} | ||
if ($form->valid()) { | ||
logger()->info("Véhicule {vehicle_id} deleted by user {currentUserLogin}", ['vehicle_id' => $vehicle_id, 'currentUserLogin' => User::getCurrent()->login]); | ||
em()->remove($vehicle); | ||
em()->flush(); | ||
Toast::error("Véhicule supprimé"); | ||
redirect("/evenements/$event_id?tab=vehicules"); | ||
} | ||
|
||
page("Confirmation de suppression"); | ||
?> | ||
<form method="post"> | ||
<div class="row center"> | ||
<?= $form->render_validation() ?> | ||
<p>Sûr de vouloir supprimer le véhicule | ||
<?= "$vehicle->id" ?> ? Il sera définitivement supprimé!! | ||
</p> | ||
<div class="col-auto"> | ||
<a class="secondary" role="button" href="/evenements/<?= $event_id ?>?tab=vehicules">Annuler</a> | ||
</div> | ||
<div class="col-auto"> | ||
<button type="submit" name="delete" value="true" class="destructive">Supprimer</button> | ||
</div> | ||
</div> | ||
</form> |
Oops, something went wrong.