feat(S&P): Form Footer.

This commit is contained in:
elforjani13
2022-03-20 11:20:13 +02:00
parent cc637471d9
commit acdec70385
27 changed files with 665 additions and 204 deletions

View File

@@ -1,56 +1,30 @@
import React from 'react';
import { FormGroup, TextArea } from '@blueprintjs/core';
import { FastField } from 'formik';
import classNames from 'classnames';
import { FormattedMessage as T } from 'components';
import { Dragzone, Postbox, Row, Col } from 'components';
import styled from 'styled-components';
import { CLASSES } from 'common/classes';
import { inputIntent } from 'utils';
import { Paper, Row, Col } from 'components';
import { ReceiptFormFooterLeft } from './ReceiptFormFooterLeft';
import { ReceiptFormFooterRight } from './ReceiptFormFooterRight';
export default function ReceiptFormFooter({}) {
return (
<div className={classNames(CLASSES.PAGE_FORM_FOOTER)}>
<Postbox title={<T id={'receipt_details'}/>} defaultOpen={false}>
<ReceiptFooterPaper>
<Row>
<Col md={8}>
{/* --------- Receipt message --------- */}
<FastField name={'receipt_message'}>
{({ field, meta: { error, touched } }) => (
<FormGroup
label={<T id={'receipt_message'} />}
className={'form-group--receipt_message'}
intent={inputIntent({ error, touched })}
>
<TextArea growVertically={true} {...field} />
</FormGroup>
)}
</FastField>
{/* --------- Statement--------- */}
<FastField name={'statement'}>
{({ field, meta: { error, touched } }) => (
<FormGroup
label={<T id={'statement'} />}
className={'form-group--statement'}
intent={inputIntent({ error, touched })}
>
<TextArea growVertically={true} {...field} />
</FormGroup>
)}
</FastField>
<ReceiptFormFooterLeft />
</Col>
<Col md={4}>
<Dragzone
initialFiles={[]}
// onDrop={handleDropFiles}
// onDeleteFile={handleDeleteFile}
hint={<T id={'attachments_maximum'} />}
/>
<ReceiptFormFooterRight />
</Col>
</Row>
</Postbox>
</ReceiptFooterPaper>
</div>
);
}
const ReceiptFooterPaper = styled(Paper)`
padding: 20px;
`;

View File

@@ -0,0 +1,57 @@
import React from 'react';
import styled from 'styled-components';
import { FFormGroup, FEditableText, FormattedMessage as T } from 'components';
export function ReceiptFormFooterLeft() {
return (
<React.Fragment>
{/* --------- Receipt message --------- */}
<ReceiptMsgFormGroup
name={'receipt_message'}
label={<T id={'receipt_message'} />}
hintText={'Will be displayed on the Receipt'}
>
<FEditableText
name={'receipt_message'}
placeholder={'Thanks for your business and have a great day!'}
/>
</ReceiptMsgFormGroup>
{/* --------- Statement--------- */}
<StatementFormGroup label={<T id={'statement'} />} name={'statement'}>
<FEditableText
name={'statement'}
placeholder={
'Enter the terms and conditions of your business to be displayed in your transaction'
}
/>
</StatementFormGroup>
</React.Fragment>
);
}
const ReceiptMsgFormGroup = styled(FFormGroup)`
&.bp3-form-group {
margin-bottom: 40px;
.bp3-label {
font-size: 12px;
margin-bottom: 12px;
}
.bp3-form-content {
margin-left: 10px;
}
}
`;
const StatementFormGroup = styled(FFormGroup)`
&.bp3-form-group {
.bp3-label {
font-size: 12px;
margin-bottom: 12px;
}
.bp3-form-content {
margin-left: 10px;
}
}
`;

View File

@@ -0,0 +1,43 @@
import React from 'react';
import styled from 'styled-components';
import {
T,
TotalLines,
TotalLine,
TotalLineBorderStyle,
TotalLineTextStyle,
} from 'components';
export function ReceiptFormFooterRight() {
return (
<ReceiptTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
<TotalLine
title={<T id={'receipt.details.subtotal'} />}
value={'$5000.00'}
borderStyle={TotalLineBorderStyle.None}
/>
<TotalLine
title={<T id={'receipt.details.total'} />}
value={'$5000.00'}
borderStyle={TotalLineBorderStyle.SingleDark}
textStyle={TotalLineTextStyle.Bold}
/>
<TotalLine
title={<T id={'receipt.details.payment_amount'} />}
value={'$0.00'}
borderStyle={TotalLineBorderStyle.None}
/>
<TotalLine
title={<T id={'receipt.details.due_amount'} />}
value={'$5000.00'}
textStyle={TotalLineTextStyle.Bold}
/>
</ReceiptTotalLines>
);
}
const ReceiptTotalLines = styled(TotalLines)`
width: 100%;
color: #555555;
`;

View File

@@ -113,7 +113,7 @@ function ReceiptFormHeader({
popoverFill={true}
allowCreate={true}
/>
<ReceiptFormCurrencyTag />
</ControlCustomerGroup>
</FormGroup>
)}