mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
feat: Assign default pdf template automatically
This commit is contained in:
@@ -67,6 +67,7 @@ function CreditNoteForm({
|
||||
newCreditNote,
|
||||
createCreditNoteMutate,
|
||||
editCreditNoteMutate,
|
||||
creditNoteState,
|
||||
} = useCreditNoteFormContext();
|
||||
|
||||
// Credit number.
|
||||
@@ -85,6 +86,7 @@ function CreditNoteForm({
|
||||
currency_code: base_currency,
|
||||
terms_conditions: defaultTo(creditTermsConditions, ''),
|
||||
note: defaultTo(creditCustomerNotes, ''),
|
||||
pdf_template_id: creditNoteState?.defaultTemplateId,
|
||||
...newCreditNote,
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -85,7 +85,7 @@ function CreditNoteFormProvider({ creditNoteId, ...props }) {
|
||||
|
||||
// Fetches branding templates of invoice.
|
||||
const { data: brandingTemplates, isLoading: isBrandingTemplatesLoading } =
|
||||
useGetPdfTemplates({ resource: 'PaymentReceive' });
|
||||
useGetPdfTemplates({ resource: 'CreditNote' });
|
||||
|
||||
// Fetches the credit note state.
|
||||
const { data: creditNoteState, isLoading: isCreditNoteStateLoading } =
|
||||
|
||||
@@ -172,17 +172,16 @@ function InvoiceFormProvider({ invoiceId, baseCurrency, ...props }) {
|
||||
isInvoiceStateLoading,
|
||||
};
|
||||
|
||||
const isLoading =
|
||||
isInvoiceLoading ||
|
||||
isItemsLoading ||
|
||||
isCustomersLoading ||
|
||||
isEstimateLoading ||
|
||||
isSettingsLoading ||
|
||||
isInvoiceStateLoading;
|
||||
|
||||
return (
|
||||
<DashboardInsider
|
||||
loading={
|
||||
isInvoiceLoading ||
|
||||
isItemsLoading ||
|
||||
isCustomersLoading ||
|
||||
isEstimateLoading ||
|
||||
isSettingsLoading
|
||||
}
|
||||
name={'invoice-form'}
|
||||
>
|
||||
<DashboardInsider loading={isLoading} name={'invoice-form'}>
|
||||
<InvoiceFormContext.Provider value={provider} {...props} />
|
||||
</DashboardInsider>
|
||||
);
|
||||
|
||||
@@ -90,7 +90,7 @@ function PaymentReceiveForm({
|
||||
}),
|
||||
deposit_account_id: defaultTo(preferredDepositAccount, ''),
|
||||
currency_code: base_currency,
|
||||
pdf_template_id: paymentReceivedState.defaultTemplateId,
|
||||
pdf_template_id: paymentReceivedState?.defaultTemplateId,
|
||||
}),
|
||||
};
|
||||
// Handle form submit.
|
||||
|
||||
@@ -137,7 +137,8 @@ function PaymentReceiveFormProvider({ query, paymentReceiveId, ...props }) {
|
||||
isPaymentLoading ||
|
||||
isAccountsLoading ||
|
||||
isCustomersLoading ||
|
||||
isBrandingTemplatesLoading;
|
||||
isBrandingTemplatesLoading ||
|
||||
isPaymentReceivedStateLoading;
|
||||
|
||||
return (
|
||||
<DashboardInsider loading={isLoading} name={'payment-receive-form'}>
|
||||
|
||||
@@ -85,7 +85,7 @@ function ReceiptForm({
|
||||
currency_code: base_currency,
|
||||
receipt_message: receiptMessage,
|
||||
terms_conditions: receiptTermsConditions,
|
||||
pdf_template_id: saleReceiptState?.pdfTemplateId,
|
||||
pdf_template_id: saleReceiptState?.defaultTemplateId,
|
||||
}),
|
||||
};
|
||||
// Handle the form submit.
|
||||
@@ -173,7 +173,7 @@ function ReceiptForm({
|
||||
|
||||
{/*---------- Dialogs ---------*/}
|
||||
<ReceiptFormDialogs />
|
||||
|
||||
css
|
||||
{/*---------- Effects ---------*/}
|
||||
<ReceiptSyncIncrementSettingsToForm />
|
||||
<ReceiptSyncAutoExRateToForm />
|
||||
|
||||
Reference in New Issue
Block a user