Merge pull request #675 from bigcapitalhq/hook-up-company-logo-to-pdf-templates

feat: Hook up company logo to server-side pdf templates
This commit is contained in:
Ahmed Bouhuolia
2024-09-26 18:33:45 +02:00
committed by GitHub
12 changed files with 51 additions and 25 deletions

View File

@@ -134,9 +134,9 @@ block content
div(class=`${prefix}-root`)
div(class=`${prefix}-big-title`) Credit Note
if showCompanyLogo
if showCompanyLogo && companyLogoUri
div(class=`${prefix}-logo-wrap`)
img(src=companyLogo alt=`Company Logo`)
img(src=companyLogoUri alt=`Company Logo`)
div(class=`${prefix}-terms-list`)
if showCreditNoteNumber
@@ -155,6 +155,7 @@ block content
strong #{companyName}
each address in billedFromAddress
div #{address}
if showBilledToAddress
div(class=`${prefix}-address`)
strong #{billedToLabel}
@@ -187,12 +188,12 @@ block content
div(class=`${prefix}-totals__item-amount`) #{totalLabel}:
div(class=`${prefix}-totals__item-label`) #{total}
if showCustomerNote
if showCustomerNote && customerNote
div(class=`${prefix}-statement`)
div(class=`${prefix}-statement__label`) #{customerNoteLabel}:
div(class=`${prefix}-statement__value`) #{customerNote}
if showTermsConditions
if showTermsConditions && termsConditions
div(class=`${prefix}-statement`)
div(class=`${prefix}-statement__label`) #{termsConditionsLabel}:
div(class=`${prefix}-statement__value`) #{termsConditions}

View File

@@ -135,9 +135,9 @@ block content
div(class=`${prefix}-root`, style=`--invoice-primary-color: ${primaryColor}; --invoice-secondary-color: ${secondaryColor};`)
h1(class=`${prefix}-big-title`) Estimate
if showCompanyLogo
if showCompanyLogo && companyLogoUri
div(class=`${prefix}-logo-wrap`)
img(alt="", src=companyLogo)
img(alt="Company logo", src=companyLogoUri)
//- Terms List
div(class=`${prefix}-terms`)

View File

@@ -144,9 +144,9 @@ block content
//- Title and company logo
h1(class=`${prefix}-big-title`) Invoice
if showCompanyLogo
if showCompanyLogo && companyLogoUri
div(class=`${prefix}-logo-wrap`)
img(alt="", src=companyLogo)
img(alt="Company logo", src=companyLogoUri)
//- Invoice details
div(class=`${prefix}-details`)

View File

@@ -124,9 +124,9 @@ block content
div(class=`${prefix}-root`)
div(class=`${prefix}-big-title`) Payment
if showCompanyLogo
if showCompanyLogo && companyLogoUri
div(class=`${prefix}-logo-wrap`)
img(src=companyLogo alt="Company Logo")
img(src=companyLogoUri alt="Company Logo")
div(class=`${prefix}-terms-list`)
if showPaymentReceivedNumber

View File

@@ -128,9 +128,10 @@ block content
//- Title and company logo
h1(class=`${prefix}-big-title`) Receipt
if showCompanyLogo
//- Company Logo
if showCompanyLogo && companyLogoUri
div(class=`${prefix}-logo-wrap`)
img(src=companyLogo alt=`Company Logo`)
img(src=companyLogoUri alt=`Company Logo`)
//- Terms List
div(class=`${prefix}-terms-list`)
@@ -186,13 +187,13 @@ block content
span(class=`${prefix}-totals__line__amount`)= total
//- Customer Note Section
if showCustomerNote
if showCustomerNote && customerNote
div(class=`${prefix}-statement`)
div(class=`${prefix}-statement__label`)= customerNoteLabel
div(class=`${prefix}-statement__value`)= customerNote
//- Terms & Conditions Section
if showTermsConditions
if showTermsConditions && termsConditions
div(class=`${prefix}-statement`)
div(class=`${prefix}-statement__label`)= termsConditionsLabel
div(class=`${prefix}-statement__value`)= termsConditions

View File

