This commit is contained in:
ajat91 2021-12-16 18:58:04 +07:00
commit ba01132cd4
6 changed files with 30 additions and 8 deletions

View File

@ -26,7 +26,7 @@
work correctly both with client-side routing and a non-root public URL. work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`. Learn how to configure a non-root public URL by running `npm run build`.
--> -->
<title>React App</title> <title>PPOB</title>
</head> </head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>

View File

@ -1,6 +1,6 @@
{ {
"short_name": "React App", "short_name": "PPOB",
"name": "Create React App Sample", "name": "PPOB",
"icons": [ "icons": [
{ {
"src": "favicon.ico", "src": "favicon.ico",

View File

@ -106,8 +106,9 @@ export const Membership = observer(() => {
const columns = [ const columns = [
{ {
title: "Name", title: "Name",
dataIndex: "username", dataIndex: "name",
key: "username", key: "name",
render: (text, record) => record?.name ?? record?.username,
}, },
{ {
title: "Username", title: "Username",
@ -138,7 +139,7 @@ export const Membership = observer(() => {
render: (text, record) => ( render: (text, record) => (
<Space size="middle"> <Space size="middle">
<Button <Button
type={record?.status === true ? "danger" : "primary"} type={record?.isActive === true ? "danger" : "primary"}
onClick={() => changeStatus(record?.id, record?.isActive)} onClick={() => changeStatus(record?.id, record?.isActive)}
> >
{record?.isActive === true ? "Inactive" : "Active"} {record?.isActive === true ? "Inactive" : "Active"}

View File

@ -52,6 +52,15 @@ export const MembershipModal = ({
initialValues={initialData} initialValues={initialData}
> >
{((initialData.id && !initialData.isChangePassword) || !initialData.id) && ( {((initialData.id && !initialData.isChangePassword) || !initialData.id) && (
<Form.Item
name="name"
label="Name"
rules={[{ required: true, message: "Please input Name!" }]}
>
<Input />
</Form.Item>
)}
{!initialData.id && (
<Form.Item <Form.Item
name="username" name="username"
label="Username" label="Username"

View File

@ -5,6 +5,7 @@ import {LINKS} from "../../routes/app";
import {useStore} from "../../utils/useStore"; import {useStore} from "../../utils/useStore";
import {observer} from "mobx-react-lite"; import {observer} from "mobx-react-lite";
import {FilterOutlined} from "@ant-design/icons"; import {FilterOutlined} from "@ant-design/icons";
import {format, parseISO} from "date-fns";
const {Title, Text} = Typography; const {Title, Text} = Typography;
@ -47,6 +48,11 @@ export const Profile = observer(() => {
title: 'Transaction Date', title: 'Transaction Date',
dataIndex: 'created_at', dataIndex: 'created_at',
key: 'created_at', key: 'created_at',
render: (text, record) => {
return (
<Text>{format(parseISO(record.created_at), 'dd MMMM yyyy HH:mm')}</Text>
)
},
}, },
] ]

View File

@ -17,9 +17,13 @@ export class Membership {
this.data = response.body.data.map((item, idx) => { this.data = response.body.data.map((item, idx) => {
item.key = idx; item.key = idx;
item.roleName = item.roles.name; item.name = item?.user_detail?.name;
item.roleId = item?.roles.id;
item.roleName = item?.roles.name;
return item return item
}) ?? [] }) ?? []
console.log(JSON.stringify(this.data), "DATA");
this.total_data = response.body.total_data ?? 0 this.total_data = response.body.total_data ?? 0
} }
@ -28,7 +32,9 @@ export class Membership {
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}`);
this.data = response.body.data.map((item, idx) => { this.data = response.body.data.map((item, idx) => {
item.key = idx; item.key = idx;
item.roleName = item.roles.name; item.name = item?.user_detail?.name;
item.roleId = item?.roles.id;
item.roleName = item?.roles?.name;
return item return item
}) ?? [] }) ?? []