Claim Services
This commit is contained in:
@@ -565,9 +565,162 @@ class ClaimController extends Controller
|
|||||||
->get();
|
->get();
|
||||||
$results['request_documents'] = $request_documents;
|
$results['request_documents'] = $request_documents;
|
||||||
|
|
||||||
|
$claim_services = DB::table('claim_services')
|
||||||
|
->where('claim_services.claim_request_id', $claim_id)
|
||||||
|
->select(
|
||||||
|
'claim_services.id',
|
||||||
|
'claim_services.addmission_date',
|
||||||
|
'claim_services.discharge_date',
|
||||||
|
'claim_services.service_id',
|
||||||
|
DB::raw('(SELECT services.name FROM services WHERE id = claim_services.service_id LIMIT 1) AS name_services'),
|
||||||
|
'claim_services.hospital_id',
|
||||||
|
DB::raw('(SELECT corporate_hospitals.name FROM corporate_hospitals WHERE id = claim_services.hospital_id LIMIT 1) AS name_hospitals'),
|
||||||
|
)
|
||||||
|
->groupBy('claim_services.id')
|
||||||
|
->first();
|
||||||
|
$results['claim_services'] = $claim_services;
|
||||||
|
|
||||||
|
$claim_service_benefits = DB::table('claim_service_benefits')
|
||||||
|
->where('claim_service_id', $claim_services->id)
|
||||||
|
->select(
|
||||||
|
'claim_service_benefits.claim_service_id',
|
||||||
|
'claim_service_benefits.benefit_id',
|
||||||
|
DB::raw('(SELECT benefits.description FROM benefits WHERE id = claim_service_benefits.benefit_id LIMIT 1) AS name_benefits')
|
||||||
|
)
|
||||||
|
->get();
|
||||||
|
foreach ($claim_service_benefits as $item) {
|
||||||
|
$claimServiceId = $item->claim_service_id;
|
||||||
|
$nameBenefits = $item->name_benefits;
|
||||||
|
$benefitId = $item->benefit_id."";
|
||||||
|
if (!isset($output[$claimServiceId])) {
|
||||||
|
$output[$claimServiceId] = (object)[
|
||||||
|
"claim_service_id" => $claimServiceId,
|
||||||
|
"name_benefits" => $nameBenefits,
|
||||||
|
"benefit_id" => [$benefitId],
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$output[$claimServiceId]->name_benefits .= ", " . $nameBenefits;
|
||||||
|
$output[$claimServiceId]->benefit_id[] = $benefitId."";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$output = array_values($output);
|
||||||
|
|
||||||
|
$results['claim_service_benefits'] = $output[0];
|
||||||
|
|
||||||
return Helper::responseJson($results);
|
return Helper::responseJson($results);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getServices($claim_id)
|
||||||
|
{
|
||||||
|
//Corporate_id
|
||||||
|
$corporate_id = DB::table('claim_requests')
|
||||||
|
->leftJoin('claims', 'claim_requests.id', '=', 'claims.claim_request_id')
|
||||||
|
->leftJoin('members', 'claim_requests.member_id', '=', 'members.id')
|
||||||
|
->leftJoin('corporate_employees', 'members.id', '=', 'corporate_employees.member_id')
|
||||||
|
->leftJoin('corporates', 'corporate_employees.corporate_id', '=', 'corporates.id')
|
||||||
|
->where('claim_requests.id', '=', $claim_id)
|
||||||
|
->select('corporates.id')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
//Service Type
|
||||||
|
$service_type = DB::table('corporate_services')
|
||||||
|
->leftJoin('services','corporate_services.service_code', 'services.code')
|
||||||
|
->where('corporate_services.corporate_id', $corporate_id->id)
|
||||||
|
->select('services.name', 'services.code', 'services.id')
|
||||||
|
->get();
|
||||||
|
$results['service_type'] = $service_type;
|
||||||
|
|
||||||
|
//Benefit Name
|
||||||
|
$benefit_name = DB::table('corporate_benefits')
|
||||||
|
->leftJoin('benefits', 'corporate_benefits.benefit_id', 'benefits.id')
|
||||||
|
->where('corporate_benefits.corporate_id', $corporate_id->id)
|
||||||
|
->select('benefits.code', 'benefits.description', 'benefits.id')
|
||||||
|
->get();
|
||||||
|
$results['benefit_name'] = $benefit_name;
|
||||||
|
|
||||||
|
//Hospital
|
||||||
|
$hospital = DB::table('corporate_hospitals')
|
||||||
|
->where('corporate_hospitals.corporate_id', $corporate_id->id)
|
||||||
|
->where('corporate_hospitals.active', 1)
|
||||||
|
->select('corporate_hospitals.code', 'corporate_hospitals.name', 'corporate_hospitals.id')
|
||||||
|
->get();
|
||||||
|
$results['hospital'] = $hospital;
|
||||||
|
|
||||||
|
return Helper::responseJson($results);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveServices(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'claim_request_id' => 'required',
|
||||||
|
'dateAdd' => 'required',
|
||||||
|
'dateDisc' => 'required',
|
||||||
|
'serviceType' => 'required',
|
||||||
|
'hospital' => 'required',
|
||||||
|
'benefitName' => 'required',
|
||||||
|
]);
|
||||||
|
if($request->flagAddService === 'add')
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'claim_request_id' => $request->claim_request_id,
|
||||||
|
'service_id' => $request->serviceType,
|
||||||
|
'hospital_id' => $request->hospital,
|
||||||
|
'addmission_date' => $request->dateAdd,
|
||||||
|
'discharge_date' => $request->dateDisc,
|
||||||
|
'created_by' =>auth()->user()->id,
|
||||||
|
'created_at' => date('Y-m-d H:i:s'),
|
||||||
|
'updated_at' => null,
|
||||||
|
];
|
||||||
|
$id = DB::table('claim_services')
|
||||||
|
->insertGetId($data);
|
||||||
|
foreach ($request->benefitName as $value)
|
||||||
|
{
|
||||||
|
DB::table('claim_service_benefits')
|
||||||
|
->insert([
|
||||||
|
'claim_service_id' => $id,
|
||||||
|
'benefit_id' => $value,
|
||||||
|
'created_by' =>auth()->user()->id,
|
||||||
|
'created_at' => date('Y-m-d H:i:s'),
|
||||||
|
'updated_at' => date('Y-m-d H:i:s'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if($request->flagAddService === 'edit')
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'claim_request_id' => $request->claim_request_id,
|
||||||
|
'service_id' => $request->serviceType,
|
||||||
|
'hospital_id' => $request->hospital,
|
||||||
|
'addmission_date' => $request->dateAdd,
|
||||||
|
'discharge_date' => $request->dateDisc,
|
||||||
|
'created_by' =>auth()->user()->id,
|
||||||
|
'created_at' => null,
|
||||||
|
'updated_at' => date('Y-m-d H:i:s'),
|
||||||
|
];
|
||||||
|
DB::table('claim_services')
|
||||||
|
->where('claim_services.id', $request->idService)
|
||||||
|
->update($data);
|
||||||
|
|
||||||
|
DB::table('claim_service_benefits')
|
||||||
|
->where('claim_service_id', $request->idService)
|
||||||
|
->delete();
|
||||||
|
|
||||||
|
foreach ($request->benefitName as $value)
|
||||||
|
{
|
||||||
|
DB::table('claim_service_benefits')
|
||||||
|
->insert([
|
||||||
|
'claim_service_id' => $request->idService,
|
||||||
|
'benefit_id' => $value,
|
||||||
|
'created_by' =>auth()->user()->id,
|
||||||
|
'created_at' => date('Y-m-d H:i:s'),
|
||||||
|
'updated_at' => date('Y-m-d H:i:s'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Helper::responseJson([]);
|
||||||
|
}
|
||||||
|
|
||||||
public function requestDocuments(Request $request)
|
public function requestDocuments(Request $request)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
|
|||||||
@@ -224,6 +224,8 @@ Route::prefix('internal')->group(function () {
|
|||||||
Route::get('claims/1/data-claim', [ClaimController::class, 'dataClaimReport']);
|
Route::get('claims/1/data-claim', [ClaimController::class, 'dataClaimReport']);
|
||||||
Route::get('claims/detail/{id}', [ClaimController::class, 'getDetailClaims']);
|
Route::get('claims/detail/{id}', [ClaimController::class, 'getDetailClaims']);
|
||||||
Route::post('claims/request-documents', [ClaimController::class, 'requestDocuments']);
|
Route::post('claims/request-documents', [ClaimController::class, 'requestDocuments']);
|
||||||
|
Route::get('claims/get-services/{id}', [ClaimController::class, 'getServices']);
|
||||||
|
Route::post('claims/save-services', [ClaimController::class, 'saveServices']);
|
||||||
|
|
||||||
Route::get('search-organizations', [OrganizationController::class, 'searchOrganization']);
|
Route::get('search-organizations', [OrganizationController::class, 'searchOrganization']);
|
||||||
Route::get('search-specialities', [SpecialityController::class, 'searchSpeciality']);
|
Route::get('search-specialities', [SpecialityController::class, 'searchSpeciality']);
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('claim_services', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->bigInteger('claim_request_id');
|
||||||
|
$table->bigInteger('service_id');
|
||||||
|
$table->bigInteger('hospital_id');
|
||||||
|
$table->dateTime('addmission_date');
|
||||||
|
$table->dateTime('discharge_date');
|
||||||
|
$table->bigInteger('created_by')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('claim_services');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('claim_service_benefits', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->bigInteger('claim_service_id');
|
||||||
|
$table->bigInteger('benefit_id');
|
||||||
|
$table->bigInteger('created_by')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('claim_service_benefits');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,5 +1,21 @@
|
|||||||
// mui
|
// mui
|
||||||
import { Container, Grid, Stack, Typography, Card, TextField, Divider, ButtonBase, Box, IconButton } from '@mui/material';
|
import {
|
||||||
|
Container,
|
||||||
|
Grid,
|
||||||
|
Stack,
|
||||||
|
Typography,
|
||||||
|
Card,
|
||||||
|
TextField,
|
||||||
|
Divider,
|
||||||
|
ButtonBase,
|
||||||
|
Box,
|
||||||
|
IconButton,
|
||||||
|
FormControl,
|
||||||
|
InputLabel,
|
||||||
|
Select,
|
||||||
|
FormHelperText,
|
||||||
|
MenuItem,
|
||||||
|
} from '@mui/material';
|
||||||
// components
|
// components
|
||||||
import Page from '../../components/Page';
|
import Page from '../../components/Page';
|
||||||
// utils
|
// utils
|
||||||
@@ -19,9 +35,17 @@ import CloseIcon from '@mui/icons-material/Close';
|
|||||||
import FormGroup from '@mui/material/FormGroup';
|
import FormGroup from '@mui/material/FormGroup';
|
||||||
import FormControlLabel from '@mui/material/FormControlLabel';
|
import FormControlLabel from '@mui/material/FormControlLabel';
|
||||||
import Checkbox from '@mui/material/Checkbox';
|
import Checkbox from '@mui/material/Checkbox';
|
||||||
|
import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers';
|
||||||
|
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
||||||
|
import { fPostFormat } from '@/utils/formatTime';
|
||||||
|
import { fDate, fDateTime } from '../../utils/formatTime';
|
||||||
|
import ListItemText from '@mui/material/ListItemText';
|
||||||
|
import EditOutlinedIcon from '@mui/icons-material/EditOutlined';
|
||||||
|
import TableMoreMenu from '@/components/table/TableMoreMenu';
|
||||||
|
|
||||||
import { enqueueSnackbar } from 'notistack';
|
import { enqueueSnackbar } from 'notistack';
|
||||||
import BenefitConfigurationList from './components/BenefitConfigurationList';
|
import BenefitConfigurationList from './components/BenefitConfigurationList';
|
||||||
|
import { map } from 'lodash';
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -35,6 +59,8 @@ export default function Detail() {
|
|||||||
const [customerData, setCustomerData] = useState(null);
|
const [customerData, setCustomerData] = useState(null);
|
||||||
const [documentData, setDocumentData] = useState(null);
|
const [documentData, setDocumentData] = useState(null);
|
||||||
const [requestDocumentData, setRequestDocumentData] = useState(null);
|
const [requestDocumentData, setRequestDocumentData] = useState(null);
|
||||||
|
const [serviceData, setServiceData] = useState(null);
|
||||||
|
const [serviceBenefitData, setServiceBenefitData] = useState(null);
|
||||||
|
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
|
|
||||||
@@ -45,10 +71,13 @@ export default function Detail() {
|
|||||||
setCustomerData(response.data.data.customer_data);
|
setCustomerData(response.data.data.customer_data);
|
||||||
setDocumentData(response.data.data.documents);
|
setDocumentData(response.data.data.documents);
|
||||||
setRequestDocumentData(response.data.data.request_documents);
|
setRequestDocumentData(response.data.data.request_documents);
|
||||||
|
setServiceData(response.data.data.claim_services);
|
||||||
|
setServiceBenefitData(response.data.data.claim_service_benefits);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
});
|
});
|
||||||
|
getService();
|
||||||
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -69,8 +98,9 @@ export default function Detail() {
|
|||||||
marginBottom: 1,
|
marginBottom: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Request
|
||||||
const [openDialogRequest, setOpenDialogRequest] = useState(false);
|
const [openDialogRequest, setOpenDialogRequest] = useState(false);
|
||||||
const handleCloseDialogUpdate = () => {
|
const handleCloseDialogRequest = () => {
|
||||||
setOpenDialogRequest(false);
|
setOpenDialogRequest(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +145,118 @@ export default function Detail() {
|
|||||||
enqueueSnackbar('Something Went Wrong', { variant: 'error' });
|
enqueueSnackbar('Something Went Wrong', { variant: 'error' });
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
//Service
|
||||||
|
const [openDialogService, setOpenDialogService] = useState(false);
|
||||||
|
const handleCloseDialogService = () => {
|
||||||
|
setOpenDialogService(false);
|
||||||
|
}
|
||||||
|
const handleConditionChangeService = (event) => {
|
||||||
|
const selectedItem = event.target.value;
|
||||||
|
|
||||||
|
if (valBenefitNames.includes(selectedItem)) {
|
||||||
|
// Item is already selected, remove it
|
||||||
|
setValBenefitNames(valBenefitNames.filter(item => item !== selectedItem));
|
||||||
|
} else {
|
||||||
|
// Item is not selected, add it
|
||||||
|
setValBenefitNames([...valBenefitNames, selectedItem]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//Data
|
||||||
|
const [serviceTypeData, setServiceTypeData] = useState(null);
|
||||||
|
const [benefitNameData, setBenefitNameData] = useState(null);
|
||||||
|
const [hospitalData, setHospitalData] = useState(null);
|
||||||
|
//Field
|
||||||
|
const currentDate = new Date();
|
||||||
|
const formattedCurrentDate = format(currentDate, 'dd MMM yyyy');
|
||||||
|
//Date Addmissions
|
||||||
|
const [dateAd, setDateAd] = useState(currentDate);
|
||||||
|
//Date Discharge
|
||||||
|
const [dateDis, setDateDis] = useState(currentDate);
|
||||||
|
//Service Type
|
||||||
|
const [valServiceType, setValServiceType] = useState('');
|
||||||
|
const [valServiceTypeError, setValServiceTypeError] = useState('');
|
||||||
|
//Benefit Name
|
||||||
|
const [valBenefitNames, setValBenefitNames] = useState([]);
|
||||||
|
const [valBenefitNameError, setValBenefitNameError] = useState('');
|
||||||
|
//Hospital
|
||||||
|
const [valHospital, setValHospital] = useState('');
|
||||||
|
const [valHospitalError, setValHospitalError] = useState('');
|
||||||
|
//txt name
|
||||||
|
const [txtName, setTxtName] = useState('Add Service');
|
||||||
|
//flag add or edit service
|
||||||
|
const [flagAddService, setFlagAddService] = useState('add');
|
||||||
|
//id claim_services
|
||||||
|
const [idService, setIdService] = useState(null);
|
||||||
|
|
||||||
|
|
||||||
|
const isRequiredFieldsServiceType = () => {
|
||||||
|
return dateAd !== '' && dateDis !== '' && valServiceType !== '' && valBenefitNames.length > 0 && valHospital !== '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const getService = async () => {
|
||||||
|
try {
|
||||||
|
const response = await axios.get('/claims/get-services/' + id);
|
||||||
|
setServiceTypeData(response.data.data.service_type);
|
||||||
|
setBenefitNameData(response.data.data.benefit_name);
|
||||||
|
setHospitalData(response.data.data.hospital);
|
||||||
|
await Promise.all([
|
||||||
|
setServiceTypeData(response.data.data.service_type),
|
||||||
|
setBenefitNameData(response.data.data.benefit_name),
|
||||||
|
setHospitalData(response.data.data.hospital),
|
||||||
|
]);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const handleAddService = async () => {
|
||||||
|
setTxtName('Add Service');
|
||||||
|
setFlagAddService('add');
|
||||||
|
setOpenDialogService(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleEditService = async () => {
|
||||||
|
setDateAd(serviceData.addmission_date);
|
||||||
|
setDateDis(serviceData.discharge_date);
|
||||||
|
setIdService(serviceData.id);
|
||||||
|
|
||||||
|
setOpenDialogService(true);
|
||||||
|
setTxtName('Edit Service');
|
||||||
|
setFlagAddService('edit');
|
||||||
|
|
||||||
|
if (serviceTypeData) {
|
||||||
|
setValServiceType(serviceData.service_id);
|
||||||
|
setValHospital(serviceData.hospital_id);
|
||||||
|
setValBenefitNames(serviceBenefitData.benefit_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handelSaveServiceType = () => {
|
||||||
|
const dateAdd = dateAd ? fPostFormat(dateAd, 'yyyy-MM-dd') : null;
|
||||||
|
const dateDisc = dateDis ? fPostFormat(dateDis, 'yyyy-MM-dd') : null;
|
||||||
|
const data = {
|
||||||
|
flagAddService : flagAddService,
|
||||||
|
idService: idService,
|
||||||
|
claim_request_id: id,
|
||||||
|
dateAdd : dateAdd,
|
||||||
|
dateDisc : dateDisc,
|
||||||
|
serviceType : valServiceType,
|
||||||
|
benefitName : valBenefitNames,
|
||||||
|
hospital : valHospital
|
||||||
|
};
|
||||||
|
axios
|
||||||
|
.post('/claims/save-services', data)
|
||||||
|
.then((response) => {
|
||||||
|
enqueueSnackbar('Success '+(flagAddService == 'add' ? 'Add' : 'Edit')+' Service', { variant: 'success' });
|
||||||
|
handleCloseDialogService();
|
||||||
|
window.location.reload();
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
enqueueSnackbar('Something Went Wrong', { variant: 'error' });
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page title='Detail'>
|
<Page title='Detail'>
|
||||||
@@ -223,13 +365,14 @@ export default function Detail() {
|
|||||||
</Stack>
|
</Stack>
|
||||||
))}
|
))}
|
||||||
</Stack>
|
</Stack>
|
||||||
<Dialog open={openDialogRequest} onClose={handleCloseDialogUpdate} fullWidth={true}>
|
{/* Dialog Request Documents */}
|
||||||
|
<Dialog open={openDialogRequest} onClose={handleCloseDialogRequest} fullWidth={true}>
|
||||||
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
|
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
|
||||||
<Stack direction="row" alignItems="center" justifyContent="space-between">
|
<Stack direction="row" alignItems="center" justifyContent="space-between">
|
||||||
<Stack direction="row" alignItems='center' spacing={1}>
|
<Stack direction="row" alignItems='center' spacing={1}>
|
||||||
<Typography variant="h6">Request Document</Typography>
|
<Typography variant="h6">Request Document</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
<IconButton sx={{ color: '#FFF' }} onClick={handleCloseDialogUpdate}>
|
<IconButton sx={{ color: '#FFF' }} onClick={handleCloseDialogRequest}>
|
||||||
<CloseIcon />
|
<CloseIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -250,9 +393,11 @@ export default function Detail() {
|
|||||||
label="Supporting Result Document"
|
label="Supporting Result Document"
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
<Typography variant="Subtitle1" sx={{fontWeight: 'bold'}}>
|
||||||
|
Notes*
|
||||||
|
</Typography>
|
||||||
<TextField
|
<TextField
|
||||||
label="Note"
|
label="Detail Notes"
|
||||||
required
|
|
||||||
value={noteField ? noteField : ''}
|
value={noteField ? noteField : ''}
|
||||||
onChange={(e) =>{
|
onChange={(e) =>{
|
||||||
setNoteField(e.target.value);
|
setNoteField(e.target.value);
|
||||||
@@ -266,7 +411,7 @@ export default function Detail() {
|
|||||||
</Stack>
|
</Stack>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button variant="outlined" sx={{color: '#212B36'}} onClick={handleCloseDialogUpdate}>Cancel</Button>
|
<Button variant="outlined" sx={{color: '#212B36', borderColor: '#919EAB52'}} onClick={handleCloseDialogRequest}>Cancel</Button>
|
||||||
<Button sx={{backgroundColor: '#19BBBB'}} variant="contained" disabled={!isRequiredFieldsFilled()} onClick={() => handelRequestDocument()}>Request</Button>
|
<Button sx={{backgroundColor: '#19BBBB'}} variant="contained" disabled={!isRequiredFieldsFilled()} onClick={() => handelRequestDocument()}>Request</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
@@ -310,12 +455,199 @@ export default function Detail() {
|
|||||||
<Card sx={{padding: 3}}>
|
<Card sx={{padding: 3}}>
|
||||||
<Stack direction="row" alignItems="center" sx={{marginBottom: 4}}>
|
<Stack direction="row" alignItems="center" sx={{marginBottom: 4}}>
|
||||||
<Typography variant='subtitle1' sx={{color: '#19BBBB'}} gutterBottom>Service</Typography>
|
<Typography variant='subtitle1' sx={{color: '#19BBBB'}} gutterBottom>Service</Typography>
|
||||||
<Button variant="outlined" startIcon={<AddIcon/>} sx={{marginLeft: 'auto'}}>
|
{!serviceData ? (
|
||||||
|
<Button variant="outlined" startIcon={<AddIcon/>} sx={{marginLeft: 'auto'}} onClick={() => handleAddService()}>
|
||||||
<Typography variant="button" display="block">Service</Typography>
|
<Typography variant="button" display="block">Service</Typography>
|
||||||
</Button>
|
</Button>
|
||||||
|
) : (
|
||||||
|
<Stack sx={{marginLeft: 'auto'}}>
|
||||||
|
<TableMoreMenu actions={
|
||||||
|
<>
|
||||||
|
<MenuItem onClick={() => handleEditService()}>
|
||||||
|
<EditOutlinedIcon />
|
||||||
|
Edit
|
||||||
|
</MenuItem>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack direction="column" spacing={2} sx={{marginBottom: 2}}>
|
{serviceData ? (
|
||||||
</Stack>
|
<>
|
||||||
|
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
||||||
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Admission Date</Typography>
|
||||||
|
<Typography variant='subtitle2' sx={style2} gutterBottom>{serviceData && serviceData.addmission_date ? fDateTime(serviceData.addmission_date) : ''}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
||||||
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Discharge Date</Typography>
|
||||||
|
<Typography variant='subtitle2' sx={style2} gutterBottom>{serviceData && serviceData.discharge_date ? fDateTime(serviceData.discharge_date) : ''}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
||||||
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Serice Type</Typography>
|
||||||
|
<Typography variant='subtitle2' sx={style2} gutterBottom>{serviceData && serviceData.name_services ? serviceData.name_services : ''}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
||||||
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Benefit Name</Typography>
|
||||||
|
<Typography variant='subtitle2' sx={style2} gutterBottom>{serviceBenefitData && serviceBenefitData.name_benefits ? serviceBenefitData.name_benefits : ''}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
||||||
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Hospital</Typography>
|
||||||
|
<Typography variant='subtitle2' sx={style2} gutterBottom>{serviceData && serviceData.name_hospitals ? serviceData.name_hospitals : ''}</Typography>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
): ''}
|
||||||
|
|
||||||
|
{/* Dialog Service */}
|
||||||
|
<Dialog open={openDialogService} onClose={handleCloseDialogService} fullWidth={true}>
|
||||||
|
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
|
||||||
|
<Stack direction="row" alignItems="center" justifyContent="space-between">
|
||||||
|
<Stack direction="row" alignItems='center' spacing={1}>
|
||||||
|
<Typography variant="h6">{txtName}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<IconButton sx={{ color: '#FFF' }} onClick={handleCloseDialogService}>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
|
</Stack>
|
||||||
|
</DialogTitle>
|
||||||
|
<DialogContent>
|
||||||
|
<Stack spacing={2} sx={{marginTop: 2, padding: 2}} direction="column">
|
||||||
|
<Stack direction="row" spacing={2}>
|
||||||
|
<Stack direction="column" spacing={2}>
|
||||||
|
<Typography variant="Subtitle1" sx={{fontWeight: 'bold'}}>
|
||||||
|
Admission Date*
|
||||||
|
</Typography>
|
||||||
|
<LocalizationProvider dateAdapter={AdapterDateFns}>
|
||||||
|
<DatePicker
|
||||||
|
label="Admission Date"
|
||||||
|
value={dateAd}
|
||||||
|
onChange={(newValue) => {
|
||||||
|
setDateAd(newValue);
|
||||||
|
}}
|
||||||
|
inputFormat="dd MMM yyyy"
|
||||||
|
renderInput={(params) => <TextField sx={{width:'100%'}} {...params} defaultValue={formattedCurrentDate}/>}
|
||||||
|
/>
|
||||||
|
</LocalizationProvider>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction="column" spacing={2}>
|
||||||
|
<Typography variant="Subtitle1" sx={{fontWeight: 'bold'}}>
|
||||||
|
Discharge Date*
|
||||||
|
</Typography>
|
||||||
|
<LocalizationProvider dateAdapter={AdapterDateFns}>
|
||||||
|
<DatePicker
|
||||||
|
label="Discharge Date"
|
||||||
|
value={dateDis}
|
||||||
|
onChange={(newValue) => {
|
||||||
|
setDateDis(newValue);
|
||||||
|
}}
|
||||||
|
inputFormat="dd MMM yyyy"
|
||||||
|
renderInput={(params) => <TextField sx={{width:'100%'}} {...params} defaultValue={formattedCurrentDate}/>}
|
||||||
|
/>
|
||||||
|
</LocalizationProvider>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction="row" spacing={2}>
|
||||||
|
<Stack spacing={2} sx={{width:'100%'}}>
|
||||||
|
<Typography variant='subtitle1'>Service Type*</Typography>
|
||||||
|
<FormControl>
|
||||||
|
<InputLabel htmlFor="service_type">
|
||||||
|
Service Type
|
||||||
|
</InputLabel>
|
||||||
|
<Select
|
||||||
|
id="service_type"
|
||||||
|
value={valServiceType}
|
||||||
|
fullWidth
|
||||||
|
label="Service Type"
|
||||||
|
error={!!valServiceTypeError}
|
||||||
|
onChange={(e) => {
|
||||||
|
setValServiceType(e.target.value);
|
||||||
|
setValServiceTypeError(e.target.value === '' ? 'This field is required' : '');
|
||||||
|
}}
|
||||||
|
|
||||||
|
>
|
||||||
|
{serviceTypeData?.map((item, index) => (
|
||||||
|
<MenuItem key={index} value={item.id}>{item.name}</MenuItem>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
<FormHelperText style={{ color: 'red' }}>{valServiceTypeError}</FormHelperText>
|
||||||
|
</FormControl>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction="row" spacing={2}>
|
||||||
|
<Stack spacing={2} sx={{width:'100%'}}>
|
||||||
|
<Typography variant='subtitle1'>Benefit Name*</Typography>
|
||||||
|
<FormControl>
|
||||||
|
<InputLabel htmlFor="benefit_name">
|
||||||
|
Benefit Name
|
||||||
|
</InputLabel>
|
||||||
|
<Select
|
||||||
|
id="benefit_name"
|
||||||
|
value={valBenefitNames}
|
||||||
|
fullWidth
|
||||||
|
label="Benefit Name"
|
||||||
|
error={!!valBenefitNameError}
|
||||||
|
onChange={(e) => {
|
||||||
|
setValBenefitNames(e.target.value);
|
||||||
|
setValBenefitNameError(e.target.value.length === 0 ? 'At least one item must be selected' : '');
|
||||||
|
}}
|
||||||
|
renderValue={(selected) => selected.map(value => {
|
||||||
|
const selectedOption = benefitNameData.find(option => String(option.id) === value);
|
||||||
|
return selectedOption ? selectedOption.description : '';
|
||||||
|
}).join(', ')}
|
||||||
|
>
|
||||||
|
{benefitNameData?.map((item, index) => (
|
||||||
|
<FormGroup key={index} sx={{ marginLeft: 2 }}>
|
||||||
|
<FormControlLabel
|
||||||
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={valBenefitNames.includes(String(item.id))}
|
||||||
|
onChange={handleConditionChangeService}
|
||||||
|
value={String(item.id)}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={item.description}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
<FormHelperText style={{ color: 'red' }}>{valBenefitNameError}</FormHelperText>
|
||||||
|
</FormControl>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction="row" spacing={2}>
|
||||||
|
<Stack spacing={2} sx={{width:'100%'}}>
|
||||||
|
<Typography variant='subtitle1'>Hospital*</Typography>
|
||||||
|
<FormControl>
|
||||||
|
<InputLabel htmlFor="hospital">
|
||||||
|
Hospital
|
||||||
|
</InputLabel>
|
||||||
|
<Select
|
||||||
|
id="hospital"
|
||||||
|
value={valHospital}
|
||||||
|
fullWidth
|
||||||
|
label="Hospital"
|
||||||
|
error={!!valHospitalError}
|
||||||
|
onChange={(e) => {
|
||||||
|
setValHospital(e.target.value);
|
||||||
|
setValHospitalError(e.target.value === '' ? 'This field is required' : '');
|
||||||
|
}}
|
||||||
|
|
||||||
|
>
|
||||||
|
{hospitalData?.map((item, index) => (
|
||||||
|
<MenuItem key={index} value={item.id}>{item.name}</MenuItem>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
<FormHelperText style={{ color: 'red' }}>{valHospitalError}</FormHelperText>
|
||||||
|
</FormControl>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<Button variant="outlined" sx={{color: '#212B36', borderColor: '#919EAB52'}} onClick={handleCloseDialogService}>Cancel</Button>
|
||||||
|
<Button sx={{backgroundColor: '#19BBBB'}} variant="contained" disabled={!isRequiredFieldsServiceType()} onClick={() => handelSaveServiceType()}>Save</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</Dialog>
|
||||||
</Card>
|
</Card>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
|
|||||||
Reference in New Issue
Block a user