Add piece_weight calibration: enter Stück + Gramm per delivery, average auto-calculated
Deploy / deploy (push) Successful in 17s
Deploy / deploy (push) Successful in 17s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
38bcf60778
commit
d87383672c
5 files changed
+73
-1
No files matched your search
@@ -15,6 +15,7 @@ class SpiceSupplier extends Model
|
||||
'spice_id',
|
||||
'supplier_id',
|
||||
'amount',
|
||||
'weight_g',
|
||||
'supplied_at',
|
||||
];
|
||||
|
||||
@@ -39,6 +40,9 @@ class SpiceSupplier extends Model
|
||||
'description' => 'Lieferung' . ($ss->supplier ? ' von ' . $ss->supplier->name : ''),
|
||||
]);
|
||||
$ss->spice->recalculateQuantity();
|
||||
if ($ss->weight_g && $ss->amount) {
|
||||
$ss->spice->recalculatePieceWeight();
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (SpiceSupplier $ss) {
|
||||
@@ -46,6 +50,9 @@ class SpiceSupplier extends Model
|
||||
->where('source_id', $ss->id)
|
||||
->delete();
|
||||
$ss->spice->recalculateQuantity();
|
||||
if ($ss->weight_g) {
|
||||
$ss->spice->recalculatePieceWeight();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user