Fix Build

This commit is contained in:
2022-05-26 12:50:15 +07:00
parent 12c298b9a0
commit 720eff969d
9 changed files with 509 additions and 57 deletions

View File

@@ -0,0 +1,3 @@
GENERATE_SOURCEMAP=false
VITE_API_URL="http://aso-api.local/api"

View File

@@ -8,7 +8,7 @@
"lint": "eslint --ext .ts,.tsx ./src",
"lint:fix": "eslint --fix --ext .ts,.tsx ./src",
"start": "vite",
"build": "vite build && cp .htaccess build/.htaccess && cp -r build ../../public/client-portal",
"build": "vite build --mode production && cp .htaccess build/.htaccess && rm -f -r ../../public/client-portal && cp -r build ../../public/client-portal",
"serve": "vite preview",
"clear-all": "rm -rf build node_modules",
"re-start": "rm -rf build node_modules && yarn install && yarn start",
@@ -44,6 +44,7 @@
"@iconify/react": "^3.2.1",
"@mui/lab": "5.0.0-alpha.80",
"@mui/material": "^5.6.4",
"@mui/icons-material": "^5.8.0",
"@mui/system": "^5.6.4",
"@mui/x-data-grid": "^5.10.0",
"@vitejs/plugin-react": "^1.3.2",

View File

@@ -10,6 +10,7 @@ specifiers:
'@emotion/styled': ^11.8.1
'@hookform/resolvers': ^2.8.8
'@iconify/react': ^3.2.1
'@mui/icons-material': ^5.8.0
'@mui/lab': 5.0.0-alpha.80
'@mui/material': ^5.6.4
'@mui/system': ^5.6.4
@@ -71,6 +72,7 @@ dependencies:
'@emotion/styled': 11.8.1_3mkbovqfrbpc53bljqhapolzfu
'@hookform/resolvers': 2.8.10_react-hook-form@7.31.2
'@iconify/react': 3.2.1
'@mui/icons-material': 5.8.0_thescs6epir3llb7jldxow7if4
'@mui/lab': 5.0.0-alpha.80_xcunwhadao43cv4uyunwgxd52a
'@mui/material': 5.8.0_zdaquy43folvhsznh4trclztdq
'@mui/system': 5.8.0_wwmr3izetkfahorjeqrfwx2m5i
@@ -1782,6 +1784,23 @@ packages:
react-is: 17.0.2
dev: false
/@mui/icons-material/5.8.0_thescs6epir3llb7jldxow7if4:
resolution: {integrity: sha512-ScwLxa0q5VYV70Jfc60V/9VD0b9SvIeZ0Jddx2Dt2pBUFFO9vKdrbt9LYiT+4p21Au5NdYIb2XSHj46CLN1v3g==}
engines: {node: '>=12.0.0'}
peerDependencies:
'@mui/material': ^5.0.0
'@types/react': ^17.0.0 || ^18.0.0
react: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@types/react':
optional: true
dependencies:
'@babel/runtime': 7.18.0
'@mui/material': 5.8.0_zdaquy43folvhsznh4trclztdq
'@types/react': 17.0.45
react: 17.0.2
dev: false
/@mui/lab/5.0.0-alpha.80_xcunwhadao43cv4uyunwgxd52a:
resolution: {integrity: sha512-td5Ak0Hx+EzVN9MJqBlZJ6BKFGjTrHyNjXncjSHTvp8Z9p157AlOA/Sf7r+RyqyVzOzBfv4S37i9ShFTzSK61Q==}
engines: {node: '>=12.0.0'}

View File

@@ -18,25 +18,31 @@ const navConfig = [
// GENERAL
// ----------------------------------------------------------------------
{
subheader: 'general v3.2.0',
items: [
{ title: 'Dashboard', path: '/dashboard', icon: ICONS.dashboard },
],
},
// MANAGEMENT
// Membership
// ----------------------------------------------------------------------
{
subheader: 'Management',
subheader: 'Membership',
items: [
{
title: 'Master Data',
// path: '/',
title: 'Member List',
path: '/members',
icon: ICONS.user,
children: [
{ title: 'Obat', path: '/medicines' },
],
},
// {
// title: 'Member Movement',
// // path: '/',
// icon: ICONS.user,
// children: [
// { title: '', path: '/medicines' },
// { title: 'Obat', path: '/medicines' },
// { title: 'Obat', path: '/medicines' },
// ],
// },
],
},
];

View File

@@ -1,34 +0,0 @@
// @mui
import { Button, Container, Typography } from '@mui/material';
// hooks
import useSettings from '../../hooks/useSettings';
// components
import Page from '../../components/Page';
import axios from '../../utils/axios';
import useAuth from '../../hooks/useAuth';
import { Link } from 'react-router-dom';
// ----------------------------------------------------------------------
export default function PageOne() {
const { themeStretch } = useSettings();
const { logout } = useAuth();
const loadSomething = () => {
console.log('Loading Something')
}
return (
<Page title="Obat">
<Container maxWidth={themeStretch ? false : 'xl'}>
<Typography variant="h3" component="h1" paragraph>
Daftar Obat
</Typography>
<Typography>askdnkasndka jsndkajsndkajsdnkajsndk jansdkasjdnkjansd</Typography>
<Button onClick={loadSomething}>Something</Button>
<Link to='/medicines/create'>asdasdasd</Link>
</Container>
</Page>
);
}

