test
This commit is contained in:
parent
df93a1945d
commit
503172f537
@ -1428,17 +1428,6 @@ const TimeClockPage = () => {
|
||||
|
||||
|
||||
try {
|
||||
/* =====================================================
|
||||
GROUPE MULTI-JOURS
|
||||
|
||||
On ne modifie que :
|
||||
- start_time de la première ligne
|
||||
- end_time de la dernière ligne
|
||||
|
||||
Les dates restent celles du groupe car le serializer
|
||||
actuel de mise à jour ne gère pas date/end_date.
|
||||
====================================================== */
|
||||
|
||||
if (
|
||||
editingEntry.isGrouped
|
||||
) {
|
||||
@ -1493,10 +1482,6 @@ const TimeClockPage = () => {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Cas très improbable où le groupe ne possède
|
||||
* qu'une seule ligne.
|
||||
*/
|
||||
if (
|
||||
firstEntry.id ===
|
||||
lastEntry.id
|
||||
@ -1511,11 +1496,6 @@ const TimeClockPage = () => {
|
||||
},
|
||||
);
|
||||
} else {
|
||||
/*
|
||||
* Première journée :
|
||||
* on conserve son end_time = 23:59:59
|
||||
* et on change uniquement start_time.
|
||||
*/
|
||||
await timeApi.updateTimeEntry(
|
||||
firstEntry.id,
|
||||
{
|
||||
@ -1527,11 +1507,6 @@ const TimeClockPage = () => {
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* Dernière journée :
|
||||
* on conserve son start_time = 00:00
|
||||
* et on change uniquement end_time.
|
||||
*/
|
||||
await timeApi.updateTimeEntry(
|
||||
lastEntry.id,
|
||||
{
|
||||
@ -1543,11 +1518,6 @@ const TimeClockPage = () => {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Pointage classique :
|
||||
* le backend actuel ne prend en charge que
|
||||
* start_time/end_time pour la modification.
|
||||
*/
|
||||
await timeApi.updateTimeEntry(
|
||||
editingEntry.id,
|
||||
{
|
||||
@ -1598,10 +1568,6 @@ const TimeClockPage = () => {
|
||||
entry.sourceEntries,
|
||||
)
|
||||
) {
|
||||
/*
|
||||
* Suppression de toutes les lignes
|
||||
* appartenant au même group_id.
|
||||
*/
|
||||
for (
|
||||
const sourceEntry of
|
||||
entry.sourceEntries
|
||||
@ -2328,6 +2294,9 @@ const TimeClockPage = () => {
|
||||
RENDER
|
||||
========================================================= */
|
||||
|
||||
const scanConflictConfig =
|
||||
getScanConflictConfig();
|
||||
|
||||
return (
|
||||
<Card className="flex h-full min-h-0 w-full flex-col overflow-y-auto lg:overflow-hidden">
|
||||
|
||||
@ -2392,78 +2361,73 @@ const TimeClockPage = () => {
|
||||
)}
|
||||
|
||||
|
||||
{/* =========================
|
||||
CONFLIT
|
||||
========================== */}
|
||||
{/* =====================================================
|
||||
DIALOG CONFLIT DE POINTAGE
|
||||
====================================================== */}
|
||||
|
||||
{scanConflict && (
|
||||
<Card className="mb-6">
|
||||
<CardHeader className="border-b">
|
||||
<CardTitle>
|
||||
{scanConflict.step ===
|
||||
<Dialog
|
||||
open={Boolean(scanConflict)}
|
||||
onOpenChange={(open) => {
|
||||
if (!open) {
|
||||
cancelScanConflict();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<DialogContent className="w-[calc(100%-2rem)] max-w-md">
|
||||
<DialogHeader>
|
||||
<DialogTitle>
|
||||
{scanConflict?.step ===
|
||||
'confirm'
|
||||
? 'Confirmation du pointage'
|
||||
: 'Heure manquante'}
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<CardContent className="space-y-4">
|
||||
{(() => {
|
||||
const config =
|
||||
getScanConflictConfig();
|
||||
{scanConflictConfig && (
|
||||
<div className="space-y-4">
|
||||
|
||||
if (!config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (
|
||||
scanConflict.step ===
|
||||
'confirm'
|
||||
) {
|
||||
return (
|
||||
<>
|
||||
<p>
|
||||
{
|
||||
config.confirmationMessage
|
||||
}
|
||||
</p>
|
||||
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Button
|
||||
type="button"
|
||||
onClick={
|
||||
startScanConflictResolution
|
||||
}
|
||||
>
|
||||
Oui, continuer
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
variant="secondary"
|
||||
onClick={
|
||||
cancelScanConflict
|
||||
}
|
||||
>
|
||||
Non, annuler
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
{scanConflict.step ===
|
||||
'confirm' ? (
|
||||
<>
|
||||
<p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{
|
||||
config.confirmationMessage
|
||||
scanConflictConfig.confirmationMessage
|
||||
}
|
||||
</p>
|
||||
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:justify-end">
|
||||
<Button
|
||||
type="button"
|
||||
variant="secondary"
|
||||
onClick={
|
||||
cancelScanConflict
|
||||
}
|
||||
>
|
||||
Non, annuler
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
onClick={
|
||||
startScanConflictResolution
|
||||
}
|
||||
>
|
||||
Oui, continuer
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{
|
||||
scanConflictConfig.confirmationMessage
|
||||
}
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<Label>
|
||||
{
|
||||
config.timeLabel
|
||||
scanConflictConfig.timeLabel
|
||||
}
|
||||
</Label>
|
||||
|
||||
@ -2479,16 +2443,7 @@ const TimeClockPage = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Button
|
||||
type="button"
|
||||
onClick={
|
||||
resolveScanConflict
|
||||
}
|
||||
>
|
||||
Enregistrer
|
||||
</Button>
|
||||
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:justify-end">
|
||||
<Button
|
||||
type="button"
|
||||
variant="secondary"
|
||||
@ -2498,13 +2453,23 @@ const TimeClockPage = () => {
|
||||
>
|
||||
Annuler
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
onClick={
|
||||
resolveScanConflict
|
||||
}
|
||||
>
|
||||
Enregistrer
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
})()}
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
)}
|
||||
|
||||
</div>
|
||||
)}
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
|
||||
{/* =====================================================
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user