您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

InvoiceTotals.php 1.1KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Filament\Forms\Components;
  3. use App\Enums\Accounting\AdjustmentComputation;
  4. use Filament\Forms\Components\Grid;
  5. use Filament\Forms\Components\Select;
  6. use Filament\Forms\Components\TextInput;
  7. use Filament\Forms\Get;
  8. class InvoiceTotals extends Grid
  9. {
  10. protected string $view = 'filament.forms.components.invoice-totals';
  11. protected function setUp(): void
  12. {
  13. parent::setUp();
  14. $this->schema([
  15. TextInput::make('discount_rate')
  16. ->label('Discount Rate')
  17. ->hiddenLabel()
  18. ->live()
  19. ->rate(computation: static fn (Get $get) => $get('discount_computation'), showAffix: false),
  20. Select::make('discount_computation')
  21. ->label('Discount Computation')
  22. ->hiddenLabel()
  23. ->options([
  24. 'percentage' => '%',
  25. 'fixed' => '$',
  26. ])
  27. ->default(AdjustmentComputation::Percentage)
  28. ->selectablePlaceholder(false)
  29. ->live(),
  30. ]);
  31. }
  32. }