fix: inventory adjustment cost out of range.

This commit is contained in:
a.bouhuolia
2021-08-07 08:09:37 +02:00
parent 0ab4596836
commit c21236c4ae
4 changed files with 32 additions and 14 deletions

View File

@@ -83,7 +83,7 @@ export function useCustomersTableColumns() {
Header: '', Header: '',
accessor: AvatarCell, accessor: AvatarCell,
className: 'avatar', className: 'avatar',
width: 50, width: 45,
disableResizing: true, disableResizing: true,
disableSortBy: true, disableSortBy: true,
}, },

View File

@@ -8,6 +8,9 @@ import { FormattedMessage as T } from 'components';
import withDialogActions from 'containers/Dialog/withDialogActions'; import withDialogActions from 'containers/Dialog/withDialogActions';
import { compose } from 'utils'; import { compose } from 'utils';
/**
* Currency dialog form footer action.
*/
function CurrencyFormFooter({ function CurrencyFormFooter({
// #withDialogActions // #withDialogActions
closeDialog, closeDialog,
@@ -23,10 +26,10 @@ function CurrencyFormFooter({
return ( return (
<div className={Classes.DIALOG_FOOTER}> <div className={Classes.DIALOG_FOOTER}>
<div className={Classes.DIALOG_FOOTER_ACTIONS}> <div className={Classes.DIALOG_FOOTER_ACTIONS}>
<Button onClick={handleClose}> <Button onClick={handleClose} disabled={isSubmitting}>
<T id={'cancel'} /> <T id={'cancel'} />
</Button> </Button>
<Button intent={Intent.PRIMARY} type="submit" disabled={isSubmitting}> <Button intent={Intent.PRIMARY} type="submit" loading={isSubmitting}>
{!isEditMode ? <T id={'submit'} /> : <T id={'edit'} />} {!isEditMode ? <T id={'submit'} /> : <T id={'edit'} />}
</Button> </Button>
</div> </div>

View File

@@ -13,7 +13,7 @@ const accountNameMapper = (column) => ({
accessor: 'cells[0].value', accessor: 'cells[0].value',
className: 'account_name', className: 'account_name',
textOverview: true, textOverview: true,
width: 240, width: 400,
disableSortBy: true, disableSortBy: true,
}); });
@@ -25,7 +25,10 @@ const dateRangeMapper = (data, index, column) => ({
Header: column.label, Header: column.label,
key: column.key, key: column.key,
accessor: `cells[${index}].value`, accessor: `cells[${index}].value`,
width: getColumnWidth(data, `cells.${index}.value`, { minWidth: 100 }), width: getColumnWidth(data, `cells.${index}.value`, {
magicSpacing: 10,
minWidth: 100,
}),
className: `date-period ${column.key}`, className: `date-period ${column.key}`,
disableSortBy: true, disableSortBy: true,
textOverview: true, textOverview: true,
@@ -41,7 +44,10 @@ const totalMapper = (data, index, column) => ({
className: 'total', className: 'total',
textOverview: true, textOverview: true,
Cell: CellTextSpan, Cell: CellTextSpan,
width: getColumnWidth(data, `cells[${index}].value`, { minWidth: 100 }), width: getColumnWidth(data, `cells[${index}].value`, {
magicSpacing: 10,
minWidth: 100,
}),
disableSortBy: true, disableSortBy: true,
}); });

View File

@@ -1,13 +1,22 @@
exports.up = function (knex) { exports.up = function (knex) {
return knex.schema.createTable('inventory_adjustments_entries', table => { return knex.schema.createTable('inventory_adjustments_entries', (table) => {
table.increments(); table.increments();
table.integer('adjustment_id').unsigned().index().references('id').inTable('inventory_adjustments'); table
.integer('adjustment_id')
.unsigned()
.index()
.references('id')
.inTable('inventory_adjustments');
table.integer('index').unsigned(); table.integer('index').unsigned();
table.integer('item_id').unsigned().index().references('id').inTable('items'); table
.integer('item_id')
.unsigned()
.index()
.references('id')
.inTable('items');
table.integer('quantity'); table.integer('quantity');
table.decimal('cost').unsigned(); table.decimal('cost', 13, 3).unsigned();
table.decimal('value').unsigned(); table.decimal('value', 13, 3).unsigned();
}); });
}; };