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