diff --git a/src/component/PartnerComponent.js b/src/component/PartnerComponent.js index 99bdbb4..7dd2f90 100644 --- a/src/component/PartnerComponent.js +++ b/src/component/PartnerComponent.js @@ -20,6 +20,7 @@ import { ModalLoaderContext } from "../utils/modal"; export const PartnerComponent = observer((props) => { const store = useStore(); + const [value, setValue] = useState(); const [form] = Form.useForm(); const history = useHistory(); const [idData, setIdData] = useState(""); @@ -65,6 +66,7 @@ export const PartnerComponent = observer((props) => { setIsChangePassword(true); store.partner.visibleModalPartner = true; setIdData(data.id); + console.log(data.id); }; const columns = [ @@ -161,20 +163,22 @@ export const PartnerComponent = observer((props) => { if (idData !== "") { modalLoader.setLoading(true); try { - await store.partner.update(idData, data); + isChangePassword + ? await store.partner.updatePassword(idData, data) + : await store.partner.update(idData, data); modalLoader.setLoading(false); message.success( isChangePassword - ? "Failed Change Partner Password" + ? "Success Change Password" : "Success Update Data Partner" ); //await store.partner.getData() } catch (e) { - modalLoader.setLoading(true); + modalLoader.setLoading(false); message.error( isChangePassword - ? "Failed Change Partner Password" + ? "Failed Change Password" : "Failed Update Data Partner" ); } @@ -280,7 +284,9 @@ export const PartnerComponent = observer((props) => { > {item?.status === true ? "Inactive" : "Active"} - {/* */} @@ -358,17 +364,17 @@ export const PartnerComponent = observer((props) => { )} {!idData && ( - - - + + + )} {!idData && ( { required: true, message: "Please input password phone number!", }, + { + pattern: /^(?:\d*)$/, + message: "Value should contain just number", + }, + { + pattern: /^[\d]{0,12}$/, + message: "Value should be less than 12 character", + }, ]} > - + { + setValue(value); + }} + /> )} {!isChangePassword && ( diff --git a/src/component/ProductComponent.js b/src/component/ProductComponent.js index 059b695..4902208 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([]); @@ -107,12 +107,14 @@ export const ProductComponent = observer((props) => { key: "action", render: (text, record) => ( + onClick={async () => { + history.push( + LINKS.PRODUCT_DETAIL.replace(":id", record.product_id) + ); + }} + > + Detail + ), }, ]; @@ -258,7 +260,11 @@ export const ProductComponent = observer((props) => { width: store.ui.mediaQuery.isMobile ? 250 : "", }} columns={columns} - dataSource={store.product.data} + dataSource={ + store.authentication.userData.role === "Admin Partner" + ? store.product.dataProductPartner + : store.product.data + } bordered pagination={{ pageSize: store.product.pageSize, diff --git a/src/component/SupplierComponent.js b/src/component/SupplierComponent.js index b7f3d3e..b5542c1 100644 --- a/src/component/SupplierComponent.js +++ b/src/component/SupplierComponent.js @@ -192,14 +192,18 @@ export const SupplierComponent = observer((props) => { try { modalLoader.setLoading(true); const response = await store.supplier.create(data); - response?.body?.statusCode === 201 || response?.body?.statusCode === 200 + console.log(response) + response?.body?.statusCode === 201 && response?.body?.statusCode === 200 ? message.success( response?.body?.message || "Berhasil Tambah Supplier Baru" ) : message.error( - response?.body?.statusCode === 406 + response?.body?.error ? response?.body?.error || "Supplier Sudah Ada" : response?.body?.message || "Gagal Tambah Supplier Baru" + // response?.body?.statusCode === 406 + // ? response?.body?.error || "Supplier Sudah Ada" + // : response?.body?.message || "Gagal Tambah Supplier Baru" //response?.body?.message || "Gagal Tambah Supplier Baru" ); } catch (e) { diff --git a/src/config/app.js b/src/config/app.js index 4bf4b05..b6c3d6a 100644 --- a/src/config/app.js +++ b/src/config/app.js @@ -1,5 +1,5 @@ export const appConfig = { - apiUrl: 'https://ppob-backend.k3s.bangun-kreatif.com/v1' + apiUrl: 'https://ppob-backend.k3s.bangun-kreatif.com/v1' //apiUrl: 'http://localhost:3222/v1' // apiUrl: 'http://localhost:3222/v1' }; diff --git a/src/pages/App/DesktopLayout.js b/src/pages/App/DesktopLayout.js index 23c2b32..2a51446 100644 --- a/src/pages/App/DesktopLayout.js +++ b/src/pages/App/DesktopLayout.js @@ -1,65 +1,71 @@ -import React, {useState} from "react"; -import {Button, Drawer, Layout, Menu, Popover, Typography} from "antd"; -import {MenuList} from "./MenuList"; -import {Link, useHistory} from "react-router-dom"; +import React, { useState } from "react"; +import { Button, Drawer, Layout, Menu, Popover, Typography } from "antd"; +import { MenuList } from "./MenuList"; +import { Link, useHistory } from "react-router-dom"; import { - AlipayOutlined, - DatabaseOutlined, - FileAddOutlined, - FileProtectOutlined, - FileSyncOutlined, - HomeOutlined, - LogoutOutlined, - MenuOutlined, - PayCircleOutlined, - ProfileOutlined, - ShoppingCartOutlined, - UserOutlined + AlipayOutlined, + DatabaseOutlined, + FileAddOutlined, + FileProtectOutlined, + FileSyncOutlined, + HomeOutlined, + LogoutOutlined, + MenuOutlined, + PayCircleOutlined, + ProfileOutlined, + ShoppingCartOutlined, + UserOutlined, + IdcardOutlined, + SettingOutlined, + WindowsOutlined, + SlackOutlined, + AppstoreAddOutlined, + AppstoreOutlined, } from "@ant-design/icons"; -import {AppRoute, LINKS} from "../../routes/app"; -import {useStore} from "../../utils/useStore"; -import {observer} from "mobx-react-lite"; -import {useMediaQuery} from "react-responsive"; +import { AppRoute, LINKS } from "../../routes/app"; +import { useStore } from "../../utils/useStore"; +import { observer } from "mobx-react-lite"; +import { useMediaQuery } from "react-responsive"; -const {Text, Paragraph} = Typography; -const {Header, Content, Sider} = Layout; -const {SubMenu} = Menu; +const { Text, Paragraph } = Typography; +const { Header, Content, Sider } = Layout; +const { SubMenu } = Menu; export const DesktopLayout = observer(() => { - let history = useHistory(); - const xl = useMediaQuery({minWidth: 1024}); - const store = useStore(); - const [clicked, setClicked] = useState(false); + let history = useHistory(); + const xl = useMediaQuery({ minWidth: 1024 }); + const store = useStore(); + const [clicked, setClicked] = useState(false); - return ( - + {store.ui.mediaQuery.isDesktop && ( + - {store.ui.mediaQuery.isDesktop && ( -
{ }} > + {/* {store.authentication.userData.role !== "Admin Partner" && ( */} - - Beranda + + Beranda - {store.authentication.userData.role !== "Retail" && ( + {/* )} */} + {store.authentication.userData.role === "Admin" && ( - - Keanggotaan + + Keanggotaan + + + )} + {store.authentication.userData.role === "Supervisor" && ( + + + + Keanggotaan )} {store.authentication.userData.role === "Admin" && ( } + icon={} title="Config" style={{ backgroundColor: "#e3e8ee" }} > - - Rekanan + + Rekanan - - Komisi + + Komisi - + Supplier @@ -162,76 +178,95 @@ export const DesktopLayout = observer(() => { {store.authentication.userData.role === "Admin" && ( } + icon={} title="Product" > - - Produk + + Produk {store.authentication.userData.role === "Admin" && ( - - Kategori + + Kategori )} {store.authentication.userData.role === "Admin" && ( - - Sub Kategori + + Sub Kategori )} )} - {store.authentication.userData.role !== "Admin" && ( + {store.authentication.userData.role === "Supervisor" && ( - - Produk + + Produk + + + )} + {store.authentication.userData.role === "Admin Partner" && ( + + + + Produk + + + )} + {store.authentication.userData.role === "Admin Partner" && ( + + + + Transaksi )} {store.authentication.userData.role === "Retail" && ( - - Transaksi + + Transaksi )} - } - title="Pembayaran" - > - {store.authentication.userData.role !== "Retail" && ( - - - - Konfirmasi - - + {store.authentication.userData.role !== "Admin Partner" && + store.authentication.userData.role !== "Retail" && ( + } + title="Pembayaran" + > + {store.authentication.userData.role !== "Retail" && ( + + + + Konfirmasi + + + )} + {store.authentication.userData.role !== "Admin" && ( + + + + Dibuat oleh Saya + + + )} + )} - {store.authentication.userData.role !== "Admin" && ( - - - - Dibuat oleh Saya - - - )} - {store.authentication.userData.role !== "Admin" && ( - - Profil + + Profil )} @@ -354,45 +389,46 @@ export const DesktopLayout = observer(() => { autoAdjustOverflow={true} placement="bottomRight" content={ - + {store.authentication.userData.role !== "Admin" && ( + + + + Profile + + + )} + { + store.authentication.logout(); + history.push("/login"); + }} > - {store.authentication.userData.role !== "Admin" && - - - Profile - - - } - { - store.authentication.logout(); - history.push("/login"); - }} - > - - Sign out - - + + Sign out + + } title={ - - {store.user.data.username} - - {store.authentication.userData.username} - - + + {store.user.data.username} + + {store.authentication.userData.username} + + } trigger="click" visible={clicked} @@ -455,45 +491,45 @@ export const DesktopLayout = observer(() => { autoAdjustOverflow={true} placement="bottomRight" content={ - + {store.authentication.userData.role !== "Admin" && ( + + + + Profile + + + )} + { + store.authentication.logout(); + history.push("/login"); + }} > - {store.authentication.userData.role !== "Admin" && ( - - - - Profile - - - )} - { - store.authentication.logout(); - history.push("/login"); - }} - > - - Sign out - - + + Sign out + + } title={ - - {store.authentication.userData.username} - + + {store.authentication.userData.username} + } trigger="click" diff --git a/src/pages/App/MenuList.js b/src/pages/App/MenuList.js index db26d51..a3dac73 100644 --- a/src/pages/App/MenuList.js +++ b/src/pages/App/MenuList.js @@ -1,34 +1,38 @@ -import React, {useEffect, useState} from "react"; -import {Menu} from "antd"; -import {Link} from "react-router-dom"; +import React, { useEffect, useState } from "react"; +import { Menu } from "antd"; +import { Link } from "react-router-dom"; import { - AppstoreOutlined, - DatabaseOutlined, - FileAddOutlined, - FileProtectOutlined, - FileSyncOutlined, - HomeOutlined, - MenuUnfoldOutlined, - MoneyCollectOutlined, - ProfileOutlined, - ProjectOutlined, - ShoppingCartOutlined, - UserOutlined, + AppstoreOutlined, + DatabaseOutlined, + FileAddOutlined, + FileProtectOutlined, + FileSyncOutlined, + HomeOutlined, + MenuUnfoldOutlined, + ProfileOutlined, + ShoppingCartOutlined, + UserOutlined, + SlackOutlined, + CodepenOutlined, + WindowsOutlined, + AliyunOutlined, + SettingOutlined, + IdcardOutlined, + AppstoreAddOutlined, } from "@ant-design/icons"; -import {observer} from "mobx-react-lite"; -import {useStore} from "../../utils/useStore"; -import {LINKS} from "../../routes/app"; +import { observer } from "mobx-react-lite"; +import { useStore } from "../../utils/useStore"; +import { LINKS } from "../../routes/app"; -const {SubMenu} = Menu; +const { SubMenu } = Menu; export const MenuList = observer((props) => { - const store = useStore(); - useEffect(() => { - }, []); + const store = useStore(); + useEffect(() => {}, []); - const [setKeys, setSetKeys] = useState(["dashboard"]); + const [setKeys, setSetKeys] = useState(["dashboard"]); - return ( + return ( { overflowedIndicator={0} forceSubMenuRender={true} > + {/* {store.authentication.userData.role === "Admin" && ( */} Beranda - {store.authentication.userData.role !== "Retail" && ( + {/* )} */} + {store.authentication.userData.role === "Admin" && ( - + + Keanggotaan + + + )} + {store.authentication.userData.role === "Supervisor" && ( + + + Keanggotaan )} {store.authentication.userData.role === "Admin" && ( - } title="Config"> + } title="Config"> - + Rekanan - + Komisi @@ -84,10 +98,14 @@ export const MenuList = observer((props) => { )} {store.authentication.userData.role === "Admin" && ( - } title="Product"> - + } + title="Produk" + > + - + Produk @@ -109,14 +127,30 @@ export const MenuList = observer((props) => { )} )} + {store.authentication.userData.role === "Admin Partner" && ( + + + + Produk + + + )} {store.authentication.userData.role === "Supervisor" && ( - + Produk )} + {store.authentication.userData.role === "Admin Partner" && ( + + + + Transaksi + + + )} {store.authentication.userData.role === "Retail" && ( @@ -125,29 +159,36 @@ export const MenuList = observer((props) => { )} - } title="Pembayaran"> - {store.authentication.userData.role !== "Retail" && ( - - - - Konfirmasi - - - )} - {store.authentication.userData.role !== "Admin" && ( - - - + {store.authentication.userData.role !== "Retail" && + store.authentication.userData.role !== "Admin Partner" && ( + } + title="Pembayaran" + > + {store.authentication.userData.role !== "Retail" && ( + + + + Konfirmasi + + + )} + {store.authentication.userData.role !== "Admin" && ( + + + Dibuat oleh Saya - - + + + )} + )} - {store.authentication.userData.role !== "Admin" && ( - - Profil + + Profil )} diff --git a/src/pages/Config/Commission.js b/src/pages/Config/Commission.js index baa91c9..ea51153 100644 --- a/src/pages/Config/Commission.js +++ b/src/pages/Config/Commission.js @@ -38,7 +38,7 @@ export const Commission = observer(() => { const routeData = [ { route: LINKS.HOME, - name: "Home", + name: "Beranda", }, { route: LINKS.COMMISSION, diff --git a/src/pages/Config/Partner.js b/src/pages/Config/Partner.js index c43e6b6..9e85a1d 100644 --- a/src/pages/Config/Partner.js +++ b/src/pages/Config/Partner.js @@ -36,7 +36,7 @@ export const Partner = observer(() => { const routeData = [ { route: LINKS.HOME, - name: "Home", + name: "Beranda", }, { route: LINKS.PARTNER, diff --git a/src/pages/Config/Supplier.js b/src/pages/Config/Supplier.js index e009362..3cd403b 100644 --- a/src/pages/Config/Supplier.js +++ b/src/pages/Config/Supplier.js @@ -51,7 +51,7 @@ export const Supplier = observer(() => { const routeData = [ { route: LINKS.HOME, - name: "Home", + name: "Beranda", }, { route: LINKS.SUPPLIER, diff --git a/src/pages/Home/Home.js b/src/pages/Home/Home.js index 5a96c09..b3b80d6 100644 --- a/src/pages/Home/Home.js +++ b/src/pages/Home/Home.js @@ -1,25 +1,157 @@ import React from "react"; -import {Button, PageHeader} from "antd"; -import {store} from "../../utils/useStore"; -import {observer} from "mobx-react-lite"; +import { Button, PageHeader, Card, Row, Col } from "antd"; +import { store } from "../../utils/useStore"; +import { observer } from "mobx-react-lite"; +import { + DropboxOutlined, + DollarCircleOutlined, + BarChartOutlined, +} from "@ant-design/icons"; export const Home = observer(() => { - return
- + {store.ui.mediaQuery.isDesktop && ( + - - - Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus aut recusandae velit! Consequatur corporis, - eum fuga, harum incidunt laboriosam minus necessitatibus neque non nostrum pariatur tempore. Dignissimos impedit - rem tempora! + + + + Total Transaksi}> + Total Transaksi : 25 Transaksi + + + + + + + Total Keuntungan}> + + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(store.authentication.profileData?.wallet || 0)} + + + + + + + + Saldo}> + + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(store.authentication.profileData?.wallet || 0)} + + + + + + )} + {store.ui.mediaQuery.isMobile && ( +
+ + + + Total Transaksi}> + Total Transaksi : 25 Transaksi + + + + + + + Total Keuntungan}> + + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(store.authentication.profileData?.wallet || 0)} + + + + + + + + Saldo}> + + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(store.authentication.profileData?.wallet || 0)} + + + + +
+ )}
+ ); }); diff --git a/src/pages/Membership/DetailUser.js b/src/pages/Membership/DetailUser.js index 1301340..e3567f5 100644 --- a/src/pages/Membership/DetailUser.js +++ b/src/pages/Membership/DetailUser.js @@ -127,7 +127,7 @@ export const DetailUser = observer(() => { const routeData = [ { route: LINKS.HOME, - name: "Home", + name: "Beranda", }, { route: LINKS.MEMBERSHIP, diff --git a/src/pages/Membership/Membership.js b/src/pages/Membership/Membership.js index 2e3ea61..fd5fe25 100644 --- a/src/pages/Membership/Membership.js +++ b/src/pages/Membership/Membership.js @@ -104,15 +104,15 @@ export const Membership = observer(() => { : (response = await store.transaction.distribute(data)); response?.body?.statusCode === 201 - ? message.success("Success Top Up") - : message.error("Failed Top Up"); + ? message.success("Sukses Top Up") + : message.error("Saldo Tidak Mencukupi"); modalLoader.setLoading(false); await getData(); } catch (e) { console.log(e, "apa errornya"); modalLoader.setLoading(false); - message.error("Failed Top Up"); + message.error("Gagal Top Up"); } setConfirmLoading(false); setIsVisibleTopUpModal(false); @@ -174,7 +174,7 @@ export const Membership = observer(() => { const routeData = [ { route: LINKS.HOME, - name: "Home", + name: "Beranda", }, { route: LINKS.MEMBERSHIP, diff --git a/src/pages/Membership/MembershipModal.js b/src/pages/Membership/MembershipModal.js index 169850f..b7b1ade 100644 --- a/src/pages/Membership/MembershipModal.js +++ b/src/pages/Membership/MembershipModal.js @@ -1,107 +1,126 @@ -import React from "react"; -import {Form, Input, Modal, Select} from "antd"; -import {useStore} from "../../utils/useStore"; +import React, { useState } from "react"; +import { Form, Input, Modal, Select, InputNumber } from "antd"; +import { useStore } from "../../utils/useStore"; export const MembershipModal = ({ - visible, - onCreate, - onCancel, - initialData, - }) => { - const [form] = Form.useForm(); - const {Option} = Select; - const store = useStore(); + visible, + onCreate, + onCancel, + initialData, +}) => { + const [form] = Form.useForm(); + const { Option } = Select; + const store = useStore(); + const [value, setValue] = useState(); - return ( - { - form.resetFields(); - onCancel(); - }} - onOk={() => { - form - .validateFields() - .then((values) => { - onCreate(values); - form.resetFields(); - }) - .catch((info) => { - console.log("Validate Failed:", info); - }); - }} - > -
- {((initialData.id && !initialData.isChangePassword) || - !initialData.id) && ( - - - - )} - {!initialData.id && ( - - - - )} - {((initialData.id && initialData.isChangePassword) || - !initialData.id) && ( - - - - )} - {((initialData.id && !initialData.isChangePassword) || - !initialData.id) && ( - - - - )} - {((initialData.id && !initialData.isChangePassword) || - !initialData.id) && ( - - - - )} -
-
- ); + return ( + { + form.resetFields(); + onCancel(); + }} + onOk={() => { + form + .validateFields() + .then((values) => { + onCreate(values); + form.resetFields(); + }) + .catch((info) => { + console.log("Validate Failed:", info); + }); + }} + > +
+ {((initialData.id && !initialData.isChangePassword) || + !initialData.id) && ( + + + + )} + {!initialData.id && ( + + + + )} + {((initialData.id && initialData.isChangePassword) || + !initialData.id) && ( + + + + )} + {((initialData.id && !initialData.isChangePassword) || + !initialData.id) && ( + + { + setValue(value); + }} + /> + + )} + {((initialData.id && !initialData.isChangePassword) || + !initialData.id) && ( + + + + )} +
+
+ ); }; diff --git a/src/pages/Payback/Payback.js b/src/pages/Payback/Payback.js index e7b716d..7ffebc2 100644 --- a/src/pages/Payback/Payback.js +++ b/src/pages/Payback/Payback.js @@ -163,7 +163,7 @@ export const Payback = observer(() => { const routeData = [ { route: LINKS.HOME, - name: "Home", + name: "Beranda", }, { route: LINKS.PAYBACK, @@ -175,15 +175,23 @@ export const Payback = observer(() => { modalLoader.setLoading(true); try { const response = await store.payback.confirmPayback(id, type); - if (response.body.status !== 201) { - message.error( - response?.body?.message || `Failed ${capitalize(type)} Payback` - ); - } else { - message.success( - response?.body?.message || `Success ${capitalize(type)} Payback` - ); - } + console.log(response); + response.body.statusCode !== 201 && response.body.statusCode !== 200 + ? message.error( + response?.body?.message || `Failed ${capitalize(type)} Payback` + ) + : message.success( + response?.body?.message || `Success ${capitalize(type)} Payback` + ); + // if (response.body.status !== 201 ) { + // message.error( + // response?.body?.message || `Failed ${capitalize(type)} Payback` + // ); + // } else { + // message.success( + // response?.body?.message || `Success ${capitalize(type)} Payback` + // ); + // } } catch (e) { console.error(e, "apa errornya"); message.error( @@ -200,10 +208,10 @@ export const Payback = observer(() => {
- + */} {/* { title={item.name} description={
- +

+ {item.userData_name} +
+ Amount: {item.amount} +
+ {PAYBACK_STATUS[item.status] === + PAYBACK_STATUS[0] ? ( + + + + + ) : ( + + {PAYBACK_STATUS[item.status]} + + )} +

} /> @@ -291,7 +371,10 @@ export const Payback = observer(() => { margin: 0, }} > - {item.amount} +

diff --git a/src/pages/Payback/PaybackCreated.js b/src/pages/Payback/PaybackCreated.js index 8420b1a..1ba7bbe 100644 --- a/src/pages/Payback/PaybackCreated.js +++ b/src/pages/Payback/PaybackCreated.js @@ -80,7 +80,7 @@ export const PaybackCreated = observer(() => { const routeData = [ { route: LINKS.HOME, - name: "Home", + name: "Beranda", }, { route: LINKS.PAYBACK_CREATED, diff --git a/src/pages/Product/Category.js b/src/pages/Product/Category.js index c2dd230..ca64fd7 100644 --- a/src/pages/Product/Category.js +++ b/src/pages/Product/Category.js @@ -37,7 +37,7 @@ export const Category = observer(() => { const routeData = [ { route: LINKS.HOME, - name: "Home", + name: "Beranda", }, { route: LINKS.CATEGORY, diff --git a/src/pages/Product/Product.js b/src/pages/Product/Product.js index 7cdd86e..d9bb8d5 100644 --- a/src/pages/Product/Product.js +++ b/src/pages/Product/Product.js @@ -30,6 +30,7 @@ export const Product = observer(() => { store.supplier.getData(), store.category.getData(), store.product.getDataSubCategories(), + store.product.getProductPartner() ]); await store.product.getData(); modalLoader.setLoading(false); @@ -53,7 +54,7 @@ export const Product = observer(() => { const routeData = [ { route: LINKS.HOME, - name: "Home", + name: "Beranda", }, { route: LINKS.PRODUCT, diff --git a/src/pages/Product/ProductDetail.js b/src/pages/Product/ProductDetail.js index e30aa91..0d6e884 100644 --- a/src/pages/Product/ProductDetail.js +++ b/src/pages/Product/ProductDetail.js @@ -18,7 +18,7 @@ export const ProductDetail = observer(() => { const routeData = [ { route: LINKS.HOME, - name: "Home", + name: "Beranda", }, { route: LINKS.PRODUCT, diff --git a/src/pages/Product/Subcategory.js b/src/pages/Product/Subcategory.js index 08e26cb..0594a68 100644 --- a/src/pages/Product/Subcategory.js +++ b/src/pages/Product/Subcategory.js @@ -41,7 +41,7 @@ export const Subcategory = observer(() => { const routeData = [ { route: LINKS.HOME, - name: "Home", + name: "Beranda", }, { route: LINKS.SUBCATEGORY, diff --git a/src/pages/Profile/Profile.js b/src/pages/Profile/Profile.js index c346341..7bbab08 100644 --- a/src/pages/Profile/Profile.js +++ b/src/pages/Profile/Profile.js @@ -138,12 +138,12 @@ export const Profile = observer(() => {
History User Transaction - + */} { const routeData = [ { route: LINKS.HOME, - name: "Home", + name: "Beranda", }, { route: LINKS.TRANSACTION, diff --git a/src/store/partner.js b/src/store/partner.js index f804b6e..95ddcda 100644 --- a/src/store/partner.js +++ b/src/store/partner.js @@ -27,7 +27,7 @@ export class Partner { async getData() { try { const response = await http.get(`/users/partner?page=${this.page}&pageSize=${this.pageSize}`); - + //console.log(response) this.data = response.body.data.map((item, idx) => { item.key = idx; return item @@ -59,11 +59,12 @@ export class Partner { } } - // async updateStatus(id, data) { - // const response = await http.put(`/users/partner/${id}`).send(data); - // await this.getData(); - // return response; - // } + async updatePassword(id, data) { + const response = await http.put(`/users/change-password-partner/${id}`).send(data); + console.log(response) + await this.getData(); + return response; + } async delete(id) { try { diff --git a/src/store/product.js b/src/store/product.js index 5697d10..b7d6e7c 100644 --- a/src/store/product.js +++ b/src/store/product.js @@ -26,9 +26,11 @@ export class Product { dataPriceHistory = []; totalDataPriceHistory = 0; pagePriceHistory = 0; + pageProductPartner = 0; pageSizePriceHistory = 10 dataDetailProduct = {}; + dataProductPartner=[] constructor(ctx) { this.ctx = ctx; @@ -94,6 +96,16 @@ export class Product { } } + async getProductPartner(id) { + try { + const response = await http.get(`/product/by-categories?page=${this.pageProductPartner}&sub-category=${id}`); + console.log(response) + this.dataProductPartner = response.body.data + } catch (e) { + console.error(e); + } + } + async create(data) { try { const response = await http.post('/product').send(data);