Compare commits
1 Commits
feature/as
...
feature/ge
| Author | SHA1 | Date | |
|---|---|---|---|
| bcf6662db6 |
@@ -10,6 +10,7 @@ use App\Models\Member;
|
||||
use Box\Spout\Reader\Common\Creator\ReaderEntityFactory;
|
||||
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
@@ -42,10 +43,10 @@ class CorporateMemberController extends Controller
|
||||
'claims' => function ($claim) {
|
||||
// return $claim->whereBetween('requested_at', [now()->startOfYear(), now()->endOfYear()]);
|
||||
// return $claim->used(now()->startOfYear(), now()->endOfYear());
|
||||
}
|
||||
},
|
||||
'currentPlan',
|
||||
'currentPlan.benefits'
|
||||
])
|
||||
->with('currentPlan')
|
||||
// ->with
|
||||
->paginate()
|
||||
->appends($request->all());
|
||||
|
||||
@@ -231,7 +232,7 @@ class CorporateMemberController extends Controller
|
||||
}
|
||||
|
||||
|
||||
public function generateLog($member_id)
|
||||
public function generateLog(Request $request, $member_id)
|
||||
{
|
||||
$member = Member::findOrFail($member_id)
|
||||
->load([
|
||||
@@ -239,7 +240,7 @@ class CorporateMemberController extends Controller
|
||||
'currentPolicy',
|
||||
'currentPlan.corporateBenefits' => function ($benefit) use ($request) {
|
||||
return $benefit->when($request->benefit_ids, function ($q, $ids) {
|
||||
return $q->whereIn('benefit_id', $ids);
|
||||
return $q->whereIn('id', $ids);
|
||||
});
|
||||
},
|
||||
'currentPlan.corporateBenefits.benefit']);
|
||||
@@ -247,7 +248,7 @@ class CorporateMemberController extends Controller
|
||||
$dateOfAdmission = $request->date_of_admission ? Carbon::parse($request->date_of_admission) : now();
|
||||
|
||||
// return view('pdf.guaranted_leter', compact('member'));
|
||||
$pdf = PDF::loadView('pdf.guaranted_leter', compact('member'));
|
||||
$pdf = PDF::loadView('pdf.guaranted_leter', compact(['member', 'dateOfAdmission']));
|
||||
return $pdf->download('Guaranted Letter - '.$member->full_name.'.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,8 +130,10 @@ Route::prefix('internal')->group(function () {
|
||||
|
||||
Route::resource('doctors', DoctorController::class);
|
||||
|
||||
|
||||
Route::get('generate-log/{member_id}', [CorporateMemberController::class, 'generateLog']);
|
||||
Route::post('generate-log/{member_id}', [CorporateMemberController::class, 'generateLog']);
|
||||
|
||||
Route::get('claim-requests', [ClaimRequestController::class, 'index'])->name('claim-requests.index');
|
||||
Route::post('claim-requests/{id}/approve', [ClaimRequestController::class, 'approve'])->name('claim-requests.approve');
|
||||
});
|
||||
|
||||
Route::get('province', [ProvinceController::class, 'index']);
|
||||
|
||||
@@ -4,10 +4,7 @@ namespace App\Http\Controllers\Api\OLDLMS;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\OLDLMS\MemberResource;
|
||||
use App\Models\Corporate;
|
||||
use App\Models\Member;
|
||||
use App\Rules\NikRule;
|
||||
use App\Services\ClaimService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -172,91 +169,4 @@ class MembershipController extends Controller
|
||||
|
||||
return Helper::responseJson(data: $limits);
|
||||
}
|
||||
|
||||
public function linkingRules(Request $request)
|
||||
{
|
||||
$corporates = Corporate::query()
|
||||
->when($request->search, function ($q, $search) {
|
||||
$q->where('name', 'LIKE', '%'.$search.'%');
|
||||
})
|
||||
->get();
|
||||
|
||||
return Helper::responseJson(data: $corporates);
|
||||
}
|
||||
|
||||
public function linkingValidate(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'corporate_id' => 'required'
|
||||
]);
|
||||
|
||||
$corporate = Corporate::findOrFail($request->corporate_id);
|
||||
|
||||
// Make Validation from Linking Rules
|
||||
$linkingRulesArr = $corporate->linking_rules->toArray();
|
||||
$validationRules = [];
|
||||
foreach ($linkingRulesArr as $field) {
|
||||
$rules = ['required']; // Default is required if in the linking_rules
|
||||
if ($field == 'email') {
|
||||
$rules[] = 'email';
|
||||
}
|
||||
|
||||
if ($field == 'nric') {
|
||||
$rules[] = new NikRule;
|
||||
}
|
||||
|
||||
$validationRules[$field] = $rules;
|
||||
}
|
||||
$request->validate($validationRules);
|
||||
|
||||
$member = Member::query()
|
||||
->when(in_array('nric', $linkingRulesArr), function($q) use ($request) {
|
||||
$q->where('nric', $request->nric);
|
||||
})
|
||||
->when(in_array('member_id', $linkingRulesArr), function($q) use ($request) {
|
||||
$q->where('member_id', $request->member_id);
|
||||
})
|
||||
->when(in_array('name', $linkingRulesArr), function($q) use ($request) {
|
||||
$q->where('name', $request->name);
|
||||
})
|
||||
->when(in_array('dob', $linkingRulesArr), function($q) use ($request) {
|
||||
$q->where('birth_date', $request->dob);
|
||||
})
|
||||
->when(in_array('phone', $linkingRulesArr), function($q) use ($request) {
|
||||
$q->whereHas('person', function ($person) use ($request) {
|
||||
$person->where('phone', $request->phone);
|
||||
});
|
||||
})
|
||||
->when(in_array('email', $linkingRulesArr), function($q) use ($request) {
|
||||
$q->where('email', $request->email);
|
||||
})
|
||||
->when(in_array('nik', $linkingRulesArr), function($q) use ($request) {
|
||||
$q->whereHas('employeds', function ($employed) use ($request) {
|
||||
$employed->where('corporate_id', $request->corporate_id)
|
||||
->where('nik', $request->nik);
|
||||
});
|
||||
})
|
||||
|
||||
->with([
|
||||
'memberPlans' => function ($memberPlan) {
|
||||
$memberPlan->latest();
|
||||
},
|
||||
])
|
||||
|
||||
->first();
|
||||
|
||||
if ($member) {
|
||||
return Helper::responseJson(data: MemberResource::make($member), message: 'Data Member ditemukan!');
|
||||
}
|
||||
|
||||
return Helper::responseJson(data: [], message: 'Member Tidak ditemukan', statusCode: 404, status: 'error');
|
||||
}
|
||||
|
||||
public function show($member_id)
|
||||
{
|
||||
$member = Member::where('member_id', $member_id)->firstOrFail();
|
||||
$member->load(['currentPlan', 'memberPlans']);
|
||||
|
||||
return Helper::responseJson(data: MemberResource::make($member));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,30 +14,6 @@ class MemberResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
// $data = parent::toArray($request);
|
||||
$currentMemberPlan = $this->memberPlans?->first();
|
||||
|
||||
$data = [
|
||||
'member_id' => $this->member_id,
|
||||
'birth_date' => $this->birth_date,
|
||||
'email' => $this->email,
|
||||
'phone' => $this->person->phone ?? null,
|
||||
'full_name' => $this->full_name,
|
||||
'nric' => $this->nric,
|
||||
'plan' => $currentMemberPlan ? [
|
||||
'code' => $currentMemberPlan->plan->code ?? null,
|
||||
'start' => $currentMemberPlan->start,
|
||||
'end' => $currentMemberPlan->end
|
||||
] : null,
|
||||
'policy_code' => $this->currentPolicy->code,
|
||||
'corporate' => [
|
||||
'code' => $this->currentPolicy->corporate->code,
|
||||
'name' => $this->currentPolicy->corporate->name,
|
||||
'welcome_message' => $this->currentPolicy->corporate->welcome_message,
|
||||
'help_text' => $this->currentPolicy->corporate->help_text,
|
||||
'avatar_url' => $this->currentpolicy->corporate->avatar_url
|
||||
]
|
||||
];
|
||||
return $data;
|
||||
return parent::toArray($request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\Blameable;
|
||||
use Illuminate\Database\Eloquent\Casts\AsArrayObject;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
@@ -24,7 +23,7 @@ class Corporate extends Model
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'linking_rules' => AsArrayObject::class,
|
||||
'linking_rules' => 'array',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
|
||||
@@ -141,8 +141,7 @@ class Member extends Model
|
||||
|
||||
public function currentPlan()
|
||||
{
|
||||
return $this->hasOneThrough(Plan::class, MemberPlan::class, 'member_id', 'id', 'id', 'plan_id')
|
||||
->latest(); // TODO Fix This
|
||||
return $this->hasOneThrough(Plan::class, MemberPlan::class, 'member_id', 'id', 'id', 'plan_id')->latest();
|
||||
}
|
||||
|
||||
public function policies()
|
||||
|
||||
@@ -31,17 +31,4 @@ class MemberPlan extends Model
|
||||
{
|
||||
return $this->belongsTo(CorporatePlan::class, 'plan_id', 'code');
|
||||
}
|
||||
|
||||
public function plan()
|
||||
{
|
||||
return $this->belongsTo(Plan::class, 'plan_id');
|
||||
}
|
||||
|
||||
public function scopeActive($q)
|
||||
{
|
||||
return $q
|
||||
->where('start', '<', now())
|
||||
->where('end', '>', now())
|
||||
->latest();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Rules\NikRule;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Str;
|
||||
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Rules;
|
||||
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
|
||||
class NikRule implements Rule
|
||||
{
|
||||
/**
|
||||
* Create a new rule instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the validation rule passes.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
// The NIK is a 16-digit number
|
||||
if (!preg_match('/^[0-9]{16}$/', $value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// // The first 6 digits represent the person's birth date in the format of YYMMDD
|
||||
// $year = substr($value, 6, 2);
|
||||
// $month = substr($value, 8, 2);
|
||||
// $day = substr($value, 10, 2);
|
||||
|
||||
// // dd($year, $month, $day);
|
||||
// // dd(checkdate($month, $day, "19{$year}"));
|
||||
|
||||
// if (!checkdate($month, $day, "19{$year}")) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// // The next 2 digits represent the place of birth (province/city code)
|
||||
// $provinceCode = substr($value, 6, 2);
|
||||
|
||||
// // The next 2 digits represent the person's gender (odd for male, even for female)
|
||||
// $genderCode = substr($value, 14, 1);
|
||||
|
||||
// // The last 4 digits represent the sequence number of the person's birth in that day
|
||||
// $sequenceNumber = substr($value, 12, 4);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation error message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
return ':attribute bukan valid NIK Indonesia.';
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ export default function CorporateForm({ isEdit, currentCorporate }: Props) {
|
||||
policy_stop_service_net: currentCorporate?.current_policy?.minimal_stop_service_net || 0,
|
||||
policy_start: currentCorporate?.current_policy?.start || '',
|
||||
policy_end: currentCorporate?.current_policy?.end || '',
|
||||
linking_rules: currentCorporate?.linking_rules || ['nric', 'nik', 'member_id'],
|
||||
linking_rules: currentCorporate?.linking_rules || ['nrik', 'nik', 'member_id'],
|
||||
type: currentCorporate?.type || 'corporate',
|
||||
logo: currentCorporate?.logo || '',
|
||||
}),
|
||||
@@ -174,8 +174,6 @@ export default function CorporateForm({ isEdit, currentCorporate }: Props) {
|
||||
formData.append('policy_end', data.policy_end);
|
||||
formData.append('linking_rules', data.linking_rules);
|
||||
|
||||
console.log('MOTHERFUCKER', data.linking_rules)
|
||||
|
||||
if (!isEdit) {
|
||||
const response = await axios.post('/corporates', formData);
|
||||
} else {
|
||||
@@ -271,7 +269,7 @@ export default function CorporateForm({ isEdit, currentCorporate }: Props) {
|
||||
const linking_rules_checkbox_name = 'linking_rules';
|
||||
const linking_tools = [
|
||||
{
|
||||
value: 'nric',
|
||||
value: 'nrik',
|
||||
label: 'No. KTP',
|
||||
},
|
||||
{
|
||||
@@ -427,7 +425,6 @@ export default function CorporateForm({ isEdit, currentCorporate }: Props) {
|
||||
Linking Rules
|
||||
</Typography>
|
||||
<Stack>
|
||||
{JSON.stringify(getValues('linking_rules'))}
|
||||
<RHFCustomMultiCheckbox name="linking_rules" options={linking_tools} />
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
@@ -46,6 +46,7 @@ import { Member } from '../../../@types/member';
|
||||
import BasePagination from '../../../components/BasePagination';
|
||||
import { enqueueSnackbar } from 'notistack';
|
||||
import { LoadingButton } from '@mui/lab';
|
||||
import DialogLog from './sections/DialogLog';
|
||||
|
||||
export default function CorporatePlanList() {
|
||||
const { themeStretch } = useSettings();
|
||||
@@ -198,19 +199,17 @@ export default function CorporatePlanList() {
|
||||
enqueueSnackbar('No File Selected', { variant: 'warning' });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const handleGetTemplate = (type :string) => {
|
||||
axios.get('corporates/import-document-example/' + type)
|
||||
.then((response) => {
|
||||
const link = document.createElement('a');
|
||||
link.href = response.data.data.file_url;
|
||||
link.setAttribute('download', response.data.data.file_name);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
handleClose();
|
||||
})
|
||||
}
|
||||
const handleGetTemplate = (type: string) => {
|
||||
axios.get('corporates/import-document-example/' + type).then((response) => {
|
||||
const link = document.createElement('a');
|
||||
link.href = response.data.data.file_url;
|
||||
link.setAttribute('download', response.data.data.file_name);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
handleClose();
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -248,7 +247,13 @@ export default function CorporatePlanList() {
|
||||
}}
|
||||
>
|
||||
<MenuItem onClick={handleImportButton}>Import</MenuItem>
|
||||
<MenuItem onClick={() => {handleGetTemplate('member')}}>Download Template</MenuItem>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
handleGetTemplate('member');
|
||||
}}
|
||||
>
|
||||
Download Template
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</Stack>
|
||||
)}
|
||||
@@ -329,6 +334,15 @@ export default function CorporatePlanList() {
|
||||
const { row } = props;
|
||||
const [open, setOpen] = React.useState(false);
|
||||
const [loadingLog, setLoadingLog] = React.useState(false);
|
||||
const [dialogLogOpen, setDialogLogOpen] = React.useState(false);
|
||||
|
||||
// useEffect(function () {
|
||||
// if (row.full_name == 'Pajri') {
|
||||
// setDialogLogOpen(true);
|
||||
// console.log('fuck');
|
||||
// }
|
||||
// }, []);
|
||||
|
||||
const handleActivate = (model: any, status: string) => {
|
||||
axios
|
||||
.put(`/members/${row.id}/activation`, {
|
||||
@@ -355,33 +369,7 @@ export default function CorporatePlanList() {
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
const handleDownloadLog = (row: ReturnType<typeof createData>) => {
|
||||
setLoadingLog(true);
|
||||
axios.get(`generate-log/${row.id}`, {
|
||||
responseType: 'blob'
|
||||
})
|
||||
.then((response) => {
|
||||
window.open(URL.createObjectURL(response.data));
|
||||
// const content = response.headers['content-type'];
|
||||
// download(response.data, file.file_name, content);
|
||||
// const link = document.createElement('a');
|
||||
// console.log(response.data);
|
||||
// link.href = response.data.data.file_url;
|
||||
// link.setAttribute('download', response.data.data.file_name);
|
||||
// document.body.appendChild(link);
|
||||
// link.click();
|
||||
setLoadingLog(false);
|
||||
})
|
||||
// .then((blobFile) => {
|
||||
// new File([blobFile], 'asdads.pdf', { type: blobFile.type })
|
||||
// setLoadingLog(false);
|
||||
// })
|
||||
.catch((response) => {
|
||||
enqueueSnackbar(response.message, {variant: 'error'})
|
||||
setLoadingLog(false);
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<TableRow sx={{ '& > *': { borderBottom: 'unset' } }}>
|
||||
@@ -546,31 +534,29 @@ export default function CorporatePlanList() {
|
||||
</Grid>
|
||||
|
||||
<Grid>
|
||||
<LoadingButton
|
||||
id="upload-button"
|
||||
variant="outlined"
|
||||
startIcon={<InsertDriveFileIcon />}
|
||||
// sx={{ p: 1.8 }}
|
||||
onClick={() => {handleDownloadLog(row)}}
|
||||
loading={loadingLog}
|
||||
>
|
||||
Download LOG
|
||||
</LoadingButton>
|
||||
<LoadingButton
|
||||
id="upload-button"
|
||||
variant="outlined"
|
||||
startIcon={<InsertDriveFileIcon />}
|
||||
// sx={{ p: 1.8 }}
|
||||
// onClick={() => {handleDownloadLog(row)}}
|
||||
onClick={() => {
|
||||
setDialogLogOpen(true);
|
||||
}}
|
||||
loading={loadingLog}
|
||||
>
|
||||
Download LOG
|
||||
</LoadingButton>
|
||||
</Grid>
|
||||
|
||||
{/* <Typography sx={{ fontWeight: '600', mb: 1, mt: 2 }}>Sub Corporate</Typography>
|
||||
<Grid container>
|
||||
<Grid item xs={12}>
|
||||
<Grid container>
|
||||
<Grid item xs={6}>
|
||||
Sub Corporates (asdasdasdasd)
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
: qweqweqweqwe
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid> */}
|
||||
<DialogLog
|
||||
title={{
|
||||
name: `Generate LOG - ${row.full_name}`,
|
||||
}}
|
||||
openDialog={dialogLogOpen}
|
||||
setOpenDialog={setDialogLogOpen}
|
||||
data={{ member: row }}
|
||||
></DialogLog>
|
||||
</Box>
|
||||
</Collapse>
|
||||
</TableCell>
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
// react
|
||||
import { ReactElement, useEffect, useState } from 'react';
|
||||
// mui
|
||||
import {
|
||||
Card,
|
||||
Checkbox,
|
||||
Divider,
|
||||
Grid,
|
||||
Input,
|
||||
Link,
|
||||
Stack,
|
||||
Table,
|
||||
TableCell,
|
||||
TableContainer,
|
||||
TableRow,
|
||||
Typography,
|
||||
} from '@mui/material';
|
||||
import { styled } from '@mui/material/styles';
|
||||
// Component
|
||||
import MuiDialog from '@/components/MuiDialog';
|
||||
import { Box } from '@mui/material';
|
||||
import { TextField } from '@mui/material';
|
||||
import { DesktopDatePicker, LocalizationProvider } from '@mui/x-date-pickers';
|
||||
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
||||
import { fPostFormat } from '@/utils/formatTime';
|
||||
import { LoadingButton } from '@mui/lab';
|
||||
import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile';
|
||||
import axios from '@/utils/axios';
|
||||
import { enqueueSnackbar } from 'notistack';
|
||||
|
||||
type DataContent = {
|
||||
info: string;
|
||||
date: string;
|
||||
time: string;
|
||||
};
|
||||
|
||||
type MuiDialogProps = {
|
||||
title?: {
|
||||
name?: string;
|
||||
icon?: string;
|
||||
};
|
||||
openDialog: boolean;
|
||||
setOpenDialog: Function;
|
||||
content?: ReactElement;
|
||||
data?: DataContent[];
|
||||
};
|
||||
|
||||
const ItemNotificationStyle = styled(Card)(({ theme }) => ({
|
||||
boxShadow: 'none',
|
||||
padding: theme.spacing(1),
|
||||
borderRadius: 0.5,
|
||||
color: 'black',
|
||||
}));
|
||||
|
||||
const DialogLog = ({ title, openDialog, setOpenDialog, data }: MuiDialogProps) => {
|
||||
const [openDialogClaim, setOpenDialogClaim] = useState(false);
|
||||
const [dialogTitleClaim, setDialogTitleClaim] = useState('');
|
||||
const [dateOfAdmission, setDateOfAdmission] = useState(new Date());
|
||||
const [checkedBenefitIds, setCheckedBenefitIds] = useState([]);
|
||||
const [benefitIds, setBenefitIds] = useState([]);
|
||||
const [loadingLog, setLoadingLog] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setBenefitIds(data.member.current_plan?.benefits.map((benefit) => benefit.id))
|
||||
setCheckedBenefitIds(benefitIds)
|
||||
console.log('Check All', benefitIds, 'X', data.member.current_plan?.benefits.map((benefit) => benefit.id))
|
||||
}, [])
|
||||
|
||||
const clickHandler = () => {
|
||||
setDialogTitleClaim('Claim Details');
|
||||
setOpenDialogClaim(true);
|
||||
};
|
||||
|
||||
const handleCheckAll = (event) => {
|
||||
if (event.target.checked) {
|
||||
setCheckedBenefitIds(benefitIds)
|
||||
} else {
|
||||
setCheckedBenefitIds([])
|
||||
}
|
||||
}
|
||||
|
||||
const handleCheckChange = (event, benefit) => {
|
||||
if ( event.target.checked ) {
|
||||
setCheckedBenefitIds([...checkedBenefitIds, benefit.id])
|
||||
} else {
|
||||
// setCheckedBenefitIds([])
|
||||
setCheckedBenefitIds(checkedBenefitIds.filter((benefitId) => benefitId !== benefit.id))
|
||||
}
|
||||
}
|
||||
|
||||
const handleDownloadLog = (row) => {
|
||||
setLoadingLog(true);
|
||||
axios
|
||||
.post(`generate-log/${row.id}`, {
|
||||
date_of_admission : dateOfAdmission,
|
||||
benefit_ids : checkedBenefitIds
|
||||
}, {
|
||||
responseType: 'blob',
|
||||
})
|
||||
.then((response) => {
|
||||
window.open(URL.createObjectURL(response.data));
|
||||
setLoadingLog(false);
|
||||
setOpenDialog(false);
|
||||
})
|
||||
.catch((response) => {
|
||||
enqueueSnackbar(response.message, { variant: 'error' });
|
||||
setLoadingLog(false);
|
||||
});
|
||||
}
|
||||
|
||||
const getContent = () => (
|
||||
<Stack sx={{ marginTop: 2 }}>
|
||||
<ItemNotificationStyle>
|
||||
<Stack>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={12}>
|
||||
<LocalizationProvider dateAdapter={AdapterDateFns}>
|
||||
<DesktopDatePicker
|
||||
inputFormat="dd/MM/Y"
|
||||
value={dateOfAdmission}
|
||||
onChange={(value) => {
|
||||
setDateOfAdmission(new Date(fPostFormat(value)));
|
||||
// console.log('value')
|
||||
}}
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
{...params}
|
||||
fullWidth
|
||||
label="Date of Admission"
|
||||
placeholder="dd/mm/yyyy"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</LocalizationProvider>
|
||||
</Grid>
|
||||
<Grid item xs={12} sx={{marginTop: 2}}>
|
||||
<Stack direction="row" alignItems="center" justifyContent={'space-between'}>
|
||||
<Typography variant="body1" fontWeight={800}>List Of Benefit</Typography>
|
||||
|
||||
<Stack direction="row" alignItems="center">
|
||||
<Typography>All</Typography>
|
||||
<Checkbox onChange={handleCheckAll} checked={benefitIds.length == checkedBenefitIds.length}/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Stack divider={<Divider flexItem />}>
|
||||
{ data.member.current_plan?.benefits && (
|
||||
data.member.current_plan?.benefits.map((benefit, index) => (
|
||||
<Stack direction="row" alignItems="center" key={index}>
|
||||
<Box sx={{ width: '100%' }}>
|
||||
<Typography>{benefit.code} {benefit.description ? ` - ${benefit.description} ` : ''}</Typography>
|
||||
</Box>
|
||||
<Checkbox checked={checkedBenefitIds.includes(benefit.id)} onClick={(event) => {handleCheckChange(event, benefit)} } />
|
||||
</Stack>
|
||||
))
|
||||
)}
|
||||
</Stack>
|
||||
{/* <TableContainer>
|
||||
<Table>
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
ASD
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
ASD
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</Table>
|
||||
</TableContainer> */}
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
|
||||
<LoadingButton
|
||||
id="upload-button"
|
||||
variant="outlined"
|
||||
fullWidth
|
||||
startIcon={<InsertDriveFileIcon />}
|
||||
onClick={() => {handleDownloadLog(data.member)}}
|
||||
loading={loadingLog}
|
||||
>
|
||||
Download LOG
|
||||
</LoadingButton>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</ItemNotificationStyle>
|
||||
</Stack>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<MuiDialog
|
||||
title={title}
|
||||
openDialog={openDialog}
|
||||
setOpenDialog={setOpenDialog}
|
||||
content={getContent()}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default DialogLog;
|
||||
@@ -154,7 +154,7 @@ export default function FormulariumForm({ isEdit, currentFormularium }: Props) {
|
||||
const linking_rules_checkbox_name = "linking_rules"
|
||||
const linking_tools = [
|
||||
{
|
||||
"value" : "nric",
|
||||
"value" : "nrik",
|
||||
"label" : "No. KTP"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -212,10 +212,10 @@ export default function List() {
|
||||
<Grid item xs={2}>Metode Pembayaran</Grid><Grid item xs="10">: {row.payment_method}</Grid>
|
||||
<Grid item xs={2}>HIS RegID</Grid><Grid item xs="10">: {row.his_detail?.sRegID}</Grid>
|
||||
<Grid item xs={2}>HIS Medrec</Grid><Grid item xs="10">: {row.his_detail?.Medrec}</Grid>
|
||||
<Grid item xs={2}>No HP</Grid><Grid item xs="10">: {row.patient?.sPhone ?? ''}</Grid>
|
||||
<Grid item xs={2}>E-mail</Grid><Grid item xs="10">: {row.patient?.sEmail ?? ''}</Grid>
|
||||
<Grid item xs={2}>Alamat</Grid><Grid item xs="10">: {row.patient?.detail?.sAlamat ?? ''}</Grid>
|
||||
<Grid item xs={2}>KTP</Grid><Grid item xs="10">: {row.patient?.detail?.sKTP ?? ''}</Grid>
|
||||
<Grid item xs={2}>No HP</Grid><Grid item xs="10">: {row.patient.sPhone ?? ''}</Grid>
|
||||
<Grid item xs={2}>E-mail</Grid><Grid item xs="10">: {row.patient.sEmail ?? ''}</Grid>
|
||||
<Grid item xs={2}>Alamat</Grid><Grid item xs="10">: {row.patient.detail.sAlamat ?? ''}</Grid>
|
||||
<Grid item xs={2}>KTP</Grid><Grid item xs="10">: {row.patient.detail.sKTP ?? ''}</Grid>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</Collapse>
|
||||
|
||||
@@ -124,7 +124,11 @@
|
||||
<tr>
|
||||
<td>
|
||||
<div class="text-sm text-gray">Date of Admission</div>
|
||||
<div class="text-md">{{ !empty($member->endorsement_date) ? \Carbon\Carbon::parse($member->endorsement_date)->format('d/m/Y') : $member->created_at->format('d/m/Y') }}</div>
|
||||
@if (isset($claimRequest))
|
||||
<div class="text-md">{{ !empty($claimRequest->submission_date) ? \Carbon\Carbon::parse($claimRequest->submission_date)->format('d/m/Y') : now()->format('d/m/Y') }}</div>
|
||||
@else
|
||||
<div class="text-md">{{ $dateOfAdmission->format('d/m/Y') }}</div>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<div class="text-sm text-gray">Plan</div>
|
||||
@@ -141,17 +145,17 @@
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
{{-- <tr>
|
||||
<td class="text-lg">Medical Check Up</td>
|
||||
<td class="text-lg">As Charged</td>
|
||||
</tr>
|
||||
</tr> --}}
|
||||
|
||||
{{-- @foreach ($member->currentPlan->corporateBenefits as $corporateBenefit)
|
||||
@foreach ($member->currentPlan->corporateBenefits as $corporateBenefit)
|
||||
<tr>
|
||||
<td>{{ $corporateBenefit->corporate_benefit_code ?? '' }}</td>
|
||||
<td style="align-right">IDR {{ number_format($corporateBenefit->limit_amount, 0, ',', '.') ?? '' }}</td>
|
||||
</tr>
|
||||
@endforeach --}}
|
||||
@endforeach
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -19,14 +19,10 @@ 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::post('claim-create', [ClaimController::class, 'store']);
|
||||
Route::post('claim-update-diagnosis', [ClaimController::class, 'updateClaimDiagnosis']);
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user