Refactor VisaMasterPaymentOrderInfolist and SpatieMediaLibraryFileEntry components
- Cleaned up imports and improved code formatting for better readability. - Adjusted layout in VisaMasterPaymentOrderInfolist schema for consistent column spans. - Enhanced SpatieMediaLibraryFileEntry component by streamlining property definitions and ensuring consistent formatting.
This commit is contained in:
@@ -2,12 +2,12 @@
|
||||
|
||||
namespace App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Schemas;
|
||||
|
||||
use App\Filament\Infolists\Components\SpatieMediaLibraryFileEntry;
|
||||
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 App\Filament\Infolists\Components\SpatieMediaLibraryFileEntry;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Schemas\Components\Fieldset;
|
||||
use Filament\Schemas\Components\Section;
|
||||
@@ -15,10 +15,7 @@ use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Hugomyb\FilamentMediaAction\Actions\MediaAction;
|
||||
use Illuminate\Support\Str;
|
||||
use RalphJSmit\Filament\Upload\Filament\Forms\Components\AdvancedFileUpload;
|
||||
use RalphJSmit\Filament\Upload\Filament\Infolists\Entries\PdfEntry;
|
||||
|
||||
class VisaMasterPaymentOrderInfolist
|
||||
{
|
||||
@@ -78,35 +75,35 @@ class VisaMasterPaymentOrderInfolist
|
||||
->columns(8)
|
||||
->schema([
|
||||
TextEntry::make('sender_full_name')
|
||||
->label(__('Name, Surname, Patronic name'))
|
||||
->columnSpan(4)
|
||||
->placeholder('-'),
|
||||
->label(__('Name, Surname, Patronic name'))
|
||||
->columnSpan(4)
|
||||
->placeholder('-'),
|
||||
|
||||
TextEntry::make('sender_passport')
|
||||
->label(__('Passport serie and number'))
|
||||
->formatStateUsing(function ($record) {
|
||||
$serie = TurkmenPassportRepository::values()[$record->sender_passport_serie] ?? $record->sender_passport_serie;
|
||||
TextEntry::make('sender_passport')
|
||||
->label(__('Passport serie and number'))
|
||||
->formatStateUsing(function ($record) {
|
||||
$serie = TurkmenPassportRepository::values()[$record->sender_passport_serie] ?? $record->sender_passport_serie;
|
||||
|
||||
return $serie.' '.$record->sender_passport_number;
|
||||
})
|
||||
->columnSpan(2)
|
||||
->placeholder('-'),
|
||||
return $serie.' '.$record->sender_passport_number;
|
||||
})
|
||||
->columnSpan(2)
|
||||
->placeholder('-'),
|
||||
|
||||
TextEntry::make('phone')
|
||||
->label(__('Phone'))
|
||||
->formatStateUsing(fn ($state) => '+993 '.$state)
|
||||
->columnSpan(2)
|
||||
->placeholder('-'),
|
||||
TextEntry::make('phone')
|
||||
->label(__('Phone'))
|
||||
->formatStateUsing(fn ($state) => '+993 '.$state)
|
||||
->columnSpan(2)
|
||||
->placeholder('-'),
|
||||
|
||||
TextEntry::make('sender_deposit_account')
|
||||
->label(__('Deposit account'))
|
||||
->columnSpan(4)
|
||||
->placeholder('-'),
|
||||
TextEntry::make('sender_deposit_account')
|
||||
->label(__('Deposit account'))
|
||||
->columnSpan(4)
|
||||
->placeholder('-'),
|
||||
|
||||
TextEntry::make('address')
|
||||
->label(__('Address'))
|
||||
->columnSpan(4)
|
||||
->placeholder('-'),
|
||||
TextEntry::make('address')
|
||||
->label(__('Address'))
|
||||
->columnSpan(4)
|
||||
->placeholder('-'),
|
||||
]),
|
||||
|
||||
Section::make(__('Files'))
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Filament\Infolists\Components;
|
||||
|
||||
use Closure;
|
||||
use Filament\Infolists\Components\Entry;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Infolists\Components\Entry;
|
||||
use Filament\Support\Concerns\HasMediaFilter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
@@ -19,7 +19,7 @@ class SpatieMediaLibraryFileEntry extends Entry
|
||||
|
||||
public function getViewMediaActionName(): string
|
||||
{
|
||||
return 'view_media_' . $this->getName();
|
||||
return 'view_media_'.$this->getName();
|
||||
}
|
||||
|
||||
protected function setUp(): void
|
||||
@@ -38,45 +38,45 @@ class SpatieMediaLibraryFileEntry extends Entry
|
||||
|
||||
protected string $view = 'filament.infolists.components.spatie-media-library-file-entry';
|
||||
|
||||
protected string | Closure | null $collection = null;
|
||||
protected string|Closure|null $collection = null;
|
||||
|
||||
protected string | Closure | null $conversion = null;
|
||||
protected string|Closure|null $conversion = null;
|
||||
|
||||
protected string | Closure $visibility = 'private';
|
||||
protected string|Closure $visibility = 'private';
|
||||
|
||||
protected bool | Closure $isDownloadable = true;
|
||||
protected bool|Closure $isDownloadable = true;
|
||||
|
||||
protected bool | Closure $isPreviewable = true;
|
||||
protected bool|Closure $isPreviewable = true;
|
||||
|
||||
public function collection(string | Closure | null $collection): static
|
||||
public function collection(string|Closure|null $collection): static
|
||||
{
|
||||
$this->collection = $collection;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function conversion(string | Closure | null $conversion): static
|
||||
public function conversion(string|Closure|null $conversion): static
|
||||
{
|
||||
$this->conversion = $conversion;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function visibility(string | Closure $visibility): static
|
||||
public function visibility(string|Closure $visibility): static
|
||||
{
|
||||
$this->visibility = $visibility;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function downloadable(bool | Closure $condition = true): static
|
||||
public function downloadable(bool|Closure $condition = true): static
|
||||
{
|
||||
$this->isDownloadable = $condition;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function previewable(bool | Closure $condition = true): static
|
||||
public function previewable(bool|Closure $condition = true): static
|
||||
{
|
||||
$this->isPreviewable = $condition;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user