Refactor the Filament admin panel structure by adjusting navigation sorting across various resources to improve usability and logical grouping. - Reorder navigation items in 'مالی' (Finance), 'تنظیمات' (Settings), and 'عملیات' (Operations) groups. - Hide `PriceTestPage` from the main navigation sidebar. - Adjust sidebar width and max content width in `AdminPanelProvider`. - Add custom CSS asset for Filament styling.
113 lines
4.8 KiB
PHP
113 lines
4.8 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
use App\Filament\Resources\ShippingRateResource\Pages;
|
|
use App\Models\ShippingRate;
|
|
use Filament\Forms;
|
|
use Filament\Forms\Form;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table;
|
|
|
|
class ShippingRateResource extends Resource
|
|
{
|
|
protected static ?string $model = ShippingRate::class;
|
|
|
|
protected static ?string $navigationIcon = 'heroicon-o-currency-dollar';
|
|
|
|
protected static ?string $navigationLabel = 'نرخهای حمل';
|
|
protected static ?string $navigationGroup = 'تنظیمات';
|
|
protected static ?int $navigationSort = 3;
|
|
|
|
public static function form(Form $form): Form
|
|
{
|
|
return $form
|
|
->schema([
|
|
Forms\Components\Select::make('direction')
|
|
->options(['export' => 'Export', 'import' => 'Import'])
|
|
->required(),
|
|
Forms\Components\Select::make('type')
|
|
->options([
|
|
'DOC_NORMAL' => 'Doc Normal',
|
|
'DOC_ECONOMY' => 'Doc Economy',
|
|
'PARCEL' => 'Parcel',
|
|
])
|
|
->required(),
|
|
Forms\Components\TextInput::make('weight')
|
|
->required()
|
|
->numeric()
|
|
->suffix('kg')
|
|
->label('Weight (kg)'),
|
|
Forms\Components\Grid::make()
|
|
->schema([
|
|
Forms\Components\TextInput::make('zone_1')->numeric()->label('Zone 1'),
|
|
Forms\Components\TextInput::make('zone_2')->numeric()->label('Zone 2'),
|
|
Forms\Components\TextInput::make('zone_3')->numeric()->label('Zone 3'),
|
|
Forms\Components\TextInput::make('zone_4')->numeric()->label('Zone 4'),
|
|
Forms\Components\TextInput::make('zone_5')->numeric()->label('Zone 5'),
|
|
Forms\Components\TextInput::make('zone_6')->numeric()->label('Zone 6'),
|
|
Forms\Components\TextInput::make('zone_7')->numeric()->label('Zone 7'),
|
|
Forms\Components\TextInput::make('zone_8')->numeric()->label('Zone 8'),
|
|
Forms\Components\TextInput::make('zone_9')->numeric()->label('Zone 9'),
|
|
Forms\Components\TextInput::make('zone_10')->numeric()->label('Zone 10'),
|
|
])
|
|
->columns(5),
|
|
]);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
Tables\Columns\TextColumn::make('direction')->badge()->label('Direction'),
|
|
Tables\Columns\TextColumn::make('type')->badge()->label('Type'),
|
|
Tables\Columns\TextColumn::make('weight')->numeric()->suffix(' kg')->label('Weight'),
|
|
Tables\Columns\TextColumn::make('zone_1')->label('Z1')->sortable(),
|
|
Tables\Columns\TextColumn::make('zone_2')->label('Z2')->sortable(),
|
|
Tables\Columns\TextColumn::make('zone_3')->label('Z3')->sortable(),
|
|
Tables\Columns\TextColumn::make('zone_4')->label('Z4')->sortable(),
|
|
Tables\Columns\TextColumn::make('zone_5')->label('Z5')->sortable(),
|
|
Tables\Columns\TextColumn::make('zone_6')->label('Z6')->sortable(),
|
|
Tables\Columns\TextColumn::make('zone_7')->label('Z7')->sortable(),
|
|
Tables\Columns\TextColumn::make('zone_8')->label('Z8')->sortable(),
|
|
Tables\Columns\TextColumn::make('zone_9')->label('Z9')->sortable(),
|
|
Tables\Columns\TextColumn::make('zone_10')->label('Z10')->sortable(),
|
|
])
|
|
->filters([
|
|
Tables\Filters\SelectFilter::make('direction')
|
|
->options(['export' => 'Export', 'import' => 'Import']),
|
|
Tables\Filters\SelectFilter::make('type')
|
|
->options([
|
|
'DOC_NORMAL' => 'Doc Normal',
|
|
'DOC_ECONOMY' => 'Doc Economy',
|
|
'PARCEL' => 'Parcel',
|
|
]),
|
|
])
|
|
->actions([
|
|
Tables\Actions\EditAction::make(),
|
|
])
|
|
->bulkActions([
|
|
Tables\Actions\BulkActionGroup::make([
|
|
Tables\Actions\DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
|
|
public static function getRelations(): array
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => Pages\ListShippingRates::route('/'),
|
|
'create' => Pages\CreateShippingRate::route('/create'),
|
|
'edit' => Pages\EditShippingRate::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|