update bugs upload file
This commit is contained in:
@@ -109,7 +109,7 @@ class ClaimRequestController extends Controller
|
||||
}
|
||||
|
||||
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);
|
||||
$newClaimRequest->files()->updateOrCreate([
|
||||
'type' => 'claim-kondisi',
|
||||
@@ -137,7 +137,8 @@ class ClaimRequestController extends Controller
|
||||
$claimRequest->load([
|
||||
'histories' => function ($history) {
|
||||
$history->latest();
|
||||
}
|
||||
},
|
||||
'files',
|
||||
]);
|
||||
|
||||
return Helper::responseJson(data: ClaimRequestShowResource::make($claimRequest));
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Modules\HospitalPortal\Transformers;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ClaimRequestShowResource extends JsonResource
|
||||
{
|
||||
@@ -25,6 +26,12 @@ class ClaimRequestShowResource extends JsonResource
|
||||
'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;
|
||||
}
|
||||
|
||||
@@ -291,8 +291,8 @@ const DialogDetailClaim = ({ title, openDialog, setOpenDialog, data }: MuiDialog
|
||||
spacing={1}
|
||||
sx={{ marginY: 2 }}
|
||||
>
|
||||
{claim.files_by_type?.result &&
|
||||
claim.files_by_type.result.map((file, index) => (
|
||||
{claim.files_by_type?.claim_result &&
|
||||
claim.files_by_type.claim_result.map((file, index) => (
|
||||
<Stack direction="row" justifyContent={'space-between'} key={index}>
|
||||
<a href={file.url} target="_blank" style={{ textDecoration: 'none' }}>
|
||||
<Typography sx={{ color: 'text.secondary' }} variant="subtitle2">
|
||||
|
||||
@@ -292,8 +292,8 @@ const DialogDetailClaim = ({ title, openDialog, setOpenDialog, data }: MuiDialog
|
||||
spacing={1}
|
||||
sx={{ marginY: 2 }}
|
||||
>
|
||||
{claim.files_by_type?.result &&
|
||||
claim.files_by_type.result.map((file, index) => (
|
||||
{claim.files_by_type?.claim_result &&
|
||||
claim.files_by_type.claim_result.map((file, index) => (
|
||||
<Stack direction="row" justifyContent={'space-between'} key={index}>
|
||||
<a href={file.url} target="_blank" style={{ textDecoration: 'none' }}>
|
||||
<Typography sx={{ color: 'text.secondary' }} variant="subtitle2">
|
||||
|
||||
@@ -210,7 +210,7 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }) {
|
||||
style={{ display: 'none' }}
|
||||
multiple
|
||||
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
|
||||
variant="outlined"
|
||||
@@ -260,7 +260,7 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }) {
|
||||
style={{ display: 'none' }}
|
||||
multiple
|
||||
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
|
||||
variant="outlined"
|
||||
@@ -310,7 +310,7 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }) {
|
||||
style={{ display: 'none' }}
|
||||
multiple
|
||||
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
|
||||
variant="outlined"
|
||||
|
||||
Reference in New Issue
Block a user