-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/Seminario-Integrador-2024/Ge…
…stionTUP into dev
- Loading branch information
Showing
6 changed files
with
108 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
FrontAdmin/src/components/Pages/Estadisticas/SubPages/Inhabilitaciones/TablaDetalles.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { Table, Tr, Th,Thead, Tbody, Td, Checkbox } from '@chakra-ui/react'; | ||
import { formatoFechaISOaDDMMAAAA } from '../../../../../utils/general'; | ||
import { useNavigate } from 'react-router-dom'; | ||
interface TablaProps { | ||
headers: string[]; | ||
data: Array<Record<string, any>>; | ||
} | ||
|
||
const TablaDetalle: React.FC<TablaProps> = ({ headers, data}) => { | ||
const [renderKey, setRenderKey] = useState(0); | ||
const navigate = useNavigate(); | ||
|
||
const keyMap: { [key: string]: string } = { | ||
'Apellido y Nombre': 'full_name', | ||
'DNI': 'user', | ||
'Legajo': 'legajo', | ||
'Desde': 'fecha_inhabilitacion', | ||
'Tipo': 'tipo', | ||
'Fecha Vencimiento': 'fecha_vencimiento', | ||
'Monto': 'monto' | ||
}; | ||
|
||
return ( | ||
<Table key={renderKey} variant="simple" p={4} borderWidth={1} borderColor={'grey.500'}> | ||
<Thead> | ||
<Tr> | ||
{headers.map((header) => ( | ||
<Th fontFamily="Helvetica" fontWeight="900" key={header}>{header}</Th> | ||
))} | ||
</Tr> | ||
</Thead> | ||
<Tbody> | ||
{data.map((row) => ( | ||
<Tr key={row.user} cursor="pointer" _hover={{ | ||
bg: 'gray.200', // Color de fondo cuando el cursor está sobre la fila | ||
cursor: 'pointer', // Cambiar el cursor para indicar que es un enlace | ||
}}> | ||
{headers.map((header) => ( | ||
<Td key={header}> | ||
{header === 'Desde' | ||
? row[keyMap[header]] | ||
? new Date(row[keyMap[header]]).toLocaleDateString() | ||
: 'N/A' | ||
: header === 'Legajo' || header === 'DNI' | ||
? new Intl.NumberFormat('es-ES').format(row[keyMap[header]]) | ||
: header === 'Monto' | ||
? `$${new Intl.NumberFormat('es-ES').format(row[keyMap[header]])}` | ||
: header === 'Fecha Vencimiento' | ||
? formatoFechaISOaDDMMAAAA(row[keyMap[header]]) | ||
: row[keyMap[header]]} | ||
</Td> | ||
))} | ||
</Tr> | ||
))} | ||
</Tbody> | ||
</Table> | ||
); | ||
}; | ||
|
||
export default TablaDetalle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters