Created
May 6, 2024 21:43
-
-
Save dersonsena/ba86e25aa0f9c23c1b4f16684837b1ba to your computer and use it in GitHub Desktop.
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
<ModalCustomerDetails isOpen={isOpenFullDetails} onClose={onCloseFullDetails} id={customerId} /> |
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
import { Modal } from '@/components/Common/Modal/Modal' | |
import { EssentialInformations, PaymentDetail } from './components' | |
import { useFetchCustomerDetail } from '../../hooks' | |
import { useEffect } from 'react' | |
import { useToast } from '@chakra-ui/react' | |
export const ModalCustomerDetails = ({ isOpen, onClose, id }) => { | |
const toast = useToast() | |
const { dataCustomer, errorCustomer, fetchCustomer, loadingCustomer } = useFetchCustomerDetail() | |
useEffect(() => { | |
if (!id || !isOpen) return | |
fetchCustomer(id) | |
}, [id]) | |
useEffect(() => { | |
if (!errorCustomer) return | |
toast({ | |
description: 'Erro ao exibir detalhes do Cliente.', | |
status: 'error', | |
duration: 2000, | |
isClosable: true, | |
position: 'top-right', | |
}) | |
onClose() | |
}, [errorCustomer]) | |
return ( | |
<Modal.Root isOpen={isOpen} onClose={onClose} size='6xl'> | |
<Modal.Header text={dataCustomer && dataCustomer.customerName} /> | |
<Modal.Body loading={loadingCustomer}> | |
<main className='px-3 flex flex-col gap-3'> | |
<EssentialInformations customer={dataCustomer} /> | |
{/* <CareerPath complete={complete} nextGraduation='Titan Sky Black' numberGraduation={3} /> */} | |
<PaymentDetail customer={dataCustomer} /> | |
{/* <DepositTable /> */} | |
{/* <Network customers={dataCustomer && dataCustomer.network} /> */} | |
</main> | |
</Modal.Body> | |
</Modal.Root> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment