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.
124 lines
4.1 KiB
PHP
124 lines
4.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
use App\Filament\Resources\ShipmentItemResource\Pages;
|
|
use App\Models\ShipmentItem;
|
|
use Filament\Forms;
|
|
use Filament\Forms\Form;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table;
|
|
|
|
class ShipmentItemResource extends Resource
|
|
{
|
|
protected static ?string $model = ShipmentItem::class;
|
|
|
|
protected static ?string $navigationIcon = 'heroicon-o-clipboard-document-list';
|
|
|
|
protected static ?string $navigationLabel = 'اقلام مرسوله';
|
|
protected static ?string $navigationGroup = 'عملیات';
|
|
protected static ?int $navigationSort = 2;
|
|
|
|
public static function form(Form $form): Form
|
|
{
|
|
return $form
|
|
->schema([
|
|
Forms\Components\Select::make('shipment_id')
|
|
->relationship('shipment', 'awb_no')
|
|
->searchable()
|
|
->preload()
|
|
->required()
|
|
->label('Shipment AWB'),
|
|
Forms\Components\TextInput::make('row_number')
|
|
->required()
|
|
->numeric()
|
|
->minValue(1)
|
|
->maxValue(9)
|
|
->label('Row'),
|
|
Forms\Components\TextInput::make('description')
|
|
->required()
|
|
->maxLength(255)
|
|
->columnSpan(2)
|
|
->label('Description'),
|
|
Forms\Components\TextInput::make('hs_code')
|
|
->required()
|
|
->label('HS Code'),
|
|
Forms\Components\TextInput::make('quantity')
|
|
->required()
|
|
->numeric()
|
|
->label('Quantity'),
|
|
Forms\Components\TextInput::make('unit_price')
|
|
->required()
|
|
->numeric()
|
|
->prefix('USD')
|
|
->label('Unit Price'),
|
|
Forms\Components\TextInput::make('total_usd')
|
|
->required()
|
|
->numeric()
|
|
->prefix('USD')
|
|
->label('Total USD'),
|
|
])->columns(4);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
Tables\Columns\TextColumn::make('shipment.awb_no')
|
|
->searchable()
|
|
->sortable()
|
|
->label('Shipment AWB'),
|
|
Tables\Columns\TextColumn::make('row_number')
|
|
->sortable()
|
|
->label('Row'),
|
|
Tables\Columns\TextColumn::make('description')
|
|
->searchable()
|
|
->limit(30)
|
|
->label('Description'),
|
|
Tables\Columns\TextColumn::make('hs_code')
|
|
->searchable()
|
|
->label('HS Code'),
|
|
Tables\Columns\TextColumn::make('quantity')
|
|
->numeric()
|
|
->sortable()
|
|
->label('Qty'),
|
|
Tables\Columns\TextColumn::make('unit_price')
|
|
->money('USD')
|
|
->sortable()
|
|
->label('Unit Price'),
|
|
Tables\Columns\TextColumn::make('total_usd')
|
|
->money('USD')
|
|
->sortable()
|
|
->label('Total'),
|
|
])
|
|
->filters([
|
|
//
|
|
])
|
|
->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\ListShipmentItems::route('/'),
|
|
'create' => Pages\CreateShipmentItem::route('/create'),
|
|
'edit' => Pages\EditShipmentItem::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|