Merge branch 'develop' of https://gitlab.com/empatnusabangsa/ppob/ppob-frontend into develop
This commit is contained in:
commit
f5903db03e
|
@ -11,11 +11,17 @@ export const Pulsa = () => {
|
||||||
|
|
||||||
const [productData, setProductData] = useState([])
|
const [productData, setProductData] = useState([])
|
||||||
const [productFilter, setProductFilter] = useState("")
|
const [productFilter, setProductFilter] = useState("")
|
||||||
// useEffect(()=>{
|
useEffect(() => {
|
||||||
// if(!productFilter){
|
if (!productFilter) {
|
||||||
// setProductData(store.transaction.data)
|
console.log('⚡ filter is null', productFilter)
|
||||||
// }
|
setProductData(store.transaction.data)
|
||||||
// },[productFilter])
|
} else {
|
||||||
|
console.log('⚡ filter is not null', productFilter)
|
||||||
|
setProductData(store.transaction.data.filter(function (product) {
|
||||||
|
return product.sub_categories.name === productFilter
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}, [productFilter])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
|
@ -23,6 +29,7 @@ export const Pulsa = () => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
await store.transaction.getDataSubCategories();
|
await store.transaction.getDataSubCategories();
|
||||||
await store.transaction.getData();
|
await store.transaction.getData();
|
||||||
|
await store.transaction.getDataCategories();
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
@ -30,6 +37,7 @@ export const Pulsa = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
setProductFilter("")
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// data
|
// data
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import React from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { useStore } from "../../utils/useStore";
|
||||||
import { Button, Card, Col, Input, Row, Tabs } from "antd";
|
import { Button, Card, Col, Input, Row, Tabs } from "antd";
|
||||||
import { FilterOutlined, } from "@ant-design/icons";
|
import { FilterOutlined, } from "@ant-design/icons";
|
||||||
import { BreadcumbComponent } from "../../component/BreadcumbComponent";
|
import { BreadcumbComponent } from "../../component/BreadcumbComponent";
|
||||||
|
@ -9,6 +10,31 @@ const {TabPane} = Tabs;
|
||||||
const { Search } = Input;
|
const { Search } = Input;
|
||||||
|
|
||||||
export const Transaction = () => {
|
export const Transaction = () => {
|
||||||
|
|
||||||
|
const store = useStore();
|
||||||
|
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
|
// Init
|
||||||
|
useEffect(() => {
|
||||||
|
const init = async () => {
|
||||||
|
try {
|
||||||
|
setIsLoading(true);
|
||||||
|
await store.transaction.getDataCategories();
|
||||||
|
setIsLoading(false);
|
||||||
|
} catch (e) {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
init();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Category
|
||||||
|
useEffect(() => {
|
||||||
|
console.log('⚡ transaction category store', store.transaction.dataCategories)
|
||||||
|
}, [store.transaction.dataCategories])
|
||||||
|
|
||||||
const callback = (key) => {
|
const callback = (key) => {
|
||||||
console.log(key);
|
console.log(key);
|
||||||
};
|
};
|
||||||
|
@ -46,21 +72,12 @@ export const Transaction = () => {
|
||||||
size="default"
|
size="default"
|
||||||
tabBarGutter="50"
|
tabBarGutter="50"
|
||||||
>
|
>
|
||||||
<TabPane tab="Pulsa" key="1">
|
{store.transaction.dataCategories.map((item, index) => (
|
||||||
|
<TabPane tab={item.name} key={index}>
|
||||||
<Pulsa />
|
<Pulsa />
|
||||||
</TabPane>
|
</TabPane>
|
||||||
<TabPane tab="Game Voucher" key="2">
|
))}
|
||||||
Game Voucher
|
|
||||||
</TabPane>
|
|
||||||
<TabPane tab="Product" key="3">
|
|
||||||
Product
|
|
||||||
</TabPane>
|
|
||||||
<TabPane tab="Prduct" key="4">
|
|
||||||
Product
|
|
||||||
</TabPane>
|
|
||||||
<TabPane tab="Prdct" key="5">
|
|
||||||
Product
|
|
||||||
</TabPane>
|
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user