This commit is contained in:
2025-11-18 01:46:06 +05:00
parent 438e5a3f43
commit a9490e132d
8 changed files with 206 additions and 26 deletions

View File

@@ -6,6 +6,7 @@ use App\Modules\OrderStatus\Repositories\OrderStatusRepository;
use App\Modules\Region\Repositories\RegionRepository; use App\Modules\Region\Repositories\RegionRepository;
use App\Modules\TurkmenPassport\Repositories\TurkmenPassportRepository; use App\Modules\TurkmenPassport\Repositories\TurkmenPassportRepository;
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder; use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder;
use Filament\Forms\Components\SpatieMediaLibraryFileUpload;
use Filament\Infolists\Components\IconEntry; use Filament\Infolists\Components\IconEntry;
use Filament\Infolists\Components\SpatieMediaLibraryImageEntry; use Filament\Infolists\Components\SpatieMediaLibraryImageEntry;
use Filament\Infolists\Components\TextEntry; use Filament\Infolists\Components\TextEntry;
@@ -70,36 +71,41 @@ class VisaMasterPaymentOrderInfolist
Tab::make(__('Payment sender data')) Tab::make(__('Payment sender data'))
->columns(8) ->columns(8)
->schema([ ->schema([
TextEntry::make('sender_full_name') Fieldset::make(__('Data'))
->label(__('Name, Surname, Patronic name')) ->columnSpan(8)
->columnSpan(4) ->columns(8)
->placeholder('-'), ->schema([
TextEntry::make('sender_full_name')
->label(__('Name, Surname, Patronic name'))
->columnSpan(4)
->placeholder('-'),
TextEntry::make('sender_passport') TextEntry::make('sender_passport')
->label(__('Passport serie and number')) ->label(__('Passport serie and number'))
->formatStateUsing(function ($record) { ->formatStateUsing(function ($record) {
$serie = TurkmenPassportRepository::values()[$record->sender_passport_serie] ?? $record->sender_passport_serie; $serie = TurkmenPassportRepository::values()[$record->sender_passport_serie] ?? $record->sender_passport_serie;
return $serie.' '.$record->sender_passport_number; return $serie.' '.$record->sender_passport_number;
}) })
->columnSpan(2) ->columnSpan(2)
->placeholder('-'), ->placeholder('-'),
TextEntry::make('phone') TextEntry::make('phone')
->label(__('Phone')) ->label(__('Phone'))
->formatStateUsing(fn ($state) => '+993 '.$state) ->formatStateUsing(fn ($state) => '+993 '.$state)
->columnSpan(2) ->columnSpan(2)
->placeholder('-'), ->placeholder('-'),
TextEntry::make('sender_deposit_account') TextEntry::make('sender_deposit_account')
->label(__('Deposit account')) ->label(__('Deposit account'))
->columnSpan(4) ->columnSpan(4)
->placeholder('-'), ->placeholder('-'),
TextEntry::make('address') TextEntry::make('address')
->label(__('Address')) ->label(__('Address'))
->columnSpan(4) ->columnSpan(4)
->placeholder('-'), ->placeholder('-'),
]),
Section::make(__('Files')) Section::make(__('Files'))
->description('PNG, JPEG, PDF') ->description('PNG, JPEG, PDF')

View File

@@ -49,6 +49,12 @@
"Tests\\": "tests/" "Tests\\": "tests/"
} }
}, },
"repositories": [
{
"type": "composer",
"url": "https://satis.ralphjsmit.com"
}
],
"scripts": { "scripts": {
"post-autoload-dump": [ "post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",

View File

@@ -727,5 +727,6 @@
"Payment": "Töleg", "Payment": "Töleg",
"Online payments": "Onlaýn tölegler", "Online payments": "Onlaýn tölegler",
"USD rate": "USD kursy", "USD rate": "USD kursy",
"Total": "Jemi" "Total": "Jemi",
"Data": "Maglumatlar"
} }

View File

@@ -0,0 +1,7 @@
<?php
// translations for Hugomyb/FilamentMediaAction
return [
'loading' => 'Loading...',
'unsupported-media-type' => 'Unsupported media type.',
];

View File

@@ -0,0 +1,6 @@
<?php
return [
'loading' => 'Chargement...',
'unsupported-media-type' => 'Type de média non pris en charge.',
];

View File

@@ -0,0 +1,7 @@
<?php
// translations for Hugomyb/FilamentMediaAction
return [
'loading' => 'Caricamento...',
'unsupported-media-type' => 'Tipo di file non supportato.',
];

View File

View File

@@ -0,0 +1,147 @@
<div class="w-full flex flex-col justify-center items-center h-full"
x-data="{
loading: true,
autoplayed: false,
init() {
this.loading = true;
let mediaElement = this.$refs.mediaFrame;
if (!mediaElement) {
this.loading = false;
return;
}
if (mediaElement.tagName === 'VIDEO' || mediaElement.tagName === 'AUDIO') {
mediaElement.load();
mediaElement.onload = () => {
this.loading = false;
};
mediaElement.oncanplaythrough = () => {
this.loading = false;
};
mediaElement.onloadstart = () => {
this.loading = true;
};
mediaElement.onerror = () => {
this.loading = false;
};
if (mediaElement.readyState >= 3) {
this.loading = false;
}
// Autoplay logic
if (@js($autoplay) && mediaElement.play) {
this.autoplayed = true;
mediaElement.play().catch(() => {
console.log('Autoplay failed or was blocked.');
});
}
} else {
this.loading = true;
mediaElement.onload = () => {
setTimeout(() => {
this.loading = false;
}, 200);
};
mediaElement.onerror = () => {
this.loading = false;
};
}
},
resetAutoplay() {
this.autoplayed = false;
}
}"
@open-modal.window="resetAutoplay"
>
<div class="flex h-full flex-col justify-center items-center" x-show="loading">
<x-filament::loading-indicator class="h-10 w-10" />
<span class="text-center font-bold">{{ __('filament-media-action::media-action.loading') }}</span>
</div>
<div class="mediaContainer w-full flex flex-col justify-center items-center h-full" x-show="!loading">
@if ($mediaType === \Hugomyb\FilamentMediaAction\Actions\MediaAction::TYPE_YOUTUBE)
@php
$youtubeId = '';
// Parse the URL to get components
$parsedUrl = parse_url($media);
if (isset($parsedUrl['host'])) {
// Check if it's a youtu.be short URL
if (str_contains($parsedUrl['host'], 'youtu.be')) {
$youtubeId = ltrim($parsedUrl['path'], '/');
}
// Check if it's a regular youtube.com URL
elseif (str_contains($parsedUrl['host'], 'youtube.com')) {
parse_str($parsedUrl['query'] ?? '', $queryParams);
$youtubeId = $queryParams['v'] ?? '';
}
}
@endphp
@if ($youtubeId)
<iframe x-ref="mediaFrame" class="rounded-lg" width="100%"
src="https://www.youtube.com/embed/{{ $youtubeId }}{{ $autoplay ? '?autoplay=1' : '' }}"
frameborder="0"
style="aspect-ratio: 16 / 9;"
allowfullscreen
></iframe>
@else
<p>Invalid YouTube URL.</p>
@endif
@elseif ($mediaType === \Hugomyb\FilamentMediaAction\Actions\MediaAction::TYPE_AUDIO)
<audio
x-ref="mediaFrame"
class="rounded-lg w-full"
style="width: 100%"
controls
@if($controlsList) controlsList="{{ $controlsList }}" @endif
@canplay="loading = false"
@loadeddata="loading = false"
@play="loading = false"
{{ $preload ? '' : 'preload="none"' }}
>
<source src="{{ $media }}" @if($mime && $mime !== 'unknown') type="{{ $mime }}" @endif>
Your browser does not support the audio element.
</audio>
@elseif ($mediaType === \Hugomyb\FilamentMediaAction\Actions\MediaAction::TYPE_VIDEO)
<video
x-ref="mediaFrame"
class="rounded-lg w-full"
width="100%"
style="aspect-ratio: 16 / 9;"
controls
playsinline
@if($controlsList) controlsList="{{ $controlsList }}" @endif
@canplaythrough="loading = false"
{{ $preload ? '' : 'preload="none"' }}
>
<source src="{{ $media }}" @if($mime && $mime !== 'unknown') type="{{ $mime }}" @endif>
Your browser does not support the video tag.
</video>
@elseif ($mediaType === \Hugomyb\FilamentMediaAction\Actions\MediaAction::TYPE_IMAGE)
<img x-ref="mediaFrame" class="rounded-lg" src="{{ $media }}" alt="Media Image"
style="max-width: 100%; height: auto;" @load="loading = false">
@elseif ($mediaType === \Hugomyb\FilamentMediaAction\Actions\MediaAction::TYPE_PDF)
<iframe x-ref="mediaFrame" class="rounded-lg" style="min-height: 600px"
src="{{ $media }}" width="100%" height="100%"
@load="loading = false"></iframe>
@else
<p>{{ __('filament-media-action::unsupported-media-type') }}</p>
@endif
</div>
</div>