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
@@ -71,6 +71,10 @@ class SpiceSupplierResource extends Resource
|
||||
->required()
|
||||
->rules(['min:0.001'])
|
||||
->disabled(fn($record) => !is_null($record))
|
||||
->label(function (Get $get) {
|
||||
$unit = \App\Models\Spice::find($get('spice_id'))?->unit;
|
||||
return $unit === 'pieces' ? 'Anzahl Stück' : 'Liefermenge';
|
||||
})
|
||||
->suffix(function (Get $get) {
|
||||
$unit = \App\Models\Spice::find($get('spice_id'))?->unit;
|
||||
return match($unit) {
|
||||
@@ -90,6 +94,16 @@ class SpiceSupplierResource extends Resource
|
||||
$unit = \App\Models\Spice::find($get('spice_id'))?->unit;
|
||||
return $unit === 'grams' ? (float) $state * 1000 : $state;
|
||||
}),
|
||||
|
||||
TextInput::make('weight_g')
|
||||
->label('Gesamtgewicht dieser Lieferung (g)')
|
||||
->numeric()
|
||||
->suffix('g')
|
||||
->helperText('Optional — aktualisiert das Ø Stückgewicht automatisch')
|
||||
->disabled(fn($record) => !is_null($record))
|
||||
->visible(function (Get $get) {
|
||||
return \App\Models\Spice::find($get('spice_id'))?->unit === 'pieces';
|
||||
}),
|
||||
|
||||
DatePicker::make('supplied_at')
|
||||
->label('Lieferdatum')
|
||||
|
||||
Reference in new issue
Block a user