feat(ui): reorganize filament nav, shipment table density, 6 relation managers
This commit is contained in:
parent
7faa778e22
commit
78036245ad
@ -17,10 +17,10 @@ class BulkTrackingImport extends Page implements HasForms
|
||||
use InteractsWithForms;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-arrow-up-tray';
|
||||
protected static ?string $navigationGroup = 'مدیریت عملیات';
|
||||
protected static ?string $navigationGroup = 'عملیات';
|
||||
protected static ?string $navigationLabel = 'ایمپورت گروهی ترکینگ';
|
||||
protected static ?string $title = 'ایمپورت گروهی وضعیت ترکینگ';
|
||||
protected static ?int $navigationSort = 20;
|
||||
protected static ?int $navigationSort = 3;
|
||||
protected static string $view = 'filament.pages.bulk-tracking-import';
|
||||
|
||||
public ?array $data = [];
|
||||
|
||||
@ -10,7 +10,7 @@ class IfnexSettingsPage extends Page
|
||||
protected static ?string $navigationIcon = 'heroicon-o-cog-6-tooth';
|
||||
protected static ?string $navigationLabel = 'تنظیمات سیستم';
|
||||
protected static ?string $navigationGroup = 'تنظیمات';
|
||||
protected static ?int $navigationSort = 1;
|
||||
protected static ?int $navigationSort = 7;
|
||||
|
||||
protected static string $view = 'filament.pages.ifnex-settings';
|
||||
|
||||
|
||||
@ -16,9 +16,9 @@ class ImportRatesPage extends Page implements HasForms
|
||||
{
|
||||
use InteractsWithForms;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-arrow-up-tray';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-arrow-up-on-square';
|
||||
protected static ?string $navigationLabel = 'ایمپورت نرخها';
|
||||
protected static ?int $navigationSort = 100;
|
||||
protected static ?int $navigationSort = 8;
|
||||
protected static string $view = 'filament.pages.import-rates';
|
||||
|
||||
public ?array $formData = [];
|
||||
|
||||
@ -18,8 +18,9 @@ class PriceTestPage extends Page
|
||||
protected static ?string $navigationIcon = 'heroicon-o-calculator';
|
||||
protected static string $view = 'filament.pages.price-test-page';
|
||||
protected static ?string $navigationLabel = 'تست محاسبه قیمت';
|
||||
protected static ?int $navigationSort = 999;
|
||||
protected static bool $shouldRegisterNavigation = false;
|
||||
protected static ?string $navigationGroup = 'ابزارها';
|
||||
protected static ?int $navigationSort = 1;
|
||||
protected static bool $shouldRegisterNavigation = true;
|
||||
|
||||
public ?array $data = [];
|
||||
public ?array $result = null;
|
||||
|
||||
@ -15,8 +15,8 @@ class FinancialReport extends Page
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-o-chart-bar';
|
||||
protected static ?string $navigationLabel = 'گزارش مالی';
|
||||
protected static ?string $navigationGroup = 'مالی';
|
||||
protected static ?int $navigationSort = 5;
|
||||
protected static ?string $navigationGroup = 'گزارشها';
|
||||
protected static ?int $navigationSort = 1;
|
||||
protected static ?string $slug = 'financial-report';
|
||||
protected static string $view = 'filament.pages.reports.financial-report';
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ class AuditLogResource extends Resource
|
||||
protected static ?string $navigationLabel = 'تاریخچه تغییرات';
|
||||
protected static ?string $modelLabel = 'لاگ تغییرات';
|
||||
protected static ?string $pluralModelLabel = 'تاریخچه تغییرات';
|
||||
protected static ?int $navigationSort = 50;
|
||||
protected static ?int $navigationSort = 2;
|
||||
protected static ?string $navigationBadgeColor = 'warning';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
|
||||
@ -22,7 +22,7 @@ class CommitmentFormResource extends Resource
|
||||
|
||||
protected static ?string $navigationGroup = 'تنظیمات';
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
protected static ?int $navigationSort = 6;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@ -18,7 +18,7 @@ class CountryResource extends Resource
|
||||
|
||||
protected static ?string $navigationLabel = 'کشورها';
|
||||
protected static ?string $navigationGroup = 'تنظیمات';
|
||||
protected static ?int $navigationSort = 2;
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@ -13,10 +13,10 @@ use Filament\Tables\Table;
|
||||
class CurrencyResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Currency::class;
|
||||
protected static ?string $navigationIcon = 'heroicon-o-banknotes';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-currency-yen';
|
||||
protected static ?string $navigationLabel = 'ارزها';
|
||||
protected static ?string $navigationGroup = 'تنظیمات';
|
||||
protected static ?int $navigationSort = 11;
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@ -16,11 +16,11 @@ class CustomerCreditResource extends Resource
|
||||
{
|
||||
protected static ?string $model = User::class;
|
||||
protected static ?string $navigationIcon = 'heroicon-o-banknotes';
|
||||
protected static ?string $navigationGroup = 'مدیریت مالی';
|
||||
protected static ?string $navigationGroup = 'مالی';
|
||||
protected static ?string $navigationLabel = 'اعتبار مشتریان';
|
||||
protected static ?string $modelLabel = 'اعتبار مشتری';
|
||||
protected static ?string $pluralModelLabel = 'اعتبار مشتریان';
|
||||
protected static ?int $navigationSort = 10;
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@ -14,11 +14,11 @@ class DiscountCodeResource extends Resource
|
||||
{
|
||||
protected static ?string $model = DiscountCode::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-ticket';
|
||||
|
||||
protected static ?string $navigationLabel = 'کدهای تخفیف';
|
||||
protected static ?string $navigationGroup = 'مالی';
|
||||
protected static ?int $navigationSort = 4;
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@ -24,7 +24,7 @@ class ExchangeRateHistoryResource extends Resource
|
||||
protected static ?string $modelLabel = 'تغییر نرخ';
|
||||
protected static ?string $pluralModelLabel = 'تاریخچه نرخ ارز';
|
||||
protected static ?string $navigationGroup = 'مالی';
|
||||
protected static ?int $navigationSort = 3;
|
||||
protected static ?int $navigationSort = 6;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@ -19,7 +19,7 @@ class RoleResource extends Resource
|
||||
protected static ?string $navigationLabel = 'نقشها';
|
||||
protected static ?string $modelLabel = 'نقش';
|
||||
protected static ?string $pluralModelLabel = 'نقشها';
|
||||
protected static ?string $navigationGroup = 'تنظیمات سیستم';
|
||||
protected static ?string $navigationGroup = 'تنظیمات';
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
|
||||
@ -16,11 +16,11 @@ class ShipmentChecklistResource extends Resource
|
||||
{
|
||||
protected static ?string $model = ShipmentChecklist::class;
|
||||
protected static ?string $navigationIcon = 'heroicon-o-clipboard-document-check';
|
||||
protected static ?string $navigationGroup = 'مدیریت عملیات';
|
||||
protected static ?string $navigationGroup = 'عملیات';
|
||||
protected static ?string $navigationLabel = 'چکلیست سفارشات';
|
||||
protected static ?string $modelLabel = 'چکلیست سفارش';
|
||||
protected static ?string $pluralModelLabel = 'چکلیست سفارشات';
|
||||
protected static ?int $navigationSort = 15;
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@ -19,6 +19,7 @@ class ShipmentItemResource extends Resource
|
||||
protected static ?string $navigationLabel = 'اقلام مرسوله';
|
||||
protected static ?string $navigationGroup = 'عملیات';
|
||||
protected static ?int $navigationSort = 2;
|
||||
protected static bool $shouldRegisterNavigation = false;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@ -381,8 +381,15 @@ class ShipmentResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('awb_no')
|
||||
Tables\Columns\TextColumn::make('awb_no')
|
||||
->searchable()->label('AWB No.')->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('تاریخ درخواست')
|
||||
->formatStateUsing(fn ($state) => $state
|
||||
? \Morilog\Jalali\Jalalian::fromCarbon(\Illuminate\Support\Carbon::parse($state))->format('Y/m/d H:i')
|
||||
: '—')
|
||||
->sortable()
|
||||
->toggleable(),
|
||||
Tables\Columns\TextColumn::make('direction')
|
||||
->badge()
|
||||
->color(fn (\App\Enums\ShipmentDirection $state): string => match ($state->value) {
|
||||
@ -443,9 +450,8 @@ class ShipmentResource extends Resource
|
||||
->toggleable(),
|
||||
Tables\Columns\TextColumn::make('total_fee')
|
||||
->money('IRR')->sortable()->label('Total Fee'),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()->sortable()->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->defaultSort('created_at', 'desc')
|
||||
->filters([
|
||||
Tables\Filters\SelectFilter::make('status')
|
||||
->options(collect(ShipmentStatus::cases())->mapWithKeys(fn ($case) => [
|
||||
@ -701,6 +707,12 @@ class ShipmentResource extends Resource
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
RelationManagers\PackagesRelationManager::class,
|
||||
RelationManagers\ItemsRelationManager::class,
|
||||
RelationManagers\ChecklistsRelationManager::class,
|
||||
RelationManagers\CommitmentFormsRelationManager::class,
|
||||
RelationManagers\ReviewsRelationManager::class,
|
||||
RelationManagers\StatusHistoriesRelationManager::class,
|
||||
RelationManagers\CarrierMappingsRelationManager::class,
|
||||
RelationManagers\TrackingEventsRelationManager::class,
|
||||
];
|
||||
|
||||
@ -0,0 +1,66 @@
|
||||
<?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 ChecklistsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'checklists';
|
||||
|
||||
protected static ?string $title = 'چکلیست عملیاتی';
|
||||
|
||||
protected static ?string $icon = 'heroicon-o-check-badge';
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form->schema([
|
||||
Forms\Components\TextInput::make('status')
|
||||
->required()
|
||||
->label('عنوان مرحله/آیتم'),
|
||||
Forms\Components\Toggle::make('is_completed')
|
||||
->label('تکمیل شده')
|
||||
->default(false),
|
||||
Forms\Components\Textarea::make('notes')
|
||||
->rows(3)
|
||||
->label('یادداشت'),
|
||||
Forms\Components\DateTimePicker::make('completed_at')
|
||||
->label('تاریخ/ساعت تکمیل'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('status')->label('مرحله')->searchable()->weight('bold'),
|
||||
Tables\Columns\IconColumn::make('is_completed')
|
||||
->label('وضعیت')
|
||||
->boolean()
|
||||
->trueIcon('heroicon-o-check-circle')
|
||||
->falseIcon('heroicon-o-x-circle')
|
||||
->trueColor('success')
|
||||
->falseColor('danger'),
|
||||
Tables\Columns\TextColumn::make('user.name')->label('انجامدهنده')->toggleable(),
|
||||
Tables\Columns\TextColumn::make('completed_at')->label('تاریخ تکمیل')->dateTime('Y/m/d H:i')->toggleable(),
|
||||
Tables\Columns\TextColumn::make('notes')->label('یادداشت')->limit(40)->toggleable(),
|
||||
])
|
||||
->defaultSort('created_at', 'desc')
|
||||
->headerActions([
|
||||
Tables\Actions\CreateAction::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
<?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 CommitmentFormsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'commitmentForms';
|
||||
|
||||
protected static ?string $title = 'تعهدنامهها';
|
||||
|
||||
protected static ?string $icon = 'heroicon-o-document-text';
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form->schema([
|
||||
Forms\Components\Select::make('status')
|
||||
->options([
|
||||
'pending' => 'در انتظار',
|
||||
'uploaded' => 'بارگذاری شده',
|
||||
'verified' => 'تأیید شده',
|
||||
'rejected' => 'رد شده',
|
||||
])
|
||||
->label('وضعیت'),
|
||||
Forms\Components\Textarea::make('notes')
|
||||
->rows(3)
|
||||
->label('یادداشت'),
|
||||
Forms\Components\Select::make('verified_by')
|
||||
->relationship('verifier', 'name')
|
||||
->label('تأییدکننده'),
|
||||
Forms\Components\DateTimePicker::make('verified_at')
|
||||
->label('تاریخ تأیید'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('form.title')->label('فرم تعهدنامه')->limit(40),
|
||||
Tables\Columns\TextColumn::make('status')
|
||||
->label('وضعیت')
|
||||
->badge()
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'pending' => 'warning',
|
||||
'uploaded' => 'info',
|
||||
'verified' => 'success',
|
||||
'rejected' => 'danger',
|
||||
default => 'gray',
|
||||
})
|
||||
->formatStateUsing(fn (string $state): string => match ($state) {
|
||||
'pending' => 'در انتظار',
|
||||
'uploaded' => 'بارگذاری شده',
|
||||
'verified' => 'تأیید شده',
|
||||
'rejected' => 'رد شده',
|
||||
default => $state,
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('uploader.name')->label('بارگذاری توسط')->toggleable(),
|
||||
Tables\Columns\TextColumn::make('verifier.name')->label('تأییدکننده')->toggleable(),
|
||||
Tables\Columns\TextColumn::make('verified_at')->label('تاریخ تأیید')->dateTime('Y/m/d H:i')->toggleable(),
|
||||
Tables\Columns\TextColumn::make('notes')->label('یادداشت')->limit(40)->toggleable(),
|
||||
])
|
||||
->defaultSort('created_at', 'desc')
|
||||
// ساخت دستی مجاز نیست — این رکوردها از آپلود تعهدنامه توسط مشتری ایجاد میشوند
|
||||
->headerActions([])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\Action::make('download')
|
||||
->label('دانلود فایل')
|
||||
->icon('heroicon-o-arrow-down-tray')
|
||||
->url(fn ($record) => $record->uploaded_file_path ? asset('storage/' . $record->uploaded_file_path) : null)
|
||||
->openUrlInNewTab()
|
||||
->visible(fn ($record) => !empty($record->uploaded_file_path)),
|
||||
])
|
||||
->bulkActions([]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
<?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 ItemsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'items';
|
||||
|
||||
protected static ?string $title = 'اقلام گمرکی';
|
||||
|
||||
protected static ?string $icon = 'heroicon-o-clipboard-document-list';
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form->schema([
|
||||
Forms\Components\TextInput::make('row_number')
|
||||
->numeric()
|
||||
->minValue(1)
|
||||
->default(1)
|
||||
->required()
|
||||
->label('ردیف'),
|
||||
Forms\Components\TextInput::make('description')
|
||||
->required()
|
||||
->label('شرح کالا'),
|
||||
Forms\Components\TextInput::make('hs_code')
|
||||
->required()
|
||||
->label('HS Code'),
|
||||
Forms\Components\TextInput::make('quantity')
|
||||
->numeric()
|
||||
->minValue(1)
|
||||
->required()
|
||||
->label('تعداد'),
|
||||
Forms\Components\TextInput::make('unit_price')
|
||||
->numeric()
|
||||
->step(0.01)
|
||||
->prefix('USD')
|
||||
->required()
|
||||
->label('قیمت واحد'),
|
||||
Forms\Components\TextInput::make('total_usd')
|
||||
->numeric()
|
||||
->step(0.01)
|
||||
->prefix('USD')
|
||||
->label('مجموع'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('row_number')->label('ردیف')->sortable(),
|
||||
Tables\Columns\TextColumn::make('description')->label('شرح کالا')->limit(40)->searchable(),
|
||||
Tables\Columns\TextColumn::make('hs_code')->label('HS Code')->searchable(),
|
||||
Tables\Columns\TextColumn::make('quantity')->label('تعداد'),
|
||||
Tables\Columns\TextColumn::make('unit_price')->label('قیمت واحد')->money('USD')->sortable(),
|
||||
Tables\Columns\TextColumn::make('total_usd')->label('مجموع')->money('USD')->sortable()->badge()->color('success'),
|
||||
])
|
||||
->defaultSort('row_number', 'asc')
|
||||
->headerActions([
|
||||
Tables\Actions\CreateAction::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
<?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 PackagesRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'packages';
|
||||
|
||||
protected static ?string $title = 'بستهها';
|
||||
|
||||
protected static ?string $icon = 'heroicon-o-cube';
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form->schema([
|
||||
Forms\Components\TextInput::make('package_no')
|
||||
->numeric()
|
||||
->minValue(1)
|
||||
->default(1)
|
||||
->required()
|
||||
->label('شماره بسته'),
|
||||
Forms\Components\TextInput::make('weight')
|
||||
->numeric()
|
||||
->step(0.001)
|
||||
->required()
|
||||
->label('وزن واقعی (kg)'),
|
||||
Forms\Components\TextInput::make('dimensions')
|
||||
->placeholder('مثلاً 25*15*3')
|
||||
->required()
|
||||
->label('ابعاد (L*W*H)'),
|
||||
Forms\Components\Textarea::make('content_description')
|
||||
->rows(2)
|
||||
->label('شرح محتوا'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('package_no')->label('#')->sortable(),
|
||||
Tables\Columns\TextColumn::make('weight')->label('وزن واقعی')->suffix(' kg')->sortable(),
|
||||
Tables\Columns\TextColumn::make('dimensions')->label('ابعاد'),
|
||||
Tables\Columns\TextColumn::make('volumetric_weight')->label('وزن حجمی')->suffix(' kg'),
|
||||
Tables\Columns\TextColumn::make('chargeable_weight')->label('وزن محاسبهای')->suffix(' kg')->badge()->color('warning'),
|
||||
Tables\Columns\TextColumn::make('content_description')->label('شرح محتوا')->limit(40)->toggleable(),
|
||||
])
|
||||
->defaultSort('package_no', 'asc')
|
||||
->headerActions([
|
||||
Tables\Actions\CreateAction::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
<?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 ReviewsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'reviews';
|
||||
|
||||
protected static ?string $title = 'تاریخچه بررسی';
|
||||
|
||||
protected static ?string $icon = 'heroicon-o-arrow-path';
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
// این رکوردها توسط ShipmentReviewService ایجاد میشوند؛ فرم فقط برای مشاهده/یادداشت
|
||||
return $form->schema([
|
||||
Forms\Components\TextInput::make('revision_no')
|
||||
->label('شماره بازبینی')
|
||||
->disabled(),
|
||||
Forms\Components\Select::make('decision')
|
||||
->options([
|
||||
'pending' => 'در انتظار',
|
||||
'changes_requested' => 'درخواست اصلاح',
|
||||
'approved' => 'تأیید شده',
|
||||
'rejected' => 'رد شده',
|
||||
])
|
||||
->label('تصمیم')
|
||||
->disabled(),
|
||||
Forms\Components\Textarea::make('reason')
|
||||
->rows(3)
|
||||
->label('دلیل')
|
||||
->disabled(),
|
||||
Forms\Components\Textarea::make('notes')
|
||||
->rows(3)
|
||||
->label('یادداشت'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('revision_no')->label('نسخه')->sortable()->badge()->color('gray'),
|
||||
Tables\Columns\TextColumn::make('decision')
|
||||
->label('تصمیم')
|
||||
->badge()
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'pending' => 'warning',
|
||||
'changes_requested' => 'info',
|
||||
'approved' => 'success',
|
||||
'rejected' => 'danger',
|
||||
default => 'gray',
|
||||
})
|
||||
->formatStateUsing(fn (string $state): string => match ($state) {
|
||||
'pending' => 'در انتظار',
|
||||
'changes_requested' => 'درخواست اصلاح',
|
||||
'approved' => 'تأیید شده',
|
||||
'rejected' => 'رد شده',
|
||||
default => $state,
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('reason')->label('دلیل')->limit(50)->toggleable(),
|
||||
Tables\Columns\TextColumn::make('notes')->label('یادداشت')->limit(50)->toggleable(),
|
||||
Tables\Columns\TextColumn::make('reviewedBy.name')->label('بررسیکننده')->toggleable(),
|
||||
Tables\Columns\TextColumn::make('reviewed_at')->label('تاریخ بررسی')->dateTime('Y/m/d H:i')->toggleable(),
|
||||
])
|
||||
->defaultSort('revision_no', 'desc')
|
||||
// فقط مشاهده — این رکوردها توسط ShipmentReviewService ایجاد/نهایی میشوند
|
||||
->headerActions([]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
<?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 StatusHistoriesRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'statusHistories';
|
||||
|
||||
protected static ?string $title = 'تاریخچه وضعیت';
|
||||
|
||||
protected static ?string $icon = 'heroicon-o-clock';
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
// این رکوردها هنگام تغییر وضعیت مرسوله توسط سیستم ایجاد میشوند؛ فرم فقط مشاهده
|
||||
return $form->schema([
|
||||
Forms\Components\TextInput::make('from_status')->label('از وضعیت')->disabled(),
|
||||
Forms\Components\TextInput::make('to_status')->label('به وضعیت')->disabled(),
|
||||
Forms\Components\Textarea::make('reason')->rows(3)->label('دلیل')->disabled(),
|
||||
Forms\Components\Textarea::make('notes')->rows(3)->label('یادداشت'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('from_status')->label('از وضعیت')->badge()->color('gray'),
|
||||
Tables\Columns\TextColumn::make('to_status')->label('به وضعیت')->badge()->color('info'),
|
||||
Tables\Columns\TextColumn::make('reason')->label('دلیل')->limit(50)->toggleable(),
|
||||
Tables\Columns\TextColumn::make('changedBy.name')->label('تغییردهنده')->toggleable(),
|
||||
Tables\Columns\TextColumn::make('created_at')->label('تاریخ تغییر')->dateTime('Y/m/d H:i')->sortable(),
|
||||
])
|
||||
->defaultSort('created_at', 'desc')
|
||||
// فقط مشاهده — این رکوردها توسط سیستم هنگام تغییر وضعیت ایجاد میشوند
|
||||
->headerActions([]);
|
||||
}
|
||||
}
|
||||
@ -14,11 +14,11 @@ class ShippingRateResource extends Resource
|
||||
{
|
||||
protected static ?string $model = ShippingRate::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-currency-dollar';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-scale';
|
||||
|
||||
protected static ?string $navigationLabel = 'نرخهای حمل';
|
||||
protected static ?string $navigationGroup = 'تنظیمات';
|
||||
protected static ?int $navigationSort = 3;
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@ -24,7 +24,7 @@ class UserResource extends Resource
|
||||
protected static ?string $navigationLabel = 'کاربران';
|
||||
protected static ?string $modelLabel = 'کاربر';
|
||||
protected static ?string $pluralModelLabel = 'کاربران';
|
||||
protected static ?string $navigationGroup = 'تنظیمات سیستم';
|
||||
protected static ?string $navigationGroup = 'تنظیمات';
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
|
||||
@ -18,7 +18,7 @@ class WalletTransactionResource extends Resource
|
||||
{
|
||||
protected static ?string $model = WalletTransaction::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-banknotes';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-arrows-right-left';
|
||||
|
||||
protected static ?string $navigationLabel = 'تراکنشهای کیف پول';
|
||||
protected static ?string $navigationGroup = 'مالی';
|
||||
|
||||
@ -124,12 +124,39 @@ class Shipment extends Model
|
||||
return $this->hasMany(ShipmentPackage::class);
|
||||
}
|
||||
|
||||
public function reviews(): HasMany
|
||||
public function reviews(): HasMany
|
||||
{
|
||||
return $this->hasMany(ShipmentReview::class)
|
||||
->orderBy('revision_no');
|
||||
}
|
||||
|
||||
/**
|
||||
* چکلیستهای عملیاتی مرسوله
|
||||
*/
|
||||
public function checklists(): HasMany
|
||||
{
|
||||
return $this->hasMany(ShipmentChecklist::class)
|
||||
->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
/**
|
||||
* تعهدنامههای مرسوله (instanceهای پرشده توسط مشتری)
|
||||
*/
|
||||
public function commitmentForms(): HasMany
|
||||
{
|
||||
return $this->hasMany(ShipmentCommitmentForm::class)
|
||||
->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
/**
|
||||
* تاریخچه تغییرات وضعیت مرسوله
|
||||
*/
|
||||
public function statusHistories(): HasMany
|
||||
{
|
||||
return $this->hasMany(ShipmentStatusHistory::class)
|
||||
->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
// === Scopes ===
|
||||
|
||||
public function scopeByAwb($query, string $awbNo)
|
||||
|
||||
@ -56,6 +56,16 @@ class AdminPanelProvider extends PanelProvider
|
||||
->globalSearchKeyBindings(['command+k', 'ctrl+k'])
|
||||
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
|
||||
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
|
||||
// ─── ترتیب و گروهبندی منوی ناوبری ───
|
||||
->navigationGroups([
|
||||
'عملیات',
|
||||
'مالی',
|
||||
'تنظیمات',
|
||||
'گزارشها',
|
||||
'ابزارها',
|
||||
])
|
||||
// ─── بارگذاری استایل سفارشی IFNEX بهعنوان تم فیلمنت ───
|
||||
// ->viteTheme('resources/css/filament.css') // موقتاً غیرفعال تا npm run build
|
||||
->pages([
|
||||
Pages\Dashboard::class,
|
||||
])
|
||||
|
||||
@ -165,8 +165,26 @@
|
||||
color: #991b1b !important;
|
||||
}
|
||||
|
||||
.fi-badge.fi-badge-color-warning {
|
||||
.fi-badge.fi-badge-color-warning {
|
||||
background: #fef3c7 !important;
|
||||
color: #92400e !important;
|
||||
}
|
||||
|
||||
/* ─── فشردهسازی جداول فیلمنت (فونت کوچکتر + padding کمتر) ─── */
|
||||
.fi-ta-text,
|
||||
.fi-ta-text-content {
|
||||
font-size: 0.8125rem !important; /* 13px بهجای 14px پیشفرض */
|
||||
line-height: 1.4 !important;
|
||||
}
|
||||
.fi-ta-header-heading {
|
||||
font-size: 0.75rem !important; /* سرست 12px */
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
.fi-ta-cell,
|
||||
.fi-ta-header-cell {
|
||||
padding: 0.5rem 0.625rem !important; /* فشردهتر */
|
||||
}
|
||||
.fi-ta-text-wrap {
|
||||
gap: 0.125rem !important;
|
||||
}
|
||||
</style>
|
||||
@ -5,7 +5,7 @@ import tailwindcss from '@tailwindcss/vite';
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
laravel({
|
||||
input: ['resources/css/app.css', 'resources/js/app.js'],
|
||||
input: ['resources/css/app.css', 'resources/js/app.js', 'resources/css/filament.css'],
|
||||
refresh: true,
|
||||
}),
|
||||
tailwindcss(),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user