add fitur delete dan upload ulang file di FINAL log

This commit is contained in:
2024-02-09 16:58:03 +07:00
parent 7809e8828f
commit 2dad400486
11 changed files with 650 additions and 74 deletions

View File

@@ -1,7 +1,10 @@
import { Card, Typography } from "@mui/material";
import { Card, IconButton, Typography } from "@mui/material";
import { Stack } from '@mui/material';
import { DetailFinalLogType } from "../FinalLog/Model/Types";
import { fDate, fDateTimesecond, toTitleCase } from "@/utils/formatTime";
import { Button } from "@mui/material";
import AddIcon from '@mui/icons-material/Add';
import { Delete } from "@mui/icons-material";
type CardDetail = {
@@ -26,25 +29,40 @@ const marginBottom2 = {
export default function CardFile({requestLog} : CardDetail ) {
return (
<Card sx={{padding:2}} >
<Stack direction="row" alignItems="center" sx={{marginBottom: 4}}>
<Stack direction="row" alignItems="center" justifyContent="space-between" sx={{marginBottom: 4}}>
<Stack direction="column" spacing={2} sx={{marginBottom: 2}}>
<Typography variant='subtitle1' sx={{color: '#19BBBB'}} gutterBottom>Files </Typography>
{requestLog?.files?.map((documentType, index) => (
<Stack direction="column" spacing={2} key={index}>
<Stack direction="row" spacing={1} sx={{color: '#19BBBB'}}>
<a
href={documentType.url}
style={{ cursor: 'pointer', textDecoration: 'none', color: '#19BBBB' }}
target="_blank"
>
<Typography variant="body2" gutterBottom>{documentType.original_name ? documentType.original_name : '-'}</Typography>
</a>
</Stack>
<Typography variant='subtitle1' sx={{color: '#19BBBB'}} gutterBottom>Files </Typography>
</Stack>
<Stack direction="column" spacing={2} sx={{marginBottom: 2}}>
<Button variant="outlined" startIcon={<AddIcon/>} sx={{marginLeft: 'auto'}} onClick={() => {
// setDialogMedicine(true)
}} >
<Typography variant="button" display="block">Files</Typography>
</Button>
</Stack>
</Stack>
{requestLog?.files?.map((documentType, index) => (
<Stack direction="row" alignItems="center" justifyContent="space-between" sx={{marginBottom: 2}} key={index}>
<Stack direction="column" spacing={2} >
<a
href={documentType.url}
style={{ cursor: 'pointer', textDecoration: 'none', color: '#19BBBB' }}
target="_blank"
>
<Typography variant="body2" gutterBottom>{documentType.original_name ? documentType.original_name : '-'}</Typography>
</a>
</Stack>
))}
</Stack>
</Stack>
<Stack direction="column" spacing={2}>
<IconButton onClick={() => {}} aria-label="delete" size="small" sx={{ marginLeft: 'auto' }}>
<Delete color='error' fontSize="small" />
</IconButton>
</Stack>
</Stack>
))}
</Card>
)
}