💄 Trip: conditionnally show edit place button
This commit is contained in:
parent
2b2971a6c9
commit
084ce90f43
@ -328,8 +328,10 @@
|
|||||||
<div class="relative rounded-md shadow p-4">
|
<div class="relative rounded-md shadow p-4">
|
||||||
<p class="font-bold mb-1">Place</p>
|
<p class="font-bold mb-1">Place</p>
|
||||||
<div class="text-sm text-gray-500 truncate">{{ selectedItem.place.name }}</div>
|
<div class="text-sm text-gray-500 truncate">{{ selectedItem.place.name }}</div>
|
||||||
|
@if (selectedItem.place.user == username) {
|
||||||
<div class="absolute top-2 right-2"><p-button severity="help" pTooltip="Edit place details" text
|
<div class="absolute top-2 right-2"><p-button severity="help" pTooltip="Edit place details" text
|
||||||
icon="pi pi-pencil" (click)="editPlace(selectedItem.place)" /></div>
|
icon="pi pi-pencil" (click)="editPlace(selectedItem.place)" /></div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -83,6 +83,7 @@ import { generateTripCSVFile } from './csv';
|
|||||||
})
|
})
|
||||||
export class TripComponent implements AfterViewInit {
|
export class TripComponent implements AfterViewInit {
|
||||||
@ViewChild('menuTripActions') menuTripActions!: Menu;
|
@ViewChild('menuTripActions') menuTripActions!: Menu;
|
||||||
|
username: string;
|
||||||
tripSharedURL$?: Observable<string>;
|
tripSharedURL$?: Observable<string>;
|
||||||
statuses: TripStatus[] = [];
|
statuses: TripStatus[] = [];
|
||||||
trip?: Trip;
|
trip?: Trip;
|
||||||
@ -255,6 +256,7 @@ export class TripComponent implements AfterViewInit {
|
|||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private clipboard: Clipboard,
|
private clipboard: Clipboard,
|
||||||
) {
|
) {
|
||||||
|
this.username = this.utilsService.loggedUser;
|
||||||
this.statuses = this.utilsService.statuses;
|
this.statuses = this.utilsService.statuses;
|
||||||
this.tripTableSearchInput.valueChanges.pipe(debounceTime(300), takeUntilDestroyed()).subscribe({
|
this.tripTableSearchInput.valueChanges.pipe(debounceTime(300), takeUntilDestroyed()).subscribe({
|
||||||
next: (value) => {
|
next: (value) => {
|
||||||
|
|||||||
@ -23,6 +23,10 @@ export class UtilsService {
|
|||||||
|
|
||||||
constructor(private ngMessageService: MessageService) {}
|
constructor(private ngMessageService: MessageService) {}
|
||||||
|
|
||||||
|
get loggedUser(): string {
|
||||||
|
return localStorage.getItem(JWT_USER) ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
toGithubTRIP() {
|
toGithubTRIP() {
|
||||||
window.open('https://github.com/itskovacs/trip', '_blank');
|
window.open('https://github.com/itskovacs/trip', '_blank');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user