From 5c34df0f09922e599285aac82e984f019ae8588a Mon Sep 17 00:00:00 2001 From: Kenan KARAER Date: Mon, 26 Jan 2026 00:19:09 +0300 Subject: [PATCH] =?UTF-8?q?sms=20entegrasyonu=20ve=20ana=20sayfa=20i=C5=9F?= =?UTF-8?q?lemleri?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(dashboard)/dashboard/customers/page.tsx | 76 +++++++ app/(dashboard)/dashboard/settings/page.tsx | 17 ++ app/(dashboard)/dashboard/sms/logs/page.tsx | 65 ++++++ app/(dashboard)/dashboard/sms/page.tsx | 9 + app/(public)/page.tsx | 22 ++- components/dashboard/content-form.tsx | 2 + components/dashboard/customer-form.tsx | 187 ++++++++++++++++++ components/dashboard/sidebar.tsx | 48 ++++- components/dashboard/sms-page-client.tsx | 198 +++++++++++++++++++ components/layout/navbar.tsx | 20 +- components/ui/scroll-area.tsx | 58 ++++++ lib/actions/contact.ts | 2 +- lib/customers/actions.ts | 88 +++++++++ lib/sms/actions.ts | 68 +++++++ package-lock.json | 32 +++ package.json | 1 + security_updates.sql | 94 +++++++++ supabase_schema_customers.sql | 35 ++++ types/customer.ts | 13 ++ 19 files changed, 1018 insertions(+), 17 deletions(-) create mode 100644 app/(dashboard)/dashboard/customers/page.tsx create mode 100644 app/(dashboard)/dashboard/sms/logs/page.tsx create mode 100644 app/(dashboard)/dashboard/sms/page.tsx create mode 100644 components/dashboard/customer-form.tsx create mode 100644 components/dashboard/sms-page-client.tsx create mode 100644 components/ui/scroll-area.tsx create mode 100644 lib/customers/actions.ts create mode 100644 security_updates.sql create mode 100644 supabase_schema_customers.sql create mode 100644 types/customer.ts diff --git a/app/(dashboard)/dashboard/customers/page.tsx b/app/(dashboard)/dashboard/customers/page.tsx new file mode 100644 index 0000000..9e23f90 --- /dev/null +++ b/app/(dashboard)/dashboard/customers/page.tsx @@ -0,0 +1,76 @@ +import { getCustomers, deleteCustomer } from "@/lib/customers/actions" +import { CustomerForm } from "@/components/dashboard/customer-form" +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table" +import { Button } from "@/components/ui/button" +import { Trash, Edit } from "lucide-react" + +export default async function CustomersPage() { + const { data: customers } = await getCustomers() + + return ( +
+
+

Müşteriler

+
+ +
+
+ +
+ + + + Ad Soyad + E-Posta + Telefon + Adres + İşlemler + + + + {customers?.length === 0 && ( + + + Henüz müşteri bulunmuyor. + + + )} + {customers?.map((customer) => ( + + {customer.full_name} + {customer.email || "-"} + {customer.phone || "-"} + {customer.address || "-"} + + + + + } + /> +
{ + 'use server' + await deleteCustomer(customer.id) + }}> + + +
+
+ ))} +
+
+
+
+ ) +} diff --git a/app/(dashboard)/dashboard/settings/page.tsx b/app/(dashboard)/dashboard/settings/page.tsx index 7ee1968..cf63ebf 100644 --- a/app/(dashboard)/dashboard/settings/page.tsx +++ b/app/(dashboard)/dashboard/settings/page.tsx @@ -28,6 +28,15 @@ export default async function SettingsPage() { { key: 'site_title', value: 'ParaKasa', type: 'text', section: 'general' }, { key: 'site_description', value: '', type: 'long_text', section: 'general' }, { key: 'site_logo', value: '', type: 'image_url', section: 'general' }, + { key: 'favicon_url', value: '', type: 'image_url', section: 'general' }, + + // Home + { key: 'home_hero_title', value: 'GÜVENLİK SINIR
TANIMAZ', type: 'html', section: 'home' }, + { key: 'home_hero_description', value: 'En değerli varlıklarınız için tasarlanmış yüksek güvenlikli çelik kasalar. Modern teknoloji ve zanaatkarlığın mükemmel uyumu.', type: 'long_text', section: 'home' }, + { key: 'home_hero_button_text', value: 'Koleksiyonu İncele', type: 'text', section: 'home' }, + { key: 'home_hero_bg_image', value: '/images/hero-safe.png', type: 'image_url', section: 'home' }, + { key: 'home_categories_title', value: 'Ürün Kategorileri', type: 'text', section: 'home' }, + { key: 'home_categories_description', value: 'İhtiyacınıza uygun güvenlik çözümünü seçin.', type: 'text', section: 'home' }, // Contact { key: 'contact_phone', value: '', type: 'text', section: 'contact' }, @@ -37,6 +46,14 @@ export default async function SettingsPage() { { key: 'social_youtube', value: '', type: 'text', section: 'contact' }, { key: 'social_tiktok', value: '', type: 'text', section: 'contact' }, { key: 'contact_map_embed', value: '', type: 'html', section: 'contact' }, + + // SEO + { key: 'meta_keywords', value: '', type: 'text', section: 'seo' }, + { key: 'meta_author', value: '', type: 'text', section: 'seo' }, + + // Scripts & Analytics + { key: 'google_analytics_id', value: '', type: 'text', section: 'scripts' }, + { key: 'facebook_pixel_id', value: '', type: 'text', section: 'scripts' }, ] // Merge default contents with existing contents diff --git a/app/(dashboard)/dashboard/sms/logs/page.tsx b/app/(dashboard)/dashboard/sms/logs/page.tsx new file mode 100644 index 0000000..85608a0 --- /dev/null +++ b/app/(dashboard)/dashboard/sms/logs/page.tsx @@ -0,0 +1,65 @@ +import { getSmsLogs } from "@/lib/sms/actions" +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table" +import { Badge } from "@/components/ui/badge" +import { format } from "date-fns" +import { tr } from "date-fns/locale" + +export default async function SmsLogsPage() { + const { data: logs, error } = await getSmsLogs(100) + + if (error) { + return
Hata: {error}
+ } + + return ( +
+

SMS Geçmişi

+

Son gönderilen mesajların durumu.

+ +
+ + + + Tarih + Numara + Mesaj + Durum + Kod + + + + {logs?.length === 0 && ( + + + Kayıt bulunamadı. + + + )} + {logs?.map((log) => ( + + + {log.created_at ? format(new Date(log.created_at), "dd MMM yyyy HH:mm", { locale: tr }) : "-"} + + {log.phone} + {log.message} + + + {log.status === 'success' ? 'Başarılı' : 'Hatalı'} + + + {log.response_code} + + ))} + +
+
+
+ ) +} 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() {
Premium Çelik Kasa
-

- 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."}

- {user && ( + )} + + + + {customer ? "Müşteriyi Düzenle" : "Yeni Müşteri Ekle"} + + Müşteri bilgilerini aşağıdan yönetebilirsiniz. + + +
+ + ( + + Ad Soyad + + + + + + )} + /> + ( + + E-Posta + + + + + + )} + /> + ( + + Telefon + + + + + + )} + /> + ( + + Adres + +