-
Notifications
You must be signed in to change notification settings - Fork 0
feat(meetings): add ability to cancel meeting occurrences #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
46e6cd9
feat(meetings): add ability to cancel meeting occurrences
andrest50 359ff55
refactor(meetings): improve cancel occurrence implementation
andrest50 96d289e
Merge branch 'main' into andrest50/cancel-meeting-occurrence
andrest50 eecc2b6
fix(meetings): resolve merge conflict and improve cancel occurrence l…
andrest50 cce6222
Merge branch 'main' into andrest50/cancel-meeting-occurrence
asithade File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
69 changes: 69 additions & 0 deletions
69
...ting-cancel-occurrence-confirmation/meeting-cancel-occurrence-confirmation.component.html
This file contains hidden or 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,69 @@ | ||
| <!-- Copyright The Linux Foundation and each contributor to LFX. --> | ||
| <!-- SPDX-License-Identifier: MIT --> | ||
|
|
||
| <div class="meeting-cancel-occurrence-confirmation"> | ||
| <!-- Occurrence Details --> | ||
| <div class="mb-6"> | ||
| <div class="bg-gray-50 rounded-lg p-4 border border-gray-200"> | ||
| <h3 class="text-lg font-semibold text-gray-900 mb-3">Occurrence Details</h3> | ||
|
|
||
| <div class="space-y-2"> | ||
| <div class="flex items-start"> | ||
| <span class="font-medium text-gray-700 w-20 flex-shrink-0">Title:</span> | ||
| <span class="text-gray-900">{{ occurrence.title || meeting.title || 'Untitled Meeting' }}</span> | ||
| </div> | ||
|
|
||
| <div class="flex items-start"> | ||
| <span class="font-medium text-gray-700 w-20 flex-shrink-0">Date:</span> | ||
| <span class="text-gray-900">{{ occurrence.start_time | meetingTime: occurrence.duration : 'date' }}</span> | ||
| </div> | ||
|
|
||
| <div class="flex items-start"> | ||
| <span class="font-medium text-gray-700 w-20 flex-shrink-0">Time:</span> | ||
| <span class="text-gray-900">{{ occurrence.start_time | meetingTime: occurrence.duration : 'time' }}</span> | ||
| </div> | ||
|
|
||
| <div class="flex items-start"> | ||
| <span class="font-medium text-gray-700 w-20 flex-shrink-0">Series:</span> | ||
| <span class="text-gray-900 flex items-center gap-2"> | ||
| <i class="fa-light fa-repeat text-blue-500"></i> | ||
| Part of Recurring Series | ||
| </span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <!-- Warning Message --> | ||
| <lfx-message severity="error" icon="fa-light fa-triangle-exclamation" styleClass="mb-6"> | ||
| <ng-template #content> | ||
| <h4 class="font-medium mb-1">Warning</h4> | ||
| <p class="text-sm">This will permanently cancel this specific occurrence. Guests will be notified of the cancellation. This action cannot be undone.</p> | ||
| </ng-template> | ||
| </lfx-message> | ||
|
|
||
| <!-- Action Buttons --> | ||
| <div class="flex justify-end gap-3"> | ||
| <lfx-button | ||
| label="Cancel" | ||
| severity="secondary" | ||
| [outlined]="true" | ||
| size="small" | ||
| type="button" | ||
| [disabled]="isCanceling()" | ||
| (click)="onCancel()" | ||
| data-testid="cancel-occurrence-cancel-button"> | ||
| </lfx-button> | ||
|
|
||
| <lfx-button | ||
| [label]="isCanceling() ? 'Canceling...' : 'Cancel Occurrence'" | ||
| severity="danger" | ||
| size="small" | ||
| type="button" | ||
| [icon]="isCanceling() ? 'fa-light fa-circle-notch fa-spin' : 'fa-light fa-ban'" | ||
| [disabled]="isCanceling()" | ||
| (click)="onConfirm()" | ||
| data-testid="cancel-occurrence-confirm-button"> | ||
| </lfx-button> | ||
| </div> | ||
| </div> |
59 changes: 59 additions & 0 deletions
59
...eeting-cancel-occurrence-confirmation/meeting-cancel-occurrence-confirmation.component.ts
This file contains hidden or 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,59 @@ | ||
| // Copyright The Linux Foundation and each contributor to LFX. | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| import { Component, inject, signal } from '@angular/core'; | ||
| import { CommonModule } from '@angular/common'; | ||
| import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; | ||
| import { Meeting, MeetingOccurrence } from '@lfx-one/shared/interfaces'; | ||
| import { MeetingService } from '@services/meeting.service'; | ||
| import { ButtonComponent } from '@components/button/button.component'; | ||
| import { MessageComponent } from '@components/message/message.component'; | ||
| import { MeetingTimePipe } from '@pipes/meeting-time.pipe'; | ||
| import { HttpErrorResponse } from '@angular/common/http'; | ||
|
|
||
| @Component({ | ||
| selector: 'lfx-meeting-cancel-occurrence-confirmation', | ||
| standalone: true, | ||
| imports: [CommonModule, ButtonComponent, MessageComponent, MeetingTimePipe], | ||
| templateUrl: './meeting-cancel-occurrence-confirmation.component.html', | ||
| }) | ||
| export class MeetingCancelOccurrenceConfirmationComponent { | ||
| private readonly dialogRef = inject(DynamicDialogRef); | ||
| private readonly config = inject(DynamicDialogConfig); | ||
| private readonly meetingService = inject(MeetingService); | ||
|
|
||
| public readonly meeting: Meeting = this.config.data.meeting; | ||
| public readonly occurrence: MeetingOccurrence = this.config.data.occurrence; | ||
| public readonly isCanceling = signal(false); | ||
|
|
||
| public onCancel(): void { | ||
| this.dialogRef.close({ confirmed: false }); | ||
| } | ||
|
|
||
| public onConfirm(): void { | ||
| this.isCanceling.set(true); | ||
|
|
||
| this.meetingService.cancelOccurrence(this.meeting.uid, this.occurrence.occurrence_id).subscribe({ | ||
| next: () => { | ||
| this.isCanceling.set(false); | ||
| this.dialogRef.close({ confirmed: true }); | ||
| }, | ||
| error: (error: HttpErrorResponse) => { | ||
| this.isCanceling.set(false); | ||
| let errorMessage = 'Failed to cancel occurrence. Please try again.'; | ||
|
|
||
| if (error.status === 404) { | ||
| errorMessage = 'Meeting occurrence not found.'; | ||
| } else if (error.status === 403) { | ||
| errorMessage = 'You do not have permission to cancel this occurrence.'; | ||
| } else if (error.status === 500) { | ||
| errorMessage = 'Server error occurred while canceling occurrence.'; | ||
| } else if (error.status === 0) { | ||
| errorMessage = 'Network error. Please check your connection.'; | ||
| } | ||
|
|
||
| this.dialogRef.close({ confirmed: false, error: errorMessage }); | ||
| }, | ||
| }); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
76 changes: 76 additions & 0 deletions
76
...ngs/components/meeting-delete-type-selection/meeting-delete-type-selection.component.html
This file contains hidden or 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,76 @@ | ||
| <!-- Copyright The Linux Foundation and each contributor to LFX. --> | ||
| <!-- SPDX-License-Identifier: MIT --> | ||
|
|
||
| <div class="meeting-delete-type-selection"> | ||
| <!-- Description --> | ||
| <div class="mb-6"> | ||
| <p class="text-gray-700">This is a recurring meeting. Would you like to cancel just this occurrence or delete the entire meeting series?</p> | ||
| </div> | ||
|
|
||
| <!-- Selection Options --> | ||
| <div class="space-y-3 mb-6"> | ||
| <div | ||
| class="border rounded-lg p-4 cursor-pointer transition-all" | ||
| [ngClass]="{ | ||
| 'border-blue-500 bg-blue-50': selectedType === 'occurrence', | ||
| 'border-gray-200': selectedType !== 'occurrence', | ||
| }" | ||
| (click)="selectType('occurrence')" | ||
| data-testid="delete-type-occurrence-option"> | ||
| <div class="flex items-start gap-3"> | ||
| <div class="mt-1"> | ||
| <i | ||
| class="fa-light text-lg" | ||
| [ngClass]="{ | ||
| 'fa-circle-dot text-blue-500': selectedType === 'occurrence', | ||
| 'fa-circle text-gray-400': selectedType !== 'occurrence', | ||
| }"></i> | ||
| </div> | ||
| <div class="flex-1"> | ||
| <h4 class="font-semibold text-gray-900 mb-1">Cancel This Occurrence</h4> | ||
| <p class="text-sm text-gray-600">Only this specific meeting instance will be canceled. The rest of the series will remain.</p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div | ||
| class="border rounded-lg p-4 cursor-pointer transition-all" | ||
| [ngClass]="{ | ||
| 'border-blue-500 bg-blue-50': selectedType === 'series', | ||
| 'border-gray-200': selectedType !== 'series', | ||
| }" | ||
| (click)="selectType('series')" | ||
| data-testid="delete-type-series-option"> | ||
| <div class="flex items-start gap-3"> | ||
| <div class="mt-1"> | ||
| <i | ||
| class="fa-light text-lg" | ||
| [ngClass]="{ | ||
| 'fa-circle-dot text-blue-500': selectedType === 'series', | ||
| 'fa-circle text-gray-400': selectedType !== 'series', | ||
| }"></i> | ||
| </div> | ||
| <div class="flex-1"> | ||
| <h4 class="font-semibold text-gray-900 mb-1">Delete Entire Series</h4> | ||
| <p class="text-sm text-gray-600">The entire recurring meeting series will be permanently deleted.</p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <!-- Action Buttons --> | ||
| <div class="flex justify-end gap-3"> | ||
| <lfx-button label="Cancel" severity="secondary" [outlined]="true" size="small" type="button" (click)="onCancel()" data-testid="delete-type-cancel-button"> | ||
| </lfx-button> | ||
|
|
||
| <lfx-button | ||
| label="Continue" | ||
| severity="primary" | ||
| size="small" | ||
| type="button" | ||
| [disabled]="!selectedType" | ||
| (click)="onContinue()" | ||
| data-testid="delete-type-continue-button"> | ||
| </lfx-button> | ||
| </div> | ||
| </div> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.