import React, { useState, useEffect } from 'react'; import { Dialog, DialogTitle, DialogContent, IconButton, Typography, Box, TextField, MenuItem, Button, Alert, CircularProgress, } from '@mui/material'; import { X, Send, CheckCircle2, MessageCircle } from 'lucide-react'; import confetti from 'canvas-confetti'; import { useQuote } from '../../../context/QuoteContext'; import { PRODUCTS } from '../../../data/productsData'; import { COMPANY_INFO } from '../../../data/companyData'; import { InquiryFormData } from '../../../types'; export const QuoteModal: React.FC = () => { const { isQuoteModalOpen, selectedProductForQuote, closeQuoteModal } = useQuote(); const [formData, setFormData] = useState({ name: '', companyName: '', email: '', phone: '', country: '', productInterest: '', estimatedQuantity: '1x20ft Container (FCL)', packagingPreference: '25kg Paper / PP Bags', destinationPort: '', message: '', }); const [submitted, setSubmitted] = useState(false); const [loading, setLoading] = useState(false); useEffect(() => { if (selectedProductForQuote) { setFormData((prev) => ({ ...prev, productInterest: selectedProductForQuote, })); } else { setFormData((prev) => ({ ...prev, productInterest: 'All / Multiple Products', })); } }, [selectedProductForQuote, isQuoteModalOpen]); const handleChange = (e: React.ChangeEvent) => { const { name, value } = e.target; setFormData((prev) => ({ ...prev, [name]: value })); }; const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setTimeout(() => { setLoading(false); setSubmitted(true); confetti({ particleCount: 80, spread: 70, origin: { y: 0.6 }, }); }, 800); }; const handleReset = () => { setSubmitted(false); closeQuoteModal(); }; const whatsappDirectMsg = `Hello Mani Agro Exports, I am ${formData.name || 'a buyer'} from ${formData.companyName || 'our company'}. We require a quote for ${formData.productInterest || 'agro commodities'}. Quantity: ${formData.estimatedQuantity}. Port: ${formData.destinationPort || 'Overseas Port'}.`; return ( Direct B2B Export Inquiries Request Quotation & Samples {submitted ? ( Inquiry Successfully Received! Thank you, {formData.name}. Mihir Motiyani and the Mani Agro Exports team will review your specifications and contact you shortly with commercial pricing and sample details. ) : ( Looking for commercial pricing, custom mesh size, ASTA color, or sample dispatch? Fill out your requirements below for an immediate response. All / Multiple Products {PRODUCTS.map((prod) => ( {prod.name} ))} Sample Evaluation (Courier) Trial Pallet / LCL (1 - 5 MT) 1x20ft Container (FCL - approx 14-18 MT) 1x40ft Container (FCL - approx 24-26 MT) Multiple Containers / Regular Monthly Supply 25kg Multi-layer Kraft Paper Bags 50kg PP Woven Sacks with Inner Poly Liner Jumbo FIBC Bags (500kg / 1000kg) Customized Private Label Packaging Direct Contact: {COMPANY_INFO.person} • {COMPANY_INFO.phoneDisplay} )} ); };