Products now have a configurable lot_prefix (e.g. "112"). In the batch form
the prefix is shown read-only next to the suffix input (JJMMTT), and the full
lot_number (e.g. "112-260912") is composed automatically and stored.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Each BatchOrigin (spice) now has multiple BatchOriginEntry rows, replacing the flat
single-supplier/farmer fields. Lieferant and Landwirt are Select fields backed by
dedicated tables with inline create support. Migration preserves existing data.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix root cause: recipes_spices.amount_in_percent was decimal(4,2) which
overflows on 100% — widened to decimal(6,2) via migration
- Wrap afterSave() in try-catch so DB/logic errors show as a persistent
danger notification instead of a blank 500 page
- Same for CreateProduct: errors show as notification; also reads
recipe_spices from raw Livewire $this->data (not $data param which
excludes dehydrated(false) fields) so recipes actually save on create
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Each size row in the product form now shows a Shopify status badge
(green ✓ Shopify / gray Lokal). For saved variants, an action button
appears: 'Zu Shopify' for local-only variants (creates via Shopify
API and stores the returned variant ID), 'Shopify sync' for linked
variants (pushes price/SKU/GTIN to Shopify).
Also fixes:
- gtin missing from ProductSize::$fillable (was silently not saved)
- shopify_product_id added to products table and stored on import
- sizes afterStateHydrated now loads ProductSize directly instead of
via the belongsToMany pivot (gets product_size_id, shopify_variant_id)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add size_id, units_produced, quantity_g to batches table
- quantity_g auto-calculated from units × packing size on save
- Batch model deducts spice quantities on create, reverses on delete,
recalculates on update when relevant fields change
- Batch form shows live total weight preview
- Chargen table shows units + grams produced
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>