mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
fix: Pdf branding template initial values
This commit is contained in:
@@ -16,19 +16,17 @@ export const initialValues = {
|
|||||||
showInvoiceNumber: true,
|
showInvoiceNumber: true,
|
||||||
invoiceNumberLabel: 'Invoice number',
|
invoiceNumberLabel: 'Invoice number',
|
||||||
|
|
||||||
|
// Issue date
|
||||||
showDateIssue: true,
|
showDateIssue: true,
|
||||||
dateIssueLabel: 'Date of Issue',
|
dateIssueLabel: 'Date of Issue',
|
||||||
|
|
||||||
|
// Due date.
|
||||||
showDueDate: true,
|
showDueDate: true,
|
||||||
dueDateLabel: 'Due Date',
|
dueDateLabel: 'Due Date',
|
||||||
|
|
||||||
// Company name
|
|
||||||
companyName: 'Bigcapital Technology, Inc.',
|
|
||||||
|
|
||||||
// Addresses
|
// Addresses
|
||||||
showCustomerAddress: true,
|
showCustomerAddress: true,
|
||||||
showCompanyAddress: true,
|
showCompanyAddress: true,
|
||||||
companyAddress: '',
|
|
||||||
billedToLabel: 'Billed To',
|
billedToLabel: 'Billed To',
|
||||||
|
|
||||||
// Entries
|
// Entries
|
||||||
@@ -41,6 +39,7 @@ export const initialValues = {
|
|||||||
showSubtotal: true,
|
showSubtotal: true,
|
||||||
subtotalLabel: 'Subtotal',
|
subtotalLabel: 'Subtotal',
|
||||||
|
|
||||||
|
// Discount
|
||||||
showDiscount: true,
|
showDiscount: true,
|
||||||
discountLabel: 'Discount',
|
discountLabel: 'Discount',
|
||||||
|
|
||||||
@@ -52,6 +51,7 @@ export const initialValues = {
|
|||||||
paymentMadeLabel: 'Payment Made',
|
paymentMadeLabel: 'Payment Made',
|
||||||
showPaymentMade: true,
|
showPaymentMade: true,
|
||||||
|
|
||||||
|
// Due amount
|
||||||
dueAmountLabel: 'Due Amount',
|
dueAmountLabel: 'Due Amount',
|
||||||
showDueAmount: true,
|
showDueAmount: true,
|
||||||
|
|
||||||
@@ -59,6 +59,7 @@ export const initialValues = {
|
|||||||
termsConditionsLabel: 'Terms & Conditions',
|
termsConditionsLabel: 'Terms & Conditions',
|
||||||
showTermsConditions: true,
|
showTermsConditions: true,
|
||||||
|
|
||||||
|
// Statement
|
||||||
statementLabel: 'Statement',
|
statementLabel: 'Statement',
|
||||||
showStatement: true,
|
showStatement: true,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { BrandingTemplateValues } from "@/containers/BrandingTemplates/types";
|
import { BrandingState, BrandingTemplateValues } from '@/containers/BrandingTemplates/types';
|
||||||
|
|
||||||
export interface InvoiceCustomizeValues extends BrandingTemplateValues {
|
export interface InvoiceCustomizeState extends BrandingState {}
|
||||||
|
|
||||||
|
export interface InvoiceCustomizeFormValues extends BrandingTemplateValues {
|
||||||
// Colors
|
// Colors
|
||||||
primaryColor?: string;
|
primaryColor?: string;
|
||||||
secondaryColor?: string;
|
secondaryColor?: string;
|
||||||
@@ -14,15 +16,14 @@ export interface InvoiceCustomizeValues extends BrandingTemplateValues {
|
|||||||
showInvoiceNumber?: boolean;
|
showInvoiceNumber?: boolean;
|
||||||
invoiceNumberLabel?: string;
|
invoiceNumberLabel?: string;
|
||||||
|
|
||||||
|
// Date issue
|
||||||
showDateIssue?: boolean;
|
showDateIssue?: boolean;
|
||||||
dateIssueLabel?: string;
|
dateIssueLabel?: string;
|
||||||
|
|
||||||
|
// Due date
|
||||||
showDueDate?: boolean;
|
showDueDate?: boolean;
|
||||||
dueDateLabel?: string;
|
dueDateLabel?: string;
|
||||||
|
|
||||||
// Company name
|
|
||||||
companyName?: string;
|
|
||||||
|
|
||||||
// Addresses
|
// Addresses
|
||||||
showBilledFromAddress?: boolean;
|
showBilledFromAddress?: boolean;
|
||||||
showBillingToAddress?: boolean;
|
showBillingToAddress?: boolean;
|
||||||
@@ -38,6 +39,7 @@ export interface InvoiceCustomizeValues extends BrandingTemplateValues {
|
|||||||
showSubtotal?: boolean;
|
showSubtotal?: boolean;
|
||||||
subtotalLabel?: string;
|
subtotalLabel?: string;
|
||||||
|
|
||||||
|
// Discount
|
||||||
showDiscount?: boolean;
|
showDiscount?: boolean;
|
||||||
discountLabel?: string;
|
discountLabel?: string;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { omit } from 'lodash';
|
import { omit } from 'lodash';
|
||||||
import { useFormikContext } from 'formik';
|
import { InvoiceCustomizeFormValues } from './types';
|
||||||
import { InvoiceCustomizeValues } from './types';
|
|
||||||
import {
|
import {
|
||||||
CreatePdfTemplateValues,
|
CreatePdfTemplateValues,
|
||||||
EditPdfTemplateValues,
|
EditPdfTemplateValues,
|
||||||
@@ -10,7 +9,7 @@ import { initialValues } from './constants';
|
|||||||
import { useBrandingTemplateBoot } from '@/containers/BrandingTemplates/BrandingTemplateBoot';
|
import { useBrandingTemplateBoot } from '@/containers/BrandingTemplates/BrandingTemplateBoot';
|
||||||
|
|
||||||
export const transformToEditRequest = (
|
export const transformToEditRequest = (
|
||||||
values: InvoiceCustomizeValues,
|
values: InvoiceCustomizeFormValues,
|
||||||
): EditPdfTemplateValues => {
|
): EditPdfTemplateValues => {
|
||||||
return {
|
return {
|
||||||
templateName: values.templateName,
|
templateName: values.templateName,
|
||||||
@@ -19,7 +18,7 @@ export const transformToEditRequest = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const transformToNewRequest = (
|
export const transformToNewRequest = (
|
||||||
values: InvoiceCustomizeValues,
|
values: InvoiceCustomizeFormValues,
|
||||||
): CreatePdfTemplateValues => {
|
): CreatePdfTemplateValues => {
|
||||||
return {
|
return {
|
||||||
resource: 'SaleInvoice',
|
resource: 'SaleInvoice',
|
||||||
@@ -28,7 +27,7 @@ export const transformToNewRequest = (
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useInvoiceCustomizeInitialValues = (): InvoiceCustomizeValues => {
|
export const useInvoiceCustomizeInitialValues = (): InvoiceCustomizeFormValues => {
|
||||||
const { pdfTemplate } = useBrandingTemplateBoot();
|
const { pdfTemplate } = useBrandingTemplateBoot();
|
||||||
|
|
||||||
const defaultPdfTemplate = {
|
const defaultPdfTemplate = {
|
||||||
@@ -40,6 +39,6 @@ export const useInvoiceCustomizeInitialValues = (): InvoiceCustomizeValues => {
|
|||||||
...(transformToForm(
|
...(transformToForm(
|
||||||
defaultPdfTemplate,
|
defaultPdfTemplate,
|
||||||
initialValues,
|
initialValues,
|
||||||
) as InvoiceCustomizeValues),
|
) as InvoiceCustomizeFormValues),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ export const initialValues = {
|
|||||||
|
|
||||||
// Customer address
|
// Customer address
|
||||||
showCompanyAddress: true,
|
showCompanyAddress: true,
|
||||||
companyAddress: '',
|
|
||||||
|
|
||||||
// Company address
|
// Company address
|
||||||
showCustomerAddress: true,
|
showCustomerAddress: true,
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ export const initialValues = {
|
|||||||
showCustomerAddress: true,
|
showCustomerAddress: true,
|
||||||
|
|
||||||
// Company address
|
// Company address
|
||||||
companyAddress: '',
|
|
||||||
showCompanyAddress: true,
|
showCompanyAddress: true,
|
||||||
billedToLabel: 'Billed To',
|
billedToLabel: 'Billed To',
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user