Add delivery_note field to products for planned delivery info
Deploy to Production (witstore.wende.it) / deploy (push) Successful in 7s
Release erstellen / build-release (push) Successful in 47s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 07:17:40 +02:00
co-authored by Claude Sonnet 4.6
parent 6d16a6b0f9
commit 9dbc6e7ea1
6 changed files with 42 additions and 6 deletions
@@ -46,6 +46,7 @@ class ProductController extends Controller
'featured' => 'boolean',
'track_stock' => 'boolean',
'sort_order' => 'integer',
'delivery_note' => 'nullable|string|max:255',
]);
$data['slug'] = Str::slug($data['name']);
$data['active'] = $request->boolean('active');
@@ -91,6 +92,7 @@ class ProductController extends Controller
'featured' => 'boolean',
'track_stock' => 'boolean',
'sort_order' => 'integer',
'delivery_note' => 'nullable|string|max:255',
]);
$data['slug'] = Str::slug($data['name']);
$data['active'] = $request->boolean('active');
+1 -1
View File
@@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
class Product extends Model
{
protected $fillable = ['category_id','name','slug','description','base_price','sale_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','delivery_note'];
protected $casts = ['active' => 'boolean', 'featured' => 'boolean', 'track_stock' => 'boolean', 'base_price' => 'decimal:2', 'sale_price' => 'decimal:2', 'tax_rate' => 'decimal:2'];
@@ -0,0 +1,18 @@
<?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->string('delivery_note')->nullable()->after('track_stock');
});
}
public function down(): void {
Schema::table('products', function (Blueprint $table) {
$table->dropColumn('delivery_note');
});
}
};
@@ -165,6 +165,12 @@
</label>
</div>
<div>
<label class="block text-sm font-medium mb-1">Lieferhinweis <span class="text-gray-400 font-normal">(optional, z.B. "Geplante Lieferung: Mai 2026")</span></label>
<input type="text" name="delivery_note" value="{{ old('delivery_note', $product->delivery_note ?? '') }}"
class="w-full border rounded px-3 py-2 text-sm" placeholder="z.B. Geplante Lieferung: Mai 2026">
</div>
<div class="flex gap-2">
<button type="submit" class="flex-1 bg-blue-600 text-white py-2 rounded hover:bg-blue-700 text-sm">Speichern</button>
<a href="{{ route('admin.products.index') }}" class="flex-1 text-center py-2 rounded border text-sm hover:bg-gray-50">Abbrechen</a>
@@ -24,7 +24,13 @@
<span class="text-xs text-gray-400">inkl. {{ number_format($product->tax_rate, 0) }}% MwSt.</span>
</div>
@if($product->track_stock && $product->variants->sum('stock') <= 0)
@if($product->delivery_note)
<p class="text-xs text-orange-500 mt-1">📦 {{ $product->delivery_note }}</p>
@else
<p class="text-xs text-red-500 mt-1">Nicht vorrätig</p>
@endif
@elseif($product->delivery_note && !($product->track_stock && $product->variants->sum('stock') > 0))
<p class="text-xs text-orange-500 mt-1">📦 {{ $product->delivery_note }}</p>
@endif
</div>
</a>
@@ -74,6 +74,10 @@
@endif
@endif
@if($product->delivery_note)
<p class="text-sm text-orange-500 mb-3">📦 {{ $product->delivery_note }}</p>
@endif
{{-- In den Warenkorb --}}
<form method="POST" action="{{ route('cart.add') }}">
@csrf