mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
feat: getting invoice preview on send mail view
This commit is contained in:
@@ -31,6 +31,25 @@ export class SaleInvoicePdf {
|
||||
@Inject()
|
||||
private eventPublisher: EventPublisher;
|
||||
|
||||
/**
|
||||
* Retrieve sale invoice html content.
|
||||
* @param {number} tenantId - Tenant Id.
|
||||
* @param {ISaleInvoice} saleInvoice -
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
public async saleInvoiceHtml(
|
||||
tenantId: number,
|
||||
invoiceId: number
|
||||
): Promise<string> {
|
||||
const brandingAttributes = await this.getInvoiceBrandingAttributes(
|
||||
tenantId,
|
||||
invoiceId
|
||||
);
|
||||
return renderInvoicePaperTemplateHtml({
|
||||
...brandingAttributes,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve sale invoice pdf content.
|
||||
* @param {number} tenantId - Tenant Id.
|
||||
@@ -43,13 +62,8 @@ export class SaleInvoicePdf {
|
||||
): Promise<[Buffer, string]> {
|
||||
const filename = await this.getInvoicePdfFilename(tenantId, invoiceId);
|
||||
|
||||
const brandingAttributes = await this.getInvoiceBrandingAttributes(
|
||||
tenantId,
|
||||
invoiceId
|
||||
);
|
||||
const htmlContent = renderInvoicePaperTemplateHtml({
|
||||
...brandingAttributes,
|
||||
});
|
||||
const htmlContent = await this.saleInvoiceHtml(tenantId, invoiceId);
|
||||
|
||||
// Converts the given html content to pdf document.
|
||||
const buffer = await this.chromiumlyTenancy.convertHtmlContent(
|
||||
tenantId,
|
||||
|
||||
@@ -273,6 +273,19 @@ export class SaleInvoiceApplication {
|
||||
return this.pdfSaleInvoiceService.saleInvoicePdf(tenantId, saleInvoiceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the html content of the given sale invoice.
|
||||
* @param {number} tenantId
|
||||
* @param {number} saleInvoiceId
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
public saleInvoiceHtml(
|
||||
tenantId: number,
|
||||
saleInvoiceId: number
|
||||
): Promise<string> {
|
||||
return this.pdfSaleInvoiceService.saleInvoiceHtml(tenantId, saleInvoiceId);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} tenantId
|
||||
|
||||
Reference in New Issue
Block a user