-
Notifications
You must be signed in to change notification settings - Fork 0
feat(meetings): add public meeting registration and RSVP updates #193
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 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
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
104 changes: 104 additions & 0 deletions
104
...es/meetings/components/public-registration-modal/public-registration-modal.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,104 @@ | ||
| <!-- Copyright The Linux Foundation and each contributor to LFX. --> | ||
| <!-- SPDX-License-Identifier: MIT --> | ||
|
|
||
| <form [formGroup]="form" (ngSubmit)="onSubmit()" class="flex flex-col gap-4" data-testid="public-registration-modal-form"> | ||
| <p class="text-sm text-gray-600 mb-2"> | ||
| Register for <span class="font-semibold">{{ meetingTitle }}</span> | ||
| </p> | ||
|
|
||
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4"> | ||
| <!-- First Name --> | ||
| <div class="flex flex-col gap-1" data-testid="public-registration-firstname-field"> | ||
| <label for="first_name" class="text-sm font-medium text-gray-700">First Name <span class="text-red-500">*</span></label> | ||
| <lfx-input-text | ||
| size="small" | ||
| [form]="form" | ||
| control="first_name" | ||
| label="First Name" | ||
| placeholder="Enter first name" | ||
| data-testid="public-registration-firstname-input"> | ||
| </lfx-input-text> | ||
| </div> | ||
|
|
||
| <!-- Last Name --> | ||
| <div class="flex flex-col gap-1" data-testid="public-registration-lastname-field"> | ||
| <label for="last_name" class="text-sm font-medium text-gray-700">Last Name <span class="text-red-500">*</span></label> | ||
| <lfx-input-text | ||
| size="small" | ||
| [form]="form" | ||
| control="last_name" | ||
| label="Last Name" | ||
| placeholder="Enter last name" | ||
| data-testid="public-registration-lastname-input"> | ||
| </lfx-input-text> | ||
| </div> | ||
|
|
||
| <!-- Email --> | ||
| <div class="md:col-span-2 flex flex-col gap-1" data-testid="public-registration-email-field"> | ||
| <label for="email" class="text-sm font-medium text-gray-700">Email <span class="text-red-500">*</span></label> | ||
| <lfx-input-text | ||
| size="small" | ||
| [form]="form" | ||
| control="email" | ||
| label="Email" | ||
| placeholder="Enter email address" | ||
| type="email" | ||
| data-testid="public-registration-email-input"> | ||
| </lfx-input-text> | ||
| @if (form.get('email')?.errors?.['required'] && form.get('email')?.touched && form.get('email')?.dirty) { | ||
| <p class="text-sm text-red-500">Email is required</p> | ||
| } | ||
| @if (form.get('email')?.errors?.['email'] && form.get('email')?.touched && form.get('email')?.dirty) { | ||
| <p class="text-sm text-red-500">Invalid email address</p> | ||
| } | ||
| </div> | ||
|
|
||
| <!-- Job Title --> | ||
| <div class="flex flex-col gap-1" data-testid="public-registration-jobtitle-field"> | ||
| <label for="job_title" class="text-sm font-medium text-gray-700">Job Title</label> | ||
| <lfx-input-text | ||
| size="small" | ||
| [form]="form" | ||
| control="job_title" | ||
| label="Job Title" | ||
| placeholder="Enter job title" | ||
| data-testid="public-registration-jobtitle-input"> | ||
| </lfx-input-text> | ||
| </div> | ||
|
|
||
| <!-- Organization --> | ||
| <div class="flex flex-col gap-1" data-testid="public-registration-organization-field"> | ||
| <label for="org_name" class="text-sm font-medium text-gray-700">Organization</label> | ||
| <lfx-organization-search | ||
| [form]="form" | ||
| nameControl="org_name" | ||
| placeholder="Search organizations..." | ||
| styleClass="w-full" | ||
| inputStyleClass="text-sm w-full" | ||
| panelStyleClass="text-sm w-full" | ||
| dataTestId="public-registration-organization-input"> | ||
| </lfx-organization-search> | ||
| </div> | ||
| </div> | ||
|
|
||
| <!-- Action Buttons --> | ||
| <div class="flex border-t border-gray-200 pt-4 justify-end gap-2" data-testid="public-registration-modal-actions"> | ||
| <lfx-button | ||
| label="Cancel" | ||
| severity="secondary" | ||
| [text]="true" | ||
| size="small" | ||
| type="button" | ||
| (onClick)="onCancel()" | ||
| data-testid="public-registration-cancel-button"> | ||
| </lfx-button> | ||
| <lfx-button | ||
| label="Register" | ||
| [loading]="submitting()" | ||
| [disabled]="form.invalid || submitting()" | ||
| type="submit" | ||
| size="small" | ||
| data-testid="public-registration-submit-button"> | ||
| </lfx-button> | ||
| </div> | ||
| </form> |
108 changes: 108 additions & 0 deletions
108
...ules/meetings/components/public-registration-modal/public-registration-modal.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,108 @@ | ||
| // Copyright The Linux Foundation and each contributor to LFX. | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| import { CommonModule } from '@angular/common'; | ||
| import { Component, inject, signal, WritableSignal } from '@angular/core'; | ||
| import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; | ||
| import { ButtonComponent } from '@components/button/button.component'; | ||
| import { InputTextComponent } from '@components/input-text/input-text.component'; | ||
| import { OrganizationSearchComponent } from '@components/organization-search/organization-search.component'; | ||
| import { MeetingRegistrant, User } from '@lfx-one/shared/interfaces'; | ||
| import { markFormControlsAsTouched } from '@lfx-one/shared/utils'; | ||
| import { MeetingService } from '@services/meeting.service'; | ||
| import { MessageService } from 'primeng/api'; | ||
| import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; | ||
|
|
||
| @Component({ | ||
| selector: 'lfx-public-registration-modal', | ||
| standalone: true, | ||
| imports: [CommonModule, ReactiveFormsModule, ButtonComponent, InputTextComponent, OrganizationSearchComponent], | ||
| templateUrl: './public-registration-modal.component.html', | ||
| }) | ||
| export class PublicRegistrationModalComponent { | ||
| private readonly meetingService = inject(MeetingService); | ||
| private readonly messageService = inject(MessageService); | ||
| private readonly ref = inject(DynamicDialogRef); | ||
| private readonly config = inject(DynamicDialogConfig); | ||
|
|
||
| public readonly meetingId: string = this.config.data.meetingId; | ||
| public readonly meetingTitle: string = this.config.data.meetingTitle; | ||
| public readonly user: User | null = this.config.data.user; | ||
|
|
||
| public submitting: WritableSignal<boolean> = signal(false); | ||
| public form: FormGroup; | ||
|
|
||
| public constructor() { | ||
| this.form = new FormGroup({ | ||
| first_name: new FormControl('', [Validators.required, Validators.minLength(2)]), | ||
| last_name: new FormControl('', [Validators.required, Validators.minLength(2)]), | ||
| email: new FormControl('', [Validators.required, Validators.email]), | ||
| job_title: new FormControl(''), | ||
| org_name: new FormControl(''), | ||
| }); | ||
|
|
||
| // Pre-populate with user data if available | ||
| if (this.user) { | ||
| let firstName: string | null = null; | ||
| let lastName: string | null = null; | ||
|
|
||
| if (this.user.name) { | ||
| const nameParts = this.user.name.split(' '); | ||
| firstName = nameParts[0]; | ||
| lastName = this.user.name.split(' ').slice(1).join(' '); | ||
asithade marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } else { | ||
| firstName = this.user.given_name || this.user.first_name || ''; | ||
| lastName = this.user.family_name || this.user.last_name || ''; | ||
| } | ||
|
|
||
| this.form.patchValue({ first_name: firstName, last_name: lastName, email: this.user.email || '' }); | ||
| } | ||
| } | ||
|
|
||
| public onSubmit(): void { | ||
| if (this.submitting()) { | ||
| return; | ||
| } | ||
|
|
||
| if (this.form.valid) { | ||
| this.submitting.set(true); | ||
| const formValue = this.form.value; | ||
|
|
||
| this.meetingService | ||
| .registerForPublicMeeting({ | ||
| meeting_uid: this.meetingId, | ||
| email: formValue.email, | ||
| first_name: formValue.first_name, | ||
| last_name: formValue.last_name, | ||
| job_title: formValue.job_title || null, | ||
| org_name: formValue.org_name || null, | ||
| }) | ||
| .subscribe({ | ||
| next: (registrant: MeetingRegistrant) => { | ||
| this.submitting.set(false); | ||
| this.messageService.add({ | ||
| severity: 'success', | ||
| summary: 'Registration Successful', | ||
| detail: 'You have been registered for this meeting', | ||
| }); | ||
| this.ref.close({ registered: true, registrant }); | ||
| }, | ||
| error: (error: any) => { | ||
| this.submitting.set(false); | ||
| const errorMessage = error?.error?.message || 'Failed to register for this meeting'; | ||
| this.messageService.add({ | ||
| severity: 'error', | ||
| summary: 'Registration Failed', | ||
| detail: errorMessage, | ||
| }); | ||
| }, | ||
| }); | ||
| } else { | ||
| markFormControlsAsTouched(this.form); | ||
| } | ||
| } | ||
|
|
||
| public onCancel(): void { | ||
| this.ref.close(); | ||
| } | ||
| } | ||
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
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.