mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
feat: optimize branding templates customiing
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
import { InputGroupProps, SwitchProps } from '@blueprintjs/core';
|
||||||
import { FInputGroup, FSwitch, Group, Stack } from '@/components';
|
import { FInputGroup, FSwitch, Group, Stack } from '@/components';
|
||||||
import { CLASSES } from '@/constants';
|
import { CLASSES } from '@/constants';
|
||||||
import { InputGroupProps, SwitchProps } from '@blueprintjs/core';
|
|
||||||
|
|
||||||
export function ElementCustomizeFieldsGroup({
|
export function ElementCustomizeFieldsGroup({
|
||||||
label,
|
label,
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import { Group, Stack } from '@/components';
|
import { Group, Stack } from '@/components';
|
||||||
import { PaperTemplate, PaperTemplateProps } from '../../Invoices/InvoiceCustomize/PaperTemplate';
|
import {
|
||||||
|
PaperTemplate,
|
||||||
|
PaperTemplateProps,
|
||||||
|
} from '../../Invoices/InvoiceCustomize/PaperTemplate';
|
||||||
|
|
||||||
export interface CreditNotePaperTemplateProps extends PaperTemplateProps {
|
export interface CreditNotePaperTemplateProps extends PaperTemplateProps {
|
||||||
billedToAddress?: Array<string>;
|
billedToAddress?: Array<string>;
|
||||||
@@ -131,8 +134,8 @@ export function CreditNotePaperTemplate({
|
|||||||
columns={[
|
columns={[
|
||||||
{ label: 'Item', accessor: 'item' },
|
{ label: 'Item', accessor: 'item' },
|
||||||
{ label: 'Description', accessor: 'item' },
|
{ label: 'Description', accessor: 'item' },
|
||||||
{ label: 'Rate', accessor: 'rate' },
|
{ label: 'Rate', accessor: 'rate', align: 'right' },
|
||||||
{ label: 'Total', accessor: 'total' },
|
{ label: 'Total', accessor: 'total', align: 'right' },
|
||||||
]}
|
]}
|
||||||
data={lines}
|
data={lines}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import { Classes } from '@blueprintjs/core';
|
|
||||||
import { useFormikContext } from 'formik';
|
import { useFormikContext } from 'formik';
|
||||||
import { Box } from '@/components';
|
|
||||||
import { ElementCustomize } from '../../../ElementCustomize/ElementCustomize';
|
import { ElementCustomize } from '../../../ElementCustomize/ElementCustomize';
|
||||||
import { EstimateCustomizeGeneralField } from './EstimateCustomizeFieldsGeneral';
|
import { EstimateCustomizeGeneralField } from './EstimateCustomizeFieldsGeneral';
|
||||||
import { EstimateCustomizeContentFields } from './EstimateCustomizeFieldsContent';
|
import { EstimateCustomizeContentFields } from './EstimateCustomizeFieldsContent';
|
||||||
@@ -14,7 +12,6 @@ import { BrandingTemplateForm } from '@/containers/BrandingTemplates/BrandingTem
|
|||||||
export function EstimateCustomizeContent() {
|
export function EstimateCustomizeContent() {
|
||||||
const { payload, name } = useDrawerContext();
|
const { payload, name } = useDrawerContext();
|
||||||
const { closeDrawer } = useDrawerActions();
|
const { closeDrawer } = useDrawerActions();
|
||||||
|
|
||||||
const templateId = payload?.templateId || null;
|
const templateId = payload?.templateId || null;
|
||||||
|
|
||||||
const handleSuccess = () => {
|
const handleSuccess = () => {
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ export function EstimatePaperTemplate({
|
|||||||
secondaryColor,
|
secondaryColor,
|
||||||
showCompanyLogo = true,
|
showCompanyLogo = true,
|
||||||
companyLogo,
|
companyLogo,
|
||||||
|
companyName,
|
||||||
|
|
||||||
billedToAddress = [
|
billedToAddress = [
|
||||||
'Bigcapital Technology, Inc.',
|
'Bigcapital Technology, Inc.',
|
||||||
@@ -74,6 +75,9 @@ export function EstimatePaperTemplate({
|
|||||||
'+1 762-339-5634',
|
'+1 762-339-5634',
|
||||||
'ahmed@bigcapital.app',
|
'ahmed@bigcapital.app',
|
||||||
],
|
],
|
||||||
|
showBilledFromAddress = true,
|
||||||
|
showBilledToAddress = true,
|
||||||
|
|
||||||
total = '$1000.00',
|
total = '$1000.00',
|
||||||
totalLabel = 'Total',
|
totalLabel = 'Total',
|
||||||
showTotal = true,
|
showTotal = true,
|
||||||
@@ -141,8 +145,14 @@ export function EstimatePaperTemplate({
|
|||||||
</PaperTemplate.TermsList>
|
</PaperTemplate.TermsList>
|
||||||
|
|
||||||
<Group spacing={10}>
|
<Group spacing={10}>
|
||||||
<PaperTemplate.Address items={billedToAddress} />
|
{showBilledFromAddress && (
|
||||||
<PaperTemplate.Address items={billedFromAddress} />
|
<PaperTemplate.Address
|
||||||
|
items={[<strong>{companyName}</strong>, ...billedFromAddress]}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{showBilledToAddress && (
|
||||||
|
<PaperTemplate.Address items={billedToAddress} />
|
||||||
|
)}
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
<Stack spacing={0}>
|
<Stack spacing={0}>
|
||||||
@@ -150,8 +160,8 @@ export function EstimatePaperTemplate({
|
|||||||
columns={[
|
columns={[
|
||||||
{ label: 'Item', accessor: 'item' },
|
{ label: 'Item', accessor: 'item' },
|
||||||
{ label: 'Description', accessor: 'item' },
|
{ label: 'Description', accessor: 'item' },
|
||||||
{ label: 'Rate', accessor: 'rate' },
|
{ label: 'Rate', accessor: 'rate', align: 'right' },
|
||||||
{ label: 'Total', accessor: 'total' },
|
{ label: 'Total', accessor: 'total', align: 'right' },
|
||||||
]}
|
]}
|
||||||
data={lines}
|
data={lines}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export const initialValues = {
|
|||||||
|
|
||||||
// Addresses
|
// Addresses
|
||||||
showBilledFromAddress: true,
|
showBilledFromAddress: true,
|
||||||
showBillingToAddress: true,
|
showBilledToAddress: true,
|
||||||
billedToLabel: 'Billed To',
|
billedToLabel: 'Billed To',
|
||||||
|
|
||||||
// Entries
|
// Entries
|
||||||
@@ -55,7 +55,7 @@ export const fieldsGroups = [
|
|||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
labelKey: 'estimateNumberLabel',
|
labelKey: 'estimateNumberLabel',
|
||||||
enableKey: 'showEstimateeNumber',
|
enableKey: 'showEstimateNumber',
|
||||||
label: 'Estimate No.',
|
label: 'Estimate No.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -65,11 +65,11 @@ export const fieldsGroups = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
labelKey: 'expirationDateLabel',
|
labelKey: 'expirationDateLabel',
|
||||||
enableKey: 'expirationDueDate',
|
enableKey: 'showExpirationDate',
|
||||||
label: 'Expiration Date',
|
label: 'Expiration Date',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
enableKey: 'showBillingToAddress',
|
enableKey: 'showBilledToAddress',
|
||||||
labelKey: 'billedToLabel',
|
labelKey: 'billedToLabel',
|
||||||
label: 'Bill To',
|
label: 'Bill To',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { PaperTemplate } from './PaperTemplate';
|
import { PaperTemplate, PaperTemplateTotalBorder } from './PaperTemplate';
|
||||||
import { Group, Stack } from '@/components';
|
import { Group, Stack } from '@/components';
|
||||||
|
|
||||||
interface PapaerLine {
|
interface PapaerLine {
|
||||||
@@ -223,8 +223,8 @@ export function InvoicePaperTemplate({
|
|||||||
columns={[
|
columns={[
|
||||||
{ label: lineItemLabel, accessor: 'item' },
|
{ label: lineItemLabel, accessor: 'item' },
|
||||||
{ label: lineDescriptionLabel, accessor: 'description' },
|
{ label: lineDescriptionLabel, accessor: 'description' },
|
||||||
{ label: lineRateLabel, accessor: 'rate' },
|
{ label: lineRateLabel, accessor: 'rate', align: 'right' },
|
||||||
{ label: lineTotalLabel, accessor: 'total' },
|
{ label: lineTotalLabel, accessor: 'total', align: 'right' },
|
||||||
]}
|
]}
|
||||||
data={lines}
|
data={lines}
|
||||||
/>
|
/>
|
||||||
@@ -233,6 +233,7 @@ export function InvoicePaperTemplate({
|
|||||||
<PaperTemplate.TotalLine
|
<PaperTemplate.TotalLine
|
||||||
label={subtotalLabel}
|
label={subtotalLabel}
|
||||||
amount={subtotal}
|
amount={subtotal}
|
||||||
|
border={PaperTemplateTotalBorder.Gray}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{showDiscount && (
|
{showDiscount && (
|
||||||
@@ -253,7 +254,12 @@ export function InvoicePaperTemplate({
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{showTotal && (
|
{showTotal && (
|
||||||
<PaperTemplate.TotalLine label={totalLabel} amount={total} />
|
<PaperTemplate.TotalLine
|
||||||
|
label={totalLabel}
|
||||||
|
amount={total}
|
||||||
|
border={PaperTemplateTotalBorder.Dark}
|
||||||
|
style={{ fontWeight: 500 }}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
{showPaymentMade && (
|
{showPaymentMade && (
|
||||||
<PaperTemplate.TotalLine
|
<PaperTemplate.TotalLine
|
||||||
@@ -265,6 +271,8 @@ export function InvoicePaperTemplate({
|
|||||||
<PaperTemplate.TotalLine
|
<PaperTemplate.TotalLine
|
||||||
label={balanceDueLabel}
|
label={balanceDueLabel}
|
||||||
amount={balanceDue}
|
amount={balanceDue}
|
||||||
|
border={PaperTemplateTotalBorder.Dark}
|
||||||
|
style={{ fontWeight: 500 }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</PaperTemplate.Totals>
|
</PaperTemplate.Totals>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ export interface PaperTemplateProps {
|
|||||||
|
|
||||||
showCompanyLogo?: boolean;
|
showCompanyLogo?: boolean;
|
||||||
companyLogo?: string;
|
companyLogo?: string;
|
||||||
|
companyName?: string;
|
||||||
|
|
||||||
bigtitle?: string;
|
bigtitle?: string;
|
||||||
|
|
||||||
@@ -44,7 +45,11 @@ export function PaperTemplate({
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface PaperTemplateTableProps {
|
interface PaperTemplateTableProps {
|
||||||
columns: Array<{ accessor: string; label: string }>;
|
columns: Array<{
|
||||||
|
accessor: string;
|
||||||
|
label: string;
|
||||||
|
align?: 'left' | 'center' | 'right';
|
||||||
|
}>;
|
||||||
data: Array<Record<string, any>>;
|
data: Array<Record<string, any>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +59,9 @@ PaperTemplate.Table = ({ columns, data }: PaperTemplateTableProps) => {
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
{columns.map((col, index) => (
|
{columns.map((col, index) => (
|
||||||
<th key={index}>{col.label}</th>
|
<th key={index} align={col.align}>
|
||||||
|
{col.label}
|
||||||
|
</th>
|
||||||
))}
|
))}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -63,7 +70,9 @@ PaperTemplate.Table = ({ columns, data }: PaperTemplateTableProps) => {
|
|||||||
{data.map((_data: any) => (
|
{data.map((_data: any) => (
|
||||||
<tr>
|
<tr>
|
||||||
{columns.map((column, index) => (
|
{columns.map((column, index) => (
|
||||||
<td key={index}>{get(_data, column.accessor)}</td>
|
<td align={column.align} key={index}>
|
||||||
|
{get(_data, column.accessor)}
|
||||||
|
</td>
|
||||||
))}
|
))}
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
@@ -72,18 +81,34 @@ PaperTemplate.Table = ({ columns, data }: PaperTemplateTableProps) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export enum PaperTemplateTotalBorder {
|
||||||
|
Gray = 'gray',
|
||||||
|
Dark = 'dark',
|
||||||
|
}
|
||||||
|
|
||||||
PaperTemplate.Totals = ({ children }: { children: React.ReactNode }) => {
|
PaperTemplate.Totals = ({ children }: { children: React.ReactNode }) => {
|
||||||
return <div className={styles.totals}>{children}</div>;
|
return <div className={clsx(styles.totals)}>{children}</div>;
|
||||||
};
|
};
|
||||||
PaperTemplate.TotalLine = ({
|
PaperTemplate.TotalLine = ({
|
||||||
label,
|
label,
|
||||||
amount,
|
amount,
|
||||||
|
border,
|
||||||
|
style,
|
||||||
}: {
|
}: {
|
||||||
label: string;
|
label: string;
|
||||||
amount: string;
|
amount: string;
|
||||||
|
border?: PaperTemplateTotalBorder;
|
||||||
|
style?: any;
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<div className={clsx(styles.totalsItem, styles.totalBottomGrayBordered)}>
|
<div
|
||||||
|
className={clsx(styles.totalsItem, {
|
||||||
|
[styles.totalBottomBordered]: border === PaperTemplateTotalBorder.Dark,
|
||||||
|
[styles.totalBottomGrayBordered]:
|
||||||
|
border === PaperTemplateTotalBorder.Gray,
|
||||||
|
})}
|
||||||
|
style={style}
|
||||||
|
>
|
||||||
<div className={styles.totalsItemLabel}>{label}</div>
|
<div className={styles.totalsItemLabel}>{label}</div>
|
||||||
<div className={styles.totalsItemAmount}>{amount}</div>
|
<div className={styles.totalsItemAmount}>{amount}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Group, Stack } from '@/components';
|
|||||||
import {
|
import {
|
||||||
PaperTemplate,
|
PaperTemplate,
|
||||||
PaperTemplateProps,
|
PaperTemplateProps,
|
||||||
|
PaperTemplateTotalBorder,
|
||||||
} from '../../Invoices/InvoiceCustomize/PaperTemplate';
|
} from '../../Invoices/InvoiceCustomize/PaperTemplate';
|
||||||
|
|
||||||
export interface PaymentReceivedPaperTemplateProps extends PaperTemplateProps {
|
export interface PaymentReceivedPaperTemplateProps extends PaperTemplateProps {
|
||||||
@@ -44,6 +45,7 @@ export function PaymentReceivedPaperTemplate({
|
|||||||
secondaryColor,
|
secondaryColor,
|
||||||
showCompanyLogo = true,
|
showCompanyLogo = true,
|
||||||
companyLogo,
|
companyLogo,
|
||||||
|
companyName = 'Bigcapital Technology, Inc.',
|
||||||
|
|
||||||
billedToAddress = [
|
billedToAddress = [
|
||||||
'Bigcapital Technology, Inc.',
|
'Bigcapital Technology, Inc.',
|
||||||
@@ -62,6 +64,7 @@ export function PaymentReceivedPaperTemplate({
|
|||||||
],
|
],
|
||||||
showBilledFromAddress,
|
showBilledFromAddress,
|
||||||
showBillingToAddress,
|
showBillingToAddress,
|
||||||
|
billedToLabel = 'Billed To',
|
||||||
|
|
||||||
total = '$1000.00',
|
total = '$1000.00',
|
||||||
totalLabel = 'Total',
|
totalLabel = 'Total',
|
||||||
@@ -110,11 +113,15 @@ export function PaymentReceivedPaperTemplate({
|
|||||||
</PaperTemplate.TermsList>
|
</PaperTemplate.TermsList>
|
||||||
|
|
||||||
<Group spacing={10}>
|
<Group spacing={10}>
|
||||||
{showBillingToAddress && (
|
|
||||||
<PaperTemplate.Address items={billedToAddress} />
|
|
||||||
)}
|
|
||||||
{showBilledFromAddress && (
|
{showBilledFromAddress && (
|
||||||
<PaperTemplate.Address items={billedFromAddress} />
|
<PaperTemplate.Address
|
||||||
|
items={[<strong>{companyName}</strong>, ...billedFromAddress]}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{showBillingToAddress && (
|
||||||
|
<PaperTemplate.Address
|
||||||
|
items={[<strong>{billedToLabel}</strong>, ...billedToAddress]}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
@@ -122,8 +129,12 @@ export function PaymentReceivedPaperTemplate({
|
|||||||
<PaperTemplate.Table
|
<PaperTemplate.Table
|
||||||
columns={[
|
columns={[
|
||||||
{ label: 'Invoice #', accessor: 'invoiceNumber' },
|
{ label: 'Invoice #', accessor: 'invoiceNumber' },
|
||||||
{ label: 'Invoice Amount', accessor: 'invoiceAmount' },
|
{
|
||||||
{ label: 'Paid Amount', accessor: 'paidAmount' },
|
label: 'Invoice Amount',
|
||||||
|
accessor: 'invoiceAmount',
|
||||||
|
align: 'right',
|
||||||
|
},
|
||||||
|
{ label: 'Paid Amount', accessor: 'paidAmount', align: 'right' },
|
||||||
]}
|
]}
|
||||||
data={lines}
|
data={lines}
|
||||||
/>
|
/>
|
||||||
@@ -132,10 +143,16 @@ export function PaymentReceivedPaperTemplate({
|
|||||||
<PaperTemplate.TotalLine
|
<PaperTemplate.TotalLine
|
||||||
label={subtotalLabel}
|
label={subtotalLabel}
|
||||||
amount={subtotal}
|
amount={subtotal}
|
||||||
|
border={PaperTemplateTotalBorder.Gray}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{showTotal && (
|
{showTotal && (
|
||||||
<PaperTemplate.TotalLine label={totalLabel} amount={total} />
|
<PaperTemplate.TotalLine
|
||||||
|
label={totalLabel}
|
||||||
|
amount={total}
|
||||||
|
border={PaperTemplateTotalBorder.Dark}
|
||||||
|
style={{ fontWeight: 500 }}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</PaperTemplate.Totals>
|
</PaperTemplate.Totals>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
import { useFormikContext } from 'formik';
|
||||||
import { ElementCustomize } from '../../../ElementCustomize/ElementCustomize';
|
import { ElementCustomize } from '../../../ElementCustomize/ElementCustomize';
|
||||||
import { ReceiptCustomizeGeneralField } from './ReceiptCustomizeFieldsGeneral';
|
import { ReceiptCustomizeGeneralField } from './ReceiptCustomizeFieldsGeneral';
|
||||||
import { ReceiptCustomizeFieldsContent } from './ReceiptCustomizeFieldsContent';
|
import { ReceiptCustomizeFieldsContent } from './ReceiptCustomizeFieldsContent';
|
||||||
import { ReceiptPaperTemplate } from './ReceiptPaperTemplate';
|
import { ReceiptPaperTemplate } from './ReceiptPaperTemplate';
|
||||||
import { ReceiptCustomizeValues } from './types';
|
import { ReceiptCustomizeValues } from './types';
|
||||||
import { initialValues } from './constants';
|
import { initialValues } from './constants';
|
||||||
import { useFormikContext } from 'formik';
|
|
||||||
import { BrandingTemplateForm } from '@/containers/BrandingTemplates/BrandingTemplateForm';
|
import { BrandingTemplateForm } from '@/containers/BrandingTemplates/BrandingTemplateForm';
|
||||||
import { useDrawerActions } from '@/hooks/state';
|
import { useDrawerActions } from '@/hooks/state';
|
||||||
import { useDrawerContext } from '@/components/Drawer/DrawerProvider';
|
import { useDrawerContext } from '@/components/Drawer/DrawerProvider';
|
||||||
@@ -12,7 +12,6 @@ import { useDrawerContext } from '@/components/Drawer/DrawerProvider';
|
|||||||
export function ReceiptCustomizeContent() {
|
export function ReceiptCustomizeContent() {
|
||||||
const { payload, name } = useDrawerContext();
|
const { payload, name } = useDrawerContext();
|
||||||
const { closeDrawer } = useDrawerActions();
|
const { closeDrawer } = useDrawerActions();
|
||||||
|
|
||||||
const templateId = payload?.templateId || null;
|
const templateId = payload?.templateId || null;
|
||||||
|
|
||||||
const handleFormSuccess = () => {
|
const handleFormSuccess = () => {
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import { Stack } from '@/components';
|
import { Stack } from '@/components';
|
||||||
import { Classes } from '@blueprintjs/core';
|
import { Classes } from '@blueprintjs/core';
|
||||||
|
import {
|
||||||
|
ElementCustomizeContentItemFieldGroup,
|
||||||
|
ElementCustomizeFieldsGroup,
|
||||||
|
} from '@/containers/ElementCustomize/ElementCustomizeFieldsGroup';
|
||||||
|
import { fieldsGroups } from './constants';
|
||||||
|
|
||||||
export function ReceiptCustomizeFieldsContent() {
|
export function ReceiptCustomizeFieldsContent() {
|
||||||
return (
|
return (
|
||||||
@@ -16,7 +21,24 @@ export function ReceiptCustomizeFieldsContent() {
|
|||||||
</p>
|
</p>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<Stack></Stack>
|
<Stack>
|
||||||
|
{fieldsGroups.map((group) => (
|
||||||
|
<ElementCustomizeFieldsGroup label={group.label}>
|
||||||
|
{group.fields.map((item, index) => (
|
||||||
|
<ElementCustomizeContentItemFieldGroup
|
||||||
|
key={index}
|
||||||
|
inputGroupProps={{
|
||||||
|
name: item.enableKey,
|
||||||
|
label: item.label,
|
||||||
|
}}
|
||||||
|
switchProps={{
|
||||||
|
name: item.labelKey,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</ElementCustomizeFieldsGroup>
|
||||||
|
))}
|
||||||
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,38 @@
|
|||||||
import { Group, Stack } from '@/components';
|
import { Group, Stack } from '@/components';
|
||||||
import { PaperTemplate, PaperTemplateProps } from '../../Invoices/InvoiceCustomize/PaperTemplate';
|
import {
|
||||||
|
PaperTemplate,
|
||||||
|
PaperTemplateProps,
|
||||||
|
} from '../../Invoices/InvoiceCustomize/PaperTemplate';
|
||||||
|
|
||||||
export interface ReceiptPaperTemplateProps extends PaperTemplateProps {
|
export interface ReceiptPaperTemplateProps extends PaperTemplateProps {
|
||||||
|
// Addresses
|
||||||
billedToAddress?: Array<string>;
|
billedToAddress?: Array<string>;
|
||||||
billedFromAddress?: Array<string>;
|
billedFromAddress?: Array<string>;
|
||||||
|
showBilledFromAddress?: boolean;
|
||||||
|
showBilledToAddress?: boolean;
|
||||||
|
billedToLabel?: string;
|
||||||
|
|
||||||
|
// Total
|
||||||
total?: string;
|
total?: string;
|
||||||
showTotal?: boolean;
|
showTotal?: boolean;
|
||||||
totalLabel?: string;
|
totalLabel?: string;
|
||||||
|
|
||||||
|
// Subtotal
|
||||||
subtotal?: string;
|
subtotal?: string;
|
||||||
showSubtotal?: boolean;
|
showSubtotal?: boolean;
|
||||||
subtotalLabel?: string;
|
subtotalLabel?: string;
|
||||||
|
|
||||||
|
// Customer Note
|
||||||
showCustomerNote?: boolean;
|
showCustomerNote?: boolean;
|
||||||
customerNote?: string;
|
customerNote?: string;
|
||||||
customerNoteLabel?: string;
|
customerNoteLabel?: string;
|
||||||
|
|
||||||
|
// Terms & Conditions
|
||||||
showTermsConditions?: boolean;
|
showTermsConditions?: boolean;
|
||||||
termsConditions?: string;
|
termsConditions?: string;
|
||||||
termsConditionsLabel?: string;
|
termsConditionsLabel?: string;
|
||||||
|
|
||||||
|
// Lines
|
||||||
lines?: Array<{
|
lines?: Array<{
|
||||||
item: string;
|
item: string;
|
||||||
description: string;
|
description: string;
|
||||||
@@ -29,10 +41,12 @@ export interface ReceiptPaperTemplateProps extends PaperTemplateProps {
|
|||||||
total: string;
|
total: string;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
// Receipt Date.
|
||||||
receiptDateLabel?: string;
|
receiptDateLabel?: string;
|
||||||
showReceiptDate?: boolean;
|
showReceiptDate?: boolean;
|
||||||
receiptDate?: string;
|
receiptDate?: string;
|
||||||
|
|
||||||
|
// Receipt Number
|
||||||
receiptNumebr?: string;
|
receiptNumebr?: string;
|
||||||
receiptNumberLabel?: string;
|
receiptNumberLabel?: string;
|
||||||
showReceiptNumber?: boolean;
|
showReceiptNumber?: boolean;
|
||||||
@@ -43,7 +57,9 @@ export function ReceiptPaperTemplate({
|
|||||||
secondaryColor,
|
secondaryColor,
|
||||||
showCompanyLogo = true,
|
showCompanyLogo = true,
|
||||||
companyLogo,
|
companyLogo,
|
||||||
|
companyName = 'Bigcapital Technology, Inc.',
|
||||||
|
|
||||||
|
// # Address
|
||||||
billedToAddress = [
|
billedToAddress = [
|
||||||
'Bigcapital Technology, Inc.',
|
'Bigcapital Technology, Inc.',
|
||||||
'131 Continental Dr Suite 305 Newark,',
|
'131 Continental Dr Suite 305 Newark,',
|
||||||
@@ -59,6 +75,10 @@ export function ReceiptPaperTemplate({
|
|||||||
'+1 762-339-5634',
|
'+1 762-339-5634',
|
||||||
'ahmed@bigcapital.app',
|
'ahmed@bigcapital.app',
|
||||||
],
|
],
|
||||||
|
showBilledFromAddress = true,
|
||||||
|
showBilledToAddress = true,
|
||||||
|
billedToLabel = 'Billed To',
|
||||||
|
|
||||||
total = '$1000.00',
|
total = '$1000.00',
|
||||||
totalLabel = 'Total',
|
totalLabel = 'Total',
|
||||||
showTotal = true,
|
showTotal = true,
|
||||||
@@ -107,7 +127,6 @@ export function ReceiptPaperTemplate({
|
|||||||
{receiptNumebr}
|
{receiptNumebr}
|
||||||
</PaperTemplate.TermsItem>
|
</PaperTemplate.TermsItem>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{showReceiptDate && (
|
{showReceiptDate && (
|
||||||
<PaperTemplate.TermsItem label={receiptDateLabel}>
|
<PaperTemplate.TermsItem label={receiptDateLabel}>
|
||||||
{receiptDate}
|
{receiptDate}
|
||||||
@@ -116,8 +135,16 @@ export function ReceiptPaperTemplate({
|
|||||||
</PaperTemplate.TermsList>
|
</PaperTemplate.TermsList>
|
||||||
|
|
||||||
<Group spacing={10}>
|
<Group spacing={10}>
|
||||||
<PaperTemplate.Address items={billedToAddress} />
|
{showBilledFromAddress && (
|
||||||
<PaperTemplate.Address items={billedFromAddress} />
|
<PaperTemplate.Address
|
||||||
|
items={[<strong>{companyName}</strong>, ...billedFromAddress]}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{showBilledToAddress && (
|
||||||
|
<PaperTemplate.Address
|
||||||
|
items={[<strong>{billedToLabel}</strong>, ...billedToAddress]}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
<Stack spacing={0}>
|
<Stack spacing={0}>
|
||||||
@@ -125,8 +152,8 @@ export function ReceiptPaperTemplate({
|
|||||||
columns={[
|
columns={[
|
||||||
{ label: 'Item', accessor: 'item' },
|
{ label: 'Item', accessor: 'item' },
|
||||||
{ label: 'Description', accessor: 'item' },
|
{ label: 'Description', accessor: 'item' },
|
||||||
{ label: 'Rate', accessor: 'rate' },
|
{ label: 'Rate', accessor: 'rate', align: 'right' },
|
||||||
{ label: 'Total', accessor: 'total' },
|
{ label: 'Total', accessor: 'total', align: 'right' },
|
||||||
]}
|
]}
|
||||||
data={lines}
|
data={lines}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export const initialValues = {
|
|||||||
|
|
||||||
// Addresses
|
// Addresses
|
||||||
showBilledFromAddress: true,
|
showBilledFromAddress: true,
|
||||||
showBillingToAddress: true,
|
showBilledToAddress: true,
|
||||||
billedToLabel: 'Billed To',
|
billedToLabel: 'Billed To',
|
||||||
|
|
||||||
// Entries
|
// Entries
|
||||||
@@ -48,3 +48,56 @@ export const initialValues = {
|
|||||||
customerNoteLabel: 'Customer Note',
|
customerNoteLabel: 'Customer Note',
|
||||||
showCustomerNote: true,
|
showCustomerNote: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const fieldsGroups = [
|
||||||
|
{
|
||||||
|
label: 'Header',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
labelKey: 'receiptNumberLabel',
|
||||||
|
enableKey: 'showReceiptNumber',
|
||||||
|
label: 'Receipt Number',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
labelKey: 'receiptDateLabel',
|
||||||
|
enableKey: 'showReceiptDate',
|
||||||
|
label: 'Receipt Date',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
enableKey: 'showBilledToAddress',
|
||||||
|
labelKey: 'billedToLabel',
|
||||||
|
label: 'Bill To',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
enableKey: 'showBilledFromAddress',
|
||||||
|
label: 'Billed From',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Totals',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
labelKey: 'subtotalLabel',
|
||||||
|
enableKey: 'showSubtotal',
|
||||||
|
label: 'Subtotal',
|
||||||
|
},
|
||||||
|
{ labelKey: 'totalLabel', enableKey: 'showTotal', label: 'Total' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Statements',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
enableKey: 'showCustomerNote',
|
||||||
|
labelKey: 'customerNoteLabel',
|
||||||
|
label: 'Customer Note',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
enableKey: 'showTermsConditions',
|
||||||
|
labelKey: 'termsConditionsLabel',
|
||||||
|
label: 'Terms & Conditions',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -9,10 +9,11 @@ export interface ReceiptCustomizeValues extends BrandingTemplateValues {
|
|||||||
showCompanyLogo?: boolean;
|
showCompanyLogo?: boolean;
|
||||||
companyLogo?: string;
|
companyLogo?: string;
|
||||||
|
|
||||||
// Top details.
|
// Receipt Number
|
||||||
showReceiptNumber?: boolean;
|
showReceiptNumber?: boolean;
|
||||||
receiptNumberLabel?: string;
|
receiptNumberLabel?: string;
|
||||||
|
|
||||||
|
// Receipt Date.
|
||||||
showReceiptDate?: boolean;
|
showReceiptDate?: boolean;
|
||||||
receiptDateLabel?: string;
|
receiptDateLabel?: string;
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ export interface ReceiptCustomizeValues extends BrandingTemplateValues {
|
|||||||
|
|
||||||
// Addresses
|
// Addresses
|
||||||
showBilledFromAddress?: boolean;
|
showBilledFromAddress?: boolean;
|
||||||
showBillingToAddress?: boolean;
|
showBilledToAddress?: boolean;
|
||||||
billedToLabel?: string;
|
billedToLabel?: string;
|
||||||
|
|
||||||
// Entries
|
// Entries
|
||||||
@@ -30,17 +31,19 @@ export interface ReceiptCustomizeValues extends BrandingTemplateValues {
|
|||||||
itemRateLabel?: string;
|
itemRateLabel?: string;
|
||||||
itemTotalLabel?: string;
|
itemTotalLabel?: string;
|
||||||
|
|
||||||
// Totals
|
// Subtotal
|
||||||
showSubtotal?: boolean;
|
showSubtotal?: boolean;
|
||||||
subtotalLabel?: string;
|
subtotalLabel?: string;
|
||||||
|
|
||||||
|
// Total
|
||||||
showTotal?: boolean;
|
showTotal?: boolean;
|
||||||
totalLabel?: string;
|
totalLabel?: string;
|
||||||
|
|
||||||
// Statements
|
// Terms & Conditions
|
||||||
termsConditionsLabel?: string;
|
termsConditionsLabel?: string;
|
||||||
showTermsConditions?: boolean;
|
showTermsConditions?: boolean;
|
||||||
|
|
||||||
|
// Statement
|
||||||
customerNoteLabel?: string;
|
customerNoteLabel?: string;
|
||||||
showCustomerNote?: boolean;
|
showCustomerNote?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user