diff --git a/client/src/containers/Purchases/Bill/BillForm.js b/client/src/containers/Purchases/Bill/BillForm.js index 9a05536eb..4c1b838ba 100644 --- a/client/src/containers/Purchases/Bill/BillForm.js +++ b/client/src/containers/Purchases/Bill/BillForm.js @@ -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, diff --git a/client/src/containers/Sales/Estimate/EstimateForm.js b/client/src/containers/Sales/Estimate/EstimateForm.js index 7fbc8a5d6..db3c514e9 100644 --- a/client/src/containers/Sales/Estimate/EstimateForm.js +++ b/client/src/containers/Sales/Estimate/EstimateForm.js @@ -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(), }), ), diff --git a/client/src/containers/Sales/Invoice/InvoiceForm.js b/client/src/containers/Sales/Invoice/InvoiceForm.js index 9f963348d..be611ec40 100644 --- a/client/src/containers/Sales/Invoice/InvoiceForm.js +++ b/client/src/containers/Sales/Invoice/InvoiceForm.js @@ -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(), }), ), diff --git a/client/src/containers/Sales/Receipt/ReceiptForm.js b/client/src/containers/Sales/Receipt/ReceiptForm.js index 41bb06cce..eeb3afc7d 100644 --- a/client/src/containers/Sales/Receipt/ReceiptForm.js +++ b/client/src/containers/Sales/Receipt/ReceiptForm.js @@ -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, diff --git a/client/src/containers/Sales/Receipt/ReceiptsDataTable.js b/client/src/containers/Sales/Receipt/ReceiptsDataTable.js index 45ad5c793..819a87988 100644 --- a/client/src/containers/Sales/Receipt/ReceiptsDataTable.js +++ b/client/src/containers/Sales/Receipt/ReceiptsDataTable.js @@ -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' }), diff --git a/client/src/store/ExchangeRate/exchange.reducer.js b/client/src/store/ExchangeRate/exchange.reducer.js index 112299fd9..94ef93516 100644 --- a/client/src/store/ExchangeRate/exchange.reducer.js +++ b/client/src/store/ExchangeRate/exchange.reducer.js @@ -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: { diff --git a/client/src/store/receipt/receipt.actions.js b/client/src/store/receipt/receipt.actions.js index 61f712d32..815458d5a 100644 --- a/client/src/store/receipt/receipt.actions.js +++ b/client/src/store/receipt/receipt.actions.js @@ -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); }) diff --git a/client/src/store/receipt/receipt.reducer.js b/client/src/store/receipt/receipt.reducer.js index d463afcd0..7f6a67015 100644 --- a/client/src/store/receipt/receipt.reducer.js +++ b/client/src/store/receipt/receipt.reducer.js @@ -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 = {};