feat(contact): implement contact form submission, admin management and dynamic contact info
This commit is contained in:
1 parent
49049a7f78
commit
2aea3bded4
11 files changed
+961
-77
No files matched your search
@@ -19,6 +19,7 @@ import Media from './pages/Media';
|
||||
import CMS from './pages/CMS';
|
||||
import WholesaleApplications from './pages/WholesaleApplications';
|
||||
import Videos from './pages/Videos';
|
||||
import ContactSubmissions from './pages/ContactSubmissions';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
@@ -44,6 +45,7 @@ function App() {
|
||||
<Route path="media" element={<Media />} />
|
||||
<Route path="cms" element={<CMS />} />
|
||||
<Route path="wholesale" element={<WholesaleApplications />} />
|
||||
<Route path="contact" element={<ContactSubmissions />} />
|
||||
</Route>
|
||||
</Route>
|
||||
</Routes>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||
import { Users, ShoppingCart, Tag, Settings, LogOut, TrendingUp, FolderTree, FileText, BookOpen, Heart, Package, LayoutDashboard, Languages, Image, Video } from 'lucide-react';
|
||||
import { Users, ShoppingCart, Tag, Settings, LogOut, TrendingUp, FolderTree, FileText, BookOpen, Heart, Package, LayoutDashboard, Languages, Image, Video, PhoneCall } from 'lucide-react';
|
||||
import api from '../services/api';
|
||||
|
||||
const menuGroups = [
|
||||
@@ -26,6 +26,7 @@ const menuGroups = [
|
||||
{ icon: Users, label: 'کاربران', path: '/users' },
|
||||
{ icon: Heart, label: 'حیوانات (Pets)', path: '/pets' },
|
||||
{ icon: Package, label: 'درخواستهای B2B', path: '/wholesale' },
|
||||
{ icon: PhoneCall, label: 'تماس با ما & اطلاعات', path: '/contact' },
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import axios from 'axios';
|
||||
import toast from 'react-hot-toast';
|
||||
|
||||
interface ContactSubmission {
|
||||
id: string;
|
||||
name: string;
|
||||
phone: string;
|
||||
email?: string;
|
||||
subject?: string;
|
||||
message: string;
|
||||
status: string;
|
||||
adminNotes?: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
interface ContactInfoItem {
|
||||
key: string;
|
||||
title: string;
|
||||
value: string;
|
||||
icon?: string;
|
||||
order?: number;
|
||||
}
|
||||
|
||||
export default function ContactSubmissions() {
|
||||
const [activeTab, setActiveTab] = useState<'submissions' | 'info'>('submissions');
|
||||
const [submissions, setSubmissions] = useState<ContactSubmission[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [infoItems, setInfoItems] = useState<ContactInfoItem[]>([]);
|
||||
const [selectedSub, setSelectedSub] = useState<ContactSubmission | null>(null);
|
||||
const [adminNotes, setAdminNotes] = useState('');
|
||||
const [status, setStatus] = useState('PENDING');
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL || '';
|
||||
|
||||
const fetchSubmissions = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const token = localStorage.getItem('adminToken');
|
||||
const res = await axios.get(`${API_URL}/api/contact/submissions`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
setSubmissions(res.data.items || []);
|
||||
} catch (err: any) {
|
||||
toast.error('خطا در دریافت پیامهای تماس با ما');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const fetchContactInfo = async () => {
|
||||
try {
|
||||
const res = await axios.get(`${API_URL}/api/contact/info`);
|
||||
setInfoItems(res.data || []);
|
||||
} catch (err: any) {
|
||||
toast.error('خطا در دریافت اطلاعات نمایندگی');
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchSubmissions();
|
||||
fetchContactInfo();
|
||||
}, []);
|
||||
|
||||
const handleUpdateStatus = async () => {
|
||||
if (!selectedSub) return;
|
||||
try {
|
||||
const token = localStorage.getItem('adminToken');
|
||||
await axios.put(
|
||||
`${API_URL}/api/contact/submissions/${selectedSub.id}`,
|
||||
{ status, adminNotes },
|
||||
{ headers: { Authorization: `Bearer ${token}` } },
|
||||
);
|
||||
toast.success('وضعیت پیام با موفقیت بهروزرسانی شد');
|
||||
setSelectedSub(null);
|
||||
fetchSubmissions();
|
||||
} catch (err: any) {
|
||||
toast.error('خطا در ثبت تغییرات');
|
||||
}
|
||||
};
|
||||
|
||||
const handleSaveContactInfo = async () => {
|
||||
try {
|
||||
const token = localStorage.getItem('adminToken');
|
||||
await axios.put(
|
||||
`${API_URL}/api/contact/info`,
|
||||
{ items: infoItems },
|
||||
{ headers: { Authorization: `Bearer ${token}` } },
|
||||
);
|
||||
toast.success('اطلاعات نمایندگی و دفتر مرکزی با موفقیت ذخیره شد');
|
||||
} catch (err: any) {
|
||||
toast.error('خطا در بروزرسانی اطلاعات نمایندگی');
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="p-6 dir-rtl">
|
||||
<div className="flex justify-between items-center mb-6">
|
||||
<h1 className="text-2xl font-bold text-gray-800">مدیریت تماس با ما & اطلاعات نمایندگی</h1>
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
onClick={() => setActiveTab('submissions')}
|
||||
className={`px-4 py-2 rounded-lg font-medium transition ${
|
||||
activeTab === 'submissions' ? 'bg-amber-600 text-white' : 'bg-gray-100 text-gray-700'
|
||||
}`}
|
||||
>
|
||||
پیامهای دریافت شده
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setActiveTab('info')}
|
||||
className={`px-4 py-2 rounded-lg font-medium transition ${
|
||||
activeTab === 'info' ? 'bg-amber-600 text-white' : 'bg-gray-100 text-gray-700'
|
||||
}`}
|
||||
>
|
||||
اطلاعات نمایندگی & آدرسها
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{activeTab === 'submissions' ? (
|
||||
<div className="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
|
||||
{loading ? (
|
||||
<div className="p-8 text-center text-gray-500">در حال بارگذاری...</div>
|
||||
) : submissions.length === 0 ? (
|
||||
<div className="p-8 text-center text-gray-500">هیچ پیامی ثبت نشده است.</div>
|
||||
) : (
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full text-right border-collapse">
|
||||
<thead>
|
||||
<tr className="bg-gray-50 text-gray-600 text-sm font-semibold border-b">
|
||||
<th className="p-4">نام فرستنده</th>
|
||||
<th className="p-4">شماره تماس</th>
|
||||
<th className="p-4">موضوع</th>
|
||||
<th className="p-4">تاریخ ثبت</th>
|
||||
<th className="p-4">وضعیت</th>
|
||||
<th className="p-4">عملیات</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y divide-gray-100 text-sm">
|
||||
{submissions.map((sub) => (
|
||||
<tr key={sub.id} className="hover:bg-gray-50/50">
|
||||
<td className="p-4 font-medium text-gray-900">{sub.name}</td>
|
||||
<td className="p-4 dir-ltr text-right">{sub.phone}</td>
|
||||
<td className="p-4">{sub.subject || 'بدون موضوع'}</td>
|
||||
<td className="p-4">
|
||||
{new Date(sub.createdAt).toLocaleDateString('fa-IR')}
|
||||
</td>
|
||||
<td className="p-4">
|
||||
<span
|
||||
className={`px-2.5 py-1 rounded-full text-xs font-medium ${
|
||||
sub.status === 'RESOLVED'
|
||||
? 'bg-emerald-100 text-emerald-700'
|
||||
: sub.status === 'IN_PROGRESS'
|
||||
? 'bg-amber-100 text-amber-700'
|
||||
: 'bg-rose-100 text-rose-700'
|
||||
}`}
|
||||
>
|
||||
{sub.status === 'RESOLVED'
|
||||
? 'پاسخ داده شده'
|
||||
: sub.status === 'IN_PROGRESS'
|
||||
? 'در حال پیگیری'
|
||||
: 'جدید (نیازمند بررسی)'}
|
||||
</span>
|
||||
</td>
|
||||
<td className="p-4">
|
||||
<button
|
||||
onClick={() => {
|
||||
setSelectedSub(sub);
|
||||
setStatus(sub.status);
|
||||
setAdminNotes(sub.adminNotes || '');
|
||||
}}
|
||||
className="px-3 py-1.5 bg-gray-100 hover:bg-gray-200 text-gray-800 rounded-lg text-xs font-medium transition"
|
||||
>
|
||||
مشاهده & تغییر وضعیت
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div className="bg-white rounded-xl shadow-sm border border-gray-100 p-6 max-w-4xl">
|
||||
<h2 className="text-lg font-bold text-gray-800 mb-4">ویرایش داینامیک اطلاعات دفتر مرکزی & نمایندگیها</h2>
|
||||
<div className="space-y-6">
|
||||
{infoItems.map((item, idx) => (
|
||||
<div key={item.key} className="p-4 bg-gray-50 rounded-xl border border-gray-200 space-y-3">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-gray-700 mb-1">عنوان بخش</label>
|
||||
<input
|
||||
type="text"
|
||||
value={item.title}
|
||||
onChange={(e) => {
|
||||
const newItems = [...infoItems];
|
||||
newItems[idx].title = e.target.value;
|
||||
setInfoItems(newItems);
|
||||
}}
|
||||
className="w-full px-3 py-2 border rounded-lg text-sm"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-gray-700 mb-1">آیکون (نام آیکون یا کلید)</label>
|
||||
<input
|
||||
type="text"
|
||||
value={item.icon || ''}
|
||||
onChange={(e) => {
|
||||
const newItems = [...infoItems];
|
||||
newItems[idx].icon = e.target.value;
|
||||
setInfoItems(newItems);
|
||||
}}
|
||||
className="w-full px-3 py-2 border rounded-lg text-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-gray-700 mb-1">مقدار / متون اطلاعات</label>
|
||||
<textarea
|
||||
rows={3}
|
||||
value={item.value}
|
||||
onChange={(e) => {
|
||||
const newItems = [...infoItems];
|
||||
newItems[idx].value = e.target.value;
|
||||
setInfoItems(newItems);
|
||||
}}
|
||||
className="w-full px-3 py-2 border rounded-lg text-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<button
|
||||
onClick={handleSaveContactInfo}
|
||||
className="px-6 py-2.5 bg-amber-600 hover:bg-amber-700 text-white rounded-lg font-medium transition shadow-sm"
|
||||
>
|
||||
ذخیره تغییرات اطلاعات نمایندگی
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Modal for Submission Detail & Status Update */}
|
||||
{selectedSub && (
|
||||
<div className="fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center p-4 z-50">
|
||||
<div className="bg-white rounded-2xl p-6 max-w-lg w-full shadow-xl">
|
||||
<h3 className="text-lg font-bold text-gray-900 mb-4">جزئیات پیام {selectedSub.name}</h3>
|
||||
<div className="space-y-3 text-sm text-gray-700 mb-6 bg-gray-50 p-4 rounded-xl">
|
||||
<div><span className="font-semibold text-gray-900">تلفن:</span> {selectedSub.phone}</div>
|
||||
{selectedSub.email && <div><span className="font-semibold text-gray-900">ایمیل:</span> {selectedSub.email}</div>}
|
||||
<div><span className="font-semibold text-gray-900">موضوع:</span> {selectedSub.subject || 'ندارد'}</div>
|
||||
<div>
|
||||
<span className="font-semibold text-gray-900 block mb-1">متن پیام:</span>
|
||||
<p className="bg-white p-3 rounded-lg border text-gray-800 leading-relaxed whitespace-pre-wrap">{selectedSub.message}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-gray-700 mb-1">تغییر وضعیت پیگیری</label>
|
||||
<select
|
||||
value={status}
|
||||
onChange={(e) => setStatus(e.target.value)}
|
||||
className="w-full px-3 py-2 border rounded-lg text-sm bg-white"
|
||||
>
|
||||
<option value="PENDING">جدید (نیازمند بررسی)</option>
|
||||
<option value="IN_PROGRESS">در حال پیگیری توسط ادمین</option>
|
||||
<option value="RESOLVED">پاسخ داده شد / تکمیل پیگیری</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-gray-700 mb-1">یادداشت مدیر (اختیاری)</label>
|
||||
<textarea
|
||||
rows={3}
|
||||
value={adminNotes}
|
||||
onChange={(e) => setAdminNotes(e.target.value)}
|
||||
placeholder="یادداشتهای داخلی جهت پیگیری کارشناسان..."
|
||||
className="w-full px-3 py-2 border rounded-lg text-sm"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex justify-end gap-2 pt-2">
|
||||
<button
|
||||
onClick={() => setSelectedSub(null)}
|
||||
className="px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg text-sm"
|
||||
>
|
||||
انصراف
|
||||
</button>
|
||||
<button
|
||||
onClick={handleUpdateStatus}
|
||||
className="px-4 py-2 bg-amber-600 hover:bg-amber-700 text-white rounded-lg text-sm font-medium"
|
||||
>
|
||||
ثبت تغییرات
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Mail, Phone, MapPin, Clock, Send } from "lucide-react";
|
||||
import ContactFormClient from "@/components/ContactFormClient";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "تماس با ما - نمایندگی رسمی مکملهای کانینا آلمان در ایران",
|
||||
@@ -35,83 +35,10 @@ export default function ContactPage() {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="grid lg:grid-cols-12 gap-12 items-start">
|
||||
{/* Contact Details */}
|
||||
<div className="lg:col-span-5 space-y-8">
|
||||
<h3 className="text-2xl font-black text-medical-gray-900">اطلاعات نمایندگی</h3>
|
||||
|
||||
<div className="space-y-6">
|
||||
<div className="flex gap-4 p-6 bg-white border border-medical-gray-200 rounded-[2rem] shadow-sm">
|
||||
<div className="w-12 h-12 bg-canina-blue/5 text-canina-blue rounded-2xl flex items-center justify-center shrink-0">
|
||||
<Phone className="w-6 h-6" />
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="text-xs font-black text-medical-gray-400 uppercase tracking-wider mb-1">تلفنهای تماس</h4>
|
||||
<p className="text-lg font-black text-medical-gray-900 tracking-wider">۰۲۱-۸۸۸۸ ۴۴۴۴</p>
|
||||
<p className="text-sm text-medical-gray-500 font-bold">شنبه تا چهارشنبه ۹:۰۰ الی ۱۸:۰۰</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-4 p-6 bg-white border border-medical-gray-200 rounded-[2rem] shadow-sm">
|
||||
<div className="w-12 h-12 bg-canina-blue/5 text-canina-blue rounded-2xl flex items-center justify-center shrink-0">
|
||||
<Mail className="w-6 h-6" />
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="text-xs font-black text-medical-gray-400 uppercase tracking-wider mb-1">پست الکترونیک</h4>
|
||||
<p className="text-sm font-black text-medical-gray-900">info@canina-iran.com</p>
|
||||
<p className="text-xs text-medical-gray-500 font-bold">پاسخگویی در کمتر از ۲۴ ساعت کاری</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-4 p-6 bg-white border border-medical-gray-200 rounded-[2rem] shadow-sm">
|
||||
<div className="w-12 h-12 bg-canina-blue/5 text-canina-blue rounded-2xl flex items-center justify-center shrink-0">
|
||||
<MapPin className="w-6 h-6" />
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="text-xs font-black text-medical-gray-400 uppercase tracking-wider mb-1">نشانی دفتر مرکزی</h4>
|
||||
<p className="text-sm font-bold text-medical-gray-900 leading-relaxed">
|
||||
تهران، جردن، خیابان سعیدی، ساختمان کانینا، طبقه ۵، واحد ۱۹
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Contact Form */}
|
||||
<div className="lg:col-span-7 bg-white border border-medical-gray-200 rounded-[3rem] p-10 shadow-xl">
|
||||
<h3 className="text-2xl font-black text-medical-gray-900 mb-8">ارسال پیام مستقیم</h3>
|
||||
|
||||
<form className="space-y-6">
|
||||
<div className="grid md:grid-cols-2 gap-6">
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs font-black text-medical-gray-500">نام و نام خانوادگی</label>
|
||||
<input type="text" className="w-full bg-medical-gray-50 border border-medical-gray-200 rounded-2xl p-4 text-sm font-bold focus:outline-none focus:ring-2 focus:ring-canina-blue/20" />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs font-black text-medical-gray-500">شماره موبایل</label>
|
||||
<input type="text" className="w-full bg-medical-gray-50 border border-medical-gray-200 rounded-2xl p-4 text-sm font-bold text-left focus:outline-none focus:ring-2 focus:ring-canina-blue/20" dir="ltr" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs font-black text-medical-gray-500">موضوع پیام</label>
|
||||
<input type="text" className="w-full bg-medical-gray-50 border border-medical-gray-200 rounded-2xl p-4 text-sm font-bold focus:outline-none focus:ring-2 focus:ring-canina-blue/20" />
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs font-black text-medical-gray-500">متن پیام</label>
|
||||
<textarea rows={4} className="w-full bg-medical-gray-50 border border-medical-gray-200 rounded-2xl p-4 text-sm font-bold focus:outline-none focus:ring-2 focus:ring-canina-blue/20"></textarea>
|
||||
</div>
|
||||
|
||||
<button type="button" className="w-full bg-canina-blue text-white py-4 rounded-2xl font-black flex items-center justify-center gap-2 hover:shadow-xl hover:shadow-canina-blue/20 transition-all">
|
||||
<Send className="w-5 h-5 rotate-180" />
|
||||
ارسال پیام
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<ContactFormClient />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,248 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { Mail, Phone, MapPin, Send, CheckCircle2 } from "lucide-react";
|
||||
import axios from "axios";
|
||||
|
||||
interface ContactInfoItem {
|
||||
key: string;
|
||||
title: string;
|
||||
value: string;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
export default function ContactFormClient() {
|
||||
const [infoItems, setInfoItems] = useState<ContactInfoItem[]>([]);
|
||||
const [name, setName] = useState("");
|
||||
const [phone, setPhone] = useState("");
|
||||
const [subject, setSubject] = useState("");
|
||||
const [message, setMessage] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [success, setSuccess] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
|
||||
const API_URL = process.env.NEXT_PUBLIC_API_URL || "";
|
||||
|
||||
useEffect(() => {
|
||||
async function fetchContactInfo() {
|
||||
try {
|
||||
const res = await axios.get(`${API_URL}/contact/info`);
|
||||
setInfoItems(res.data || []);
|
||||
} catch (err) {
|
||||
console.error("Failed to fetch contact info", err);
|
||||
}
|
||||
}
|
||||
fetchContactInfo();
|
||||
}, [API_URL]);
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!name.trim() || !phone.trim() || !message.trim()) {
|
||||
setError("لطفاً نام، شماره موبایل و متن پیام را وارد کنید.");
|
||||
return;
|
||||
}
|
||||
setError("");
|
||||
setLoading(true);
|
||||
|
||||
try {
|
||||
await axios.post(`${API_URL}/contact`, {
|
||||
name,
|
||||
phone,
|
||||
subject,
|
||||
message,
|
||||
});
|
||||
setSuccess(true);
|
||||
setName("");
|
||||
setPhone("");
|
||||
setSubject("");
|
||||
setMessage("");
|
||||
} catch (err: any) {
|
||||
setError(
|
||||
err.response?.data?.message || "خطایی در ثبت پیام رخ داده است. لطفاً مجدداً تلاش کنید."
|
||||
);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const getIcon = (iconName?: string) => {
|
||||
switch (iconName) {
|
||||
case "mail":
|
||||
return <Mail className="w-6 h-6" />;
|
||||
case "map-pin":
|
||||
return <MapPin className="w-6 h-6" />;
|
||||
case "phone":
|
||||
default:
|
||||
return <Phone className="w-6 h-6" />;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="grid lg:grid-cols-12 gap-12 items-start">
|
||||
{/* Contact Details */}
|
||||
<div className="lg:col-span-5 space-y-8">
|
||||
<h3 className="text-2xl font-black text-medical-gray-900">اطلاعات نمایندگی</h3>
|
||||
|
||||
<div className="space-y-6">
|
||||
{infoItems.length > 0 ? (
|
||||
infoItems.map((item) => (
|
||||
<div
|
||||
key={item.key}
|
||||
className="flex gap-4 p-6 bg-white border border-medical-gray-200 rounded-[2rem] shadow-sm"
|
||||
>
|
||||
<div className="w-12 h-12 bg-canina-blue/5 text-canina-blue rounded-2xl flex items-center justify-center shrink-0">
|
||||
{getIcon(item.icon)}
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="text-xs font-black text-medical-gray-400 uppercase tracking-wider mb-1">
|
||||
{item.title}
|
||||
</h4>
|
||||
<div className="text-sm font-bold text-medical-gray-900 leading-relaxed whitespace-pre-wrap">
|
||||
{item.value}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<>
|
||||
<div className="flex gap-4 p-6 bg-white border border-medical-gray-200 rounded-[2rem] shadow-sm">
|
||||
<div className="w-12 h-12 bg-canina-blue/5 text-canina-blue rounded-2xl flex items-center justify-center shrink-0">
|
||||
<Phone className="w-6 h-6" />
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="text-xs font-black text-medical-gray-400 uppercase tracking-wider mb-1">
|
||||
تلفنهای تماس
|
||||
</h4>
|
||||
<p className="text-lg font-black text-medical-gray-900 tracking-wider">
|
||||
۰۲۱-۸۸۸۸ ۴۴۴۴
|
||||
</p>
|
||||
<p className="text-sm text-medical-gray-500 font-bold">
|
||||
شنبه تا چهارشنبه ۹:۰۰ الی ۱۸:۰۰
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-4 p-6 bg-white border border-medical-gray-200 rounded-[2rem] shadow-sm">
|
||||
<div className="w-12 h-12 bg-canina-blue/5 text-canina-blue rounded-2xl flex items-center justify-center shrink-0">
|
||||
<Mail className="w-6 h-6" />
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="text-xs font-black text-medical-gray-400 uppercase tracking-wider mb-1">
|
||||
پست الکترونیک
|
||||
</h4>
|
||||
<p className="text-sm font-black text-medical-gray-900">info@canina-iran.com</p>
|
||||
<p className="text-xs text-medical-gray-500 font-bold">
|
||||
پاسخگویی در کمتر از ۲۴ ساعت کاری
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-4 p-6 bg-white border border-medical-gray-200 rounded-[2rem] shadow-sm">
|
||||
<div className="w-12 h-12 bg-canina-blue/5 text-canina-blue rounded-2xl flex items-center justify-center shrink-0">
|
||||
<MapPin className="w-6 h-6" />
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="text-xs font-black text-medical-gray-400 uppercase tracking-wider mb-1">
|
||||
نشانی دفتر مرکزی
|
||||
</h4>
|
||||
<p className="text-sm font-bold text-medical-gray-900 leading-relaxed">
|
||||
تهران، جردن، خیابان سعیدی، ساختمان کانینا، طبقه ۵، واحد ۱۹
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Contact Form */}
|
||||
<div className="lg:col-span-7 bg-white border border-medical-gray-200 rounded-[3rem] p-10 shadow-xl">
|
||||
<h3 className="text-2xl font-black text-medical-gray-900 mb-8">ارسال پیام مستقیم</h3>
|
||||
|
||||
{success ? (
|
||||
<div className="p-6 bg-emerald-50 border border-emerald-200 text-emerald-800 rounded-2xl text-center space-y-3">
|
||||
<CheckCircle2 className="w-12 h-12 text-emerald-600 mx-auto" />
|
||||
<h4 className="text-lg font-black">پیام شما با موفقیت ثبت شد</h4>
|
||||
<p className="text-sm font-medium leading-relaxed">
|
||||
پیامک تایید به شماره شما ارسال شد. کارشناسان کانینا به زودی با شما تماس خواهند گرفت.
|
||||
</p>
|
||||
<button
|
||||
onClick={() => setSuccess(false)}
|
||||
className="mt-4 px-6 py-2 bg-emerald-600 text-white rounded-xl text-xs font-black"
|
||||
>
|
||||
ارسال پیام جدید
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<form onSubmit={handleSubmit} className="space-y-6">
|
||||
{error && (
|
||||
<div className="p-4 bg-rose-50 border border-rose-200 text-rose-700 text-xs font-bold rounded-2xl">
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="grid md:grid-cols-2 gap-6">
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs font-black text-medical-gray-500">
|
||||
نام و نام خانوادگی *
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
className="w-full bg-medical-gray-50 border border-medical-gray-200 rounded-2xl p-4 text-sm font-bold focus:outline-none focus:ring-2 focus:ring-canina-blue/20"
|
||||
placeholder="مثال: علی محمدی"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs font-black text-medical-gray-500">شماره موبایل *</label>
|
||||
<input
|
||||
type="text"
|
||||
value={phone}
|
||||
onChange={(e) => setPhone(e.target.value)}
|
||||
className="w-full bg-medical-gray-50 border border-medical-gray-200 rounded-2xl p-4 text-sm font-bold text-left focus:outline-none focus:ring-2 focus:ring-canina-blue/20"
|
||||
dir="ltr"
|
||||
placeholder="09123456789"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs font-black text-medical-gray-500">موضوع پیام</label>
|
||||
<input
|
||||
type="text"
|
||||
value={subject}
|
||||
onChange={(e) => setSubject(e.target.value)}
|
||||
className="w-full bg-medical-gray-50 border border-medical-gray-200 rounded-2xl p-4 text-sm font-bold focus:outline-none focus:ring-2 focus:ring-canina-blue/20"
|
||||
placeholder="مثال: مشاوره تخصصی مکمل یا خرید عمده"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs font-black text-medical-gray-500">متن پیام *</label>
|
||||
<textarea
|
||||
rows={4}
|
||||
value={message}
|
||||
onChange={(e) => setMessage(e.target.value)}
|
||||
className="w-full bg-medical-gray-50 border border-medical-gray-200 rounded-2xl p-4 text-sm font-bold focus:outline-none focus:ring-2 focus:ring-canina-blue/20"
|
||||
placeholder="متن درخواست یا پیام خود را بنویسید..."
|
||||
required
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={loading}
|
||||
className="w-full bg-canina-blue text-white py-4 rounded-2xl font-black flex items-center justify-center gap-2 hover:shadow-xl hover:shadow-canina-blue/20 transition-all disabled:opacity-50"
|
||||
>
|
||||
<Send className="w-5 h-5 rotate-180" />
|
||||
{loading ? "در حال ثبت..." : "ارسال پیام"}
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user