This commit is contained in:
root
2023-05-24 16:55:56 +07:00
parent fff9b7cb18
commit d999d86959
22 changed files with 979 additions and 139 deletions

View File

@@ -1,59 +0,0 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
OLDLMS_DB_CONNECTION=mysql
OLDLMS_DB_HOST=127.0.0.1
OLDLMS_DB_PORT=3306
OLDLMS_DB_DATABASE=linksehat
OLDLMS_DB_USERNAME=mysql
OLDLMS_DB_PASSWORD=password
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

View File

@@ -0,0 +1,32 @@
<?php
namespace Modules\Client\Http\Controllers\Api;
use App\Models\Person;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
class DataController extends Controller
{
public function show($id)
{
try {
$data = Person::findOrFail($id);
return response()->json($data);
} catch (\Exception $e) {
return response()->json(['error' => 'Member not found'], 404);
}
}
public function update(Request $request, $id)
{
try {
$data = Person::findOrFail($id);
$data->update($request->all());
return response()->json(['message' => 'Data updated successfully']);
} catch (\Exception $e) {
return response()->json(['error' => 'Failed to update data'], 500);
}
}
}

View File

@@ -3,6 +3,7 @@
namespace Modules\Client\Http\Controllers\Api;
use App\Helpers\Helper;
use App\Models\CorporatePolicy;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
@@ -33,9 +34,22 @@ class TopUpController extends Controller
* @param Request $request
* @return Renderable
*/
public function store(Request $request)
public function store(Request $request, $corporate_id)
{
//
$data = $request->validate([
'topup' => 'required|numeric',
]);
$corporatePolicy = CorporatePolicy::query()->where('corporate_id',$corporate_id)->firstOrFail();
if (!$corporatePolicy) {
return response() -> json (['message' => 'Corporate policy not found'],404);
}
$corporatePolicy -> total_premi += $data ['topup'];
$corporatePolicy -> save();
return response () -> json (['message' => 'Amount added to total_premi successfully'], 200);
}
/**

View File

@@ -15,6 +15,7 @@ class MemberAlarmCenterResources extends JsonResource
{
return [
'id' => $this->id,
'personId' => $this->person_id,
'memberId' => $this->member_id,
'fullName' => $this->full_name,
'service' => $this->service_code,

View File

@@ -146,4 +146,9 @@ class Person extends Model
return "other";
}
}
public function updatePerson()
{
$this -> update ( $data );
}
}

View File

@@ -11,7 +11,6 @@ class CorporateMemberService
public function getAllMemberDashboards(int $corporateId, Request $request)
{
$limit = $request->has('perPage') ? $request->input('perPage') : 10;
return Member::query()
->joinCorporateEmployees('left')
->joinCorporateDivisions('left')
@@ -34,8 +33,9 @@ class CorporateMemberService
'division' => 'corporate_divisions.name',
default => ''
};
$query->getQuery()->orderBy($orderBy, $request->order);
if ($request->order){
$query->getQuery()->orderBy($orderBy, $request->order);
}
})
->select(['members.id', 'members.person_id', 'members.member_id', 'members.name', 'corporate_divisions.name AS division_name', 'members.active'])
->selectRaw("(select sum(`claims`.`total_claim`) from `claims` where `members`.`id` = `claims`.`member_id` AND `claims`.`deleted_at` IS NULL) AS `claims_sum_total_claim`")

View File

@@ -2,6 +2,6 @@ GENERATE_SOURCEMAP=false
PORT=8083
REACT_APP_HOST_API_URL="http://localhost:8001"
REACT_APP_HOST_API_URL="http://localhost:8000"
VITE_API_URL="http://localhost:8001/api/client"
VITE_API_URL="http://localhost:8000/api/client"

View File

@@ -0,0 +1,28 @@
import * as React from 'react';
import { IconButton } from '@mui/material';
import ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew';
import { useNavigate } from 'react-router-dom';
export default function ButtonBack(props: any) {
const navigate = useNavigate();
return (
<IconButton
sx={{
color: '#005B7F',
'&:hover': {
// color: '#ffffff',
backgroundColor: '#ffffff',
boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.25)',
},
transition: 'background-color 0.3s',
boxShadow: '0px 8px 16px rgba(145, 158, 171, 0.16)',
mr: 5,
mb: 7,
}}
size="large"
onClick={() => (props.url ? navigate(props.url) : navigate(-1))}
>
<ArrowBackIosNewIcon />
</IconButton>
);
}

View File

@@ -14,7 +14,7 @@ const LANGS = [
value: 'en',
icon: 'https://minimal-assets-api.vercel.app/assets/icons/ic_flag_en.svg',
},
{
/* {
label: 'German',
value: 'de',
icon: 'https://minimal-assets-api.vercel.app/assets/icons/ic_flag_de.svg',
@@ -23,7 +23,7 @@ const LANGS = [
label: 'French',
value: 'fr',
icon: 'https://minimal-assets-api.vercel.app/assets/icons/ic_flag_fr.svg',
},
}, */
];
// ----------------------------------------------------------------------

View File

