Warenwirtschaft: AP-00 bis AP-08 + aktualisierter Entwicklungsplan
Umsetzung der Warenwirtschafts-/Produktmanagement-Erweiterung gemaess Entwicklungsplan V4.0: - AP-00: Regressionsbasis fuer 5.1-Features (ProductPhase51Test) - AP-01: URL-Bugfixes B1/B2 (suppliers/packaging-items, breitere url-Spalten) - AP-04/04.1: iPad-taugliche, vereinheitlichte Tabellen-Aktionen - AP-05: Einstellungen "Allgemein" mit UST-Saetzen (tax_rates) und Lieferzeit-Vorlagen (delivery_times, inkl. Tage-Feld) - AP-06: Lieferanten um Bestellweg, Bestell-Mail/-URL und Lieferzeit erweitert - AP-07/07.1: INCI um Lieferanten-Mehrfachwahl, UST und Lieferzeit erweitert; Lieferanten-Detailansicht im Modal mit pflegbaren INCI-/Verpackungslisten - AP-08: Einkauf um UST-Snapshot, Netto/Brutto-Automatik und Duplizieren erweitert Entwicklungsplan aktualisiert: alle Klaerungspunkte (§5) vom Kunden beantwortet und in die jeweiligen APs eingearbeitet (AP-02/03/09/13/15), neues AP-18 (Hinweise-Doku unter Einstellungen) ergaenzt. Naechster Schritt eindeutig markiert: AP-09 (Produktion auf Hersteller-Rezeptur, kein Fallback, Warnung).
This commit is contained in:
parent
ca3eb663fe
commit
78679e0c55
67 changed files with 3523 additions and 101 deletions
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Inventory;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Inventory\StoreDeliveryTimeRequest;
|
||||
use App\Http\Requests\Inventory\UpdateDeliveryTimeRequest;
|
||||
use App\Models\DeliveryTime;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class DeliveryTimeController extends Controller
|
||||
{
|
||||
public function create(): View
|
||||
{
|
||||
return view('admin.inventory.delivery-times.form', [
|
||||
'model' => new DeliveryTime(['active' => true, 'pos' => 0]),
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(StoreDeliveryTimeRequest $request): RedirectResponse
|
||||
{
|
||||
DeliveryTime::create($request->validated());
|
||||
|
||||
\Session::flash('alert-save', '1');
|
||||
|
||||
return redirect()->route('admin.inventory.general');
|
||||
}
|
||||
|
||||
public function edit(DeliveryTime $deliveryTime): View
|
||||
{
|
||||
return view('admin.inventory.delivery-times.form', [
|
||||
'model' => $deliveryTime,
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(UpdateDeliveryTimeRequest $request, DeliveryTime $deliveryTime): RedirectResponse
|
||||
{
|
||||
$deliveryTime->update($request->validated());
|
||||
|
||||
\Session::flash('alert-save', '1');
|
||||
|
||||
return redirect()->route('admin.inventory.general');
|
||||
}
|
||||
|
||||
public function destroy(DeliveryTime $deliveryTime): RedirectResponse
|
||||
{
|
||||
$deliveryTime->delete();
|
||||
|
||||
\Session::flash('alert-success', __('Eintrag gelöscht'));
|
||||
|
||||
return redirect()->route('admin.inventory.general');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Inventory;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\DeliveryTime;
|
||||
use App\Models\TaxRate;
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
class GeneralSettingController extends Controller
|
||||
{
|
||||
public function index(): View
|
||||
{
|
||||
return view('admin.inventory.general.index', [
|
||||
'taxRates' => TaxRate::query()->orderBy('pos')->orderBy('percent')->get(),
|
||||
'deliveryTimes' => DeliveryTime::query()->orderBy('pos')->orderBy('label')->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@ use App\Models\MaterialQuality;
|
|||
use App\Models\PackagingItem;
|
||||
use App\Models\StockEntry;
|
||||
use App\Models\Supplier;
|
||||
use App\Models\TaxRate;
|
||||
use App\Repositories\StockEntryRepository;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
|
@ -115,6 +116,37 @@ class StockEntryController extends Controller
|
|||
return redirect()->route('admin.inventory.stock-entries.index');
|
||||
}
|
||||
|
||||
public function copy(StockEntry $stockEntry): RedirectResponse
|
||||
{
|
||||
if (! auth()->user()->isAdmin()) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
|
||||
$data = $stockEntry->only([
|
||||
'entry_type',
|
||||
'ingredient_id',
|
||||
'packaging_item_id',
|
||||
'supplier_id',
|
||||
'location_id',
|
||||
'ordered_quantity',
|
||||
'price_per_kg',
|
||||
'price_per_kg_gross',
|
||||
'price_total',
|
||||
'tax_rate_id',
|
||||
'tax_rate_percent',
|
||||
'quality_id',
|
||||
]);
|
||||
$data['ordered_at'] = now()->toDateString();
|
||||
$data['ordered_by'] = (int) auth()->id();
|
||||
$data['status'] = 'pending';
|
||||
|
||||
$copy = $this->stockEntryRepository->create($data);
|
||||
|
||||
\Session::flash('alert-warning', __('Kopie angelegt – bitte Menge/Charge prüfen und speichern.'));
|
||||
|
||||
return redirect()->route('admin.inventory.stock-entries.edit', $copy);
|
||||
}
|
||||
|
||||
public function destroy(StockEntry $stockEntry): RedirectResponse
|
||||
{
|
||||
if (! auth()->user()->isAdmin()) {
|
||||
|
|
@ -223,6 +255,7 @@ class StockEntryController extends Controller
|
|||
'suppliers' => Supplier::query()->where('active', true)->orderBy('name')->get(),
|
||||
'locations' => Location::query()->where('active', true)->orderBy('name')->get(),
|
||||
'materialQualities' => MaterialQuality::query()->orderBy('pos')->orderBy('name')->get(),
|
||||
'taxRates' => TaxRate::query()->active()->orderBy('pos')->orderBy('name')->get(),
|
||||
'entryTypeLabels' => [
|
||||
'ingredient' => __('Rohstoff'),
|
||||
'packaging' => __('Produktverpackung'),
|
||||
|
|
|
|||
|
|
@ -6,9 +6,14 @@ use App\Http\Controllers\Controller;
|
|||
use App\Http\Requests\Inventory\StoreSupplierRequest;
|
||||
use App\Http\Requests\Inventory\UpdateSupplierRequest;
|
||||
use App\Models\Country;
|
||||
use App\Models\DeliveryTime;
|
||||
use App\Models\Ingredient;
|
||||
use App\Models\PackagingItem;
|
||||
use App\Models\Supplier;
|
||||
use App\Models\SupplierCategory;
|
||||
use App\Repositories\SupplierRepository;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SupplierController extends Controller
|
||||
{
|
||||
|
|
@ -31,6 +36,7 @@ class SupplierController extends Controller
|
|||
'model' => new Supplier(['active' => true, 'country_id' => $defaultCountryId]),
|
||||
'countries' => Country::query()->orderBy('de')->get(),
|
||||
'supplierCategories' => SupplierCategory::query()->orderBy('pos')->orderBy('name')->get(),
|
||||
'deliveryTimes' => DeliveryTime::query()->active()->orderBy('pos')->orderBy('label')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -43,6 +49,71 @@ class SupplierController extends Controller
|
|||
return redirect()->route('admin.inventory.suppliers.index');
|
||||
}
|
||||
|
||||
public function show(Supplier $supplier): View
|
||||
{
|
||||
return $this->renderDetails($supplier);
|
||||
}
|
||||
|
||||
public function attachIngredient(Request $request, Supplier $supplier): View
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'ingredient_id' => ['required', 'integer', 'exists:ingredients,id'],
|
||||
]);
|
||||
|
||||
$supplier->ingredients()->syncWithoutDetaching([$validated['ingredient_id']]);
|
||||
|
||||
return $this->renderDetails($supplier);
|
||||
}
|
||||
|
||||
public function detachIngredient(Supplier $supplier, Ingredient $ingredient): View
|
||||
{
|
||||
$supplier->ingredients()->detach($ingredient->id);
|
||||
|
||||
return $this->renderDetails($supplier);
|
||||
}
|
||||
|
||||
public function attachPackagingItem(Request $request, Supplier $supplier): View
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'packaging_item_id' => ['required', 'integer', 'exists:packaging_items,id'],
|
||||
]);
|
||||
|
||||
PackagingItem::query()
|
||||
->whereKey($validated['packaging_item_id'])
|
||||
->update(['supplier_id' => $supplier->id]);
|
||||
|
||||
return $this->renderDetails($supplier);
|
||||
}
|
||||
|
||||
public function detachPackagingItem(Supplier $supplier, PackagingItem $packagingItem): View
|
||||
{
|
||||
if ((int) $packagingItem->supplier_id === (int) $supplier->id) {
|
||||
$packagingItem->update(['supplier_id' => null]);
|
||||
}
|
||||
|
||||
return $this->renderDetails($supplier);
|
||||
}
|
||||
|
||||
protected function renderDetails(Supplier $supplier): View
|
||||
{
|
||||
$supplier->load(['country', 'supplierCategories', 'ingredients', 'packagingItems']);
|
||||
|
||||
$assignedIngredientIds = $supplier->ingredients->pluck('id')->all();
|
||||
$assignedPackagingItemIds = $supplier->packagingItems->pluck('id')->all();
|
||||
|
||||
return view('admin.inventory.suppliers._details', [
|
||||
'supplier' => $supplier,
|
||||
'availableIngredients' => Ingredient::query()
|
||||
->whereNotIn('id', $assignedIngredientIds)
|
||||
->orderBy('name')
|
||||
->get(),
|
||||
'availablePackagingItems' => PackagingItem::query()
|
||||
->whereNotIn('id', $assignedPackagingItemIds)
|
||||
->orderBy('name')
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function edit(Supplier $supplier)
|
||||
{
|
||||
$supplier->load('supplierCategories');
|
||||
|
|
@ -51,6 +122,7 @@ class SupplierController extends Controller
|
|||
'model' => $supplier,
|
||||
'countries' => Country::query()->orderBy('de')->get(),
|
||||
'supplierCategories' => SupplierCategory::query()->orderBy('pos')->orderBy('name')->get(),
|
||||
'deliveryTimes' => DeliveryTime::query()->active()->orderBy('pos')->orderBy('label')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
54
app/Http/Controllers/Admin/Inventory/TaxRateController.php
Normal file
54
app/Http/Controllers/Admin/Inventory/TaxRateController.php
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Inventory;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Inventory\StoreTaxRateRequest;
|
||||
use App\Http\Requests\Inventory\UpdateTaxRateRequest;
|
||||
use App\Models\TaxRate;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class TaxRateController extends Controller
|
||||
{
|
||||
public function create(): View
|
||||
{
|
||||
return view('admin.inventory.tax-rates.form', [
|
||||
'model' => new TaxRate(['active' => true, 'pos' => 0]),
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(StoreTaxRateRequest $request): RedirectResponse
|
||||
{
|
||||
TaxRate::create($request->validated());
|
||||
|
||||
\Session::flash('alert-save', '1');
|
||||
|
||||
return redirect()->route('admin.inventory.general');
|
||||
}
|
||||
|
||||
public function edit(TaxRate $taxRate): View
|
||||
{
|
||||
return view('admin.inventory.tax-rates.form', [
|
||||
'model' => $taxRate,
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(UpdateTaxRateRequest $request, TaxRate $taxRate): RedirectResponse
|
||||
{
|
||||
$taxRate->update($request->validated());
|
||||
|
||||
\Session::flash('alert-save', '1');
|
||||
|
||||
return redirect()->route('admin.inventory.general');
|
||||
}
|
||||
|
||||
public function destroy(TaxRate $taxRate): RedirectResponse
|
||||
{
|
||||
$taxRate->delete();
|
||||
|
||||
\Session::flash('alert-success', __('Eintrag gelöscht'));
|
||||
|
||||
return redirect()->route('admin.inventory.general');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue