Added numeric validation rules, some styling fixes
This commit is contained in:
parent
66168d0919
commit
f0f10a4907
@ -49,8 +49,10 @@ public static function form(Form $form): Form
|
||||
DatePicker::make('date_end')
|
||||
->required()
|
||||
->default(today()),
|
||||
])->columns(2),
|
||||
]);
|
||||
])
|
||||
->columns(2)
|
||||
->columnSpan(3),
|
||||
])->columns(3);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
@ -77,11 +79,7 @@ public static function table(Table $table): Table
|
||||
->weight(FontWeight::Bold)
|
||||
->money(),
|
||||
])
|
||||
->defaultSort('id', 'desc')
|
||||
|
||||
->filters([
|
||||
])
|
||||
->actions([]);
|
||||
->defaultSort('id', 'desc');
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
|
@ -123,7 +123,8 @@ public static function form(Form $form): Form
|
||||
|
||||
])
|
||||
->columnSpan(1)
|
||||
->hidden(fn (?Invoice $record) => $record === null),
|
||||
->hidden(fn (?Invoice $record) => $record === null)
|
||||
->extraAttributes(['class' => 'h-full']),
|
||||
|
||||
])
|
||||
->columns(3)
|
||||
|
@ -28,6 +28,7 @@
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Support\Enums\MaxWidth;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Columns\IconColumn\IconColumnSize;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Guava\FilamentClusters\Forms\Cluster;
|
||||
@ -118,6 +119,10 @@ public static function form(Form $form): Form
|
||||
->label('Order ID')
|
||||
->content(fn (Order $record): ?string => $record->internal_po),
|
||||
|
||||
Placeholder::make('total_service_price')
|
||||
->label('Total service price')
|
||||
->content(fn (Order $record): ?string => '$'.number_format($record->total_service_price, 2)),
|
||||
|
||||
Placeholder::make('created_at')
|
||||
->label('Created')
|
||||
->content(fn (Order $record): ?string => $record->created_at?->diffForHumans()),
|
||||
@ -127,7 +132,8 @@ public static function form(Form $form): Form
|
||||
->content(fn (Order $record): ?string => $record->updated_at?->diffForHumans()),
|
||||
])
|
||||
->columnSpan(1)
|
||||
->hidden(fn (?Order $record) => $record === null),
|
||||
->hidden(fn (?Order $record) => $record === null)
|
||||
->extraAttributes(['class' => 'h-full']),
|
||||
])
|
||||
->columns(6)
|
||||
->columnSpan(2),
|
||||
@ -144,21 +150,29 @@ public static function form(Form $form): Form
|
||||
->datalist(OrderProduct::all()->unique('color')->pluck('color')->toArray()),
|
||||
Cluster::make([
|
||||
TextInput::make('xs')
|
||||
->placeholder('xs'),
|
||||
->placeholder('xs')
|
||||
->rules('numeric'),
|
||||
TextInput::make('s')
|
||||
->placeholder('s'),
|
||||
->placeholder('s')
|
||||
->rules('numeric'),
|
||||
TextInput::make('m')
|
||||
->placeholder('m'),
|
||||
->placeholder('m')
|
||||
->rules('numeric'),
|
||||
TextInput::make('l')
|
||||
->placeholder('l'),
|
||||
->placeholder('l')
|
||||
->rules('numeric'),
|
||||
TextInput::make('xl')
|
||||
->placeholder('xl'),
|
||||
->placeholder('xl')
|
||||
->rules('numeric'),
|
||||
TextInput::make('2xl')
|
||||
->placeholder('2xl'),
|
||||
->placeholder('2xl')
|
||||
->rules('numeric'),
|
||||
TextInput::make('3xl')
|
||||
->placeholder('3xl'),
|
||||
->placeholder('3xl')
|
||||
->rules('numeric'),
|
||||
TextInput::make('osfa')
|
||||
->placeholder('osfa'),
|
||||
->placeholder('osfa')
|
||||
->rules('numeric'),
|
||||
])
|
||||
->label('Sizes'),
|
||||
])
|
||||
@ -197,13 +211,16 @@ public static function form(Form $form): Form
|
||||
->label('Logo Name'),
|
||||
TextInput::make('serviceFileSetupNumber')
|
||||
->label('Setup')
|
||||
->columnSpan(1),
|
||||
->columnSpan(1)
|
||||
->rules('numeric'),
|
||||
|
||||
Cluster::make([
|
||||
TextInput::make('serviceFileWidth')
|
||||
->prefix('w'),
|
||||
->prefix('w')
|
||||
->rules('numeric'),
|
||||
TextInput::make('serviceFileHeight')
|
||||
->prefix('h'),
|
||||
->prefix('h')
|
||||
->rules('numeric'),
|
||||
])
|
||||
->label('Dimensions (inches)')
|
||||
->columnSpan(4),
|
||||
@ -212,12 +229,14 @@ public static function form(Form $form): Form
|
||||
->label('Quantity')
|
||||
->live()
|
||||
->prefix('#')
|
||||
->columnSpan(2),
|
||||
->columnSpan(2)
|
||||
->rules('numeric'),
|
||||
|
||||
TextInput::make('amount_price')
|
||||
->label('Amount')
|
||||
->prefix('$')
|
||||
->columnSpan(2),
|
||||
->columnSpan(2)
|
||||
->rules('numeric'),
|
||||
]),
|
||||
|
||||
Grid::make(9)
|
||||
@ -254,7 +273,7 @@ public static function table(Table $table): Table
|
||||
? 'lucide-calendar-clock' : ($record->rush
|
||||
? OrderAttributes::rush->getIcon() : null);
|
||||
})
|
||||
->size(Tables\Columns\IconColumn\IconColumnSize::Medium),
|
||||
->size(IconColumnSize::Medium),
|
||||
|
||||
TextColumn::make('internal_po')
|
||||
->label('Internal PO')
|
||||
|
@ -51,7 +51,8 @@ public static function form(Form $form): Form
|
||||
->content(fn (TaxRate $record): ?string => $record->updated_at?->diffForHumans()),
|
||||
])
|
||||
->columnSpan(1)
|
||||
->hidden(fn (?TaxRate $record) => $record === null),
|
||||
->hidden(fn (?TaxRate $record) => $record === null)
|
||||
->extraAttributes(['class' => 'h-full']),
|
||||
])->columns(3);
|
||||
}
|
||||
|
||||
@ -94,8 +95,8 @@ public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListTaxRates::route('/'),
|
||||
'create' => Pages\CreateTaxRate::route('/create'),
|
||||
'edit' => Pages\EditTaxRate::route('/{record}/edit'),
|
||||
// 'create' => Pages\CreateTaxRate::route('/create'),
|
||||
// 'edit' => Pages\EditTaxRate::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ class OrderProduct extends Model
|
||||
'color',
|
||||
];
|
||||
|
||||
protected $touches = ['order'];
|
||||
|
||||
public function totalQuantity(): int
|
||||
{
|
||||
return array_sum($this->productSizes()->pluck('amount')->toArray());
|
||||
|
@ -33,6 +33,8 @@ class ProductService extends Model
|
||||
'price',
|
||||
];
|
||||
|
||||
protected $touches = ['order'];
|
||||
|
||||
public function getPriceAttribute(): float
|
||||
{
|
||||
return number_format($this->amount * $this->amount_price, 2);
|
||||
|
@ -88,7 +88,10 @@
|
||||
'width' => 1.5,
|
||||
'height' => 2.5,
|
||||
'color_amount' => 2,
|
||||
'color_match' => 5.10,
|
||||
'setup_amount' => 2,
|
||||
'run_charge' => 10,
|
||||
'color_match' => true,
|
||||
'color_change' => true,
|
||||
'flash' => 5.20,
|
||||
'fleece' => 5.30,
|
||||
'poly_ink' => 5.40,
|
||||
|
Loading…
x
Reference in New Issue
Block a user