"use client"; import React, { useState } from "react"; import { Box, Button, Typography, Paper, Container, useTheme, useMediaQuery, Chip, } from "@mui/material"; import CheckCircleIcon from "@mui/icons-material/CheckCircle"; import ArrowBackIcon from "@mui/icons-material/ArrowBack"; import ArrowForwardIcon from "@mui/icons-material/ArrowForward"; import BusinessIcon from "@mui/icons-material/Business"; import LocationOnIcon from "@mui/icons-material/LocationOn"; import LocalHospitalIcon from "@mui/icons-material/LocalHospital"; const TOTAL_STEPS = 12; const STEP_LABELS = [ "انتخاب مرکز", "موقعیت و آدرس", "وضعیت فوریت", "توضیحات تکمیلی", "ساعات کاری", "تصاویر مرکز", "تجهیزات موجود", "پرسنل", "بیمه‌های طرف قرارداد", "مجوزها", "شرایط پذیرش", "بررسی نهایی", ]; type CenterItem = { id: string; name: string; address: string; isUrgent: boolean; }; const centersMock: CenterItem[] = [ { id: "1", name: "مرکز درمانی امید", address: "تهران، خیابان ولیعصر، بالاتر از پارک ساعی، پلاک ۱۲۳", isUrgent: true, }, { id: "2", name: "کلینیک تخصصی مهر", address: "مشهد، بلوار وکیل‌آباد، بین وکیل‌آباد ۲۱ و ۲۳", isUrgent: false, }, { id: "3", name: "بیمارستان شبانه‌روزی آتیه", address: "اصفهان، خیابان شریعتی، کوچه ۸، ساختمان آتیه", isUrgent: true, }, { id: "4", name: "مرکز سلامت نوین", address: "شیراز، میدان مطهری، خیابان معدل، نبش کوچه ۶", isUrgent: false, }, ]; export default function CenterRegistrationForm() { const [activeStep, setActiveStep] = useState(1); const [maxStepReached, setMaxStepReached] = useState(1); const [selectedCenterId, setSelectedCenterId] = useState(null); const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down("md")); const selectedCenter = centersMock.find((center) => center.id === selectedCenterId) || null; const handleNext = () => { if (activeStep < TOTAL_STEPS) { const nextStep = activeStep + 1; setActiveStep(nextStep); if (nextStep > maxStepReached) setMaxStepReached(nextStep); } }; const handleBack = () => { if (activeStep > 1) setActiveStep((prev) => prev - 1); }; const goToStep = (step: number) => { if (step <= maxStepReached) setActiveStep(step); }; const renderCenterList = () => { return ( <> <> {centersMock.map((center) => { const isSelected = selectedCenterId === center.id; return (
setSelectedCenterId(center.id)} sx={{ p: 2.5, borderRadius: "18px", border: isSelected ? "2px solid #2563eb" : "1px solid #e2e8f0", backgroundColor: isSelected ? "#eff6ff" : "#fff", cursor: "pointer", transition: "all 0.25s ease", boxShadow: isSelected ? "0 10px 25px -15px rgba(37,99,235,0.45)" : "0 4px 12px rgba(15,23,42,0.04)", "&:hover": { transform: "translateY(-2px)", borderColor: "#2563eb", boxShadow: "0 12px 24px -16px rgba(37,99,235,0.35)", }, }} > {center.name} {center.address} } label={ center.isUrgent ? "استخدام فوری دارد" : "استخدام فوری ندارد" } sx={{ fontWeight: 700, backgroundColor: center.isUrgent ? "#fee2e2" : "#e2e8f0", color: center.isUrgent ? "#b91c1c" : "#475569", "& .MuiChip-icon": { color: center.isUrgent ? "#dc2626" : "#64748b", }, }} /> {isSelected && ( )}
); })} ); }; const renderStepContent = (step: number) => { switch (step) { case 1: return renderCenterList(); case 2: return selectedCenter ? ( مرکز انتخاب‌شده {selectedCenter.name} {selectedCenter.address} ) : ( ابتدا از مرحله قبل یک مرکز را انتخاب کنید. ); case 3: return selectedCenter ? ( وضعیت استخدام فوری {selectedCenter.isUrgent ? "این مرکز دارای استخدام فوری است." : "این مرکز در حال حاضر استخدام فوری ندارد."} ) : ( ابتدا یک مرکز انتخاب کنید. ); default: return ( محتوای مرحله «{STEP_LABELS[step - 1]}»
(در حال توسعه...)
); } }; return ( <>
{renderStepContent(activeStep)}
); }