/* * Copyright 2020-2021 AskChristee, LLC. All rights reserved. */ /** * Rent or Buy PDF * * This files has both the PDF container and the report details as a function. * While report details could be separated out into it's own file, there * is no problem having it together, so the file includes all that is required. * * Also, as this PDF would be required in both the ask and tcb urls, having * it as a single file seems to be cleaner, but that may just be a * personal preference. * * TODO: pdf-helpers.rob should move into the Styles.js */ import React from 'react'; import { Document, Page, Text, StyleSheet, Image } from '@react-pdf/renderer'; import { View } from '@react-pdf/renderer'; import ReportTitle from '../../../atoms/Pdf/ReportTitle'; import styled from '@react-pdf/styled-components'; import ReportClose from '../ClosingAcalc'; import { TBoRANotes, TBuyOrRentResponseObject, TBuyOrRentResponseObjectV2, TResponseCoverPage } from '../../../../types/api'; import UserInfo from '../../../atoms/Pdf/UserInfo'; import { PdfReportLogo } from '../../../atoms'; import ReportHeader from '../../../atoms/Pdf/ReportHeader'; import logo from '../../../../images/christee-logo.png'; const Note = styled.Text` width: '100%'; text-align: left; font-size: 9px; `; type DetailProps = { aNotes: TBoRANotes; }; const styles = StyleSheet.create({ body: { // fontFamily: 'Roboto', paddingTop: 10, paddingBottom: 25, paddingHorizontal: 30, }, pageNumber: { position: 'absolute', fontSize: 9, bottom: 15, left: 0, right: 0, textAlign: 'center', color: 'black', }, image: { width: 70, height: 20, }, header: { fontSize: 12, marginBottom: 20, textAlign: 'center', color: 'grey', }, textbold: { // fontFamily: 'RobotoBold', fontWeight: 900, fontSize: 9, }, description: { textAlign: 'left', width: '100%', fontSize: 9, }, tableContainer: { flexDirection: 'row', flexWrap: 'wrap', marginTop: 10, }, row: { flexDirection: 'row', alignItems: 'center', height: 16, }, logo: { width: 65, height: 15, position: 'absolute', bottom: 11, left: 65, }, copy: { fontSize: 9, position: 'absolute', bottom: 13, left: 10, }, }); const ReportDetailsRefactor: React.FC = ({ aNotes }) => { return ( {aNotes.pdf_mess1} {aNotes.pdf_mess} {aNotes.pdf_head1} {aNotes.pdf_head2} {aNotes.pdf_head3} {aNotes.pdf_head4} {aNotes.pdf_mess2} {aNotes.pdf_mess3} {aNotes.pdf_mess5} {aNotes.pdf_mess6} {aNotes.pdf_mess7} {aNotes.pdf_mess8} {aNotes.pdf_mess9} {aNotes.pdf_mess10} {aNotes.pdf_mess11} {aNotes.pdf_mess12} {aNotes.pdf_mess13} {aNotes.pdf_mess14} {aNotes.pdf_mess15} {aNotes.pdf_mess16} {aNotes.pdf_mess17} {aNotes.pdf_mess18} {aNotes.pdf_mess19} {aNotes.pdf_mess20} {aNotes.pdf_mess21} {aNotes.pdf_mess22} {aNotes.pdf_mess23} {aNotes.pdf_mess24} {aNotes.pdf_mess25} {aNotes.pdf_mess26} {aNotes.pdf_mess27} {aNotes.pdf_mess28} {aNotes.pdf_mess29} {aNotes.pdf_mess30} {aNotes.pdf_mess31} {aNotes.pdf_mess32} {aNotes.pdf_mess33} {aNotes.pdf_mess34} {aNotes.pdf_mess35} {aNotes.pdf_mess36} {aNotes.pdf_mess37} {aNotes.pdf_mess38} {aNotes.pdf_mess39} ); }; interface Props { dat: { conventional: TBuyOrRentResponseObject | TBuyOrRentResponseObjectV2 | undefined; fha: TBuyOrRentResponseObject | TBuyOrRentResponseObjectV2 | undefined; va: TBuyOrRentResponseObject | TBuyOrRentResponseObjectV2 | undefined; usda: TBuyOrRentResponseObject | TBuyOrRentResponseObjectV2 | undefined; coverPage: TResponseCoverPage; }; } const PdfReportContainer: React.FC = ({ dat: { conventional, fha, va, usda, coverPage } }) => { let title = ''; return ( {conventional?.aNotes && ( {!!(coverPage.name && coverPage.email) && } Powered By `${pageNumber} / ${totalPages}`} fixed /> )} {conventional?.aNotes && ( Powered By `${pageNumber} / ${totalPages}`} fixed /> )} {fha?.aNotes && ( Powered By `${pageNumber} / ${totalPages}`} fixed /> )} {fha?.aNotes && ( Powered By `${pageNumber} / ${totalPages}`} fixed /> )} {va?.aNotes && ( Powered By `${pageNumber} / ${totalPages}`} fixed /> )} {va?.aNotes && ( Powered By `${pageNumber} / ${totalPages}`} fixed /> )} {usda?.aNotes && ( Powered By `${pageNumber} / ${totalPages}`} fixed /> )} {usda?.aNotes && ( Powered By `${pageNumber} / ${totalPages}`} fixed /> )} ); }; export default PdfReportContainer;