nice
This commit is contained in:
parent
9df9847c8a
commit
fd6d4e2ae2
@ -3,7 +3,6 @@ import { BrowserQRCodeReader } from '@zxing/browser';
|
||||
import { timeApi } from '../api/time';
|
||||
import { useAuth } from '../context/useAuth';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
@ -241,37 +240,26 @@ const TimeClockPage = () => {
|
||||
if (!user) return '';
|
||||
|
||||
return String(
|
||||
user.id ??
|
||||
user.pk ??
|
||||
user.user_id ??
|
||||
user.user?.id ??
|
||||
''
|
||||
user.id
|
||||
);
|
||||
};
|
||||
|
||||
const getUserLabel = (user) => {
|
||||
if (!user) return 'Utilisateur';
|
||||
|
||||
const firstName = user.first_name || user.firstName || '';
|
||||
const lastName = user.last_name || user.lastName || '';
|
||||
const firstName = user.first_name || '';
|
||||
const lastName = user.last_name || '';
|
||||
const fullName = `${firstName} ${lastName}`.trim();
|
||||
|
||||
return (
|
||||
fullName ||
|
||||
user.username ||
|
||||
user.name ||
|
||||
user.email ||
|
||||
`Utilisateur #${getUserId(user)}`
|
||||
`Utilisateur #${user.id}`
|
||||
);
|
||||
};
|
||||
|
||||
const getEntryUserId = (entry) => {
|
||||
return String(
|
||||
entry.user_id ??
|
||||
entry.userId ??
|
||||
entry.user?.id ??
|
||||
entry.user?.pk ??
|
||||
''
|
||||
entry.user.id
|
||||
);
|
||||
};
|
||||
|
||||
@ -312,16 +300,7 @@ const TimeClockPage = () => {
|
||||
|
||||
if (!id || usersById.has(id)) return;
|
||||
|
||||
const entryUser =
|
||||
typeof entry.user === 'object' && entry.user
|
||||
? entry.user
|
||||
: {
|
||||
id,
|
||||
username: entry.username,
|
||||
name: entry.user,
|
||||
};
|
||||
|
||||
usersById.set(id, entryUser);
|
||||
usersById.set(id, entry.user);
|
||||
});
|
||||
|
||||
availableUsers = [...usersById.values()];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user