mirror of
https://github.com/BreizhHardware/Site-comptage-heure.git
synced 2026-01-18 16:17:28 +01:00
feat: add total summary section to dashboard and ensure upload directory creation
This commit is contained in:
@@ -611,7 +611,9 @@ export default function AdminPage() {
|
||||
checked={forceDelete}
|
||||
onChange={(e) => setForceDelete(e.target.checked)}
|
||||
/>
|
||||
<Label htmlFor="force">Forcer la suppression même si l'utilisateur a des heures</Label>
|
||||
<Label htmlFor="force">
|
||||
Forcer la suppression même si l'utilisateur a des heures
|
||||
</Label>
|
||||
</div>
|
||||
</DialogDescription>
|
||||
<DialogFooter>
|
||||
@@ -630,7 +632,8 @@ export default function AdminPage() {
|
||||
<DialogTitle>Confirmation de suppression forcée</DialogTitle>
|
||||
</DialogHeader>
|
||||
<DialogDescription>
|
||||
Cette action supprimera l'utilisateur sans tenir compte de ses heures. Êtes-vous sûr ?
|
||||
Cette action supprimera l'utilisateur sans tenir compte de ses
|
||||
heures. Êtes-vous sûr ?
|
||||
</DialogDescription>
|
||||
<DialogFooter>
|
||||
<Button onClick={() => setShowForceModal(false)}>Annuler</Button>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { writeFile } from 'fs/promises';
|
||||
import { writeFile, mkdir } from 'fs/promises';
|
||||
import path from 'path';
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
@@ -29,6 +29,7 @@ export async function POST(request: NextRequest) {
|
||||
const filename = `${Date.now()}-${file.name}`;
|
||||
const filepath = path.join(process.cwd(), 'public', 'uploads', filename);
|
||||
|
||||
await mkdir(path.dirname(filepath), { recursive: true });
|
||||
await writeFile(filepath, buffer);
|
||||
|
||||
return NextResponse.json({ path: `/uploads/${filename}` });
|
||||
|
||||
@@ -150,6 +150,23 @@ export default function DashboardPage() {
|
||||
return (
|
||||
<div className="container mx-auto p-4">
|
||||
<h1 className="text-2xl font-bold mb-4">Tableau de bord</h1>
|
||||
<div className="mb-4">
|
||||
<h2 className="text-xl font-bold">Totaux</h2>
|
||||
<div className="flex space-x-4">
|
||||
<div>
|
||||
<h3 className="font-semibold">En attente</h3>
|
||||
<p>{formatHours(totalPending)}</p>
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="font-semibold">Validées</h3>
|
||||
<p>{formatHours(totalValidated)}</p>
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="font-semibold">Rejetées</h3>
|
||||
<p>{formatHours(totalRejected)}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{isMember && (
|
||||
<Card className="mb-4">
|
||||
<CardHeader>
|
||||
@@ -292,23 +309,6 @@ export default function DashboardPage() {
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
<div className="mt-4">
|
||||
<h2 className="text-xl font-bold">Totaux</h2>
|
||||
<div className="flex space-x-4">
|
||||
<div>
|
||||
<h3 className="font-semibold">En attente</h3>
|
||||
<p>{formatHours(totalPending)}</p>
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="font-semibold">Validées</h3>
|
||||
<p>{formatHours(totalValidated)}</p>
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="font-semibold">Rejetées</h3>
|
||||
<p>{formatHours(totalRejected)}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user