mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
32 lines
907 B
TypeScript
32 lines
907 B
TypeScript
import { Inject, Service } from 'typedi';
|
|
import { mergePdfTemplateWithDefaultAttributes } from './utils';
|
|
import { GetPdfTemplate } from '@/services/PdfTemplate/GetPdfTemplate';
|
|
import { defaultEstimatePdfBrandingAttributes } from '../Estimates/constants';
|
|
|
|
@Service()
|
|
export class SaleEstimatePdfTemplate {
|
|
@Inject()
|
|
private getPdfTemplateService: GetPdfTemplate;
|
|
|
|
/**
|
|
* Retrieves the estimate pdf template.
|
|
* @param {number} tenantId
|
|
* @param {number} invoiceTemplateId
|
|
* @returns
|
|
*/
|
|
async getEstimatePdfTemplate(tenantId: number, estimateTemplateId: number) {
|
|
const template = await this.getPdfTemplateService.getPdfTemplate(
|
|
tenantId,
|
|
estimateTemplateId
|
|
);
|
|
const attributes = mergePdfTemplateWithDefaultAttributes(
|
|
template.attributes,
|
|
defaultEstimatePdfBrandingAttributes
|
|
);
|
|
return {
|
|
...template,
|
|
attributes,
|
|
};
|
|
}
|
|
}
|