Merge branch 'feature/maintainer' into 'develop'

debug uploading system

See merge request witel3/loan-facilities-user!10
This commit is contained in:
2023-07-19 07:04:44 +00:00
3 changed files with 20 additions and 3 deletions

View File

@@ -98,6 +98,8 @@
"text_field_enter_your_shenasname_id": "شماره شناسنامه خود را وارد کنید", "text_field_enter_your_shenasname_id": "شماره شناسنامه خود را وارد کنید",
"text_field_plate_number": "شماره پلاک", "text_field_plate_number": "شماره پلاک",
"text_field_enter_your_plate_number": "شماره پلاک خود را وارد کنید", "text_field_enter_your_plate_number": "شماره پلاک خود را وارد کنید",
"button_submit": "ثبت درخواست" "button_submit": "ثبت درخواست",
"file_field_shenasname_image": "تصویر شناسنامه",
"file_field_national_card_image": "تصویر کارت ملی"
} }
} }

View File

@@ -29,9 +29,9 @@ const WelfareServicesForm = () => {
const handleUploadChangeShenasname = (event, setFieldValue) => { const handleUploadChangeShenasname = (event, setFieldValue) => {
const uploadedFile = event.target?.files?.[0]; const uploadedFile = event.target?.files?.[0];
const fileType = event.target.files[0].type;
const fileName = event.target.files[0].name;
if (uploadedFile) { if (uploadedFile) {
const fileType = event.target?.files?.[0].type;
const fileName = event.target?.files?.[0].name;
setSelectedImageShenasname(URL.createObjectURL(uploadedFile)); setSelectedImageShenasname(URL.createObjectURL(uploadedFile));
setFileTypeShenasname(fileType); setFileTypeShenasname(fileType);
setFileNameShenasname(fileName); setFileNameShenasname(fileName);
@@ -380,6 +380,7 @@ const WelfareServicesForm = () => {
fileName={fileNameShenasname} fileName={fileNameShenasname}
imageAlt={t("app_name")} imageAlt={t("app_name")}
imageSize={[300 /*width*/, 150 /*height*/]} imageSize={[300 /*width*/, 150 /*height*/]}
label={t("LoanRequest.file_field_shenasname_image")}
/> />
<UploadSystem <UploadSystem
selectedImage={selectedImageNationalCard} selectedImage={selectedImageNationalCard}
@@ -393,6 +394,7 @@ const WelfareServicesForm = () => {
fileName={fileNameNationalCard} fileName={fileNameNationalCard}
imageAlt={t("app_name")} imageAlt={t("app_name")}
imageSize={[300 /*width*/, 150 /*height*/]} imageSize={[300 /*width*/, 150 /*height*/]}
label={t("LoanRequest.file_field_national_card_image")}
/> />
</Box> </Box>
<Box <Box

View File

@@ -14,6 +14,7 @@ const UploadSystem = ({
imageSize, imageSize,
fileType, fileType,
fileName, fileName,
label,
}) => { }) => {
const t = useTranslations(); const t = useTranslations();
const fileInputRef = useRef(null); const fileInputRef = useRef(null);
@@ -39,6 +40,17 @@ const UploadSystem = ({
return ( return (
<Box sx={{ width: imageSize[0], my: 2 }}> <Box sx={{ width: imageSize[0], my: 2 }}>
<Typography
margin={2}
sx={{
fontWeight: 500,
fontSize: "1rem",
color: "#a19d9d",
}}
textAlign="center"
>
{label}
</Typography>
{selectedImage === "/images/upload-image.svg" ? ( {selectedImage === "/images/upload-image.svg" ? (
<Image <Image
width={imageSize[0]} width={imageSize[0]}
@@ -84,6 +96,7 @@ const UploadSystem = ({
alignItems: "center", alignItems: "center",
justifyContent: "center", justifyContent: "center",
}} }}
onClick={handleClick}
> >
<Typography <Typography
margin={2} margin={2}