mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
fix(invoice): Skeleton warehouses & branch loading & style action top bar.
This commit is contained in:
@@ -1,10 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
PopoverInteractionKind,
|
PopoverInteractionKind,
|
||||||
Position,
|
Position,
|
||||||
|
Classes,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
|
import clsx from 'classnames';
|
||||||
import { defaultTo } from 'lodash';
|
import { defaultTo } from 'lodash';
|
||||||
import { Select } from '@blueprintjs/select';
|
import { Select } from '@blueprintjs/select';
|
||||||
import { FormattedMessage as T, Icon } from 'components';
|
import { FormattedMessage as T, Icon } from 'components';
|
||||||
@@ -18,7 +21,8 @@ export default function CustomSelectList({
|
|||||||
items,
|
items,
|
||||||
initialItemId,
|
initialItemId,
|
||||||
selectedItemId,
|
selectedItemId,
|
||||||
text,
|
loading = false,
|
||||||
|
defaultSelectText,
|
||||||
onItemSelected,
|
onItemSelected,
|
||||||
buttonProps,
|
buttonProps,
|
||||||
}) {
|
}) {
|
||||||
@@ -85,17 +89,19 @@ export default function CustomSelectList({
|
|||||||
offset: { offset: '0, 4' },
|
offset: { offset: '0, 4' },
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
className={clsx({ [Classes.SKELETON]: loading })}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
text={
|
text={
|
||||||
selecetedItem
|
selecetedItem
|
||||||
? `${text}:${selecetedItem.name} ${defaultTo(
|
? `${defaultSelectText}:${selecetedItem.name} ${defaultTo(
|
||||||
selecetedItem.code,
|
selecetedItem.code,
|
||||||
'',
|
'',
|
||||||
)}`
|
)}`
|
||||||
: `${text}: Bigcapital`
|
: `${defaultSelectText}: Bigcapital`
|
||||||
}
|
}
|
||||||
minimal={true}
|
minimal={true}
|
||||||
|
small={true}
|
||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
/>
|
/>
|
||||||
</Select>
|
</Select>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ function BaseCurrency({
|
|||||||
organization: { base_currency },
|
organization: { base_currency },
|
||||||
isForeignCustomer,
|
isForeignCustomer,
|
||||||
}) {
|
}) {
|
||||||
console.log(isForeignCustomer, 'XXXX');
|
|
||||||
if (isForeignCustomer) {
|
if (isForeignCustomer) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FastField } from 'formik';
|
import { FastField, Field } from 'formik';
|
||||||
import {
|
import {
|
||||||
Alignment,
|
Alignment,
|
||||||
Navbar,
|
Navbar,
|
||||||
@@ -18,7 +18,8 @@ import { useInvoiceFormContext } from './InvoiceFormProvider';
|
|||||||
import { Features } from 'common';
|
import { Features } from 'common';
|
||||||
|
|
||||||
export default function InvoiceFormTopBar() {
|
export default function InvoiceFormTopBar() {
|
||||||
const { warehouses, branches } = useInvoiceFormContext();
|
const { branches, warehouses, isWarehouesLoading, isBranchesLoading } =
|
||||||
|
useInvoiceFormContext();
|
||||||
|
|
||||||
const { featureCan } = useFeatureCan();
|
const { featureCan } = useFeatureCan();
|
||||||
|
|
||||||
@@ -30,42 +31,44 @@ export default function InvoiceFormTopBar() {
|
|||||||
<Navbar className={'navbar--dashboard-topbar'}>
|
<Navbar className={'navbar--dashboard-topbar'}>
|
||||||
<NavbarGroup align={Alignment.LEFT}>
|
<NavbarGroup align={Alignment.LEFT}>
|
||||||
<FeatureCan feature={Features.Warehouses}>
|
<FeatureCan feature={Features.Warehouses}>
|
||||||
<FastField name={'branch_id'}>
|
<Field name={'branch_id'}>
|
||||||
{({ form, field: { value }, meta: { error, touched } }) => (
|
{({ form, field: { value }, meta: { error, touched } }) => (
|
||||||
<CustomSelectList
|
<CustomSelectList
|
||||||
items={branches}
|
items={branches}
|
||||||
text={'Branch'}
|
loading={isBranchesLoading}
|
||||||
|
defaultSelectText={'Branch'}
|
||||||
onItemSelected={({ id }) => {
|
onItemSelected={({ id }) => {
|
||||||
form.setFieldValue('branch_id', id);
|
form.setFieldValue('branch_id', id);
|
||||||
}}
|
}}
|
||||||
selectedItemId={value}
|
selectedItemId={value}
|
||||||
buttonProps={{
|
buttonProps={{
|
||||||
icon: <Icon icon={'branch-16'} iconSize={20} />,
|
icon: <Icon icon={'branch-16'} iconSize={16} />,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</FastField>
|
</Field>
|
||||||
</FeatureCan>
|
</FeatureCan>
|
||||||
|
|
||||||
{featureCan(Features.Warehouses) && featureCan(Features.Branches) && (
|
{featureCan(Features.Warehouses) && featureCan(Features.Branches) && (
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
)}
|
)}
|
||||||
<FeatureCan feature={Features.Warehouses}>
|
<FeatureCan feature={Features.Warehouses}>
|
||||||
<FastField name={'warehouse_id'}>
|
<Field name={'warehouse_id'}>
|
||||||
{({ form, field: { value }, meta: { error, touched } }) => (
|
{({ form, field: { value }, meta: { error, touched } }) => (
|
||||||
<CustomSelectList
|
<CustomSelectList
|
||||||
items={warehouses}
|
items={warehouses}
|
||||||
text={'Warehosue'}
|
loading={isWarehouesLoading}
|
||||||
|
defaultSelectText={'Warehosue'}
|
||||||
onItemSelected={({ id }) => {
|
onItemSelected={({ id }) => {
|
||||||
form.setFieldValue('warehouse_id', id);
|
form.setFieldValue('warehouse_id', id);
|
||||||
}}
|
}}
|
||||||
selectedItemId={value}
|
selectedItemId={value}
|
||||||
buttonProps={{
|
buttonProps={{
|
||||||
icon: <Icon icon={'warehouse-16'} iconSize={20} />,
|
icon: <Icon icon={'warehouse-16'} iconSize={16} />,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</FastField>
|
</Field>
|
||||||
</FeatureCan>
|
</FeatureCan>
|
||||||
</NavbarGroup>
|
</NavbarGroup>
|
||||||
</Navbar>
|
</Navbar>
|
||||||
|
|||||||
@@ -575,17 +575,19 @@ $dashboard-views-bar-height: 44px;
|
|||||||
.navbar--dashboard-topbar {
|
.navbar--dashboard-topbar {
|
||||||
box-shadow: 0 0 0;
|
box-shadow: 0 0 0;
|
||||||
border-bottom: 1px solid #d2dce2;
|
border-bottom: 1px solid #d2dce2;
|
||||||
/* height: 44px; */
|
height: 35px;
|
||||||
height: 37px;
|
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
|
|
||||||
.bp3-navbar-group {
|
.bp3-navbar-group {
|
||||||
height: 37px;
|
height: 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bp3-navbar-divider {
|
.bp3-navbar-divider {
|
||||||
border-left-color: #d2dce2;
|
border-left-color: #d2dce2;
|
||||||
}
|
}
|
||||||
|
.bp3-skeleton {
|
||||||
|
max-height: 10px;
|
||||||
|
}
|
||||||
.bp3-button {
|
.bp3-button {
|
||||||
&:hover {
|
&:hover {
|
||||||
background: rgba(167, 182, 194, 0.12);
|
background: rgba(167, 182, 194, 0.12);
|
||||||
|
|||||||
Reference in New Issue
Block a user