Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ahmed Bouhuolia
2020-11-07 14:31:13 +02:00
8 changed files with 19 additions and 20 deletions

View File

@@ -120,7 +120,7 @@ function BillForm({
then: Yup.number().required(),
}),
total: Yup.number().nullable(),
discount: Yup.number().nullable(),
discount: Yup.number().nullable().min(0).max(100),
description: Yup.string().nullable(),
}),
),
@@ -210,7 +210,6 @@ function BillForm({
};
const formik = useFormik({
// enableReinitialize: true,
validationSchema,
initialValues: {
...initialValues,

View File

@@ -129,7 +129,7 @@ const EstimateForm = ({
is: (quantity, rate) => quantity || rate,
then: Yup.number().required(),
}),
discount: Yup.number().nullable(),
discount: Yup.number().nullable().min(0).max(100),
description: Yup.string().nullable(),
}),
),

View File

@@ -127,7 +127,7 @@ function InvoiceForm({
is: (quantity, rate) => quantity || rate,
then: Yup.number().required(),
}),
discount: Yup.number().nullable(),
discount: Yup.number().nullable().min(0).max(100),
description: Yup.string().nullable(),
}),
),

View File

@@ -129,7 +129,7 @@ function ReceiptForm({
is: (quantity, rate) => quantity || rate,
then: Yup.number().required(),
}),
discount: Yup.number().nullable(),
discount: Yup.number().nullable().min(0).max(100),
description: Yup.string().nullable(),
}),
),
@@ -383,9 +383,9 @@ function ReceiptForm({
export default compose(
withReceiptActions,
withReceiptDetail(),
withDashboardActions,
withMediaActions,
withReceiptDetail(),
withSettings(({ receiptSettings }) => ({
receiptNextNumber: receiptSettings?.nextNumber,
receiptNumberPrefix: receiptSettings?.numberPrefix,

View File

@@ -152,13 +152,13 @@ function ReceiptsDataTable({
width: 140,
className: 'deposit_account',
},
{
id: 'send_to_email',
Header: formatMessage({ id: 'email' }),
accessor: 'send_to_email',
width: 140,
className: 'send_to_email',
},
// {
// id: 'send_to_email',
// Header: formatMessage({ id: 'email' }),
// accessor: 'send_to_email',
// width: 140,
// className: 'send_to_email',
// },
{
id: 'amount',
Header: formatMessage({ id: 'amount' }),

View File

@@ -5,6 +5,7 @@ import t from 'store/types';
const initialState = {
exchangeRates: {},
loading: false,
views: {},
tableQuery: {
page_size: 5,
page: 1,
@@ -26,17 +27,15 @@ const reducer = createReducer(initialState, {
},
[t.EXCHANGE_RATE_TABLE_LOADING]: (state, action) => {
const { loading } = action.payload;
state.loading = loading;
},
[t.ESTIMATES_PAGE_SET]: (state, action) => {
[t.EXCHANGE_RATES_PAGE_SET]: (state, action) => {
const { customViewId, exchange_rates, pagination } = action.payload;
const viewId = customViewId || -1;
const view = state.views[viewId] || {};
state.views[viewId] = {
...view,
pages: {

View File

@@ -54,10 +54,9 @@ export const fetchReceipt = ({ id }) => {
new Promise((resovle, reject) => {
ApiService.get(`sales/receipts/${id}`)
.then((response) => {
const { receipt } = response.data;
dispatch({
type: t.RECEIPT_SET,
payload: { id, receipt },
payload: { id, sale_receipt: response.data.sale_receipt },
});
resovle(response);
})

View File

@@ -18,12 +18,14 @@ const defaultReceipt = {
};
const reducer = createReducer(initialState, {
[t.RECEIPT_SET]: (state, action) => {
const { id, receipt } = action.payload;
const { id, sale_receipt } = action.payload;
const _receipt = state.items[id] || {};
state.items[id] = { ...defaultReceipt, ..._receipt, ...receipt };
state.items[id] = { ...defaultReceipt, ..._receipt, ...sale_receipt };
},
[t.RECEIPTS_ITEMS_SET]: (state, action) => {
const { sales_receipts } = action.payload;
const _receipts = {};