@@ -19,6 +19,7 @@ import {
1919} from '@placeos/bookings' ;
2020import {
2121 AsyncHandler ,
22+ currentUser ,
2223 Desk ,
2324 firstTruthyValueFrom ,
2425 i18n ,
@@ -44,7 +45,7 @@ import { isBefore, startOfMinute } from 'date-fns';
4445 >
4546 <!-- Header -->
4647 <header
47- class="sticky top-0 z-10 m-2 h-14 w-[calc(100%-1rem)] min-w-[20rem] rounded border-none bg-base-200 p-2"
48+ class="bg-base-200 sticky top-0 z-10 m-2 h-14 w-[calc(100%-1rem)] min-w-[20rem] rounded border-none p-2"
4849 >
4950 <h2 class="px-2 text-xl font-medium">
5051 {{ 'BOOKINGS.DESK_AUTO_ASSIGNED_TITLE' | translate }}
@@ -84,7 +85,7 @@ import { isBefore, startOfMinute } from 'date-fns';
8485 <!-- Success Message -->
8586 <div class="mb-6 flex items-start space-x-3">
8687 <div
87- class="flex h-8 w-8 items-center justify-center rounded-full bg-success text-white"
88+ class="bg-success flex h-8 w-8 items-center justify-center rounded-full text-white"
8889 >
8990 <icon class="text-xl">done</icon>
9091 </div>
@@ -103,12 +104,12 @@ import { isBefore, startOfMinute } from 'date-fns';
103104
104105 <!-- Desk Details Card -->
105106 <div
106- class="mb-4 space-y-3 rounded-lg border border-base-200 bg-base-100 p-4"
107+ class="border-base-200 bg-base-100 mb-4 space-y-3 rounded-lg border p-4"
107108 >
108109 <div class="flex items-center space-x-2">
109110 <icon class="text-2xl">chair</icon>
110111 <div class="leading-tight">
111- <div class="text-xs uppercase tracking-wide">
112+ <div class="text-xs tracking-wide uppercase ">
112113 {{ 'RESOURCE.DESK' | translate }}
113114 </div>
114115 <div class="text-lg font-medium">
@@ -122,7 +123,7 @@ import { isBefore, startOfMinute } from 'date-fns';
122123 <div class="flex items-center space-x-2">
123124 <icon class="text-2xl">layers</icon>
124125 <div class="leading-tight">
125- <div class="text-xs uppercase tracking-wide">
126+ <div class="text-xs tracking-wide uppercase ">
126127 {{ 'COMMON.FLOOR' | translate }}
127128 </div>
128129 <div class="text-lg font-medium">
@@ -133,7 +134,7 @@ import { isBefore, startOfMinute } from 'date-fns';
133134 <div class="flex items-center space-x-2">
134135 <icon class="text-2xl">place</icon>
135136 <div class="leading-none">
136- <div class="text-xs uppercase tracking-wide">
137+ <div class="text-xs tracking-wide uppercase ">
137138 {{
138139 'BOOKINGS.DESK_NEIGHBOURHOOD'
139140 | translate
@@ -151,7 +152,7 @@ import { isBefore, startOfMinute } from 'date-fns';
151152 {{ 'BOOKINGS.DESK_LOCATION_ON_MAP' | translate }}
152153 </div>
153154 <div
154- class="relative h-64 overflow-hidden rounded-lg border border-base-200 bg-base-200 "
155+ class="border-base-200 bg-base-200 relative h-64 overflow-hidden rounded-lg border"
155156 >
156157 @if (map_url()) {
157158 <interactive-map
@@ -162,7 +163,7 @@ import { isBefore, startOfMinute } from 'date-fns';
162163 ></interactive-map>
163164 } @else {
164165 <div
165- class="flex h-full w-full items-center justify-center text-base-content opacity-30"
166+ class="text-base-content flex h-full w-full items-center justify-center opacity-30"
166167 >
167168 <div class="text-center">
168169 <icon class="mb-2 text-4xl">map</icon>
@@ -181,7 +182,7 @@ import { isBefore, startOfMinute } from 'date-fns';
181182
182183 <!-- Footer -->
183184 <footer
184- class="flex items-center justify-between gap-2 border-t border-base-200 p-4"
185+ class="border-base-200 flex items-center justify-between gap-2 border-t p-4"
185186 >
186187 <button
187188 btn
@@ -332,8 +333,22 @@ export class AutoAssignedDeskModalComponent
332333
333334 // Fallback to original logic if no nearby desk found
334335 if ( ! assigned_desk ) {
336+ // Prefer desks whose tags match the current user's groups
337+ const user_groups = currentUser ( ) ?. groups || [ ] ;
338+ const tag_matched = user_groups . length
339+ ? available_desks . filter (
340+ ( desk ) =>
341+ desk . tags ?. length &&
342+ desk . tags . some ( ( tag ) =>
343+ user_groups . includes ( tag ) ,
344+ ) ,
345+ )
346+ : [ ] ;
347+ const pool =
348+ tag_matched . length > 0 ? tag_matched : available_desks ;
349+
335350 // Group desks by level and find level with most available desks
336- const desks_by_level = available_desks . reduce (
351+ const desks_by_level = pool . reduce (
337352 ( acc , desk ) => {
338353 const zone_id = desk . zone ?. id || 'unknown' ;
339354 if ( ! acc [ zone_id ] ) {
0 commit comments