fix claim report
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
namespace Modules\Client\Http\Controllers\Api;
|
namespace Modules\Client\Http\Controllers\Api;
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\ClaimRequest;
|
use App\Models\ClaimRequest;
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class CorporateMemberController extends Controller
|
|||||||
$members = $this->corporateMemberService->getAllMemberClaimReports($corporate_id, $request);
|
$members = $this->corporateMemberService->getAllMemberClaimReports($corporate_id, $request);
|
||||||
return response()->json(Helper::paginateResources(ClaimReportMemberResources::collection($members)));
|
return response()->json(Helper::paginateResources(ClaimReportMemberResources::collection($members)));
|
||||||
case 'claim-submit':
|
case 'claim-submit':
|
||||||
$members = $this->corporateMemberService->getAllMemberClaimReports($corporate_id, $request);
|
$members = $this->corporateMemberService->getAllMemberClaimSubmits($corporate_id, $request);
|
||||||
return response()->json(Helper::paginateResources(ClaimSubmitMemberResources::collection($members)));
|
return response()->json(Helper::paginateResources(ClaimSubmitMemberResources::collection($members)));
|
||||||
case 'alarm-center':
|
case 'alarm-center':
|
||||||
$members = $this->corporateMemberService->getAllMemberAlarmCenter($corporate_id, $request);
|
$members = $this->corporateMemberService->getAllMemberAlarmCenter($corporate_id, $request);
|
||||||
@@ -61,35 +61,34 @@ class CorporateMemberController extends Controller
|
|||||||
//Get Family
|
//Get Family
|
||||||
|
|
||||||
$data_family = DB::table('members')
|
$data_family = DB::table('members')
|
||||||
->join('persons', 'members.person_id', '=', 'persons.id')
|
|
||||||
->select('members.*','persons.phone')
|
|
||||||
->where('principal_id', $data->member_id)
|
|
||||||
->get();
|
|
||||||
if($data_family->isEmpty())
|
|
||||||
{
|
|
||||||
$principal_id = DB::table('members')
|
|
||||||
->where('member_id', $data->member_id)
|
|
||||||
->select('principal_id')
|
|
||||||
->first();
|
|
||||||
$data_family = DB::table('members')
|
|
||||||
->join('persons', 'members.person_id', '=', 'persons.id')
|
->join('persons', 'members.person_id', '=', 'persons.id')
|
||||||
->select('members.*','persons.phone')
|
->select('members.*', 'persons.phone')
|
||||||
->where('principal_id', $principal_id->principal_id)
|
->where('principal_id', $data->member_id)
|
||||||
->where('members.member_id','<>',$data->member_id)
|
->get();
|
||||||
->orWhere('members.member_id', $principal_id->principal_id)
|
if ($data_family->isEmpty()) {
|
||||||
->get();
|
$principal_id = DB::table('members')
|
||||||
|
->where('member_id', $data->member_id)
|
||||||
|
->select('principal_id')
|
||||||
|
->first();
|
||||||
|
$data_family = DB::table('members')
|
||||||
|
->join('persons', 'members.person_id', '=', 'persons.id')
|
||||||
|
->select('members.*', 'persons.phone')
|
||||||
|
->where('principal_id', $principal_id->principal_id)
|
||||||
|
->where('members.member_id', '<>', $data->member_id)
|
||||||
|
->orWhere('members.member_id', $principal_id->principal_id)
|
||||||
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
$data->family = $data_family;
|
$data->family = $data_family;
|
||||||
|
|
||||||
//Claim History
|
//Claim History
|
||||||
$data_claim_history = DB::table('claim_requests')
|
$data_claim_history = DB::table('claim_requests')
|
||||||
->join('claims', 'claims.claim_request_id', '=', 'claim_requests.id')
|
->join('claims', 'claims.claim_request_id', '=', 'claim_requests.id')
|
||||||
->join('claim_items', 'claim_items.claim_id', '=', 'claims.id')
|
->join('claim_items', 'claim_items.claim_id', '=', 'claims.id')
|
||||||
->join('benefits', 'benefits.id', '=', 'claim_items.claim_itemable_id')
|
->join('benefits', 'benefits.id', '=', 'claim_items.claim_itemable_id')
|
||||||
->select('claim_requests.status','claim_requests.submission_date','benefits.description')
|
->select('claim_requests.status', 'claim_requests.submission_date', 'benefits.description')
|
||||||
->where('claim_requests.member_id', $data->id)
|
->where('claim_requests.member_id', $data->id)
|
||||||
->get();
|
->get();
|
||||||
$data->claim_history = $data_claim_history;
|
$data->claim_history = $data_claim_history;
|
||||||
|
|
||||||
return response()->json(DataMemberResource::make($data));
|
return response()->json(DataMemberResource::make($data));
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ class MemberResources extends JsonResource
|
|||||||
'memberId' => $this->member_id,
|
'memberId' => $this->member_id,
|
||||||
'fullName' => $this->full_name,
|
'fullName' => $this->full_name,
|
||||||
'division' => $this->division_name ?? '',
|
'division' => $this->division_name ?? '',
|
||||||
'submission_date' => '',
|
'status' => $this->status,
|
||||||
'status' => $this->active,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,46 @@ class CorporateMemberService
|
|||||||
{
|
{
|
||||||
$limit = $request->has('perPage') ? $request->input('perPage') : 10;
|
$limit = $request->has('perPage') ? $request->input('perPage') : 10;
|
||||||
|
|
||||||
|
return Member::query()
|
||||||
|
->joinClaimRequests('right')
|
||||||
|
->joinCorporateEmployees('left')
|
||||||
|
->joinCorporateDivisions('left')
|
||||||
|
->withSum('claims', 'total_claim')
|
||||||
|
->whereHas('employeds', function (Builder $corporateEmployee) use ($corporateId) {
|
||||||
|
$corporateEmployee->where('corporate_id', $corporateId);
|
||||||
|
})
|
||||||
|
->when($request->input('search'), function (Builder $query, $search) {
|
||||||
|
$query->where(function (Builder $query) use ($search) {
|
||||||
|
$query->orWhere('members.member_id', 'like', "%" . $search . "%")
|
||||||
|
->orWhere('members.name', 'like', "%" . $search . "%");
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->when($request->input('division'), function (Builder $division, $value) {
|
||||||
|
$division->whereHas('division', function (Builder $corporateEmployee) use ($value) {
|
||||||
|
$corporateEmployee->where('division_id', $value);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->when($request->has('orderBy'), function (Builder $query) use ($request) {
|
||||||
|
$orderBy = match ($request->orderBy) {
|
||||||
|
'memberId' => 'member_id',
|
||||||
|
'fullName' => 'name',
|
||||||
|
default => ''
|
||||||
|
};
|
||||||
|
|
||||||
|
if (in_array($orderBy, ['member_id', 'name', 'active'])) {
|
||||||
|
$query->getQuery()->orderBy($orderBy, $request->order);
|
||||||
|
} elseif ($request->orderBy === 'division') {
|
||||||
|
$query->getQuery()->orderBy('corporate_divisions.name', $request->order);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->select(['members.id', 'members.person_id', 'members.member_id', 'members.name', 'corporate_divisions.name AS division_name', 'claim_requests.status'])
|
||||||
|
->paginate($limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAllMemberClaimSubmits(int $corporateId, Request $request)
|
||||||
|
{
|
||||||
|
$limit = $request->has('perPage') ? $request->input('perPage') : 10;
|
||||||
|
|
||||||
return Member::query()
|
return Member::query()
|
||||||
->joinClaimRequests('right')
|
->joinClaimRequests('right')
|
||||||
->joinCorporateEmployees('left')
|
->joinCorporateEmployees('left')
|
||||||
|
|||||||
@@ -1,183 +1,181 @@
|
|||||||
// @mui
|
// @mui
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Box,
|
Box,
|
||||||
Stepper,
|
Stepper,
|
||||||
Step,
|
Step,
|
||||||
StepLabel,
|
StepLabel,
|
||||||
Card,
|
Card,
|
||||||
Typography,
|
Typography,
|
||||||
Divider,
|
Divider,
|
||||||
Stack,
|
Stack,
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import { Add } from '@mui/icons-material';
|
import { Add } from '@mui/icons-material';
|
||||||
// components
|
// components
|
||||||
import MuiDialog from '../../components/MuiDialog';
|
import MuiDialog from '../../components/MuiDialog';
|
||||||
// theme
|
// theme
|
||||||
import palette from '../../theme/palette';
|
import palette from '../../theme/palette';
|
||||||
// React
|
// React
|
||||||
import { ReactElement } from '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) => {
|
|
||||||
function clickHandler(arg0: string) {
|
|
||||||
throw new Error('Function not implemented.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// const getContent = () => (
|
type DataContent = {
|
||||||
|
info: string;
|
||||||
// );
|
date: string;
|
||||||
|
time: string;
|
||||||
return (
|
};
|
||||||
|
|
||||||
<>
|
type MuiDialogProps = {
|
||||||
<Stack
|
title?: {
|
||||||
alignItems="center"
|
name?: string;
|
||||||
justifyContent="space-between"
|
icon?: string;
|
||||||
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' }}
|
|
||||||
>
|
|
||||||
onClick={() => clickHandler('topUpLimit')}
|
|
||||||
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()}
|
|
||||||
// />
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
openDialog: boolean;
|
||||||
export default DialogDetailClaim;
|
setOpenDialog: Function;
|
||||||
|
content?: ReactElement;
|
||||||
|
data?: DataContent[];
|
||||||
|
};
|
||||||
|
|
||||||
|
const steps = ['Review', 'Approval', 'Disbursement'];
|
||||||
|
|
||||||
|
const DialogDetailClaim = ({ title, openDialog, setOpenDialog, data }: MuiDialogProps) => {
|
||||||
|
function clickHandler(arg0: string) {
|
||||||
|
throw new Error('Function not implemented.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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' }}
|
||||||
|
// onClick={() => clickHandler('topUpLimit')}
|
||||||
|
>
|
||||||
|
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;
|
||||||
|
|||||||
@@ -1,22 +1,5 @@
|
|||||||
/* ---------------------------------- @mui ---------------------------------- */
|
/* ---------------------------------- @mui ---------------------------------- */
|
||||||
import {
|
import { Stack, Button } from '@mui/material';
|
||||||
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 --------------------------------- */
|
/* ---------------------------------- axios --------------------------------- */
|
||||||
// import axios from 'axios';
|
// import axios from 'axios';
|
||||||
import axios from '../../utils/axios';
|
import axios from '../../utils/axios';
|
||||||
@@ -25,121 +8,13 @@ import { useContext, useEffect, useState } from 'react';
|
|||||||
|
|
||||||
/* -------------------------------- component ------------------------------- */
|
/* -------------------------------- component ------------------------------- */
|
||||||
import Iconify from '../../components/Iconify';
|
import Iconify from '../../components/Iconify';
|
||||||
import BaseTablePagination from '../../components/BaseTablePagination';
|
|
||||||
import TableComponent from '../../components/Table';
|
import TableComponent from '../../components/Table';
|
||||||
import { Navigate } from 'react-router-dom';
|
|
||||||
|
|
||||||
/* ---------------------------------- hooks --------------------------------- */
|
|
||||||
import useMap from '../../hooks/useMap';
|
|
||||||
/* ---------------------------------- theme --------------------------------- */
|
/* ---------------------------------- theme --------------------------------- */
|
||||||
import palette from '../../theme/palette';
|
import palette from '../../theme/palette';
|
||||||
import { UserCurrentCorporateContext } from '../../contexts/UserCurrentCorporate';
|
import { UserCurrentCorporateContext } from '../../contexts/UserCurrentCorporate';
|
||||||
import { HeadCell, Order, PaginationTableProps } from '../../@types/table';
|
import { HeadCell, Order, PaginationTableProps } from '../../@types/table';
|
||||||
import { useSearchParams, useNavigate } from 'react-router-dom';
|
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() {
|
export default function List() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
@@ -250,12 +125,6 @@ export default function List() {
|
|||||||
label: 'Divisi',
|
label: 'Divisi',
|
||||||
isSort: true,
|
isSort: true,
|
||||||
},
|
},
|
||||||
/* {
|
|
||||||
id: 'end_date',
|
|
||||||
align: 'center',
|
|
||||||
label: 'End Date',
|
|
||||||
isSort: false,
|
|
||||||
}, */
|
|
||||||
{
|
{
|
||||||
id: 'status',
|
id: 'status',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
@@ -270,31 +139,6 @@ export default function List() {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
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(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
@@ -313,13 +157,10 @@ export default function List() {
|
|||||||
setData(
|
setData(
|
||||||
response.data.data.map((obj: any) => ({
|
response.data.data.map((obj: any) => ({
|
||||||
...obj,
|
...obj,
|
||||||
|
|
||||||
/* memberId: <Button onClick={() => navigate ('user-profile/:id')}>{obj.memberId}</Button>, */
|
|
||||||
status:
|
status:
|
||||||
obj.status === 1 ? (
|
obj.status === 'requested' ? (
|
||||||
<Button
|
<Button
|
||||||
onClick={() => navigate('dialog-detail')}
|
onClick={() => navigate('dialog-detail')}
|
||||||
/* startIcon={<Iconify icon="ic:round-check" />} */
|
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: 'rgba(84, 214, 44, 0.16)',
|
backgroundColor: 'rgba(84, 214, 44, 0.16)',
|
||||||
color: palette.dark.success.dark,
|
color: palette.dark.success.dark,
|
||||||
@@ -333,6 +174,21 @@ export default function List() {
|
|||||||
>
|
>
|
||||||
Request
|
Request
|
||||||
</Button>
|
</Button>
|
||||||
|
) : obj.status === 'approved' ? (
|
||||||
|
<Button
|
||||||
|
sx={{
|
||||||
|
backgroundColor: (theme) => theme.palette.secondary.main,
|
||||||
|
color: '#FFFF',
|
||||||
|
paddingX: 1.5,
|
||||||
|
paddingY: 1,
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: (theme) => theme.palette.secondary.dark,
|
||||||
|
color: '#FFFF',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Aprroved
|
||||||
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<Button
|
<Button
|
||||||
startIcon={<Iconify icon="fa6-solid:clock" />}
|
startIcon={<Iconify icon="fa6-solid:clock" />}
|
||||||
@@ -350,11 +206,6 @@ export default function List() {
|
|||||||
Ongoing
|
Ongoing
|
||||||
</Button>
|
</Button>
|
||||||
),
|
),
|
||||||
/* action: (
|
|
||||||
<IconButton onClick={() => clickHandler('infoDetail')}>
|
|
||||||
<MoreVertIcon />
|
|
||||||
</IconButton>
|
|
||||||
), */
|
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -383,7 +234,6 @@ export default function List() {
|
|||||||
loadings={loadings}
|
loadings={loadings}
|
||||||
params={params}
|
params={params}
|
||||||
searchs={searchs}
|
searchs={searchs}
|
||||||
// filters={filters}
|
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user