Skip to content

Commit

Permalink
Merge branch 'develop' into BIG-354-validate-the-warehouse-transfer-q…
Browse files Browse the repository at this point in the history
…uantity-should-be-above-zero
  • Loading branch information
abouolia authored Mar 31, 2022
2 parents 6daa9f0 + f828d85 commit b0a826e
Show file tree
Hide file tree
Showing 18 changed files with 171 additions and 36 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

All notable changes to Bigcapital server-side will be in this file.

## [1.7.1-rc.2] - 30-03-2022

## Added
- `BIG-141` Add inactive status to item drawer details.
- `BIG-278` Add created at date on expense details.
- `BIG-350` Add empty status content of warehouse transfers service.
- `BIG-344` Add branch details to manual journal and expense details.
## Fixed
- `BIG-221` Remove Non-inventory radio choice on item form.
- `BIG-236` Validate estimate expiration date should be equal or bigger than estimate date.
- `BIG-237` Validate invoice due date should be equal or bigger than invoice date.
- `BIG-238` Validate bill due date should be equal or bigger than bill date.
- `BIG-280` Optimize style of multi-select accounts menu.
- `BIG-284` Cashflow statement loading bar.
- `BIG-296` Creating a new child account from accounts list.
- `BIG-301` Navigation bar divider on actions bar hide with permissions control.
- `BIG-304` Adding cash or bank account from cash flow service.
- `BIG-351` Invalid date in the inventory adjustment detail.
- `BIG-352` Fix terms and notes fields on footer of all services.
- `BIG-354` Validate the warehouse transfer quantity should be above zero.

## [1.7.0-rc.1] - 24-03-2022

## Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bigcapital-client",
"version": "1.6.3",
"version": "1.7.1",
"private": true,
"dependencies": {
"@babel/core": "7.8.4",
Expand Down
12 changes: 10 additions & 2 deletions src/containers/Accounting/MakeJournal/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import { Popover2 } from '@blueprintjs/popover2';
import { useFormikContext } from 'formik';
import intl from 'react-intl-universal';

import { ExchangeRateInputGroup, Icon, Hint, FormattedMessage as T } from 'components';
import {
ExchangeRateInputGroup,
Icon,
Hint,
FormattedMessage as T,
} from 'components';
import {
AccountsListFieldCell,
MoneyFieldCell,
Expand Down Expand Up @@ -63,7 +68,10 @@ export const ActionsCellRenderer = ({
};
const exampleMenu = (
<Menu>
<MenuItem onClick={handleClickRemoveRole} text="Remove line" />
<MenuItem
onClick={handleClickRemoveRole}
text={intl.get('make_journal.entries.remove_row')}
/>
</Menu>
);
return (
Expand Down
7 changes: 5 additions & 2 deletions src/containers/Drawers/ExpenseDrawer/ExpenseDrawerHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
Col,
DetailItem,
DetailsMenu,
FormatDate,
ExchangeRateDetailItem,
FormattedMessage as T,
} from 'components';
Expand Down Expand Up @@ -64,10 +65,12 @@ export default function ExpenseDrawerHeader() {
minLabelSize={'180px'}
>
<DetailItem label={<T id={'published_at'} />}>
{moment(expense.published_at).format('YYYY MMM DD')}
<FormatDate value={expense.published_at} />
</DetailItem>

<DetailItem label={<T id={'created_at'} />}>2021 Aug 24</DetailItem>
<DetailItem label={<T id={'created_at'} />}>
<FormatDate value={expense.created_at} />
</DetailItem>
</DetailsMenu>
</Col>
</Row>
Expand Down
19 changes: 18 additions & 1 deletion src/containers/Drawers/ExpenseDrawer/ExpenseDrawerProvider.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import React from 'react';
import intl from 'react-intl-universal';
import { useExpense } from 'hooks/query';
import { DrawerLoading } from 'components';
import { DrawerHeaderContent, DrawerLoading } from 'components';
import { Features } from 'common';
import { useFeatureCan } from 'hooks/state';

const ExpenseDrawerDrawerContext = React.createContext();

/**
* Expense drawer provider.
*/
function ExpenseDrawerProvider({ expenseId, ...props }) {
// Features guard.
const { featureCan } = useFeatureCan();

// Fetch the expense details.
const {
data: expense,
Expand All @@ -28,6 +34,17 @@ function ExpenseDrawerProvider({ expenseId, ...props }) {

return (
<DrawerLoading loading={isExpenseLoading}>
<DrawerHeaderContent
name="expense-drawer"
title={intl.get('expense.drawer.title')}
subTitle={
featureCan(Features.Branches)
? intl.get('expense.drawer.subtitle', {
value: expense.branch?.name,
})
: null
}
/>
<ExpenseDrawerDrawerContext.Provider value={provider} {...props} />
</DrawerLoading>
);
Expand Down
3 changes: 0 additions & 3 deletions src/containers/Drawers/ExpenseDrawer/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import React, { lazy } from 'react';
import intl from 'react-intl-universal';

import { Drawer, DrawerSuspense } from 'components';
import withDrawers from 'containers/Drawer/withDrawers';

Expand All @@ -22,7 +20,6 @@ function ExpenseDrawer({
<Drawer
isOpen={isOpen}
name={name}
title={intl.get('expense.drawer.title')}
size={'65%'}
style={{ minWidth: '700px', maxWidth: '900px' }}
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { DrawerHeaderContent, DrawerLoading } from 'components';
import { useItem } from 'hooks/query';
import { inactiveStatus } from './utlis';

const ItemDetailDrawerContext = React.createContext();

Expand All @@ -27,7 +28,10 @@ function ItemDetailDrawerProvider({ itemId, ...props }) {

return (
<DrawerLoading loading={isItemLoading}>
<DrawerHeaderContent name="item-detail-drawer" title={item?.name} />
<DrawerHeaderContent
name="item-detail-drawer"
title={inactiveStatus(item)}
/>
<ItemDetailDrawerContext.Provider value={provider} {...props} />
</DrawerLoading>
);
Expand Down
27 changes: 27 additions & 0 deletions src/containers/Drawers/ItemDetailDrawer/utlis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react';
import styled from 'styled-components';
import { Intent, Tag } from '@blueprintjs/core';
import { Choose, FormattedMessage as T } from '../../../components';

/**
* items inactive status.
* @returns {React.JSX}
*/
export function inactiveStatus(item) {
return (
<Choose>
<Choose.When condition={!item.active}>
{item.name}
<StatusTag intent={Intent.NONE} minimal={true} round={true}>
<T id={'item.details.inactive'} />
</StatusTag>
</Choose.When>
<Choose.Otherwise>{item.name}</Choose.Otherwise>
</Choose>
);
}

const StatusTag = styled(Tag)`
font-size: 11px;
margin-left: 10px;
`;
21 changes: 18 additions & 3 deletions src/containers/Drawers/ManualJournalDrawer/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import React from 'react';
import { Tag, Intent, Classes, Tooltip, Position } from '@blueprintjs/core';

import { T, Choose, FormatNumberCell, If, Icon } from '../../../components';
import { Features } from 'common';
import { useFeatureCan } from 'hooks/state';

/**
* Note column accessor.
Expand Down Expand Up @@ -46,8 +48,9 @@ export function ManualJournalDetailsStatus({ manualJournal }) {
/**
* Retrieve read-only manual journal entries columns.
*/
export const useManualJournalEntriesColumns = () =>
React.useMemo(
export const useManualJournalEntriesColumns = () => {
const { featureCan } = useFeatureCan();
return React.useMemo(
() => [
{
Header: intl.get('account_name'),
Expand All @@ -70,6 +73,17 @@ export const useManualJournalEntriesColumns = () =>
disableSortBy: true,
className: 'note',
},
...(featureCan(Features.Branches)
? [
{
Header: intl.get('branch'),
width: 130,
accessor: 'branch.name',
disableSortBy: true,
className: 'branch',
},
]
: []),
{
Header: intl.get('credit'),
accessor: 'credit',
Expand All @@ -93,5 +107,6 @@ export const useManualJournalEntriesColumns = () =>
align: 'right',
},
],
[],
[featureCan],
);
};
2 changes: 1 addition & 1 deletion src/containers/Entries/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function ActionsCellRenderer({

const exampleMenu = (
<Menu>
<MenuItem onClick={onRemoveRole} text="Remove line" />
<MenuItem onClick={onRemoveRole} text={'item_entries.remove_row'} />
</Menu>
);

Expand Down
7 changes: 5 additions & 2 deletions src/containers/Expenses/ExpenseForm/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ const ActionsCellRenderer = ({
};
const exampleMenu = (
<Menu>
<MenuItem onClick={handleClickRemoveRole} text="Remove line" />
<MenuItem
onClick={handleClickRemoveRole}
text={intl.get('expense.entries.remove_row')}
/>
</Menu>
);
return (
Expand Down Expand Up @@ -163,4 +166,4 @@ export function ExpensesExchangeRateInputField({ ...props }) {
/>
);
}
ExpensesExchangeRateInputField.cellType = CellType.Field;
ExpensesExchangeRateInputField.cellType = CellType.Field;
2 changes: 1 addition & 1 deletion src/containers/ItemsCategories/ItemCategoriesTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function ItemsCategoryTable({
loading={isCategoriesLoading}
headerLoading={isCategoriesLoading}
progressBarLoading={isCategoriesFetching}
expandable={true}
expandable={false}
sticky={true}
selectionColumn={true}
TableLoadingRenderer={TableSkeletonRows}
Expand Down
17 changes: 10 additions & 7 deletions src/containers/Purchases/Bills/BillForm/BillForm.schema.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import * as Yup from 'yup';
import moment from 'moment';
import intl from 'react-intl-universal';
import { DATATYPES_LENGTH } from 'common/dataTypes';
import { isBlank } from 'utils';

const BillFormSchema = Yup.object().shape({
vendor_id: Yup.number()
.required()
.label(intl.get('vendor_name_')),
bill_date: Yup.date()
.required()
.label(intl.get('bill_date_')),
vendor_id: Yup.number().required().label(intl.get('vendor_name_')),
bill_date: Yup.date().required().label(intl.get('bill_date_')),
due_date: Yup.date()
.min(Yup.ref('bill_date'), ({ path, min }) =>
intl.get('bill.validation.due_date', {
path,
min: moment(min).format('YYYY/MM/DD'),
}),
)
.required()
.label(intl.get('due_date_')),
bill_number: Yup.string()
Expand All @@ -25,7 +28,7 @@ const BillFormSchema = Yup.object().shape({
open: Yup.boolean(),
branch_id: Yup.string(),
warehouse_id: Yup.string(),
exchange_rate:Yup.number(),
exchange_rate: Yup.number(),
entries: Yup.array().of(
Yup.object().shape({
quantity: Yup.number()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ import * as Yup from 'yup';
import intl from 'react-intl-universal';
import { DATATYPES_LENGTH } from 'common/dataTypes';
import { isBlank } from 'utils';
import moment from 'moment';

const Schema = Yup.object().shape({
customer_id: Yup.number()
.label(intl.get('customer_name_'))
.required(),
estimate_date: Yup.date()
.required()
.label(intl.get('estimate_date_')),
customer_id: Yup.number().label(intl.get('customer_name_')).required(),
estimate_date: Yup.date().required().label(intl.get('estimate_date_')),
expiration_date: Yup.date()
.required()
.min(Yup.ref('estimate_date'), ({ path, min }) =>
intl.get('estimate.validation.expiration_date', {
path,
min: moment(min).format('YYYY/MM/DD'),
}),
)
.label(intl.get('expiration_date_')),
estimate_number: Yup.string()
.max(DATATYPES_LENGTH.STRING)
Expand Down
11 changes: 10 additions & 1 deletion src/containers/Sales/Invoices/InvoiceForm/InvoiceForm.schema.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as Yup from 'yup';
import moment from 'moment';
import intl from 'react-intl-universal';
import { DATATYPES_LENGTH } from 'common/dataTypes';
import { isBlank } from 'utils';
Expand All @@ -7,7 +8,15 @@ const getSchema = () =>
Yup.object().shape({
customer_id: Yup.string().label(intl.get('customer_name_')).required(),
invoice_date: Yup.date().required().label(intl.get('invoice_date_')),
due_date: Yup.date().required().label(intl.get('due_date_')),
due_date: Yup.date()
.min(Yup.ref('invoice_date'), ({ path, min }) =>
intl.get('invoice.validation.due_date', {
path,
min: moment(min).format('YYYY/MM/DD'),
}),
)
.required()
.label(intl.get('due_date_')),
invoice_no: Yup.string()
.max(DATATYPES_LENGTH.STRING)
.label(intl.get('invoice_no_')),
Expand Down
5 changes: 4 additions & 1 deletion src/containers/WarehouseTransfers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ export function ActionsCellRenderer({

const exampleMenu = (
<Menu>
<MenuItem onClick={onRemoveRole} text="Remove line" />
<MenuItem
onClick={onRemoveRole}
text={intl.get('warehouse_transfer.entries.remove_row')}
/>
</Menu>
);

Expand Down
Loading

0 comments on commit b0a826e

Please sign in to comment.