Add coupons, newsletter, country-based shipping, sale prices, USP bar
Deploy to Production (witstore.wende.it) / deploy (push) Successful in 8s

- Gutscheincodes: DB-Verwaltung (%, €-Rabatt, Mindestbestellwert, Ablauf),
  Eingabefeld im Checkout, Admin unter Marketing → Gutscheine
- Newsletter: Double-Opt-In per E-Mail, Formular im Footer,
  Admin-Liste mit CSV-Export
- Länderzonen-Versand: DE / DACH / EU / WORLD, Versandkosten nach
  Lieferland dynamisch berechnet, Coupon-Rabatt in Bestellung gespeichert
- Sale-Preise: sale_price auf Produkten, durchgestrichener UVP auf
  Produktkarte, Sonderangebote-Sektion auf Startseite
- USP-Leiste auf Startseite: Versand, Zahlung, Rückgabe, Service

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 11:07:14 +02:00
co-authored by Claude Sonnet 4.6
parent 5dad8b9324
commit 092dae6085
27 changed files with 782 additions and 51 deletions
@@ -0,0 +1,68 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Coupon;
use Illuminate\Http\Request;
class CouponController extends Controller
{
public function index()
{
$coupons = Coupon::orderByDesc('created_at')->get();
return view('admin.coupons.index', compact('coupons'));
}
public function create()
{
return view('admin.coupons.form');
}
public function store(Request $request)
{
$data = $request->validate([
'code' => 'required|string|max:50|unique:coupons,code',
'type' => 'required|in:percent,fixed',
'value' => 'required|numeric|min:0.01',
'min_order_value' => 'nullable|numeric|min:0',
'expires_at' => 'nullable|date',
'max_uses' => 'nullable|integer|min:1',
'active' => 'boolean',
]);
$data['code'] = strtoupper(trim($data['code']));
$data['active'] = $request->boolean('active');
Coupon::create($data);
return redirect()->route('admin.coupons.index')->with('success', 'Gutschein erstellt.');
}
public function edit(Coupon $coupon)
{
return view('admin.coupons.form', compact('coupon'));
}
public function update(Request $request, Coupon $coupon)
{
$data = $request->validate([
'code' => 'required|string|max:50|unique:coupons,code,' . $coupon->id,
'type' => 'required|in:percent,fixed',
'value' => 'required|numeric|min:0.01',
'min_order_value' => 'nullable|numeric|min:0',
'expires_at' => 'nullable|date',
'max_uses' => 'nullable|integer|min:1',
'active' => 'boolean',
]);
$data['code'] = strtoupper(trim($data['code']));
$data['active'] = $request->boolean('active');
$coupon->update($data);
return redirect()->route('admin.coupons.index')->with('success', 'Gutschein aktualisiert.');
}
public function destroy(Coupon $coupon)
{
$coupon->delete();
return redirect()->route('admin.coupons.index')->with('success', 'Gutschein gelöscht.');
}
}
@@ -0,0 +1,35 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\NewsletterSubscriber;
class NewsletterController extends Controller
{
public function index()
{
$subscribers = NewsletterSubscriber::orderByDesc('created_at')->get();
return view('admin.newsletter.index', compact('subscribers'));
}
public function export()
{
$rows = NewsletterSubscriber::whereNotNull('confirmed_at')
->orderBy('email')
->pluck('email');
$csv = "E-Mail\n" . $rows->implode("\n");
return response($csv, 200, [
'Content-Type' => 'text/csv; charset=UTF-8',
'Content-Disposition' => 'attachment; filename="newsletter-' . date('Y-m-d') . '.csv"',
]);
}
public function destroy(NewsletterSubscriber $subscriber)
{
$subscriber->delete();
return back()->with('success', 'Abonnent gelöscht.');
}
}
@@ -39,6 +39,7 @@ class ProductController extends Controller
'category_id' => 'nullable|exists:categories,id', 'category_id' => 'nullable|exists:categories,id',
'description' => 'nullable|string', 'description' => 'nullable|string',
'base_price' => 'required|numeric|min:0', 'base_price' => 'required|numeric|min:0',
'sale_price' => 'nullable|numeric|min:0',
'tax_rate' => 'required|numeric|in:7,19', 'tax_rate' => 'required|numeric|in:7,19',
'weight' => 'nullable|numeric|min:0', 'weight' => 'nullable|numeric|min:0',
'active' => 'boolean', 'active' => 'boolean',
@@ -83,6 +84,7 @@ class ProductController extends Controller
'category_id' => 'nullable|exists:categories,id', 'category_id' => 'nullable|exists:categories,id',
'description' => 'nullable|string', 'description' => 'nullable|string',
'base_price' => 'required|numeric|min:0', 'base_price' => 'required|numeric|min:0',
'sale_price' => 'nullable|numeric|min:0',
'tax_rate' => 'required|numeric|in:7,19', 'tax_rate' => 'required|numeric|in:7,19',
'weight' => 'nullable|numeric|min:0', 'weight' => 'nullable|numeric|min:0',
'active' => 'boolean', 'active' => 'boolean',
@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Shop; namespace App\Http\Controllers\Shop;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Coupon;
use App\Models\ShippingRate; use App\Models\ShippingRate;
use App\Services\CartService; use App\Services\CartService;
use App\Services\OrderService; use App\Services\OrderService;
@@ -21,12 +22,49 @@ class CheckoutController extends Controller
return redirect()->route('cart.index')->with('error', 'Ihr Warenkorb ist leer.'); return redirect()->route('cart.index')->with('error', 'Ihr Warenkorb ist leer.');
} }
$subtotal = $this->cart->subtotal(); $subtotal = $this->cart->subtotal();
$shippingRate = ShippingRate::forCart($subtotal); $country = session('checkout_country', 'DE');
$shippingRate = ShippingRate::forCart($subtotal, $country);
$shippingCost = $shippingRate ? $shippingRate->getCostForTotal($subtotal) : 0; $shippingCost = $shippingRate ? $shippingRate->getCostForTotal($subtotal) : 0;
$total = $subtotal + $shippingCost; $discount = $this->getCouponDiscount($subtotal);
$total = max(0, $subtotal - $discount) + $shippingCost;
$userAddresses = auth()->user()?->addresses ?? collect(); $userAddresses = auth()->user()?->addresses ?? collect();
$couponCode = session('coupon_code');
return view('shop.checkout.index', compact('subtotal', 'shippingCost', 'total', 'userAddresses')); return view('shop.checkout.index', compact('subtotal', 'shippingCost', 'total', 'userAddresses', 'discount', 'couponCode'));
}
public function applyCoupon(Request $request)
{
$code = trim($request->input('coupon_code', ''));
if (!$code) {
return back()->with('coupon_error', 'Bitte Gutscheincode eingeben.');
}
$coupon = Coupon::findValid($code);
if (!$coupon) {
return back()->with('coupon_error', 'Gutscheincode ungültig oder abgelaufen.');
}
$subtotal = $this->cart->subtotal();
if ($coupon->min_order_value && $subtotal < $coupon->min_order_value) {
return back()->with('coupon_error', 'Mindestbestellwert von ' . number_format($coupon->min_order_value, 2, ',', '.') . ' € nicht erreicht.');
}
session(['coupon_code' => $coupon->code]);
return back()->with('coupon_success', 'Gutschein "' . $coupon->code . '" angewendet!');
}
public function removeCoupon()
{
session()->forget('coupon_code');
return back()->with('coupon_success', 'Gutschein entfernt.');
}
public function shippingCost(Request $request)
{
$country = strtoupper($request->input('country', 'DE'));
session(['checkout_country' => $country]);
$subtotal = $this->cart->subtotal();
$shippingRate = ShippingRate::forCart($subtotal, $country);
$cost = $shippingRate ? $shippingRate->getCostForTotal($subtotal) : 0;
return response()->json(['cost' => $cost, 'formatted' => number_format($cost, 2, ',', '.') . ' €']);
} }
public function storeAddress(Request $request) public function storeAddress(Request $request)
@@ -83,10 +121,13 @@ class CheckoutController extends Controller
if ($request->isMethod('get')) { if ($request->isMethod('get')) {
$items = $this->cart->get(); $items = $this->cart->get();
$subtotal = $this->cart->subtotal(); $subtotal = $this->cart->subtotal();
$shippingRate = ShippingRate::forCart($subtotal); $country = $checkoutData['shipping']['country'] ?? $checkoutData['billing']['country'] ?? 'DE';
$shippingRate = ShippingRate::forCart($subtotal, $country);
$shippingCost = $shippingRate ? $shippingRate->getCostForTotal($subtotal) : 0; $shippingCost = $shippingRate ? $shippingRate->getCostForTotal($subtotal) : 0;
$total = $subtotal + $shippingCost; $discount = $this->getCouponDiscount($subtotal);
return view('shop.checkout.confirm', compact('checkoutData', 'items', 'subtotal', 'shippingCost', 'total')); $total = max(0, $subtotal - $discount) + $shippingCost;
$couponCode = session('coupon_code');
return view('shop.checkout.confirm', compact('checkoutData', 'items', 'subtotal', 'shippingCost', 'total', 'discount', 'couponCode'));
} }
$order = $this->orderService->createFromSession( $order = $this->orderService->createFromSession(
@@ -94,7 +135,7 @@ class CheckoutController extends Controller
$checkoutData['payment_method'] $checkoutData['payment_method']
); );
session()->forget('checkout_data'); session()->forget(['checkout_data', 'checkout_country']);
return redirect()->route('checkout.thankyou', $order->order_number); return redirect()->route('checkout.thankyou', $order->order_number);
} }
@@ -104,4 +145,15 @@ class CheckoutController extends Controller
$order = \App\Models\Order::where('order_number', $order)->firstOrFail(); $order = \App\Models\Order::where('order_number', $order)->firstOrFail();
return view('shop.checkout.thankyou', compact('order')); return view('shop.checkout.thankyou', compact('order'));
} }
private function getCouponDiscount(float $subtotal): float
{
if ($code = session('coupon_code')) {
$coupon = Coupon::findValid($code);
if ($coupon) {
return $coupon->calcDiscount($subtotal);
}
}
return 0;
}
} }
+4 -3
View File
@@ -14,10 +14,11 @@ class HomeController extends Controller
{ {
$banners = Banner::where('active', true)->orderBy('sort_order')->get(); $banners = Banner::where('active', true)->orderBy('sort_order')->get();
$categories = Category::whereNull('parent_id')->where('active', true)->orderBy('sort_order')->get(); $categories = Category::whereNull('parent_id')->where('active', true)->orderBy('sort_order')->get();
$topProducts = Product::where('active', true)->where('featured', true)->latest()->take(8)->get(); $topProducts = Product::where('active', true)->where('featured', true)->with('images','variants','category')->latest()->take(8)->get();
$newProducts = Product::where('active', true)->latest()->take(8)->get(); $newProducts = Product::where('active', true)->with('images','variants','category')->latest()->take(8)->get();
$saleProducts = Product::where('active', true)->whereNotNull('sale_price')->with('images','variants','category')->latest()->take(8)->get();
$blogPosts = Page::where('type', 'blog')->where('published', true)->latest('published_at')->take(3)->get(); $blogPosts = Page::where('type', 'blog')->where('published', true)->latest('published_at')->take(3)->get();
return view('shop.home', compact('banners', 'categories', 'topProducts', 'newProducts', 'blogPosts')); return view('shop.home', compact('banners', 'categories', 'topProducts', 'newProducts', 'saleProducts', 'blogPosts'));
} }
} }
@@ -0,0 +1,57 @@
<?php
namespace App\Http\Controllers\Shop;
use App\Http\Controllers\Controller;
use App\Models\NewsletterSubscriber;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Str;
class NewsletterController extends Controller
{
public function subscribe(Request $request)
{
$request->validate(['newsletter_email' => 'required|email|max:255']);
$email = strtolower($request->input('newsletter_email'));
$existing = NewsletterSubscriber::where('email', $email)->first();
if ($existing && $existing->isConfirmed()) {
return back()->with('newsletter_info', 'Diese E-Mail-Adresse ist bereits angemeldet.');
}
$token = Str::random(64);
if ($existing) {
$existing->update(['token' => $token]);
} else {
NewsletterSubscriber::create(['email' => $email, 'token' => $token]);
}
$confirmUrl = route('newsletter.confirm', $token);
$shopName = \App\Models\Setting::get('shop_name', 'Shop');
Mail::raw(
"Bitte bestätigen Sie Ihre Newsletter-Anmeldung:\n\n{$confirmUrl}\n\n"
. "Falls Sie sich nicht angemeldet haben, können Sie diese E-Mail ignorieren.\n\n"
. "– {$shopName}",
fn($m) => $m->to($email)->subject("Newsletter-Anmeldung bestätigen – {$shopName}")
);
return back()->with('newsletter_success', 'Bitte prüfen Sie Ihren Posteingang und bestätigen Sie die Anmeldung.');
}
public function confirm(string $token)
{
$subscriber = NewsletterSubscriber::where('token', $token)->whereNull('confirmed_at')->first();
if (!$subscriber) {
return redirect('/')->with('error', 'Ungültiger oder bereits verwendeter Bestätigungslink.');
}
$subscriber->update(['confirmed_at' => now(), 'token' => null]);
return redirect('/')->with('success', 'Newsletter-Anmeldung erfolgreich bestätigt!');
}
}
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Coupon extends Model
{
protected $fillable = ['code','type','value','min_order_value','expires_at','max_uses','used_count','active'];
protected $casts = [
'active' => 'boolean',
'expires_at' => 'datetime',
'value' => 'decimal:2',
'min_order_value' => 'decimal:2',
];
public static function findValid(string $code): ?self
{
return self::where('code', strtoupper(trim($code)))
->where('active', true)
->where(fn($q) => $q->whereNull('expires_at')->orWhere('expires_at', '>=', now()))
->where(fn($q) => $q->whereNull('max_uses')->orWhereColumn('used_count', '<', 'max_uses'))
->first();
}
public function calcDiscount(float $subtotal): float
{
if ($this->min_order_value && $subtotal < $this->min_order_value) {
return 0.0;
}
if ($this->type === 'percent') {
return round($subtotal * $this->value / 100, 2);
}
return min((float) $this->value, $subtotal);
}
}
+16
View File
@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class NewsletterSubscriber extends Model
{
protected $fillable = ['email','token','confirmed_at'];
protected $casts = ['confirmed_at' => 'datetime'];
public function isConfirmed(): bool
{
return $this->confirmed_at !== null;
}
}
+2
View File
@@ -10,12 +10,14 @@ class Order extends Model
{ {
protected $fillable = [ protected $fillable = [
'order_number','user_id','guest_email','status','payment_method', 'order_number','user_id','guest_email','status','payment_method',
'coupon_code','discount_amount',
'subtotal','tax_total','shipping_cost','total','tracking_code','notes','paid_at', 'subtotal','tax_total','shipping_cost','total','tracking_code','notes','paid_at',
]; ];
protected $casts = [ protected $casts = [
'paid_at' => 'datetime', 'paid_at' => 'datetime',
'subtotal' => 'decimal:2', 'subtotal' => 'decimal:2',
'discount_amount' => 'decimal:2',
'tax_total' => 'decimal:2', 'tax_total' => 'decimal:2',
'shipping_cost' => 'decimal:2', 'shipping_cost' => 'decimal:2',
'total' => 'decimal:2', 'total' => 'decimal:2',
+12 -2
View File
@@ -8,9 +8,19 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
class Product extends Model class Product extends Model
{ {
protected $fillable = ['category_id','name','slug','description','base_price','tax_rate','weight','active','featured','track_stock','sort_order']; protected $fillable = ['category_id','name','slug','description','base_price','sale_price','tax_rate','weight','active','featured','track_stock','sort_order'];
protected $casts = ['active' => 'boolean', 'featured' => 'boolean', 'track_stock' => 'boolean', 'base_price' => 'decimal:2', 'tax_rate' => 'decimal:2']; protected $casts = ['active' => 'boolean', 'featured' => 'boolean', 'track_stock' => 'boolean', 'base_price' => 'decimal:2', 'sale_price' => 'decimal:2', 'tax_rate' => 'decimal:2'];
public function isOnSale(): bool
{
return $this->sale_price !== null && (float)$this->sale_price < (float)$this->base_price;
}
public function getEffectivePriceAttribute(): float
{
return $this->isOnSale() ? (float)$this->sale_price : (float)$this->base_price;
}
public function category(): BelongsTo public function category(): BelongsTo
{ {
+25 -2
View File
@@ -10,9 +10,32 @@ class ShippingRate extends Model
protected $casts = ['active' => 'boolean', 'price' => 'decimal:2', 'free_from' => 'decimal:2']; protected $casts = ['active' => 'boolean', 'price' => 'decimal:2', 'free_from' => 'decimal:2'];
public static function forCart(float $total, string $zone = 'DE'): ?self // Länder → Zonen-Mapping
public static array $countryZones = [
'DE' => 'DE',
'AT' => 'DACH',
'CH' => 'DACH',
'LI' => 'DACH',
'FR' => 'EU', 'NL' => 'EU', 'BE' => 'EU', 'LU' => 'EU',
'IT' => 'EU', 'ES' => 'EU', 'PT' => 'EU', 'PL' => 'EU',
'CZ' => 'EU', 'SK' => 'EU', 'HU' => 'EU', 'RO' => 'EU',
'BG' => 'EU', 'HR' => 'EU', 'SI' => 'EU', 'GR' => 'EU',
'DK' => 'EU', 'SE' => 'EU', 'FI' => 'EU', 'EE' => 'EU',
'LV' => 'EU', 'LT' => 'EU', 'IE' => 'EU', 'MT' => 'EU',
'CY' => 'EU',
];
public static function zoneForCountry(string $country): string
{ {
return self::where('zone', $zone)->where('active', true)->first(); return self::$countryZones[strtoupper($country)] ?? 'WORLD';
}
public static function forCart(float $total, string $country = 'DE'): ?self
{
$zone = self::zoneForCountry($country);
$rate = self::where('zone', $zone)->where('active', true)->first();
// Fallback auf DE wenn keine Zone gefunden
return $rate ?? self::where('zone', 'DE')->where('active', true)->first();
} }
public function getCostForTotal(float $total): float public function getCostForTotal(float $total): float
+26 -6
View File
@@ -4,6 +4,7 @@ namespace App\Services;
use App\Mail\OrderConfirmationMail; use App\Mail\OrderConfirmationMail;
use App\Mail\OrderShippedMail; use App\Mail\OrderShippedMail;
use App\Models\Coupon;
use App\Models\Order; use App\Models\Order;
use App\Models\OrderAddress; use App\Models\OrderAddress;
use App\Models\OrderItem; use App\Models\OrderItem;
@@ -20,24 +21,43 @@ class OrderService
$items = $this->cart->get(); $items = $this->cart->get();
$subtotal = $this->cart->subtotal(); $subtotal = $this->cart->subtotal();
$shippingRate = ShippingRate::forCart($subtotal); $country = $addressData['shipping']['country'] ?? $addressData['billing']['country'] ?? 'DE';
$shippingRate = ShippingRate::forCart($subtotal, $country);
$shippingCost = $shippingRate ? $shippingRate->getCostForTotal($subtotal) : 0; $shippingCost = $shippingRate ? $shippingRate->getCostForTotal($subtotal) : 0;
$taxTotal = array_sum(array_map(function ($item) { // Gutschein aus Session
$net = $item['price'] / (1 + $item['tax_rate'] / 100); $couponCode = null;
return round(($item['price'] - $net) * $item['qty'], 2); $discountAmount = 0;
if ($code = session('coupon_code')) {
$coupon = Coupon::findValid($code);
if ($coupon) {
$discountAmount = $coupon->calcDiscount($subtotal);
$couponCode = $coupon->code;
$coupon->increment('used_count');
}
}
$taxable = max(0, $subtotal - $discountAmount);
$taxTotal = array_sum(array_map(function ($item) use ($subtotal, $discountAmount) {
$ratio = $subtotal > 0 ? ($item['price'] * $item['qty']) / $subtotal : 0;
$itemNet = ($item['price'] * $item['qty'] - $discountAmount * $ratio) / (1 + $item['tax_rate'] / 100);
return round(($item['price'] * $item['qty'] - $discountAmount * $ratio) - $itemNet, 2);
}, $items)); }, $items));
$total = max(0, $subtotal - $discountAmount) + $shippingCost;
$order = Order::create([ $order = Order::create([
'order_number' => Order::generateOrderNumber(), 'order_number' => Order::generateOrderNumber(),
'user_id' => auth()->id(), 'user_id' => auth()->id(),
'guest_email' => auth()->check() ? null : ($addressData['email'] ?? null), 'guest_email' => auth()->check() ? null : ($addressData['email'] ?? null),
'status' => 'new', 'status' => 'new',
'payment_method' => $paymentMethod, 'payment_method' => $paymentMethod,
'coupon_code' => $couponCode,
'discount_amount' => $discountAmount,
'subtotal' => $subtotal, 'subtotal' => $subtotal,
'tax_total' => $taxTotal, 'tax_total' => $taxTotal,
'shipping_cost' => $shippingCost, 'shipping_cost' => $shippingCost,
'total' => $subtotal + $shippingCost, 'total' => $total,
]); ]);
foreach ($items as $item) { foreach ($items as $item) {
@@ -50,7 +70,6 @@ class OrderService
'unit_price' => $item['price'], 'unit_price' => $item['price'],
'tax_rate' => $item['tax_rate'], 'tax_rate' => $item['tax_rate'],
]); ]);
// Bestand reduzieren — nur wenn track_stock aktiv
$variant = ProductVariant::with('product')->find($item['variant_id']); $variant = ProductVariant::with('product')->find($item['variant_id']);
if ($variant && $variant->product->track_stock) { if ($variant && $variant->product->track_stock) {
$variant->decrement('stock', $item['qty']); $variant->decrement('stock', $item['qty']);
@@ -63,6 +82,7 @@ class OrderService
} }
$this->cart->clear(); $this->cart->clear();
session()->forget('coupon_code');
Mail::to($order->guest_email ?? $order->user?->email)->send(new OrderConfirmationMail($order)); Mail::to($order->guest_email ?? $order->user?->email)->send(new OrderConfirmationMail($order));
@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::create('coupons', function (Blueprint $table) {
$table->id();
$table->string('code')->unique();
$table->enum('type', ['percent', 'fixed'])->default('fixed');
$table->decimal('value', 10, 2);
$table->decimal('min_order_value', 10, 2)->nullable();
$table->timestamp('expires_at')->nullable();
$table->unsignedInteger('max_uses')->nullable();
$table->unsignedInteger('used_count')->default(0);
$table->boolean('active')->default(true);
$table->timestamps();
});
Schema::table('orders', function (Blueprint $table) {
$table->string('coupon_code')->nullable()->after('payment_method');
$table->decimal('discount_amount', 10, 2)->default(0)->after('coupon_code');
});
}
public function down(): void
{
Schema::table('orders', function (Blueprint $table) {
$table->dropColumn(['coupon_code', 'discount_amount']);
});
Schema::dropIfExists('coupons');
}
};
@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::create('newsletter_subscribers', function (Blueprint $table) {
$table->id();
$table->string('email')->unique();
$table->string('token', 64)->nullable();
$table->timestamp('confirmed_at')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('newsletter_subscribers');
}
};
@@ -0,0 +1,21 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::table('products', function (Blueprint $table) {
$table->decimal('sale_price', 10, 2)->nullable()->after('base_price');
});
}
public function down(): void
{
Schema::table('products', function (Blueprint $table) {
$table->dropColumn('sale_price');
});
}
};
@@ -0,0 +1,74 @@
@extends('layouts.admin')
@section('title', isset($coupon) ? 'Gutschein bearbeiten' : 'Neuer Gutschein')
@section('content')
<div class="flex items-center gap-3 mb-6">
<a href="{{ route('admin.coupons.index') }}" class="text-gray-400 hover:text-gray-600">← Zurück</a>
<h2 class="text-xl font-bold">{{ isset($coupon) ? 'Gutschein bearbeiten' : 'Neuer Gutschein' }}</h2>
</div>
<form method="POST" action="{{ isset($coupon) ? route('admin.coupons.update', $coupon) : route('admin.coupons.store') }}"
class="bg-white rounded shadow p-6 space-y-4 max-w-lg">
@csrf
@isset($coupon) @method('PUT') @endisset
@if($errors->any())
<div class="bg-red-50 border border-red-200 rounded px-4 py-3 text-sm text-red-700">
@foreach($errors->all() as $e)<p>• {{ $e }}</p>@endforeach
</div>
@endif
<div>
<label class="block text-sm font-medium mb-1">Code *</label>
<input type="text" name="code" value="{{ old('code', $coupon->code ?? '') }}"
class="w-full border rounded px-3 py-2 text-sm font-mono uppercase" required placeholder="SOMMER20">
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium mb-1">Typ *</label>
<select name="type" class="w-full border rounded px-3 py-2 text-sm">
<option value="fixed" {{ old('type', $coupon->type ?? 'fixed') === 'fixed' ? 'selected' : '' }}>Fester Betrag (€)</option>
<option value="percent" {{ old('type', $coupon->type ?? '') === 'percent' ? 'selected' : '' }}>Prozent (%)</option>
</select>
</div>
<div>
<label class="block text-sm font-medium mb-1">Wert *</label>
<input type="number" name="value" step="0.01" min="0.01"
value="{{ old('value', $coupon->value ?? '') }}"
class="w-full border rounded px-3 py-2 text-sm" required>
</div>
</div>
<div>
<label class="block text-sm font-medium mb-1">Mindestbestellwert (€)</label>
<input type="number" name="min_order_value" step="0.01" min="0"
value="{{ old('min_order_value', $coupon->min_order_value ?? '') }}"
class="w-full border rounded px-3 py-2 text-sm" placeholder="leer = kein Minimum">
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium mb-1">Ablaufdatum</label>
<input type="date" name="expires_at"
value="{{ old('expires_at', isset($coupon->expires_at) ? $coupon->expires_at->format('Y-m-d') : '') }}"
class="w-full border rounded px-3 py-2 text-sm">
</div>
<div>
<label class="block text-sm font-medium mb-1">Max. Verwendungen</label>
<input type="number" name="max_uses" min="1"
value="{{ old('max_uses', $coupon->max_uses ?? '') }}"
class="w-full border rounded px-3 py-2 text-sm" placeholder="leer = unbegrenzt">
</div>
</div>
<label class="flex items-center gap-2 text-sm">
<input type="checkbox" name="active" value="1" {{ old('active', $coupon->active ?? true) ? 'checked' : '' }}>
Aktiv
</label>
<div class="flex gap-3 pt-2">
<button type="submit" class="bg-blue-600 text-white px-6 py-2 rounded hover:bg-blue-700">Speichern</button>
<a href="{{ route('admin.coupons.index') }}" class="border px-6 py-2 rounded hover:bg-gray-50 text-sm">Abbrechen</a>
</div>
</form>
@endsection
@@ -0,0 +1,59 @@
@extends('layouts.admin')
@section('title', 'Gutscheine')
@section('content')
<div class="flex items-center justify-between mb-6">
<h2 class="text-xl font-bold">Gutscheine</h2>
<a href="{{ route('admin.coupons.create') }}" class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700 text-sm">+ Neuer Gutschein</a>
</div>
@if(session('success'))
<div class="bg-green-100 border border-green-300 text-green-800 px-4 py-3 rounded mb-4">{{ session('success') }}</div>
@endif
<div class="bg-white rounded shadow overflow-hidden">
<table class="w-full text-sm">
<thead class="bg-gray-50 text-gray-600 uppercase text-xs">
<tr>
<th class="px-4 py-3 text-left">Code</th>
<th class="px-4 py-3 text-left">Typ</th>
<th class="px-4 py-3 text-left">Wert</th>
<th class="px-4 py-3 text-left">Mind. Bestellwert</th>
<th class="px-4 py-3 text-left">Läuft ab</th>
<th class="px-4 py-3 text-left">Verwendet</th>
<th class="px-4 py-3 text-left">Status</th>
<th class="px-4 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
@forelse($coupons as $coupon)
<tr class="hover:bg-gray-50">
<td class="px-4 py-3 font-mono font-bold">{{ $coupon->code }}</td>
<td class="px-4 py-3">{{ $coupon->type === 'percent' ? 'Prozent' : 'Betrag' }}</td>
<td class="px-4 py-3">
{{ number_format($coupon->value, 2, ',', '.') }}{{ $coupon->type === 'percent' ? ' %' : ' €' }}
</td>
<td class="px-4 py-3">{{ $coupon->min_order_value ? number_format($coupon->min_order_value, 2, ',', '.') . ' €' : '–' }}</td>
<td class="px-4 py-3">{{ $coupon->expires_at ? $coupon->expires_at->format('d.m.Y') : '–' }}</td>
<td class="px-4 py-3">{{ $coupon->used_count }}{{ $coupon->max_uses ? ' / ' . $coupon->max_uses : '' }}</td>
<td class="px-4 py-3">
@if($coupon->active)
<span class="bg-green-100 text-green-800 text-xs px-2 py-0.5 rounded-full">Aktiv</span>
@else
<span class="bg-gray-100 text-gray-600 text-xs px-2 py-0.5 rounded-full">Inaktiv</span>
@endif
</td>
<td class="px-4 py-3 text-right flex gap-2 justify-end">
<a href="{{ route('admin.coupons.edit', $coupon) }}" class="text-blue-600 hover:underline">Bearbeiten</a>
<form method="POST" action="{{ route('admin.coupons.destroy', $coupon) }}" onsubmit="return confirm('Gutschein löschen?')">
@csrf @method('DELETE')
<button class="text-red-500 hover:underline">Löschen</button>
</form>
</td>
</tr>
@empty
<tr><td colspan="8" class="px-4 py-8 text-center text-gray-400">Noch keine Gutscheine angelegt.</td></tr>
@endforelse
</tbody>
</table>
</div>
@endsection
@@ -0,0 +1,55 @@
@extends('layouts.admin')
@section('title', 'Newsletter-Abonnenten')
@section('content')
<div class="flex items-center justify-between mb-6">
<h2 class="text-xl font-bold">Newsletter-Abonnenten</h2>
<a href="{{ route('admin.newsletter.export') }}" class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 text-sm">CSV exportieren</a>
</div>
@if(session('success'))
<div class="bg-green-100 border border-green-300 text-green-800 px-4 py-3 rounded mb-4">{{ session('success') }}</div>
@endif
<div class="mb-3 text-sm text-gray-500">
{{ $subscribers->whereNotNull('confirmed_at')->count() }} bestätigt,
{{ $subscribers->whereNull('confirmed_at')->count() }} ausstehend
</div>
<div class="bg-white rounded shadow overflow-hidden">
<table class="w-full text-sm">
<thead class="bg-gray-50 text-gray-600 uppercase text-xs">
<tr>
<th class="px-4 py-3 text-left">E-Mail</th>
<th class="px-4 py-3 text-left">Status</th>
<th class="px-4 py-3 text-left">Angemeldet am</th>
<th class="px-4 py-3 text-left">Bestätigt am</th>
<th class="px-4 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
@forelse($subscribers as $sub)
<tr class="hover:bg-gray-50">
<td class="px-4 py-3">{{ $sub->email }}</td>
<td class="px-4 py-3">
@if($sub->isConfirmed())
<span class="bg-green-100 text-green-800 text-xs px-2 py-0.5 rounded-full">Bestätigt</span>
@else
<span class="bg-yellow-100 text-yellow-800 text-xs px-2 py-0.5 rounded-full">Ausstehend</span>
@endif
</td>
<td class="px-4 py-3 text-gray-500">{{ $sub->created_at->format('d.m.Y H:i') }}</td>
<td class="px-4 py-3 text-gray-500">{{ $sub->confirmed_at?->format('d.m.Y H:i') ?? '–' }}</td>
<td class="px-4 py-3 text-right">
<form method="POST" action="{{ route('admin.newsletter.destroy', $sub) }}" onsubmit="return confirm('Abonnent löschen?')">
@csrf @method('DELETE')
<button class="text-red-500 hover:underline text-sm">Löschen</button>
</form>
</td>
</tr>
@empty
<tr><td colspan="5" class="px-4 py-8 text-center text-gray-400">Keine Abonnenten.</td></tr>
@endforelse
</tbody>
</table>
</div>
@endsection
@@ -21,11 +21,15 @@
<textarea name="description" rows="6" class="w-full border rounded px-3 py-2 text-sm">{{ old('description', $product->description ?? '') }}</textarea> <textarea name="description" rows="6" class="w-full border rounded px-3 py-2 text-sm">{{ old('description', $product->description ?? '') }}</textarea>
</div> </div>
<div class="grid grid-cols-3 gap-4"> <div class="grid grid-cols-4 gap-4">
<div> <div>
<label class="block text-sm font-medium mb-1">Bruttopreis (€) *</label> <label class="block text-sm font-medium mb-1">Bruttopreis (€) *</label>
<input type="number" name="base_price" step="0.01" min="0" value="{{ old('base_price', $product->base_price ?? '') }}" class="w-full border rounded px-3 py-2 text-sm" required> <input type="number" name="base_price" step="0.01" min="0" value="{{ old('base_price', $product->base_price ?? '') }}" class="w-full border rounded px-3 py-2 text-sm" required>
</div> </div>
<div>
<label class="block text-sm font-medium mb-1">Angebotspreis (€)</label>
<input type="number" name="sale_price" step="0.01" min="0" value="{{ old('sale_price', $product->sale_price ?? '') }}" class="w-full border rounded px-3 py-2 text-sm" placeholder="leer = kein Angebot">
</div>
<div> <div>
<label class="block text-sm font-medium mb-1">MwSt.-Satz *</label> <label class="block text-sm font-medium mb-1">MwSt.-Satz *</label>
<select name="tax_rate" class="w-full border rounded px-3 py-2 text-sm"> <select name="tax_rate" class="w-full border rounded px-3 py-2 text-sm">
@@ -3,11 +3,19 @@
@section('content') @section('content')
<div class="max-w-2xl"> <div class="max-w-2xl">
<div class="bg-white rounded shadow p-6 mb-6"> <div class="bg-white rounded shadow p-6 mb-6">
<h3 class="font-semibold mb-4">Neue Versandzone</h3> <h3 class="font-semibold mb-1">Neue Versandzone</h3>
<p class="text-xs text-gray-400 mb-4">Zonen: <code>DE</code> = Deutschland, <code>DACH</code> = AT/CH, <code>EU</code> = EU-Länder, <code>WORLD</code> = Welt</p>
<form method="POST" action="{{ route('admin.shipping.store') }}" class="grid grid-cols-2 gap-3"> <form method="POST" action="{{ route('admin.shipping.store') }}" class="grid grid-cols-2 gap-3">
@csrf @csrf
<div><label class="block text-xs mb-1">Name</label><input type="text" name="name" class="w-full border rounded px-3 py-2 text-sm" required></div> <div><label class="block text-xs mb-1">Name</label><input type="text" name="name" class="w-full border rounded px-3 py-2 text-sm" required></div>
<div><label class="block text-xs mb-1">Zone (z.B. DE, AT)</label><input type="text" name="zone" value="DE" class="w-full border rounded px-3 py-2 text-sm" required></div> <div><label class="block text-xs mb-1">Zone</label>
<select name="zone" class="w-full border rounded px-3 py-2 text-sm">
<option value="DE">DE – Deutschland</option>
<option value="DACH">DACH – Österreich + Schweiz</option>
<option value="EU">EU – Europa (ohne DE/DACH)</option>
<option value="WORLD">WORLD – Weltweit</option>
</select>
</div>
<div><label class="block text-xs mb-1">Preis (€)</label><input type="number" name="price" step="0.01" class="w-full border rounded px-3 py-2 text-sm" required></div> <div><label class="block text-xs mb-1">Preis (€)</label><input type="number" name="price" step="0.01" class="w-full border rounded px-3 py-2 text-sm" required></div>
<div><label class="block text-xs mb-1">Kostenlos ab (€, leer = nie)</label><input type="number" name="free_from" step="0.01" class="w-full border rounded px-3 py-2 text-sm"></div> <div><label class="block text-xs mb-1">Kostenlos ab (€, leer = nie)</label><input type="number" name="free_from" step="0.01" class="w-full border rounded px-3 py-2 text-sm"></div>
<div class="col-span-2 flex items-center gap-3"> <div class="col-span-2 flex items-center gap-3">
+3
View File
@@ -27,6 +27,9 @@
<a href="{{ route('admin.pages.index') }}" class="block px-3 py-2 rounded hover:bg-gray-700 {{ request()->routeIs('admin.pages.*') ? 'bg-gray-700' : '' }}">Seiten</a> <a href="{{ route('admin.pages.index') }}" class="block px-3 py-2 rounded hover:bg-gray-700 {{ request()->routeIs('admin.pages.*') ? 'bg-gray-700' : '' }}">Seiten</a>
<a href="{{ route('admin.banners.index') }}" class="block px-3 py-2 rounded hover:bg-gray-700 {{ request()->routeIs('admin.banners.*') ? 'bg-gray-700' : '' }}">Banner</a> <a href="{{ route('admin.banners.index') }}" class="block px-3 py-2 rounded hover:bg-gray-700 {{ request()->routeIs('admin.banners.*') ? 'bg-gray-700' : '' }}">Banner</a>
<a href="{{ route('admin.faqs.index') }}" class="block px-3 py-2 rounded hover:bg-gray-700 {{ request()->routeIs('admin.faqs.*') ? 'bg-gray-700' : '' }}">FAQ</a> <a href="{{ route('admin.faqs.index') }}" class="block px-3 py-2 rounded hover:bg-gray-700 {{ request()->routeIs('admin.faqs.*') ? 'bg-gray-700' : '' }}">FAQ</a>
<div class="pt-2 pb-1 text-xs text-gray-400 uppercase tracking-wide">Marketing</div>
<a href="{{ route('admin.coupons.index') }}" class="block px-3 py-2 rounded hover:bg-gray-700 {{ request()->routeIs('admin.coupons.*') ? 'bg-gray-700' : '' }}">Gutscheine</a>
<a href="{{ route('admin.newsletter.index') }}" class="block px-3 py-2 rounded hover:bg-gray-700 {{ request()->routeIs('admin.newsletter.*') ? 'bg-gray-700' : '' }}">Newsletter</a>
<div class="pt-2 pb-1 text-xs text-gray-400 uppercase tracking-wide">System</div> <div class="pt-2 pb-1 text-xs text-gray-400 uppercase tracking-wide">System</div>
<a href="{{ route('admin.admins.index') }}" class="block px-3 py-2 rounded hover:bg-gray-700 {{ request()->routeIs('admin.admins.*') ? 'bg-gray-700' : '' }}">Admin-Benutzer</a> <a href="{{ route('admin.admins.index') }}" class="block px-3 py-2 rounded hover:bg-gray-700 {{ request()->routeIs('admin.admins.*') ? 'bg-gray-700' : '' }}">Admin-Benutzer</a>
<a href="{{ route('admin.email-templates.index') }}" class="block px-3 py-2 rounded hover:bg-gray-700 {{ request()->routeIs('admin.email-templates.*') ? 'bg-gray-700' : '' }}">E-Mail-Templates</a> <a href="{{ route('admin.email-templates.index') }}" class="block px-3 py-2 rounded hover:bg-gray-700 {{ request()->routeIs('admin.email-templates.*') ? 'bg-gray-700' : '' }}">E-Mail-Templates</a>
+21 -1
View File
@@ -196,7 +196,27 @@
$hasBlog = \App\Models\Page::where('type','blog')->where('published', true)->exists(); $hasBlog = \App\Models\Page::where('type','blog')->where('published', true)->exists();
$hasFaq = \App\Models\Faq::exists(); $hasFaq = \App\Models\Faq::exists();
@endphp @endphp
<footer class="bg-gray-900 text-gray-400 text-sm mt-12"> {{-- Newsletter --}}
<div class="bg-gray-800 text-white py-8">
<div class="max-w-6xl mx-auto px-4 flex flex-col sm:flex-row items-center gap-6">
<div class="shrink-0 text-center sm:text-left">
<p class="font-semibold text-lg">Newsletter abonnieren</p>
<p class="text-gray-400 text-sm">Angebote & Neuigkeiten direkt in Ihr Postfach.</p>
</div>
<form method="POST" action="{{ route('newsletter.subscribe') }}" class="flex gap-2 flex-1 max-w-md w-full">
@csrf
<input type="email" name="newsletter_email" placeholder="Ihre E-Mail-Adresse"
class="flex-1 rounded px-4 py-2 text-gray-800 text-sm border-0" required>
<button class="btn-primary px-4 py-2 rounded text-sm font-medium whitespace-nowrap">Anmelden</button>
</form>
@if(session('newsletter_success'))
<p class="text-green-400 text-sm">{{ session('newsletter_success') }}</p>
@elseif(session('newsletter_info'))
<p class="text-yellow-400 text-sm">{{ session('newsletter_info') }}</p>
@endif
</div>
</div>
<footer class="bg-gray-900 text-gray-400 text-sm">
<div class="max-w-6xl mx-auto px-4 py-8 grid grid-cols-2 md:grid-cols-4 gap-6"> <div class="max-w-6xl mx-auto px-4 py-8 grid grid-cols-2 md:grid-cols-4 gap-6">
<div> <div>
@if($logo) @if($logo)
@@ -48,6 +48,11 @@
<div class="bg-white border rounded-lg p-6 sticky top-4"> <div class="bg-white border rounded-lg p-6 sticky top-4">
<div class="space-y-2 text-sm mb-3 border-b pb-3"> <div class="space-y-2 text-sm mb-3 border-b pb-3">
<div class="flex justify-between"><span>Zwischensumme</span><span>{{ number_format($subtotal, 2, ',', '.') }} €</span></div> <div class="flex justify-between"><span>Zwischensumme</span><span>{{ number_format($subtotal, 2, ',', '.') }} €</span></div>
@if(($discount ?? 0) > 0)
<div class="flex justify-between text-green-600">
<span>Gutschein ({{ $couponCode }})</span><span>- {{ number_format($discount, 2, ',', '.') }} €</span>
</div>
@endif
<div class="flex justify-between"><span>Versand</span><span>{{ $shippingCost == 0 ? 'Kostenlos' : number_format($shippingCost, 2, ',', '.') . ' €' }}</span></div> <div class="flex justify-between"><span>Versand</span><span>{{ $shippingCost == 0 ? 'Kostenlos' : number_format($shippingCost, 2, ',', '.') . ' €' }}</span></div>
</div> </div>
<div class="flex justify-between font-bold text-lg"> <div class="flex justify-between font-bold text-lg">
+33 -2
View File
@@ -186,12 +186,43 @@
<h2 class="font-semibold mb-4">Zusammenfassung</h2> <h2 class="font-semibold mb-4">Zusammenfassung</h2>
<div class="space-y-2 text-sm mb-4 border-b pb-4"> <div class="space-y-2 text-sm mb-4 border-b pb-4">
<div class="flex justify-between"><span>Zwischensumme</span><span>{{ number_format($subtotal, 2, ',', '.') }} €</span></div> <div class="flex justify-between"><span>Zwischensumme</span><span>{{ number_format($subtotal, 2, ',', '.') }} €</span></div>
<div class="flex justify-between"><span>Versand</span><span>{{ $shippingCost == 0 ? 'Kostenlos' : number_format($shippingCost, 2, ',', '.') . ' €' }}</span></div> @if($discount > 0)
<div class="flex justify-between text-green-600">
<span>Gutschein ({{ $couponCode }})</span>
<span>- {{ number_format($discount, 2, ',', '.') }} €</span>
</div>
@endif
<div class="flex justify-between"><span>Versand</span><span id="shipping-display">{{ $shippingCost == 0 ? 'Kostenlos' : number_format($shippingCost, 2, ',', '.') . ' €' }}</span></div>
</div> </div>
<div class="flex justify-between font-bold text-lg"> <div class="flex justify-between font-bold text-lg">
<span>Gesamt</span><span>{{ number_format($total, 2, ',', '.') }} €</span> <span>Gesamt</span><span id="total-display">{{ number_format($total, 2, ',', '.') }} €</span>
</div> </div>
<p class="text-xs text-gray-400 mt-2">inkl. MwSt.</p> <p class="text-xs text-gray-400 mt-2">inkl. MwSt.</p>
{{-- Gutscheincode --}}
<div class="mt-4 border-t pt-4">
@if(session('coupon_error'))
<p class="text-red-600 text-xs mb-2">{{ session('coupon_error') }}</p>
@endif
@if(session('coupon_success'))
<p class="text-green-600 text-xs mb-2">{{ session('coupon_success') }}</p>
@endif
@if($couponCode)
<div class="flex items-center justify-between text-sm mb-2">
<span class="font-mono bg-green-50 text-green-700 px-2 py-0.5 rounded">{{ $couponCode }}</span>
<form method="POST" action="{{ route('checkout.coupon.remove') }}">@csrf
<button class="text-red-500 text-xs hover:underline">Entfernen</button>
</form>
</div>
@else
<form method="POST" action="{{ route('checkout.coupon.apply') }}" class="flex gap-2">
@csrf
<input type="text" name="coupon_code" placeholder="Gutscheincode"
class="flex-1 border rounded px-3 py-1.5 text-sm uppercase" style="text-transform:uppercase">
<button class="bg-gray-700 text-white px-3 py-1.5 rounded text-sm hover:bg-gray-800">OK</button>
</form>
@endif
</div>
</div> </div>
</div> </div>
</div> </div>
+40
View File
@@ -2,6 +2,30 @@
@section('title', \App\Models\Setting::get('shop_name', 'Shop')) @section('title', \App\Models\Setting::get('shop_name', 'Shop'))
@section('content') @section('content')
{{-- USP-Leiste --}}
<div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-8 text-center">
<div class="bg-white rounded-lg p-4 border">
<div class="text-2xl mb-1">🚚</div>
<p class="text-sm font-semibold">Schnelle Lieferung</p>
<p class="text-xs text-gray-400">1-3 Werktage</p>
</div>
<div class="bg-white rounded-lg p-4 border">
<div class="text-2xl mb-1">🔒</div>
<p class="text-sm font-semibold">Sicher bezahlen</p>
<p class="text-xs text-gray-400">Vorkasse & Rechnung</p>
</div>
<div class="bg-white rounded-lg p-4 border">
<div class="text-2xl mb-1">↩️</div>
<p class="text-sm font-semibold">14 Tage Rückgabe</p>
<p class="text-xs text-gray-400">Widerrufsrecht</p>
</div>
<div class="bg-white rounded-lg p-4 border">
<div class="text-2xl mb-1">📞</div>
<p class="text-sm font-semibold">Persönlicher Service</p>
<p class="text-xs text-gray-400">{{ \App\Models\Setting::get('shop_phone', '') }}</p>
</div>
</div>
{{-- Banner --}} {{-- Banner --}}
@if($banners->count()) @if($banners->count())
<div class="relative mb-10 -mx-4" x-data="{ current: 0 }"> <div class="relative mb-10 -mx-4" x-data="{ current: 0 }">
@@ -65,6 +89,22 @@
</div> </div>
@endif @endif
{{-- Sonderangebote --}}
@if($saleProducts->count())
<div class="mb-12">
<div class="flex items-center gap-3 mb-6">
<span class="text-2xl">🏷️</span>
<h2 class="text-2xl font-bold">Sonderangebote</h2>
<span class="bg-red-100 text-red-700 text-xs font-bold px-2 py-0.5 rounded-full">SALE</span>
</div>
<div class="grid grid-cols-2 md:grid-cols-4 gap-6">
@foreach($saleProducts as $product)
@include('shop.products._card', ['product' => $product])
@endforeach
</div>
</div>
@endif
{{-- Neue Produkte --}} {{-- Neue Produkte --}}
@if($newProducts->count()) @if($newProducts->count())
<div class="mb-12"> <div class="mb-12">
+16 -6
View File
@@ -4,17 +4,27 @@
@else @else
<div class="w-full h-48 bg-gray-100 flex items-center justify-center text-5xl">📦</div> <div class="w-full h-48 bg-gray-100 flex items-center justify-center text-5xl">📦</div>
@endif @endif
@if(isset($badge))
<span class="absolute top-2 left-2 bg-yellow-400 text-yellow-900 text-xs font-bold px-2 py-0.5 rounded-full"> @if($product->isOnSale())
★ {{ $badge }} <span class="absolute top-2 left-2 bg-red-500 text-white text-xs font-bold px-2 py-0.5 rounded-full">SALE</span>
</span> @elseif(isset($badge))
<span class="absolute top-2 left-2 bg-yellow-400 text-yellow-900 text-xs font-bold px-2 py-0.5 rounded-full">★ {{ $badge }}</span>
@endif @endif
<div class="p-4"> <div class="p-4">
<p class="text-xs text-gray-400 mb-1">{{ $product->category?->name }}</p> <p class="text-xs text-gray-400 mb-1">{{ $product->category?->name }}</p>
<h3 class="font-semibold text-sm mb-2 group-hover:text-blue-600">{{ $product->name }}</h3> <h3 class="font-semibold text-sm mb-2 group-hover:text-primary">{{ $product->name }}</h3>
<div class="flex items-baseline gap-2"> <div class="flex items-baseline gap-2">
<span class="text-lg font-bold text-blue-700">{{ number_format($product->base_price, 2, ',', '.') }} €</span> @if($product->isOnSale())
<span class="text-lg font-bold text-red-600">{{ number_format($product->sale_price, 2, ',', '.') }} €</span>
<span class="text-sm text-gray-400 line-through">{{ number_format($product->base_price, 2, ',', '.') }} €</span>
@else
<span class="text-lg font-bold text-primary">{{ number_format($product->base_price, 2, ',', '.') }} €</span>
@endif
<span class="text-xs text-gray-400">inkl. {{ number_format($product->tax_rate, 0) }}% MwSt.</span> <span class="text-xs text-gray-400">inkl. {{ number_format($product->tax_rate, 0) }}% MwSt.</span>
</div> </div>
@if($product->track_stock && $product->variants->sum('stock') <= 0)
<p class="text-xs text-red-500 mt-1">Nicht vorrätig</p>
@endif
</div> </div>
</a> </a>
+20
View File
@@ -25,6 +25,13 @@ Route::post('/kasse/adresse', [Shop\CheckoutController::class, 'storeAddress'])-
Route::get('/kasse/zahlung', [Shop\CheckoutController::class, 'payment'])->name('checkout.payment'); Route::get('/kasse/zahlung', [Shop\CheckoutController::class, 'payment'])->name('checkout.payment');
Route::match(['GET','POST'], '/kasse/bestaetigen', [Shop\CheckoutController::class, 'confirm'])->name('checkout.confirm'); Route::match(['GET','POST'], '/kasse/bestaetigen', [Shop\CheckoutController::class, 'confirm'])->name('checkout.confirm');
Route::get('/kasse/danke/{order}', [Shop\CheckoutController::class, 'thankyou'])->name('checkout.thankyou'); Route::get('/kasse/danke/{order}', [Shop\CheckoutController::class, 'thankyou'])->name('checkout.thankyou');
Route::post('/kasse/gutschein', [Shop\CheckoutController::class, 'applyCoupon'])->name('checkout.coupon.apply');
Route::post('/kasse/gutschein/entfernen', [Shop\CheckoutController::class, 'removeCoupon'])->name('checkout.coupon.remove');
Route::get('/kasse/versandkosten', [Shop\CheckoutController::class, 'shippingCost'])->name('checkout.shipping.cost');
// Newsletter
Route::post('/newsletter', [Shop\NewsletterController::class, 'subscribe'])->name('newsletter.subscribe');
Route::get('/newsletter/bestaetigen/{token}', [Shop\NewsletterController::class, 'confirm'])->name('newsletter.confirm');
// CMS-Seiten // CMS-Seiten
Route::get('/seite/{slug}', [Shop\PageController::class, 'show'])->name('page'); Route::get('/seite/{slug}', [Shop\PageController::class, 'show'])->name('page');
@@ -105,6 +112,19 @@ Route::middleware(['auth', 'admin'])->prefix('admin')->name('admin.')->group(fun
Route::put('admins/{admin}', [Admin\AdminUserController::class, 'update'])->name('admins.update'); Route::put('admins/{admin}', [Admin\AdminUserController::class, 'update'])->name('admins.update');
Route::delete('admins/{admin}', [Admin\AdminUserController::class, 'destroy'])->name('admins.destroy'); Route::delete('admins/{admin}', [Admin\AdminUserController::class, 'destroy'])->name('admins.destroy');
// Gutscheine
Route::get('coupons', [Admin\CouponController::class, 'index'])->name('coupons.index');
Route::get('coupons/create', [Admin\CouponController::class, 'create'])->name('coupons.create');
Route::post('coupons', [Admin\CouponController::class, 'store'])->name('coupons.store');
Route::get('coupons/{coupon}/edit', [Admin\CouponController::class, 'edit'])->name('coupons.edit');
Route::put('coupons/{coupon}', [Admin\CouponController::class, 'update'])->name('coupons.update');
Route::delete('coupons/{coupon}', [Admin\CouponController::class, 'destroy'])->name('coupons.destroy');
// Newsletter
Route::get('newsletter', [Admin\NewsletterController::class, 'index'])->name('newsletter.index');
Route::get('newsletter/export', [Admin\NewsletterController::class, 'export'])->name('newsletter.export');
Route::delete('newsletter/{subscriber}', [Admin\NewsletterController::class, 'destroy'])->name('newsletter.destroy');
// E-Mail-Templates // E-Mail-Templates
Route::get('email-templates', [Admin\EmailTemplateController::class, 'index'])->name('email-templates.index'); Route::get('email-templates', [Admin\EmailTemplateController::class, 'index'])->name('email-templates.index');
Route::get('email-templates/{emailTemplate}/edit', [Admin\EmailTemplateController::class, 'edit'])->name('email-templates.edit'); Route::get('email-templates/{emailTemplate}/edit', [Admin\EmailTemplateController::class, 'edit'])->name('email-templates.edit');