add edit provider prime center
This commit is contained in:
@@ -31,6 +31,16 @@ class OrganizationController extends Controller
|
||||
return response()->json(OrganizationResource::collection($organizations));
|
||||
}
|
||||
|
||||
public function organizations()
|
||||
{
|
||||
$data = Organization::hospital()->select('id', 'name', 'code')->get();
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'data' => OrganizationResource::collection($data)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return Renderable
|
||||
|
||||
@@ -56,6 +56,7 @@ use Modules\Internal\Http\Controllers\ClaimEncounterController;
|
||||
use Modules\Linksehat\Http\Controllers\Api\AutocompleteController;
|
||||
use Modules\HospitalPortal\Http\Controllers\Api\MemberController as MemberControllerHospitalPortal;
|
||||
use Modules\HospitalPortal\Http\Controllers\Api\RequestLogController as RequestLogControllerHospitalPortal;
|
||||
use Modules\Primaya\Http\Controllers\Api\MasterController;
|
||||
|
||||
|
||||
|
||||
@@ -397,6 +398,8 @@ Route::prefix('internal')->group(function () {
|
||||
Route::get('search-organizations', [OrganizationController::class, 'searchOrganization']);
|
||||
Route::get('search-specialities', [SpecialityController::class, 'searchSpeciality']);
|
||||
Route::resource('organizations', OrganizationController::class);
|
||||
Route::get('organizations', [MasterController::class, 'organizations']);
|
||||
|
||||
Route::resource('appointments', AppointmentController::class);
|
||||
Route::get('live-chat/export', [LivechatController::class, 'export']);
|
||||
Route::resource('live-chat', LivechatController::class);
|
||||
|
||||
@@ -22,6 +22,7 @@ use App\Models\ClaimRequest;
|
||||
use App\Models\CorporateBenefit;
|
||||
use App\Models\RequestLogBenefit;
|
||||
use App\Models\Speciality;
|
||||
use Modules\Internal\Transformers\OrganizationResource;
|
||||
|
||||
class MasterController extends Controller
|
||||
{
|
||||
@@ -53,11 +54,11 @@ class MasterController extends Controller
|
||||
|
||||
public function organizations()
|
||||
{
|
||||
$data = Organization::select('id', 'name', 'code')->get();
|
||||
$data = Organization::hospital()->select('id', 'name', 'code')->get();
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'data' => $data
|
||||
'data' => OrganizationResource::collection($data)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ type DialogConfirmationType = {
|
||||
openDialog: boolean;
|
||||
setOpenDialog: any;
|
||||
onSubmit?: void;
|
||||
requestLog: DetailFinalLogType|undefined;
|
||||
requestLog: DetailFinalLogType|undefined;
|
||||
}
|
||||
|
||||
export default function DialogEditFinalLOG({requestLog, setOpenDialog, openDialog, onSubmit} : DialogConfirmationType ) {
|
||||
@@ -28,11 +28,13 @@ export default function DialogEditFinalLOG({requestLog, setOpenDialog, openDialo
|
||||
catatan: requestLog?.catatan,
|
||||
icdCodes: requestLog?.diagnosis,
|
||||
reason: requestLog?.reason,
|
||||
type_of_member: requestLog?.type_of_member
|
||||
type_of_member: requestLog?.type_of_member,
|
||||
organization_id: requestLog?.organization_id || 0,
|
||||
|
||||
});
|
||||
|
||||
const [error, setError] = useState(false);
|
||||
|
||||
|
||||
const [icdOptions, setIcdOptions] = useState([
|
||||
{ value: '-', label: '-' }
|
||||
]);
|
||||
@@ -48,9 +50,9 @@ export default function DialogEditFinalLOG({requestLog, setOpenDialog, openDialo
|
||||
.catch((error) => {
|
||||
console.error('Error fetching ICD options:', error);
|
||||
});
|
||||
|
||||
|
||||
}, []); // useEffect dijalankan hanya sekali saat komponen dimount
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
setFormData({
|
||||
discharge_date: requestLog?.discharge_date|| '',
|
||||
@@ -61,7 +63,10 @@ export default function DialogEditFinalLOG({requestLog, setOpenDialog, openDialo
|
||||
icdCodes: requestLog?.diagnosis|| [],
|
||||
reason: requestLog?.reason|| '',
|
||||
type_of_member: requestLog?.type_of_member|| '',
|
||||
organization_id: requestLog?.organization_id || 0,
|
||||
|
||||
});
|
||||
setIdProvider(requestLog?.organization_id || 0);
|
||||
}, [requestLog]);
|
||||
|
||||
|
||||
@@ -93,13 +98,13 @@ export default function DialogEditFinalLOG({requestLog, setOpenDialog, openDialo
|
||||
console.error('Error fetching ICD options:', error);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
const handleSubmit = () => {
|
||||
if (formData.type_of_member == "" && requestLog?.corporate_id == 5) {
|
||||
setError(true);
|
||||
alert('Silakan pilih Type Of Member sebelum mengirimkan data.');
|
||||
}
|
||||
}
|
||||
else if (isReasonSelected && formData.reason !== '') {
|
||||
axios
|
||||
.post(`customer-service/request/final-log`, formData)
|
||||
@@ -117,7 +122,7 @@ export default function DialogEditFinalLOG({requestLog, setOpenDialog, openDialo
|
||||
alert('Silakan pilih alasan sebelum mengirimkan data.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const style1 = {
|
||||
color: '#919EAB',
|
||||
width: '30%'
|
||||
@@ -140,12 +145,14 @@ export default function DialogEditFinalLOG({requestLog, setOpenDialog, openDialo
|
||||
invoice_no: requestLog?.invoice_no ?? '',
|
||||
catatan: requestLog?.catatan ?? '',
|
||||
icdCodes: requestLog?.diagnosis ?? [],
|
||||
reason: requestLog?.reason ?? '',
|
||||
reason: requestLog?.reason ?? '',
|
||||
type_of_member: requestLog?.type_of_member ?? '',
|
||||
organization_id: requestLog?.organization_id || 0,
|
||||
|
||||
});
|
||||
};
|
||||
const [isReasonSelected, setIsReasonSelected] = useState(true);
|
||||
|
||||
|
||||
const handleCloseDialog = () => {
|
||||
setOpenDialog(false);
|
||||
resetForm();
|
||||
@@ -161,6 +168,27 @@ export default function DialogEditFinalLOG({requestLog, setOpenDialog, openDialo
|
||||
|
||||
// console.log(formData.type_of_member)
|
||||
|
||||
const [providers, setProviders] = useState([]);
|
||||
const [idProvider, setIdProvider] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
axios
|
||||
.get('/organizations')
|
||||
.then((res) => {
|
||||
setProviders(res.data.data || []);
|
||||
})
|
||||
.catch((err) => console.error(err));
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (requestLog?.organization_id) {
|
||||
console.log(requestLog?.organization_id);
|
||||
setIdProvider(requestLog.organization_id);
|
||||
console.log(idProvider);
|
||||
}
|
||||
}, [requestLog]);
|
||||
|
||||
const getContent = () => (
|
||||
<Stack spacing={1} marginTop={2}>
|
||||
<Typography variant="subtitle2">Are you sure to edit this final log ?</Typography>
|
||||
@@ -193,6 +221,26 @@ export default function DialogEditFinalLOG({requestLog, setOpenDialog, openDialo
|
||||
</Card>
|
||||
|
||||
<Card sx={{padding:2, marginTop:2}} >
|
||||
<Stack direction="row" spacing={2} sx={marginBottom2}>
|
||||
<Typography variant="subtitle2" sx={style1} gutterBottom>
|
||||
Provider
|
||||
</Typography>
|
||||
|
||||
<Autocomplete
|
||||
options={providers}
|
||||
getOptionLabel={(option) => option.name?.trim() || '-'}
|
||||
value={providers.find((item) => item.id == idProvider) || null}
|
||||
onChange={(event, newValue) => {
|
||||
const id = newValue?.id || 0;
|
||||
setIdProvider(id);
|
||||
handleChange('organization_id', id);
|
||||
}}
|
||||
renderInput={(params) => (
|
||||
<TextField {...params} label="Provider" fullWidth />
|
||||
)}
|
||||
fullWidth
|
||||
/>
|
||||
</Stack>
|
||||
<Stack direction='row' spacing={2} sx={marginBottom2}>
|
||||
<Typography variant='subtitle2' sx={style1} gutterBottom>Invoice Provider</Typography>
|
||||
<TextField
|
||||
|
||||
@@ -49,6 +49,8 @@ import { LoadingButton } from '@mui/lab';
|
||||
import { makeFormData } from '@/utils/jsonToFormData';
|
||||
import TextField from '@mui/material/TextField';
|
||||
import { fPostFormat } from '@/utils/formatTime';
|
||||
import { parse } from 'date-fns';
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -86,16 +88,29 @@ import { format } from 'date-fns';
|
||||
|
||||
export default function Detail() {
|
||||
//dari hospital portal
|
||||
const [dischargeDate, setDischargeDate] = useState<string>(format(new Date(), "yyyy MMM d HH:mm:ss"));
|
||||
const [serviceOptions, setServiceOptions] = useState([
|
||||
{ value: '-', label: '-' }
|
||||
]);
|
||||
const [specialisOptions, setSpecialisOptions] = useState([
|
||||
{ value: '-', label: '-' }
|
||||
]);
|
||||
// const [dischargeDate, setDischargeDate] = useState<string>(format(new Date(), "yyyy MMM d HH:mm:ss"));
|
||||
const [dischargeDate, setDischargeDate] = useState<Date | null>(null)
|
||||
|
||||
|
||||
// const [serviceOptions, setServiceOptions] = useState([
|
||||
// { value: '-', label: '-' }
|
||||
// ]);
|
||||
// const [specialisOptions, setSpecialisOptions] = useState([
|
||||
// { value: '-', label: '-' }
|
||||
// ]);
|
||||
|
||||
const [serviceOptions, setServiceOptions] = useState<
|
||||
{ value: string; label: string }[]
|
||||
>([])
|
||||
|
||||
const [specialisOptions, setSpecialisOptions] = useState<
|
||||
{ value: number; label: string }[]
|
||||
>([])
|
||||
const [serviceCode, setServiceCode] = useState<string>("");
|
||||
const [idSpecialities, setIdSpecialities] = useState("");
|
||||
const [idSpecialities, setIdSpecialities] = useState<number | null>(null)
|
||||
|
||||
const [inputDppj, setInputDppj] = useState("");
|
||||
const [requestLog, setRequestLog] = useState<DetailFinalLogType>();
|
||||
function submitRequestFinalLog() {
|
||||
if(dischargeDate == '')
|
||||
{
|
||||
@@ -120,6 +135,7 @@ function submitRequestFinalLog() {
|
||||
// result_files: fileHasilPenunjangs,
|
||||
// diagnosa_files: fileDiagnosas,
|
||||
// kondisi_files: fileKondisis,
|
||||
request_logs_id: requestLog?.id,
|
||||
discharge_date: fPostFormat(dischargeDate, 'yyyy-MM-dd HH:mm:ss'),
|
||||
service_code: serviceCode,
|
||||
spescialis_id: idSpecialities,
|
||||
@@ -147,7 +163,7 @@ function submitRequestFinalLog() {
|
||||
|
||||
const navigate = useNavigate();
|
||||
const { themeStretch } = useSettings();
|
||||
const [requestLog, setRequestLog] = useState<DetailFinalLogType>();
|
||||
|
||||
const [isReversal, setIsReversal] = useState(false);
|
||||
const [submitLoading, setSubmitLoading] = useState(false);
|
||||
|
||||
@@ -337,6 +353,40 @@ function submitRequestFinalLog() {
|
||||
);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (requestLog?.discharge_date) {
|
||||
setDischargeDate(
|
||||
parse(
|
||||
requestLog.discharge_date,
|
||||
'yyyy-MM-dd HH:mm:ss',
|
||||
new Date()
|
||||
)
|
||||
)
|
||||
}
|
||||
}, [requestLog?.discharge_date])
|
||||
useEffect(() => {
|
||||
if (!requestLog) return
|
||||
setServiceCode(requestLog.service_code ?? '')
|
||||
setIdSpecialities(requestLog.specialitiesID ?? null)
|
||||
setInputDppj(requestLog.dppj ?? '')
|
||||
}, [requestLog])
|
||||
const selectedService = useMemo(
|
||||
() =>
|
||||
serviceOptions.find(
|
||||
(o) => String(o.value) === String(serviceCode)
|
||||
) || null,
|
||||
[serviceOptions, serviceCode]
|
||||
)
|
||||
console.log(serviceOptions);
|
||||
console.log(serviceCode);
|
||||
const selectedSpecialis = useMemo(
|
||||
() =>
|
||||
specialisOptions.find(
|
||||
(o) => Number(o.value) === Number(idSpecialities)
|
||||
) || null,
|
||||
[specialisOptions, idSpecialities]
|
||||
)
|
||||
|
||||
return (
|
||||
<Page title='Detail'>
|
||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
||||
@@ -354,7 +404,7 @@ function submitRequestFinalLog() {
|
||||
Detail
|
||||
</Typography>
|
||||
</Grid>
|
||||
{requestLog?.status_final_log != 'requested' ? (
|
||||
{requestLog?.status_final_log != 'approved' ? (
|
||||
<Grid item xs={6} sx={{ display: 'flex', placeContent: 'end' }}>
|
||||
<MoreMenu
|
||||
actions={
|
||||
@@ -531,7 +581,7 @@ function submitRequestFinalLog() {
|
||||
{/* Kolom Service Type */}
|
||||
<Stack spacing={2} sx={{ flex: 1 }}>
|
||||
<Typography variant="subtitle1">Tipe Service </Typography>
|
||||
<Autocomplete
|
||||
{/* <Autocomplete
|
||||
id="service_type"
|
||||
options={serviceOptions}
|
||||
getOptionLabel={(option) => option.label || ""}
|
||||
@@ -542,7 +592,17 @@ function submitRequestFinalLog() {
|
||||
renderInput={(params) => (
|
||||
<TextField {...params} label='Tipe Service' fullWidth />
|
||||
)}
|
||||
/>
|
||||
/> */}
|
||||
<Autocomplete
|
||||
options={serviceOptions}
|
||||
value={selectedService}
|
||||
getOptionLabel={(o) => o.label}
|
||||
isOptionEqualToValue={(o, v) => o.value === v.value}
|
||||
onChange={(_, v) => setServiceCode(v?.value ?? '')}
|
||||
renderInput={(params) => (
|
||||
<TextField {...params} label="Tipe Service" fullWidth />
|
||||
)}
|
||||
/>
|
||||
<FormHelperText style={{ color: "red" }}></FormHelperText>
|
||||
</Stack>
|
||||
</Stack>
|
||||
@@ -551,7 +611,7 @@ function submitRequestFinalLog() {
|
||||
<Stack direction="row" spacing={2}>
|
||||
<Stack spacing={2} sx={{ width: '100%' }}>
|
||||
<Typography variant='subtitle1'>Spesialis </Typography>
|
||||
<Autocomplete
|
||||
{/* <Autocomplete
|
||||
id='specialities'
|
||||
options={specialisOptions}
|
||||
getOptionLabel={(option) => option.label || ''}
|
||||
@@ -562,6 +622,16 @@ function submitRequestFinalLog() {
|
||||
renderInput={(params) => (
|
||||
<TextField {...params} label="Spesialis" fullWidth />
|
||||
)}
|
||||
/> */}
|
||||
<Autocomplete
|
||||
options={specialisOptions}
|
||||
value={selectedSpecialis}
|
||||
getOptionLabel={(o) => o.label}
|
||||
isOptionEqualToValue={(o, v) => o.value === v.value}
|
||||
onChange={(_, v) => setIdSpecialities(v?.value ?? null)}
|
||||
renderInput={(params) => (
|
||||
<TextField {...params} label="Spesialis" fullWidth />
|
||||
)}
|
||||
/>
|
||||
<FormHelperText style={{ color: 'red' }}></FormHelperText>
|
||||
</Stack>
|
||||
|
||||
@@ -35,6 +35,7 @@ export type DetailFinalLogType = {
|
||||
id : number,
|
||||
code : string,
|
||||
member_id : string,
|
||||
organization_id : any,
|
||||
id_member : string,
|
||||
service_code : string,
|
||||
specialitiesID : any,
|
||||
|
||||
@@ -35,6 +35,7 @@ export type DetailFinalLogType = {
|
||||
id : number,
|
||||
code : string,
|
||||
member_id : string,
|
||||
organization_id : any,
|
||||
id_member : string,
|
||||
service_code : string,
|
||||
specialitiesID : any,
|
||||
|
||||
Reference in New Issue
Block a user