mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
fix: Pdf branding templates request data
This commit is contained in:
@@ -2,12 +2,13 @@ import { useFormikContext } from 'formik';
|
||||
import { ElementCustomize } from '../../../ElementCustomize/ElementCustomize';
|
||||
import { EstimateCustomizeGeneralField } from './EstimateCustomizeFieldsGeneral';
|
||||
import { EstimateCustomizeContentFields } from './EstimateCustomizeFieldsContent';
|
||||
import { EstimatePaperTemplate } from './EstimatePaperTemplate';
|
||||
import { EstimateCustomizeValues } from './types';
|
||||
import { EstimatePaperTemplate, EstimatePaperTemplateProps } from './EstimatePaperTemplate';
|
||||
import { EstimateBrandingState, EstimateCustomizeValues } from './types';
|
||||
import { initialValues } from './constants';
|
||||
import { useDrawerContext } from '@/components/Drawer/DrawerProvider';
|
||||
import { useDrawerActions } from '@/hooks/state';
|
||||
import { BrandingTemplateForm } from '@/containers/BrandingTemplates/BrandingTemplateForm';
|
||||
import { useElementCustomizeContext } from '@/containers/ElementCustomize/ElementCustomizeProvider';
|
||||
|
||||
export function EstimateCustomizeContent() {
|
||||
const { payload, name } = useDrawerContext();
|
||||
@@ -19,7 +20,7 @@ export function EstimateCustomizeContent() {
|
||||
};
|
||||
|
||||
return (
|
||||
<BrandingTemplateForm<EstimateCustomizeValues>
|
||||
<BrandingTemplateForm<EstimateCustomizeValues, EstimateBrandingState>
|
||||
templateId={templateId}
|
||||
defaultValues={initialValues}
|
||||
onSuccess={handleSuccess}
|
||||
@@ -40,8 +41,15 @@ export function EstimateCustomizeContent() {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Injects the `EstimatePaperTemplate` component props from the form and branding states.
|
||||
* @returns {JSX.Element}
|
||||
*/
|
||||
function EstimatePaperTemplateFormConnected() {
|
||||
const { values } = useFormikContext<EstimateCustomizeValues>();
|
||||
const { brandingState } = useElementCustomizeContext()
|
||||
|
||||
return <EstimatePaperTemplate {...values} />;
|
||||
const mergedProps: EstimatePaperTemplateProps = { ...values, ...brandingState }
|
||||
|
||||
return <EstimatePaperTemplate {...mergedProps} />;
|
||||
}
|
||||
|
||||
@@ -20,15 +20,11 @@ export const initialValues = {
|
||||
showExpirationDate: true,
|
||||
expirationDateLabel: 'Expiration Date',
|
||||
|
||||
// Company name
|
||||
companyName: 'Bigcapital Technology, Inc.',
|
||||
|
||||
// Customer address
|
||||
showCustomerAddress: true,
|
||||
|
||||
// Company address
|
||||
showCompanyAddress: true,
|
||||
companyAddress: '',
|
||||
billedToLabel: 'Billed To',
|
||||
|
||||
// Entries
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { BrandingTemplateValues } from '@/containers/BrandingTemplates/types';
|
||||
import { BrandingState, BrandingTemplateValues } from '@/containers/BrandingTemplates/types';
|
||||
|
||||
export interface EstimateBrandingState extends BrandingState {}
|
||||
|
||||
export interface EstimateCustomizeValues extends BrandingTemplateValues {
|
||||
// Colors
|
||||
@@ -20,9 +22,6 @@ export interface EstimateCustomizeValues extends BrandingTemplateValues {
|
||||
estimateDateLabel?: string;
|
||||
showEstimateDate?: boolean;
|
||||
|
||||
// Company name
|
||||
companyName?: string;
|
||||
|
||||
// Addresses
|
||||
showBilledFromAddress?: boolean;
|
||||
showBillingToAddress?: boolean;
|
||||
|
||||
Reference in New Issue
Block a user