import { forwardRef , ReactElement , Ref } from "react" import Dialog from '@mui/material/Dialog'; import DialogTitle from '@mui/material/DialogTitle'; import { useDispatch } from "react-redux"; import { AppDispatch, useAppSelector } from "@/redux/store"; import { setDetailsPopUp } from "@/redux/features/members-slice" import { useTranslations } from "next-intl"; import { useTheme } from '@mui/material/styles'; import useMediaQuery from '@mui/material/useMediaQuery'; import Slide from '@mui/material/Slide'; import { TransitionProps } from '@mui/material/transitions'; import { Formik } from 'formik'; import DialogContent from '@mui/material/DialogContent'; import DialogContentText from '@mui/material/DialogContentText'; import DialogActions from '@mui/material/DialogActions'; export default function ServiceDetailsPopUp() { // declare the needed variables // redux const dispatch = useDispatch(); // intl-18 const t = useTranslations('members'); // mui const theme = useTheme(); const fullScreen = useMediaQuery(theme.breakpoints.down('md')); // get state from redux const detailsPopUp = useAppSelector((state) => state.membersReducer.value.detailsPopUp) const detailsPopUpData = useAppSelector((state) => state.membersReducer.value.detailsPopUpData) // setup the popup animation const Transition = forwardRef(function Transition( props: TransitionProps & { children: ReactElement; }, ref: Ref, ) { return ; }); // setup the function that close the popup const handleClose = () => { dispatch(setDetailsPopUp({ status: false, data: null })); }; // we dont mount the pop up if we dont need it if(!detailsPopUp) return <> // convert unix into read able date function UnixToReadAbleDate(unix_time : number) { let dateObj = new Date(unix_time * 1000) // we got the year let year = dateObj.getUTCFullYear(), // get month month = dateObj.getUTCMonth(), // get day day = dateObj.getUTCDay(), // get the hours hours = dateObj.getUTCHours(), // minutes minutes = dateObj.getUTCMinutes(), // seconds seconds = dateObj.getUTCSeconds(); // now we format the string let formattedTime = year.toString()+ '-' + month.toString() + '-' + day.toString(); return formattedTime; } // we mount the popup if we needed it return ( { // This is the title of the pop up }

{t('memberDetails')}

handleClose()} className="fill-primary-dark dark:fill-primary cursor-pointer">
{ // Formik form start from here } { handleClose(); }} > {({ handleChange, handleBlur, handleSubmit, }) => ( <>
{ // dialog content contain the formik form } { // dialog text content contain a small description to the current form part }

{t('memberDetailsText1')}

{t('identificationInformation')}

{t('gendre')}

{t('contactInformations')}