Pages Membership
This commit is contained in:
parent
4a46c86b30
commit
72a747e66e
|
@ -168,18 +168,22 @@ export const DesktopLayout = observer(() => {
|
||||||
<span>Product</span>
|
<span>Product</span>
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
{store.authentication.userData.role === "Admin" && (
|
||||||
<Menu.Item key="category">
|
<Menu.Item key="category">
|
||||||
<Link to={LINKS.CATEGORY}>
|
<Link to={LINKS.CATEGORY}>
|
||||||
<FileAddOutlined />
|
<FileAddOutlined />
|
||||||
<span>Category</span>
|
<span>Category</span>
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
)}
|
||||||
|
{store.authentication.userData.role === "Admin" && (
|
||||||
<Menu.Item key="sub-category">
|
<Menu.Item key="sub-category">
|
||||||
<Link to={LINKS.SUBCATEGORY}>
|
<Link to={LINKS.SUBCATEGORY}>
|
||||||
<FileSyncOutlined />
|
<FileSyncOutlined />
|
||||||
<span>Sub Category</span>
|
<span>Sub Category</span>
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
)}
|
||||||
</SubMenu>
|
</SubMenu>
|
||||||
)}
|
)}
|
||||||
{store.authentication.userData.role !== "Admin" && (
|
{store.authentication.userData.role !== "Admin" && (
|
||||||
|
@ -204,12 +208,14 @@ export const DesktopLayout = observer(() => {
|
||||||
<span>Payback</span>
|
<span>Payback</span>
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
{store.authentication.userData.role !== "Admin" && (
|
||||||
<Menu.Item key="profile">
|
<Menu.Item key="profile">
|
||||||
<Link to={LINKS.PROFILE}>
|
<Link to={LINKS.PROFILE}>
|
||||||
<UserOutlined />
|
<UserOutlined />
|
||||||
<span>Profile</span>
|
<span>Profile</span>
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
)}
|
||||||
<Menu.Divider
|
<Menu.Divider
|
||||||
style={{ background: "transparent", paddingTop: 15 }}
|
style={{ background: "transparent", paddingTop: 15 }}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -90,18 +90,22 @@ export const MenuList = observer((props) => {
|
||||||
<span>Product</span>
|
<span>Product</span>
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
{store.authentication.userData.role === "Admin" && (
|
||||||
<Menu.Item key="category">
|
<Menu.Item key="category">
|
||||||
<Link to={LINKS.CATEGORY}>
|
<Link to={LINKS.CATEGORY}>
|
||||||
<FileAddOutlined />
|
<FileAddOutlined />
|
||||||
<span>Category</span>
|
<span>Category</span>
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
)}
|
||||||
|
{store.authentication.userData.role === "Admin" && (
|
||||||
<Menu.Item key="sub-category">
|
<Menu.Item key="sub-category">
|
||||||
<Link to={LINKS.SUBCATEGORY}>
|
<Link to={LINKS.SUBCATEGORY}>
|
||||||
<FileSyncOutlined />
|
<FileSyncOutlined />
|
||||||
<span>Sub Category</span>
|
<span>Sub Category</span>
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
)}
|
||||||
</SubMenu>
|
</SubMenu>
|
||||||
)}
|
)}
|
||||||
{store.authentication.userData.role !== "Admin" && (
|
{store.authentication.userData.role !== "Admin" && (
|
||||||
|
@ -126,12 +130,14 @@ export const MenuList = observer((props) => {
|
||||||
<span>Payback</span>
|
<span>Payback</span>
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
{store.authentication.userData.role !== "Admin" && (
|
||||||
<Menu.Item key="profile">
|
<Menu.Item key="profile">
|
||||||
<Link to={LINKS.PROFILE}>
|
<Link to={LINKS.PROFILE}>
|
||||||
<UserOutlined />
|
<UserOutlined />
|
||||||
<span>Profile</span>
|
<span>Profile</span>
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
)}
|
||||||
{/*<Menu.Item key="about">*/}
|
{/*<Menu.Item key="about">*/}
|
||||||
{/* <Link to={'/app/about'}>*/}
|
{/* <Link to={'/app/about'}>*/}
|
||||||
{/* <CalendarOutlined/>*/}
|
{/* <CalendarOutlined/>*/}
|
||||||
|
|
|
@ -39,7 +39,6 @@ export const Membership = observer(() => {
|
||||||
const [confirmLoading, setConfirmLoading] = useState(false);
|
const [confirmLoading, setConfirmLoading] = useState(false);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
try {
|
try {
|
||||||
|
@ -89,11 +88,11 @@ export const Membership = observer(() => {
|
||||||
setConfirmLoading(true);
|
setConfirmLoading(true);
|
||||||
try {
|
try {
|
||||||
data.destination = destination;
|
data.destination = destination;
|
||||||
if(data.amount) {
|
if (data.amount) {
|
||||||
data = {
|
data = {
|
||||||
...data,
|
...data,
|
||||||
amount: Number(data.amount)
|
amount: Number(data.amount),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
(await store.authentication.userData.role) === "Admin"
|
(await store.authentication.userData.role) === "Admin"
|
||||||
|
@ -155,7 +154,7 @@ export const Membership = observer(() => {
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setDestination(record?.id);
|
setDestination(record?.id);
|
||||||
console.log(record?.id)
|
console.log(record?.id);
|
||||||
setIsVisibleTopUpModal(true);
|
setIsVisibleTopUpModal(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -274,6 +273,7 @@ export const Membership = observer(() => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={["ppob-container"].join(" ")}>
|
<div className={["ppob-container"].join(" ")}>
|
||||||
<BreadcumbComponent data={routeData} />
|
<BreadcumbComponent data={routeData} />
|
||||||
|
@ -435,7 +435,7 @@ export const Membership = observer(() => {
|
||||||
label="Amount"
|
label="Amount"
|
||||||
rules={[{ required: true, message: "Please input amount!" }]}
|
rules={[{ required: true, message: "Please input amount!" }]}
|
||||||
>
|
>
|
||||||
<Input/>
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useStore } from "../../utils/useStore";
|
import { useStore } from "../../utils/useStore";
|
||||||
import { Button, Card, Col, Input, Row, Select ,message} from "antd";
|
import { Button, Card, Col, Input, Row, Select, message } from "antd";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { BuyProductModal } from "../../component/BuyProductModal";
|
import { BuyProductModal } from "../../component/BuyProductModal";
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ export const Product = observer(() => {
|
||||||
const [productData, setProductData] = useState([]);
|
const [productData, setProductData] = useState([]);
|
||||||
const [data, setData] = useState({});
|
const [data, setData] = useState({});
|
||||||
const [kode, setKode] = useState({});
|
const [kode, setKode] = useState({});
|
||||||
|
const [cardIndex, setCardIndex] = useState({});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
|
@ -50,14 +51,10 @@ export const Product = observer(() => {
|
||||||
await store.transaction.getData();
|
await store.transaction.getData();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleBuy = async (data) => {
|
const handleBuyProduct = async (kode) => {
|
||||||
setKode(data.code);
|
console.log(kode);
|
||||||
//console.log(data.code)
|
|
||||||
};
|
|
||||||
const handleBuyProduct = async (kode)=>{
|
|
||||||
console.log(kode)
|
|
||||||
try {
|
try {
|
||||||
await store.product.buyProduct({productCode:kode});
|
await store.product.buyProduct({ productCode: kode });
|
||||||
message.success("Success Buy Product");
|
message.success("Success Buy Product");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
message.error("Failed Buy Product");
|
message.error("Failed Buy Product");
|
||||||
|
@ -110,8 +107,16 @@ export const Product = observer(() => {
|
||||||
{productData.map((item, index) => (
|
{productData.map((item, index) => (
|
||||||
<Col key={index} xs={24} md={16} lg={8}>
|
<Col key={index} xs={24} md={16} lg={8}>
|
||||||
<Card
|
<Card
|
||||||
onClick={() => handleBuy(item)}
|
onClick={() => {
|
||||||
style={{ cursor: "pointer",backgroundColor:"#2D9CDB" }}
|
setKode(item.code);
|
||||||
|
setCardIndex(index);
|
||||||
|
}}
|
||||||
|
hoverable
|
||||||
|
style={{
|
||||||
|
cursor: "pointer",
|
||||||
|
borderColor: cardIndex === index ? "#2D9CDB" : "",
|
||||||
|
marginLeft: "10px",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<span style={{ color: "black" }}>{item.name}</span>
|
<span style={{ color: "black" }}>{item.name}</span>
|
||||||
<br />
|
<br />
|
||||||
|
@ -128,7 +133,8 @@ export const Product = observer(() => {
|
||||||
)}
|
)}
|
||||||
{productData.length !== 0 && (
|
{productData.length !== 0 && (
|
||||||
<Col style={{ textAlign: "right" }}>
|
<Col style={{ textAlign: "right" }}>
|
||||||
<Button style={{ backgroundColor: "#2D9CDB", color: "white" }}
|
<Button
|
||||||
|
style={{ backgroundColor: "#2D9CDB", color: "white" }}
|
||||||
onClick={() => handleBuyProduct(kode)}
|
onClick={() => handleBuyProduct(kode)}
|
||||||
>
|
>
|
||||||
Beli Sekarang
|
Beli Sekarang
|
||||||
|
|
|
@ -15,7 +15,7 @@ export class Membership {
|
||||||
async getData() {
|
async getData() {
|
||||||
try {
|
try {
|
||||||
const response = await http.get(`/users?page=${this.page}&pageSize=${this.pageSize}`);
|
const response = await http.get(`/users?page=${this.page}&pageSize=${this.pageSize}`);
|
||||||
|
console.log(response,"admin")
|
||||||
this.data = response.body.data.map((item, idx) => {
|
this.data = response.body.data.map((item, idx) => {
|
||||||
item.key = idx;
|
item.key = idx;
|
||||||
item.name = item?.user_detail?.name;
|
item.name = item?.user_detail?.name;
|
||||||
|
@ -33,6 +33,7 @@ export class Membership {
|
||||||
async getDataBySuperior() {
|
async getDataBySuperior() {
|
||||||
try {
|
try {
|
||||||
const response = await http.get(`/users/find-by-supperior?page=${this.page}&pageSize=${this.pageSize}`);
|
const response = await http.get(`/users/find-by-supperior?page=${this.page}&pageSize=${this.pageSize}`);
|
||||||
|
console.log(response,"non admin")
|
||||||
this.data = response.body.data.map((item, idx) => {
|
this.data = response.body.data.map((item, idx) => {
|
||||||
item.key = idx;
|
item.key = idx;
|
||||||
item.name = item?.user_detail?.name;
|
item.name = item?.user_detail?.name;
|
||||||
|
|
17
tes.http
Normal file
17
tes.http
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
POST https://ppob-backend.k3s.bangun-kreatif.com/v1/auth/login HTTP/1.1
|
||||||
|
content-type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"username": "admin",
|
||||||
|
"password": 123
|
||||||
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
POST https://ppob-backend.k3s.bangun-kreatif.com/v1/auth/login HTTP/1.1
|
||||||
|
content-type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"username": "admin",
|
||||||
|
"password": 123
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user