/* * Copyright 2020-2021 AskChristee, LLC. All rights reserved. */ import React, { Fragment } from 'react'; import { Document, Text, View, StyleSheet, Page, Image } from '@react-pdf/renderer'; import { PdfCash, PdfReportLogo } from '../../../atoms'; import { THecmAClose, THecmANotes, THecmCalc, THecmResponse } from '../../../../types/api'; import ReportTitle from '../../../atoms/Pdf/ReportTitle'; import PdfMessageReport from './HecmMessage'; import PdfMessageReportCash from './HecmMessageCash'; import ReportClose from './HecmClosing'; import logo from '../../../../images/christee-logo.png'; const styles = StyleSheet.create({ body: { 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', }, description: { textAlign: 'left', width: '43%', fontSize: 9, }, tableContainer: { flexDirection: 'row', flexWrap: 'wrap', marginTop: 15, }, row: { flexDirection: 'row', height: 16, }, acalc: { width: '33%', fontSize: 9, textAlign: 'left', }, logo: { width: 65, height: 15, position: 'absolute', bottom: 11, left: 65, }, copy: { fontSize: 9, position: 'absolute', bottom: 13, left: 10, }, }); interface CalcParams { aCalc: THecmCalc; bCalc: THecmCalc; aClose: THecmAClose; aNotes: THecmANotes; bNotes: THecmANotes; } interface Props { dat: THecmResponse; } const HecmPdfReport: React.FC = ({ aCalc, bCalc }) => { console.log('HECM->PDFHelper->aCalc:', aCalc); console.log('HECM->PDFHelper->bCalc:', bCalc); return ( State {aCalc && {aCalc.state_sel}} {bCalc && {bCalc.state_sel}} Loan Type {aCalc && {aCalc.report_type}} {bCalc && {bCalc.report_type}} Report Type {aCalc && {aCalc.fumess}} {bCalc && {bCalc.fumess}} Selected Area {aCalc && {aCalc.area}} {bCalc && {bCalc.area}} Interest Rate Entered {aCalc && {aCalc.temp_rate}%} {bCalc && {bCalc.temp_rate}%} Interest Rate Used (Note 1) {aCalc && {aCalc.ex_rate}%} {bCalc && {aCalc.ex_rate}%} Interest Rate with MIP (Note 2) {aCalc && {aCalc.act_rate}%} {bCalc && {bCalc.act_rate}%} Age of Youngest Borrower (Note 3) {aCalc && {aCalc.age}} {bCalc && {bCalc.age}} Maximum Claim Amount (Note 4) {aCalc && ( )} {bCalc && ( )} Purchase Price (Note 5) {aCalc && ( )} {bCalc && ( )} Base Loan Amount (Note 6) {aCalc && ( )} {bCalc && ( )} Loan To Value (Note 7) {aCalc && {aCalc.ltv}%} {bCalc && {bCalc.ltv}%} Principal Lending Factor (Note 8) {aCalc && {aCalc.plf_factor}} {bCalc && {bCalc.plf_factor}} Total Loan Amount (Note 9) {aCalc && ( )} {bCalc && ( )} Down Payment {aCalc && ( )} {bCalc && ( )} Estimated Closing Cost (Note 10) {aCalc && ( )} {bCalc && ( )} Required Cash (Note 11) {aCalc && ( )} {bCalc && ( )} Cash Available {aCalc && ( )} {bCalc && ( )} Additional Cash Required {aCalc && ( )} {bCalc && ( )} Annual Property Taxes (Note 11) {aCalc && ( )} {bCalc && ( )} Annual Property Insurance (Note 11) {aCalc && ( )} {bCalc && ( )} Estimated HECM Balance (Note 12) {aCalc && ( )} {bCalc && ( )} Accrued Interest (Note 12) {aCalc && ( )} {bCalc && ( )} Interest Only Payment (Note 13) {aCalc && ( )} {bCalc && ( )} ); }; const ContainerFinal: React.FC = ({ aCalc, bCalc, aClose, aNotes, bNotes }) => { return ( {bCalc && ( Powered By `${pageNumber} / ${totalPages}`} fixed /> Powered By `${pageNumber} / ${totalPages}`} fixed /> )} {!bCalc && ( Powered By `${pageNumber} / ${totalPages}`} fixed /> Powered By `${pageNumber} / ${totalPages}`} fixed /> )} ); }; const PdfReportContainer: React.FC = ({ dat: { hecm } }) => { const { aCalc, bCalc, aClose, aNotes, bNotes } = hecm; return ( ); }; export default PdfReportContainer;