This commit is contained in:
Tykayn 2025-10-14 17:37:12 +02:00 committed by tykayn
parent cc92e2b5d7
commit 4f6a388129
3 changed files with 33 additions and 8 deletions

View file

@ -1,4 +1,5 @@
<div class="layout">
@if(showOptions){
<div class="aside">
@ -29,13 +30,7 @@
<input type="checkbox" [(ngModel)]="pleinAirMode" (change)="togglePleinAir()">
Mode plein air
</label>
@if (pleinAirMode) {
<div class="quick-actions" style="margin-top:8px; display:flex; gap:6px; flex-wrap:wrap;">
<button class="btn" (click)="quickCreate('traffic.contestation')">🚩 Contester</button>
<button class="btn" (click)="quickCreate('traffic.interruption')">⛓️ Interruption</button>
<button class="btn" (click)="quickCreate('traffic.wrong_way')">⛖ Détourné</button>
</div>
}
</div>
<div class="filters-group">
@ -191,6 +186,14 @@
<button class="button toggle-options" (click)="showOptions = !showOptions">
Options
</button>
@if (pleinAirMode) {
<div class="quick-actions" style="margin-top:8px; display:flex; gap:6px; flex-wrap:wrap;">
<button class="btn" (click)="quickCreate('traffic.contestation')">🚩 Contester</button>
<button class="btn" (click)="quickCreate('traffic.interruption')">⛓️ Interruption</button>
<button class="btn" (click)="quickCreate('traffic.wrong_way')">⛖ Détourné</button>
</div>
}
@if (toasts.length) {
<div class="toaster" style="position:fixed;right:16px;top:16px;display:flex;flex-direction:column;gap:8px;z-index:1000;">
@for (t of toasts; track t.id) {

View file

@ -250,4 +250,15 @@ app-edit-form{
outline: none;
}
}
.quick-actions{
margin-top: 8px;
display: inline-block;
gap: 6px;
flex-wrap: wrap;
position: fixed;
right: 5rem;
bottom: 1.1rem;
z-index: 100;
}

View file

@ -88,6 +88,7 @@ export class Home implements OnInit, OnDestroy {
const id = (map.get('id') || '').trim();
const what = (map.get('what') || '').trim();
const pleinAir = (map.get('pleinair') || '').trim().toLowerCase();
const preset = (map.get('preset') || '').trim().toLowerCase();
const limitParam = map.get('limit');
const limit = limitParam ? Number(limitParam) : null;
// Charger selon les query params
@ -104,6 +105,10 @@ export class Home implements OnInit, OnDestroy {
if (pleinAir === '1' || pleinAir === 'true' || pleinAir === 'yes') {
this.enablePleinAirMode();
}
// Support: preset=plein_air
if (preset === 'plein_air') {
this.enablePleinAirMode();
}
});
this.startAutoReload();
}
@ -355,7 +360,13 @@ export class Home implements OnInit, OnDestroy {
geometry: { type: 'Point', coordinates: [lon, lat] }
} as any;
this.OedbApi.createEvent(feature).subscribe({
next: () => { this.pushToast('success', 'Évènement créé'); this.selected = null; this.loadEvents(); },
next: () => {
this.pushToast('success', 'Évènement créé');
this.selected = null;
// Après création rapide en plein air: recharger uniquement ce type pour feedback instantané
this.selectedWhatFilter = w;
this.loadEvents({ what: w });
},
error: () => { this.pushToast('error', 'Échec de création'); }
});
}