9898 <strong >{{ request.approval_user.full_name }}</strong >
9999 </router-link >
100100 </p >
101+ <p v-else >
102+ Managed by: <strong >Not Provided</strong >
103+ </p >
101104 </div >
102105 </template >
103106 <v-divider v-if =" canManage(request)" ></v-divider >
@@ -188,27 +191,32 @@ export default defineComponent({
188191 userRequests .value .some (req => req .status === ' pending' || req .status === ' requested_to_cancel' )
189192 );
190193
194+ // Fetch logged-in user profile
191195 // Fetch logged-in user profile
192196 const loggedInUserTask = useAsyncState (async () => {
193197 const result = await $api .myprofile .getUser ();
194- if (tab .value === ' personal' ) {
198+ // Default selected user to self for all contexts initially
199+ if (result ) {
195200 selectedUser .value = result ;
196201 }
202+ // Load users list for everyone so they can explore
203+ fetchUsers ();
197204 return result ;
198205 }, null );
199206
207+ // Fetch users list (for explore tab)
200208 // Fetch users list (for explore tab)
201209 const fetchUsers = async () => {
202210 isLoadingUsers .value = true ;
203- if (isAdmin .value ) {
211+ try {
212+ // Now any user can check any user requests
213+ // Since we want consistency and listAllActiveOfficeUsers is handy:
204214 users .value = await listAllActiveOfficeUsers ($api );
205- } else {
206- const result = await $api .users .list ();
207- if (result ) {
208- users .value = result .results ;
209- }
215+ } catch (e ) {
216+ console .error (" Failed to fetch users" , e )
217+ } finally {
218+ isLoadingUsers .value = false ;
210219 }
211- isLoadingUsers .value = false ;
212220 };
213221
214222 // Fetch vacations based on current tab and filters
@@ -240,12 +248,16 @@ export default defineComponent({
240248 result = await $api .vacations .myTeamPendingRequests (query );
241249 } else {
242250 // Explore tab
243- if (! selectedUser .value ) {
244- userRequests .value = [];
245- vacationsCount .value = 0 ;
246- return ;
251+ const personalId = ApiClientBase .user .value ?.fullUser .id ;
252+ let targetUserId = personalId ;
253+
254+ if (selectedUser .value ) {
255+ targetUserId = selectedUser .value .id ;
256+ }
257+
258+ if (targetUserId ) {
259+ result = await $api .vacations .listUserRequests ({ ... query , user_id: targetUserId });
247260 }
248- result = await $api .vacations .listUserRequests ({ ... query , user_id: selectedUser .value .id });
249261 }
250262
251263 if (result ) {
@@ -268,6 +280,11 @@ export default defineComponent({
268280 };
269281
270282 const canManage = (request : Api .Vacation ) => {
283+ // Only admins and supervisors can manage requests
284+ if (! isAdmin .value && ! isSupervisor .value ) {
285+ return false ;
286+ }
287+
271288 const status = request .status ;
272289 const isPending = status === ' pending' || status === ' requested_to_cancel' ;
273290 if (! isPending ) return false ;
0 commit comments