View File

@@ -0,0 +1,159 @@
// @mui
import { Box, Button, Collapse, Container, IconButton, Paper, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Typography } from '@mui/material';
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
// hooks
import useSettings from '../../hooks/useSettings';
// components
import Page from '../../components/Page';
import axios from '../../utils/axios';
import useAuth from '../../hooks/useAuth';
import { Link } from 'react-router-dom';
import React from 'react';
export default function Members() {
const { themeStretch } = useSettings();
const { logout } = useAuth();
const loadSomething = () => {
console.log('Loading Something')
}
function createData(
name: string,
calories: number,
fat: number,
carbs: number,
protein: number,
price: number,
) {
return {
name,
calories,
fat,
carbs,
protein,
price,
history: [
{
date: '2020-01-05',
customerId: '11091700',
amount: 3,
},
{
date: '2020-01-02',
customerId: 'Anonymous',
amount: 1,
},
],
};
}
function Row(props: { row: ReturnType<typeof createData> }) {
const { row } = props;
const [open, setOpen] = React.useState(false);
return (
<React.Fragment>
<TableRow sx={{ '& > *': { borderBottom: 'unset' } }}>
<TableCell>
<IconButton
aria-label="expand row"
size="small"
onClick={() => setOpen(!open)}
>
{open ? <KeyboardArrowDownIcon /> : <KeyboardArrowRightIcon />}
</IconButton>
</TableCell>
<TableCell component="th" scope="row">
{row.name}
</TableCell>
<TableCell align="right">{row.calories}</TableCell>
<TableCell align="right">{row.fat}</TableCell>
<TableCell align="right">{row.carbs}</TableCell>
<TableCell align="right">{row.protein}</TableCell>
</TableRow>
<TableRow>
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={6}>
<Collapse in={open} timeout="auto" unmountOnExit>
<Box sx={{ margin: 1 }}>
<Typography variant="h6" gutterBottom component="div">
History
</Typography>
<Table size="small" aria-label="purchases">
<TableHead>
<TableRow>
<TableCell>Date</TableCell>
<TableCell>Customer</TableCell>
<TableCell align="right">Amount</TableCell>
<TableCell align="right">Total price ($)</TableCell>
</TableRow>
</TableHead>
<TableBody>
{row.history.map((historyRow) => (
<TableRow key={historyRow.date}>
<TableCell component="th" scope="row">
{historyRow.date}
</TableCell>
<TableCell>{historyRow.customerId}</TableCell>
<TableCell align="right">{historyRow.amount}</TableCell>
<TableCell align="right">
{Math.round(historyRow.amount * row.price * 100) / 100}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</Box>
</Collapse>
</TableCell>
</TableRow>
</React.Fragment>
);
}
// Dummy Default Data
const rows = [
createData('Frozen yoghurt', 159, 6.0, 24, 4.0, 3.99),
createData('Ice cream sandwich', 237, 9.0, 37, 4.3, 4.99),
createData('Eclair', 262, 16.0, 24, 6.0, 3.79),
createData('Cupcake', 305, 3.7, 67, 4.3, 2.5),
createData('Gingerbread', 356, 16.0, 49, 3.9, 1.5),
];
return (
<Page title="Member List">
<Container maxWidth={themeStretch ? false : 'xl'}>
<Typography variant="h3" component="h1" paragraph>
Member List
</Typography>
<Typography variant="body1" component="p" paragraph>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quaerat, delectus? Suscipit placeat tempora mollitia optio, assumenda maiores architecto officia itaque molestias cum id eligendi necessitatibus! A velit eos ratione ullam.
</Typography>
<TableContainer component={Paper}>
<Table aria-label="collapsible table">
<TableHead>
<TableRow>
<TableCell />
<TableCell>Dessert (100g serving)</TableCell>
<TableCell align="right">Calories</TableCell>
<TableCell align="right">Fat&nbsp;(g)</TableCell>
<TableCell align="right">Carbs&nbsp;(g)</TableCell>
<TableCell align="right">Protein&nbsp;(g)</TableCell>
</TableRow>
</TableHead>
<TableBody>
{rows.map((row, index) => (
<Row key={index} row={row} />
))}
</TableBody>
</Table>
</TableContainer>
</Container>
</Page>
);
}

View File

@@ -70,18 +70,15 @@ export default function Router() {
</AuthGuard>
</AuthProvider>),
children:[
{ element: <Navigate to="/dashboard" replace />, index: true },
{
path: 'dashboard',
element: <Dashboard />,
},
// {
// path: 'medicines',
// element: <AuthProvider><Medicines /></AuthProvider>,
// },
// {
// path: 'medicines/create',
// element: <AuthProvider><MedicinesCreate /></AuthProvider>
// },
{
path: 'members',
element: <Members />,
},
]
},
// {
@@ -123,6 +120,6 @@ const Login = Loadable(lazy(() => import('../pages/auth/Login')));
const Dashboard = Loadable(lazy(() => import('../pages/Dashboard')));
const NotFound = Loadable(lazy(() => import('../pages/Page404')));
// Medicines
const Medicines = Loadable(lazy(() => import('../pages/Medicines/Index')));
// Members
const Members = Loadable(lazy(() => import('../pages/Members/Index')));
const MedicinesCreate = Loadable(lazy(() => import('../pages/Medicines/Create')));