import React from 'react'; import clsx from 'classnames'; import { get } from 'lodash'; import { Group, GroupProps, Stack } from '@/components'; import styles from './InvoicePaperTemplate.module.scss'; export interface PaperTemplateProps { primaryColor?: string; secondaryColor?: string; showCompanyLogo?: boolean; companyLogoUri?: string; companyName?: string; bigtitle?: string; children?: React.ReactNode; } export function PaperTemplate({ primaryColor, secondaryColor, showCompanyLogo, companyLogoUri, bigtitle = 'Invoice', children, }: PaperTemplateProps) { return (

{bigtitle}

{showCompanyLogo && companyLogoUri && (
)}
{children}
); } interface PaperTemplateTableProps { columns: Array<{ accessor: string; label: string; align?: 'left' | 'center' | 'right'; }>; data: Array>; } PaperTemplate.Table = ({ columns, data }: PaperTemplateTableProps) => { return ( {columns.map((col, index) => ( ))} {data.map((_data: any) => ( {columns.map((column, index) => ( ))} ))}
{col.label}
{get(_data, column.accessor)}
); }; export enum PaperTemplateTotalBorder { Gray = 'gray', Dark = 'dark', } PaperTemplate.Totals = ({ children }: { children: React.ReactNode }) => { return
{children}
; }; PaperTemplate.TotalLine = ({ label, amount, border, style, }: { label: string; amount: string; border?: PaperTemplateTotalBorder; style?: any; }) => { return (
{label}
{amount}
); }; PaperTemplate.MutedText = () => {}; PaperTemplate.Text = () => {}; PaperTemplate.AddressesGroup = (props: GroupProps) => { return ; }; PaperTemplate.Address = ({ items, }: { items: Array; }) => { return ( {items.map((item, index) => (
{item}
))}
); }; PaperTemplate.Statement = ({ label, children, }: { label: string; children: React.ReactNode; }) => { return (
{label &&
{label}
}
{children}
); }; PaperTemplate.TermsList = ({ children }: { children: React.ReactNode }) => { return
{children}
; }; PaperTemplate.TermsItem = ({ label, children, }: { label: string; children: React.ReactNode; }) => { return (
{label}
{children}
); };