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 {
PaperTemplate,
PaperTemplateProps,
} from '../../Invoices/InvoiceCustomize/PaperTemplate';
import {
DefaultPdfTemplateTerms,
DefaultPdfTemplateItemDescription,
DefaultPdfTemplateStatement,
DefaultPdfTemplateItemName,
} from '@/constants/PdfTemplates';
export interface CreditNotePaperTemplateProps extends PaperTemplateProps {
// Address
@@ -95,18 +101,18 @@ export function CreditNotePaperTemplate({
// Customer note
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',
// Terms & conditions
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',
lines = [
{
item: 'Simply dummy text',
description: 'Simply dummy text of the printing and typesetting',
item: DefaultPdfTemplateItemName,
description: DefaultPdfTemplateItemDescription,
rate: '1',
quantity: '1000',
total: '$1000.00',
@@ -161,7 +167,7 @@ export function CreditNotePaperTemplate({
<PaperTemplate.Table
columns={[
{ label: 'Item', accessor: 'item' },
{ label: 'Description', accessor: 'item' },
{ label: 'Description', accessor: 'description' },
{ label: 'Rate', accessor: 'rate', align: 'right' },
{ label: 'Total', accessor: 'total', align: 'right' },
]}

View File

@@ -3,20 +3,30 @@ import {
PaperTemplate,
PaperTemplateProps,
} from '../../Invoices/InvoiceCustomize/PaperTemplate';
import {
DefaultPdfTemplateTerms,
DefaultPdfTemplateItemDescription,
DefaultPdfTemplateStatement,
DefaultPdfTemplateItemName,
} from '@/constants/PdfTemplates';
export interface EstimatePaperTemplateProps extends PaperTemplateProps {
// # Estimate number
estimateNumebr?: string;
estimateNumberLabel?: string;
showEstimateNumber?: boolean;
// # Expiration date
expirationDate?: string;
showExpirationDate?: boolean;
expirationDateLabel?: string;
// # Estimate date
estimateDateLabel?: string;
showEstimateDate?: boolean;
estimateDate?: string;
// # Customer name
companyName?: string;
// Address
@@ -36,11 +46,12 @@ export interface EstimatePaperTemplateProps extends PaperTemplateProps {
showSubtotal?: boolean;
subtotalLabel?: string;
// Statements
// # Statements
showCustomerNote?: boolean;
customerNote?: string;
customerNoteLabel?: string;
// # Terms & conditions
showTermsConditions?: boolean;
termsConditions?: string;
termsConditionsLabel?: string;
@@ -91,17 +102,17 @@ export function EstimatePaperTemplate({
showSubtotal = 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',
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',
lines = [
{
item: 'Simply dummy text',
description: 'Simply dummy text of the printing and typesetting',
item: DefaultPdfTemplateItemName,
description: DefaultPdfTemplateItemDescription,
rate: '1',
quantity: '1000',
total: '$1000.00',
@@ -165,7 +176,7 @@ export function EstimatePaperTemplate({
<PaperTemplate.Table
columns={[
{ label: 'Item', accessor: 'item' },
{ label: 'Description', accessor: 'item' },
{ label: 'Description', accessor: 'description' },
{ label: 'Rate', accessor: 'rate', align: 'right' },
{ label: 'Total', accessor: 'total', align: 'right' },
]}

View File

@@ -1,7 +1,12 @@
import React from 'react';
import { PaperTemplate, PaperTemplateTotalBorder } from './PaperTemplate';
import { Stack } from '@/components';
import {
DefaultPdfTemplateTerms,
DefaultPdfTemplateItemDescription,
DefaultPdfTemplateStatement,
DefaultPdfTemplateItemName,
} from '@/constants/PdfTemplates';
interface PapaerLine {
item?: string;
description?: string;
@@ -145,12 +150,12 @@ export function InvoicePaperTemplate({
// Footer paragraphs.
termsConditionsLabel = 'Terms & Conditions',
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 = [
{
item: 'Simply dummy text',
description: 'Simply dummy text of the printing and typesetting',
item: DefaultPdfTemplateItemName,
description: DefaultPdfTemplateItemDescription,
rate: '1',
quantity: '1000',
total: '$1000.00',
@@ -163,7 +168,7 @@ export function InvoicePaperTemplate({
statementLabel = 'Statement',
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 = [
'Bigcapital Technology, Inc.',
'131 Continental Dr Suite 305 Newark,',
@@ -286,6 +291,7 @@ export function InvoicePaperTemplate({
{termsConditions}
</PaperTemplate.Statement>
)}
{showStatement && statement && (
<PaperTemplate.Statement label={statementLabel}>
{statement}

View File

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

View File

@@ -3,6 +3,12 @@ import {
PaperTemplate,
PaperTemplateProps,
} from '../../Invoices/InvoiceCustomize/PaperTemplate';
import {
DefaultPdfTemplateTerms,
DefaultPdfTemplateItemDescription,
DefaultPdfTemplateStatement,
DefaultPdfTemplateItemName,
} from '@/constants/PdfTemplates';
export interface ReceiptPaperTemplateProps extends PaperTemplateProps {
// Addresses
@@ -22,7 +28,7 @@ export interface ReceiptPaperTemplateProps extends PaperTemplateProps {
showSubtotal?: boolean;
subtotalLabel?: string;
// Customer Note
// Customer Note
showCustomerNote?: boolean;
customerNote?: string;
customerNoteLabel?: string;
@@ -93,17 +99,17 @@ export function ReceiptPaperTemplate({
showSubtotal = 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',
customerNote = DefaultPdfTemplateStatement,
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',
termsConditions = DefaultPdfTemplateTerms,
lines = [
{
item: 'Simply dummy text',
description: 'Simply dummy text of the printing and typesetting',
item: DefaultPdfTemplateItemName,
description: DefaultPdfTemplateItemDescription,
rate: '1',
quantity: '1000',
total: '$1000.00',
@@ -156,7 +162,7 @@ export function ReceiptPaperTemplate({
<PaperTemplate.Table
columns={[
{ label: 'Item', accessor: 'item' },
{ label: 'Description', accessor: 'item' },
{ label: 'Description', accessor: 'description' },
{ label: 'Rate', accessor: 'rate', align: 'right' },
{ label: 'Total', accessor: 'total', align: 'right' },
]}