mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-22 07:40:32 +00:00
feat(RefundCreditNote): optimize style.
This commit is contained in:
@@ -15,7 +15,7 @@ function RefundCreditNoteFloatingActions({
|
|||||||
closeDialog,
|
closeDialog,
|
||||||
}) {
|
}) {
|
||||||
// Formik context.
|
// Formik context.
|
||||||
const { isSubmitting, values, errors } = useFormikContext();
|
const { isSubmitting } = useFormikContext();
|
||||||
|
|
||||||
// refund credit note dialog context.
|
// refund credit note dialog context.
|
||||||
const { dialogName } = useRefundCreditNoteContext();
|
const { dialogName } = useRefundCreditNoteContext();
|
||||||
@@ -34,7 +34,7 @@ function RefundCreditNoteFloatingActions({
|
|||||||
<Button
|
<Button
|
||||||
intent={Intent.PRIMARY}
|
intent={Intent.PRIMARY}
|
||||||
loading={isSubmitting}
|
loading={isSubmitting}
|
||||||
style={{ minWidth: '85px' }}
|
style={{ minWidth: '120px' }}
|
||||||
type="submit"
|
type="submit"
|
||||||
text={<T id={'refund'} />}
|
text={<T id={'refund'} />}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -3,16 +3,15 @@ import { Formik } from 'formik';
|
|||||||
import { Intent } from '@blueprintjs/core';
|
import { Intent } from '@blueprintjs/core';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { omit, defaultTo } from 'lodash';
|
import { omit } from 'lodash';
|
||||||
|
|
||||||
import { AppToaster } from 'components';
|
import { AppToaster } from 'components';
|
||||||
import { useRefundCreditNoteContext } from './RefundCreditNoteFormProvider';
|
import { useRefundCreditNoteContext } from './RefundCreditNoteFormProvider';
|
||||||
import { CreateRefundCreditNoteFormSchema } from './RefundCreditNoteForm.schema';
|
import { CreateRefundCreditNoteFormSchema } from './RefundCreditNoteForm.schema';
|
||||||
import RefundCreditNoteFormContent from './RefundCreditNoteFormContent';
|
import RefundCreditNoteFormContent from './RefundCreditNoteFormContent';
|
||||||
|
|
||||||
import withSettings from 'containers/Settings/withSettings';
|
|
||||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||||
import { compose, transactionNumber } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
const defaultInitialValues = {
|
const defaultInitialValues = {
|
||||||
from_account_id: '',
|
from_account_id: '',
|
||||||
@@ -39,7 +38,7 @@ function RefundCreditNoteForm({
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Handles the form submit.
|
// Handles the form submit.
|
||||||
const handleFormSubmit = (values, { setSubmitting, setFieldError }) => {
|
const handleFormSubmit = (values, { setSubmitting }) => {
|
||||||
const form = {
|
const form = {
|
||||||
...omit(values, ['currency_code', 'credits_remaining']),
|
...omit(values, ['currency_code', 'credits_remaining']),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,12 +25,10 @@ import {
|
|||||||
momentFormatter,
|
momentFormatter,
|
||||||
tansformDateValue,
|
tansformDateValue,
|
||||||
handleDateChange,
|
handleDateChange,
|
||||||
compose,
|
|
||||||
} from 'utils';
|
} from 'utils';
|
||||||
import { useAutofocus } from 'hooks';
|
import { useAutofocus } from 'hooks';
|
||||||
import { ACCOUNT_TYPE } from 'common/accountTypes';
|
import { ACCOUNT_TYPE } from 'common/accountTypes';
|
||||||
import { useRefundCreditNoteContext } from './RefundCreditNoteFormProvider';
|
import { useRefundCreditNoteContext } from './RefundCreditNoteFormProvider';
|
||||||
import withSettings from 'containers/Settings/withSettings';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refund credit note form fields.
|
* Refund credit note form fields.
|
||||||
@@ -49,7 +47,7 @@ function RefundCreditNoteFormFields() {
|
|||||||
className={classNames('form-group--select-list', CLASSES.FILL)}
|
className={classNames('form-group--select-list', CLASSES.FILL)}
|
||||||
intent={inputIntent({ error, touched })}
|
intent={inputIntent({ error, touched })}
|
||||||
helperText={<ErrorMessage name="date" />}
|
helperText={<ErrorMessage name="date" />}
|
||||||
inline={true}
|
// inline={true}
|
||||||
>
|
>
|
||||||
<DateInput
|
<DateInput
|
||||||
{...momentFormatter('YYYY/MM/DD')}
|
{...momentFormatter('YYYY/MM/DD')}
|
||||||
@@ -78,7 +76,7 @@ function RefundCreditNoteFormFields() {
|
|||||||
className={classNames('form-group--amount', CLASSES.FILL)}
|
className={classNames('form-group--amount', CLASSES.FILL)}
|
||||||
intent={inputIntent({ error, touched })}
|
intent={inputIntent({ error, touched })}
|
||||||
helperText={<ErrorMessage name="amount" />}
|
helperText={<ErrorMessage name="amount" />}
|
||||||
inline={true}
|
// inline={true}
|
||||||
>
|
>
|
||||||
<ControlGroup>
|
<ControlGroup>
|
||||||
<InputPrependText text={values.currency_code} />
|
<InputPrependText text={values.currency_code} />
|
||||||
@@ -103,7 +101,7 @@ function RefundCreditNoteFormFields() {
|
|||||||
className={classNames('form-group--reference', CLASSES.FILL)}
|
className={classNames('form-group--reference', CLASSES.FILL)}
|
||||||
intent={inputIntent({ error, touched })}
|
intent={inputIntent({ error, touched })}
|
||||||
helperText={<ErrorMessage name="reference" />}
|
helperText={<ErrorMessage name="reference" />}
|
||||||
inline={true}
|
// inline={true}
|
||||||
>
|
>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
intent={inputIntent({ error, touched })}
|
intent={inputIntent({ error, touched })}
|
||||||
@@ -127,7 +125,7 @@ function RefundCreditNoteFormFields() {
|
|||||||
labelInfo={<FieldRequiredHint />}
|
labelInfo={<FieldRequiredHint />}
|
||||||
intent={inputIntent({ error, touched })}
|
intent={inputIntent({ error, touched })}
|
||||||
helperText={<ErrorMessage name={'from_account_id'} />}
|
helperText={<ErrorMessage name={'from_account_id'} />}
|
||||||
inline={true}
|
// inline={true}
|
||||||
>
|
>
|
||||||
<AccountsSuggestField
|
<AccountsSuggestField
|
||||||
selectedAccountId={value}
|
selectedAccountId={value}
|
||||||
@@ -153,7 +151,7 @@ function RefundCreditNoteFormFields() {
|
|||||||
<FormGroup
|
<FormGroup
|
||||||
label={<T id={'refund_credit_note.dialog.description'} />}
|
label={<T id={'refund_credit_note.dialog.description'} />}
|
||||||
className={'form-group--description'}
|
className={'form-group--description'}
|
||||||
inline={true}
|
// inline={true}
|
||||||
>
|
>
|
||||||
<TextArea growVertically={true} {...field} />
|
<TextArea growVertically={true} {...field} />
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|||||||
@@ -30,13 +30,6 @@ export function ActionsMenu({
|
|||||||
text={intl.get('credit_note.action.edit_credit_note')}
|
text={intl.get('credit_note.action.edit_credit_note')}
|
||||||
onClick={safeCallback(onEdit, original)}
|
onClick={safeCallback(onEdit, original)}
|
||||||
/>
|
/>
|
||||||
<If condition={!original.is_closed && original.is_published}>
|
|
||||||
<MenuItem
|
|
||||||
icon={<Icon icon="quick-payment-16" />}
|
|
||||||
text={intl.get('credit_note.action.refund_credit_note')}
|
|
||||||
onClick={safeCallback(onRefund, original)}
|
|
||||||
/>
|
|
||||||
</If>
|
|
||||||
<If condition={original.is_draft}>
|
<If condition={original.is_draft}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon={'check'} iconSize={18} />}
|
icon={<Icon icon={'check'} iconSize={18} />}
|
||||||
@@ -44,14 +37,15 @@ export function ActionsMenu({
|
|||||||
onClick={safeCallback(onOpen, original)}
|
onClick={safeCallback(onOpen, original)}
|
||||||
/>
|
/>
|
||||||
</If>
|
</If>
|
||||||
<If
|
<If condition={!original.is_closed && original.is_published}>
|
||||||
condition={
|
<MenuItem
|
||||||
!original.is_draft && !original.is_closed && original.is_published
|
icon={<Icon icon="quick-payment-16" />}
|
||||||
}
|
text={intl.get('credit_note.action.refund_credit_note')}
|
||||||
>
|
onClick={safeCallback(onRefund, original)}
|
||||||
|
/>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={intl.get('credit_note.action.reconcile_with_invoices')}
|
text={intl.get('credit_note.action.reconcile_with_invoices')}
|
||||||
// icon={<Icon icon="quick-payment-16" />}
|
icon={<Icon icon="receipt-24" iconSize={16} />}
|
||||||
onClick={safeCallback(onReconcile, original)}
|
onClick={safeCallback(onReconcile, original)}
|
||||||
/>
|
/>
|
||||||
</If>
|
</If>
|
||||||
@@ -73,19 +67,19 @@ export function StatusAccessor(creditNote) {
|
|||||||
<div>
|
<div>
|
||||||
<Choose>
|
<Choose>
|
||||||
<Choose.When condition={creditNote.is_open}>
|
<Choose.When condition={creditNote.is_open}>
|
||||||
<Tag minimal={true} intent={Intent.WARNING}>
|
<Tag intent={Intent.WARNING} minimal={true} round={true}>
|
||||||
<T id={'open'} />
|
<T id={'open'} />
|
||||||
</Tag>
|
</Tag>
|
||||||
</Choose.When>
|
</Choose.When>
|
||||||
|
|
||||||
<Choose.When condition={creditNote.is_closed}>
|
<Choose.When condition={creditNote.is_closed}>
|
||||||
<Tag minimal={true} intent={Intent.SUCCESS}>
|
<Tag intent={Intent.SUCCESS} minimal={true} round={true}>
|
||||||
<T id={'closed'} />
|
<T id={'closed'} />
|
||||||
</Tag>
|
</Tag>
|
||||||
</Choose.When>
|
</Choose.When>
|
||||||
|
|
||||||
<Choose.When condition={creditNote.is_draft}>
|
<Choose.When condition={creditNote.is_draft}>
|
||||||
<Tag minimal={true}>
|
<Tag intent={Intent.NONE} minimal={true} round={true}>
|
||||||
<T id={'draft'} />
|
<T id={'draft'} />
|
||||||
</Tag>
|
</Tag>
|
||||||
</Choose.When>
|
</Choose.When>
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
.dialog--refund-credit-note {
|
.dialog--refund-credit-note {
|
||||||
.bp3-dialog-body {
|
.bp3-dialog-body {
|
||||||
.bp3-form-group {
|
.bp3-form-group {
|
||||||
label.bp3-label {
|
margin-bottom: 16px;
|
||||||
min-width: 140px;
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
.bp3-form-content {
|
|
||||||
width: 250px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-group {
|
.form-group {
|
||||||
@@ -22,6 +16,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.bp3-dialog-footer {
|
.bp3-dialog-footer {
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user