@@ -8,6 +8,8 @@ import Page from '../../components/Page';
/* ---------------------------------- hooks --------------------------------- */
import useSettings from '../../hooks/useSettings';
import List from './List';
import ServiceMonitoring from './ServiceMonitoring';
import UserProfile from './UserProfile';
/* ------------------------------ tabs setting ------------------------------ */
@@ -105,21 +107,21 @@ export default function Drugs() {
<Card>
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
<StyledTabs value={value} onChange={handleChange} aria-label="basic tabs example">
<StyledTab label="All Data (20)" {...a11yProps(0)} />
<StyledTab label="Ongoing (5)" {...a11yProps(1)} />
<StyledTab label="Done (15)" {...a11yProps(2)} />
<StyledTab label="All Data (999)" {...a11yProps(0)} />
<StyledTab label="Ongoing (888)" {...a11yProps(1)} />
<StyledTab label="Done (777)" {...a11yProps(2)} />
</StyledTabs>
</Box>
<TabPanel value={value} index={0}>
<List />
</TabPanel>
<TabPanel value={value} index={1}>
Item Two
{/* <TabPanel value={value} index={1}>
<ServiceMonitoring/>
</TabPanel>
<TabPanel value={value} index={2}>
Item Two
</TabPanel>
</Card>
<UserProfile />
</TabPanel> */}
</Card>
</Grid>
</Grid>
</Container>

View File

@@ -31,7 +31,8 @@ import useMap from '../../hooks/useMap';
import palette from '../../theme/palette';
import { UserCurrentCorporateContext } from '../../contexts/UserCurrentCorporate';
import { HeadCell, Order, PaginationTableProps } from '../../@types/table';
import { useSearchParams } from 'react-router-dom';
import { useSearchParams, useNavigate, Link } from 'react-router-dom';
/* ---------------------------------- types --------------------------------- */
@@ -137,6 +138,8 @@ import { useSearchParams } from 'react-router-dom';
/* -------------------------------------------------------------------------- */
export default function List() {
const navigate = useNavigate();
const { corporateValue } = useContext(UserCurrentCorporateContext);
const [data, setData] = useState([]);
@@ -198,6 +201,7 @@ export default function List() {
paginationTable: paginationTable,
setPaginationTable: setPaginationTable,
};
/* -------------------------------------------------------------------------- */
/* ------------------------------ handle search ----------------------------- */
@@ -224,18 +228,19 @@ export default function List() {
/* -------------------------------- headCell -------------------------------- */
const headCells: HeadCell<never>[] = [
{
id: 'fullName',
align: 'left',
label: 'Name',
isSort: true,
},
{
id: 'memberId',
align: 'left',
label: 'Member ID',
isSort: true,
},
{
id: 'fullName',
align: 'left',
label: 'Name',
isSort: true,
},
{
id: 'start_date',
align: 'center',
@@ -268,17 +273,23 @@ export default function List() {
? appliedParams
: Object.fromEntries([...searchParams.entries(), ['order', order], ['orderBy', orderBy]]);
const response = await axios.get(`/${corporateValue}/members?type=alarm-center`, {
params: parameters,
const response = await axios.get(`${corporateValue}/members?type=alarm-center`, {
params: { ...parameters },
});
setData(
response.data.data.map((obj: any) => {
return {
...obj,
memberId:
// <Link to={'/user-profile/'+obj.personId} >
<Button
onClick={() => navigate ('/user-profile/'+obj.personId)}
>{obj.memberId}</Button>
,
status:
obj.status === 1 ? (
<Button
<Button onClick={() => navigate('service-monitoring/:id')}
startIcon={<Iconify icon="ic:round-check" />}
sx={{
backgroundColor: palette.light.grey[300],

View File

@@ -18,6 +18,7 @@ import Iconify from '../../components/Iconify';
// utils
import useSettings from '../../hooks/useSettings';
import { useState, SyntheticEvent } from 'react';
import { useNavigate } from 'react-router-dom';
// sections
// import ListTable from '../../sections/claimreports/ListTable';
// import ClaimStatusCard from '../../sections/claimreports/ClaimStatusCard';
@@ -101,19 +102,28 @@ const StyledTab = styled((props: StyledTabProps) => <Tab disableRipple {...props
})
);
export default function ServiceMonitoring() {
const { themeStretch } = useSettings();
const navigate = useNavigate();
const [value, setValue] = useState(0);
const handleChange = (event: SyntheticEvent, newValue: number) => {
setValue(newValue);
};
return (
<Page title="Service Monitoring 123456">
<Container maxWidth={themeStretch ? false : 'xl'}>
<Stack direction="row" alignItems="center" sx={{ marginBottom: 2 }}>
<IconButton sx={{ marginRight: '10px', color: '#424242' }}>
<IconButton onClick={() =>
navigate('/alarm-center')
}
sx={{ marginRight: '10px', color: '#424242' }}>
<Iconify icon="heroicons-outline:arrow-narrow-left" />
</IconButton>
<Typography variant="h5">Service Monitoring</Typography>
@@ -271,7 +281,7 @@ export default function ServiceMonitoring() {
<StyledTab icon={<Favorite />} label="Daily Monitoring" {...a11yProps(0)} />
<StyledTab
icon={<Iconify icon="heroicons-solid:beaker" />}
label="Item Two"
label="Laboratorium Result"
{...a11yProps(1)}
/>
</StyledTabs>

View File

@@ -12,21 +12,47 @@ import CardPolicyNumber from '../../sections/alarm-center/user-profile/CardPolic
import CardBenefitSummary from '../../sections/alarm-center/user-profile/CardBenefitSummary';
import CardClaimHistory from '../../sections/alarm-center/user-profile/CardClaimHistory';
// react
import { useNavigate } from 'react-router';
import { useNavigate, useParams } from 'react-router-dom';
import ButtonBack from '../../components/ButtonBack';
import { useEffect, useState, useContext } from 'react';
import axios from '../../utils/axios';
import { UserCurrentCorporateContext } from '../../contexts/UserCurrentCorporate';
// ----------------------------------------------------------------------
export default function UserProfile() {
const { themeStretch } = useSettings();
const navigate = useNavigate();
// const navigate = useNavigate();
const [data, setData] = useState();
const [data1, setData1] = useState();
const {corporateValue} = useContext(UserCurrentCorporateContext);
const {id} = useParams();
useEffect (() => {
axios.get('/data/'+id )
.then(response => {
setData(response.data);
})
.catch(error => {
console.error(error);
});
}, []);
console.log(id)
return (
<Page title="Profile Peserta Jessica Lie">
<Container maxWidth={themeStretch ? false : 'xl'}>
<Stack direction="row" alignItems="center" sx={{ marginBottom: 2 }}>
<IconButton sx={{ marginRight: '10px', color: '#424242' }} onClick={() => navigate(-1)}>
{/* <IconButton sx={{ marginRight: '10px', color: '#424242' }} onClick={() => navigate()}>
<Iconify icon="heroicons-outline:arrow-narrow-left" />
</IconButton>
</IconButton> */}
<ButtonBack/>
<Typography variant="h5">Profil Peserta</Typography>
</Stack>
<Grid container spacing={2}>
@@ -35,11 +61,11 @@ export default function UserProfile() {
<Grid container spacing={2}>
{/* Item 1 */}
<Grid item xs={12} md={12}>
<CardPersonalInformation />
<CardPersonalInformation data={data} />
</Grid>
{/* Item 2 */}
<Grid item xs={12} md={12}>
<CardFamilyInformation />
<CardFamilyInformation data={data1} />
</Grid>
</Grid>
</Grid>

View File

@@ -0,0 +1,178 @@
// @mui
import {
Button,
Box,
Stepper,
Step,
StepLabel,
Card,
Typography,
Divider,
Stack,
} from '@mui/material';
import { Add } from '@mui/icons-material';
// components
import MuiDialog from '../../components/MuiDialog';
// theme
import palette from '../../theme/palette';
// React
import { ReactElement } from 'react';
type DataContent = {
info: string;
date: string;
time: string;
};
type MuiDialogProps = {
title?: {
name?: string;
icon?: string;
};
openDialog: boolean;
setOpenDialog: Function;
content?: ReactElement;
data?: DataContent[];
};
const steps = ['Review', 'Approval', 'Disbursement'];
const DialogDetailClaim = ({ title, openDialog, setOpenDialog, data }: MuiDialogProps) => {
// const getContent = () => (
// );
return (
<>
<Stack
alignItems="center"
justifyContent="space-between"
direction="row"
sx={{ marginTop: 1 }}
>
<Typography variant="subtitle1" sx={{ height: 'max-content' }}>
Claim Request
</Typography>
<Stack>
<Typography variant="caption">Submission date</Typography>
<Typography variant="caption">15 / 05 / 2022</Typography>
</Stack>
</Stack>
<Box sx={{ width: '100%', marginTop: 2 }}>
<Stepper alternativeLabel>
{steps.map((label) => (
<Step key={label}>
<StepLabel>{label}</StepLabel>
</Step>
))}
</Stepper>
</Box>
<Stack marginTop={2}>
<Typography variant="subtitle1" paddingY={2}>
17 Mei 2022
</Typography>
</Stack>
<Stack direction="row" spacing={2}>
<Divider orientation="vertical" flexItem sx={{ borderStyle: 'dashed' }} />
<Stack spacing={2} sx={{ flex: 1, maxWidth: '100%' }}>
{/* Item 1 */}
<Card sx={{ paddingY: 2, paddingX: 3 }}>
<Stack direction="row" justifyContent="space-between" alignItems="center">
<Typography variant="body1">09:10 WIB</Typography>
<Typography
sx={{
backgroundColor: palette.light.warning.lighter,
color: palette.light.warning.dark,
borderColor: palette.light.warning.dark,
border: '1px solid',
borderRadius: '6px',
padding: 1,
}}
variant="caption"
>
Approval
</Typography>
</Stack>
<Divider sx={{ marginY: 2 }} />
<Stack>
<Typography variant="subtitle2" color="#404040">
Details : mohon melengkapi kekurangan dokumen
</Typography>
<Typography variant="caption" color="#757575" sx={{ marginTop: 2, marginBottom: 1 }}>
Lab pemeriksaan darah
</Typography>
<Button
variant="outlined"
startIcon={<Add />}
fullWidth
sx={{ typography: 'subtitle2', borderColor: '#F5F5F5' }}
>
Hasil Pemeriksaan Laboratorium
</Button>
</Stack>
</Card>
{/* Item 2 */}
<Card sx={{ flex: 1, maxWidth: '100%', paddingY: 2, paddingX: 3 }}>
<Stack direction="row" justifyContent="space-between" alignItems="center">
<Typography variant="body1">09:00 WIB</Typography>
<Typography
sx={{
backgroundColor: palette.light.warning.lighter,
color: palette.light.warning.dark,
borderColor: palette.light.warning.dark,
border: '1px solid',
borderRadius: '6px',
padding: 1,
}}
variant="caption"
>
Approval
</Typography>
</Stack>
<Divider sx={{ marginY: 2 }} />
<Stack>
<Typography variant="subtitle2" color="#404040">
Details : Penilaian Dokter
</Typography>
</Stack>
</Card>
{/* Item 3 */}
<Card sx={{ flex: 1, maxWidth: '100%', paddingY: 2, paddingX: 3 }}>
<Stack direction="row" justifyContent="space-between" alignItems="center">
<Typography variant="body1">08:00 WIB</Typography>
<Typography
sx={{
backgroundColor: '#F5F5F5',
color: '#757575',
borderColor: '#757575',
border: '1px solid',
borderRadius: '6px',
padding: 1,
}}
variant="caption"
>
Review
</Typography>
</Stack>
<Divider sx={{ marginY: 2 }} />
<Stack>
<Typography variant="subtitle2" color="#404040">
Details : Klaim Diajukan
</Typography>
</Stack>
</Card>
</Stack>
</Stack>
</>
// <MuiDialog
// title={title}
// openDialog={openDialog}
// setOpenDialog={setOpenDialog}
// content={getContent()}
// />
);
};
export default DialogDetailClaim;

View File

@@ -16,6 +16,10 @@ import { UserCurrentCorporateContext } from '../../contexts/UserCurrentCorporate
/* --------------------------------- orders --------------------------------- */
import { HeadCell, Order, PaginationTableProps } from '../../@types/table';
import { useSearchParams } from 'react-router-dom';
import List from './List';
import ClaimItems from '../Claims/components/ClaimItems';
import DiagnosisHistory from '../Claims/components/DiagnosisHistory';
import Documents from '../Claims/components/Documents';
export default function Drugs() {
const { themeStretch } = useSettings();
@@ -154,6 +158,8 @@ export default function Drugs() {
<CardClaimStatus data={listClaimStatusItems} />
</Grid>
<Grid item xs={12} lg={12} md={12}>
<List/>
{/* <TableList
headCells={headCells}
rows={listAllMemberByClaimStatus}

View File

@@ -0,0 +1,404 @@
/* ---------------------------------- @mui ---------------------------------- */
import {
Paper,
Table,
TableBody,
TableCell,
TableContainer,
TableHead,
TableRow,
TextField,
Stack,
IconButton,
Button,
TableSortLabel,
Box,
} from '@mui/material';
import DialogDetailClaim from '../../sections/dashboard/DialogDetailClaim';
import { visuallyHidden } from '@mui/utils';
import { MoreVert as MoreVertIcon } from '@mui/icons-material';
/* ---------------------------------- axios --------------------------------- */
// import axios from 'axios';
import axios from '../../utils/axios';
/* ---------------------------------- react --------------------------------- */
import { useContext, useEffect, useState } from 'react';
/* -------------------------------- component ------------------------------- */
import Iconify from '../../components/Iconify';
import BaseTablePagination from '../../components/BaseTablePagination';
import TableComponent from '../../components/Table';
import { Navigate } from 'react-router-dom';
/* ---------------------------------- hooks --------------------------------- */
import useMap from '../../hooks/useMap';
/* ---------------------------------- theme --------------------------------- */
import palette from '../../theme/palette';
import { UserCurrentCorporateContext } from '../../contexts/UserCurrentCorporate';
import { HeadCell, Order, PaginationTableProps } from '../../@types/table';
import { useSearchParams, useNavigate } from 'react-router-dom';
/* ---------------------------------- types --------------------------------- */
// type PaginationTableProps = {
// current_page: number;
// from: number;
// last_page: number;
// links: [];
// path: string;
// per_page: number;
// to: number;
// total: number;
// };
// type DataTableProps = {
// fullName: string;
// memberId: string;
// service: string;
// start_date: string;
// end_date: string;
// status: boolean | number;
// };
// /* -------------------------------------------------------------------------- */
// /* -------------------------- enchanced table head -------------------------- */
// type Order = 'asc' | 'desc';
// interface HeadCell {
// id: string;
// label: string;
// }
// const headCells: readonly HeadCell[] = [
// {
// id: 'name',
// label: 'Name',
// },
// {
// id: 'member_id',
// label: 'Member ID',
// },
// {
// id: 'service',
// label: 'Service',
// },
// {
// id: 'start_date',
// label: 'Start Date',
// },
// {
// id: 'end_date',
// label: 'End Date',
// },
// {
// id: 'status',
// label: 'Status',
// },
// ];
// interface EnhancedTableProps {
// onRequestSort: (event: React.MouseEvent<unknown>, property: string) => void;
// order: Order;
// orderBy: string;
// }
// function EnhancedTableHead(props: EnhancedTableProps) {
// const { order, orderBy, onRequestSort } = props;
// const createSortHandler = (property: string) => (event: React.MouseEvent<unknown>) => {
// onRequestSort(event, property);
// };
// return (
// <TableHead>
// <TableRow>
// <TableCell align="center">No</TableCell>
// {headCells.map((headCell) => (
// <TableCell
// key={headCell.id}
// sortDirection={orderBy === headCell.id ? order : false}
// align="center"
// >
// <TableSortLabel
// active={orderBy === headCell.id}
// direction={orderBy === headCell.id ? order : 'asc'}
// onClick={createSortHandler(headCell.id)}
// >
// {headCell.label}
// {orderBy === headCell.id ? (
// <Box component="span" sx={visuallyHidden}>
// {order === 'desc' ? 'sorted descending' : 'sorted ascending'}
// </Box>
// ) : null}
// </TableSortLabel>
// </TableCell>
// ))}
// </TableRow>
// </TableHead>
// );
// }
/* -------------------------------------------------------------------------- */
export default function List() {
const navigate = useNavigate();
const { corporateValue } = useContext(UserCurrentCorporateContext);
const [data, setData] = useState([]);
/* -------------------------------------------------------------------------- */
/* setting up for the table */
/* -------------------------------------------------------------------------- */
const [isLoading, setIsLoading] = useState(true);
const loadings = {
isLoading: isLoading,
setIsLoading: setIsLoading,
};
/* ------------------------------ handle params ----------------------------- */
const [searchParams, setSearchParams] = useSearchParams();
const [appliedParams, setAppliedParams] = useState({});
const params = {
searchParams: searchParams,
setSearchParams: setSearchParams,
appliedParams: appliedParams,
setAppliedParams: setAppliedParams,
};
/* -------------------------------------------------------------------------- */
/* ------------------------------ handle order ------------------------------ */
const [order, setOrder] = useState<Order>('asc');
const [orderBy, setOrderBy] = useState('fullName');
const orders = {
order: order,
setOrder: setOrder,
orderBy: orderBy,
setOrderBy: setOrderBy,
};
/* -------------------------------------------------------------------------- */
/* ---------------------------- handle pagination --------------------------- */
const [page, setPage] = useState(0);
const [rowsPerPage, setRowsPerPage] = useState(10);
const [paginationTable, setPaginationTable] = useState<PaginationTableProps>({
current_page: 0,
from: 0,
last_page: 0,
links: [],
path: '',
per_page: 0,
to: 0,
total: 0,
});
const paginations = {
page: page,
setPage: setPage,
rowsPerPage: rowsPerPage,
setRowsPerPage: setRowsPerPage,
paginationTable: paginationTable,
setPaginationTable: setPaginationTable,
};
/* -------------------------------------------------------------------------- */
/* ------------------------------ handle search ----------------------------- */
const [searchText, setSearchText] = useState('');
const handleSearchSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
if (searchText === '') {
searchParams.delete('search');
const params = Object.fromEntries([...searchParams.entries()]);
setAppliedParams(params);
} else {
const params = Object.fromEntries([...searchParams.entries(), ['search', searchText]]);
setAppliedParams(params);
}
};
const searchs = {
searchText: searchText,
setSearchText: setSearchText,
handleSearchSubmit: handleSearchSubmit,
};
/* -------------------------------- headCell -------------------------------- */
const headCells: HeadCell<never>[] = [
{
id: 'memberId',
align: 'left',
label: 'Member ID',
isSort: true,
},
{
id: 'fullName',
align: 'left',
label: 'Name',
isSort: true,
},
{
id: 'division',
align: 'left',
label: 'Divisi',
isSort: true,
},
/* {
id: 'end_date',
align: 'center',
label: 'End Date',
isSort: false,
}, */
{
id: 'status',
align: 'center',
label: 'Status',
isSort: true,
},
{
id: 'action',
align: 'right',
label: '',
isSort: false,
},
];
const [open, setOpen] = useState<HTMLElement | null>(null);
const handleOpen = (event: React.MouseEvent<HTMLElement>) => {
setOpen(event.currentTarget);
};
const handleClose = () => {
setOpen(null);
};
/* const clickHandler = (isDialog: string) => {
switch (isDialog) {
case 'infoDetail':
setDialogTitle('Claim Details');
setIsDialog(isDialog);
setOpenDialog(true);
break;
default:
break;
}
}; */
/* -------------------------------------------------------------------------- */
useEffect(() => {
(async () => {
setIsLoading(true);
await new Promise((resolve) => setTimeout(resolve, 250));
const parameters =
Object.keys(appliedParams).length !== 0
? appliedParams
: Object.fromEntries([...searchParams.entries(), ['order', order], ['orderBy', orderBy]]);
const response = await axios.get(`${corporateValue}/members`, {
params: { ...parameters },
});
setData(
response.data.data.map((obj: any) => {
return {
...obj,
/* memberId: <Button onClick={() => navigate ('user-profile/:id')}>{obj.memberId}</Button>, */
status:
obj.status === 1 ? (
<Button onClick={() => navigate('dialog-detail')}
/* startIcon={<Iconify icon="ic:round-check" />} */
sx={{
backgroundColor: 'rgba(84, 214, 44, 0.16)',
color: palette.dark.success.dark,
paddingX: 1.5,
paddingY: 1,
'&:hover': {
backgroundColor: 'rgba(84, 214, 44, 0.16)',
color: palette.dark.success.dark,
},
}}
>
Request
</Button>
) : (
<Button
startIcon={<Iconify icon="fa6-solid:clock" />}
sx={{
backgroundColor: '#CD7B2E',
color: '#FFFF',
paddingX: 1.5,
paddingY: 1,
'&:hover': {
backgroundColor: '#BF6919',
color: '#FFFF',
},
}}
>
Ongoing
</Button>
),
/* action: (
<IconButton onClick={() => clickHandler('infoDetail')}>
<MoreVertIcon />
</IconButton>
), */
};
})
);
setPaginationTable(response.data);
setRowsPerPage(response.data.per_page);
if (searchParams.get('page')) {
//@ts-ignore
const currentPage = parseInt(searchParams.get('page')) - 1;
paginationTable.current_page = currentPage;
setPage(currentPage);
}
setIsLoading(false);
})();
}, [appliedParams, searchParams, order, orderBy, setSearchParams, corporateValue]);
return (
<Stack>
<TableComponent
headCells={headCells}
rows={data}
orders={orders}
paginations={paginations}
loadings={loadings}
params={params}
searchs={searchs}
// filters={filters}
/>
</Stack>
);
}

View File

@@ -8,6 +8,7 @@ import LoadingScreen from '../components/LoadingScreen';
import GuestGuard from '../guards/GuestGuard';
import { AuthProvider } from '../contexts/LaravelAuthContext';
import AuthGuard from '../guards/AuthGuard';
// import DialogDetailClaim from '../sections/dashboard/DialogDetailClaim';
// ----------------------------------------------------------------------
@@ -106,6 +107,10 @@ export default function Router() {
element: <ClaimReport />,
index: true,
},
{
path: 'dialog-detail',
element: <DialogDetailClaim/>
},
],
},
{
@@ -158,3 +163,4 @@ const AlarmCenterUserProfile = Loadable(lazy(() => import('../pages/AlarmCenter/
const ClaimReport = Loadable(lazy(() => import('../pages/ClaimReport/Index')));
const Claims = Loadable(lazy(() => import('../pages/Claims/Index')));
const ClaimShow = Loadable(lazy(() => import('../pages/Claims/Show')));
const DialogDetailClaim = Loadable(lazy(()=> import('../pages/ClaimReport/DialogDetailClaim')));

View File

@@ -1,12 +1,86 @@
// mui
import { Button, IconButton, Card, Stack, Typography } from '@mui/material';
import { Visibility as VisibilityIcon } from '@mui/icons-material';
import { Button, IconButton, Card, Stack, Typography, TextField } from '@mui/material';
import { CardMembership, Visibility as VisibilityIcon } from '@mui/icons-material';
// components
import Iconify from '../../../components/Iconify';
import axios from '../../../utils/axios';
import { useContext, useEffect, useState } from 'react';
import { UserCurrentCorporateContext } from '../../../contexts/UserCurrentCorporate';
import { useParams } from 'react-router-dom';
import { Dialog, DialogTitle, DialogContent, DialogActions } from '@mui/material';
import { enqueueSnackbar } from 'notistack';
export default function CardPersonalInformation() {
export default function CardPersonalInformation({data}) {
/* const [data, setData] = useState(); */
const [openDialog, setOpenDialog] = useState(false);
const [editedData, setEditedData] = useState(null);
const { id } = useParams();
const [weight, setWeight] = useState(data?.last_weight_kg || '');
const [height, setHeight] = useState(data?.last_height_cm || '');
const [email, setEmail] = useState(data?.email || '' );
const [phone, setPhone] = useState(data?.phone || '' );
const [address, setAddress] = useState(data?.main_address_id || '' );
/* const [updatedData, setUpdatedData] = useState(data); */
const handleEditData = () => {
setWeight(data?.last_weight_kg || '');
setHeight(data?.last_height_cm || '');
setEmail(data?.email || '');
setPhone(data?.phone||'');
setAddress(data?.main_address_id||'');
setEditedData(data);
setOpenDialog(true);
};
const handleCloseDialog = () => {
// Close the dialog
/* setOpenDialog(false); */
// Reset the edited data
setEditedData(null);
setOpenDialog(false);
};
const handleSaveData = () => {
const updatedData = {
...editedData,
last_weight_kg: weight,
last_height_cm: height,
email: email,
phone: phone,
main_address_id: address,
};
// Update the data in the database using the updatedData object
axios
.put('/data/' + id, updatedData)
.then((response) => {
// Handle the successful update
enqueueSnackbar('Data updated successfully', { variant: 'success' });
setOpenDialog(false);
})
.catch((error) => {
// Handle the error
enqueueSnackbar('Failed to update data', { variant: 'error' });
});
};
return (
<Card sx={{ borderRadius: '6px', paddingY: 2 }}>
{/* Stack 1 */}
<Stack
direction="row"
@@ -15,7 +89,7 @@ export default function CardPersonalInformation() {
sx={{ paddingY: 1, paddingX: 3 }}
>
<Typography variant="subtitle2">Informasi Pribadi</Typography>
<Button startIcon={<Iconify icon="heroicons:pencil-solid" />}>Edit Data</Button>
<Button startIcon={<Iconify icon="heroicons:pencil-solid" />} onClick={handleEditData}>Edit Data</Button>
</Stack>
{/* Stack 2 */}
<Stack direction="row" spacing={2} paddingX={2}>
@@ -45,15 +119,15 @@ export default function CardPersonalInformation() {
<Stack direction="row" paddingY={1} spacing={2} sx={{ flex: '100%' }}>
<Stack sx={{ width: '60%' }}>
<Typography variant="caption">Nama Lengkap</Typography>
<Typography variant="body2">Jessica Lie</Typography>
<Typography variant="body2"> {data ?. name} </Typography>
</Stack>
<Stack sx={{ width: '20%' }}>
<Typography variant="caption">Berat Badan</Typography>
<Typography variant="body2">40 kg</Typography>
<Typography variant="caption">Berat Badan </Typography>
<Typography variant="body2">{data ?. last_weight_kg} kg</Typography>
</Stack>
<Stack sx={{ width: '20%' }}>
<Typography variant="caption">Tinggi Badan</Typography>
<Typography variant="body2">165 cm</Typography>
<Typography variant="caption">Tinggi Badan </Typography>
<Typography variant="body2">{data ?. last_height_cm} cm</Typography>
</Stack>
</Stack>
</Stack>
@@ -65,15 +139,15 @@ export default function CardPersonalInformation() {
<Stack direction="row" spacing={2} sx={{ flex: '100%' }}>
<Stack sx={{ width: '100%' }}>
<Typography variant="caption">Tempat Lahir</Typography>
<Typography variant="body2">Jakarta</Typography>
<Typography variant="body2"> {data ?. birth_place} </Typography>
</Stack>
<Stack sx={{ width: '100%' }}>
<Typography variant="caption">Tanggal Lahir</Typography>
<Typography variant="body2">15-05-1996</Typography>
<Typography variant="body2">{data ?. birth_date}</Typography>
</Stack>
<Stack sx={{ width: '100%' }}>
<Typography variant="caption">Jenis Kelamin</Typography>
<Typography variant="body2">Perempuan</Typography>
<Typography variant="body2">{data ?. gender}</Typography>
</Stack>
</Stack>
</Stack>
@@ -83,18 +157,17 @@ export default function CardPersonalInformation() {
<Stack direction="row" spacing={2} sx={{ flex: '100%' }}>
<Stack sx={{ width: '100%' }}>
<Typography variant="caption">Nomor Telpon</Typography>
<Typography variant="body2">081256788765</Typography>
<Typography variant="body2">{data ?. phone}</Typography>
</Stack>
<Stack sx={{ width: '100%' }}>
<Typography variant="caption">Email</Typography>
<Typography variant="body2">Jessica.lie@gmail.com</Typography>
<Typography variant="body2">{data?. email}</Typography>
</Stack>
</Stack>
<Stack>
<Typography variant="caption">Alamat</Typography>
<Typography variant="body2">
Jl. Kalimantan No.6, Rw. Mekar Jaya, Kec. Serpong, Kota Tangerang Selatan, Banten
15310
{data ?. main_address_id}
</Typography>
</Stack>
</Stack>
@@ -110,7 +183,7 @@ export default function CardPersonalInformation() {
>
<Stack>
<Typography variant="caption">Nomor NIK</Typography>
<Typography variant="body2">081256788765</Typography>
<Typography variant="body2">{data ?. nik}</Typography>
</Stack>
<Stack>
<Button variant="contained" startIcon={<VisibilityIcon />}>
@@ -125,23 +198,84 @@ export default function CardPersonalInformation() {
<Stack direction="row" justifyContent="space-between" spacing={2} sx={{ flex: '100%' }}>
<Stack>
<Typography variant="caption">Agama</Typography>
<Typography variant="body2">Kristen</Typography>
<Typography variant="body2">{data ?. religion}</Typography>
</Stack>
<Stack>
<Typography variant="caption">Status</Typography>
<Typography variant="body2">Menikah</Typography>
<Typography variant="body2">{data ?. marital_status}</Typography>
</Stack>
<Stack>
<Typography variant="caption">Pendidikan</Typography>
<Typography variant="body2">S1</Typography>
<Typography variant="body2">{data ?. last_education}</Typography>
</Stack>
<Stack>
<Typography variant="caption">Pekerjaan</Typography>
<Typography variant="body2">Ibu Rumah Tangga</Typography>
<Typography variant="body2">{data ?. current_employment}</Typography>
</Stack>
</Stack>
</Stack>
</Stack>
{/* Dialog */}
<Dialog open={openDialog} onClose={handleCloseDialog}>
<DialogTitle>Edit Data</DialogTitle>
<DialogContent>
<Stack spacing={2}>
<TextField
label="Full Name"
value={editedData ? editedData.name : ''}
onChange={(e) => setEditedData({ ...editedData, name: e.target.value })}
fullWidth
sx={{ marginTop: '16px' }}
/>
<TextField
label="Weight (kg)"
value={weight}
onChange={(e) => setWeight(e.target.value)}
fullWidth
sx={{ marginTop: '16px' }}
/>
<TextField
label="Height (cm)"
value={height}
onChange={(e) => setHeight(e.target.value)}
fullWidth
sx={{ marginTop: '16px' }}
/>
<TextField
label="Email Address"
value={email}
onChange={(e) => setEmail(e.target.value)}
fullWidth
sx={{ marginTop: '16px' }}
/>
<TextField
label="Phone No."
value={phone}
onChange={(e) => setPhone(e.target.value)}
fullWidth
sx={{ marginTop: '16px' }}
/>
<TextField
label="Address"
value={address}
onChange={(e) => setAddress(e.target.value)}
fullWidth
sx={{ marginTop: '16px' }}
/>
{/* Add more fields as needed */}
</Stack>
</DialogContent>
<DialogActions>
<Button onClick={handleCloseDialog}>Cancel</Button>
<Button onClick={handleSaveData} variant="contained" color="primary">
Save
</Button>
</DialogActions>
</Dialog>
</Card>
);
}

View File

@@ -28,10 +28,10 @@ const RootStyle = styled(Card)(({ theme }) => ({
// ----------------------------------------------------------------------
const defaultData = [
{ name: 'Requested', value: 0, color: palette.dark.primary.dark },
{ name: 'Approval', value: 0, color: palette.dark.warning.dark },
{ name: 'Requested', value: 5, color: palette.dark.primary.dark },
{ name: 'Approval', value: 1, color: palette.dark.warning.dark },
{ name: 'Disbrusment', value: 0, color: palette.dark.success.dark },
{ name: 'Rejected', value: 0, color: palette.dark.error.dark },
{ name: 'Rejected', value: 3, color: palette.dark.error.dark },
];
// ----------------------------------------------------------------------

View File

@@ -13,14 +13,17 @@ import Checkbox from '@mui/material/Checkbox';
import MuiDialog from '../../components/MuiDialog';
import { FormProvider, RHFTextField } from '../../components/hook-form';
// React
import { ReactElement, useEffect, useState } from 'react';
import { useContext, ReactElement, useEffect, useState } from 'react';
import { fCurrency } from '../../utils/formatNumber';
import { UserCurrentCorporateContext } from '../../contexts/UserCurrentCorporate';
// yup
import * as Yup from 'yup';
// form
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
import axios from '../../utils/axios';
import { enqueueSnackbar } from 'notistack';
/* ---------------------------------- types --------------------------------- */
type MuiDialogProps = {
@@ -76,6 +79,8 @@ export default function DialogTopUpLimit({
const [isDisabledInput, setIsDisabledInput] = useState(false);
const [isDisabledButton, setIsDisabledButton] = useState(true);
const [isCheckboxChecked, setIsCheckboxChecked] = useState(false);
const [ message, setMessage ] = useState ('');
const { corporateValue } = useContext(UserCurrentCorporateContext);
const TopUpSchema = Yup.object().shape({
topup: Yup.number().max(
@@ -112,15 +117,32 @@ export default function DialogTopUpLimit({
}, [openDialog, reset]);
const onSubmit = async (data: FormValuesProps) => {
await new Promise((resolve) => setTimeout(resolve, 500));
setIsDisabledInput(false);
setIsDisabledButton(true);
setIsCheckboxChecked(false);
// await axios.post('');
reset();
try {
// Send the HTTP POST request to the backend
await axios.post(corporateValue + '/topup', {
topup: data.topup,
});
// Show a success notification
enqueueSnackbar('The request has been sent', { variant: 'success' });
setOpenDialog(false);
reset();
} catch (error) {
// Show an error notification
enqueueSnackbar('An error occurred', { variant: 'error' });
setOpenDialog(false);
}
};
const onCheckHandler = (value: string) => {
@@ -128,7 +150,7 @@ export default function DialogTopUpLimit({
value === '0' || value === '' ? setIsDisabledButton(true) : setIsDisabledButton(false);
setIsCheckboxChecked(!isCheckboxChecked);
// @ts-ignore
setValue('topup', data.maxTopUp);
setValue('topup', data.maxTopUp.toString());
};
const onTopupHandler = (value: string) => {

View File

@@ -63,6 +63,7 @@ const DialogLog = ({ title, openDialog, setOpenDialog, data }: MuiDialogProps) =
useEffect(() => {
setBenefitIds(data.member.current_plan?.benefits.filter((benefit) => benefit.pivot.active == 1).map((benefit) => benefit.id))
setCheckedBenefitIds(benefitIds)
console.log('Check All', benefitIds, 'X', data.member.current_plan?.benefits.map((benefit) => benefit.id))
}, [])
const clickHandler = () => {

View File

@@ -1,11 +1,14 @@
<?php
use App\Http\Controllers\Api\AuthController;
use App\Http\Controllers\Api\OLDLMS\ClaimController;
use App\Http\Controllers\Api\OLDLMS\MembershipController;
use App\Http\Controllers\Api\OLDLMS\PaymentController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Modules\Client\Http\Controllers\Api\AuthController;
use Modules\Client\Http\Controllers\Api\CorporateDivisionController;
use Modules\Client\Http\Controllers\Api\CorporateManageController;
use Modules\Client\Http\Controllers\Api\CorporateMemberController;
use Modules\Client\Http\Controllers\Api\CorporatePolicyController;
use Modules\Client\Http\Controllers\Api\UserController;
use Modules\Client\Http\Controllers\Api\ClaimController;
use Modules\Client\Http\Controllers\Api\TopUpController;
use Modules\Client\Http\Controllers\Api\DataController;
/*
|--------------------------------------------------------------------------
@@ -18,15 +21,31 @@ use Illuminate\Support\Facades\Route;
|
*/
Route::middleware('linksehat.old.auth')->group(function() {
Route::get('member/{member_id}', [MembershipController::class, 'show'])->name('member.show');
Route::post('check-membership', [MembershipController::class, 'check']);
Route::post('check-limit', [MembershipController::class, 'checkLimit']);
Route::post('check-coverage-limit', [MembershipController::class, 'checkLimit']);
Route::get('linking-rules', [MembershipController::class, 'linkingRules']);
Route::post('linking-validate', [MembershipController::class, 'linkingValidate']);
Route::prefix('client')->group(function () {
Route::post('claim-create', [ClaimController::class, 'store']);
Route::post('claim-update-diagnosis', [ClaimController::class, 'updateClaimDiagnosis']);
Route::controller(AuthController::class)->group(function () {
Route::post('login', 'login');
Route::post('verify-code', 'validateOtp');
});
});
Route::middleware('auth:sanctum')->group(function () {
Route::post('logout', [AuthController::class, 'logout'])->name('logout');
Route::get('user', [UserController::class, 'index']);
Route::get('data/{id}', [DataController::class, 'show']);
Route::put('data/{id}', [DataController::class, 'update' ]);
Route::get('corporate-manage', [CorporateManageController::class, 'index']);
Route::prefix('{corporate_id}')->group(function () {
Route::get('policy', [CorporatePolicyController::class, 'index']);
Route::get('division', [CorporateDivisionController::class, 'index']);
Route::get('members', [CorporateMemberController::class, 'index']);
Route::get('claims/status', [ClaimController::class, 'status']);
Route::get('claims', [ClaimController::class, 'index']);
Route::get('topup', [TopUpController::class, 'index']);
Route::post('topup', [TopUpController::class, 'store']);
});
Route::get('claims/{id}', [ClaimController::class, 'show']);
});
});