Add delivery_note field to products for planned delivery info
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -44,8 +44,9 @@ class ProductController extends Controller
|
||||
'weight' => 'nullable|numeric|min:0',
|
||||
'active' => 'boolean',
|
||||
'featured' => 'boolean',
|
||||
'track_stock' => 'boolean',
|
||||
'sort_order' => 'integer',
|
||||
'track_stock' => 'boolean',
|
||||
'sort_order' => 'integer',
|
||||
'delivery_note' => 'nullable|string|max:255',
|
||||
]);
|
||||
$data['slug'] = Str::slug($data['name']);
|
||||
$data['active'] = $request->boolean('active');
|
||||
@@ -89,8 +90,9 @@ class ProductController extends Controller
|
||||
'weight' => 'nullable|numeric|min:0',
|
||||
'active' => 'boolean',
|
||||
'featured' => 'boolean',
|
||||
'track_stock' => 'boolean',
|
||||
'sort_order' => 'integer',
|
||||
'track_stock' => 'boolean',
|
||||
'sort_order' => 'integer',
|
||||
'delivery_note' => 'nullable|string|max:255',
|
||||
]);
|
||||
$data['slug'] = Str::slug($data['name']);
|
||||
$data['active'] = $request->boolean('active');
|
||||
|
||||
@@ -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)
|
||||
<p class="text-xs text-red-500 mt-1">Nicht vorrätig</p>
|
||||
@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
|
||||
|
||||
Reference in New Issue
Block a user