diff --git a/.gitignore b/.gitignore index 960a25b..b94ee01 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ example_data/ +shop/Leitfaden +.gitignore +db-access.txt diff --git a/shop/app/admin/orders/page.tsx b/shop/app/admin/orders/page.tsx new file mode 100644 index 0000000..d44f9e7 --- /dev/null +++ b/shop/app/admin/orders/page.tsx @@ -0,0 +1,108 @@ +import { createClient } from '@/lib/supabase/server' +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' +import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table' +import { Badge } from '@/components/ui/badge' +import { Button } from '@/components/ui/button' +import { FileText, Download, ExternalLink } from 'lucide-react' +import Link from 'next/link' + +import { Suspense } from 'react' + +export default async function AdminOrdersPage() { + return ( +
+
+
+

Bestellungen & Rechnungen

+

Verwalten Sie alle Kundenbestellungen und greifen Sie auf generierte PDFs zu.

+
+
+ + }> + + +
+ ) +} + +async function OrdersData() { + const supabase = await createClient() + + const { data: orders, error } = await supabase + .from('orders') + .select('*') + .order('created_at', { ascending: false }) + + if (error) { + return
Fehler beim Laden der Bestellungen: {error.message}
+ } + + return ( + + + + + + ID + Datum + Kunde + Betrag + Status + Rechnung + + + + {orders?.length === 0 ? ( + + + Noch keine Bestellungen vorhanden. + + + ) : ( + orders?.map((order) => ( + + + {order.id.slice(0, 8)}... + + + {new Date(order.created_at).toLocaleDateString('de-DE')} + + +
{order.customer_data?.company_name || 'Privatkunde'}
+
{order.customer_data?.first_name} {order.customer_data?.last_name}
+
+ + {new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(order.total_price)} + + + + {order.status} + + + + {order.pdf_url ? ( +
+ + +
+ ) : ( + Kein PDF + )} +
+
+ )) + )} +
+
+
+
+ ) +} diff --git a/shop/app/admin/products/page.tsx b/shop/app/admin/products/page.tsx index d2f765c..5d3a12b 100644 --- a/shop/app/admin/products/page.tsx +++ b/shop/app/admin/products/page.tsx @@ -1,4 +1,4 @@ -import { getProducts } from '@/lib/actions/products' +import { getProducts, getCategories } from '@/lib/actions/products' import { ProductList } from '@/components/admin/product-list' import { CreateProductDialog } from '@/components/admin/create-product-dialog' @@ -19,11 +19,9 @@ export default async function AdminProductsPage() {

- - - + }> + +
}> @@ -35,5 +33,13 @@ export default async function AdminProductsPage() { async function ProductDataWrapper() { const products = await getProducts() - return + const categories = await getCategories() + return +} + +async function CreateProductAction() { + const categories = await getCategories() + return ( + + ) } diff --git a/shop/app/layout.tsx b/shop/app/layout.tsx index 96f7cfb..62a36f3 100644 --- a/shop/app/layout.tsx +++ b/shop/app/layout.tsx @@ -9,7 +9,7 @@ const defaultUrl = process.env.VERCEL_URL export const metadata: Metadata = { metadataBase: new URL(defaultUrl), - title: "CloudShop | Modulare Software-Lösungen", + title: "CASPOSShop | Modulare Software-Lösungen", description: "Konfigurieren und bestellen Sie Ihre maßgeschneiderte Business-Software in Minuten.", };