Merge pull request #673 from bigcapitalhq/fix-invoice-customize-bugs

fix: Invoice customize bugs
This commit is contained in:
Ahmed Bouhuolia
2024-09-25 15:21:12 +02:00
committed by GitHub
6 changed files with 62 additions and 24 deletions

View File

@@ -0,0 +1,9 @@
export const DefaultPdfTemplateTerms = 'All services provided are non-refundable. For any disputes, please contact us within 7 days of receiving this invoice.';
export const DefaultPdfTemplateStatement =
'Thank you for your business. We look forward to working with you again!';
export const DefaultPdfTemplateItemName = 'Web development';
export const DefaultPdfTemplateItemDescription =
'Website development with content and SEO optimization';

View File

@@ -1,8 +1,14 @@
import { Group, Stack } from '@/components'; import { Stack } from '@/components';
import { import {
PaperTemplate, PaperTemplate,
PaperTemplateProps, PaperTemplateProps,
} from '../../Invoices/InvoiceCustomize/PaperTemplate'; } from '../../Invoices/InvoiceCustomize/PaperTemplate';
import {
DefaultPdfTemplateTerms,
DefaultPdfTemplateItemDescription,
DefaultPdfTemplateStatement,
DefaultPdfTemplateItemName,
} from '@/constants/PdfTemplates';
export interface CreditNotePaperTemplateProps extends PaperTemplateProps { export interface CreditNotePaperTemplateProps extends PaperTemplateProps {
// Address // Address
@@ -95,18 +101,18 @@ export function CreditNotePaperTemplate({
// Customer note // Customer note
showCustomerNote = true, showCustomerNote = true,
customerNote = 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.', customerNote = DefaultPdfTemplateStatement,
customerNoteLabel = 'Customer Note', customerNoteLabel = 'Customer Note',
// Terms & conditions // Terms & conditions
showTermsConditions = true, showTermsConditions = true,
termsConditions = 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.', termsConditions = DefaultPdfTemplateTerms,
termsConditionsLabel = 'Terms & Conditions', termsConditionsLabel = 'Terms & Conditions',
lines = [ lines = [
{ {
item: 'Simply dummy text', item: DefaultPdfTemplateItemName,
description: 'Simply dummy text of the printing and typesetting', description: DefaultPdfTemplateItemDescription,
rate: '1', rate: '1',
quantity: '1000', quantity: '1000',
total: '$1000.00', total: '$1000.00',
@@ -161,7 +167,7 @@ export function CreditNotePaperTemplate({
<PaperTemplate.Table <PaperTemplate.Table
columns={[ columns={[
{ label: 'Item', accessor: 'item' }, { label: 'Item', accessor: 'item' },
{ label: 'Description', accessor: 'item' }, { label: 'Description', accessor: 'description' },
{ label: 'Rate', accessor: 'rate', align: 'right' }, { label: 'Rate', accessor: 'rate', align: 'right' },
{ label: 'Total', accessor: 'total', align: 'right' }, { label: 'Total', accessor: 'total', align: 'right' },
]} ]}

View File

@@ -3,20 +3,30 @@ import {
PaperTemplate, PaperTemplate,
PaperTemplateProps, PaperTemplateProps,
} from '../../Invoices/InvoiceCustomize/PaperTemplate'; } from '../../Invoices/InvoiceCustomize/PaperTemplate';
import {
DefaultPdfTemplateTerms,
DefaultPdfTemplateItemDescription,
DefaultPdfTemplateStatement,
DefaultPdfTemplateItemName,
} from '@/constants/PdfTemplates';
export interface EstimatePaperTemplateProps extends PaperTemplateProps { export interface EstimatePaperTemplateProps extends PaperTemplateProps {
// # Estimate number
estimateNumebr?: string; estimateNumebr?: string;
estimateNumberLabel?: string; estimateNumberLabel?: string;
showEstimateNumber?: boolean; showEstimateNumber?: boolean;
// # Expiration date
expirationDate?: string; expirationDate?: string;
showExpirationDate?: boolean; showExpirationDate?: boolean;
expirationDateLabel?: string; expirationDateLabel?: string;
// # Estimate date
estimateDateLabel?: string; estimateDateLabel?: string;
showEstimateDate?: boolean; showEstimateDate?: boolean;
estimateDate?: string; estimateDate?: string;
// # Customer name
companyName?: string; companyName?: string;
// Address // Address
@@ -36,11 +46,12 @@ export interface EstimatePaperTemplateProps extends PaperTemplateProps {
showSubtotal?: boolean; showSubtotal?: boolean;
subtotalLabel?: string; subtotalLabel?: string;
// Statements // # Statements
showCustomerNote?: boolean; showCustomerNote?: boolean;
customerNote?: string; customerNote?: string;
customerNoteLabel?: string; customerNoteLabel?: string;
// # Terms & conditions
showTermsConditions?: boolean; showTermsConditions?: boolean;
termsConditions?: string; termsConditions?: string;
termsConditionsLabel?: string; termsConditionsLabel?: string;
@@ -91,17 +102,17 @@ export function EstimatePaperTemplate({
showSubtotal = true, showSubtotal = true,
showCustomerNote = true, showCustomerNote = true,
customerNote = 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.', customerNote = DefaultPdfTemplateStatement,
customerNoteLabel = 'Customer Note', customerNoteLabel = 'Customer Note',
showTermsConditions = true, showTermsConditions = true,
termsConditions = 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.', termsConditions = DefaultPdfTemplateTerms,
termsConditionsLabel = 'Terms & Conditions', termsConditionsLabel = 'Terms & Conditions',
lines = [ lines = [
{ {
item: 'Simply dummy text', item: DefaultPdfTemplateItemName,
description: 'Simply dummy text of the printing and typesetting', description: DefaultPdfTemplateItemDescription,
rate: '1', rate: '1',
quantity: '1000', quantity: '1000',
total: '$1000.00', total: '$1000.00',
@@ -165,7 +176,7 @@ export function EstimatePaperTemplate({
<PaperTemplate.Table <PaperTemplate.Table
columns={[ columns={[
{ label: 'Item', accessor: 'item' }, { label: 'Item', accessor: 'item' },
{ label: 'Description', accessor: 'item' }, { label: 'Description', accessor: 'description' },
{ label: 'Rate', accessor: 'rate', align: 'right' }, { label: 'Rate', accessor: 'rate', align: 'right' },
{ label: 'Total', accessor: 'total', align: 'right' }, { label: 'Total', accessor: 'total', align: 'right' },
]} ]}

View File

@@ -1,7 +1,12 @@
import React from 'react'; import React from 'react';
import { PaperTemplate, PaperTemplateTotalBorder } from './PaperTemplate'; import { PaperTemplate, PaperTemplateTotalBorder } from './PaperTemplate';
import { Stack } from '@/components'; import { Stack } from '@/components';
import {
DefaultPdfTemplateTerms,
DefaultPdfTemplateItemDescription,
DefaultPdfTemplateStatement,
DefaultPdfTemplateItemName,
} from '@/constants/PdfTemplates';
interface PapaerLine { interface PapaerLine {
item?: string; item?: string;
description?: string; description?: string;
@@ -145,12 +150,12 @@ export function InvoicePaperTemplate({
// Footer paragraphs. // Footer paragraphs.
termsConditionsLabel = 'Terms & Conditions', termsConditionsLabel = 'Terms & Conditions',
showTermsConditions = true, showTermsConditions = true,
termsConditions = 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.', termsConditions = DefaultPdfTemplateTerms,
lines = [ lines = [
{ {
item: 'Simply dummy text', item: DefaultPdfTemplateItemName,
description: 'Simply dummy text of the printing and typesetting', description: DefaultPdfTemplateItemDescription,
rate: '1', rate: '1',
quantity: '1000', quantity: '1000',
total: '$1000.00', total: '$1000.00',
@@ -163,7 +168,7 @@ export function InvoicePaperTemplate({
statementLabel = 'Statement', statementLabel = 'Statement',
showStatement = true, showStatement = true,
statement = 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.', statement = DefaultPdfTemplateStatement,
billedToAddress = [ billedToAddress = [
'Bigcapital Technology, Inc.', 'Bigcapital Technology, Inc.',
'131 Continental Dr Suite 305 Newark,', '131 Continental Dr Suite 305 Newark,',
@@ -286,6 +291,7 @@ export function InvoicePaperTemplate({
{termsConditions} {termsConditions}
</PaperTemplate.Statement> </PaperTemplate.Statement>
)} )}
{showStatement && statement && ( {showStatement && statement && (
<PaperTemplate.Statement label={statementLabel}> <PaperTemplate.Statement label={statementLabel}>
{statement} {statement}

View File

@@ -1,4 +1,4 @@
import { Group, Stack } from '@/components'; import { Stack } from '@/components';
import { import {
PaperTemplate, PaperTemplate,
PaperTemplateProps, PaperTemplateProps,

View File

@@ -3,6 +3,12 @@ import {
PaperTemplate, PaperTemplate,
PaperTemplateProps, PaperTemplateProps,
} from '../../Invoices/InvoiceCustomize/PaperTemplate'; } from '../../Invoices/InvoiceCustomize/PaperTemplate';
import {
DefaultPdfTemplateTerms,
DefaultPdfTemplateItemDescription,
DefaultPdfTemplateStatement,
DefaultPdfTemplateItemName,
} from '@/constants/PdfTemplates';
export interface ReceiptPaperTemplateProps extends PaperTemplateProps { export interface ReceiptPaperTemplateProps extends PaperTemplateProps {
// Addresses // Addresses
@@ -22,7 +28,7 @@ export interface ReceiptPaperTemplateProps extends PaperTemplateProps {
showSubtotal?: boolean; showSubtotal?: boolean;
subtotalLabel?: string; subtotalLabel?: string;
// Customer Note // Customer Note
showCustomerNote?: boolean; showCustomerNote?: boolean;
customerNote?: string; customerNote?: string;
customerNoteLabel?: string; customerNoteLabel?: string;
@@ -93,17 +99,17 @@ export function ReceiptPaperTemplate({
showSubtotal = true, showSubtotal = true,
showCustomerNote = true, showCustomerNote = true,
customerNote = 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.',
customerNoteLabel = 'Customer Note', customerNoteLabel = 'Customer Note',
customerNote = DefaultPdfTemplateStatement,
showTermsConditions = true, showTermsConditions = true,
termsConditions = 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.',
termsConditionsLabel = 'Terms & Conditions', termsConditionsLabel = 'Terms & Conditions',
termsConditions = DefaultPdfTemplateTerms,
lines = [ lines = [
{ {
item: 'Simply dummy text', item: DefaultPdfTemplateItemName,
description: 'Simply dummy text of the printing and typesetting', description: DefaultPdfTemplateItemDescription,
rate: '1', rate: '1',
quantity: '1000', quantity: '1000',
total: '$1000.00', total: '$1000.00',
@@ -156,7 +162,7 @@ export function ReceiptPaperTemplate({
<PaperTemplate.Table <PaperTemplate.Table
columns={[ columns={[
{ label: 'Item', accessor: 'item' }, { label: 'Item', accessor: 'item' },
{ label: 'Description', accessor: 'item' }, { label: 'Description', accessor: 'description' },
{ label: 'Rate', accessor: 'rate', align: 'right' }, { label: 'Rate', accessor: 'rate', align: 'right' },
{ label: 'Total', accessor: 'total', align: 'right' }, { label: 'Total', accessor: 'total', align: 'right' },
]} ]}