feature(expense)/ cost landed checkbox.

This commit is contained in:
elforjani3
2021-07-21 23:49:00 +02:00
parent 2b5d00ed60
commit 2a55e09df8
3 changed files with 42 additions and 4 deletions

View File

@@ -8,9 +8,7 @@ const Schema = Yup.object().shape({
payment_account_id: Yup.number()
.required()
.label(intl.get('payment_account_')),
payment_date: Yup.date()
.required()
.label(intl.get('payment_date_')),
payment_date: Yup.date().required().label(intl.get('payment_date_')),
reference_no: Yup.string().min(1).max(DATATYPES_LENGTH.STRING).nullable(),
currency_code: Yup.string()
.nullable()
@@ -33,6 +31,7 @@ const Schema = Yup.object().shape({
is: (amount) => !isBlank(amount),
then: Yup.number().required(),
}),
landed_cost: Yup.boolean(),
description: Yup.string().max(DATATYPES_LENGTH.TEXT).nullable(),
}),
),

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { Button, Tooltip, Intent, Position } from '@blueprintjs/core';
import { Button, Tooltip, Intent, Position, Checkbox } from '@blueprintjs/core';
import { FormattedMessage as T } from 'components';
import { Icon, Hint } from 'components';
import intl from 'react-intl-universal';
@@ -49,6 +49,35 @@ const ActionsCellRenderer = ({
);
};
/**
* Landed cost cell.
*/
const LandedCostCell = ({
row: { index },
column: { id },
cell: { value: initialValue },
data,
payload,
}) => {
return (
<Tooltip content={''} position={Position.RIGHT}>
<Checkbox minimal={true} className="ml2" />
</Tooltip>
);
};
/**
* Landed cost header cell.
*/
const LandedCostHeaderCell = () => {
return (
<>
<T id={'cost'} />
<Hint content={''} />
</>
);
};
/**
* Amount footer cell.
*/
@@ -114,6 +143,15 @@ export function useExpenseFormTableColumns() {
className: 'description',
width: 100,
},
{
Header: LandedCostHeaderCell,
accessor: 'landed_cost',
Cell: LandedCostCell,
disableSortBy: true,
disableResizing: true,
width: 70,
className: 'landed_cost',
},
{
Header: '',
accessor: 'action',

View File

@@ -27,6 +27,7 @@ export const defaultExpenseEntry = {
amount: '',
expense_account_id: '',
description: '',
landed_cost: false,
};
export const defaultExpense = {