This commit is contained in:
ajat91.sudrajat 2021-12-22 11:12:25 +07:00
commit 7edf7650ec
4 changed files with 23 additions and 40 deletions

View File

@ -1,23 +1,8 @@
import React, {useContext, useState} from "react";
import {
Button,
Col,
Form,
Input,
message,
Modal,
Row,
Select,
Table,
Divider,
Tag,
Typography,
List,
} from "antd";
import {Button, Col, Divider, Form, Input, List, message, Modal, Row, Select, Table, Tag, Typography,} from "antd";
import {observer} from "mobx-react-lite";
import {ExclamationCircleOutlined} from "@ant-design/icons";
import {useHistory} from "react-router-dom";
import { capitalize } from "lodash";
import {useStore} from "../utils/useStore";
import {LINKS} from "../routes/app";
import {ModalLoaderContext} from "../utils/modal";
@ -397,7 +382,7 @@ export const ProductComponent = observer((props) => {
]}
>
<Select placeholder="Select Sub Category" allowClear>
{store.product.dataSubCategories.map((item) => (
{store.category.dataSubCategories.map((item) => (
<Option value={item.id} key={item.id}>
{item.name}
</Option>

View File

@ -1,5 +1,5 @@
import React, {useContext, useEffect} from "react";
import {Button, Card, Col, Input, Row, Upload,message} from "antd";
import {Button, Card, Col, Input, message, Row, Upload} from "antd";
import {FilterOutlined, PlusSquareOutlined, UploadOutlined,} from "@ant-design/icons";
import {BreadcumbComponent} from "../../component/BreadcumbComponent";
import {useStore} from "../../utils/useStore";
@ -20,8 +20,8 @@ export const Product = observer(() => {
modalLoader.setLoading(true);
await Promise.allSettled([
store.supplier.getData(),
store.product.getDataCategories(),
store.category.getData(),
store.category.getDataSubCategories(),
]);
await store.product.getData();
modalLoader.setLoading(false);

View File

@ -71,12 +71,9 @@ export const Product = observer(() => {
<Select
placeholder={"Select Sub Category"}
allowClear={true}
onChange={(val) => {
if (val) {
handleChangeSubcategory(val);
}
}}
onChange={(val) => handleChangeSubcategory(val)}
style={{marginBottom: "10px", width: "100%"}}
value={store.transaction.filterSubCategory}
>
{store.transaction.dataSubCategories.map((item, index) => (
<Option key={item.id} value={item.id}>

View File

@ -34,9 +34,10 @@ export const Transaction = observer(() => {
}, []);
const handleChangeTabs = async (key) => {
modalLoader.setLoading(true);
store.transaction.dataSubCategories = [];
store.transaction.data = [];
modalLoader.setLoading(true);
store.transaction.filterSubCategory = null;
store.transaction.filterCategory = key;
await store.transaction.getDataSubCategories();
modalLoader.setLoading(false);