Skip to content

Commit 02e6e42

Browse files
committed
fix(workplace): fix schedule filters for parking requests
1 parent 894522b commit 02e6e42

4 files changed

Lines changed: 25 additions & 13 deletions

File tree

apps/workplace/src/app/schedule/schedule-filter-card.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ import { ScheduleStateService } from './schedule-state.service';
7979
></mat-checkbox>
8080
</button>
8181
}
82-
@if (hasFeature('parking')) {
82+
@if (hasFeature('parking') || hasFeature('parking-requests')) {
8383
<button
8484
matRipple
8585
name="schedule-toggle-parking-filter"

apps/workplace/src/app/schedule/schedule-filters.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import { ScheduleStateService } from './schedule-state.service';
6161
}
6262
@if (
6363
(filters | async)?.shown_types?.includes('parking') &&
64-
hasFeature('parking')
64+
(hasFeature('parking') || hasFeature('parking-requests'))
6565
) {
6666
<div
6767
class="border-base-200 m-1 flex items-center rounded-3xl border"
@@ -192,7 +192,7 @@ import { ScheduleStateService } from './schedule-state.service';
192192
}
193193
@if (
194194
(filters | async)?.shown_types?.includes('parking') &&
195-
hasFeature('parking')
195+
(hasFeature('parking') || hasFeature('parking-requests'))
196196
) {
197197
<div
198198
class="border-base-200 bg-base-100 flex items-center rounded-3xl border pl-2 text-sm"

apps/workplace/src/app/schedule/schedule-sidebar.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ import {
170170
></mat-checkbox>
171171
</button>
172172
}
173-
@if (hasFeature('parking')) {
173+
@if (hasFeature('parking') || hasFeature('parking-requests')) {
174174
<button
175175
matRipple
176176
name="schedule-toggle-parking-filter"
@@ -369,7 +369,11 @@ export class ScheduleSidebarComponent extends AsyncHandler implements OnInit {
369369
.subscribe((_) => {
370370
this._state.setType('event', this.hasFeature('spaces'));
371371
this._state.setType('desk', this.hasFeature('desks'));
372-
this._state.setType('parking', this.hasFeature('parking'));
372+
this._state.setType(
373+
'parking',
374+
this.hasFeature('parking') ||
375+
this.hasFeature('parking-requests'),
376+
);
373377
this._state.setType(
374378
'visitor',
375379
this.hasFeature('visitor-invite'),

libs/bookings/src/lib/booking-details-modal.component.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,9 @@ import { DeskSettingsModalComponent } from './desk-settings-modal.component';
163163
<div>{{ period() }}</div>
164164
</div>
165165
<div class="flex items-center space-x-2 px-2">
166-
<icon
167-
matTooltip="Level and Resource"
168-
>{{ is_visitor() ? 'person' : 'map' }}</icon
169-
>
166+
<icon matTooltip="Level and Resource">{{
167+
is_visitor() ? 'person' : 'map'
168+
}}</icon>
170169
<div>
171170
@if (is_visitor()) {
172171
<div>{{ visitor_display_name() }}</div>
@@ -480,10 +479,17 @@ export class BookingDetailsModalComponent {
480479
const is_visitor = this.booking().booking_type === 'visitor';
481480
const visitor_edit_allowed =
482481
is_visitor && settingSignal('visitors.allow_editing', false)();
482+
const is_parking = this.booking().booking_type === 'parking';
483+
const features: string[] = settingSignal<string[]>('features', [])();
484+
const parking_allocated_edit_blocked =
485+
is_parking &&
486+
!!this.booking().asset_id &&
487+
!features.includes('parking');
483488
return (
484489
!this.booking().is_done &&
485490
!this.booking().checked_in &&
486-
(!is_visitor || visitor_edit_allowed)
491+
(!is_visitor || visitor_edit_allowed) &&
492+
!parking_allocated_edit_blocked
487493
);
488494
});
489495

@@ -679,7 +685,8 @@ export class BookingDetailsModalComponent {
679685
if (group_member_name) return group_member_name;
680686
const attendee_name = this._visitorAttendeeName(booking);
681687
if (attendee_name) return attendee_name;
682-
const asset_name = `${booking.extension_data?.visitor_name || booking.asset_name || ''}`.trim();
688+
const asset_name =
689+
`${booking.extension_data?.visitor_name || booking.asset_name || ''}`.trim();
683690
const reason_values = [
684691
`${booking.title || ''}`.trim().toLowerCase(),
685692
`${booking.description || ''}`.trim().toLowerCase(),
@@ -704,8 +711,9 @@ export class BookingDetailsModalComponent {
704711

705712
private _visitorAttendeeName(booking: Booking) {
706713
const attendee =
707-
(booking.attendees || []).find((item) => item?.email === booking.asset_id) ||
708-
booking.attendees?.[0];
714+
(booking.attendees || []).find(
715+
(item) => item?.email === booking.asset_id,
716+
) || booking.attendees?.[0];
709717
const name = `${attendee?.name || ''}`.trim();
710718
return name || '';
711719
}

0 commit comments

Comments
 (0)