+ {/*
Hi, Rayan Moran
@@ -23,7 +23,7 @@ export default function NavbarDocs() {
-
+
*/}
);
}
diff --git a/frontend/dashboard/src/layouts/dashboard/navbar/NavbarVertical.tsx b/frontend/dashboard/src/layouts/dashboard/navbar/NavbarVertical.tsx
index 268d8117..a356edf3 100644
--- a/frontend/dashboard/src/layouts/dashboard/navbar/NavbarVertical.tsx
+++ b/frontend/dashboard/src/layouts/dashboard/navbar/NavbarVertical.tsx
@@ -2,7 +2,7 @@ import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';
// @mui
import { styled, useTheme } from '@mui/material/styles';
-import { Box, Stack, Drawer } from '@mui/material';
+import { Box, Stack, Drawer, Typography } from '@mui/material';
// hooks
import useResponsive from '../../../hooks/useResponsive';
import useCollapseDrawer from '../../../hooks/useCollapseDrawer';
@@ -72,13 +72,19 @@ export default function NavbarVertical({ isOpenSidebar, onCloseSidebar }: Props)
...(isCollapse && { alignItems: 'center' }),
}}
>
-
-
-
- {isDesktop && !isCollapse && (
+ {isDesktop && !isCollapse ? (
+
+
+
+ PRIME CENTER
+
- )}
-
+ )
+ : (
+
+
+
+ )}
diff --git a/frontend/dashboard/src/pages/Dashboard.tsx b/frontend/dashboard/src/pages/Dashboard.tsx
index 6fb8397f..96a89fb0 100644
--- a/frontend/dashboard/src/pages/Dashboard.tsx
+++ b/frontend/dashboard/src/pages/Dashboard.tsx
@@ -1,11 +1,13 @@
// @mui
-import { Button, Container, Typography } from '@mui/material';
+import { Button, Container, Grid, styled, Typography, Card, Stack } 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 SomethingUsage from '../sections/dashboard/SomethingUsage';
+import { fCurrency } from '../utils/formatNumber';
// ----------------------------------------------------------------------
@@ -18,30 +20,47 @@ export default function Dashboard() {
axios.get('/user')
};
+ const DangerCard = styled(Card)(({ theme }) => ({
+ boxShadow: 'none',
+ padding: theme.spacing(3),
+ color: theme.palette.error.main,
+ backgroundColor: theme.palette.error.lighter,
+ }));
+
+ const SuccessCard = styled(Card)(({ theme }) => ({
+ boxShadow: 'none',
+ padding: theme.spacing(3),
+ color: theme.palette.success.darker,
+ backgroundColor: theme.palette.success.lighter,
+ }));
+
return (
Dashboard
-
- Curabitur turpis. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc,
- vitae euismod ligula urna in dolor. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit
- id, lorem. Phasellus blandit leo ut odio. Vestibulum ante ipsum primis in faucibus orci
- luctus et ultrices posuere cubilia Curae; Fusce id purus. Aliquam lorem ante, dapibus in,
- viverra quis, feugiat a, tellus. In consectetuer turpis ut velit. Aenean posuere, tortor
- sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus.
- Vestibulum suscipit nulla quis orci. Nam commodo suscipit quam. Sed a libero.
-
-
- Praesent ac sem eget est egestas volutpat. Phasellus viverra nulla ut metus varius
- laoreet. Curabitur ullamcorper ultricies nisi. Ut non enim eleifend felis pretium feugiat.
- Donec mi odio, faucibus at, scelerisque quis, convallis in, nisi. Fusce vel dui. Quisque
- libero metus, condimentum nec, tempor a, commodo mollis, magna. In enim justo, rhoncus ut,
- imperdiet a, venenatis vitae, justo. Cras dapibus.
-
-
-
+
+
+
+
+
+
+
+
+ This Month Usages
+ {fCurrency(15000000)} (57)
+
+
+
+
+
+ Remaining Balance Estimation
+ November 2022
+
+
+
+
);
diff --git a/frontend/dashboard/src/pages/Medicines/Index.tsx b/frontend/dashboard/src/pages/Medicines/Index.tsx
deleted file mode 100644
index 7bdcf7f0..00000000
--- a/frontend/dashboard/src/pages/Medicines/Index.tsx
+++ /dev/null
@@ -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 (
-
-
-
- Daftar Obat
-
- askdnkasndka jsndkajsndkajsdnkajsndk jansdkasjdnkjansd
-
- asdasdasd
-
-
- );
-}
diff --git a/frontend/dashboard/src/pages/Members/Index.tsx b/frontend/dashboard/src/pages/Members/Index.tsx
new file mode 100644
index 00000000..ed5ef6a4
--- /dev/null
+++ b/frontend/dashboard/src/pages/Members/Index.tsx
@@ -0,0 +1,319 @@
+// @mui
+import { Box, Button, Card, Collapse, Container, FormControl, Grid, IconButton, InputLabel, MenuItem, OutlinedInput, Paper, Select, SelectChangeEvent, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TextField, Typography, Badge } from '@mui/material';
+import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
+import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
+import PublishIcon from '@mui/icons-material/Publish';
+// 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, { useEffect, useRef } from 'react';
+import { Theme, useTheme } from '@mui/material/styles';
+
+export default function Members() {
+ const { themeStretch } = useSettings();
+
+ const { logout } = useAuth();
+
+ const loadSomething = () => {
+ console.log('Loading Something')
+ }
+
+ type Member = {
+ id: number;
+ code: string;
+ nik: string;
+ name: string;
+ plan_code: string;
+ number_of_families: number;
+ number_of_claim: number;
+ active: boolean;
+ history: any[];
+ }
+
+ function createData( member: Member ): Member {
+ return {
+ ...member,
+ history: [
+ {
+ date: '2020-01-05',
+ customerId: '11091700',
+ amount: 3,
+ },
+ {
+ date: '2020-01-02',
+ customerId: 'Anonymous',
+ amount: 1,
+ },
+ ]
+ }
+ }
+
+ function Row(props: { row: ReturnType
}) {
+ const { row } = props;
+ const [open, setOpen] = React.useState(false);
+
+ return (
+
+ *': { borderBottom: 'unset' } }}>
+
+ setOpen(!open)}
+ >
+ {open ? : }
+
+
+ {row.code}
+ {row.name}
+ {row.nik}
+ {row.plan_code}
+ {row.number_of_claim}
+ {row.number_of_families}
+
+
+
+
+
+
+
+ History
+
+
+
+
+ Date
+ Customer
+ Amount
+ Total price ($)
+
+
+
+ {row.history ? row.history.map((historyRow) => (
+
+
+ {historyRow?.date}
+
+ {historyRow?.customerId}
+ {historyRow?.amount}
+
+ {Math.round(historyRow?.amount * 1000 * 100) / 100}
+
+
+ ))
+ : (
+
+ No Data
+
+ )
+ }
+
+
+
+
+
+
+
+ );
+ }
+
+ // Dummy Default Data
+ const [memberLoading, setMemberLoading] = React.useState(true);
+ const [members, setMembers] = React.useState([]);
+
+ const loadMembers = async () => {
+ setMemberLoading(true)
+ const response = await axios.get('/members');
+ setMemberLoading(false)
+ setMembers(response.data.map(createData));
+ }
+
+ useEffect(() => {
+ loadMembers();
+ }, [])
+
+ const headStyle = {
+ fontWeight: 'bold',
+ };
+
+ // FILTER SELECT
+ const ITEM_HEIGHT = 48;
+ const ITEM_PADDING_TOP = 8;
+ const MenuProps = {
+ PaperProps: {
+ style: {
+ maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP,
+ width: 250,
+ },
+ },
+ };
+
+ const names = [
+ 'PLAN001',
+ 'PLAN002',
+ 'PLAN003',
+ 'PLAN004',
+ 'PLAN005',
+ ];
+ function getStyles(name: string, personName: string[], theme: Theme) {
+ return {
+ fontWeight:
+ personName.indexOf(name) === -1
+ ? theme.typography.fontWeightRegular
+ : theme.typography.fontWeightMedium,
+ };
+ }
+
+ const theme = useTheme();
+ const [planIdFilter, setPlanIdFilter] = React.useState([]);
+
+ const handleChangePlanID = (event: SelectChangeEvent) => {
+ const {
+ target: { value },
+ } = event;
+ setPlanIdFilter(
+ // On autofill we get a stringified value.
+ typeof value === 'string' ? value.split(',') : value,
+ );
+ };
+
+ const [statusFilter, setStatusFilter] = React.useState([]);
+ const handleChangeStatus = (event: SelectChangeEvent) => {
+ const {
+ target: { value },
+ } = event;
+ setStatusFilter(
+ // On autofill we get a stringified value.
+ typeof value === 'string' ? value.split(',') : value,
+ );
+ };
+ // END FILTER SELECT
+
+ // IMPORT
+ const importMember = React.useRef(null);
+ const handleImportButton = (event: any) => {
+ if (importMember?.current)
+ importMember.current.click()
+ else
+ alert('No file selected')
+ }
+
+ return (
+
+
+
+ Member List
+
+
+
+
+
+
+
+
+
+ PlanID
+ }
+ MenuProps={MenuProps}
+ >
+ {names.map((name) => (
+
+ ))}
+
+
+
+
+
+
+ Status
+ }
+ MenuProps={MenuProps}
+ >
+ {['Active', 'Suspended'].map((name) => (
+
+ ))}
+
+
+
+
+
+
+ } sx={{ p: 1.8 }} onClick={handleImportButton}>
+ Import
+
+
+
+
+
+
+
+
+
+ Detail
+ MemberID
+ Name
+ NIK
+ PlanID
+ Claim (time)
+ Family (person)
+ Status
+
+
+ {memberLoading ?
+ (
+
+
+ Loading
+
+
+ ) : (
+ members.length == 0 ?
+ (
+
+
+ No Data
+
+
+ ) : (
+
+ {members.map(row => (
+
+ ))}
+
+ )
+ )}
+
+
+
+
+
+ );
+}
diff --git a/frontend/dashboard/src/pages/auth/Login.tsx b/frontend/dashboard/src/pages/auth/Login.tsx
index aa9b284e..a3ec2f16 100644
--- a/frontend/dashboard/src/pages/auth/Login.tsx
+++ b/frontend/dashboard/src/pages/auth/Login.tsx
@@ -71,18 +71,21 @@ export default function Login() {
-
+
{smUp && (
- Don’t have an account? {''}
-
- Get started
+ Has problem with your account? {''}
+ {
+ window.location.href = "mailto:admin@linksehat.com";
+ e.preventDefault();
+ }}>
+ Contact Us
)}
- {mdUp && (
+ {/* {mdUp && (
Hi, Welcome Back
@@ -94,14 +97,14 @@ export default function Login() {
alt="login"
/>
- )}
+ )} */}
- Sign in to Minimal
+ Sign in to LinkSehat
Enter your details below.
@@ -119,7 +122,7 @@ export default function Login() {
- {!smUp && (
+ {false && !smUp && (
Don’t have an account?{' '}
diff --git a/frontend/dashboard/src/routes/index.tsx b/frontend/dashboard/src/routes/index.tsx
index 00bf6e62..671f5a36 100644
--- a/frontend/dashboard/src/routes/index.tsx
+++ b/frontend/dashboard/src/routes/index.tsx
@@ -11,6 +11,7 @@ import Register from '../pages/auth/Register';
import ResetPassword from '../pages/auth/ResetPassword';
import VerifyCode from '../pages/auth/VerifyCode';
import { AuthProvider } from '../contexts/LaravelAuthContext';
+import AuthGuard from '../guards/AuthGuard';
// ----------------------------------------------------------------------
@@ -34,18 +35,22 @@ export default function Router() {
path: 'login',
element: (
-
+
+
+
+
+ ),
+ },
+ {
+ path: 'register',
+ element: (
+
+
+
+
),
},
- // {
- // path: 'register',
- // element: (
- //
- //
- //
- // ),
- // },
// { path: 'login-unprotected', element: },
// { path: 'register-unprotected', element: },
// { path: 'reset-password', element: },
@@ -58,15 +63,21 @@ export default function Router() {
// },
{
path: '/',
- element: ,
+ element: (
+
+
+
+
+ ),
children:[
+ { element: , index: true },
{
- path: 'medicines',
- element: ,
+ path: 'dashboard',
+ element: ,
},
{
- path: 'medicines/create',
- element:
+ path: 'members',
+ element: ,
},
]
},
@@ -109,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')));
diff --git a/frontend/dashboard/src/sections/auth/login/LoginForm.tsx b/frontend/dashboard/src/sections/auth/login/LoginForm.tsx
index eb12f74a..72723c23 100644
--- a/frontend/dashboard/src/sections/auth/login/LoginForm.tsx
+++ b/frontend/dashboard/src/sections/auth/login/LoginForm.tsx
@@ -39,8 +39,8 @@ export default function LoginForm() {
});
const defaultValues = {
- email: '',
- password: '',
+ email: 'admin@linksehat.dev',
+ password: 'password',
remember: true,
};
@@ -58,15 +58,16 @@ export default function LoginForm() {
const onSubmit = async (data: FormValuesProps) => {
try {
- await login(data.email, data.password );
- navigate('/dashboard/one');
+ const loginResult = await login(data.email, data.password );
+
+ navigate('/dashboard');
} catch (error) {
console.error(error);
reset();
if (isMountedRef.current) {
- setError('afterSubmit', { ...error, message: error.message });
+ setError('afterSubmit', { ...error, message: error.data.message });
}
}
};
@@ -74,6 +75,7 @@ export default function LoginForm() {
return (
+ Email : admin@linksehat.dev & Password : password
{!!errors.afterSubmit && {errors.afterSubmit.message}}
diff --git a/frontend/dashboard/src/sections/dashboard/SomethingUsage.tsx b/frontend/dashboard/src/sections/dashboard/SomethingUsage.tsx
new file mode 100644
index 00000000..4fbaafc3
--- /dev/null
+++ b/frontend/dashboard/src/sections/dashboard/SomethingUsage.tsx
@@ -0,0 +1,80 @@
+import merge from 'lodash/merge';
+import ReactApexChart from 'react-apexcharts';
+// @mui
+import { styled } from '@mui/material/styles';
+import { Card, Typography, Stack } from '@mui/material';
+// utils
+import { fCurrency, fPercent } from '../../utils/formatNumber';
+// components
+import Iconify from '../../components/Iconify';
+import BaseOptionChart from '../../components/chart/BaseOptionChart';
+
+// ----------------------------------------------------------------------
+
+const RootStyle = styled(Card)(({ theme }) => ({
+ boxShadow: 'none',
+ padding: theme.spacing(3),
+ color: theme.palette.primary.darker,
+ backgroundColor: theme.palette.primary.lighter,
+}));
+
+// ----------------------------------------------------------------------
+
+const INITIAL = 500000000
+const TOTAL = 257907000;
+const PERCENT = -3;
+const CHART_DATA = [{ data: [100, 99, 99, 85, 74, 57, 54, 51] }];
+
+export default function SomethingUsage() {
+ const chartOptions = merge(BaseOptionChart(), {
+ chart: { sparkline: { enabled: true } },
+ xaxis: { labels: { show: true } },
+ yaxis: { labels: { show: false } },
+ stroke: { width: 4 },
+ legend: { show: false },
+ grid: { show: false },
+ tooltip: {
+ marker: { show: false },
+ y: {
+ formatter: (seriesName: string) => (seriesName) + "%",
+ title: {
+ formatter: () => '',
+ },
+ },
+ },
+ fill: { gradient: { opacityFrom: 0, opacityTo: 0 } },
+ });
+
+ return (
+
+
+
+
+ {fCurrency(INITIAL)}
+
+ Remaining Balance
+ {fCurrency(TOTAL)}
+
+
+
+
+ = 0 ? 'eva:trending-up-fill' : 'eva:trending-down-fill'}
+ />
+
+ {PERCENT > 0 && '+'}
+ {fPercent(PERCENT)}
+
+
+
+ than last month
+
+
+
+
+
+
+ );
+}
diff --git a/frontend/dashboard/src/utils/axios.ts b/frontend/dashboard/src/utils/axios.ts
index 92795cad..1c23435f 100644
--- a/frontend/dashboard/src/utils/axios.ts
+++ b/frontend/dashboard/src/utils/axios.ts
@@ -21,7 +21,7 @@ const axiosInstance = axios.create({
axiosInstance.interceptors.response.use(
(response) => response,
- (error) => Promise.reject((error.response && error.response.data) || 'Something went wrong')
+ (error) => Promise.reject((error) || 'Something went wrong')
);
export default axiosInstance;
diff --git a/frontend/dashboard/src/utils/formatNumber.ts b/frontend/dashboard/src/utils/formatNumber.ts
index 2dd23b39..353c0299 100644
--- a/frontend/dashboard/src/utils/formatNumber.ts
+++ b/frontend/dashboard/src/utils/formatNumber.ts
@@ -1,9 +1,31 @@
import numeral from 'numeral';
// ----------------------------------------------------------------------
+// load a locale
+numeral.register('locale', 'id', {
+ delimiters: {
+ thousands: '.',
+ decimal: ','
+ },
+ abbreviations: {
+ thousand: 'k',
+ million: 'm',
+ billion: 'b',
+ trillion: 't'
+ },
+ ordinal : function (number: number) {
+ return number === 1 ? 'er' : 'ème';
+ },
+ currency: {
+ symbol: 'Rp '
+ }
+});
+
+// switch between locales
+numeral.locale('id');
export function fCurrency(number: string | number) {
- return numeral(number).format(Number.isInteger(number) ? '$0,0' : '$0,0.00');
+ return numeral(number).format('$0,0');
}
export function fPercent(number: number) {
diff --git a/frontend/dashboard/src/utils/token.ts b/frontend/dashboard/src/utils/token.ts
index 13e32b9c..db33ff36 100644
--- a/frontend/dashboard/src/utils/token.ts
+++ b/frontend/dashboard/src/utils/token.ts
@@ -38,6 +38,15 @@ const setSession = (accessToken: string | null) => {
}
};
-const getSession = () => window.localStorage.getItem('accessToken')
+const setUser = (user: any) => {
+ if (user) {
+ localStorage.setItem('user', user);
+ } else {
+ localStorage.removeItem('user');
+ }
+};
-export { setSession, getSession };
+const getSession = () => window.localStorage.getItem('accessToken')
+const getUser = () => window.localStorage.getItem('user')
+
+export { setSession, getSession, setUser, getUser };