"use client"; import { usePathname } from "next/navigation"; import { useState, useEffect, useRef } from "react"; import Image from "next/legacy/image"; import { contactApiService, ContactFormData } from "@/lib/api/contactService"; const ContactSection = () => { const pathname = usePathname(); const isServiceSingle = pathname === "/service-single" || pathname === "/about-us"; const [formData, setFormData] = useState({ firstName: '', lastName: '', email: '', phone: '', company: '', jobTitle: '', industry: '', companySize: '', budget: '', timeline: '', projectType: '', message: '', newsletter: false, privacy: false }); const [isSubmitting, setIsSubmitting] = useState(false); const [submitStatus, setSubmitStatus] = useState<{ type: 'success' | 'error' | null; message: string; }>({ type: null, message: '' }); // Refs for scrolling to status messages const statusRef = useRef(null); const formRef = useRef(null); // Scroll to status message when it appears useEffect(() => { if (submitStatus.type && statusRef.current) { setTimeout(() => { statusRef.current?.scrollIntoView({ behavior: 'smooth', block: 'center' }); }, 100); } }, [submitStatus]); const handleInputChange = (e: React.ChangeEvent) => { const { name, value, type } = e.target; if (type === 'checkbox') { const checked = (e.target as HTMLInputElement).checked; setFormData(prev => ({ ...prev, [name]: checked })); } else { setFormData(prev => ({ ...prev, [name]: value })); } }; const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setIsSubmitting(true); setSubmitStatus({ type: null, message: '' }); try { // Transform form data to match API requirements const apiData: ContactFormData = { first_name: formData.firstName, last_name: formData.lastName, email: formData.email, phone: formData.phone || undefined, company: formData.company, job_title: formData.jobTitle, industry: formData.industry || undefined, company_size: formData.companySize || undefined, project_type: formData.projectType || undefined, timeline: formData.timeline || undefined, budget: formData.budget || undefined, message: formData.message, newsletter_subscription: formData.newsletter, privacy_consent: formData.privacy }; // Submit to Django API const response = await contactApiService.submitContactForm(apiData); setSubmitStatus({ type: 'success', message: response.message || 'Thank you! We\'ll contact you within 24 hours.' }); // Reset form on success setFormData({ firstName: '', lastName: '', email: '', phone: '', company: '', jobTitle: '', industry: '', companySize: '', budget: '', timeline: '', projectType: '', message: '', newsletter: false, privacy: false }); } catch (error) { setSubmitStatus({ type: 'error', message: error instanceof Error ? error.message : 'Failed to submit form. Please try again.' }); } finally { setIsSubmitting(false); } }; return (
{/* Contact Information Cards */}

Phone Support

Main Contact & Emergency

+359 896 13 80 30 Emergency: +359 897 338 147 Available 24/7

Email Support

Software Solutions

info@gnxsoft.com contact@gnxsoft.com 24/7 Response Time

Office Locations

Our Location

GNX Soft Ltd.
Tsar Simeon I, 56
Burgas, Burgas 8000, Bulgaria
Schedule a Visit

Request Enterprise Consultation

Fill out the form below to get started