diff --git a/src/component/ProductComponent.js b/src/component/ProductComponent.js
index 0087f07..293fffa 100644
--- a/src/component/ProductComponent.js
+++ b/src/component/ProductComponent.js
@@ -1,4 +1,4 @@
-import React, { useContext, useState } from "react";
+import React, {useContext, useState} from "react";
import {
Button,
Col,
@@ -15,19 +15,19 @@ import {
Tag,
Typography,
} from "antd";
-import { observer } from "mobx-react-lite";
-import { ExclamationCircleOutlined } from "@ant-design/icons";
-import { useHistory } from "react-router-dom";
-import { useStore } from "../utils/useStore";
-import { LINKS } from "../routes/app";
-import { ModalLoaderContext } from "../utils/modal";
+import {observer} from "mobx-react-lite";
+import {ExclamationCircleOutlined} from "@ant-design/icons";
+import {useHistory} from "react-router-dom";
+import {useStore} from "../utils/useStore";
+import {LINKS} from "../routes/app";
+import {ModalLoaderContext} from "../utils/modal";
-const { Title, Text } = Typography;
+const {Title, Text} = Typography;
export const ProductComponent = observer((props) => {
const store = useStore();
const [form] = Form.useForm();
- const { Option } = Select;
+ const {Option} = Select;
const history = useHistory();
const [idData, setIdData] = useState("");
const [filterSupplier, setFilterSupplier] = useState([]);
@@ -109,10 +109,7 @@ export const ProductComponent = observer((props) => {
render: (text, record) => (
*/}
{
+ let pageNumber = page.current;
+ store.product.pageSizePriceHistory = page.pageSize;
+ store.product.pagePriceHistory = pageNumber - 1;
+ modalLoader.setLoading(true);
+ await store.product.getPriceHistoryByProduct(id);
+ modalLoader.setLoading(false);
+ }}
/>
diff --git a/src/store/product.js b/src/store/product.js
index 1ccd96a..36a8295 100644
--- a/src/store/product.js
+++ b/src/store/product.js
@@ -13,7 +13,7 @@ export class Product {
uploadBtnProduct = false;
pageCategories = 0;
- pageSizeCategories = 10
+ pageSizeCategories = 100;
dataCategories = [];
total_dataCategories = 0;
@@ -22,11 +22,13 @@ export class Product {
dataSubCategories = [];
total_dataSubCategories = 0;
filterCategory = null;
- dataDetail=[]
- dataDetailProduct=[]
- pageGetDetail=0
- supplier=null
+ dataPriceHistory = [];
+ totalDataPriceHistory = 0;
+ pagePriceHistory = 0;
+ pageSizePriceHistory = 10
+
+ dataDetailProduct = {};
constructor(ctx) {
this.ctx = ctx;
@@ -72,22 +74,21 @@ export class Product {
console.error(e);
}
}
- async getDetail(id) {
+
+ async getPriceHistoryByProduct(id) {
try {
- const response = await http.get(`/product/price-history/${id}?page=${this.pageGetDetail}&supplier=${this.supplier}`);
- //console.log(response,' Detail')
- this.dataDetail = response.body.data
- this.total_data = response?.body?.count ?? 0
+ const response = await http.get(`/product/price-history/${id}?page=${this.pagePriceHistory}&pageSize${this.pageSizePriceHistory}`);
+ this.dataPriceHistory = response.body.data
+ this.totalDataPriceHistory = response?.body?.count ?? 0
} catch (e) {
console.error(e);
}
}
+
async getDetailProduct(id) {
try {
const response = await http.get(`/product/${id}`);
- //console.log(response,' Detail Product')
this.dataDetailProduct = response.body.data
- this.total_data = response?.body?.count ?? 0
} catch (e) {
console.error(e);
}