mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
fix: pdf templates server-side rendered
This commit is contained in:
@@ -48,8 +48,8 @@ block head
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-flow: wrap;
|
||||
-webkit-box-align: center;
|
||||
align-items: center;
|
||||
-webkit-box-align: flex-start;
|
||||
align-items: flex-start;
|
||||
-webkit-box-pack: start;
|
||||
justify-content: flex-start;
|
||||
gap: 10px;
|
||||
|
||||
@@ -47,9 +47,7 @@ block head
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-flow: wrap;
|
||||
-webkit-box-align: center;
|
||||
align-items: center;
|
||||
-webkit-box-pack: start;
|
||||
align-items: flex-start;
|
||||
justify-content: flex-start;
|
||||
gap: 10px;
|
||||
margin-bottom: 24px;
|
||||
|
||||
@@ -48,9 +48,7 @@ block head
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-flow: wrap;
|
||||
-webkit-box-align: center;
|
||||
align-items: center;
|
||||
-webkit-box-pack: start;
|
||||
align-items: flex-start;
|
||||
justify-content: flex-start;
|
||||
gap: 10px;
|
||||
margin-bottom: 24px;
|
||||
|
||||
@@ -46,9 +46,7 @@ block head
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-flow: wrap;
|
||||
-webkit-box-align: center;
|
||||
align-items: center;
|
||||
-webkit-box-pack: start;
|
||||
align-items: flex-start;
|
||||
justify-content: flex-start;
|
||||
gap: 10px;
|
||||
margin-bottom: 24px;
|
||||
|
||||
@@ -46,8 +46,8 @@ block head
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-flow: wrap;
|
||||
-webkit-box-align: center;
|
||||
align-items: center;
|
||||
-webkit-box-align: flex-start;
|
||||
align-items: flex-start;
|
||||
-webkit-box-pack: start;
|
||||
justify-content: flex-start;
|
||||
gap: 10px;
|
||||
|
||||
@@ -179,14 +179,15 @@ export const defaultInvoicePdfTemplateAttributes = {
|
||||
dateIssueLabel: 'Date of issue',
|
||||
showDateIssue: true,
|
||||
|
||||
// dateIssue,
|
||||
// # Invoice number,
|
||||
invoiceNumberLabel: 'Invoice number',
|
||||
showInvoiceNumber: true,
|
||||
|
||||
// Address
|
||||
// # Customer address
|
||||
showCustomerAddress: true,
|
||||
customerAddress: '',
|
||||
|
||||
// # Company address
|
||||
showCompanyAddress: true,
|
||||
companyAddress: '',
|
||||
billedToLabel: 'Billed To',
|
||||
|
||||
@@ -10,35 +10,36 @@ export class PaymentReceivedBrandingTemplate {
|
||||
@Inject()
|
||||
private getPdfTemplateService: GetPdfTemplate;
|
||||
|
||||
|
||||
@Inject()
|
||||
private getOrgBrandingAttributes: GetOrganizationBrandingAttributes;
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the payment received pdf template.
|
||||
* @param {number} tenantId
|
||||
* @param {number} paymentTemplateId
|
||||
* @returns
|
||||
* @param {number} tenantId
|
||||
* @param {number} paymentTemplateId
|
||||
* @returns
|
||||
*/
|
||||
public async getPaymentReceivedPdfTemplate(
|
||||
tenantId: number,
|
||||
paymentTemplateId: number
|
||||
) {
|
||||
) {
|
||||
const template = await this.getPdfTemplateService.getPdfTemplate(
|
||||
tenantId,
|
||||
paymentTemplateId
|
||||
);
|
||||
// Retrieves the organization branding attributes.
|
||||
const commonOrgBrandingAttrs = this.getOrgBrandingAttributes.getOrganizationBrandingAttributes(tenantId);
|
||||
|
||||
const commonOrgBrandingAttrs =
|
||||
await this.getOrgBrandingAttributes.getOrganizationBrandingAttributes(
|
||||
tenantId
|
||||
);
|
||||
// Merges the default branding attributes with common organization branding attrs.
|
||||
const organizationBrandingAttrs = {
|
||||
...defaultPaymentReceivedPdfTemplateAttributes,
|
||||
...commonOrgBrandingAttrs,
|
||||
};
|
||||
const attributes = mergePdfTemplateWithDefaultAttributes(
|
||||
template.attributes,
|
||||
organizationBrandingAttrs
|
||||
organizationBrandingAttrs
|
||||
);
|
||||
return {
|
||||
...template,
|
||||
|
||||
@@ -120,19 +120,18 @@ PaperTemplate.MutedText = () => {};
|
||||
PaperTemplate.Text = () => {};
|
||||
|
||||
PaperTemplate.AddressesGroup = (props: GroupProps) => {
|
||||
return <Group spacing={10} {...props} className={styles.addressRoot} />;
|
||||
};
|
||||
PaperTemplate.Address = ({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) => {
|
||||
return (
|
||||
<Box>
|
||||
{children}
|
||||
</Box>
|
||||
<Group
|
||||
spacing={10}
|
||||
align={'flex-start'}
|
||||
{...props}
|
||||
className={styles.addressRoot}
|
||||
/>
|
||||
);
|
||||
};
|
||||
PaperTemplate.Address = ({ children }: { children: React.ReactNode }) => {
|
||||
return <Box>{children}</Box>;
|
||||
};
|
||||
|
||||
PaperTemplate.Statement = ({
|
||||
label,
|
||||
|
||||
@@ -14,17 +14,19 @@ export const initialValues = {
|
||||
showPaymentReceivedNumber: true,
|
||||
paymentReceivedNumberLabel: 'Payment number',
|
||||
|
||||
// Payment number
|
||||
showPaymentReceivedDate: true,
|
||||
paymentReceivedDateLabel: 'Date of Issue',
|
||||
|
||||
// Company name
|
||||
companyName: 'Bigcapital Technology, Inc.',
|
||||
|
||||
// Addresses
|
||||
showCustomerAddress: true,
|
||||
// Customer address
|
||||
showCompanyAddress: true,
|
||||
customerAddress: '',
|
||||
companyAddress: '',
|
||||
|
||||
// Company address
|
||||
showCustomerAddress: true,
|
||||
billedToLabel: 'Billed To',
|
||||
|
||||
// Entries
|
||||
@@ -33,10 +35,11 @@ export const initialValues = {
|
||||
itemRateLabel: 'Rate',
|
||||
itemTotalLabel: 'Total',
|
||||
|
||||
// Totals
|
||||
// Subtotal
|
||||
showSubtotal: true,
|
||||
subtotalLabel: 'Subtotal',
|
||||
|
||||
// Total
|
||||
showTotal: true,
|
||||
totalLabel: 'Total',
|
||||
};
|
||||
|
||||
@@ -12,18 +12,23 @@ export interface PaymentReceivedCustomizeValues extends BrandingTemplateValues {
|
||||
showInvoiceNumber?: boolean;
|
||||
invoiceNumberLabel?: string;
|
||||
|
||||
// # Issue date
|
||||
showDateIssue?: boolean;
|
||||
dateIssueLabel?: string;
|
||||
|
||||
// # Due date
|
||||
showDueDate?: boolean;
|
||||
dueDateLabel?: string;
|
||||
|
||||
// Company name
|
||||
// # Company name
|
||||
companyName?: string;
|
||||
|
||||
// Addresses
|
||||
showBilledFromAddress?: boolean;
|
||||
showBillingToAddress?: boolean;
|
||||
// # Customer address
|
||||
showCustomerAddress?: boolean;
|
||||
|
||||
// # Company address
|
||||
showCompanyAddress?: boolean;
|
||||
companyAddress?: string;
|
||||
billedToLabel?: string;
|
||||
|
||||
// Entries
|
||||
@@ -54,6 +59,7 @@ export interface PaymentReceivedCustomizeValues extends BrandingTemplateValues {
|
||||
termsConditionsLabel?: string;
|
||||
showTermsConditions?: boolean;
|
||||
|
||||
// # Statement
|
||||
statementLabel?: string;
|
||||
showStatement?: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user