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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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