diff --git a/src/pages/members/manage-members/CustomerDetailModal.tsx b/src/pages/members/manage-members/CustomerDetailModal.tsx index 1e3abfd..f52e42b 100644 --- a/src/pages/members/manage-members/CustomerDetailModal.tsx +++ b/src/pages/members/manage-members/CustomerDetailModal.tsx @@ -1,18 +1,9 @@ import React, { useState, useEffect } from "react"; import axios from 'axios'; -import { - Dialog, - DialogActions, - DialogContent, - DialogTitle, - TextField, - Button, - MenuItem, - Select, - InputLabel, - FormControl, - Typography +import { Dialog,DialogActions,DialogContent,DialogTitle,TextField,Button,MenuItem,Select,InputLabel,FormControl,Typography, + InputAdornment,Grid,Box } from "@mui/material"; +import UploadFileIcon from "@mui/icons-material/UploadFile"; import Divider from '@mui/material/Divider'; import { initialMember } from "./Columns"; import { apiConfig } from '@/config/api.config'; @@ -25,7 +16,7 @@ const CustomerDialog = ({ open, handleClose, handleSubmit, initialData, viewStat const [aldeias, setAldeias] = useState([]); const [postoAdm, setPostoAdm] = useState([]); const [sucos, setSucos] = useState([]); - + useEffect(() => { setFormData(initialData || {}); // Sync formData when initialData changes fetchMasterData() @@ -81,7 +72,11 @@ const CustomerDialog = ({ open, handleClose, handleSubmit, initialData, viewStat const handleChange = async (e: any) => { const { name, value } = e.target; if (name === 'municipio' || name === 'posto_adms' || name === 'suco') await getMasterAfter(name, value); - setFormData({ ...formData, [name]: value }); + if (name === "file_selfie" || name === "photouser") { // FOR FILE ONLY + setFormData({ ...formData, [name]: e.target.files[0] }); + } else { + setFormData({ ...formData, [name]: value }); + } }; async function getMasterAfter(name: string, id: any) { @@ -159,7 +154,7 @@ const CustomerDialog = ({ open, handleClose, handleSubmit, initialData, viewStat - + {fileTextFile("Photo", formData.photouser, "photouser", handleChange)} @@ -180,8 +175,17 @@ const CustomerDialog = ({ open, handleClose, handleSubmit, initialData, viewStat Passport + + {/* AGENT & PREMIUM DATA */} + + {fileTextFile("File Selfie", formData.file_selfie, "file_selfie", handleChange)} + {fileTextFile("File Document", formData.file_document_id, "file_document_id", handleChange)} + {fileTextFile("File Document & Selfie", formData.file_document_id_selfie, "file_document_id_selfie", handleChange)} + {fileTextFile("File Commercial License", formData.file_commercial_license, "file_commercial_license", handleChange)} + {/* AGENT & PREMIUM DATA */} + {/* */} {/* */} @@ -239,14 +243,25 @@ const CustomerDialog = ({ open, handleClose, handleSubmit, initialData, viewStat Bank - + + Bank Name + + - Approval + {getAdmAccess(page)} { page === 'kyc' ? ( - + <> + Approval + + ) : ('') } @@ -267,3 +282,74 @@ const CustomerDialog = ({ open, handleClose, handleSubmit, initialData, viewStat }; export default CustomerDialog; + +function fileTextFile(label: string, value: any, name: string, handleChange: any) { + return ( + + + + + ), + }} + /> + ) +} + +function getAdmAccess(page: string) { + if (page !== "kyc") { + return ( + + Access Administration + + + + Unblock PIN + + + + Reset PIN + + + + + + Change Group + + + + Edit Member + + + + + + ) + } else { + return ('') + } +} \ No newline at end of file