feat: add discount fields in sale and purchase forms

This commit is contained in:
Ahmed Bouhuolia
2024-11-30 18:02:50 +02:00
parent 73ab92e693
commit ffb06f5194
11 changed files with 352 additions and 36 deletions

View File

@@ -7,8 +7,12 @@ import {
TotalLine,
TotalLineBorderStyle,
TotalLineTextStyle,
FInputGroup,
FFormGroup,
FSelect,
} from '@/components';
import { useEstimateTotals } from './utils';
import { Button } from '@blueprintjs/core';
export function EstimateFormFooterRight() {
const { formattedSubtotal, formattedTotal } = useEstimateTotals();
@@ -20,6 +24,32 @@ export function EstimateFormFooterRight() {
value={formattedSubtotal}
borderStyle={TotalLineBorderStyle.None}
/>
<FFormGroup name={'discount'} label={'Discount'} inline>
<FInputGroup
name={'discount'}
rightElement={
<FSelect
name={'discount_type'}
items={[
{ text: 'USD', value: 'amount' },
{ text: '%', value: 'percentage' },
]}
input={({ text }) => (
<Button small minimal>
{text}
</Button>
)}
filterable={false}
/>
}
/>
</FFormGroup>
<FFormGroup name={'adjustment'} label={'Adjustment'} inline>
<FInputGroup name={'adjustment'} />
</FFormGroup>
<TotalLine
title={<T id={'estimate_form.label.total'} />}
value={formattedTotal}

View File

@@ -63,6 +63,8 @@ export const defaultEstimate = {
entries: [...repeatValue(defaultEstimateEntry, MIN_LINES_NUMBER)],
attachments: [],
pdf_template_id: '',
discount: '',
discount_type: 'amount'
};
const ERRORS = {