@@ -68,10 +68,16 @@ export const DEFAULT_VIEWS = [
];
export const defaultCreditNoteBrandingAttributes = {
// # Colors
primaryColor: '',
secondaryColor: '',
// # Company logo
showCompanyLogo: true,
companyLogo: '',
companyLogoKey: '',
companyLogoUri: '',
// # Company name
companyName: 'Bigcapital Technology, Inc.',
// Address

View File

@@ -177,8 +177,12 @@ export const SaleEstimatesSampleData = [
export const defaultEstimatePdfBrandingAttributes = {
primaryColor: '#000',
secondaryColor: '#000',
// # Company logo
showCompanyLogo: true,
companyLogo: '',
companyLogoUri: '',
companyLogoKey: '',
companyName: '',
billedToAddress: [

View File

@@ -170,7 +170,8 @@ export const defaultInvoicePdfTemplateAttributes = {
companyName: 'Bigcapital Technology, Inc.',
showCompanyLogo: true,
companyLogo: '',
companyLogoKey: '',
companyLogoUri: '',
dueDateLabel: 'Date due',
showDueDate: true,

View File

@@ -47,12 +47,18 @@ export const PaymentsReceiveSampleData = [
];
export const defaultPaymentReceivedPdfTemplateAttributes = {
// # Colors
primaryColor: '#000',
secondaryColor: '#000',
// # Company logo
showCompanyLogo: true,
companyLogo: '',
companyLogoUri: '',
// # Company name
companyName: 'Bigcapital Technology, Inc.',
// Address
billedToAddress: [
'Bigcapital Technology, Inc.',
'131 Continental Dr Suite 305 Newark,',
@@ -72,10 +78,12 @@ export const defaultPaymentReceivedPdfTemplateAttributes = {
showBillingToAddress: true,
billedToLabel: 'Billed To',
// Total
total: '$1000.00',
totalLabel: 'Total',
showTotal: true,
// Subtotal
subtotal: '1000/00',
subtotalLabel: 'Subtotal',
showSubtotal: true,
@@ -87,10 +95,12 @@ export const defaultPaymentReceivedPdfTemplateAttributes = {
paidAmount: '$1000.00',
},
],
// Payment received number
showPaymentReceivedNumber: true,
paymentReceivedNumberLabel: 'Payment Number',
paymentReceivedNumebr: '346D3D40-0001',
// Payment date.
paymentReceivedDate: 'September 3, 2024',
showPaymentReceivedDate: true,
paymentReceivedDateLabel: 'Payment Date',

View File

@@ -69,10 +69,13 @@ export const SaleReceiptsSampleData = [
export const defaultSaleReceiptBrandingAttributes = {
primaryColor: '',
secondaryColor: '',
showCompanyLogo: true,
companyLogo: '',
companyName: 'Bigcapital Technology, Inc.',
// # Company logo
showCompanyLogo: true,
companyLogoUri: '',
companyLogoKey: '',
// # Address
billedToAddress: [
'Bigcapital Technology, Inc.',

View File

@@ -8,7 +8,7 @@ export const initialValues = {
// Company logo.
showCompanyLogo: true,
companyLogoUri: '',
companyLogokey: '',
companyLogoKey: '',
// Top details.
showPaymentReceivedNumber: true,

View File

@@ -1,5 +1,5 @@
import { useFormikContext } from 'formik';
import { ElementCustomize } from '../../../ElementCustomize/ElementCustomize';
import { ElementCustomize } from '@/containers/ElementCustomize/ElementCustomize';
import { ReceiptCustomizeGeneralField } from './ReceiptCustomizeFieldsGeneral';
import { ReceiptCustomizeFieldsContent } from './ReceiptCustomizeFieldsContent';
import { ReceiptPaperTemplate } from './ReceiptPaperTemplate';
@@ -20,10 +20,10 @@ export function ReceiptCustomizeContent() {
return (
<BrandingTemplateForm<ReceiptCustomizeValues>
templateId={templateId}
initialValues={initialValues}
onSuccess={handleFormSuccess}
resource={'SaleReceipt'}
templateId={templateId}
defaultValues={initialValues}
onSuccess={handleFormSuccess}
>
<ElementCustomize.PaperTemplate>
<ReceiptPaperTemplateFormConnected />