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:
Kevin Adametz 2026-06-02 16:30:42 +00:00
parent ca3eb663fe
commit 78679e0c55
67 changed files with 3523 additions and 101 deletions

View file

@ -0,0 +1,41 @@
<?php
namespace App\Models;
use Database\Factories\DeliveryTimeFactory;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class DeliveryTime extends Model
{
/** @use HasFactory<DeliveryTimeFactory> */
use HasFactory;
protected $fillable = [
'label',
'days',
'active',
'pos',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'days' => 'integer',
'active' => 'boolean',
];
}
/**
* @param Builder<DeliveryTime> $query
* @return Builder<DeliveryTime>
*/
public function scopeActive(Builder $query): Builder
{
return $query->where('active', true);
}
}

View file

@ -10,6 +10,7 @@ use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
/**
* Class Ingredient
@ -56,6 +57,7 @@ class Ingredient extends Model
'pos' => 'int',
'default_factor' => 'decimal:2',
'min_stock_alert' => 'decimal:2',
'delivery_time_days' => 'integer',
];
protected $fillable = [
@ -70,6 +72,9 @@ class Ingredient extends Model
'default_factor',
'min_stock_alert',
'material_quality_id',
'tax_rate_id',
'delivery_time',
'delivery_time_days',
];
/**
@ -80,6 +85,24 @@ class Ingredient extends Model
return $this->belongsTo(MaterialQuality::class);
}
/**
* @return BelongsTo<TaxRate, $this>
*/
public function taxRate(): BelongsTo
{
return $this->belongsTo(TaxRate::class);
}
/**
* @return BelongsToMany<Supplier, $this>
*/
public function suppliers(): BelongsToMany
{
return $this->belongsToMany(Supplier::class, 'ingredient_supplier')
->withPivot(['preferred', 'supplier_sku', 'url'])
->withTimestamps();
}
public function products()
{
return $this->belongsToMany(Product::class, 'product_ingredients')

View file

@ -24,7 +24,10 @@ class StockEntry extends Model
'ordered_at',
'ordered_quantity',
'price_per_kg',
'price_per_kg_gross',
'price_total',
'tax_rate_id',
'tax_rate_percent',
'received_by',
'received_at',
'received_quantity',
@ -46,7 +49,9 @@ class StockEntry extends Model
'ordered_quantity' => 'decimal:2',
'received_quantity' => 'decimal:2',
'price_per_kg' => 'decimal:4',
'price_per_kg_gross' => 'decimal:4',
'price_total' => 'decimal:4',
'tax_rate_percent' => 'decimal:2',
];
}
@ -82,6 +87,14 @@ class StockEntry extends Model
return $this->belongsTo(Location::class);
}
/**
* @return BelongsTo<TaxRate, $this>
*/
public function taxRate(): BelongsTo
{
return $this->belongsTo(TaxRate::class);
}
/**
* @return BelongsTo<MaterialQuality, $this>
*/

View file

@ -18,6 +18,11 @@ class Supplier extends Model
protected $fillable = [
'name',
'url',
'order_method',
'order_email',
'order_url',
'delivery_time',
'delivery_time_days',
'contact_person',
'email',
'phone',
@ -33,6 +38,7 @@ class Supplier extends Model
{
return [
'active' => 'boolean',
'delivery_time_days' => 'integer',
];
}
@ -64,4 +70,14 @@ class Supplier extends Model
{
return $this->hasMany(PackagingItem::class);
}
/**
* @return BelongsToMany<Ingredient, $this>
*/
public function ingredients(): BelongsToMany
{
return $this->belongsToMany(Ingredient::class, 'ingredient_supplier')
->withPivot(['preferred', 'supplier_sku', 'url'])
->withTimestamps();
}
}

41
app/Models/TaxRate.php Normal file
View file

@ -0,0 +1,41 @@
<?php
namespace App\Models;
use Database\Factories\TaxRateFactory;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class TaxRate extends Model
{
/** @use HasFactory<TaxRateFactory> */
use HasFactory;
protected $fillable = [
'name',
'percent',
'active',
'pos',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'percent' => 'decimal:2',
'active' => 'boolean',
];
}
/**
* @param Builder<TaxRate> $query
* @return Builder<TaxRate>
*/
public function scopeActive(Builder $query): Builder
{
return $query->where('active', true);
}
}