Skip to content

Commit

Permalink
fix: Pdf branding template initial values
Browse files Browse the repository at this point in the history
  • Loading branch information
abouolia committed Oct 7, 2024
1 parent 9edfb83 commit e76d3b1
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,17 @@ export const initialValues = {
showInvoiceNumber: true,
invoiceNumberLabel: 'Invoice number',

// Issue date
showDateIssue: true,
dateIssueLabel: 'Date of Issue',

// Due date.
showDueDate: true,
dueDateLabel: 'Due Date',

// Company name
companyName: 'Bigcapital Technology, Inc.',

// Addresses
showCustomerAddress: true,
showCompanyAddress: true,
companyAddress: '',
billedToLabel: 'Billed To',

// Entries
Expand All @@ -41,6 +39,7 @@ export const initialValues = {
showSubtotal: true,
subtotalLabel: 'Subtotal',

// Discount
showDiscount: true,
discountLabel: 'Discount',

Expand All @@ -52,13 +51,15 @@ export const initialValues = {
paymentMadeLabel: 'Payment Made',
showPaymentMade: true,

// Due amount
dueAmountLabel: 'Due Amount',
showDueAmount: true,

// Footer paragraphs.
termsConditionsLabel: 'Terms & Conditions',
showTermsConditions: true,

// Statement
statementLabel: 'Statement',
showStatement: true,
};
Expand Down
Original file line number Diff line number Diff line change
@@ -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
primaryColor?: string;
secondaryColor?: string;
Expand All @@ -14,15 +16,14 @@ export interface InvoiceCustomizeValues extends BrandingTemplateValues {
showInvoiceNumber?: boolean;
invoiceNumberLabel?: string;

// Date issue
showDateIssue?: boolean;
dateIssueLabel?: string;

// Due date
showDueDate?: boolean;
dueDateLabel?: string;

// Company name
companyName?: string;

// Addresses
showBilledFromAddress?: boolean;
showBillingToAddress?: boolean;
Expand All @@ -38,6 +39,7 @@ export interface InvoiceCustomizeValues extends BrandingTemplateValues {
showSubtotal?: boolean;
subtotalLabel?: string;

// Discount
showDiscount?: boolean;
discountLabel?: string;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { omit } from 'lodash';
import { useFormikContext } from 'formik';
import { InvoiceCustomizeValues } from './types';
import { InvoiceCustomizeFormValues } from './types';
import {
CreatePdfTemplateValues,
EditPdfTemplateValues,
Expand All @@ -10,7 +9,7 @@ import { initialValues } from './constants';
import { useBrandingTemplateBoot } from '@/containers/BrandingTemplates/BrandingTemplateBoot';

export const transformToEditRequest = (
values: InvoiceCustomizeValues,
values: InvoiceCustomizeFormValues,
): EditPdfTemplateValues => {
return {
templateName: values.templateName,
Expand All @@ -19,7 +18,7 @@ export const transformToEditRequest = (
};

export const transformToNewRequest = (
values: InvoiceCustomizeValues,
values: InvoiceCustomizeFormValues,
): CreatePdfTemplateValues => {
return {
resource: 'SaleInvoice',
Expand All @@ -28,7 +27,7 @@ export const transformToNewRequest = (
};
};

export const useInvoiceCustomizeInitialValues = (): InvoiceCustomizeValues => {
export const useInvoiceCustomizeInitialValues = (): InvoiceCustomizeFormValues => {
const { pdfTemplate } = useBrandingTemplateBoot();

const defaultPdfTemplate = {
Expand All @@ -40,6 +39,6 @@ export const useInvoiceCustomizeInitialValues = (): InvoiceCustomizeValues => {
...(transformToForm(
defaultPdfTemplate,
initialValues,
) as InvoiceCustomizeValues),
) as InvoiceCustomizeFormValues),
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const initialValues = {

// Customer address
showCompanyAddress: true,
companyAddress: '',

// Company address
showCustomerAddress: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const initialValues = {
showCustomerAddress: true,

// Company address
companyAddress: '',
showCompanyAddress: true,
billedToLabel: 'Billed To',

Expand Down

0 comments on commit e76d3b1

Please sign in to comment.