-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Reschedule Reservations (#111)
* Add Reschedule Modal + UI Enhancements + Bug Fixes * Implement reschedule reservations * Disable reschedule button while processing
- Loading branch information
Showing
18 changed files
with
638 additions
and
125 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
98 changes: 98 additions & 0 deletions
98
...ate-reservation-dialog/reservation-duration-form/reservation-duration-form.component.html
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 |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<form | ||
*ngIf="reservationDurationForm" | ||
[formGroup]="reservationDurationForm" | ||
class="flex flex-wrap gap-5"> | ||
<mat-form-field class="w-full lg:flex-1 mb-4"> | ||
<mat-label>Reservation Date</mat-label> | ||
<input | ||
formControlName="reservationDate" | ||
autocomplete="off" | ||
matInput | ||
readonly | ||
[min]="startAt" | ||
[value]="startAt" | ||
[matDatepicker]="datePicker" /> | ||
<mat-hint>MM/DD/YYYY</mat-hint> | ||
<mat-datepicker-toggle | ||
matIconSuffix | ||
[for]="datePicker"></mat-datepicker-toggle> | ||
<mat-datepicker | ||
[startAt]="startAt" | ||
#datePicker></mat-datepicker> | ||
|
||
<mat-error | ||
*ngIf=" | ||
reservationDurationForm.get('reservationDate')?.errors?.[ | ||
'required' | ||
] | ||
" | ||
>Reservation Date is Required</mat-error | ||
> | ||
</mat-form-field> | ||
|
||
<mat-form-field class="w-full sm:flex-1 mb-4"> | ||
<mat-label>Start Time</mat-label> | ||
|
||
<input | ||
formControlName="startDateTime" | ||
autocomplete="off" | ||
readonly | ||
matInput | ||
[ngxTimepicker]="startTimePicker" /> | ||
<ngx-material-timepicker | ||
[timepickerClass]="'dine-a-night_time-picker'" | ||
#startTimePicker></ngx-material-timepicker> | ||
|
||
<mat-hint>HH:MM AM/PM</mat-hint> | ||
|
||
<mat-error | ||
*ngIf=" | ||
reservationDurationForm.get('startDateTime')?.errors?.[ | ||
'required' | ||
] | ||
" | ||
>Start Date is Required</mat-error | ||
> | ||
|
||
<mat-error | ||
*ngIf=" | ||
reservationDurationForm.get('startDateTime')?.errors?.[ | ||
'DateBeforeValidator' | ||
] | ||
" | ||
>Cannot be after end time</mat-error | ||
> | ||
</mat-form-field> | ||
|
||
<mat-form-field class="w-full sm:flex-1 mb-4"> | ||
<mat-label>End Time</mat-label> | ||
|
||
<input | ||
formControlName="endDateTime" | ||
autocomplete="off" | ||
readonly | ||
matInput | ||
[ngxTimepicker]="endTimePicker" /> | ||
<ngx-material-timepicker | ||
[timepickerClass]="'dine-a-night_time-picker'" | ||
#endTimePicker></ngx-material-timepicker> | ||
|
||
<mat-hint>HH:MM AM/PM</mat-hint> | ||
|
||
<mat-error | ||
*ngIf=" | ||
reservationDurationForm.get('endDateTime')?.errors?.['required'] | ||
" | ||
>End Date is Required</mat-error | ||
> | ||
|
||
<mat-error | ||
*ngIf=" | ||
reservationDurationForm.get('endDateTime')?.errors?.[ | ||
'DateAfterValidator' | ||
] | ||
" | ||
>Cannot be before Start Time</mat-error | ||
> | ||
</mat-form-field> | ||
</form> |
Empty file.
21 changes: 21 additions & 0 deletions
21
...-reservation-dialog/reservation-duration-form/reservation-duration-form.component.spec.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ReservationDurationFormComponent } from './reservation-duration-form.component'; | ||
|
||
describe('ReservationDurationFormComponent', () => { | ||
let component: ReservationDurationFormComponent; | ||
let fixture: ComponentFixture<ReservationDurationFormComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ReservationDurationFormComponent], | ||
}); | ||
fixture = TestBed.createComponent(ReservationDurationFormComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
13 changes: 13 additions & 0 deletions
13
...reate-reservation-dialog/reservation-duration-form/reservation-duration-form.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { FormGroup } from '@angular/forms'; | ||
|
||
@Component({ | ||
selector: 'reservation-duration-form', | ||
templateUrl: './reservation-duration-form.component.html', | ||
styleUrls: ['./reservation-duration-form.component.scss'], | ||
}) | ||
export class ReservationDurationFormComponent { | ||
@Input() reservationDurationForm: FormGroup; | ||
|
||
@Input() startAt: Date = new Date(Date.now()); | ||
} |
54 changes: 54 additions & 0 deletions
54
...s/reservations/reschedule-reservation-dialog/reschedule-reservation-dialog.component.html
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<h2 class="text-3xl font-bold text-center py-5 bg-slate-950 text-color-light" | ||
>Reschedule Reservation<mat-icon class="mx-2">date_range</mat-icon> | ||
</h2> | ||
|
||
<mat-dialog-content class="h-full"> | ||
<reservation-duration-form | ||
[reservationDurationForm]="reservationDurationForm" | ||
[startAt]="startAt"></reservation-duration-form> | ||
|
||
<div | ||
*ngIf="slotUnavailable" | ||
class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 my-2 rounded relative" | ||
role="alert"> | ||
<strong class="font-bold">Oops! </strong> | ||
<span class="block sm:inline" | ||
>This slot is already reserved. Please choose a different | ||
time.</span | ||
> | ||
</div> | ||
|
||
<restaurant-layout | ||
[selectionDisabled]="true" | ||
[restaurant]="restaurant" | ||
[unavailableTableIds]=" | ||
getUnavailableTableIds( | ||
currentReservations, | ||
startDateTime, | ||
endDateTime | ||
) | ||
" | ||
[selectedTable]="reservation.tables[0]"></restaurant-layout> | ||
</mat-dialog-content> | ||
|
||
<mat-dialog-actions | ||
class="absolute right-0 bottom-0 flex flex-wrap" | ||
[align]="'end'"> | ||
<button | ||
[disableRipple]="true" | ||
mat-dialog-close | ||
mat-raised-button> | ||
<mat-icon>cancel</mat-icon> | ||
Cancel | ||
</button> | ||
|
||
<button | ||
[disabled]="saveDisabled" | ||
[disableRipple]="true" | ||
mat-raised-button | ||
(click)="onRescheduleClick()" | ||
color="accent"> | ||
<mat-icon>today</mat-icon> | ||
Reschedule | ||
</button> | ||
</mat-dialog-actions> |
Empty file.
21 changes: 21 additions & 0 deletions
21
...eservations/reschedule-reservation-dialog/reschedule-reservation-dialog.component.spec.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { RescheduleReservationDialogComponent } from './reschedule-reservation-dialog.component'; | ||
|
||
describe('RescheduleReservationDialogComponent', () => { | ||
let component: RescheduleReservationDialogComponent; | ||
let fixture: ComponentFixture<RescheduleReservationDialogComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [RescheduleReservationDialogComponent], | ||
}); | ||
fixture = TestBed.createComponent(RescheduleReservationDialogComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
Oops, something went wrong.