diff --git a/src/constants/payback.js b/src/constants/payback.js new file mode 100644 index 0000000..a72024e --- /dev/null +++ b/src/constants/payback.js @@ -0,0 +1,7 @@ +export const PAYBACK_STATUS = { + 0: 'Pending', + 1: 'Success', + 2: 'Failed', + 3: 'Approved', + 4: 'Rejected', +} \ No newline at end of file diff --git a/src/pages/Payback/Payback.js b/src/pages/Payback/Payback.js index a8f7130..bbb5291 100644 --- a/src/pages/Payback/Payback.js +++ b/src/pages/Payback/Payback.js @@ -1,5 +1,5 @@ import React, {useContext, useEffect} from "react"; -import {Button, Card, Col, Divider, Image, Input, List, message, Modal, Row, Space, Table,} from "antd"; +import {Button, Card, Col, Divider, Image, Input, List, message, Modal, Row, Space, Table, Tag,} from "antd"; import {useStore} from "../../utils/useStore"; import {observer} from "mobx-react-lite"; import {CheckCircleOutlined, CheckOutlined, CloseOutlined, FilterOutlined, StopOutlined,} from "@ant-design/icons"; @@ -8,6 +8,7 @@ import {LINKS} from "../../routes/app"; import {ModalLoaderContext} from "../../utils/modal"; import {appConfig} from "../../config/app"; import {capitalize} from "lodash"; +import {PAYBACK_STATUS} from "../../constants/payback"; const {Search} = Input; @@ -35,88 +36,100 @@ export const Payback = observer(() => { }, []); const columns = [ + { + title: "Name", + dataIndex: "userData_name", + key: "userData_name", + }, { title: "Picture", dataIndex: "image_prove", key: "image_prove", render: (text, record) => ( - {record.id} - ), - }, - { - title: "Amount", - dataIndex: "amount", - key: "amount", - width: '20%', - render: (text) => - new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(text), - }, - { - title: "Action", - dataIndex: "amount", - key: "action", - width: '10%', - render: (text, record) => ( - - - + - + }} + icon={} + style={{ + backgroundColor: "#ff1c1c", + color: "#fff", + borderColor: "#ff1c1c", + }} + > + Reject + + : + + {PAYBACK_STATUS[record.status]} + ), }, ]; @@ -140,8 +153,9 @@ export const Payback = observer(() => { const response = await store.payback.confirmPayback(id, type); if (response.body.status !== 201) { message.error(`Failed ${capitalize(type)} Payback`); + } else { + message.success(`Success ${capitalize(type)} Payback`); } - message.success(`Success ${capitalize(type)} Payback`); } catch (e) { console.error(e, "apa errornya"); message.error("Failed Handler Action Payback"); diff --git a/src/pages/Payback/PaybackCreated.js b/src/pages/Payback/PaybackCreated.js index 70dd3e6..54005ef 100644 --- a/src/pages/Payback/PaybackCreated.js +++ b/src/pages/Payback/PaybackCreated.js @@ -1,5 +1,5 @@ import React, {useContext, useEffect, useState} from "react"; -import {Button, Card, Col, Divider, Image, Input, List, message, Row, Table,} from "antd"; +import {Button, Card, Col, Divider, Image, Input, List, message, Row, Table, Tag,} from "antd"; import {useStore} from "../../utils/useStore"; import {observer} from "mobx-react-lite"; import {FilterOutlined, PlusSquareOutlined,} from "@ant-design/icons"; @@ -8,6 +8,7 @@ import {BreadcumbComponent} from "../../component/BreadcumbComponent"; import {LINKS} from "../../routes/app"; import {ModalLoaderContext} from "../../utils/modal"; import {appConfig} from "../../config/app"; +import {PAYBACK_STATUS} from "../../constants/payback"; const {Search} = Input; @@ -61,6 +62,19 @@ export const PaybackCreated = observer(() => { currency: "IDR", }).format(text), }, + { + title: "Status", + dataIndex: "status", + key: "status", + width: '10%', + render: (text) => + + {PAYBACK_STATUS[text]} + + }, ]; const routeData = [