feat(TotalLine): add extra border style.

This commit is contained in:
a.bouhuolia
2022-03-19 23:16:41 +02:00
parent 69c47aee4d
commit 321d206670
5 changed files with 34 additions and 26 deletions

View File

@@ -2,6 +2,7 @@ import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
export const TotalLineBorderStyle = { export const TotalLineBorderStyle = {
None: 'None',
SingleDark: 'SingleDark', SingleDark: 'SingleDark',
DoubleDark: 'DoubleDark', DoubleDark: 'DoubleDark',
}; };
@@ -80,6 +81,11 @@ export const TotalLineRoot = styled.div`
` `
border-bottom: 1px double #000; border-bottom: 1px double #000;
`} `}
${(props) =>
props.borderStyle === TotalLineBorderStyle.None &&
`
border-bottom-color: transparent;
`}
${(props) => ${(props) =>
props.textStyle === TotalLineTextStyle.Bold && props.textStyle === TotalLineTextStyle.Bold &&
` `

View File

@@ -14,13 +14,14 @@ import intl from 'react-intl-universal';
import { defaultFastFieldShouldUpdate } from 'utils'; import { defaultFastFieldShouldUpdate } from 'utils';
import { ERROR } from 'common/errors'; import { ERROR } from 'common/errors';
import { AppToaster } from 'components'; import { AppToaster } from 'components';
import { getEntriesTotal } from 'containers/Entries/utils';
import { useInvoiceFormContext } from './InvoiceFormProvider'; import { useInvoiceFormContext } from './InvoiceFormProvider';
import { import {
updateItemsEntriesTotal, updateItemsEntriesTotal,
ensureEntriesHaveEmptyLine, ensureEntriesHaveEmptyLine,
} from 'containers/Entries/utils'; } from 'containers/Entries/utils';
export const MIN_LINES_NUMBER = 4; export const MIN_LINES_NUMBER = 1;
// Default invoice entry object. // Default invoice entry object.
export const defaultInvoiceEntry = { export const defaultInvoiceEntry = {
@@ -201,13 +202,11 @@ export const useSetPrimaryBranchToForm = () => {
}, [isBranchesSuccess, setFieldValue, branches]); }, [isBranchesSuccess, setFieldValue, branches]);
}; };
export const useSetForeignCurrencyToEditForm = () => { export const useInvoiceTotal = () => {
const { values } = useFormikContext(); const {
const { isNewMode, setSelectCustomer } = useInvoiceFormContext(); values: { entries },
} = useFormikContext();
React.useEffect(() => { // Calculate the total due amount of invoice entries.
if (!isNewMode) { return React.useMemo(() => getEntriesTotal(entries), [entries]);
setSelectCustomer({ currency_code: values.currency_code });
}
}, [isNewMode, setSelectCustomer, values]);
}; };

View File

@@ -534,4 +534,10 @@ export default {
], ],
viewBox: '0 0 24 24', viewBox: '0 0 24 24',
}, },
'more-13': {
path: [
'M1.5 3a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 10a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0-5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z',
],
viewBox: '0 0 3 13',
},
}; };

View File

@@ -42,11 +42,6 @@
margin-bottom: 0; margin-bottom: 0;
} }
} }
#{$self}__body,
#{$self}__footer {
max-width: 1400px;
}
#{$self}__header { #{$self}__header {
background-color: #FFF; background-color: #FFF;
padding: 25px 32px; padding: 25px 32px;

View File

@@ -22,6 +22,7 @@ body.page-invoice-edit {
.bp3-label { .bp3-label {
min-width: 150px; min-width: 150px;
} }
.bp3-form-content { .bp3-form-content {
width: 100%; width: 100%;
} }
@@ -31,34 +32,33 @@ body.page-invoice-edit {
max-width: 450px; max-width: 450px;
} }
} }
.row { .row {
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: nowrap;
.col { .col {
max-width: 470px; max-width: 470px;
&--terms,
&--due-date { &--due-date {
.bp3-form-group { .bp3-form-group {
margin: 0px 15px 15px; margin: 0px 15px 15px;
.bp3-label { .bp3-label {
min-width: 70px; min-width: 100px;
} }
} }
} }
&--due-date {
.bp3-input-group .bp3-input {
border: 1px dashed #ced4da;
}
}
} }
} }
.col--invoice-date { .col--invoice-date {
max-width: 435px; max-width: 435px;
} }
} }
#{$self}__footer { #{$self}__footer {
.form-group--invoice_message, .form-group--invoice_message,
.form-group--terms_conditions { .form-group--terms_conditions {
max-width: 450px; max-width: 450px;
@@ -71,12 +71,14 @@ body.page-invoice-edit {
} }
} }
} }
.status-accessor { .status-accessor {
span { span {
font-size: 13px; font-size: 13px;
font-weight: 400; font-weight: 400;
line-height: 1.5; line-height: 1.5;
} }
.fully-paid-status { .fully-paid-status {
height: 19px; height: 19px;
width: 19px; width: 19px;
@@ -97,8 +99,8 @@ body.page-invoice-edit {
margin-top: 5px; margin-top: 5px;
width: 80%; width: 80%;
} }
&.overdue-status {
} &.overdue-status {}
&.remaining-status {
} &.remaining-status {}
} }