-
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.
- Loading branch information
Showing
3 changed files
with
60 additions
and
57 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
57 changes: 22 additions & 35 deletions
57
FrontAdmin/src/components/Pages/Sysacad/ExcelSysacad/Resultado.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 |
---|---|---|
@@ -1,38 +1,25 @@ | ||
import datos from '../../../../API/Sysacad.ts'; | ||
import { useState, useEffect, JSXElementConstructor, Key, ReactElement, ReactNode, ReactPortal } from 'react'; | ||
import {Stack, Flex, Text} from '@chakra-ui/react'; | ||
interface DataItem { | ||
"id": string; | ||
"Apellido y Nombres": string | null; | ||
"Celular": string | null; | ||
"Tel. Resid"?: string | null; | ||
"Teléfono": string | null; | ||
import { Stack, Flex, Text, Link } from '@chakra-ui/react'; | ||
|
||
|
||
function Resultado({ data }: { data: any }) { | ||
|
||
if (data.length === 0) { | ||
console.log("No hay datos") | ||
return null; | ||
} | ||
|
||
//recibe los datos como parametros y los muestra en pantalla | ||
function Resultado(data: any) { | ||
|
||
|
||
useEffect(() => { | ||
//mapear a array de objetos pq viene un diccionario | ||
const dataArray = Object.entries(datos).map(([key, value]) => ({ | ||
id: key, | ||
...value | ||
})) as DataItem[]; | ||
//setData(dataArray); | ||
}, []); | ||
|
||
return ( | ||
<Stack mt={7}> | ||
<Text fontSize="xl" fontWeight="bold">Errores de formato encontrados. Por favor, revisar:</Text> | ||
{data.map((item: { [x: string]: any; id: string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null | undefined; }, index: Key | null | undefined) => ( | ||
<Flex key={index} direction="column" p={3} borderRadius="8px" mb={2} bg="#F8C0BB" w={800}> | ||
<Text fontWeight={500}> Error en la linea {item.id}, en el/los campo/s: {item["Apellido y Nombres"] && "Apellido y Nombres"} {item["Celular"] && "Celular"} {item["Tel. Resid"] && "Tel. Resid"} {item["Teléfono"] && "Teléfono"} | ||
</Text> | ||
</Flex> | ||
))} | ||
</Stack> | ||
); | ||
} | ||
|
||
export default Resultado; | ||
|
||
const { excel, duplicates, message, total } = data; | ||
|
||
return ( | ||
<Stack mt={7}> | ||
<Text fontSize="xl" fontWeight="bold">Datos cargados</Text> | ||
<Text>Duplicados: {duplicates}</Text> | ||
<Text>Mensaje: {message}</Text> | ||
<Text>Total: {total}</Text> | ||
</Stack> | ||
); | ||
} | ||
|
||
export default Resultado; |
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