From 438e5a3f43fde7c234ff4b5edfeecc5f70b7f2ca Mon Sep 17 00:00:00 2001 From: Nurmuhammet Allanov Date: Tue, 18 Nov 2025 01:09:35 +0500 Subject: [PATCH] Add View Page for VisaMasterPaymentOrder and Update Schema - Introduced ViewVisaMasterPaymentOrder page for displaying payment order details. - Updated VisaMasterPaymentOrderResource to include a route for the new view page. - Enhanced VisaMasterPaymentOrderInfolist schema to include location details and conditional visibility for notes. - Enabled ViewAction in VisaMasterPaymentOrdersTable for accessing the new view page. - Modified VisaMasterPaymentOrder model to allow nullable notes property. --- .../Pages/ViewVisaMasterPaymentOrder.php | 7 ++++ .../VisaMasterPaymentOrderInfolist.php | 32 +++++++++---------- .../Tables/VisaMasterPaymentOrdersTable.php | 2 +- .../VisaMasterPaymentOrderResource.php | 2 ++ .../Models/VisaMasterPaymentOrder.php | 2 +- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Pages/ViewVisaMasterPaymentOrder.php b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Pages/ViewVisaMasterPaymentOrder.php index 6dbe947..b632b57 100644 --- a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Pages/ViewVisaMasterPaymentOrder.php +++ b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Pages/ViewVisaMasterPaymentOrder.php @@ -2,9 +2,11 @@ namespace App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Pages; +use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Schemas\VisaMasterPaymentOrderInfolist; use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\VisaMasterPaymentOrderResource; use Filament\Actions\EditAction; use Filament\Resources\Pages\ViewRecord; +use Filament\Schemas\Schema; use Filament\Support\Icons\Heroicon; class ViewVisaMasterPaymentOrder extends ViewRecord @@ -18,4 +20,9 @@ class ViewVisaMasterPaymentOrder extends ViewRecord ->icon(Heroicon::OutlinedPencil), ]; } + + public function infolist(Schema $schema): Schema + { + return VisaMasterPaymentOrderInfolist::configure($schema); + } } diff --git a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderInfolist.php b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderInfolist.php index 910e000..249ccd0 100644 --- a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderInfolist.php +++ b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderInfolist.php @@ -5,6 +5,7 @@ namespace App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOr use App\Modules\OrderStatus\Repositories\OrderStatusRepository; use App\Modules\Region\Repositories\RegionRepository; use App\Modules\TurkmenPassport\Repositories\TurkmenPassportRepository; +use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder; use Filament\Infolists\Components\IconEntry; use Filament\Infolists\Components\SpatieMediaLibraryImageEntry; use Filament\Infolists\Components\TextEntry; @@ -14,6 +15,7 @@ use Filament\Schemas\Components\Tabs; use Filament\Schemas\Components\Tabs\Tab; use Filament\Schemas\Schema; use Filament\Support\Icons\Heroicon; +use Illuminate\Support\Str; class VisaMasterPaymentOrderInfolist { @@ -43,30 +45,28 @@ class VisaMasterPaymentOrderInfolist ->trueColor('success') ->falseColor('danger'), + Fieldset::make(__('Location')) + ->schema([ + TextEntry::make('region') + ->label(__('Region')) + ->formatStateUsing(fn (string $state): string => RegionRepository::label($state)), + + TextEntry::make('branch.name') + ->label(__('Branch')) + ->placeholder('-'), + ]) + ->columnSpan(1), + TextEntry::make('notes') ->label(__('Bellik')) ->html() - ->columnSpanFull() + ->visible(fn (VisaMasterPaymentOrder $record): bool => ! is_null($record->notes) && $record->notes != '' && $record->notes != '

' && Str::length($record->notes) > 7) + ->columnSpan(2) ->placeholder('-'), ]), Tabs::make('Order Information') ->tabs([ - Tab::make(__('Order type and bank')) - ->schema([ - - Fieldset::make(__('Location')) - ->schema([ - TextEntry::make('region') - ->label(__('Region')) - ->formatStateUsing(fn ($state) => RegionRepository::values()[$state] ?? $state), - - TextEntry::make('branch.name') - ->label(__('Branch')) - ->placeholder('-'), - ]), - ]), - Tab::make(__('Payment sender data')) ->columns(8) ->schema([ diff --git a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Tables/VisaMasterPaymentOrdersTable.php b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Tables/VisaMasterPaymentOrdersTable.php index 67bd745..893c77c 100644 --- a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Tables/VisaMasterPaymentOrdersTable.php +++ b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Tables/VisaMasterPaymentOrdersTable.php @@ -68,7 +68,7 @@ class VisaMasterPaymentOrdersTable TrashedFilter::make(), ]) ->recordActions([ - // ViewAction::make(), + ViewAction::make(), EditAction::make(), ]) ->toolbarActions([ diff --git a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php index ea10ad9..7faed23 100644 --- a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php +++ b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php @@ -5,6 +5,7 @@ namespace App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOr use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Pages\CreateVisaMasterPaymentOrder; use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Pages\EditVisaMasterPaymentOrder; use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Pages\ListVisaMasterPaymentOrders; +use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Pages\ViewVisaMasterPaymentOrder; use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Schemas\VisaMasterPaymentOrderForm; use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Tables\VisaMasterPaymentOrdersTable; use App\Filament\Clusters\VisaMasterPayments\VisaMasterPaymentsCluster; @@ -65,6 +66,7 @@ class VisaMasterPaymentOrderResource extends Resource return [ 'index' => ListVisaMasterPaymentOrders::route('/'), 'create' => CreateVisaMasterPaymentOrder::route('/create'), + 'view' => ViewVisaMasterPaymentOrder::route('/{record}/view'), 'edit' => EditVisaMasterPaymentOrder::route('/{record}/edit'), ]; } diff --git a/app/Modules/VisaMasterPaymentOrder/Models/VisaMasterPaymentOrder.php b/app/Modules/VisaMasterPaymentOrder/Models/VisaMasterPaymentOrder.php index 7650743..88b27b7 100644 --- a/app/Modules/VisaMasterPaymentOrder/Models/VisaMasterPaymentOrder.php +++ b/app/Modules/VisaMasterPaymentOrder/Models/VisaMasterPaymentOrder.php @@ -25,7 +25,7 @@ use Spatie\MediaLibrary\InteractsWithMedia; * @property array $payment_reciever * @property array $documents * @property string $status - * @property string $notes + * @property ?string $notes * @property string $sender_full_name * @property string $sender_passport_serie * @property string $sender_passport_number