diff --git a/04_Laravel/app/Filament/Pages/BulkTrackingImport.php b/04_Laravel/app/Filament/Pages/BulkTrackingImport.php index d0ae96d..4480d57 100644 --- a/04_Laravel/app/Filament/Pages/BulkTrackingImport.php +++ b/04_Laravel/app/Filament/Pages/BulkTrackingImport.php @@ -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 = []; diff --git a/04_Laravel/app/Filament/Pages/IfnexSettingsPage.php b/04_Laravel/app/Filament/Pages/IfnexSettingsPage.php index 56c7f18..e97a35c 100644 --- a/04_Laravel/app/Filament/Pages/IfnexSettingsPage.php +++ b/04_Laravel/app/Filament/Pages/IfnexSettingsPage.php @@ -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'; diff --git a/04_Laravel/app/Filament/Pages/ImportRatesPage.php b/04_Laravel/app/Filament/Pages/ImportRatesPage.php index 53311c9..ac804bb 100644 --- a/04_Laravel/app/Filament/Pages/ImportRatesPage.php +++ b/04_Laravel/app/Filament/Pages/ImportRatesPage.php @@ -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 = []; diff --git a/04_Laravel/app/Filament/Pages/PriceTestPage.php b/04_Laravel/app/Filament/Pages/PriceTestPage.php index f432570..a4bffeb 100644 --- a/04_Laravel/app/Filament/Pages/PriceTestPage.php +++ b/04_Laravel/app/Filament/Pages/PriceTestPage.php @@ -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; diff --git a/04_Laravel/app/Filament/Pages/Reports/FinancialReport.php b/04_Laravel/app/Filament/Pages/Reports/FinancialReport.php index 6451b74..ef393a0 100644 --- a/04_Laravel/app/Filament/Pages/Reports/FinancialReport.php +++ b/04_Laravel/app/Filament/Pages/Reports/FinancialReport.php @@ -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'; diff --git a/04_Laravel/app/Filament/Resources/AuditLogResource.php b/04_Laravel/app/Filament/Resources/AuditLogResource.php index 4301966..58889fa 100644 --- a/04_Laravel/app/Filament/Resources/AuditLogResource.php +++ b/04_Laravel/app/Filament/Resources/AuditLogResource.php @@ -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 diff --git a/04_Laravel/app/Filament/Resources/CommitmentFormResource.php b/04_Laravel/app/Filament/Resources/CommitmentFormResource.php index b9bb9c9..0bb939c 100644 --- a/04_Laravel/app/Filament/Resources/CommitmentFormResource.php +++ b/04_Laravel/app/Filament/Resources/CommitmentFormResource.php @@ -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 { diff --git a/04_Laravel/app/Filament/Resources/CountryResource.php b/04_Laravel/app/Filament/Resources/CountryResource.php index 16f624c..0125e8d 100644 --- a/04_Laravel/app/Filament/Resources/CountryResource.php +++ b/04_Laravel/app/Filament/Resources/CountryResource.php @@ -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 { diff --git a/04_Laravel/app/Filament/Resources/CurrencyResource.php b/04_Laravel/app/Filament/Resources/CurrencyResource.php index deef07e..4cd5266 100644 --- a/04_Laravel/app/Filament/Resources/CurrencyResource.php +++ b/04_Laravel/app/Filament/Resources/CurrencyResource.php @@ -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 { diff --git a/04_Laravel/app/Filament/Resources/CustomerCreditResource.php b/04_Laravel/app/Filament/Resources/CustomerCreditResource.php index 23d3bce..e71e863 100644 --- a/04_Laravel/app/Filament/Resources/CustomerCreditResource.php +++ b/04_Laravel/app/Filament/Resources/CustomerCreditResource.php @@ -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 { diff --git a/04_Laravel/app/Filament/Resources/DiscountCodeResource.php b/04_Laravel/app/Filament/Resources/DiscountCodeResource.php index cd93ec0..6705f82 100644 --- a/04_Laravel/app/Filament/Resources/DiscountCodeResource.php +++ b/04_Laravel/app/Filament/Resources/DiscountCodeResource.php @@ -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 { diff --git a/04_Laravel/app/Filament/Resources/ExchangeRateHistoryResource.php b/04_Laravel/app/Filament/Resources/ExchangeRateHistoryResource.php index 0c68a5d..e773ab3 100644 --- a/04_Laravel/app/Filament/Resources/ExchangeRateHistoryResource.php +++ b/04_Laravel/app/Filament/Resources/ExchangeRateHistoryResource.php @@ -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 { diff --git a/04_Laravel/app/Filament/Resources/RoleResource.php b/04_Laravel/app/Filament/Resources/RoleResource.php index 3c67e46..2419461 100644 --- a/04_Laravel/app/Filament/Resources/RoleResource.php +++ b/04_Laravel/app/Filament/Resources/RoleResource.php @@ -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 diff --git a/04_Laravel/app/Filament/Resources/ShipmentChecklistResource.php b/04_Laravel/app/Filament/Resources/ShipmentChecklistResource.php index 899ee04..b738a0d 100644 --- a/04_Laravel/app/Filament/Resources/ShipmentChecklistResource.php +++ b/04_Laravel/app/Filament/Resources/ShipmentChecklistResource.php @@ -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 { diff --git a/04_Laravel/app/Filament/Resources/ShipmentItemResource.php b/04_Laravel/app/Filament/Resources/ShipmentItemResource.php index ad9a21f..ddbd71e 100644 --- a/04_Laravel/app/Filament/Resources/ShipmentItemResource.php +++ b/04_Laravel/app/Filament/Resources/ShipmentItemResource.php @@ -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 { diff --git a/04_Laravel/app/Filament/Resources/ShipmentResource.php b/04_Laravel/app/Filament/Resources/ShipmentResource.php index 1073311..40ed5ff 100644 --- a/04_Laravel/app/Filament/Resources/ShipmentResource.php +++ b/04_Laravel/app/Filament/Resources/ShipmentResource.php @@ -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, ]; diff --git a/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/ChecklistsRelationManager.php b/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/ChecklistsRelationManager.php new file mode 100644 index 0000000..83e660a --- /dev/null +++ b/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/ChecklistsRelationManager.php @@ -0,0 +1,66 @@ +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(), + ]), + ]); + } +} \ No newline at end of file diff --git a/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/CommitmentFormsRelationManager.php b/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/CommitmentFormsRelationManager.php new file mode 100644 index 0000000..bf472f7 --- /dev/null +++ b/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/CommitmentFormsRelationManager.php @@ -0,0 +1,82 @@ +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([]); + } +} \ No newline at end of file diff --git a/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/ItemsRelationManager.php b/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/ItemsRelationManager.php new file mode 100644 index 0000000..80d2ce0 --- /dev/null +++ b/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/ItemsRelationManager.php @@ -0,0 +1,78 @@ +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(), + ]), + ]); + } +} \ No newline at end of file diff --git a/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/PackagesRelationManager.php b/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/PackagesRelationManager.php new file mode 100644 index 0000000..ca054ba --- /dev/null +++ b/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/PackagesRelationManager.php @@ -0,0 +1,68 @@ +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(), + ]), + ]); + } +} \ No newline at end of file diff --git a/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/ReviewsRelationManager.php b/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/ReviewsRelationManager.php new file mode 100644 index 0000000..7bce4e2 --- /dev/null +++ b/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/ReviewsRelationManager.php @@ -0,0 +1,76 @@ +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([]); + } +} \ No newline at end of file diff --git a/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/StatusHistoriesRelationManager.php b/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/StatusHistoriesRelationManager.php new file mode 100644 index 0000000..4f1e287 --- /dev/null +++ b/04_Laravel/app/Filament/Resources/ShipmentResource/RelationManagers/StatusHistoriesRelationManager.php @@ -0,0 +1,44 @@ +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([]); + } +} \ No newline at end of file diff --git a/04_Laravel/app/Filament/Resources/ShippingRateResource.php b/04_Laravel/app/Filament/Resources/ShippingRateResource.php index 12abed0..4bb5b11 100644 --- a/04_Laravel/app/Filament/Resources/ShippingRateResource.php +++ b/04_Laravel/app/Filament/Resources/ShippingRateResource.php @@ -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 { diff --git a/04_Laravel/app/Filament/Resources/UserResource.php b/04_Laravel/app/Filament/Resources/UserResource.php index 7091989..2c1246f 100644 --- a/04_Laravel/app/Filament/Resources/UserResource.php +++ b/04_Laravel/app/Filament/Resources/UserResource.php @@ -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 diff --git a/04_Laravel/app/Filament/Resources/WalletTransactionResource.php b/04_Laravel/app/Filament/Resources/WalletTransactionResource.php index fd92036..3c215d9 100644 --- a/04_Laravel/app/Filament/Resources/WalletTransactionResource.php +++ b/04_Laravel/app/Filament/Resources/WalletTransactionResource.php @@ -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 = 'مالی'; diff --git a/04_Laravel/app/Models/Shipment.php b/04_Laravel/app/Models/Shipment.php index 44ab6e2..14ac880 100644 --- a/04_Laravel/app/Models/Shipment.php +++ b/04_Laravel/app/Models/Shipment.php @@ -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) diff --git a/04_Laravel/app/Providers/Filament/AdminPanelProvider.php b/04_Laravel/app/Providers/Filament/AdminPanelProvider.php index b4c8a95..fdf90b4 100644 --- a/04_Laravel/app/Providers/Filament/AdminPanelProvider.php +++ b/04_Laravel/app/Providers/Filament/AdminPanelProvider.php @@ -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, ]) diff --git a/04_Laravel/resources/views/filament/hooks/head.blade.php b/04_Laravel/resources/views/filament/hooks/head.blade.php index cdc2ad2..e211eb9 100644 --- a/04_Laravel/resources/views/filament/hooks/head.blade.php +++ b/04_Laravel/resources/views/filament/hooks/head.blade.php @@ -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; + } \ No newline at end of file diff --git a/04_Laravel/vite.config.js b/04_Laravel/vite.config.js index f35b4e7..63ac31a 100644 --- a/04_Laravel/vite.config.js +++ b/04_Laravel/vite.config.js @@ -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(),