Neue Anforderungen (docs/) interpretiert und als Entwicklungsplan V5.0 (AP-20 bis AP-28) aufgenommen; erste drei Pakete umgesetzt: AP-26 Ausschuss-Gründe konfigurierbar: - Stammdaten-Tabelle disposal_reasons + CRUD unter Einstellungen → Allgemein - StockDisposalController liest aktive DB-Gründe statt hartkodierter Liste - Seeder übernimmt die bisherigen 6 Gründe idempotent AP-25 Lieferbestand — Datum statt Tage: - "Nicht vorrätig" wird über Datepicker "Wieder lieferbar ab" gepflegt; Resttage-Hinweis zählt täglich automatisch herunter - Interne Bestellliste wieder kaufbar: Hinweis erscheint zusätzlich zu den Mengen-Buttons (VP entscheidet selbst) AP-22 Produktbestand-Erweiterungen: - Default-Sortierung nach Dringlichkeit, Status-Kopf toggelt - Alle vier Status-Kacheln als Filter klickbar - Neue Spalte "Verbrauch/Monat" (Ø Abgänge der letzten 6 Monate) - Produkt-Flag "Im Produktbestand anzeigen" (products.show_in_product_stock) Tests: 77 grün (DisposalReasonSettings 8, ProductOutOfStock 8, ProductStock 13 + Regression). Hinweise-Doku + Plan-Protokoll fortgeschrieben; nächster Schritt laut Plan: AP-21 (INCI-Erweiterungen). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
54 lines
1.5 KiB
PHP
54 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin\Inventory;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\Inventory\StoreDisposalReasonRequest;
|
|
use App\Http\Requests\Inventory\UpdateDisposalReasonRequest;
|
|
use App\Models\DisposalReason;
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\Http\RedirectResponse;
|
|
|
|
class DisposalReasonController extends Controller
|
|
{
|
|
public function create(): View
|
|
{
|
|
return view('admin.inventory.disposal-reasons.form', [
|
|
'model' => new DisposalReason(['active' => true, 'pos' => 0]),
|
|
]);
|
|
}
|
|
|
|
public function store(StoreDisposalReasonRequest $request): RedirectResponse
|
|
{
|
|
DisposalReason::create($request->validated());
|
|
|
|
\Session::flash('alert-save', '1');
|
|
|
|
return redirect()->route('admin.inventory.general');
|
|
}
|
|
|
|
public function edit(DisposalReason $disposalReason): View
|
|
{
|
|
return view('admin.inventory.disposal-reasons.form', [
|
|
'model' => $disposalReason,
|
|
]);
|
|
}
|
|
|
|
public function update(UpdateDisposalReasonRequest $request, DisposalReason $disposalReason): RedirectResponse
|
|
{
|
|
$disposalReason->update($request->validated());
|
|
|
|
\Session::flash('alert-save', '1');
|
|
|
|
return redirect()->route('admin.inventory.general');
|
|
}
|
|
|
|
public function destroy(DisposalReason $disposalReason): RedirectResponse
|
|
{
|
|
$disposalReason->delete();
|
|
|
|
\Session::flash('alert-success', __('Eintrag gelöscht'));
|
|
|
|
return redirect()->route('admin.inventory.general');
|
|
}
|
|
}
|