|
@@ -6,9 +6,12 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/com
|
|
|
import { Input } from '@/components/ui/input';
|
|
import { Input } from '@/components/ui/input';
|
|
|
import { Label } from '@/components/ui/label';
|
|
import { Label } from '@/components/ui/label';
|
|
|
import { Alert, AlertDescription } from '@/components/ui/alert';
|
|
import { Alert, AlertDescription } from '@/components/ui/alert';
|
|
|
-import { Plus, Edit, Trash2, ArrowLeft } from 'lucide-react';
|
|
|
|
|
|
|
+import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
|
|
|
|
+import { Badge } from '@/components/ui/badge';
|
|
|
|
|
+import { Plus, Edit, Trash2, ArrowLeft, GraduationCap } from 'lucide-react';
|
|
|
import Link from 'next/link';
|
|
import Link from 'next/link';
|
|
|
import { DashboardLayout } from '@/components/dashboard-layout';
|
|
import { DashboardLayout } from '@/components/dashboard-layout';
|
|
|
|
|
+import { Spinner } from '@/components/ui/spinner';
|
|
|
|
|
|
|
|
interface Teacher {
|
|
interface Teacher {
|
|
|
id: string;
|
|
id: string;
|
|
@@ -147,7 +150,7 @@ export default function TeachersPage() {
|
|
|
if (loading) {
|
|
if (loading) {
|
|
|
return (
|
|
return (
|
|
|
<div className="min-h-screen flex items-center justify-center">
|
|
<div className="min-h-screen flex items-center justify-center">
|
|
|
- <div className="text-lg">Cargando profesores...</div>
|
|
|
|
|
|
|
+ <Spinner size="lg" />
|
|
|
</div>
|
|
</div>
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
@@ -161,7 +164,8 @@ export default function TeachersPage() {
|
|
|
<DashboardLayout breadcrumbs={breadcrumbs}>
|
|
<DashboardLayout breadcrumbs={breadcrumbs}>
|
|
|
<div className="space-y-6">
|
|
<div className="space-y-6">
|
|
|
<div className="flex justify-between items-center">
|
|
<div className="flex justify-between items-center">
|
|
|
- <h1 className="text-3xl font-bold">
|
|
|
|
|
|
|
+ <h1 className="text-3xl font-bold flex items-center gap-2">
|
|
|
|
|
+ <GraduationCap className="h-8 w-8" />
|
|
|
Gestión de Profesores
|
|
Gestión de Profesores
|
|
|
</h1>
|
|
</h1>
|
|
|
<Button onClick={() => setShowForm(true)}>
|
|
<Button onClick={() => setShowForm(true)}>
|
|
@@ -278,37 +282,35 @@ export default function TeachersPage() {
|
|
|
</CardHeader>
|
|
</CardHeader>
|
|
|
<CardContent>
|
|
<CardContent>
|
|
|
<div className="overflow-x-auto">
|
|
<div className="overflow-x-auto">
|
|
|
- <table className="w-full border-collapse">
|
|
|
|
|
- <thead>
|
|
|
|
|
- <tr className="border-b">
|
|
|
|
|
- <th className="text-left p-4">Nombre</th>
|
|
|
|
|
- <th className="text-left p-4">Email</th>
|
|
|
|
|
- <th className="text-left p-4">Cédula</th>
|
|
|
|
|
- <th className="text-left p-4">Teléfono</th>
|
|
|
|
|
- <th className="text-left p-4">Estado</th>
|
|
|
|
|
- <th className="text-left p-4">Acciones</th>
|
|
|
|
|
- </tr>
|
|
|
|
|
- </thead>
|
|
|
|
|
- <tbody>
|
|
|
|
|
|
|
+ <Table>
|
|
|
|
|
+ <TableHeader>
|
|
|
|
|
+ <TableRow>
|
|
|
|
|
+ <TableHead>Nombre</TableHead>
|
|
|
|
|
+ <TableHead>Email</TableHead>
|
|
|
|
|
+ <TableHead>Cédula</TableHead>
|
|
|
|
|
+ <TableHead>Teléfono</TableHead>
|
|
|
|
|
+ <TableHead>Estado</TableHead>
|
|
|
|
|
+ <TableHead className="text-right">Acciones</TableHead>
|
|
|
|
|
+ </TableRow>
|
|
|
|
|
+ </TableHeader>
|
|
|
|
|
+ <TableBody>
|
|
|
{teachers.map((teacher) => (
|
|
{teachers.map((teacher) => (
|
|
|
- <tr key={teacher.id} className="border-b hover:bg-gray-50">
|
|
|
|
|
- <td className="p-4">
|
|
|
|
|
|
|
+ <TableRow key={teacher.id}>
|
|
|
|
|
+ <TableCell className="font-medium">
|
|
|
{teacher.firstName} {teacher.lastName}
|
|
{teacher.firstName} {teacher.lastName}
|
|
|
- </td>
|
|
|
|
|
- <td className="p-4">{teacher.email}</td>
|
|
|
|
|
- <td className="p-4">{teacher.cedula}</td>
|
|
|
|
|
- <td className="p-4">{teacher.phone}</td>
|
|
|
|
|
- <td className="p-4">
|
|
|
|
|
- <span className={`px-2 py-1 rounded-full text-xs ${
|
|
|
|
|
- teacher.isActive
|
|
|
|
|
- ? 'bg-green-100 text-green-800'
|
|
|
|
|
- : 'bg-red-100 text-red-800'
|
|
|
|
|
- }`}>
|
|
|
|
|
|
|
+ </TableCell>
|
|
|
|
|
+ <TableCell>{teacher.email}</TableCell>
|
|
|
|
|
+ <TableCell>
|
|
|
|
|
+ <Badge variant="secondary">{teacher.cedula}</Badge>
|
|
|
|
|
+ </TableCell>
|
|
|
|
|
+ <TableCell>{teacher.phone}</TableCell>
|
|
|
|
|
+ <TableCell>
|
|
|
|
|
+ <Badge variant={teacher.isActive ? "default" : "outline"}>
|
|
|
{teacher.isActive ? 'Activo' : 'Inactivo'}
|
|
{teacher.isActive ? 'Activo' : 'Inactivo'}
|
|
|
- </span>
|
|
|
|
|
- </td>
|
|
|
|
|
- <td className="p-4">
|
|
|
|
|
- <div className="flex space-x-2">
|
|
|
|
|
|
|
+ </Badge>
|
|
|
|
|
+ </TableCell>
|
|
|
|
|
+ <TableCell className="text-right">
|
|
|
|
|
+ <div className="flex space-x-2 justify-end">
|
|
|
<Button
|
|
<Button
|
|
|
size="sm"
|
|
size="sm"
|
|
|
variant="outline"
|
|
variant="outline"
|
|
@@ -320,15 +322,16 @@ export default function TeachersPage() {
|
|
|
size="sm"
|
|
size="sm"
|
|
|
variant="outline"
|
|
variant="outline"
|
|
|
onClick={() => handleDelete(teacher.id)}
|
|
onClick={() => handleDelete(teacher.id)}
|
|
|
|
|
+ className="text-red-600 hover:text-red-700"
|
|
|
>
|
|
>
|
|
|
<Trash2 className="h-4 w-4" />
|
|
<Trash2 className="h-4 w-4" />
|
|
|
</Button>
|
|
</Button>
|
|
|
</div>
|
|
</div>
|
|
|
- </td>
|
|
|
|
|
- </tr>
|
|
|
|
|
|
|
+ </TableCell>
|
|
|
|
|
+ </TableRow>
|
|
|
))}
|
|
))}
|
|
|
- </tbody>
|
|
|
|
|
- </table>
|
|
|
|
|
|
|
+ </TableBody>
|
|
|
|
|
+ </Table>
|
|
|
{teachers.length === 0 && (
|
|
{teachers.length === 0 && (
|
|
|
<div className="text-center py-8 text-gray-500">
|
|
<div className="text-center py-8 text-gray-500">
|
|
|
No hay profesores registrados
|
|
No hay profesores registrados
|