fix show image document

This commit is contained in:
unknown
2025-04-01 22:38:34 +07:00
parent 5e5642d356
commit 28de8e64e8

View File

@ -163,16 +163,16 @@ const CustomerDialog = ({ open, handleClose, handleSubmit, initialData, viewStat
<FormControl fullWidth margin="dense"> <FormControl fullWidth margin="dense">
<InputLabel>Gender</InputLabel> <InputLabel>Gender</InputLabel>
<Select disabled={viewOnly} name="gender" value={formData.gender} onChange={handleChange}> <Select disabled={viewOnly} name="gender" value={formData.gender} onChange={handleChange}>
<MenuItem value="M">Male</MenuItem> <MenuItem key={1} value="M">Male</MenuItem>
<MenuItem value="F">Female</MenuItem> <MenuItem key={2} value="F">Female</MenuItem>
</Select> </Select>
</FormControl> </FormControl>
<FormControl fullWidth margin="dense"> <FormControl fullWidth margin="dense">
<InputLabel>Identity Type</InputLabel> <InputLabel>Identity Type</InputLabel>
<Select disabled={viewOnly} name="identity_type" value={formData.identity_type} onChange={handleChange}> <Select disabled={viewOnly} name="identity_type" value={formData.identity_type} onChange={handleChange}>
<MenuItem value="eleitoral_id">Eleitoral ID</MenuItem> <MenuItem key={1} value="eleitoral_id">Eleitoral ID</MenuItem>
<MenuItem value="bihete_de_identidade">Bihete de Identidade</MenuItem> <MenuItem key={2} value="bihete_de_identidade">Bihete de Identidade</MenuItem>
<MenuItem value="passport">Passport</MenuItem> <MenuItem key={3} value="passport">Passport</MenuItem>
</Select> </Select>
</FormControl> </FormControl>
@ -181,9 +181,13 @@ const CustomerDialog = ({ open, handleClose, handleSubmit, initialData, viewStat
<TextField disabled={viewOnly} type="number" fullWidth margin="dense" label="License Number" name="license_number" value={formData.license_number} onChange={handleChange} /> <TextField disabled={viewOnly} type="number" fullWidth margin="dense" label="License Number" name="license_number" value={formData.license_number} onChange={handleChange} />
<TextField disabled={viewOnly} type="text" fullWidth margin="dense" label="Merchant Address" name="merchantaddress" value={formData.merchantaddress} onChange={handleChange} /> <TextField disabled={viewOnly} type="text" fullWidth margin="dense" label="Merchant Address" name="merchantaddress" value={formData.merchantaddress} onChange={handleChange} />
{fileTextFile("File Selfie", formData.file_selfie, "file_selfie", handleChange)} {fileTextFile("File Selfie", formData.file_selfie, "file_selfie", handleChange)}
<img width={300} height={250} srcSet={formData.file_selfie} src={formData.file_selfie} alt={"file_selfie"} style={{borderRadius: 10}}/>
{fileTextFile("File Document", formData.file_document_id, "file_document_id", handleChange)} {fileTextFile("File Document", formData.file_document_id, "file_document_id", handleChange)}
<img width={300} height={250} srcSet={formData.file_document_id} src={formData.file_document_id} alt={"file_document_id"} style={{borderRadius: 10}}/>
{fileTextFile("File Document & Selfie", formData.file_document_id_selfie, "file_document_id_selfie", handleChange)} {fileTextFile("File Document & Selfie", formData.file_document_id_selfie, "file_document_id_selfie", handleChange)}
<img width={300} height={250} srcSet={formData.file_document_id_selfie} src={formData.file_document_id_selfie} alt={"file_document_id_selfie"} style={{borderRadius: 10}}/>
{fileTextFile("File Commercial License", formData.file_commercial_license, "file_commercial_license", handleChange)} {fileTextFile("File Commercial License", formData.file_commercial_license, "file_commercial_license", handleChange)}
<img width={300} height={250} srcSet={formData.file_commercial_license} src={formData.file_commercial_license} alt={"file_commercial_license"} style={{borderRadius: 10}}/>
{/* AGENT & PREMIUM DATA */} {/* AGENT & PREMIUM DATA */}
<TextField disabled={viewOnly} fullWidth margin="dense" label="Profession" name="profession" value={formData.profession} onChange={handleChange} /> <TextField disabled={viewOnly} fullWidth margin="dense" label="Profession" name="profession" value={formData.profession} onChange={handleChange} />
@ -192,8 +196,8 @@ const CustomerDialog = ({ open, handleClose, handleSubmit, initialData, viewStat
<FormControl fullWidth margin="dense"> <FormControl fullWidth margin="dense">
<InputLabel>Status</InputLabel> <InputLabel>Status</InputLabel>
<Select disabled={viewOnly} name="status" value={formData.status} onChange={handleChange}> <Select disabled={viewOnly} name="status" value={formData.status} onChange={handleChange}>
<MenuItem value="Y">Active</MenuItem> <MenuItem key={1} value="Y">Active</MenuItem>
<MenuItem value="N">Inactive</MenuItem> <MenuItem key={2} value="N">Inactive</MenuItem>
</Select> </Select>
</FormControl> </FormControl>
@ -246,10 +250,10 @@ const CustomerDialog = ({ open, handleClose, handleSubmit, initialData, viewStat
<FormControl fullWidth margin="dense"> <FormControl fullWidth margin="dense">
<InputLabel>Bank Name</InputLabel> <InputLabel>Bank Name</InputLabel>
<Select disabled={viewOnly} name="bank_name" value={formData.bank_name} onChange={handleChange}> <Select disabled={viewOnly} name="bank_name" value={formData.bank_name} onChange={handleChange}>
<MenuItem value="BNCTL">BNCTL</MenuItem> <MenuItem key={1} value="BNCTL">BNCTL</MenuItem>
<MenuItem value="BRI">BRI</MenuItem> <MenuItem key={2} value="BRI">BRI</MenuItem>
<MenuItem value="BNU">BNU</MenuItem> <MenuItem key={3} value="BNU">BNU</MenuItem>
<MenuItem value="Mandiri">Mandiri</MenuItem> <MenuItem key={4} value="Mandiri">Mandiri</MenuItem>
</Select> </Select>
</FormControl> </FormControl>
<TextField disabled={viewOnly} fullWidth margin="dense" label="Bank Account" name="bank_account" value={formData.bank_account} onChange={handleChange} /> <TextField disabled={viewOnly} fullWidth margin="dense" label="Bank Account" name="bank_account" value={formData.bank_account} onChange={handleChange} />
@ -286,37 +290,37 @@ export default CustomerDialog;
function fileTextFile(label: string, value: any, name: string, handleChange: any) { function fileTextFile(label: string, value: any, name: string, handleChange: any) {
return ( return (
<TextField <TextField
margin="dense" margin="dense"
label={label} label={label}
variant="outlined" variant="outlined"
fullWidth fullWidth
value={value} value={value}
placeholder="Choose a file..." placeholder="Choose a file..."
InputProps={{ InputProps={{
readOnly: true, readOnly: true,
endAdornment: ( endAdornment: (
<InputAdornment position="end"> <InputAdornment position="end">
<input <input
type="file" type="file"
id="file-upload" id="file-upload"
style={{ display: "none" }} style={{ display: "none" }}
onChange={handleChange} onChange={handleChange}
name={name} name={name}
/> />
<label htmlFor="file-upload"> <label htmlFor="file-upload">
<Button <Button
component="span" component="span"
variant="contained" variant="contained"
color="primary" color="primary"
startIcon={<UploadFileIcon />} startIcon={<UploadFileIcon />}
> >
Browse Browse
</Button> </Button>
</label> </label>
</InputAdornment> </InputAdornment>
), ),
}} }}
/> />
) )
} }