This commit is contained in:
fro1991
2025-02-01 16:43:57 +07:00
parent 8a385410d8
commit c432df568a
69 changed files with 0 additions and 23530 deletions

View File

@ -1,56 +0,0 @@
.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.main-content {
margin-left: 250px;
padding: 20px;
background-color: #f9f9f9;
min-height: 100vh;
}
.stats {
display: flex;
gap: 20px;
margin-bottom: 20px;
}
.stats-card {
flex: 1;
}

View File

@ -1,17 +0,0 @@
// import logo from "./logo.svg";
import "./Dashboard.css";
import Chart from "chart.js/auto";
import { CategoryScale } from "chart.js";
import Summary from "../components/Summary";
Chart.register(CategoryScale);
function Dasboard() {
return (
<div className="App">
<Summary />
</div>
);
}
export default Dasboard;

View File

@ -1,109 +0,0 @@
import React, { useState } from "react"
import { TextField, Button, Box, Typography, Grid, Paper, Avatar, Divider } from "@mui/material"
import { Link, useNavigate } from "react-router-dom"
import Cookies from "js-cookie"
import { fetchApi } from "../config/axios"
import logo from "../logo/logo.jpeg"
const LoginPage = () => {
// State for email and password
const [username, setUsername] = useState("")
const [password, setPassword] = useState("")
const navigate = useNavigate()
// Handle form submission
const handleSubmit = async (e) => {
try {
e.preventDefault()
if (username && password) {
// GET CREDIENTIAL
let user = await fetchApi("/d/login", "POST", { username, password })
if (user) {
if (user.data && user.data.data) {
let resUserLogin = user.data.data
console.log("resUserLogin", resUserLogin)
let roleList = JSON.stringify(resUserLogin.roles_list)
Cookies.set("token", resUserLogin.token.access_token, { expires: 1, path: "/" })
Cookies.set("role", resUserLogin.role_name, { expires: 1, path: "/" })
Cookies.set("userId", resUserLogin.user.id, { expires: 1, path: "/" })
Cookies.set("username", resUserLogin.user.username, { expires: 1, path: "/" })
// Cookies.set('roles_list', roleList, { expires: 1, path: '/' });
localStorage.setItem("roles_list", roleList)
navigate("/")
} else {
alert(user.response.data.message)
}
}
} else {
alert("Please fill in both fields.")
}
} catch (error) {
if (error.response) alert(error.response.data.message)
else alert(error.message)
console.log(error)
}
}
return (
<Grid container justifyContent="center" alignItems="center" style={{ minHeight: "100vh", backgroundColor: "#f4f6f8" }}>
<Grid item xs={12} sm={6} md={4}>
<Paper elevation={3} sx={{ padding: 3 }}>
<Typography variant="h5" align="center" gutterBottom>
Login
</Typography>
<form onSubmit={handleSubmit}>
<Box mb={2}>
<TextField label="Email" variant="outlined" fullWidth value={username} onChange={(e) => setUsername(e.target.value)} type="text" required />
</Box>
<Box mb={2}>
<TextField label="Password" variant="outlined" fullWidth value={password} onChange={(e) => setPassword(e.target.value)} type="password" required />
</Box>
<Box mt={2} textAlign="center">
<Button>
<Link to="/register">Register</Link>
</Button>
<Button variant="contained" color="primary" type="submit" fullWidth>
Login
</Button>
</Box>
</form>
</Paper>
</Grid>
<Box
sx={{
width: "100%",
position: "fixed",
bottom: 0,
textAlign: "center",
bgcolor: "#f9f9f9", // Background color
py: 2, // Padding
}}
>
{/* Divider (Horizontal Line) */}
<Divider sx={{ mb: 2 }} />
{/* Content */}
<Box
justifyItems={"center"}
sx={{
display: "flex",
alignItems: "center", // Align items vertically
justifyContent: "center", // Center content horizontally
gap: 1, // Space between logo and text
mt: 2, // Optional margin-top
}}
>
<Avatar src={logo} alt="T-PAY" sx={{ backgroundColor: "red", width: "50px", height: "50px" }} />
<Typography variant="h6" sx={{ fontWeight: "bold" }}>
T-PAY
</Typography>
</Box>
<Typography variant="body2" sx={{ color: "gray" }}>
© 2025 TelinDigital Solution
</Typography>
</Box>
</Grid>
)
}
export default LoginPage

View File

