/**
 * 
 * PDF Viewer
 * 
 */

import { useContext, useState } from 'react';

import { Button, Modal } from 'antd';

import PDFSignature from './pdf-signature';

import { useTranslation } from '../../../lib';

import { GlobalContext } from '../../../lib';


/**
 * 
 * 
 * @param {*} param0 
 * @returns 
 */
export default function ConsentComponent({ app_id, callback }) {

    const [openPreview, setOpenPreview] = useState(false);

    const { isMobile } = useContext(GlobalContext)

    const { t, i18n } = useTranslation(); // To Translate to another language

    return (
        <>

            <Button
                size="small"
                type="primary"
                onClick={() => {
                    setOpenPreview(true);
                }}
            >
                {t('Consent Upload')}
            </Button>
            <Modal
                height="100%"

                className="fullscreen-modal"
                style={{ top: 0 }}
                width={isMobile ? '100%' : '80%'}
                destroyOnClose={true}
                title={""}
                visible={openPreview}
                onOk={() => {
                    setOpenPreview(false);
                }}
                onCancel={() => {
                    setOpenPreview(false);
                }}
                footer={null}
            >
                <PDFSignature app_id={app_id} callback={callback} preview={setOpenPreview} />


            </Modal>
        </>
    )
}
