fix: detail product
This commit is contained in:
parent
4ba8f07f93
commit
a16f42145b
|
@ -1,37 +1,26 @@
|
||||||
import React, { useContext, useEffect, useState } from "react";
|
import React, {useContext, useEffect, useState} from "react";
|
||||||
import {
|
import {Button, Card, Col, Row, Table, Typography,} from "antd";
|
||||||
Button,
|
import {BreadcumbComponent} from "../../component/BreadcumbComponent";
|
||||||
Card,
|
import {LINKS} from "../../routes/app";
|
||||||
Col,
|
import {useStore} from "../../utils/useStore";
|
||||||
Row,
|
import {observer} from "mobx-react-lite";
|
||||||
Table,
|
import {FilterOutlined} from "@ant-design/icons";
|
||||||
Typography,
|
import {format, parseISO} from "date-fns";
|
||||||
Tag,
|
import {ModalLoaderContext} from "../../utils/modal";
|
||||||
Space,
|
import {useParams} from "react-router-dom";
|
||||||
message,
|
|
||||||
} from "antd";
|
|
||||||
import { BreadcumbComponent } from "../../component/BreadcumbComponent";
|
|
||||||
import { LINKS } from "../../routes/app";
|
|
||||||
import { useStore } from "../../utils/useStore";
|
|
||||||
import { observer } from "mobx-react-lite";
|
|
||||||
import { FilterOutlined, DownloadOutlined } from "@ant-design/icons";
|
|
||||||
import { format, parseISO } from "date-fns";
|
|
||||||
import { ModalLoaderContext } from "../../utils/modal";
|
|
||||||
import { useParams } from "react-router-dom";
|
|
||||||
|
|
||||||
const { Title, Text } = Typography;
|
const {Title, Text} = Typography;
|
||||||
|
|
||||||
export const DetailUser = observer(() => {
|
export const DetailUser = observer(() => {
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const modalLoader = useContext(ModalLoaderContext);
|
const modalLoader = useContext(ModalLoaderContext);
|
||||||
const { id } = useParams();
|
const {id} = useParams();
|
||||||
const [visibleModal, setVisibleModal] = useState(false);
|
const [visibleModal, setVisibleModal] = useState(false);
|
||||||
const [isVisibleTopUpModal, setIsVisibleTopUpModal] = useState(false);
|
const [isVisibleTopUpModal, setIsVisibleTopUpModal] = useState(false);
|
||||||
const [destination, setDestination] = useState(null);
|
const [destination, setDestination] = useState(null);
|
||||||
const [initialData, setInitialData] = useState({});
|
const [initialData, setInitialData] = useState({});
|
||||||
const [confirmLoading, setConfirmLoading] = useState(false);
|
const [confirmLoading, setConfirmLoading] = useState(false);
|
||||||
|
|
||||||
//console.log(id)
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
modalLoader.setLoading(true);
|
modalLoader.setLoading(true);
|
||||||
|
@ -69,8 +58,12 @@ export const DetailUser = observer(() => {
|
||||||
name: "Home",
|
name: "Home",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
route: LINKS.USER_DETAIL,
|
route: "/app/membership",
|
||||||
name: <span style={{ fontWeight: "bold" }}>Detail User</span>,
|
name: <span style={{fontWeight: "bold"}}>Membership</span>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
route: LINKS.USER_DETAIL.replace(":id", id),
|
||||||
|
name: <span style={{fontWeight: "bold"}}>Detail User</span>,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useContext, useEffect, useState } from "react";
|
import React, {useContext, useEffect, useState} from "react";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
|
@ -14,19 +14,18 @@ import {
|
||||||
Select,
|
Select,
|
||||||
Space,
|
Space,
|
||||||
Table,
|
Table,
|
||||||
Tag,
|
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import { useStore } from "../../utils/useStore";
|
import {useStore} from "../../utils/useStore";
|
||||||
import { observer } from "mobx-react-lite";
|
import {observer} from "mobx-react-lite";
|
||||||
import { DownloadOutlined, PlusSquareOutlined } from "@ant-design/icons";
|
import {DownloadOutlined, PlusSquareOutlined} from "@ant-design/icons";
|
||||||
import { MembershipModal } from "./MembershipModal";
|
import {MembershipModal} from "./MembershipModal";
|
||||||
import { BreadcumbComponent } from "../../component/BreadcumbComponent";
|
import {BreadcumbComponent} from "../../component/BreadcumbComponent";
|
||||||
import { LINKS } from "../../routes/app";
|
import {LINKS} from "../../routes/app";
|
||||||
import { useHistory } from "react-router-dom";
|
import {useHistory} from "react-router-dom";
|
||||||
import { ModalLoaderContext } from "../../utils/modal";
|
import {ModalLoaderContext} from "../../utils/modal";
|
||||||
|
|
||||||
const { Search } = Input;
|
const {Search} = Input;
|
||||||
const { Option } = Select;
|
const {Option} = Select;
|
||||||
export const Membership = observer(() => {
|
export const Membership = observer(() => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
@ -221,9 +220,7 @@ export const Membership = observer(() => {
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await store.transaction.getDataHistoryTopUp(record.id);
|
|
||||||
history.push(LINKS.USER_DETAIL.replace(":id", record.id));
|
history.push(LINKS.USER_DETAIL.replace(":id", record.id));
|
||||||
console.log(record.id);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Detail
|
Detail
|
||||||
|
|
|
@ -22,12 +22,13 @@ export class Transaction {
|
||||||
filterSubCategory = null;
|
filterSubCategory = null;
|
||||||
|
|
||||||
pageHistoryTransaction = 0;
|
pageHistoryTransaction = 0;
|
||||||
pageHistoryTopUp = 0;
|
|
||||||
pageSizeHistoryTransaction = 10
|
pageSizeHistoryTransaction = 10
|
||||||
dataHistoryTransaction = [];
|
dataHistoryTransaction = [];
|
||||||
total_dataHistoryTransaction = 0;
|
total_dataHistoryTransaction = 0;
|
||||||
|
|
||||||
dataHistoryTopUp=[];
|
pageHistoryTopUp = 0;
|
||||||
|
pageSizeHistoryTopUp = 10;
|
||||||
|
dataHistoryTopUp = [];
|
||||||
total_dataHistoryTopUp = 0;
|
total_dataHistoryTopUp = 0;
|
||||||
|
|
||||||
constructor(ctx) {
|
constructor(ctx) {
|
||||||
|
@ -80,9 +81,7 @@ export class Transaction {
|
||||||
|
|
||||||
async getDataHistoryTopUp(id) {
|
async getDataHistoryTopUp(id) {
|
||||||
try {
|
try {
|
||||||
//console.log("Top up")
|
const response = await http.get(`/transaction/history-deposit?page=${this.pageHistoryTopUp}&pageSize=${this.pageSizeHistoryTopUp}&user-destination=${id}`);
|
||||||
const response = await http.get(`/transaction/history-deposit?page=${this.pageHistoryTopUp}&user-destination=${id}`);
|
|
||||||
//console.log(response,"data")
|
|
||||||
this.dataHistoryTopUp = response.body.data ?? []
|
this.dataHistoryTopUp = response.body.data ?? []
|
||||||
this.total_dataHistoryTopUp = response?.body?.count ?? 0
|
this.total_dataHistoryTopUp = response?.body?.count ?? 0
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user