feat: per-row and global discount with margin validation
Parts (wo_parts) already had discount_pct; now also added to wo_works. Labor catalog gets a cost_price field as the hard minimum sell floor. - WorkOrderWork: discount_pct + cost_price fields; total calculation now includes discount: hours × price_per_hour × (1 − disc/100) - Labor model: cost_price field (used to pre-fill work rows and validate) - WorksRelationManager: discount_pct field with live helper text showing effective price + margin %; validation blocks save if below buy cost or below company min_discount_margin_pct; "Reducere globală" header action applies % to all work rows (skips rows that would breach limits) - PartsRelationManager: same validation on existing discount_pct field; helper text (🟢/🟠/🔴) shows effective price + margin in real time; "Reducere globală" header action for all parts - Settings page: new "Reduceri & limite preț" section with min_discount_margin_pct — 0 = no limit, >0 = hard block below that % - LaborResource form: cost_price field Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -71,6 +71,8 @@ class LaborResource extends Resource
|
||||
Forms\Components\TextInput::make('fixed_price')->label(__('Preț fix (MDL)'))->numeric()->default(0)
|
||||
->visible(fn (Schemas\Components\Utilities\Get $get) => $get('pricing_mode') === 'fixed'),
|
||||
Forms\Components\TextInput::make('price')->label(__('Preț orientativ (MDL)'))->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('cost_price')->label(__('Preț cost (MDL)'))->numeric()->default(0)
|
||||
->helperText(__('Costul intern — limita minimă sub care nu se poate vinde cu reducere.')),
|
||||
Forms\Components\Toggle::make('is_active')->label(__('Activă'))->default(true),
|
||||
]),
|
||||
Forms\Components\Textarea::make('notes')->label(__('Observații'))->columnSpanFull()->rows(2),
|
||||
|
||||
Reference in New Issue
Block a user