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.
This commit is contained in:
2025-11-18 01:09:35 +05:00
parent cbd469c97f
commit 438e5a3f43
5 changed files with 27 additions and 18 deletions

View File

@@ -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);
}
}

View File

@@ -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 != '<p></p>' && 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([

View File

@@ -68,7 +68,7 @@ class VisaMasterPaymentOrdersTable
TrashedFilter::make(),
])
->recordActions([
// ViewAction::make(),
ViewAction::make(),
EditAction::make(),
])
->toolbarActions([

View File

@@ -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'),
];
}

View File

@@ -25,7 +25,7 @@ use Spatie\MediaLibrary\InteractsWithMedia;
* @property array<string, string> $payment_reciever
* @property array<string, string> $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