ifnex/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/TrackingEventsRelationManager.php
Kazem Alghasi a59e192b32 ✅ ۱۰ مورد کامل شد (دیتابیس، مدل‌ها، API، Filament، Laravel 11، رفع باگ‌ها)
🔄 در حال انجام: تست دستی Filament
⏸️ بلاک: مهاجرت ۳۹۵۰ رکورد (منتظر فایل اکسل اصلاح‌شده)
⏸️ بلاک: پلاگین وردپرس (بعد از تست کامل API)
2026-08-04 01:59:08 +03:30

73 lines
2.7 KiB
PHP

<?php
namespace App\Filament\Resources\ShipmentResource\RelationManagers;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables;
use Filament\Tables\Table;
class TrackingEventsRelationManager extends RelationManager
{
protected static string $relationship = 'trackingEvents';
protected static ?string $title = 'Tracking Events';
protected static ?string $icon = 'heroicon-o-clock';
public function form(Form $form): Form
{
return $form->schema([
Forms\Components\DatePicker::make('event_date')
->required()
->default(now())
->label('Event Date'),
Forms\Components\TimePicker::make('event_time')
->required()
->default(now())
->label('Event Time'),
Forms\Components\TextInput::make('location')->nullable()->label('Location'),
Forms\Components\TextInput::make('event_description')->required()->label('Event Description'),
Forms\Components\Select::make('delivery_status')
->options([
'processed' => 'Processed',
'picked_up' => 'Picked Up',
'in_transit' => 'In Transit',
'out_for_delivery' => 'Out For Delivery',
'failed' => 'Failed',
'delivered' => 'Delivered',
'returned' => 'Returned',
])
->nullable()
->label('Delivery Status'),
]);
}
public function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('event_date')->date()->label('Date')->sortable(),
Tables\Columns\TextColumn::make('event_time')->time()->label('Time'),
Tables\Columns\TextColumn::make('location')->label('Location'),
Tables\Columns\TextColumn::make('event_description')->label('Description')->limit(60),
Tables\Columns\TextColumn::make('delivery_status')->badge()->label('Status'),
Tables\Columns\TextColumn::make('source')->badge()->label('Source'),
])
->defaultSort('event_date', 'desc')
->headerActions([
Tables\Actions\CreateAction::make(),
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
}