diff --git a/Modules/Internal/Http/Controllers/Api/RequestLogController.php b/Modules/Internal/Http/Controllers/Api/RequestLogController.php
index 28d1c5d7..08e7ea01 100644
--- a/Modules/Internal/Http/Controllers/Api/RequestLogController.php
+++ b/Modules/Internal/Http/Controllers/Api/RequestLogController.php
@@ -212,12 +212,17 @@ class RequestLogController extends Controller
public function update(Request $request, $id)
{
$requestLog = RequestLog::findOrFail($id);
+ $requestLog->submission_date = $request->submission_date;
$requestLog->keterangan = $request->keterangan;
$requestLog->hak_kamar_pasien = $request->hak_kamar_pasien;
$requestLog->penempatan_kamar = $request->penempatan_kamar;
$requestLog->catatan = $request->catatan;
+ $requestLog->reason = $request->reason;
+
+ if ($request->status){
+ $requestLog->status = $request->status;
+ }
- $requestLog->status = $request->status;
$requestLog->approved_by = auth()->user()->id;
$requestLog->approved_at = Carbon::now();
$requestLog->save();
diff --git a/Modules/Internal/Transformers/RequestLogShowResource.php b/Modules/Internal/Transformers/RequestLogShowResource.php
index 0d87a921..91a98752 100644
--- a/Modules/Internal/Transformers/RequestLogShowResource.php
+++ b/Modules/Internal/Transformers/RequestLogShowResource.php
@@ -113,6 +113,7 @@ class RequestLogShowResource extends JsonResource
'hak_kamar_pasien' => $requestLog['hak_kamar_pasien'],
'penempatan_kamar' => $requestLog['penempatan_kamar'],
'catatan' => $requestLog['catatan'],
+ 'reason' => $requestLog['reason'],
];
diff --git a/app/Models/RequestLog.php b/app/Models/RequestLog.php
index e8dcf199..def92923 100644
--- a/app/Models/RequestLog.php
+++ b/app/Models/RequestLog.php
@@ -38,6 +38,7 @@ class RequestLog extends Model
'import_system',
'diagnosis',
'code',
+ 'reason',
'approved_by',
'approved_at',
'approved_final_log_by',
diff --git a/database/migrations/2024_01_23_095631_add_column_reason_to_request_log.php b/database/migrations/2024_01_23_095631_add_column_reason_to_request_log.php
new file mode 100644
index 00000000..b5102060
--- /dev/null
+++ b/database/migrations/2024_01_23_095631_add_column_reason_to_request_log.php
@@ -0,0 +1,32 @@
+string('reason')->after('diagnosis')->default(null);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('request_logs', function (Blueprint $table) {
+ $table->dropColumn('reason');
+ });
+ }
+};
diff --git a/frontend/dashboard/src/pages/Corporates/Form.tsx b/frontend/dashboard/src/pages/Corporates/Form.tsx
index d349d07f..ab7b4ec8 100644
--- a/frontend/dashboard/src/pages/Corporates/Form.tsx
+++ b/frontend/dashboard/src/pages/Corporates/Form.tsx
@@ -542,7 +542,7 @@ export default function CorporateForm({ isEdit, currentCorporate }: Props) {
-
+
)}
diff --git a/frontend/dashboard/src/pages/CustomerService/Request/Components/DialogConfirmation.tsx b/frontend/dashboard/src/pages/CustomerService/Request/Components/DialogConfirmation.tsx
index d92edc43..2523e229 100644
--- a/frontend/dashboard/src/pages/CustomerService/Request/Components/DialogConfirmation.tsx
+++ b/frontend/dashboard/src/pages/CustomerService/Request/Components/DialogConfirmation.tsx
@@ -1,5 +1,5 @@
import MuiDialog from "@/components/MuiDialog";
-import { Button, Card, Checkbox, DialogActions, Grid, TextField, Typography } from "@mui/material";
+import { Button, Card, Checkbox, DialogActions, Grid, TextField, TextareaAutosize, Typography } from "@mui/material";
import { Paper } from "@mui/material";
import { Stack } from '@mui/material';
import React, { useEffect, useState } from 'react';
@@ -102,6 +102,16 @@ export default function DialogConfirmation({requestLog, setOpenDialog, openDialo
const numericInput = input.replace(/\D/g, '');
return numericInput;
};
+
+ const handleKeyPress = (e:any) => {
+ if (e.key === 'Enter' && !e.shiftKey) {
+ // Menghentikan default "Enter" (tidak membuat baris baru)
+ e.preventDefault();
+
+ // Menambahkan karakter baris baru
+ handleChange('keterangan', `${formData.keterangan}\n`);
+ }
+ };
const getContent = () => (
@@ -147,12 +157,20 @@ export default function DialogConfirmation({requestLog, setOpenDialog, openDialo
Keterangan
- handleChange('keterangan', e.target.value)}
+ onKeyDown={handleKeyPress}
+ style={{
+ width: '100%',
+ padding: '8px',
+ border: '1px solid #ced4da',
+ borderRadius: '4px',
+ fontSize: '14px',
+ }}
/>
diff --git a/frontend/dashboard/src/pages/CustomerService/Request/Components/DialogEditInformation.tsx b/frontend/dashboard/src/pages/CustomerService/Request/Components/DialogEditInformation.tsx
new file mode 100644
index 00000000..0d1ffb7b
--- /dev/null
+++ b/frontend/dashboard/src/pages/CustomerService/Request/Components/DialogEditInformation.tsx
@@ -0,0 +1,234 @@
+import MuiDialog from "@/components/MuiDialog";
+import { Button, Card, Checkbox, DialogActions, Grid, TextField, TextareaAutosize, Typography, Select } from "@mui/material";
+import { Paper } from "@mui/material";
+import { Stack } from '@mui/material';
+import React, { useEffect, useState } from 'react';
+import { DetailRequestLogType } from "../Model/Types";
+import { fDateOnly, fDateTimesecond, toTitleCase } from "@/utils/formatTime";
+import axios from "@/utils/axios";
+import { enqueueSnackbar } from "notistack";
+import { useNavigate } from "react-router";
+import { RHFSelect, RHFTextField, RHFEditor } from "@/components/hook-form";
+import { Autocomplete } from "@mui/material";
+// import { RHFEditor } from "@/components/hook-form/v2";
+
+
+type DialogConfirmationType = {
+ openDialog: boolean;
+ setOpenDialog: any;
+ onSubmit?: void;
+ requestLog: DetailRequestLogType|undefined;
+}
+
+export default function DialogEditInformation({requestLog, setOpenDialog, openDialog, onSubmit} : DialogConfirmationType ) {
+ const navigate = useNavigate();
+
+ const [formData, setFormData] = useState({
+ submission_date: requestLog?.submission_date,
+ keterangan: requestLog?.keterangan,
+ hak_kamar_pasien: requestLog?.hak_kamar_pasien,
+ penempatan_kamar: requestLog?.penempatan_kamar,
+ reason: requestLog?.reason
+ });
+
+ const [isReasonSelected, setIsReasonSelected] = useState(true);
+
+ useEffect(() => {
+ // Update formData setiap kali requestLog berubah
+ setFormData({
+ submission_date: requestLog?.submission_date || '',
+ keterangan: requestLog?.keterangan || '',
+ hak_kamar_pasien: requestLog?.hak_kamar_pasien || '',
+ penempatan_kamar: requestLog?.penempatan_kamar || '',
+ reason: requestLog?.reason || '',
+
+ });
+ }, [requestLog]);
+
+ const handleChange = (field, value) => {
+ setFormData((prevData) => ({
+ ...prevData,
+ [field]: value,
+ }));
+ if (field === 'reason') {
+ setIsReasonSelected(!!value);
+ }
+
+ };
+
+ const handleApprove = () => {
+ setFormData((prevData) => ({
+ ...prevData,
+ }));
+ handleSubmit();
+ };
+
+
+ const handleSubmit = () => {
+ if (isReasonSelected && formData.reason !== '') {
+ axios
+ .put(`customer-service/request/${requestLog?.id}`, formData)
+ .then((response) => {
+ enqueueSnackbar('Verification Request LOG Success', { variant: 'success' });
+ setOpenDialog(false);
+ navigate('/custormer-service/request')
+ })
+ .catch(({ response }) => {
+ enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' });
+ });
+ } else {
+ setIsReasonSelected(false);
+ alert('Silakan pilih alasan sebelum mengirimkan data.');
+ }
+ }
+
+ const style1 = {
+ color: '#919EAB',
+ width: '30%'
+ }
+ const style2 = {
+ width: '70%'
+ }
+ const marginBottom1 = {
+ marginBottom: 1,
+ }
+
+ const marginBottom2 = {
+ marginBottom: 2,
+ }
+
+ const resetForm = () => {
+ setFormData({
+ submission_date: requestLog?.submission_date ?? '',
+ keterangan: requestLog?.keterangan ?? '',
+ hak_kamar_pasien: requestLog?.hak_kamar_pasien ?? '',
+ penempatan_kamar: requestLog?.penempatan_kamar ?? '',
+ reason: requestLog?.reason ?? '',
+
+ });
+ };
+
+ const handleCloseDialog = () => {
+ setOpenDialog(false);
+ resetForm();
+ }
+
+ const handleNumericInput = (input: any) => {
+ const numericInput = input.replace(/\D/g, '');
+ return numericInput;
+ };
+
+ const handleKeyPress = (e:any) => {
+ if (e.key === 'Enter' && !e.shiftKey) {
+ // Menghentikan default "Enter" (tidak membuat baris baru)
+ e.preventDefault();
+
+ // Menambahkan karakter baris baru
+ handleChange('keterangan', `${formData.keterangan}\n`);
+ }
+ };
+
+ const reasons = [
+ { value: 'agreement', label: 'Agreement changed' },
+ { value: 'endorsement', label: 'Endorsement' },
+ { value: 'renewal', label: 'Renewal' },
+ { value: 'wrong_setting', label: 'Wrong Setting' },
+ // Add more options as needed
+ ];
+
+ const getContent = () => (
+
+ Are you sure to update this request ?
+
+
+
+ Addmision Date
+ handleChange('submission_date', e.target.value)}
+ />
+
+
+ Keterangan
+ handleChange('keterangan', e.target.value)}
+ onKeyDown={handleKeyPress}
+ style={{
+ width: '100%',
+ padding: '8px',
+ border: '1px solid #ced4da',
+ borderRadius: '4px',
+ fontSize: '14px',
+ }}
+ />
+ {/* */}
+
+
+ Hak Kamar Pasien
+ handleChange('hak_kamar_pasien', e.target.value)}
+ />
+
+
+ Penempatan Kamar
+ handleChange('penempatan_kamar', e.target.value)}
+ />
+
+
+ Reason*
+ option.label}
+ fullWidth
+ value={reasons.find((r) => r.value === formData.reason) || null} // Use find to match the default value
+ onChange={(e, newValue) => handleChange('reason', newValue?.value)}
+ renderInput={(params) => (
+
+ )}
+ />
+
+
+
+
+
+
+
+
+ );
+
+
+ return (
+
+ );
+}
\ No newline at end of file
diff --git a/frontend/dashboard/src/pages/CustomerService/Request/Detail.tsx b/frontend/dashboard/src/pages/CustomerService/Request/Detail.tsx
index 90add7dd..27348c18 100644
--- a/frontend/dashboard/src/pages/CustomerService/Request/Detail.tsx
+++ b/frontend/dashboard/src/pages/CustomerService/Request/Detail.tsx
@@ -5,6 +5,7 @@ import {
Typography,
Card,
Dialog,
+ MenuItem,
} from '@mui/material';
// components
import Page from '../../../components/Page';
@@ -20,6 +21,9 @@ import { DetailRequestLogType } from './Model/Types';
import { fDate, fDateTimesecond } from '@/utils/formatTime';
import { Button } from '@mui/material';
import DialogConfirmation from './Components/DialogConfirmation';
+import MoreMenu from '@/components/MoreMenu';
+import { EditOutlined } from '@mui/icons-material';
+import DialogEditInformation from './Components/DialogEditInformation';
// ----------------------------------------------------------------------
@@ -66,9 +70,10 @@ export default function Detail() {
const handleCloseDialogSubmit = () => {
setOpenDialogSubmit(false);
}
-
+
const [approve, setApprove] = useState('')
-
+
+ const [openDialogEdit, setOpenDialogEdit] = useState(false);
return (
@@ -79,7 +84,28 @@ export default function Detail() {
- Detail
+
+
+
+ Detail
+
+
+
+
+
+ >
+ }
+ />
+
+
+
Provider Name
{requestLog?.provider}
@@ -185,9 +211,20 @@ export default function Detail() {
openDialog={openDialogSubmit}
approve={approve}
>
+
) : null}
+
+
+
+
+
+
diff --git a/frontend/dashboard/src/pages/CustomerService/Request/Model/Types.tsx b/frontend/dashboard/src/pages/CustomerService/Request/Model/Types.tsx
index 5cd12404..63aa725c 100644
--- a/frontend/dashboard/src/pages/CustomerService/Request/Model/Types.tsx
+++ b/frontend/dashboard/src/pages/CustomerService/Request/Model/Types.tsx
@@ -50,8 +50,9 @@ export type DetailRequestLogType = {
hak_kamar_pasien : string,
penempatan_kamar : string,
provider : string,
- status : string,
+ status : string,
benefit : Benefit[],
+ reason : string
}
export type Benefit = {