From 966c606b19b5caf43afc525d967a87a688e5bc1c Mon Sep 17 00:00:00 2001 From: mrafei Date: Sun, 18 Jul 2021 18:33:37 +0430 Subject: [PATCH] bug fixes --- package-lock.json | 2 +- package.json | 2 +- src/containers/EditProduct/InfoTable.js | 18 ++++++------ .../components/ReportPrintComponent.js | 4 +-- src/containers/OrdersReport/index.js | 28 +++++++++---------- utils/api.js | 2 +- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/package-lock.json b/package-lock.json index e64cb86..aadbfe8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vitrin-pos", - "version": "0.9.0", + "version": "0.9.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8ccb283..d1b2fd7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vitrin-pos", "productName": "vitrin-pos", - "version": "0.9.0", + "version": "0.9.1", "description": "Application for vitrin POS", "license": "Vitrin", "private": false, diff --git a/src/containers/EditProduct/InfoTable.js b/src/containers/EditProduct/InfoTable.js index 09b3c14..f6cdd5d 100644 --- a/src/containers/EditProduct/InfoTable.js +++ b/src/containers/EditProduct/InfoTable.js @@ -57,7 +57,7 @@ export default function InfoTable({ product, setProduct }) { setProduct({ ...product, extra_data: { - extra_data: product.extra_data, + ...product.extra_data, info_table: newProductInfoTable, }, }); @@ -112,14 +112,14 @@ export default function InfoTable({ product, setProduct }) { newProductInfoTable.splice(index + 1, 0, { key: "", value: "", - }), - setProduct({ - ...product, - extra_data: { - ...product.extra_data, - info_table: newProductInfoTable, - }, - }); + }); + setProduct({ + ...product, + extra_data: { + ...product.extra_data, + info_table: newProductInfoTable, + }, + }); }} edge="end" > diff --git a/src/containers/OrdersReport/components/ReportPrintComponent.js b/src/containers/OrdersReport/components/ReportPrintComponent.js index 8e1b051..e3570ca 100644 --- a/src/containers/OrdersReport/components/ReportPrintComponent.js +++ b/src/containers/OrdersReport/components/ReportPrintComponent.js @@ -18,14 +18,14 @@ export default class ReportPrintComponent extends React.Component { className="u-border-radius-8 text-center u-border-black p-3" style={{ minWidth: 105 }} > - {printOptions.date && printOptions.date.from} + {printOptions.date && printOptions.date.from_date} {business.revised_title} - {printOptions.date && printOptions.date.to} + {printOptions.date && printOptions.date.to_date}
diff --git a/src/containers/OrdersReport/index.js b/src/containers/OrdersReport/index.js index 2eb74a8..63a9fd7 100644 --- a/src/containers/OrdersReport/index.js +++ b/src/containers/OrdersReport/index.js @@ -53,11 +53,11 @@ const OrdersReport = function ({ const [modalOpen, setModalOpen] = useState(false); const [toCalenderOpen, setToCalenderOpen] = useState(false); const [fromCalenderOpen, setFromCalenderOpen] = useState(false); - const [query, setQuery] = useState({ to: "", from: "" }); + const [query, setQuery] = useState({ to_date: "", from_date: "" }); const page = getQueryParams("page", location.search) || 1; - const toTime = moment(query.to, "jYYYY/jMM/jDD").format("YYYY-MM-DD"); - const fromTime = moment(query.from, "jYYYY/jMM/jDD").format("YYYY-MM-DD"); + const toTime = moment(query.to_date, "jYYYY/jMM/jDD").format("YYYY-MM-DD"); + const fromTime = moment(query.from_date, "jYYYY/jMM/jDD").format("YYYY-MM-DD"); useEffect(() => { submit(); @@ -66,8 +66,8 @@ const OrdersReport = function ({ const submit = useCallback(() => { const params = { page }; if (query) { - if (query.to) params.to = toTime; - if (query.from) params.from = fromTime; + if (query.to_date) params.to_date = toTime; + if (query.from_date) params.from_date = fromTime; } _getAdminOrders(params); }, [query, location]); @@ -79,12 +79,12 @@ const OrdersReport = function ({ setToCalenderOpen(false)} - selectDay={(day) => setQuery({ ...query, to: day })} + selectDay={(day) => setQuery({ ...query, to_date: day })} /> setFromCalenderOpen(false)} - selectDay={(day) => setQuery({ ...query, from: day })} + selectDay={(day) => setQuery({ ...query, from_date: day })} /> @@ -110,7 +110,7 @@ const OrdersReport = function ({ > از تاریخ - {query.from ? englishNumberToPersianNumber(query.from) : "----"} + {query.from_date ? englishNumberToPersianNumber(query.from_date) : "----"}
@@ -120,7 +120,7 @@ const OrdersReport = function ({ > تا تاریخ - {query.to ? englishNumberToPersianNumber(query.to) : "----"} + {query.to_date ? englishNumberToPersianNumber(query.to_date) : "----"} @@ -129,8 +129,8 @@ const OrdersReport = function ({
{ const params = {}; - if (query.to) params.to = toTime; - if (query.from) params.from = fromTime; + if (query.to_date) params.to_date = toTime; + if (query.from_date) params.from_date = fromTime; _getOrdersReport(params); setModalOpen(true); }} diff --git a/utils/api.js b/utils/api.js index b7b6c5a..fced1c4 100644 --- a/utils/api.js +++ b/utils/api.js @@ -82,7 +82,7 @@ export const GET_ORDER_TRANSACTION_API = (id) => export const TRANSACTION_ZIBAL_API = (id) => `${BASE_URL}order_transactions/${id}/pay_transaction/`; export const TRANSACTION_API = (id, gateway) => - `${BASE_URL}transactions/${id}/${gateway}_gateway`; + `${BASE_URL}transactions/${id}/${gateway}_gateway/`; export const REPORTS_API = `${BASE_URL}shopping_orders/report/`; export const GROUP_PACKAGING_PRICE_ON_DEALS_API = (id) =>