@ -1,156 +0,0 @@
import * as React from 'react';
import Paper from '@mui/material/Paper';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TablePagination from '@mui/material/TablePagination';
import TableRow from '@mui/material/TableRow';
import { Box, Typography, Button, TextField } from '@mui/material';
import IconButton from '@mui/material/IconButton';
import SearchIcon from '@mui/icons-material/Search';
const columns = [
{ id: 'id', label: 'ID', minWidth: 50 },
{ id: 'name', label: 'Name', minWidth: 100 },
{
id: 'internalName',
label: 'Internal Name',
minWidth: 100,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'description',
label: 'Description',
minWidth: 170,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'action',
label: 'Action',
minWidth: 170,
align: 'right',
format: (value) => value.toFixed(2),
},
];
const rows = {
"recordsFiltered": 5,
"data": [
{
"description": "Default PIN Credential",
"id": 1,
"internalName": "pin_credential",
"name": "PIN Credential"
},
{
"description": "Partner Secret Auth Credential",
"id": 2,
"internalName": "secret_auth",
"name": "Secret Auth"
},
{
"description": "Partner API Key",
"id": 3,
"internalName": "api_key",
"name": "APIKey"
},
{
"description": "Web Access Credential",
"id": 4,
"internalName": "web_credential",
"name": "Web Credential"
},
{
"description": "One To Many Transfers",
"id": 5,
"internalName": "otm_tpay",
"name": "OTM TPay"
}
],
"recordsTotal": 5
};
export default function ManageGroups() {
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(10);
const handleChangePage = (event, newPage) => {
setPage(newPage);
};
const handleChangeRowsPerPage = (event) => {
setRowsPerPage(+event.target.value);
setPage(0);
};
return (
<Box sx={{ padding: 3 }}>
<Typography sx={{ color: 'gray', size: 'xl' }}>Manage Access</Typography>
<Box sx={{ padding: 3 }}>
<Box sx={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', pr: 2, }}>
<Button variant="contained" color="primary">Create New Member</Button>
</Box>
<Box sx={{ display: 'flex', justifyContent: 'flex-start', alignItems: 'center', pr: 2, }}>
<TextField id="standard-basic" label="Search" variant="standard" />
<IconButton type="button" sx={{ p: '10px' }} aria-label="search">
<SearchIcon />
</IconButton>
</Box>
<Paper sx={{ width: '100%', overflow: 'hidden' }}>
<TableContainer sx={{ maxHeight: 440 }}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{columns.map((column) => (
<TableCell
key={column.id}
align={column.align}
style={{ minWidth: column.minWidth }}
>
{column.label}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{rows.data
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((row) => {
return (
<TableRow hover role="checkbox" tabIndex={-1} key={row.id}>
{columns.map((column) => {
const value = row[column.id];
return (
<TableCell key={column.id} align={column.align}>
{
column.id === 'action' ? (
<Button>Details</Button>
) : value
}
</TableCell>
);
})}
</TableRow>
);
})}
</TableBody>
</Table>
</TableContainer>
<TablePagination
rowsPerPageOptions={[10, 25, 100]}
component="div"
count={rows.data.length}
rowsPerPage={rowsPerPage}
page={page}
onPageChange={handleChangePage}
onRowsPerPageChange={handleChangeRowsPerPage}
/>
</Paper>
</Box>
</Box>
);
}

View File

@ -1,211 +0,0 @@
import * as React from 'react';
import Paper from '@mui/material/Paper';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TablePagination from '@mui/material/TablePagination';
import TableRow from '@mui/material/TableRow';
import { Box, Typography, Button, TextField } from '@mui/material';
import IconButton from '@mui/material/IconButton';
import SearchIcon from '@mui/icons-material/Search';
const columns = [
{ id: 'id', label: 'ID', minWidth: 50 },
{ id: 'name', label: 'Name', minWidth: 100 },
{
id: 'description',
label: 'Description',
minWidth: 100,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'systemAccount',
label: 'System Account',
minWidth: 170,
align: 'right',
},
{ id: 'createdDate', label: 'Created Date', minWidth: 100 },
{
id: 'action',
label: 'Action',
minWidth: 170,
align: 'right',
format: (value) => value.toFixed(2),
},
];
function generateData(data, column) {
if (column === 'systemAccount') return data ? 'true' : 'false';
return data;
}
const rows = {
"recordsFiltered": 5,
"data": [
{
"createdDate": "2019-12-05T09:18:06.000+0000",
"creditLimit": null,
"currency": null,
"description": "Rekening Member eMoney",
"formattedCreatedDate": "2019-12-05 18:18:06",
"formattedCreditLimit": null,
"formattedLowerCreditLimit": null,
"formattedUpperCreditLimit": null,
"group": null,
"id": 1,
"lowerCreditLimit": null,
"name": "eMoney Account",
"systemAccount": false,
"upperCreditLimit": null
},
{
"createdDate": "2019-12-11T07:44:29.000+0000",
"creditLimit": null,
"currency": null,
"description": "Topup Account",
"formattedCreatedDate": "2019-12-11 16:44:29",
"formattedCreditLimit": null,
"formattedLowerCreditLimit": null,
"formattedUpperCreditLimit": null,
"group": null,
"id": 24,
"lowerCreditLimit": null,
"name": "Topup Account",
"systemAccount": true,
"upperCreditLimit": null
},
{
"createdDate": "2019-12-05T09:19:19.000+0000",
"creditLimit": null,
"currency": null,
"description": "Rekening Merchant",
"formattedCreatedDate": "2019-12-05 18:19:19",
"formattedCreditLimit": null,
"formattedLowerCreditLimit": null,
"formattedUpperCreditLimit": null,
"group": null,
"id": 39,
"lowerCreditLimit": null,
"name": "Merchant Account",
"systemAccount": false,
"upperCreditLimit": null
},
{
"createdDate": "2019-12-05T09:19:25.000+0000",
"creditLimit": null,
"currency": null,
"description": "Rekening Deposit",
"formattedCreatedDate": "2019-12-05 18:19:25",
"formattedCreditLimit": null,
"formattedLowerCreditLimit": null,
"formattedUpperCreditLimit": null,
"group": null,
"id": 40,
"lowerCreditLimit": null,
"name": "Deposit Account",
"systemAccount": false,
"upperCreditLimit": null
},
{
"createdDate": "2021-04-13T16:45:13.000+0000",
"creditLimit": null,
"currency": null,
"description": "Pooling account to maintain cash in/out member to bank",
"formattedCreatedDate": "2021-04-14 01:45:13",
"formattedCreditLimit": null,
"formattedLowerCreditLimit": null,
"formattedUpperCreditLimit": null,
"group": null,
"id": 41,
"lowerCreditLimit": null,
"name": "Cash out/in account to bank",
"systemAccount": true,
"upperCreditLimit": null
}
],
"recordsTotal": 5
};
export default function ManageGroups() {
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(10);
const handleChangePage = (event, newPage) => {
setPage(newPage);
};
const handleChangeRowsPerPage = (event) => {
setRowsPerPage(+event.target.value);
setPage(0);
};
return (
<Box sx={{ padding: 3 }}>
<Typography sx={{ color: 'gray', size: 'xl' }}>Manage Account</Typography>
<Box sx={{ padding: 3 }}>
<Box sx={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', pr: 2, }}>
<Button variant="contained" color="primary">Create New Member</Button>
</Box>
<Box sx={{ display: 'flex', justifyContent: 'flex-start', alignItems: 'center', pr: 2, }}>
<TextField id="standard-basic" label="Search" variant="standard" />
<IconButton type="button" sx={{ p: '10px' }} aria-label="search">
<SearchIcon />
</IconButton>
</Box>
<Paper sx={{ width: '100%', overflow: 'hidden' }}>
<TableContainer sx={{ maxHeight: 440 }}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{columns.map((column) => (
<TableCell
key={column.id}
align={column.align}
style={{ minWidth: column.minWidth }}
>
{column.label}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{rows.data
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((row) => {
return (
<TableRow hover role="checkbox" tabIndex={-1} key={row.id}>
{columns.map((column) => {
const value = row[column.id];
return (
<TableCell key={column.id} align={column.align}>
{
column.id === 'action' ? (
<Button>Details</Button>
) : generateData(value, column.id)
}
</TableCell>
);
})}
</TableRow>
);
})}
</TableBody>
</Table>
</TableContainer>
<TablePagination
rowsPerPageOptions={[10, 25, 100]}
component="div"
count={rows.data.length}
rowsPerPage={rowsPerPage}
page={page}
onPageChange={handleChangePage}
onRowsPerPageChange={handleChangeRowsPerPage}
/>
</Paper>
</Box>
</Box>
);
}

View File

@ -1,113 +0,0 @@
import React, { useState } from "react";
import {
TextField,
Button,
Box,
Typography,
Paper,
InputLabel,
Select,
MenuItem
} from "@mui/material";
const SettingPage = () => {
// State for form fields
const [accessType, setAccessType] = useState("");
const [username, setUsername] = useState("");
const [credential, setCredential] = useState("");
const [confirmCredential, setConfirmCredential] = useState("");
// Handle form submission
const handleSubmit = (e) => {
e.preventDefault();
if (credential !== confirmCredential) {
alert("Credentials do not match!");
return;
}
if (accessType && username && credential && setConfirmCredential) {
// Handle registration logic, like calling an API to create the user
console.log("Registered with:", { accessType, username, credential });
} else {
alert("Please fill in all fields.");
}
};
return (
<Box sx={{ padding: 3 }}>
<Typography sx={{ color: 'gray', size: 'xl' }}>Access</Typography>
<Box sx={{ padding: 3 }}>
<Box sx={{ padding: 3 }}>
<Paper sx={{ width: '100%', overflow: 'hidden' }}>
<Typography sx={{ color: 'gray', size: 'xl' }}>Manage Member Credential</Typography>
<form onSubmit={handleSubmit}>
<Box mb={2} m={2}>
<InputLabel id="demo-simple-select-label">Access Type</InputLabel>
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"
value={accessType}
label="Access Type"
variant="outlined"
fullWidth
required
onChange={(e) => setAccessType(e.target.value)}
>
<MenuItem value={10}>Ten</MenuItem>
<MenuItem value={20}>Twenty</MenuItem>
<MenuItem value={30}>Thirty</MenuItem>
</Select>
{/* <TextField
label="Access Type"
variant="outlined"
fullWidth
value={accessType}
onChange={(e) => setAccessType(e.target.value)}
required
/> */}
</Box>
<Box mb={2} m={2}>
<TextField
label="Username"
variant="outlined"
fullWidth
value={username}
onChange={(e) => setUsername(e.target.value)}
required
/>
</Box>
<Box mb={2} m={2}>
<TextField
label="Credential"
variant="outlined"
fullWidth
value={credential}
onChange={(e) => setCredential(e.target.value)}
type="password"
required
/>
</Box>
<Box mb={2} m={2}>
<TextField
label="Confirm Credential"
variant="outlined"
fullWidth
value={confirmCredential}
onChange={(e) => setConfirmCredential(e.target.value)}
type="password"
required
/>
</Box>
<Box mt={2} mb={2} textAlign="center">
<Button style={{ marginRight: '5px'}} variant="contained">Edit</Button>
<Button variant="contained" color="success">Submit</Button>
</Box>
</form>
</Paper>
</Box>
</Box>
</Box>
);
};
export default SettingPage;

View File

@ -1,128 +0,0 @@
import * as React from 'react';
import Paper from '@mui/material/Paper';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TablePagination from '@mui/material/TablePagination';
import TableRow from '@mui/material/TableRow';
import { Box, Typography, Button, TextField } from '@mui/material';
import IconButton from '@mui/material/IconButton';
import SearchIcon from '@mui/icons-material/Search';
const columns = [
{ id: 'id', label: 'ID', minWidth: 50 },
{ id: 'name', label: 'Name', minWidth: 100 },
{ id: 'code', label: 'Code', minWidth: 100 },
{ id: 'prefix', label: 'Prefix', minWidth: 100 },
{ id: 'trailer', label: 'Trailer', minWidth: 100 },
{ id: 'format', label: 'Format', minWidth: 100 },
{ id: 'grouping', label: 'Grouping Separator', minWidth: 100 },
{ id: 'decimal', label: 'Decimal Separator', minWidth: 100 },
{
id: 'action',
label: 'Action',
minWidth: 170,
align: 'right',
format: (value) => value.toFixed(2),
},
];
const rows = {
"recordsFiltered": 1,
"data": [
{
"code": "USD",
"decimal": ".",
"format": "#,##0.00",
"grouping": ",",
"id": 2,
"name": "Dollar",
"prefix": "$",
"trailer": ""
}
],
"recordsTotal": 1
};
export default function ManageCurrency() {
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(10);
const handleChangePage = (event, newPage) => {
setPage(newPage);
};
const handleChangeRowsPerPage = (event) => {
setRowsPerPage(+event.target.value);
setPage(0);
};
return (
<Box sx={{ padding: 3 }}>
<Typography sx={{ color: 'gray', size: 'xl' }}>Manage Currency</Typography>
<Box sx={{ padding: 3 }}>
<Box sx={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', pr: 2, }}>
<Button variant="contained" color="primary">Create New Group</Button>
</Box>
<Box sx={{ display: 'flex', justifyContent: 'flex-start', alignItems: 'center', pr: 2, }}>
<TextField id="standard-basic" label="Search" variant="standard" />
<IconButton type="button" sx={{ p: '10px' }} aria-label="search">
<SearchIcon />
</IconButton>
</Box>
<Paper sx={{ width: '100%', overflow: 'hidden' }}>
<TableContainer sx={{ maxHeight: 440 }}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{columns.map((column) => (
<TableCell
key={column.id}
align={column.align}
style={{ minWidth: column.minWidth }}
>
{column.label}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{rows.data
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((row) => {
return (
<TableRow hover role="checkbox" tabIndex={-1} key={row.id}>
{columns.map((column) => {
const value = row[column.id];
return (
<TableCell key={column.id} align={column.align}>
{
column.id === 'action' ? (
<Button>Details</Button>
) : value
}
</TableCell>
);
})}
</TableRow>
);
})}
</TableBody>
</Table>
</TableContainer>
<TablePagination
rowsPerPageOptions={[10, 25, 100]}
component="div"
count={rows.data.length}
rowsPerPage={rowsPerPage}
page={page}
onPageChange={handleChangePage}
onRowsPerPageChange={handleChangeRowsPerPage}
/>
</Paper>
</Box>
</Box>
);
}

View File

@ -1,142 +0,0 @@
import * as React from 'react';
import Paper from '@mui/material/Paper';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TablePagination from '@mui/material/TablePagination';
import TableRow from '@mui/material/TableRow';
import { Box, Typography, Button, TextField } from '@mui/material';
import IconButton from '@mui/material/IconButton';
import SearchIcon from '@mui/icons-material/Search';
const columns = [
{ id: 'id', label: 'ID', minWidth: 50 },
{ id: 'createdDate', label: 'Created Date', minWidth: 100 },
{
id: 'name',
label: 'Name',
minWidth: 100,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'description',
label: 'Description',
minWidth: 170,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'action',
label: 'Action',
minWidth: 170,
align: 'right',
format: (value) => value.toFixed(2),
},
];
function createData(id, name, description, population, size) {
const today = new Date();
return { id, name, description, population, size, createdDate: today.toString()};
}
const rows = [
createData(1,'India', 'IN', 1324171354, 3287263),
createData(2,'China', 'CN', 1403500365, 9596961),
createData(3,'Italy', 'IT', 60483973, 301340),
createData(4,'United States', 'US', 327167434, 9833520),
createData(5,'Canada', 'CA', 37602103, 9984670),
createData(6,'Australia', 'AU', 25475400, 7692024),
createData(7,'Germany', 'DE', 83019200, 357578),
createData(8,'Ireland', 'IE', 4857000, 70273),
createData(9,'Mexico', 'MX', 126577691, 1972550),
createData(10,'Japan', 'JP', 126317000, 377973),
createData(11,'France', 'FR', 67022000, 640679),
createData(12,'United Kingdom', 'GB', 67545757, 242495),
createData(13,'Russia', 'RU', 146793744, 17098246),
createData(14,'Nigeria', 'NG', 200962417, 923768),
createData(15,'Brazil', 'BR', 210147125, 8515767),
];
export default function ManageGroups() {
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(10);
const handleChangePage = (event, newPage) => {
setPage(newPage);
};
const handleChangeRowsPerPage = (event) => {
setRowsPerPage(+event.target.value);
setPage(0);
};
return (
<Box sx={{ padding: 3 }}>
<Typography sx={{ color: 'gray', size: 'xl' }}>Manage Group</Typography>
<Box sx={{ padding: 3 }}>
<Box sx={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', pr: 2, }}>
<Button variant="contained" color="primary">Create New Group</Button>
</Box>
<Box sx={{ display: 'flex', justifyContent: 'flex-start', alignItems: 'center', pr: 2, }}>
<TextField id="standard-basic" label="Search" variant="standard" />
<IconButton type="button" sx={{ p: '10px' }} aria-label="search">
<SearchIcon />
</IconButton>
</Box>
<Paper sx={{ width: '100%', overflow: 'hidden' }}>
<TableContainer sx={{ maxHeight: 440 }}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{columns.map((column) => (
<TableCell
key={column.id}
align={column.align}
style={{ minWidth: column.minWidth }}
>
{column.label}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{rows
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((row) => {
return (
<TableRow hover role="checkbox" tabIndex={-1} key={row.id}>
{columns.map((column) => {
const value = row[column.id];
return (
<TableCell key={column.id} align={column.align}>
{
column.id === 'action' ? (
<Button>Details</Button>
) : value
}
</TableCell>
);
})}
</TableRow>
);
})}
</TableBody>
</Table>
</TableContainer>
<TablePagination
rowsPerPageOptions={[10, 25, 100]}
component="div"
count={rows.length}
rowsPerPage={rowsPerPage}
page={page}
onPageChange={handleChangePage}
onRowsPerPageChange={handleChangeRowsPerPage}
/>
</Paper>
</Box>
</Box>
);
}

View File

@ -1,240 +0,0 @@
import * as React from 'react';
import Paper from '@mui/material/Paper';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TablePagination from '@mui/material/TablePagination';
import TableRow from '@mui/material/TableRow';
import { Box, Typography, Button, TextField } from '@mui/material';
import IconButton from '@mui/material/IconButton';
import SearchIcon from '@mui/icons-material/Search';
const columns = [
{ id: 'id', label: 'ID', minWidth: 50 },
{ id: 'username', label: 'Username', minWidth: 100 },
{
id: 'group',
label: 'Group',
minWidth: 100,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'name',
label: 'Name',
minWidth: 170,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'email',
label: 'Email',
minWidth: 170,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'createdDate',
label: 'Created Date',
minWidth: 170,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'action',
label: 'Action',
minWidth: 170,
align: 'right',
format: (value) => value.toFixed(2),
},
];
const rows = {
"recordsFiltered": 35023,
"data": [
{
"createdDate": "2024-12-29 15:56:00",
"groupID": 36871,
"name": "Tomas Pinto Amaral",
"id": 36871,
"msisdn": "67074546696",
"email": "tomasamaral1302@gmail.com",
"username": "67074546696",
"group": "REGULER"
},
{
"createdDate": "2024-12-28 23:15:00",
"groupID": 36870,
"name": "Eleioterio Jeronimo Dos Santos Belmonte",
"id": 36870,
"msisdn": "67074677364",
"email": "Ellebambros6@gmail.con",
"username": "67074677364",
"group": "REGULER"
},
{
"createdDate": "2024-12-28 06:52:00",
"groupID": 36869,
"name": "Joao de Brito ximenes ",
"id": 36869,
"msisdn": "67073650842",
"email": "ximenesjhon42@gmail.com",
"username": "67073650842",
"group": "REGULER"
},
{
"createdDate": "2024-12-28 03:44:00",
"groupID": 36868,
"name": "nelson da costa moniz calau",
"id": 36868,
"msisdn": "67078525938",
"email": "calaunelson842@gmail.com",
"username": "67078525938",
"group": "REGULER"
},
{
"createdDate": "2024-12-27 10:35:00",
"groupID": 36867,
"name": "Arcenia Maria Martins",
"id": 36867,
"msisdn": "67078601536",
"email": "arceniamartins04@gmail.com",
"username": "67078601536",
"group": "REGULER"
},
{
"createdDate": "2024-12-26 22:29:00",
"groupID": 36866,
"name": "Yakov",
"id": 36866,
"msisdn": "79604742286",
"email": "makarevichyakov2004@gmail.com",
"username": "79604742286",
"group": "REGULER"
},
{
"createdDate": "2024-12-23 15:44:00",
"groupID": 36865,
"name": "Juliao Baptista",
"id": 36865,
"msisdn": "67078248108",
"email": "juliao.baptista.1988@gmail.com",
"username": "67078248108",
"group": "REGULER"
},
{
"createdDate": "2024-12-20 15:48:00",
"groupID": 36864,
"name": "Celicia A. Lina da Silva Pereira",
"id": 36864,
"msisdn": "67073565079",
"email": "abulinadasilva@gamail.com",
"username": "67073565079",
"group": "PREMIUM"
},
{
"createdDate": "2024-12-19 23:26:00",
"groupID": 36863,
"name": "Noe Afonso guterres",
"id": 36863,
"msisdn": "67077775543",
"email": "noeguterres9@gmail.com",
"username": "67077775543",
"group": "REGULER"
},
{
"createdDate": "2024-12-19 20:08:00",
"groupID": 36862,
"name": "Leandro Simões De Araújo ",
"id": 36862,
"msisdn": "67073854248",
"email": "leoandroaraujo016@gmail.com",
"username": "67073854248",
"group": "REGULER"
}
],
"recordsTotal": 35023
};
export default function ManageGroups() {
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(10);
const handleChangePage = (event, newPage) => {
setPage(newPage);
};
const handleChangeRowsPerPage = (event) => {
setRowsPerPage(+event.target.value);
setPage(0);
};
return (
<Box sx={{ padding: 3 }}>
<Typography sx={{ color: 'gray', size: 'xl' }}>Manage Member</Typography>
<Box sx={{ padding: 3 }}>
<Box sx={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', pr: 2, }}>
<Button variant="contained" color="primary">Create New Member</Button>
</Box>
<Box sx={{ display: 'flex', justifyContent: 'flex-start', alignItems: 'center', pr: 2, }}>
<TextField id="standard-basic" label="Search" variant="standard" />
<IconButton type="button" sx={{ p: '10px' }} aria-label="search">
<SearchIcon />
</IconButton>
</Box>
<Paper sx={{ width: '100%', overflow: 'hidden' }}>
<TableContainer sx={{ maxHeight: 440 }}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{columns.map((column) => (
<TableCell
key={column.id}
align={column.align}
style={{ minWidth: column.minWidth }}
>
{column.label}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{rows.data
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((row) => {
return (
<TableRow hover role="checkbox" tabIndex={-1} key={row.id}>
{columns.map((column) => {
const value = row[column.id];
return (
<TableCell key={column.id} align={column.align}>
{
column.id === 'action' ? (
<Button>Details</Button>
) : value
}
</TableCell>
);
})}
</TableRow>
);
})}
</TableBody>
</Table>
</TableContainer>
<TablePagination
rowsPerPageOptions={[10, 25, 100]}
component="div"
count={rows.data.length}
rowsPerPage={rowsPerPage}
page={page}
onPageChange={handleChangePage}
onRowsPerPageChange={handleChangeRowsPerPage}
/>
</Paper>
</Box>
</Box>
);
}

View File

@ -1,142 +0,0 @@
import * as React from 'react';
import Paper from '@mui/material/Paper';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TablePagination from '@mui/material/TablePagination';
import TableRow from '@mui/material/TableRow';
import { Box, Typography, Button, TextField } from '@mui/material';
import IconButton from '@mui/material/IconButton';
import SearchIcon from '@mui/icons-material/Search';
const columns = [
{ id: 'id', label: 'ID', minWidth: 50 },
{ id: 'createdDate', label: 'Created Date', minWidth: 100 },
{
id: 'name',
label: 'Name',
minWidth: 100,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'description',
label: 'Description',
minWidth: 170,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'action',
label: 'Action',
minWidth: 170,
align: 'right',
format: (value) => value.toFixed(2),
},
];
function createData(id, name, description, population, size) {
const today = new Date();
return { id, name, description, population, size, createdDate: today.toString()};
}
const rows = [
createData(1,'India', 'IN', 1324171354, 3287263),
createData(2,'China', 'CN', 1403500365, 9596961),
createData(3,'Italy', 'IT', 60483973, 301340),
createData(4,'United States', 'US', 327167434, 9833520),
createData(5,'Canada', 'CA', 37602103, 9984670),
createData(6,'Australia', 'AU', 25475400, 7692024),
createData(7,'Germany', 'DE', 83019200, 357578),
createData(8,'Ireland', 'IE', 4857000, 70273),
createData(9,'Mexico', 'MX', 126577691, 1972550),
createData(10,'Japan', 'JP', 126317000, 377973),
createData(11,'France', 'FR', 67022000, 640679),
createData(12,'United Kingdom', 'GB', 67545757, 242495),
createData(13,'Russia', 'RU', 146793744, 17098246),
createData(14,'Nigeria', 'NG', 200962417, 923768),
createData(15,'Brazil', 'BR', 210147125, 8515767),
];
export default function ManageMenus() {
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(10);
const handleChangePage = (event, newPage) => {
setPage(newPage);
};
const handleChangeRowsPerPage = (event) => {
setRowsPerPage(+event.target.value);
setPage(0);
};
return (
<Box sx={{ padding: 3 }}>
<Typography sx={{ color: 'gray', size: 'xl' }}>Manage Menu</Typography>
<Box sx={{ padding: 3 }}>
<Box sx={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', pr: 2, }}>
<Button variant="contained" color="primary">Create New Member</Button>
</Box>
<Box sx={{ display: 'flex', justifyContent: 'flex-start', alignItems: 'center', pr: 2, }}>
<TextField id="standard-basic" label="Search" variant="standard" />
<IconButton type="button" sx={{ p: '10px' }} aria-label="search">
<SearchIcon />
</IconButton>
</Box>
<Paper sx={{ width: '100%', overflow: 'hidden' }}>
<TableContainer sx={{ maxHeight: 440 }}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{columns.map((column) => (
<TableCell
key={column.id}
align={column.align}
style={{ minWidth: column.minWidth }}
>
{column.label}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{rows
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((row) => {
return (
<TableRow hover role="checkbox" tabIndex={-1} key={row.id}>
{columns.map((column) => {
const value = row[column.id];
return (
<TableCell key={column.id} align={column.align}>
{
column.id === 'action' ? (
<Button>Details</Button>
) : value
}
</TableCell>
);
})}
</TableRow>
);
})}
</TableBody>
</Table>
</TableContainer>
<TablePagination
rowsPerPageOptions={[10, 25, 100]}
component="div"
count={rows.length}
rowsPerPage={rowsPerPage}
page={page}
onPageChange={handleChangePage}
onRowsPerPageChange={handleChangeRowsPerPage}
/>
</Paper>
</Box>
</Box>
);
}

View File

@ -1,141 +0,0 @@
import * as React from 'react';
import Paper from '@mui/material/Paper';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TablePagination from '@mui/material/TablePagination';
import TableRow from '@mui/material/TableRow';
import { Box, Typography, Button, TextField } from '@mui/material';
import IconButton from '@mui/material/IconButton';
import SearchIcon from '@mui/icons-material/Search';
const columns = [
{ id: 'id', label: 'ID', minWidth: 50 },
{
id: 'name',
label: 'Name',
minWidth: 100,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'moduleURL',
label: 'Destination Module',
minWidth: 170,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'action',
label: 'Action',
minWidth: 170,
align: 'right',
format: (value) => value.toFixed(2),
},
];
const rows = {
"recordsFiltered": 2,
"data": [
{
"enabled": false,
"id": 1,
"moduleURL": "https://tpay.tl/middle-tpay/notif/sender",
"name": "notifSender",
"notificationType": null,
"transferTypeID": null
},
{
"enabled": false,
"id": 2,
"moduleURL": "https://tpay.tl/middle-tpay/notif/receiver",
"name": "notifBenefeciary",
"notificationType": null,
"transferTypeID": null
}
],
"recordsTotal": 2
}
export default function ManageGroups() {
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(10);
const handleChangePage = (event, newPage) => {
setPage(newPage);
};
const handleChangeRowsPerPage = (event) => {
setRowsPerPage(+event.target.value);
setPage(0);
};
return (
<Box sx={{ padding: 3 }}>
<Typography sx={{ color: 'gray', size: 'xl' }}>Manage Notification</Typography>
<Box sx={{ padding: 3 }}>
<Box sx={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', pr: 2, }}>
<Button variant="contained" color="primary">Create New Member</Button>
</Box>
<Box sx={{ display: 'flex', justifyContent: 'flex-start', alignItems: 'center', pr: 2, }}>
<TextField id="standard-basic" label="Search" variant="standard" />
<IconButton type="button" sx={{ p: '10px' }} aria-label="search">
<SearchIcon />
</IconButton>
</Box>
<Paper sx={{ width: '100%', overflow: 'hidden' }}>
<TableContainer sx={{ maxHeight: 440 }}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{columns.map((column) => (
<TableCell
key={column.id}
align={column.align}
style={{ minWidth: column.minWidth }}
>
{column.label}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{rows.data
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((row) => {
return (
<TableRow hover role="checkbox" tabIndex={-1} key={row.id}>
{columns.map((column) => {
const value = row[column.id];
return (
<TableCell key={column.id} align={column.align}>
{
column.id === 'action' ? (
<Button>Details</Button>
) : value
}
</TableCell>
);
})}
</TableRow>
);
})}
</TableBody>
</Table>
</TableContainer>
<TablePagination
rowsPerPageOptions={[10, 25, 100]}
component="div"
count={rows.length}
rowsPerPage={rowsPerPage}
page={page}
onPageChange={handleChangePage}
onRowsPerPageChange={handleChangeRowsPerPage}
/>
</Paper>
</Box>
</Box>
);
}

View File

@ -1,257 +0,0 @@
import * as React from 'react';
import Paper from '@mui/material/Paper';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TablePagination from '@mui/material/TablePagination';
import TableRow from '@mui/material/TableRow';
import { Box, Typography, Button, TextField } from '@mui/material';
import IconButton from '@mui/material/IconButton';
import SearchIcon from '@mui/icons-material/Search';
const columns = [
{ id: 'id', label: 'ID', minWidth: 50 },
{
id: 'name',
label: 'Name',
minWidth: 100,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{ id: 'fromAccountName', label: 'From Account', minWidth: 100 },
{ id: 'toAccountName', label: 'To Account', minWidth: 100 },
{
id: 'description',
label: 'Description',
minWidth: 170,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'action',
label: 'Action',
minWidth: 170,
align: 'right',
format: (value) => value.toFixed(2),
},
];
const rows = {
"recordsFiltered": 21,
"data": [
{
"description": "Transaction for Payment Mytelkomcel",
"fromAccountName": "eMoney Account",
"fromAccounts": 1,
"id": 58,
"maxAmount": 0.00,
"maxCount": 0,
"minAmount": 0.01,
"name": "Payment Mytelkomcel",
"otpThreshold": 0.00,
"toAccountName": "Merchant Account",
"toAccounts": 39
},
{
"description": "Disburse transaction EDTL from user to Agent",
"fromAccountName": "Merchant Account",
"fromAccounts": 39,
"id": 57,
"maxAmount": 0.00,
"maxCount": 0,
"minAmount": 0.00,
"name": "Disburse transaction EDTL",
"otpThreshold": 0.00,
"toAccountName": "Merchant Account",
"toAccounts": 39
},
{
"description": "Transaction for payment EDTL",
"fromAccountName": "eMoney Account",
"fromAccounts": 1,
"id": 56,
"maxAmount": 0.00,
"maxCount": 0,
"minAmount": 0.01,
"name": "Sosa Token EDTL",
"otpThreshold": 0.00,
"toAccountName": "Merchant Account",
"toAccounts": 39
},
{
"description": "Disburs myloja to agent",
"fromAccountName": "Merchant Account",
"fromAccounts": 39,
"id": 55,
"maxAmount": 0.00,
"maxCount": 0,
"minAmount": 0.01,
"name": "Disburs myloja to agent",
"otpThreshold": 0.00,
"toAccountName": "Merchant Account",
"toAccounts": 39
},
{
"description": "Purchase Pulsa",
"fromAccountName": "eMoney Account",
"fromAccounts": 1,
"id": 54,
"maxAmount": 0.00,
"maxCount": 0,
"minAmount": 0.00,
"name": "Rekarga Pulsa",
"otpThreshold": 0.00,
"toAccountName": "Merchant Account",
"toAccounts": 39
},
{
"description": "Transaction for payment MyLoja",
"fromAccountName": "eMoney Account",
"fromAccounts": 1,
"id": 53,
"maxAmount": 0.00,
"maxCount": 0,
"minAmount": 0.01,
"name": "Payment MyLoja",
"otpThreshold": 0.00,
"toAccountName": "Merchant Account",
"toAccounts": 39
},
{
"description": "Cashout Member to Bank Account",
"fromAccountName": "eMoney Account",
"fromAccounts": 1,
"id": 52,
"maxAmount": 300.00,
"maxCount": 10,
"minAmount": 1.00,
"name": "Dada Osan P24",
"otpThreshold": 0.00,
"toAccountName": "Cash out/in account to bank",
"toAccounts": 41
},
{
"description": "Topup Member e-money from Bank",
"fromAccountName": "Cash out/in account to bank",
"fromAccounts": 41,
"id": 51,
"maxAmount": 0.00,
"maxCount": 0,
"minAmount": 1.00,
"name": "Top up P24",
"otpThreshold": 0.00,
"toAccountName": "eMoney Account",
"toAccounts": 1
},
{
"description": "Transaction for buying voucher games ",
"fromAccountName": "eMoney Account",
"fromAccounts": 1,
"id": 50,
"maxAmount": 0.00,
"maxCount": 0,
"minAmount": 0.01,
"name": "Payment GamesTL",
"otpThreshold": 0.00,
"toAccountName": "Merchant Account",
"toAccounts": 39
},
{
"description": "Partner disburse to agent or driver account",
"fromAccountName": "Merchant Account",
"fromAccounts": 39,
"id": 49,
"maxAmount": 0.00,
"maxCount": 0,
"minAmount": 0.01,
"name": "Disburse agent or driver",
"otpThreshold": 0.00,
"toAccountName": "Merchant Account",
"toAccounts": 39
}
],
"recordsTotal": 21
};
export default function ManageGroups() {
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(10);
const handleChangePage = (event, newPage) => {
setPage(newPage);
};
const handleChangeRowsPerPage = (event) => {
setRowsPerPage(+event.target.value);
setPage(0);
};
return (
<Box sx={{ padding: 3 }}>
<Typography sx={{ color: 'gray', size: 'xl' }}>Manage Transfer Type</Typography>
<Box sx={{ padding: 3 }}>
<Box sx={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', pr: 2, }}>
<Button variant="contained" color="primary">Create New Member</Button>
</Box>
<Box sx={{ display: 'flex', justifyContent: 'flex-start', alignItems: 'center', pr: 2, }}>
<TextField id="standard-basic" label="Search" variant="standard" />
<IconButton type="button" sx={{ p: '10px' }} aria-label="search">
<SearchIcon />
</IconButton>
</Box>
<Paper sx={{ width: '100%', overflow: 'hidden' }}>
<TableContainer sx={{ maxHeight: 440 }}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{columns.map((column) => (
<TableCell
key={column.id}
align={column.align}
style={{ minWidth: column.minWidth }}
>
{column.label}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{rows.data
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((row) => {
return (
<TableRow hover role="checkbox" tabIndex={-1} key={row.id}>
{columns.map((column) => {
const value = row[column.id];
return (
<TableCell key={column.id} align={column.align}>
{
column.id === 'action' ? (
<Button>Details</Button>
) : value
}
</TableCell>
);
})}
</TableRow>
);
})}
</TableBody>
</Table>
</TableContainer>
<TablePagination
rowsPerPageOptions={[10, 25, 100]}
component="div"
count={rows.data.length}
rowsPerPage={rowsPerPage}
page={page}
onPageChange={handleChangePage}
onRowsPerPageChange={handleChangeRowsPerPage}
/>
</Paper>
</Box>
</Box>
);
}

View File

@ -1,254 +0,0 @@
import * as React from 'react';
import Paper from '@mui/material/Paper';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TablePagination from '@mui/material/TablePagination';
import TableRow from '@mui/material/TableRow';
import { Box, Typography, Button, TextField } from '@mui/material';
import IconButton from '@mui/material/IconButton';
import SearchIcon from '@mui/icons-material/Search';
const columns = [
{ id: 'id', label: 'ID', minWidth: 50 },
{
id: 'name',
label: 'Name',
minWidth: 100,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'username',
label: 'Username',
minWidth: 170,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'active',
label: 'Enabled',
minWidth: 170,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'secureTransaction',
label: 'Secure',
minWidth: 170,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'action',
label: 'Action',
minWidth: 170,
align: 'right',
format: (value) => value.toFixed(2),
},
];
const rows = {
"recordsFiltered": 13,
"data": [
{
"active": true,
"group": null,
"hash": "edtl",
"id": 20,
"name": "dw-tpay-edtl",
"password": "123456",
"permissionID": null,
"secureTransaction": true,
"username": "doku_tpay_edtl"
},
{
"active": true,
"group": null,
"hash": "scheduler",
"id": 19,
"name": "scheduler",
"password": "123456",
"permissionID": null,
"secureTransaction": false,
"username": "scheduler"
},
{
"active": true,
"group": null,
"hash": "YL29DDQ66XZJ67TH",
"id": 18,
"name": "tpay-biller-nontransactional",
"password": "tpay-biller",
"permissionID": null,
"secureTransaction": false,
"username": "tpay-biller-nontransactional"
},
{
"active": true,
"group": null,
"hash": "YL29DDQ66XZJ67TH",
"id": 17,
"name": "tpay-biller",
"password": "tpay-biller",
"permissionID": null,
"secureTransaction": true,
"username": "tpay-biller"
},
{
"active": true,
"group": null,
"hash": "p24",
"id": 16,
"name": "dw-tpay-p24-nontransactional",
"password": "123456",
"permissionID": null,
"secureTransaction": false,
"username": "dokup24tpaynontransactional"
},
{
"active": true,
"group": null,
"hash": "p24",
"id": 15,
"name": "dw-tpay-p24",
"password": "123456",
"permissionID": null,
"secureTransaction": true,
"username": "dokup24tpay"
},
{
"active": true,
"group": null,
"hash": "doku",
"id": 14,
"name": "dw-mobileapi-tpay-non-transactional",
"password": "123456",
"permissionID": null,
"secureTransaction": false,
"username": "doku_dev_non"
},
{
"active": true,
"group": null,
"hash": "dokusimpel",
"id": 13,
"name": "simpel-ads-tpay",
"password": "simpel",
"permissionID": null,
"secureTransaction": false,
"username": "simpel"
},
{
"active": true,
"group": null,
"hash": "doku",
"id": 12,
"name": "dw-mobileapi-tpay",
"password": "123456",
"permissionID": null,
"secureTransaction": true,
"username": "doku_dev"
},
{
"active": true,
"group": null,
"hash": "MW7389B8ikj83990",
"id": 11,
"name": "Middleware Bank",
"password": "123456",
"permissionID": null,
"secureTransaction": false,
"username": "mwbank"
}
],
"recordsTotal": 13
}
export default function ManageWebservice() {
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(10);
const handleChangePage = (event, newPage) => {
setPage(newPage);
};
const handleChangeRowsPerPage = (event) => {
setRowsPerPage(+event.target.value);
setPage(0);
};
function generateData(data, column) {
if (column === 'secureTransaction' || column === 'active') return data ? 'true' : 'false';
return data;
}
return (
<Box sx={{ padding: 3 }}>
<Typography sx={{ color: 'gray', size: 'xl' }}>Manage Webservice</Typography>
<Box sx={{ padding: 3 }}>
<Box sx={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', pr: 2, }}>
<Button variant="contained" color="primary">Create New Member</Button>
</Box>
<Box sx={{ display: 'flex', justifyContent: 'flex-start', alignItems: 'center', pr: 2, }}>
<TextField id="standard-basic" label="Search" variant="standard" />
<IconButton type="button" sx={{ p: '10px' }} aria-label="search">
<SearchIcon />
</IconButton>
</Box>
<Paper sx={{ width: '100%', overflow: 'hidden' }}>
<TableContainer sx={{ maxHeight: 440 }}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{columns.map((column) => (
<TableCell
key={column.id}
align={column.align}
style={{ minWidth: column.minWidth }}
>
{column.label}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{rows.data
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((row) => {
return (
<TableRow hover role="checkbox" tabIndex={-1} key={row.id}>
{columns.map((column) => {
const value = row[column.id];
return (
<TableCell key={column.id} align={column.align}>
{
column.id === 'action' ? (
<Button>Details</Button>
) : generateData(value, column.id)
}
</TableCell>
);
})}
</TableRow>
);
})}
</TableBody>
</Table>
</TableContainer>
<TablePagination
rowsPerPageOptions={[10, 25, 100]}
component="div"
count={rows.length}
rowsPerPage={rowsPerPage}
page={page}
onPageChange={handleChangePage}
onRowsPerPageChange={handleChangeRowsPerPage}
/>
</Paper>
</Box>
</Box>
);
}

View File

@ -1,133 +0,0 @@
import React, { useState } from "react";
import { Grid, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Paper, Box, Typography } from '@mui/material';
import ReusableTable from '../components/Table';
const MasterDataPage = () => {
const tableData1 = [
{ id: 1, name: 'John Doe', age: 25 },
{ id: 2, name: 'Jane Smith', age: 30 },
{ id: 3, name: 'John Doe', age: 25 },
{ id: 4, name: 'Jane Smith', age: 30 },
{ id: 5, name: 'John Doe', age: 25 },
];
const tableData2 = [
{ id: 1, product: 'Laptop', price: '$1000' },
{ id: 2, product: 'Phone', price: '$600' },
];
return (
<Box p={3}>
<Box sx={{ display: 'flex', justifyContent: 'flex-start', pr: 2, }}>
<Typography sx={{ color: 'gray', fontSize: '30px' }}>Master Data</Typography>
</Box>
<Box p={3}>
<Grid container spacing={2}>
{/* First Table */}
{/* <ReusableTable columns={columns} data={users} /> */}
<Grid item xs={6}>
<Typography sx={{ color: 'gray', fontSize: '30px' }}>Kecamatan</Typography>
<TableContainer component={Paper}>
<Table>
<TableHead>
<TableRow>
<TableCell>ID</TableCell>
<TableCell>Name</TableCell>
<TableCell>Age</TableCell>
</TableRow>
</TableHead>
<TableBody>
{tableData1.map((row) => (
<TableRow key={row.id}>
<TableCell>{row.id}</TableCell>
<TableCell>{row.name}</TableCell>
<TableCell>{row.age}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</Grid>
{/* Second Table */}
<Grid item xs={6}>
<Typography sx={{ color: 'gray', fontSize: '30px' }}>Kelurahan</Typography>
<TableContainer component={Paper}>
<Table>
<TableHead>
<TableRow>
<TableCell>ID</TableCell>
<TableCell>Product</TableCell>
<TableCell>Price</TableCell>
</TableRow>
</TableHead>
<TableBody>
{tableData2.map((row) => (
<TableRow key={row.id}>
<TableCell>{row.id}</TableCell>
<TableCell>{row.product}</TableCell>
<TableCell>{row.price}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</Grid>
{/* 3rd Table */}
<Grid item xs={6}>
<Typography sx={{ color: 'gray', fontSize: '30px' }}>Kabupaten</Typography>
<TableContainer component={Paper}>
<Table>
<TableHead>
<TableRow>
<TableCell>ID</TableCell>
<TableCell>Name</TableCell>
<TableCell>Age</TableCell>
</TableRow>
</TableHead>
<TableBody>
{tableData1.map((row) => (
<TableRow key={row.id}>
<TableCell>{row.id}</TableCell>
<TableCell>{row.name}</TableCell>
<TableCell>{row.age}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</Grid>
{/* 4th Table */}
<Grid item xs={6}>
<Typography sx={{ color: 'gray', fontSize: '30px' }}>Kota</Typography>
<TableContainer component={Paper}>
<Table>
<TableHead>
<TableRow>
<TableCell>ID</TableCell>
<TableCell>Product</TableCell>
<TableCell>Price</TableCell>
</TableRow>
</TableHead>
<TableBody>
{tableData2.map((row) => (
<TableRow key={row.id}>
<TableCell>{row.id}</TableCell>
<TableCell>{row.product}</TableCell>
<TableCell>{row.price}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</Grid>
</Grid>
</Box>
</Box>
);
};
export default MasterDataPage;

View File

@ -1,142 +0,0 @@
import * as React from 'react';
import Paper from '@mui/material/Paper';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TablePagination from '@mui/material/TablePagination';
import TableRow from '@mui/material/TableRow';
import { Box, Typography, Button, TextField } from '@mui/material';
import IconButton from '@mui/material/IconButton';
import SearchIcon from '@mui/icons-material/Search';
const columns = [
{ id: 'id', label: 'ID', minWidth: 50 },
{ id: 'createdDate', label: 'Created Date', minWidth: 100 },
{
id: 'name',
label: 'Name',
minWidth: 100,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'description',
label: 'Description',
minWidth: 170,
align: 'right',
format: (value) => value.toLocaleString('en-US'),
},
{
id: 'action',
label: 'Action',
minWidth: 170,
align: 'right',
format: (value) => value.toFixed(2),
},
];
function createData(id, name, description, population, size) {
const today = new Date();
return { id, name, description, population, size, createdDate: today.toString()};
}
const rows = [
createData(1,'India', 'IN', 1324171354, 3287263),
createData(2,'China', 'CN', 1403500365, 9596961),
createData(3,'Italy', 'IT', 60483973, 301340),
createData(4,'United States', 'US', 327167434, 9833520),
createData(5,'Canada', 'CA', 37602103, 9984670),
createData(6,'Australia', 'AU', 25475400, 7692024),
createData(7,'Germany', 'DE', 83019200, 357578),
createData(8,'Ireland', 'IE', 4857000, 70273),
createData(9,'Mexico', 'MX', 126577691, 1972550),
createData(10,'Japan', 'JP', 126317000, 377973),
createData(11,'France', 'FR', 67022000, 640679),
createData(12,'United Kingdom', 'GB', 67545757, 242495),
createData(13,'Russia', 'RU', 146793744, 17098246),
createData(14,'Nigeria', 'NG', 200962417, 923768),
createData(15,'Brazil', 'BR', 210147125, 8515767),
];
export default function MemberKyc() {
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(10);
const handleChangePage = (event, newPage) => {
setPage(newPage);
};
const handleChangeRowsPerPage = (event) => {
setRowsPerPage(+event.target.value);
setPage(0);
};
return (
<Box sx={{ padding: 3 }}>
<Typography sx={{ color: 'gray', size: 'xl' }}>Manage Member KYC</Typography>
<Box sx={{ padding: 3 }}>
<Box sx={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', pr: 2, }}>
<Button variant="contained" color="primary">Create New Member</Button>
</Box>
<Box sx={{ display: 'flex', justifyContent: 'flex-start', alignItems: 'center', pr: 2, }}>
<TextField id="standard-basic" label="Search" variant="standard" />
<IconButton type="button" sx={{ p: '10px' }} aria-label="search">
<SearchIcon />
</IconButton>
</Box>
<Paper sx={{ width: '100%', overflow: 'hidden' }}>
<TableContainer sx={{ maxHeight: 440 }}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{columns.map((column) => (
<TableCell
key={column.id}
align={column.align}
style={{ minWidth: column.minWidth }}
>
{column.label}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{rows
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((row) => {
return (
<TableRow hover role="checkbox" tabIndex={-1} key={row.id}>
{columns.map((column) => {
const value = row[column.id];
return (
<TableCell key={column.id} align={column.align}>
{
column.id === 'action' ? (
<Button>Details</Button>
) : value
}
</TableCell>
);
})}
</TableRow>
);
})}
</TableBody>
</Table>
</TableContainer>
<TablePagination
rowsPerPageOptions={[10, 25, 100]}
component="div"
count={rows.length}
rowsPerPage={rowsPerPage}
page={page}
onPageChange={handleChangePage}
onRowsPerPageChange={handleChangeRowsPerPage}
/>
</Paper>
</Box>
</Box>
);
}

View File

@ -1,290 +0,0 @@
import React, { useState, useEffect } from "react"
import { TextField, Button, Box, Typography, Paper, FormControl, Select, InputLabel, MenuItem, FormControlLabel, Checkbox, FormLabel } from "@mui/material"
import { fetchApi } from "../config/axios"
import WarningDialog from "../components/WarningDialog"
import Cookies from "js-cookie"
const ProfilePage = () => {
// State for form fields
const [formData, setFormData] = useState({
username: "",
name: "",
email: "",
status: "",
idRole: "",
password: "",
oldPassword: "",
confirmPassword: "",
newPassword: "",
// nik: '',
// position: '',
// telp: '',
// address: '',
// organisasi: '',
// devisi: '',
// unit: '',
})
const [roles, setRoles] = useState([])
const [isModalOpen, setIsModalOpen] = useState(false) // ERROR MSG
const [error, setError] = useState("") // ERROR MSG
useEffect(() => {
fetchUser()
fetchUserRoles()
// eslint-disable-next-line
}, [])
async function fetchUser(params) {
try {
let userId = Cookies.get(`userId`)
let token = Cookies.get(`token`)
let fetchUsers = await fetchApi(`d/user/detail/${userId}`, "GET", null, { token: token })
// setFormData({})
console.log(fetchUsers)
setFormData(fetchUsers.data.data)
} catch (error) {
console.log(error)
handleError(`${error.message}. \n ${error.response.data.error}`)
}
}
async function fetchUserRoles(params) {
try {
let userRoles = await fetchApi("d/user_role/list", "GET", null, {
limit: 10,
page: 1,
with_deleted: true,
order_field: "id",
order_direction: "ASC",
})
console.log(userRoles)
if (userRoles.data && userRoles.data.data) setRoles(userRoles.data.data.list)
} catch (error) {
console.log(error)
handleError(`${error.message}. \n ${error.response.data.error}`)
}
}
// Handle form submission
const handleSubmit = (e) => {
e.preventDefault()
// if (name && email) {
// // Handle registration logic, like calling an API to create the user
// console.log("Registered with:", { name, email });
// } else {
// alert("Please fill in all fields.");
// }
}
const handleChange = (e) => {
let { name, value } = e.target
if (name === "status" && value === "Y") value = "N"
else if (name === "status" && value === "N") value = "Y"
setFormData((prev) => ({ ...prev, [name]: value }))
}
const handleError = (msg) => {
// ERROR MSG
setError(msg)
setIsModalOpen(true)
}
const closeModal = () => {
// ERROR MSG
setIsModalOpen(false)
setError("")
}
async function updatePassword() {
try {
let updatePassword = await fetchApi(`d/user/update_password`, "PUT", {
password: formData.password,
retype_password: formData.confirmPassword,
})
console.log(updatePassword)
} catch (error) {
console.log(error)
}
}
return (
<Box sx={{ padding: 3 }}>
<WarningDialog // ERROR MSG
open={isModalOpen}
onClose={closeModal}
errorMessage={error}
/>
<Box sx={{ display: "flex", justifyContent: "flex-start", pr: 2 }}>
<Typography sx={{ color: "gray", fontSize: "30px" }}>User Profile</Typography>
</Box>
<Box sx={{ padding: 3 }}>
<Box sx={{ padding: 3 }}>
<Paper sx={{ width: "100%", overflow: "hidden" }}>
<form onSubmit={handleSubmit}>
<Box mb={2} m={2}>
<TextField label="Username" name="username" variant="outlined" fullWidth value={formData.username} onChange={handleChange} required disabled />
</Box>
<Box mb={2} m={2}>
<TextField label="Name" name="name" variant="outlined" fullWidth value={formData.name} onChange={handleChange} required />
</Box>
<Box mb={2} m={2}>
<TextField label="Email" name="email" variant="outlined" fullWidth value={formData.email} onChange={handleChange} type="email" required />
</Box>
<Box mb={2} m={2} sx={{ display: "flex", justifyContent: "flex-start" }}>
<FormLabel component="legend">
Status :
<FormControlLabel required label="Aktif" control={<Checkbox value={formData.status} name="status" onClick={handleChange} checked={formData.status === "Y" ? true : false} />} />
</FormLabel>
</Box>
{/* <Box mb={2} m={2}>
<TextField
label="NIK"
variant="outlined"
fullWidth
value={formData.nik}
onChange={handleChange}
required
/>
</Box>
<Box mb={2} m={2}>
<TextField
label="Position"
variant="outlined"
fullWidth
value={formData.position}
onChange={handleChange}
required
/>
</Box>
<Box mb={2} m={2}>
<TextField
label="Telp"
variant="outlined"
fullWidth
value={formData.telp}
onChange={handleChange}
required
/>
</Box>
<Box mb={2} m={2}>
<TextField
label="Address"
variant="outlined"
fullWidth
value={formData.address}
onChange={handleChange}
required
/>
</Box>
<Box mb={2} m={2}>
<FormControl fullWidth required>
<InputLabel id="organization-label">Organization</InputLabel>
<Select
labelId="organization-label"
id="organization"
value={formData.organisasi}
label="Organization"
onChange={handleChange}
name='organisasi'
>
<MenuItem value={'Koperasi'}>Koperasi</MenuItem>
<MenuItem value={'Damkar'}>Damkar</MenuItem>
<MenuItem value={'Kemasyarakatan'}>Kemasyarakatan</MenuItem>
</Select>
</FormControl>
</Box>
<Box mb={2} m={2}>
<FormControl fullWidth required>
<InputLabel id="organization-label">Devision</InputLabel>
<Select
labelId="organization-label"
id="organization"
value={formData.devisi}
label="Devision"
onChange={handleChange}
name='devisi'
>
<MenuItem value={`Staff`}>Staff</MenuItem>
<MenuItem value={`Lead`}>Lead</MenuItem>
<MenuItem value={`Manager`}>Manager</MenuItem>
</Select>
</FormControl>
</Box>
<Box mb={2} m={2}>
<FormControl fullWidth required>
<InputLabel id="organization-label">Unit</InputLabel>
<Select
labelId="organization-label"
id="organization"
value={formData.unit}
label="Unit"
onChange={handleChange}
name='unit'
>
<MenuItem value={1}>Satu</MenuItem>
<MenuItem value={2}>Dua</MenuItem>
<MenuItem value={3}>Tiga</MenuItem>
</Select>
</FormControl>
</Box> */}
<Box mb={2} m={2}>
<FormControl fullWidth required>
<InputLabel id="organization-label">Role</InputLabel>
<Select labelId="organization-label" id="organization" value={formData.idRole} label="Role" onChange={handleChange} name="idRole">
{roles.map((el, idx) => (
<MenuItem key={idx} value={el.id}>
{el.name}
</MenuItem>
))}
</Select>
</FormControl>
</Box>
<Box mb={2} m={2}>
<TextField label="Password" name="password" value={formData.password} onChange={handleChange} fullWidth type="password" required disabled />
</Box>
<Box mt={2} mb={2} textAlign="center">
<Button style={{ marginRight: "5px" }} variant="contained">
Cancel
</Button>
<Button variant="contained" color="success">
Submit
</Button>
</Box>
</form>
</Paper>
</Box>
</Box>
<Box sx={{ padding: 3 }}>
<Box sx={{ padding: 3 }}>
<Typography sx={{ color: "gray", fontSize: "30px" }}>User Password</Typography>
<Paper sx={{ width: "100%", overflow: "hidden" }}>
<Box mb={2} m={2}>
<TextField label="Old Password" name="oldPassword" value={formData.oldPassword} onChange={handleChange} fullWidth type="password" required />
</Box>
<Box mb={2} m={2}>
<TextField label="New Password" name="newPassword" value={formData.newPassword} onChange={handleChange} fullWidth type="password" required />
</Box>
<Box mb={2} m={2}>
<TextField label="Confirm Password" name="confirmPassword" value={formData.confirmPassword} onChange={handleChange} fullWidth type="password" required />
</Box>
<Box mt={2} mb={2} textAlign="center">
<Button style={{ marginRight: "5px" }} variant="contained">
Cancel
</Button>
<Button variant="contained" onClick={() => updatePassword} color="success">
Update
</Button>
</Box>
</Paper>
</Box>
</Box>
</Box>
)
}
export default ProfilePage

View File

@ -1,141 +0,0 @@
import React, { useState } from "react";
import {Link} from 'react-router-dom';
import {
TextField,
Button,
Box,
Typography,
Grid,
Paper,
InputAdornment,
IconButton,
FormControl,
InputLabel,
OutlinedInput,
} from "@mui/material";
import Visibility from "@mui/icons-material/Visibility";
import VisibilityOff from "@mui/icons-material/VisibilityOff";
const RegisterPage = () => {
// State for form fields
const [name, setName] = useState("");
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [confirmPassword, setConfirmPassword] = useState("");
const [showPassword, setShowPassword] = useState(false);
// Handle password visibility toggle
const handleClickShowPassword = () => setShowPassword(!showPassword);
// Handle form submission
const handleSubmit = (e) => {
e.preventDefault();
if (password !== confirmPassword) {
alert("Passwords do not match!");
return;
}
if (name && email && password && confirmPassword) {
// Handle registration logic, like calling an API to create the user
console.log("Registered with:", { name, email, password });
} else {
alert("Please fill in all fields.");
}
};
return (
<Grid
container
justifyContent="center"
alignItems="center"
style={{ minHeight: "100vh", backgroundColor: "#f4f6f8" }}
>
<Grid item xs={12} sm={6} md={4}>
<Paper elevation={3} sx={{ padding: 3 }}>
<Typography variant="h5" align="center" gutterBottom>
Create an Account
</Typography>
<form onSubmit={handleSubmit}>
<Box mb={2}>
<TextField
label="Name"
variant="outlined"
fullWidth
value={name}
onChange={(e) => setName(e.target.value)}
required
/>
</Box>
<Box mb={2}>
<TextField
label="Email"
variant="outlined"
fullWidth
value={email}
onChange={(e) => setEmail(e.target.value)}
type="email"
required
/>
</Box>
<Box mb={2}>
<FormControl variant="outlined" fullWidth required>
<InputLabel>Password</InputLabel>
<OutlinedInput
label="Password"
type={showPassword ? "text" : "password"}
value={password}
onChange={(e) => setPassword(e.target.value)}
endAdornment={
<InputAdornment position="end">
<IconButton
onClick={handleClickShowPassword}
edge="end"
>
{showPassword ? <VisibilityOff /> : <Visibility />}
</IconButton>
</InputAdornment>
}
/>
</FormControl>
</Box>
<Box mb={2}>
<FormControl variant="outlined" fullWidth required>
<InputLabel>Confirm Password</InputLabel>
<OutlinedInput
label="Confirm Password"
type={showPassword ? "text" : "password"}
value={confirmPassword}
onChange={(e) => setConfirmPassword(e.target.value)}
endAdornment={
<InputAdornment position="end">
<IconButton
onClick={handleClickShowPassword}
edge="end"
>
{showPassword ? <VisibilityOff /> : <Visibility />}
</IconButton>
</InputAdornment>
}
/>
</FormControl>
</Box>
<Box mt={2} textAlign="center">
<Button>
<Link to="/login">Login</Link>
</Button>
<Button
variant="contained"
color="primary"
type="submit"
fullWidth
>
Register
</Button>
</Box>
</form>
</Paper>
</Grid>
</Grid>
);
};
export default RegisterPage;

View File

@ -1,218 +0,0 @@
import React, { useState, useEffect } from "react"
import { Container, Typography, Button, Dialog, DialogTitle, DialogContent, DialogActions, TextField, IconButton, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Checkbox, Paper, Box } from "@mui/material"
import AddIcon from "@mui/icons-material/Add"
import { fetchApi } from "../config/axios"
// Initial list of roles and menus
// const initialRoles = ['Admin', 'Escrow', 'Agent'];
// const menus = [
// 'Dashboard',
// 'Users',
// 'Reports',
// 'Settings',
// 'Notifications',
// 'Profile',
// 'Help',
// 'Logs',
// 'Analytics',
// 'Billing',
// ];
const RoleMenuTable = () => {
const [roles, setRoles] = useState([])
// const [roleMenus, setRoleMenus] = useState([]);
const [menus, setMenus] = useState([])
const [openDialog, setOpenDialog] = useState(false)
const [newRole, setNewRole] = useState("")
const [confirmDialog, setConfirmDialog] = useState({
open: false,
roleName: "",
menuData: [],
roleId: "",
menuId: "",
status: null,
menuName: "",
})
useEffect(() => {
fetchData()
// eslint-disable-next-line
}, [])
async function fetchData(params) {
try {
let userRole = await fetchApi("d/user_role/list", "GET", null, {
limit: 5,
page: 1,
with_deleted: true,
order_field: "id",
order_direction: "ASC",
})
let userMenu = await fetchApi("d/menus/list", "GET", null, {
limit: 50,
page: 1,
with_deleted: true,
order_field: "id",
order_direction: "ASC",
})
setMenus(userMenu.data.data.list)
console.log("role", userRole)
console.log("menu", userMenu)
if (userRole.data && userRole.data.data) setRoles(userRole.data.data.list)
} catch (error) {
console.log(error)
}
}
const handleCheckboxChange = (roleName, menuData, roleId, menuId, status, menuName) => {
setConfirmDialog({ open: true, roleName, menuData, roleId, menuId, status, menuName })
}
const handleConfirm = async (confirm) => {
const { roleName, menuData, roleId, menuId, status } = confirmDialog
try {
if (confirm) {
console.log(confirm, confirmDialog)
if (status) {
let generateRoles = menuData.filter((el) => +el !== +menuId)
console.log(generateRoles)
let userMenu = await fetchApi(`d/user_role/update/${roleId}`, "PUT", {
name: roleName,
roles: generateRoles,
status: "Y",
})
console.log(userMenu)
await fetchData()
} else {
let generateRoles = menuData.filter((el) => +el !== +menuId)
generateRoles.push(`${menuId}`)
console.log(generateRoles)
let userMenu = await fetchApi(`d/user_role/update/${roleId}`, "PUT", {
name: roleName,
roles: generateRoles,
status: "Y",
})
console.log(userMenu)
await fetchData()
}
}
setConfirmDialog({ open: false, role: "", menu: "" })
} catch (error) {
console.log(error)
}
}
const handleAddRole = async () => {
try {
await fetchApi("d/user_role/create", "POST", {
name: newRole,
roles: [],
status: "Y",
})
await fetchData()
} catch (error) {
console.log(error)
}
setNewRole("")
setOpenDialog(false)
}
const deleteRole = async (role) => {
try {
let resDeleteRole = await fetchApi(`d/user_role/delete/${role.id}/true`, "DELETE")
console.log(resDeleteRole)
await fetchData()
} catch (error) {
console.log(error)
}
}
return (
<Container>
<Typography variant="h4" align="center" gutterBottom marginTop={5}>
Role Menu Management
</Typography>
<IconButton style={{ position: "absolute", top: 16, right: 16 }} color="primary" onClick={() => setOpenDialog(true)}>
<AddIcon />
</IconButton>
<Box sx={{ display: "flex", justifyContent: "flex-end", alignItems: "center", pr: 2 }}>
<Button variant="contained" color="primary" onClick={() => setOpenDialog(true)}>
Create Role
</Button>
</Box>
{/* Table for roles and menus */}
<TableContainer component={Paper} style={{ marginTop: "20px" }}>
<Table>
<TableHead>
<TableRow>
<TableCell>
<strong>Role</strong>
</TableCell>
{menus.map((menu, idx) => (
<TableCell key={idx} align="center">
<strong>{menu.name}</strong>
</TableCell>
))}
<TableCell>
<strong>Action</strong>
</TableCell>
</TableRow>
</TableHead>
<TableBody>
{roles.map((role) => (
<TableRow key={role.id}>
<TableCell>{role.name}</TableCell>
{menus.map((menu, idx) => (
<TableCell key={idx} align="center">
<Checkbox checked={role.roles.find((el) => +el === menu.id) ? true : false} onChange={() => handleCheckboxChange(role.name, role.roles, role.id, menu.id, role.roles.find((el) => +el === menu.id) ? true : false, menu.name)} />
</TableCell>
))}
<TableCell align="center">
<Button onClick={() => deleteRole(role)}>Delete</Button>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
{/* Dialog for adding new role */}
<Dialog open={openDialog} onClose={() => setOpenDialog(false)}>
<DialogTitle>Add New Role</DialogTitle>
<DialogContent>
<TextField autoFocus margin="dense" label="Role Name" type="text" fullWidth value={newRole} onChange={(e) => setNewRole(e.target.value)} />
</DialogContent>
<DialogActions>
<Button onClick={() => setOpenDialog(false)} color="secondary">
Cancel
</Button>
<Button onClick={handleAddRole} color="primary">
Add
</Button>
</DialogActions>
</Dialog>
{/* Confirmation Dialog for checkbox */}
<Dialog open={confirmDialog.open} onClose={() => handleConfirm(false)}>
<DialogTitle>Confirm Menu Selection</DialogTitle>
<DialogContent>
Are you sure you want to <strong>{confirmDialog.status ? "remove " : "add "}</strong>
the menu <strong>{confirmDialog.menuName}</strong> for role <strong>{confirmDialog.roleName}</strong>?
</DialogContent>
<DialogActions>
<Button onClick={() => handleConfirm(false)} color="secondary">
Cancel
</Button>
<Button onClick={() => handleConfirm(true)} color="primary">
Confirm
</Button>
</DialogActions>
</Dialog>
</Container>
)
}
export default RoleMenuTable

View File

@ -1,81 +0,0 @@
import React, { useState } from "react";
import {
TextField,
Button,
Box,
Typography,
Paper,
} from "@mui/material";
const SettingPage = () => {
// State for form fields
const [name, setName] = useState("");
const [email, setEmail] = useState("");
// Handle form submission
const handleSubmit = (e) => {
e.preventDefault();
if (name && email) {
// Handle registration logic, like calling an API to create the user
console.log("Registered with:", { name, email });
} else {
alert("Please fill in all fields.");
}
};
return (
<Box sx={{ padding: 3 }}>
<Box sx={{ display: 'flex', justifyContent: 'flex-start', pr: 2, }}>
<Typography sx={{ color: 'gray', fontSize: '30px' }}>Setting</Typography>
</Box>
<Typography sx={{ color: 'gray', size: 'xl' }}>Manage Webservice</Typography>
<Box sx={{ padding: 3 }}>
<Box sx={{ padding: 3 }}>
<Paper sx={{ width: '100%', overflow: 'hidden' }}>
<form onSubmit={handleSubmit}>
<Box mb={2} m={2}>
<TextField
label="Username"
variant="outlined"
fullWidth
value={name}
onChange={(e) => setName(e.target.value)}
required
/>
</Box>
<Box mb={2} m={2}>
<TextField
label="Name"
variant="outlined"
fullWidth
value={name}
onChange={(e) => setName(e.target.value)}
required
/>
</Box>
<Box mb={2} m={2}>
<TextField
label="Email"
variant="outlined"
fullWidth
value={email}
onChange={(e) => setEmail(e.target.value)}
type="email"
required
/>
</Box>
<Box mt={2} mb={2} textAlign="center">
<Button style={{ marginRight: '5px'}} variant="contained">Edit</Button>
<Button variant="contained" color="success">Submit</Button>
</Box>
</form>
</Paper>
</Box>
</Box>
</Box>
);
};
export default SettingPage;

View File

@ -1,372 +0,0 @@
// Import React and Material-UI components
import React, { useState, useEffect } from "react"
import { Paper, Button, Dialog, DialogActions, DialogContent, DialogTitle, TableContainer, FormLabel, Checkbox, FormControlLabel, Box, Typography, TextField, Grid, MenuItem, InputLabel, Select, FormControl } from "@mui/material"
import ReusableTable from "../components/Table"
import { fetchApi } from "../config/axios"
import WarningDialog from "../components/WarningDialog" // ERROR MSG
const columns = [
{ id: "username", label: "Username" },
{ id: "name", label: "Name" },
{ id: "email", label: "Email" },
{ id: "role_name", label: "Roles" },
{ id: "status", label: "Status" },
{ id: "created_at", label: "Created" },
{ id: "actions", label: "Actions" },
]
const initiateForm = {
username: "",
name: "",
email: "",
status: "",
id_role: "",
password: "",
confirmPassword: "",
// nik: '',
// position: '',
// telp: '',
// address: '',
// organisasi: '',
// devisi: '',
// unit: '',
}
export default function UserManagement() {
const [users, setUsers] = useState([])
const [open, setOpen] = useState(false)
const [selectedUser, setSelectedUser] = useState(null)
const [selectedRoles, setSelectedRoles] = useState([])
const [roles, setRoles] = useState([])
const [openDialog, setOpenDialog] = useState(false)
const [labelDialog, setLabelDialog] = useState("")
const [formData, setFormData] = useState(initiateForm)
const [errors, setErrors] = useState({ passwordMatch: false })
const [isModalOpen, setIsModalOpen] = useState(false) // ERROR MSG
const [error, setError] = useState("") // ERROR MSG
useEffect(() => {
fetchUserRoles()
fetchUser()
// eslint-disable-next-line
}, [])
async function fetchUser(params) {
try {
let fetchUsers = await fetchApi("d/user/list", "GET", null, {
limit: 5,
page: 1,
with_deleted: true,
order_field: "id",
order_direction: "ASC",
})
console.log(fetchUsers)
if (fetchUsers.data && fetchUsers.data.data) {
let resFetchUsers = fetchUsers.data.data.list
let temp = resFetchUsers.map((el) => {
if (el.status === "Y") el.status = "Aktif"
else el.status = "Tidak Aktif"
el.actions = [
{ label: "Edit", color: "info", onClick: (row) => handleOpen(row) },
{ label: "Delete", color: "secondary", onClick: (row) => handleDelete(row) },
]
return el
})
setUsers(temp)
}
} catch (error) {
console.log(error)
handleError(`${error.message}. \n ${error.response.data.error}`)
}
}
async function fetchUserRoles(params) {
try {
let userRoles = await fetchApi("d/user_role/list", "GET", null, {
limit: 5,
page: 1,
with_deleted: true,
order_field: "id",
order_direction: "ASC",
})
if (userRoles.data && userRoles.data.data) setRoles(userRoles.data.data.list)
} catch (error) {
console.log(error)
handleError(`${error.message}. \n ${error.response.data.error}`)
}
}
const handleOpen = (user) => {
setLabelDialog(`Edit User`)
setFormData(user)
setOpenDialog(true)
// setSelectedUser(user);
// setSelectedRoles(user.role_name);
// setOpen(true);
}
const handleClose = () => {
setOpen(false)
setSelectedUser(null)
setSelectedRoles([])
}
const handleRoleChange = (role) => {
setSelectedRoles((prevRoles) => (prevRoles.includes(role) ? prevRoles.filter((r) => r !== role) : [...prevRoles, role]))
}
const handleDelete = (row) => {
const newData = users.filter((item) => item.id !== row.id)
setUsers(newData)
alert(`Deleted ${row.name}`)
}
const handleSave = () => {
setUsers((prevUsers) => prevUsers.map((user) => (user.id === selectedUser.id ? { ...user, roles: selectedRoles } : user)))
handleClose()
}
const handleChange = (e) => {
const { name, value } = e.target
setFormData((prev) => ({ ...prev, [name]: value }))
if (name === "confirmPassword" || name === "password") {
setErrors((prev) => ({
...prev,
passwordMatch: name === "confirmPassword" ? value !== formData.password : formData.confirmPassword !== value,
}))
}
}
const handleSubmit = async () => {
try {
if (!errors.passwordMatch) {
console.log("Form Data:", formData)
// setOpen(false);
// setFormData(initiateForm);
}
console.log(formData)
formData.status = "Y"
if (labelDialog === `Create User`) {
delete formData.confirmPassword
let createUser = await fetchApi("d/user/create", "POST", formData)
console.log(createUser)
} else if (labelDialog === `Edit User`) {
delete formData.created_at
delete formData.updated_at
delete formData.role_name
delete formData.actions
delete formData.confirmPassword
console.log(formData)
let editUser = await fetchApi(`d/user/update/${formData.id}`, "PUT", formData)
console.log("editUser", editUser)
}
await fetchUser()
setOpenDialog(false)
} catch (error) {
console.log(error)
handleError(`${error.message}. \n ${error.response.data.error}`)
}
}
const createNewUserBtn = () => {
setLabelDialog(`Create User`)
setFormData(initiateForm)
setOpenDialog(true)
}
const handleError = (msg) => {
// ERROR MSG
setError(msg)
setIsModalOpen(true)
}
const closeModal = () => {
// ERROR MSG
setIsModalOpen(false)
setError("")
}
return (
<Box sx={{ padding: 3 }}>
<WarningDialog // ERROR MSG
open={isModalOpen}
onClose={closeModal}
errorMessage={error}
/>
<Box sx={{ display: "flex", justifyContent: "flex-start", pr: 2 }}>
<Typography sx={{ color: "gray", fontSize: "30px" }}>User Management</Typography>
</Box>
<Box p={3}>
<Box sx={{ display: "flex", justifyContent: "flex-end", alignItems: "center", pr: 2 }}>
<Button variant="contained" color="primary" onClick={() => createNewUserBtn()}>
Create New User
</Button>
</Box>
<TableContainer component={Paper} sx={{ marginTop: 3 }}>
<ReusableTable columns={columns} data={users} />
<Dialog open={open} onClose={handleClose}>
<DialogTitle>Add Roles to {selectedUser?.name}</DialogTitle>
<DialogContent>
{roles.map((role) => (
<FormControlLabel key={role.id} control={<Checkbox checked={selectedRoles.includes(role.name)} onChange={() => handleRoleChange(role.name)} />} label={role.name} />
))}
</DialogContent>
<DialogActions>
<Button onClick={handleClose} color="secondary">
Cancel
</Button>
<Button onClick={handleSave} color="primary" variant="contained">
Save
</Button>
</DialogActions>
</Dialog>
</TableContainer>
<Dialog open={openDialog} onClose={() => setOpenDialog(false)} maxWidth="sm" fullWidth>
<DialogTitle>{labelDialog}</DialogTitle>
<DialogContent sx={{ marginTop: 2 }}>
<Grid container spacing={2}>
<Grid item xs={12}>
<TextField sx={{ marginTop: 2 }} label="Username" name="username" value={formData.username} onChange={handleChange} fullWidth required />
</Grid>
<Grid item xs={12}>
<TextField sx={{ marginTop: 2 }} label="Name" name="name" value={formData.name} onChange={handleChange} fullWidth required />
</Grid>
<Grid item xs={12}>
<TextField label="Email" name="email" value={formData.email} onChange={handleChange} fullWidth type="email" required />
</Grid>
<Grid item xs={12}>
<FormLabel component="legend">Status</FormLabel>
<FormControlLabel control={<Checkbox name="status" defaultChecked onChange={handleChange} value={formData.status === "Y" ? true : false} />} label="Aktif" />
</Grid>
{/* <Grid item xs={12}>
<TextField
sx={{ marginTop: 2 }}
label="Nik"
name="nik"
value={formData.nik}
onChange={handleChange}
fullWidth
required
/>
</Grid>
<Grid item xs={12}>
<TextField
sx={{ marginTop: 2 }}
label="Position"
name="position"
value={formData.position}
onChange={handleChange}
fullWidth
required
/>
</Grid>
<Grid item xs={12}>
<TextField
label="Telephone"
name="telp"
value={formData.telp}
onChange={handleChange}
fullWidth
type="tel"
required
/>
</Grid>
<Grid item xs={12}>
<TextField
label="Address"
name="address"
value={formData.address}
onChange={handleChange}
fullWidth
multiline
rows={3}
required
/>
</Grid>
<Grid item xs={12}>
<FormControl fullWidth required>
<InputLabel id="organization-label">Organization</InputLabel>
<Select
labelId="organization-label"
id="organization"
value={formData.organisasi}
label="Organization"
onChange={handleChange}
name='organisasi'
>
<MenuItem value={'Koperasi'}>Koperasi</MenuItem>
<MenuItem value={'Damkar'}>Damkar</MenuItem>
<MenuItem value={'Kemasyarakatan'}>Kemasyarakatan</MenuItem>
</Select>
</FormControl>
</Grid>
<Grid item xs={12}>
<FormControl fullWidth required>
<InputLabel id="organization-label">Devision</InputLabel>
<Select
labelId="organization-label"
id="organization"
value={formData.devisi}
label="Devision"
onChange={handleChange}
name='devisi'
>
<MenuItem value={`Staff`}>Staff</MenuItem>
<MenuItem value={`Lead`}>Lead</MenuItem>
<MenuItem value={`Manager`}>Manager</MenuItem>
</Select>
</FormControl>
</Grid>
<Grid item xs={12}>
<FormControl fullWidth required>
<InputLabel id="organization-label">Unit</InputLabel>
<Select
labelId="organization-label"
id="organization"
value={formData.unit}
label="Unit"
onChange={handleChange}
name='unit'
>
<MenuItem value={1}>Satu</MenuItem>
<MenuItem value={2}>Dua</MenuItem>
<MenuItem value={3}>Tiga</MenuItem>
</Select>
</FormControl>
</Grid> */}
<Grid item xs={12}>
<FormControl fullWidth required>
<InputLabel id="organization-label">Role</InputLabel>
<Select labelId="organization-label" id="organization" value={formData.id_role} label="Role" onChange={handleChange} name="id_role">
{roles.map((el, idx) => (
<MenuItem key={idx} value={el.id}>
{el.name}
</MenuItem>
))}
</Select>
</FormControl>
</Grid>
<Grid item xs={12}>
<TextField label="Password" name="password" value={formData.password} onChange={handleChange} fullWidth type="password" required />
</Grid>
<Grid item xs={12}>
<TextField label="Confirm Password" name="confirmPassword" value={formData.confirmPassword} onChange={handleChange} fullWidth type="password" error={errors.passwordMatch} helperText={errors.passwordMatch ? "Passwords do not match" : ""} required />
</Grid>
</Grid>
</DialogContent>
<DialogActions>
<Button onClick={() => setOpenDialog(false)} color="secondary">
Cancel
</Button>
<Button onClick={handleSubmit} color="primary" disabled={!formData.name || !formData.email || !formData.password || errors.passwordMatch || !formData.id_role || !formData.status || !formData.username}>
Submit
</Button>
</DialogActions>
</Dialog>
</Box>
</Box>
)
}