Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<div
[ngbPopover]="popoverContent"
[ngbPopover]="disabled ? undefined : popoverContent"
[autoClose]="'outside'"
#popover="ngbPopover"
container="body"
popoverClass="tp-popover-slim"
[tabindex]="popover.isOpen() ? 0 : -1"
(keydown)="popover.isOpen() && confirmed.emit()"
[ngClass]="reducedFootprint ? 'tp-cursor-pointer' : 'btn btn-sm btn-outline-danger'">
[ngClass]="{
'tp-cursor-pointer': reducedFootprint,
'btn btn-sm btn-outline-danger': !reducedFootprint,
'text-secondary tp-cursor-not-allowed': reducedFootprint && disabled,
disabled: !reducedFootprint && disabled
}">
<i class="bi bi-trash"></i>
@if (showLabel) {
<span class="ms-2" translate="Portal.General.Delete"></span>
Expand All @@ -15,10 +20,12 @@

<ng-template #popoverContent>
<div class="px-3 py-2 d-flex flex-row align-items-center gap-3">
<i
class="tp-cursor-pointer bi bi-trash text-danger fs-5"
(click)="confirmed.emit()"
[title]="'Portal.DeleteButton.ConfirmTooltip' | translate"></i>
@if (!disabled) {
<i
class="tp-cursor-pointer bi bi-trash text-danger fs-5"
(click)="confirmed.emit()"
[title]="'Portal.DeleteButton.ConfirmTooltip' | translate"></i>
}
<span
class="tp-cursor-pointer text-decoration-underline text-secondary"
(click)="popover.close()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ export class DeleteButtonComponent {
@Input()
public showLabel: boolean = false;

@Input()
public disabled: boolean = false;

@Output()
public confirmed = new EventEmitter<void>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,11 @@
</div>
}
</div>
<div class="card-footer">
<div class="card-footer d-flex flex-row align-items-center gap-1">
@if (writeAllowed) {
@let canDelete = invitationLink.numberOfApplications === 0;
@if (canDelete) {
<tp-delete-button [showLabel]="true" (confirmed)="deleteInvitationLink()" />
} @else {
<tp-delete-button [showLabel]="true" [disabled]="!canDelete" (confirmed)="deleteInvitationLink()" />
@if (!canDelete) {
<tp-tooltip-icon [tooltipText]="'Portal.ViewPlanningRealm.InvitationLink.DeleteNotPossible'" />
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/Turnierplan.Core/PlanningRealm/PlanningRealm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public InvitationLink AddInvitationLink(string name)
var invitationLink = new InvitationLink(name);
_invitationLinks.Add(invitationLink);

invitationLink.PlanningRealm = this;

return invitationLink;
}

Expand Down
Loading