mirror of
https://github.com/BreizhHardware/Site-comptage-heure.git
synced 2026-03-18 21:30:40 +01:00
fix: update import paths for components and utilities to relative paths
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
import { useSession } from 'next-auth/react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Button } from '../../components/ui/button';
|
||||
import { Input } from '../../components/ui/input';
|
||||
import { Label } from '../../components/ui/label';
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
@@ -13,8 +13,8 @@ import {
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/components/ui/table';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
} from '../../components/ui/table';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '../../components/ui/card';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
@@ -22,9 +22,9 @@ import {
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog';
|
||||
} from '../../components/ui/dialog';
|
||||
import { toast } from 'sonner';
|
||||
import { DatePicker } from '@/components/ui/date-picker';
|
||||
import { DatePicker } from '../../components/ui/date-picker';
|
||||
import { format } from 'date-fns';
|
||||
|
||||
interface Hour {
|
||||
@@ -94,7 +94,7 @@ export default function AdminPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleValidate = async (id: number, status: string) => {
|
||||
const handleValidate = async (id: string, status: string) => {
|
||||
await fetch(`/api/hours/${id}`, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
@@ -179,7 +179,7 @@ export default function AdminPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
const handleDelete = async (id: string) => {
|
||||
await fetch(`/api/hours/${id}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
@@ -330,14 +330,14 @@ export default function AdminPage() {
|
||||
<Button
|
||||
onClick={() => handleValidate(hour.id, 'VALIDATED')}
|
||||
className="mr-2"
|
||||
disabled={hour.userId === session.user.id}
|
||||
disabled={hour.userId === session?.user?.id}
|
||||
>
|
||||
Valider
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => handleDelete(hour.id)}
|
||||
variant="destructive"
|
||||
disabled={hour.userId === session.user.id}
|
||||
disabled={hour.userId === session?.user?.id}
|
||||
>
|
||||
Supprimer
|
||||
</Button>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import NextAuth from 'next-auth';
|
||||
import { authOptions } from '@/lib/auth';
|
||||
import { authOptions } from '../../../../lib/auth'
|
||||
|
||||
const handler = NextAuth(authOptions);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { getServerSession } from 'next-auth';
|
||||
import { authOptions } from '@/lib/auth';
|
||||
import { prisma } from '@/lib/prisma';
|
||||
import { authOptions } from '../../../../lib/auth';
|
||||
import { prisma } from '../../../../lib/prisma';
|
||||
import bcrypt from 'bcryptjs';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { getServerSession } from 'next-auth';
|
||||
import { authOptions } from '@/lib/auth';
|
||||
import { prisma } from '@/lib/prisma';
|
||||
import { authOptions } from '../../../lib/auth';
|
||||
import { prisma } from '../../../lib/prisma';
|
||||
import * as csvWriter from 'csv-writer';
|
||||
import ExcelJS from 'exceljs';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { getServerSession } from 'next-auth';
|
||||
import { authOptions } from '@/lib/auth';
|
||||
import { prisma } from '@/lib/prisma';
|
||||
import { authOptions } from '../../../../lib/auth';
|
||||
import { prisma } from '../../../../lib/prisma';
|
||||
|
||||
export async function PUT(
|
||||
request: NextRequest,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { getServerSession } from 'next-auth';
|
||||
import { authOptions } from '@/lib/auth';
|
||||
import { prisma } from '@/lib/prisma';
|
||||
import { authOptions } from '../../../lib/auth';
|
||||
import { prisma } from '../../../lib/prisma';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
export async function GET() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { getServerSession } from 'next-auth';
|
||||
import { authOptions } from '@/lib/auth';
|
||||
import { prisma } from '@/lib/prisma';
|
||||
import { authOptions } from '../../../lib/auth';
|
||||
import { prisma } from '../../../lib/prisma';
|
||||
|
||||
export async function GET() {
|
||||
const settings = await prisma.clubSettings.findFirst();
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { getServerSession } from 'next-auth';
|
||||
import { authOptions } from '@/lib/auth';
|
||||
import { prisma } from '@/lib/prisma';
|
||||
import { authOptions } from '../../../../lib/auth';
|
||||
import { prisma } from '../../../../lib/prisma';
|
||||
|
||||
export async function DELETE(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { id: string } },
|
||||
{ params }: { params: Promise<{ id: string }> },
|
||||
) {
|
||||
const session = await getServerSession(authOptions);
|
||||
if (!session || session.user.role !== 'SUPER_ADMIN') {
|
||||
return NextResponse.json({ error: 'Accès refusé' }, { status: 403 });
|
||||
}
|
||||
|
||||
const userId = params.id;
|
||||
const { id } = await params;
|
||||
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { id: userId },
|
||||
where: { id },
|
||||
include: { hours: true },
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ export async function DELETE(
|
||||
}
|
||||
|
||||
await prisma.user.delete({
|
||||
where: { id: userId },
|
||||
where: { id },
|
||||
});
|
||||
|
||||
return NextResponse.json({ message: 'Utilisateur supprimé' });
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import { useSession } from 'next-auth/react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Button } from '../../components/ui/button';
|
||||
import { Input } from '../../components/ui/input';
|
||||
import { Label } from '../../components/ui/label';
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
@@ -13,8 +13,8 @@ import {
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/components/ui/table';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
} from '../../components/ui/table';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '../../components/ui/card';
|
||||
|
||||
interface Hour {
|
||||
id: number;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { Metadata } from 'next';
|
||||
import { Geist, Geist_Mono } from 'next/font/google';
|
||||
import './globals.css';
|
||||
import { Providers } from '@/components/providers';
|
||||
import Header from '@/components/Header';
|
||||
import { Toaster } from '@/components/ui/sonner';
|
||||
import { Providers } from '../components/providers';
|
||||
import Header from '../components/Header';
|
||||
import { Toaster } from '../components/ui/sonner';
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: '--font-geist-sans',
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { signIn } from 'next-auth/react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Button } from '../../components/ui/button';
|
||||
import { Input } from '../../components/ui/input';
|
||||
import { Label } from '../../components/ui/label';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '../../components/ui/card';
|
||||
|
||||
export default function LoginPage() {
|
||||
const [email, setEmail] = useState('');
|
||||
|
||||
Reference in New Issue
Block a user