Perbaikan Modal

This commit is contained in:
2021-12-31 09:23:24 +07:00
parent 42795d9ca4
commit b5e404c0c1
6 changed files with 93 additions and 67 deletions

View File

@@ -210,16 +210,16 @@ export const ProductComponent = observer((props) => {
store.product.filterSupplier = null;
store.product.filterSubCategory = null;
setFilterSupplier([]);
store.product.filterCategory = null;
setFilterSubCategories([]);
await store.product.getData();
store.product.visibleModalFilterProduct = false;
};
const handleCancelFilter = () => {
setFilterSupplier([]);
store.product.filterCategory = null;
store.product.filterSubCategory = null;
store.product.filterSupplier = null;
setFilterSubCategories([]);
setFilterSupplier([]);
store.product.visibleModalFilterProduct = false;
};
@@ -229,18 +229,20 @@ export const ProductComponent = observer((props) => {
modalLoader.setLoading(true);
await store.product.getData();
modalLoader.setLoading(false);
setFilterSupplier([]);
setFilterSubCategories([]);
store.product.visibleModalFilterProduct = false;
};
const handleFilterCategory = async (value) => {
if (value) {
store.product.filterCategory = value;
await store.product.getDataSubCategories();
} else {
store.product.filterCategory = null;
await store.product.getDataSubCategories();
}
};
// const handleFilterCategory = async (value) => {
// if (value) {
// store.product.filterCategory = value;
// await store.product.getDataSubCategories();
// } else {
// store.product.filterCategory = null;
// await store.product.getDataSubCategories();
// }
// };
const footerLayoutFilter = [
<Button
@@ -465,11 +467,15 @@ export const ProductComponent = observer((props) => {
</Form.Item>
</Form>
</Modal>
<Modal
visible={store.product.visibleModalFilterProduct}
title={"Filter"}
footer={footerLayoutFilter}
onCancel={() => {
setFilterSupplier([]);
setFilterSubCategories([]);
store.product.visibleModalFilterProduct = false;
}}
>
<Row>
<Col span={24}>
@@ -492,24 +498,6 @@ export const ProductComponent = observer((props) => {
))}
</Select>
</Col>
{/* <Col span={24}>
<Title level={5} type={"secondary"} strong>
Filter Categories
</Title>
<Select
mode={"multiple"}
placeholder="Choose Category"
onChange={async (val) => handleFilterCategory(val)}
style={{ marginBottom: "20px", width: "100%" }}
value={store.product.filterCategory || []}
>
{store.category.data.map((item) => (
<Option value={item.id} key={item.id}>
{item.name}
</Option>
))}
</Select>
</Col> */}
<Col span={24}>
<Title level={5} type={"secondary"} strong>
Filter Sub-Categories