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