@@ -12,6 +12,7 @@ import {
1212} from '@angular/core' ;
1313import { FormsModule , ReactiveFormsModule , Validators } from '@angular/forms' ;
1414import { MatAutocompleteModule } from '@angular/material/autocomplete' ;
15+ import { MatCheckboxModule } from '@angular/material/checkbox' ;
1516import { MatFormFieldModule } from '@angular/material/form-field' ;
1617import { MatInputModule } from '@angular/material/input' ;
1718import { MatSelectModule } from '@angular/material/select' ;
@@ -79,35 +80,45 @@ import { BookingFormService } from './booking-form.service';
7980 formControlName="date"
8081 ></a-date-field>
8182 </div>
82- <div class="flex items-center space-x-2">
83- <div class="flex w-1/3 flex-1 flex-col">
84- <label for="start-time">
85- {{ 'FORM.TIME_START' | translate }}
86- <span>*</span>
87- </label>
88- <a-time-field
89- name="start-time"
90- [ngModel]="form.value.date"
91- (ngModelChange)="form.patchValue({ date: $event })"
92- [ngModelOptions]="{ standalone: true }"
93- [disabled]="form.value.all_day"
94- [use_24hr]="use_24hr()"
95- ></a-time-field>
83+ @if (allow_all_day) {
84+ <div class="-mt-2 mb-2 flex justify-end">
85+ <mat-checkbox formControlName="all_day">
86+ {{ 'COMMON.ALL_DAY' | translate }}
87+ </mat-checkbox>
9688 </div>
97- <div class="flex w-1/3 flex-1 flex-col">
98- <label for="end-time">
99- {{ 'FORM.TIME_END' | translate }}
100- <span>*</span>
101- </label>
102- <a-duration-field
103- name="end-time"
104- formControlName="duration"
105- [time]="form.value.date"
106- [max]="max_duration()"
107- [use_24hr]="use_24hr()"
108- ></a-duration-field>
89+ }
90+ @if (!form.value.all_day) {
91+ <div class="flex items-center space-x-2">
92+ <div class="flex w-1/3 flex-1 flex-col">
93+ <label for="start-time">
94+ {{ 'FORM.TIME_START' | translate }}
95+ <span>*</span>
96+ </label>
97+ <a-time-field
98+ name="start-time"
99+ [ngModel]="form.value.date"
100+ (ngModelChange)="
101+ form.patchValue({ date: $event })
102+ "
103+ [ngModelOptions]="{ standalone: true }"
104+ [use_24hr]="use_24hr()"
105+ ></a-time-field>
106+ </div>
107+ <div class="flex w-1/3 flex-1 flex-col">
108+ <label for="end-time">
109+ {{ 'FORM.TIME_END' | translate }}
110+ <span>*</span>
111+ </label>
112+ <a-duration-field
113+ name="end-time"
114+ formControlName="duration"
115+ [time]="form.value.date"
116+ [max]="max_duration()"
117+ [use_24hr]="use_24hr()"
118+ ></a-duration-field>
119+ </div>
109120 </div>
110- </div>
121+ }
111122 @if (can_book_for_others()) {
112123 <div class="flex w-full flex-col">
113124 <label for="host">
@@ -274,6 +285,7 @@ import { BookingFormService } from './booking-form.service';
274285 MatFormFieldModule ,
275286 MatInputModule ,
276287 MatSelectModule ,
288+ MatCheckboxModule ,
277289 UserListFieldComponent ,
278290 MatAutocompleteModule ,
279291 UserSearchFieldComponent ,
@@ -342,6 +354,13 @@ export class VisitorInviteFormComponent
342354 return this . _settings . time_format ;
343355 }
344356
357+ public get allow_all_day ( ) {
358+ return (
359+ this . _settings . get ( 'app.visitors.allow_all_day' ) ??
360+ this . _settings . get ( 'app.bookings.allow_all_day' )
361+ ) ;
362+ }
363+
345364 public async ngOnInit ( ) {
346365 this . _service . clearOldState ( ) ;
347366 await this . initFormZone ( ) ;
0 commit comments