Skip to content

Commit 5b3d536

Browse files
committed
Fix mobile organization switcher
1 parent e40dfc8 commit 5b3d536

File tree

178 files changed

+2237
-1666
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+2237
-1666
lines changed

.cursor/mcp.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"mcpServers": {
3+
"laravel-boost": {
4+
"command": "php",
5+
"args": [
6+
"artisan",
7+
"boost:mcp"
8+
]
9+
}
10+
}
11+
}

.cursor/rules/assodepot.mdc

Lines changed: 0 additions & 14 deletions
This file was deleted.

.cursor/rules/laravel-boost.mdc

Lines changed: 423 additions & 0 deletions
Large diffs are not rendered by default.

app/Http/Controllers/App/CalendarController.php

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ public function index(Request $request)
1616
$user = $request->user();
1717
$organization = $user->currentOrganization;
1818

19+
if (!$organization) {
20+
return redirect()->route('app.organizations.create')
21+
->with('error', 'Vous devez créer une organisation avant de pouvoir accéder au calendrier.');
22+
}
23+
1924
// Get only outgoing reservations (where we are lending equipment)
2025
$reservations = $organization->lentReservations()
2126
->whereIn('status', [ReservationStatus::PENDING, ReservationStatus::CONFIRMED, ReservationStatus::COMPLETED])
@@ -28,7 +33,7 @@ public function index(Request $request)
2833
->map(function ($reservation) {
2934
return [
3035
'id' => $reservation->id,
31-
'title' => $reservation->items->map(fn ($item) => $item->equipment->name)->join(', '),
36+
'title' => $reservation->items->map(fn ($item) => $item->equipment?->name ?? 'Équipement supprimé')->join(', '),
3237
'start' => $reservation->start_date,
3338
'end' => $reservation->end_date,
3439
'status' => [
@@ -37,18 +42,18 @@ public function index(Request $request)
3742
'color' => $reservation->status->color(),
3843
],
3944
'borrower' => [
40-
'name' => $reservation->borrowerOrganization->name,
41-
'email' => $reservation->borrowerOrganization->email,
42-
'phone' => $reservation->borrowerOrganization->phone,
45+
'name' => $reservation->borrowerOrganization?->name ?? 'Organisation supprimée',
46+
'email' => $reservation->borrowerOrganization?->email,
47+
'phone' => $reservation->borrowerOrganization?->phone,
4348
'contact' => [
44-
'name' => $reservation->user->name,
45-
'email' => $reservation->user->email,
46-
'phone' => $reservation->user->phone,
49+
'name' => $reservation->user?->name ?? 'Utilisateur supprimé',
50+
'email' => $reservation->user?->email,
51+
'phone' => $reservation->user?->phone,
4752
],
4853
],
4954
'total' => $reservation->formatted_total,
5055
'items' => $reservation->items->map(fn ($item) => [
51-
'equipment' => $item->equipment->name,
56+
'equipment' => $item->equipment?->name ?? 'Équipement supprimé',
5257
'quantity' => $item->quantity,
5358
'status' => [
5459
'value' => $item->status->value,
@@ -76,6 +81,11 @@ public function storeManualReservation(ManualReservationRequest $request)
7681
{
7782
$organization = $request->user()->currentOrganization;
7883

84+
if (!$organization) {
85+
return redirect()->route('app.organizations.create')
86+
->with('error', 'Vous devez créer une organisation avant de pouvoir créer des réservations.');
87+
}
88+
7989
$validated = $request->validated();
8090

8191
$reservation = app(CreateManualReservation::class)->handle($validated, $organization);

app/Http/Requests/Reservation/StoreRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function authorize(): bool
2323
public function rules(): array
2424
{
2525
return [
26-
'equipment_id' => ['required', 'exists:equipment,id'],
26+
'equipment_id' => ['required', 'exists:equipments,id'],
2727
'start_date' => [
2828
'required',
2929
'date',

app/Models/Equipment.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,22 @@ class Equipment extends Model
4040
'next_maintenance_date',
4141
];
4242

43-
protected $casts = [
44-
'purchase_price' => PriceCast::class,
45-
'rental_price' => PriceCast::class,
46-
'deposit_amount' => PriceCast::class,
47-
'is_available' => 'boolean',
48-
'requires_deposit' => 'boolean',
49-
'is_rentable' => 'boolean',
50-
'is_active' => 'boolean',
51-
'specifications' => 'array',
52-
'images' => 'array',
53-
'last_maintenance_date' => 'date',
54-
'next_maintenance_date' => 'date',
55-
];
43+
protected function casts(): array
44+
{
45+
return [
46+
'purchase_price' => PriceCast::class,
47+
'rental_price' => PriceCast::class,
48+
'deposit_amount' => PriceCast::class,
49+
'is_available' => 'boolean',
50+
'requires_deposit' => 'boolean',
51+
'is_rentable' => 'boolean',
52+
'is_active' => 'boolean',
53+
'specifications' => 'array',
54+
'images' => 'array',
55+
'last_maintenance_date' => 'date',
56+
'next_maintenance_date' => 'date',
57+
];
58+
}
5659

5760
protected $table = 'equipments';
5861

composer.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22
"$schema": "https://getcomposer.org/schema.json",
33
"name": "laravel/vue-starter-kit",
44
"type": "project",
5-
"description": "The skeleton application for the Laravel framework.",
5+
"description": "Plateforme de gestion de location et de réservation de matériel pour les organisations, clubs et associations.",
66
"keywords": [
7-
"laravel",
8-
"framework"
7+
"location",
8+
"réservation",
9+
"matériel",
10+
"organisation",
11+
"club",
12+
"association",
13+
"gestion",
14+
"plateforme"
915
],
1016
"license": "MIT",
1117
"require": {
@@ -25,6 +31,7 @@
2531
"tightenco/ziggy": "^2.4"
2632
},
2733
"require-dev": {
34+
"laravel/boost": "^1.0",
2835
"laravel/pail": "^1.2.2",
2936
"laravel/pint": "^1.18",
3037
"laravel/sail": "^1.41",

composer.lock

Lines changed: 191 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)