update bugs upload file
This commit is contained in:
@@ -109,7 +109,7 @@ class ClaimRequestController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($request->hasFile('kondisi_files')) {
|
if ($request->hasFile('kondisi_files')) {
|
||||||
foreach ($request->result_files as $file) {
|
foreach ($request->kondisi_files as $file) {
|
||||||
$pathFile = File::storeFile('claim-kondisi', $newClaimRequest->id, $file);
|
$pathFile = File::storeFile('claim-kondisi', $newClaimRequest->id, $file);
|
||||||
$newClaimRequest->files()->updateOrCreate([
|
$newClaimRequest->files()->updateOrCreate([
|
||||||
'type' => 'claim-kondisi',
|
'type' => 'claim-kondisi',
|
||||||
@@ -137,7 +137,8 @@ class ClaimRequestController extends Controller
|
|||||||
$claimRequest->load([
|
$claimRequest->load([
|
||||||
'histories' => function ($history) {
|
'histories' => function ($history) {
|
||||||
$history->latest();
|
$history->latest();
|
||||||
}
|
},
|
||||||
|
'files',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return Helper::responseJson(data: ClaimRequestShowResource::make($claimRequest));
|
return Helper::responseJson(data: ClaimRequestShowResource::make($claimRequest));
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace Modules\HospitalPortal\Transformers;
|
namespace Modules\HospitalPortal\Transformers;
|
||||||
|
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class ClaimRequestShowResource extends JsonResource
|
class ClaimRequestShowResource extends JsonResource
|
||||||
{
|
{
|
||||||
@@ -25,6 +26,12 @@ class ClaimRequestShowResource extends JsonResource
|
|||||||
'histories' => $histories
|
'histories' => $histories
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Map Files by type
|
||||||
|
$filesGroupByType = $this->files->mapToGroups(function($file) {
|
||||||
|
return [Str::slug($file->type, '_') => $file];
|
||||||
|
});
|
||||||
|
$data['files_by_type'] = $filesGroupByType;
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,8 +291,8 @@ const DialogDetailClaim = ({ title, openDialog, setOpenDialog, data }: MuiDialog
|
|||||||
spacing={1}
|
spacing={1}
|
||||||
sx={{ marginY: 2 }}
|
sx={{ marginY: 2 }}
|
||||||
>
|
>
|
||||||
{claim.files_by_type?.result &&
|
{claim.files_by_type?.claim_result &&
|
||||||
claim.files_by_type.result.map((file, index) => (
|
claim.files_by_type.claim_result.map((file, index) => (
|
||||||
<Stack direction="row" justifyContent={'space-between'} key={index}>
|
<Stack direction="row" justifyContent={'space-between'} key={index}>
|
||||||
<a href={file.url} target="_blank" style={{ textDecoration: 'none' }}>
|
<a href={file.url} target="_blank" style={{ textDecoration: 'none' }}>
|
||||||
<Typography sx={{ color: 'text.secondary' }} variant="subtitle2">
|
<Typography sx={{ color: 'text.secondary' }} variant="subtitle2">
|
||||||
|
|||||||
@@ -292,8 +292,8 @@ const DialogDetailClaim = ({ title, openDialog, setOpenDialog, data }: MuiDialog
|
|||||||
spacing={1}
|
spacing={1}
|
||||||
sx={{ marginY: 2 }}
|
sx={{ marginY: 2 }}
|
||||||
>
|
>
|
||||||
{claim.files_by_type?.result &&
|
{claim.files_by_type?.claim_result &&
|
||||||
claim.files_by_type.result.map((file, index) => (
|
claim.files_by_type.claim_result.map((file, index) => (
|
||||||
<Stack direction="row" justifyContent={'space-between'} key={index}>
|
<Stack direction="row" justifyContent={'space-between'} key={index}>
|
||||||
<a href={file.url} target="_blank" style={{ textDecoration: 'none' }}>
|
<a href={file.url} target="_blank" style={{ textDecoration: 'none' }}>
|
||||||
<Typography sx={{ color: 'text.secondary' }} variant="subtitle2">
|
<Typography sx={{ color: 'text.secondary' }} variant="subtitle2">
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }) {
|
|||||||
style={{ display: 'none' }}
|
style={{ display: 'none' }}
|
||||||
multiple
|
multiple
|
||||||
onChange={handleKondisiInputChange}
|
onChange={handleKondisiInputChange}
|
||||||
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain"
|
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain, application/pdf"
|
||||||
/>
|
/>
|
||||||
<LoadingButton
|
<LoadingButton
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
@@ -260,7 +260,7 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }) {
|
|||||||
style={{ display: 'none' }}
|
style={{ display: 'none' }}
|
||||||
multiple
|
multiple
|
||||||
onChange={handleDiagnosaInputChange}
|
onChange={handleDiagnosaInputChange}
|
||||||
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain"
|
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain, application/pdf"
|
||||||
/>
|
/>
|
||||||
<LoadingButton
|
<LoadingButton
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
@@ -310,7 +310,7 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }) {
|
|||||||
style={{ display: 'none' }}
|
style={{ display: 'none' }}
|
||||||
multiple
|
multiple
|
||||||
onChange={handleResultInputChange}
|
onChange={handleResultInputChange}
|
||||||
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain"
|
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain, application/pdf"
|
||||||
/>
|
/>
|
||||||
<LoadingButton
|
<LoadingButton
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
|
|||||||
Reference in New Issue
Block a user