-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Walk-in Reservations for XL Members from Ambassador Welcome De…
…sk (#313) Ambassadors requested the ability to create a drop-in reservation for a community member showing up to the XL without having already created a reservation. This commit adds a new area to the Ambassador Home Component that allows searching for a community member and registering an available seat for them. Since this is staff-only, the UX around pop-up notifications is just alerts for now. Future work could improve this to make use of snackbar or other material UX. To implement this feature, a few other useful additions were made in other parts of the application, including: Search for XL members by partial PID (with unit test coverage) Get notified of changes from the UsersLookup widget so that components which use it can have callback methods (example use case shown in this widget: after a user is selected, we lookup available seats and show the control for selecting a seat type)
- Loading branch information
1 parent
9a1f142
commit 5499238
Showing
12 changed files
with
203 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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 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 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
5 changes: 1 addition & 4 deletions
5
frontend/src/app/admin/roles/details/admin-role-details.component.ts
This file contains 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
14 changes: 11 additions & 3 deletions
14
frontend/src/app/coworking/ambassador-home/ambassador-home.component.css
This file contains 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 |
---|---|---|
@@ -1,7 +1,15 @@ | ||
.mat-mdc-card { | ||
max-width: 100%; | ||
max-width: 100%; | ||
} | ||
|
||
.mat-mdc-card-header { | ||
margin-bottom: 16px; | ||
} | ||
|
||
.walkinReservation.mat-mdc-card-content:last-child { | ||
padding-bottom: 0; | ||
} | ||
|
||
button { | ||
margin-right: 1vw; | ||
} | ||
margin-right: 1vw; | ||
} |
This file contains 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 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 |
---|---|---|
@@ -1,10 +1,26 @@ | ||
/** | ||
* This component is the primary screen for ambassadors at the check-in desk. | ||
* | ||
* @author Kris Jordan <[email protected]> | ||
* @copyright 2023 - 2024 | ||
* @license MIT | ||
*/ | ||
|
||
import { Component, OnDestroy, OnInit } from '@angular/core'; | ||
import { Route } from '@angular/router'; | ||
import { permissionGuard } from 'src/app/permission.guard'; | ||
import { profileResolver } from 'src/app/profile/profile.resolver'; | ||
import { Observable, Subscription, map, mergeMap, tap, timer } from 'rxjs'; | ||
import { Reservation } from '../coworking.models'; | ||
import { Observable, Subscription, map, tap, timer } from 'rxjs'; | ||
import { | ||
CoworkingStatus, | ||
Reservation, | ||
SeatAvailability | ||
} from '../coworking.models'; | ||
import { AmbassadorService } from './ambassador.service'; | ||
import { PublicProfile } from 'src/app/profile/profile.service'; | ||
import { CoworkingService } from '../coworking.service'; | ||
|
||
const FIVE_SECONDS = 5 * 1000; | ||
|
||
@Component({ | ||
selector: 'app-coworking-ambassador-home', | ||
|
@@ -25,11 +41,17 @@ export class AmbassadorPageComponent implements OnInit, OnDestroy { | |
upcomingReservations$: Observable<Reservation[]>; | ||
activeReservations$: Observable<Reservation[]>; | ||
|
||
welcomeDeskReservationSelection: PublicProfile[] = []; | ||
status$: Observable<CoworkingStatus>; | ||
|
||
columnsToDisplay = ['id', 'name', 'seat', 'start', 'end', 'actions']; | ||
|
||
private refreshSubscription!: Subscription; | ||
|
||
constructor(public ambassadorService: AmbassadorService) { | ||
constructor( | ||
public ambassadorService: AmbassadorService, | ||
public coworkingService: CoworkingService | ||
) { | ||
this.reservations$ = this.ambassadorService.reservations$; | ||
this.upcomingReservations$ = this.reservations$.pipe( | ||
map((reservations) => reservations.filter((r) => r.state === 'CONFIRMED')) | ||
|
@@ -39,15 +61,60 @@ export class AmbassadorPageComponent implements OnInit, OnDestroy { | |
reservations.filter((r) => r.state === 'CHECKED_IN') | ||
) | ||
); | ||
|
||
this.status$ = coworkingService.status$; | ||
} | ||
|
||
ngOnInit(): void { | ||
this.refreshSubscription = timer(0, 5000) | ||
beginReservationRefresh(): void { | ||
if (this.refreshSubscription) { | ||
this.refreshSubscription.unsubscribe(); | ||
} | ||
this.refreshSubscription = timer(0, FIVE_SECONDS) | ||
.pipe(tap((_) => this.ambassadorService.fetchReservations())) | ||
.subscribe(); | ||
} | ||
|
||
ngOnInit(): void { | ||
this.beginReservationRefresh(); | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.refreshSubscription.unsubscribe(); | ||
} | ||
|
||
onUsersChanged(users: PublicProfile[]) { | ||
if (users.length > 0) { | ||
this.coworkingService.pollStatus(); | ||
} | ||
} | ||
|
||
onWalkinSeatSelection(seatSelection: SeatAvailability[]) { | ||
if ( | ||
seatSelection.length > 0 && | ||
this.welcomeDeskReservationSelection.length > 0 | ||
) { | ||
this.ambassadorService | ||
.makeDropinReservation( | ||
seatSelection, | ||
this.welcomeDeskReservationSelection | ||
) | ||
.subscribe({ | ||
next: (reservation) => { | ||
this.welcomeDeskReservationSelection = []; | ||
this.beginReservationRefresh(); | ||
alert( | ||
`Walk-in reservation made for ${ | ||
reservation.users[0].first_name | ||
} ${ | ||
reservation.users[0].last_name | ||
}!\nReservation ends at ${reservation.end.toLocaleTimeString()}` | ||
); | ||
}, | ||
error: (e) => { | ||
this.welcomeDeskReservationSelection = []; | ||
alert(e.message + '\n\n' + e.error.message); | ||
} | ||
}); | ||
} | ||
} | ||
} |
This file contains 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 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 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 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 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