Merge branch 'staging' of itcorp.primaya.id:rajif/aso into staging

This commit is contained in:
2023-10-20 08:58:09 +07:00
6 changed files with 221 additions and 102 deletions

View File

@@ -18,6 +18,8 @@ use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Storage;
use Modules\Internal\Services\ExclusionService;
use Modules\Internal\Transformers\DiagnosisExclusionResource;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
class DiagnosisExclusionController extends Controller
{
@@ -327,4 +329,19 @@ class DiagnosisExclusionController extends Controller
// return $exclusions;
return Helper::paginateResources(DiagnosisExclusionResource::collection($exclusions));
}
public function updateActivation(Request $request)
{
// validation rule
$validator = Validator::make($request->all(),[
'id' => 'required|exists:exclusions',
'active' => 'required|in:0,1',
],$this->messages());
// validation error
if ($validator->fails()) {
return response()->json($validator->getMessageBag(),400);
}
}
}

View File

@@ -107,6 +107,7 @@ Route::prefix('internal')->group(function () {
Route::get('corporates/{corporate_id}/diagnosis-exclusions', [DiagnosisExclusionController::class, 'index']);
Route::post('corporates/{corporate_id}/diagnosis-exclusions/store', [DiagnosisExclusionController::class, 'storeExclusion']);
Route::put('corporates/diagnosis-exclusions/update_activation', [DiagnosisExclusionController::class, 'updateActivation']);
Route::delete('diagnosis-exclusions/{id}', [DiagnosisExclusionController::class, 'destroy']);
Route::post('corporates/{corporate_id}/diagnosis-exclusions/import', [DiagnosisExclusionController::class, 'import']);
@@ -132,7 +133,7 @@ Route::prefix('internal')->group(function () {
// Audittrail
Route::get('audittrail/{corporate_id}', [AuditTrailController::class, 'index']);
Route::get('master/diagnosis-template', [DiagnosisTemplateController::class, 'index']);
Route::get('master/diagnosis-template/search', [DiagnosisTemplateController::class, 'search']);
Route::post('master/diagnosis-template/store', [DiagnosisTemplateController::class, 'store']);
@@ -157,10 +158,10 @@ Route::prefix('internal')->group(function () {
Route::post('master/diagnosis/{diagnosis_template_id}/import', [DiagnosisController::class, 'import']);
Route::get('master/diagnosis/{diagnosis_template_id}/list', [DiagnosisController::class, 'generateIcdList']);
Route::put('master/diagnosis/{diagnosis_template_id}/activation', [DiagnosisController::class, 'activation']);
Route::get('master/drugs', [DrugController::class, 'index']);
Route::get('members', [MemberController::class, 'index']);
Route::get('members/{member_id}/benefits', [MemberController::class, 'benefits']);

View File

@@ -38,13 +38,13 @@ import {
} from '@mui/material';
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
import AddIcon from '@mui/icons-material/Add';
import GetApp from '@mui/icons-material/GetApp';
import UploadIcon from '@mui/icons-material/Upload';
import CancelIcon from '@mui/icons-material/Cancel';
// hooks
import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react';
import useSettings from '../../../hooks/useSettings';
import { Link, useParams, useSearchParams } from 'react-router-dom';
import { Link, useParams, useSearchParams, useNavigate } from 'react-router-dom';
// components
import axios from '../../../utils/axios';
import { LaravelPaginatedData } from '../../../@types/paginated-data';
@@ -54,6 +54,11 @@ import { enqueueSnackbar } from 'notistack';
import { Icon } from '@iconify/react';
import { LoadingButton } from '@mui/lab';
import HistoryIcon from '@mui/icons-material/History';
import CachedIcon from '@mui/icons-material/Cached';
import TableMoreMenu from '@/components/table/TableMoreMenu';
import { EditOutlined, FindInPageOutlined } from '@mui/icons-material';
import Label from '@/components/Label';
import { display } from '@mui/system';
export default function List(props: any) {
const { themeStretch } = useSettings();
@@ -82,7 +87,7 @@ export default function List(props: any) {
}, [searchParams]);
return (
<form onSubmit={handleSearchSubmit} style={{ width: '100%' }}>
<form onSubmit={handleSearchSubmit} style={{ width: '90%' }}>
<TextField
id="search-input"
ref={searchInput}
@@ -146,7 +151,7 @@ export default function List(props: any) {
handleCancelImportButton();
loadDataTableData();
setImportResult(response.data);
setImportLoading(false);
// alert('Succesfully read '+ response.data.total_successed_row + ' with ' + response.data.total_failed_row + ' failed rows');
})
@@ -156,14 +161,14 @@ export default function List(props: any) {
response.message,
{ variant: 'error' }
);
setImportLoading(false);
})
} else {
enqueueSnackbar('No File Selected', { variant: 'warning' });
}
};
const handleGetTemplate = (type :string) => {
axios.get('corporates/import-document-example/' + type)
.then((response) => {
@@ -191,17 +196,19 @@ export default function List(props: any) {
<SearchInput onSearch={applyFilter} />
{/* <h1>kjasndkjandskjasndkjansdkjansd</h1> */}
<Button
id="import-button"
variant="outlined"
startIcon={<AddIcon />}
sx={{ p: 1.8 }}
aria-controls={createMenu ? 'basic-menu' : undefined}
aria-haspopup="true"
aria-expanded={createMenu ? 'true' : undefined}
onClick={handleClick}
id="import-button"
variant="contained"
startIcon={<GetApp />}
sx={{ p: 1.8,width: '200px' }}
aria-controls={createMenu ? 'basic-menu' : undefined}
aria-haspopup="true"
aria-expanded={createMenu ? 'true' : undefined}
onClick={handleClick}
color='primary'
>
Import
Import
</Button>
<Menu
id="import-button"
anchorEl={anchorEl}
@@ -462,80 +469,171 @@ export default function List(props: any) {
console.log('exclusions', exclusions);
const handleActivate = (row: any) => {
axios
.put(`/corporates/diagnosis-exclusions/update_activation`, {
id: row.id,
active: row.active == 1 ? 0 : 1,
})
.then((res) => {
// setDataTableData({
// ...dataTableData,
// data: dataTableData.data.map((model) => {
// let updatedModel = model;
// if (row.id == model.id) {
// updatedModel.active = res.data.corporate.active;
// }
// return updatedModel;
// }),
// });
})
.catch((error) => {
enqueueSnackbar(
error.response.data.message ?? error.message ?? 'Failed Processing Request',
{ variant: 'error' }
);
});
};
return (
<React.Fragment>
<TableRow sx={{ '& > *': { borderBottom: 'unset' } }}>
<TableCell>
<IconButton aria-label="expand row" size="small" onClick={() => setOpen(!open)}>
{open ? <KeyboardArrowDownIcon /> : <KeyboardArrowRightIcon />}
</IconButton>
</TableCell>
<TableCell align="left">{row.service_code}</TableCell>
<TableCell align="left">{row.code}</TableCell>
<TableCell align="left">{row.name}</TableCell>
<TableCell align="left">{Object.keys(row.rules).length ? 'With Rules' : 'All'}</TableCell>
<TableCell align="left">{row.active ? 'Active' : 'Inactive'}</TableCell>
<TableCell align="left" onClick={() => {if(open==true) setOpen(!open)}}/>
<TableCell align="left" onClick={() => {if(open==true) setOpen(!open)}}>
{row.service_code}
</TableCell>
<TableCell align="left" onClick={() => {if(open==true) setOpen(!open)}}>
{row.code}
</TableCell>
<TableCell align="left" onClick={() => {if(open==true) setOpen(!open)}}>
{row.name}
</TableCell>
<TableCell align="left" onClick={() => {if(open==true) setOpen(!open)}}>
{Object.keys(row.rules).length ? 'With Rules' : 'All'}
</TableCell>
<TableCell align="left" onClick={() => {if(open==true) setOpen(!open)}}>
{row.active == 1 && (
<Label
variant="outlined"
color="success"
size="small"
>
Active
</Label>
)}
{row.active != 1 && (
<Label
variant="outlined"
color="error"
size="small"
>
Inactive
</Label>
)}
</TableCell>
<TableCell align="center">
<Stack direction={'row'} spacing={1} sx={{ mb: 1 }}>
{openEdit ? (
<Button
variant="contained"
color="success"
size="small"
sx={{
color: '#fff',
}}
onClick={(event) => {
setOpenEdit(!openEdit);
if (open == false) {
setOpen(true);
}
handleConfigExclusion(event, row, '', 'one_row');
}}
>
Save
</Button>
) : (
<Button
variant="outlined"
color="success"
size="small"
onClick={() => {
setOpenEdit(true);
setOpen(true);
}}
>
Edit
</Button>
)}
{/* <Button
variant="outlined"
color="error"
size="small"
sx={{ ml: 2 }}
onClick={() => {
setOpenDelete(true);
}}
>
Delete
</Button> */}
{/* <Link to={`/corporate/${corporate_id}/diagnosis-exclusions/${row.id}/history`}>
<HistoryIcon />
</Link> */}
</Stack>
<TableCell align="left">
<TableMoreMenu actions={
<>
<MenuItem onClick={() => setOpen(!open)}>
<FindInPageOutlined />
Detail
</MenuItem>
<MenuItem onClick={() => navigate(`/corporates/${corporate_id}/diagnosis-exclusions/history`)} >
<EditOutlined />
Edit
</MenuItem>
<MenuItem onClick={() => handleActivate(row)}>
<CachedIcon />
Update Status
</MenuItem>
</>
} />
</TableCell>
</TableRow>
{/* COLLAPSIBLE ROW */}
<TableRow>
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={99}>
<Collapse in={open} timeout="auto" unmountOnExit>
{open == true ? (
{open == true ? (
<Box sx={{ padding: '24px' }}>
<Card sx={{ padding: '24px' }}>
<Grid container spacing={6}>
<Grid item xs={8}>
<Typography variant="body1" sx={{ fontWeight: 'bold'}}>
Excluded Only for :
</Typography>
</Grid>
<Grid item xs={12}>
<Grid container spacing={2}>
<Grid item xs={3}>
<Typography variant="body1" component="div" color={'GrayText'}>
MSC :
</Typography>
</Grid>
<Grid item xs={9} sx={{display: 'flex', gap: 1}}>
{row?.rules?.msc && row?.rules?.msc[0] ? (
row?.rules?.msc[0].split(',').map((text,i) => {
return (
<Typography key={i} component="div">
<Label>{text}</Label>
</Typography>
)
})
) : '-'}
</Grid>
<Grid item xs={3}>
<Typography variant="body1" component="div" color={'GrayText'}>
Gender :
</Typography>
</Grid>
<Grid item xs={9} sx={{display: 'flex', gap: 1}}>
{row?.rules?.gender && row?.rules?.gender[0] ? (
<Typography component="div">
<Label>{row?.rules?.gender[0]}</Label>
</Typography>
) : '-'}
</Grid>
<Grid item xs={3}>
<Typography variant="body1" component="div" color={'GrayText'}>
Min Age :
</Typography>
</Grid>
<Grid item xs={9} sx={{display: 'flex', gap: 1}}>
<Typography component="div">
{row?.rules?.min_age && row?.rules?.min_age[0] ? row?.rules?.min_age[0] : '-'}
</Typography>
</Grid>
<Grid item xs={3}>
<Typography variant="body1" component="div" color={'GrayText'}>
Max Age :
</Typography>
</Grid>
<Grid item xs={9} sx={{display: 'flex', gap: 1}}>
<Typography component="div">
{row?.rules?.max_age && row?.rules?.max_age[0] ? row?.rules?.max_age[0] : '-'}
</Typography>
</Grid>
<Grid item xs={3}>
<Typography variant="body1" component="div" color={'GrayText'}>
Play :
</Typography>
</Grid>
<Grid item xs={9} sx={{display: 'flex', gap: 1}}>
<Typography component="div">
{row?.rules?.plan && row?.rules?.plan[0] ? row?.rules?.plan[0] : '-'}
</Typography>
</Grid>
</Grid>
</Grid>
</Grid>
</Card>
</Box>
) : null }
{/* {open == true ? (
openEdit == false ? (
<Box sx={{ borderBottom: 1 }}>
{Object.keys(row.rules).length ? (
<div>
<div>
<Typography variant="body" sx={{ fontWeight: 'bold' }}>
Excluded Only for :
</Typography>
@@ -560,12 +658,7 @@ export default function List(props: any) {
Plan : {row.rules.plan.join(', ') ?? '-'}
</Typography>
)}
</div>
) : (
<Typography variant="body2" gutterBottom component="div">
Excluded for All
</Typography>
)}
</div>
</Box>
) : (
// <CollapseEdit row={row} index={index} plans={plans} />
@@ -752,7 +845,7 @@ export default function List(props: any) {
</Stack>
</Box>
)
) : null}
) : null} */}
</Collapse>
</TableCell>
</TableRow>
@@ -866,6 +959,8 @@ export default function List(props: any) {
loadDataTableData();
}, []);
const navigate = useNavigate()
return (
<Stack>
<ImportForm />
@@ -874,9 +969,9 @@ export default function List(props: any) {
{/* The Main Table */}
<TableContainer component={Paper}>
<Table aria-label="collapsible table">
<TableBody>
<TableHead>
<TableRow>
<TableCell style={headStyle} align="left" />
<TableCell align="left" width={50} />
<TableCell style={headStyle} align="left">
Service
</TableCell>
@@ -893,15 +988,17 @@ export default function List(props: any) {
Status
</TableCell>
<TableCell style={headStyle} align="left">
Action
</TableCell>
<TableCell style={headStyle} align="left">
<Link to={`/corporate/${corporate_id}/diagnosis-exclusions/history`}>
<HistoryIcon />
</Link>
<TableMoreMenu actions={
<>
<MenuItem onClick={() => navigate(`/corporates/${corporate_id}/diagnosis-exclusions/history`)}>
<HistoryIcon />
History
</MenuItem>
</>
} />
</TableCell>
</TableRow>
</TableBody>
</TableHead>
{dataTableIsLoading ? (
<TableBody>
<TableRow>

View File

@@ -297,7 +297,11 @@ export default function Corporates() {
Import
</Button> */}
<Link to={'/corporates/create'}>
<<<<<<< HEAD
<Button variant="contained" startIcon={<AddIcon sx={{}} />} sx={{ p: 1.8, typography: 'subtitle2' }}>
=======
<Button variant="contained" startIcon={<AddIcon sx={{}} />} sx={{ p: 1.8, typography: 'subtitle2', backgroundColor: '#19BBBB' }}>
>>>>>>> 8a3b0f3d1185955685128bc197a50193b837ddc1
New Corporate
</Button>
</Link>

View File

@@ -38,7 +38,7 @@ export default function Corporates() {
const headStyle = {
fontWeight: 'bold',
};
};
// Upload Docs
const fileDocsInput = useRef<HTMLInputElement>(null);
const [fileDocs, setFileDocs] = useState([]);
@@ -109,7 +109,7 @@ export default function Corporates() {
}
axios
.post('/update-status-files-doc', {status_download : statusDownload, corporate_id : corporate_id})
.then((response) => {
.then((response) => {
enqueueSnackbar(response.data.message, { variant: 'success' });
})
.catch((error) => {
@@ -138,7 +138,7 @@ export default function Corporates() {
},
]}
/>
{/* <Container maxWidth={themeStretch ? false : 'xl'}> */}
<Card>
<Stack spacing="2">
@@ -204,7 +204,7 @@ export default function Corporates() {
accept="application/pdf"
multiple
/>
<Button
variant="outlined"
onClick={() => {

View File

@@ -260,7 +260,7 @@ export default function Router() {
path: 'master/diagnosis-template/:id/edit',
element: <MasterDiagnosisTemplateCreate />,
},
{
path: 'master/diagnosis/:diagnosis_template_id',
element: <MasterDiagnosis />,
@@ -522,4 +522,4 @@ const ClaimShow = Loadable(lazy(() => import('../pages/Claims/Show')));
const ClaimRequests = Loadable(lazy(() => import('../pages/ClaimRequests/Index')));
const Membership = Loadable(lazy(() => import('../pages/Service/Membership/index')));
const Membership = Loadable(lazy(() => import('../pages/Service/Membership/index')));