+ )
+}
diff --git a/app/(dashboard)/dashboard/sms/page.tsx b/app/(dashboard)/dashboard/sms/page.tsx
new file mode 100644
index 0000000..6b090be
--- /dev/null
+++ b/app/(dashboard)/dashboard/sms/page.tsx
@@ -0,0 +1,9 @@
+import { getCustomers } from "@/lib/customers/actions"
+import SmsPageClient from "@/components/dashboard/sms-page-client"
+
+export default async function SmsPage() {
+ // Fetch all customers to show in the list
+ const { data: customers } = await getCustomers()
+
+ return
+}
diff --git a/app/(public)/page.tsx b/app/(public)/page.tsx
index c2bd09e..aa8d3bf 100644
--- a/app/(public)/page.tsx
+++ b/app/(public)/page.tsx
@@ -4,10 +4,12 @@ import { ArrowRight, ShieldCheck, Lock, History, LayoutDashboard } from "lucide-
import { Button } from "@/components/ui/button"
import { Card, CardContent } from "@/components/ui/card"
import { createClient } from "@/lib/supabase-server"
+import { getSiteContents } from "@/lib/data"
export default async function Home() {
const supabase = createClient()
const { data: { user } } = await supabase.auth.getUser()
+ const contents = await getSiteContents()
return (
@@ -15,7 +17,7 @@ export default async function Home() {
-
- GÜVENLİK SINIR TANIMAZ
-
+ TANIMAZ' }}
+ />
- En değerli varlıklarınız için tasarlanmış yüksek güvenlikli çelik kasalar.
- Modern teknoloji ve zanaatkarlığın mükemmel uyumu.
+ {contents.home_hero_description || "En değerli varlıklarınız için tasarlanmış yüksek güvenlikli çelik kasalar. Modern teknoloji ve zanaatkarlığın mükemmel uyumu."}
-
)
diff --git a/components/dashboard/sms-page-client.tsx b/components/dashboard/sms-page-client.tsx
new file mode 100644
index 0000000..3cf9706
--- /dev/null
+++ b/components/dashboard/sms-page-client.tsx
@@ -0,0 +1,198 @@
+'use client'
+
+import { useState } from "react"
+import { useForm } from "react-hook-form"
+import { zodResolver } from "@hookform/resolvers/zod"
+import * as z from "zod"
+import { Customer } from "@/types/customer"
+import { sendBulkSms } from "@/lib/sms/actions"
+
+import { Button } from "@/components/ui/button"
+import { Input } from "@/components/ui/input"
+import { Textarea } from "@/components/ui/textarea"
+import { Checkbox } from "@/components/ui/checkbox"
+import { Label } from "@/components/ui/label"
+import { Card, CardContent, CardDescription, CardHeader, CardTitle, CardFooter } from "@/components/ui/card"
+import { Loader2, Send } from "lucide-react"
+import { toast } from "sonner"
+import { ScrollArea } from "@/components/ui/scroll-area"
+
+const formSchema = z.object({
+ manualNumbers: z.string().optional(),
+ message: z.string().min(1, "Mesaj içeriği boş olamaz").max(900, "Mesaj çok uzun (max 900 karakter)"),
+ selectedCustomers: z.array(z.string()).optional()
+})
+
+interface SmsPageProps {
+ customers: Customer[]
+}
+
+export default function SmsPageClient({ customers }: SmsPageProps) {
+ const [loading, setLoading] = useState(false)
+ const [selectAll, setSelectAll] = useState(false)
+
+ const form = useForm>({
+ resolver: zodResolver(formSchema),
+ defaultValues: {
+ manualNumbers: "",
+ message: "",
+ selectedCustomers: []
+ },
+ })
+
+ const handleSelectAll = (checked: boolean) => {
+ setSelectAll(checked)
+ if (checked) {
+ const allPhones = customers.map(c => c.phone).filter(Boolean) as string[]
+ form.setValue('selectedCustomers', allPhones)
+ } else {
+ form.setValue('selectedCustomers', [])
+ }
+ }
+
+ async function onSubmit(values: z.infer) {
+ const manualPhones = values.manualNumbers
+ ?.split(/[,\n]/) // Split by comma or newline
+ .map(p => p.trim())
+ .filter(p => p !== "") || []
+
+ const customerPhones = values.selectedCustomers || []
+ const allPhones = [...manualPhones, ...customerPhones]
+
+ if (allPhones.length === 0) {
+ toast.error("Lütfen en az bir alıcı seçin veya numara girin.")
+ return
+ }
+
+ setLoading(true)
+ try {
+ const result = await sendBulkSms(allPhones, values.message)
+ if (result.success) {
+ toast.success(result.message)
+ form.reset()
+ setSelectAll(false)
+ } else {
+ toast.error(result.error || "SMS gönderilirken hata oluştu")
+ }
+ } catch {
+ toast.error("Bir hata oluştu")
+ } finally {
+ setLoading(false)
+ }
+ }
+
+ const watchedSelected = form.watch("selectedCustomers") || []
+
+ return (
+
+
SMS Gönderimi
+
+
+
+
+ Mesaj Bilgileri
+
+ Toplu veya tekil SMS gönderin. (Türkçe karakter desteklenir)
+
+
+
+
+
+
+
+ {loading ? : }
+ Gönderimi Başlat
+
+
+
+
+
+
+ Müşteri Listesi
+
+ Listeden toplu seçim yapabilirsiniz.
+
+
+
+