diff --git a/src/component/PartnerComponent.js b/src/component/PartnerComponent.js index d660997..66f0329 100644 --- a/src/component/PartnerComponent.js +++ b/src/component/PartnerComponent.js @@ -257,6 +257,19 @@ export const PartnerComponent = observer((props) => { )} + {!idData && ( + + + + )} {((idData && isChangePassword) || !idData) && ( { { const store = useStore(); @@ -65,6 +65,11 @@ export const SupplierComponent = observer((props) => { dataIndex: ["coa", "amount"], key: ["coa", "amount"], width: "20%", + render: (text, record) => + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), }, { title: "Status", @@ -72,12 +77,12 @@ export const SupplierComponent = observer((props) => { key: "status", width: "5%", render: (text, record) => ( - - {record?.status === true ? " ACTIVE" : "INACTIVE"} - + + {record?.status === true ? " ACTIVE" : "INACTIVE"} + ), }, { @@ -85,15 +90,15 @@ export const SupplierComponent = observer((props) => { key: "action", width: "20%", render: (text, record) => ( - - - - + + + + ), }, @@ -212,18 +217,18 @@ export const SupplierComponent = observer((props) => { > - {!idData && - - - - } + {!idData && ( + + + + )} - + ); }); diff --git a/src/pages/Membership/Membership.js b/src/pages/Membership/Membership.js index e1641dc..1e031b9 100644 --- a/src/pages/Membership/Membership.js +++ b/src/pages/Membership/Membership.js @@ -209,7 +209,6 @@ export const Membership = observer(() => { data.superior = true; if (initialData.id) { - setInitialData({}); setConfirmLoading(true); try { await store.membership.update(initialData.id, data); @@ -229,7 +228,6 @@ export const Membership = observer(() => { setConfirmLoading(false); setVisibleModal(false); } else { - setInitialData({}); setConfirmLoading(true); try { await store.membership.create(data); @@ -241,6 +239,7 @@ export const Membership = observer(() => { } setConfirmLoading(false); setVisibleModal(false); + setInitialData({}); } }; diff --git a/src/pages/Transaction/Product.js b/src/pages/Transaction/Product.js index 5634d7d..fab2125 100644 --- a/src/pages/Transaction/Product.js +++ b/src/pages/Transaction/Product.js @@ -1,111 +1,129 @@ -import React, {useEffect, useState} from "react"; -import {useStore} from "../../utils/useStore"; -import {Button, Card, Col, Input, Row, Select} from "antd"; -import {observer} from "mobx-react-lite"; -import {BuyProductModal} from "../../component/BuyProductModal"; +import React, { useEffect, useState } from "react"; +import { useStore } from "../../utils/useStore"; +import { Button, Card, Col, Input, Row, Select } from "antd"; +import { observer } from "mobx-react-lite"; +import { BuyProductModal } from "../../component/BuyProductModal"; -const {Search} = Input; -const {Option} = Select; +const { Search } = Input; +const { Option } = Select; export const Product = observer(() => { - const store = useStore(); + const store = useStore(); - const [isLoading, setIsLoading] = useState(false); - const [productData, setProductData] = useState([]); - const [data, setData] = useState({}); + const [isLoading, setIsLoading] = useState(false); + const [productData, setProductData] = useState([]); + const [data, setData] = useState({}); - useEffect(() => { - const init = async () => { - try { - setIsLoading(true); - await store.transaction.getDataSubCategories(); - await store.transaction.getDataCategories(); - setIsLoading(false); - } catch (e) { - setIsLoading(false); - } - }; + useEffect(() => { + const init = async () => { + try { + setIsLoading(true); + await store.transaction.getDataSubCategories(); + await store.transaction.getDataCategories(); + setIsLoading(false); + } catch (e) { + setIsLoading(false); + } + }; - init(); - }, []); + init(); + }, []); - // data - useEffect(() => { - console.log('⚡ transaction data store', store.transaction.data) - setProductData(store.transaction.data) - }, [store.transaction.data]) + // data + useEffect(() => { + console.log("⚡ transaction data store", store.transaction.data); + setProductData(store.transaction.data); + }, [store.transaction.data]); - // Subcategory - useEffect(() => { - console.log('⚡ transaction subcategory store', store.transaction.dataSubCategories) - }, [store.transaction.dataSubCategories]) - - - const handleChangeSubcategory = async (item) => { - console.log('item', item); - store.transaction.filterSubCategory = item; - await store.transaction.getData(); - } - - const handleBuyProduct = (data) => { - setData(data); - store.transaction.visibleModalTransaction = true; - } - - return ( -
- - - Sub Category - - - - - - - - - - Produk & Nominal - - - - - - {productData.length != 0 && - {productData.map((item, index) => ( - - handleBuyProduct(item)} style={{cursor: "pointer"}}> - {item.name} -
- {item?.currentPrice?.mark_up_price} -
- - ))} -
} - {productData.length != 0 && - - } - -
+ // Subcategory + useEffect(() => { + console.log( + "⚡ transaction subcategory store", + store.transaction.dataSubCategories ); + }, [store.transaction.dataSubCategories]); + + const handleChangeSubcategory = async (item) => { + console.log("item", item); + store.transaction.filterSubCategory = item; + await store.transaction.getData(); + }; + + const handleBuyProduct = (data) => { + setData(data); + store.transaction.visibleModalTransaction = true; + }; + + return ( +
+ + + Sub Category + + + + + + + + + + Produk & Nominal + + + + + + {productData.length != 0 && ( + + {productData.map((item, index) => ( + + handleBuyProduct(item)} + style={{ cursor: "pointer" }} + > + {item.name} +
+ + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(item?.currentPrice?.mark_up_price)} + +
+ + ))} +
+ )} + {productData.length !== 0 && ( + + + + )} + +
+ ); }); diff --git a/src/store/ui.js b/src/store/ui.js index 5bf55b1..f5e9710 100644 --- a/src/store/ui.js +++ b/src/store/ui.js @@ -13,7 +13,7 @@ export class UI { } setTestValue() { - this.testValue = "yo dayo"; + this.testValue = "yoshahhh #!"; } setMediaQuery(data) {