wip
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Filament\Infolists\Components;
|
|||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Filament\Infolists\Components\Entry;
|
use Filament\Infolists\Components\Entry;
|
||||||
|
use Filament\Actions\Action;
|
||||||
use Filament\Support\Concerns\HasMediaFilter;
|
use Filament\Support\Concerns\HasMediaFilter;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
@@ -16,6 +17,25 @@ class SpatieMediaLibraryFileEntry extends Entry
|
|||||||
{
|
{
|
||||||
use HasMediaFilter;
|
use HasMediaFilter;
|
||||||
|
|
||||||
|
public function getViewMediaActionName(): string
|
||||||
|
{
|
||||||
|
return 'view_media_' . $this->getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->registerActions([
|
||||||
|
Action::make($this->getViewMediaActionName())
|
||||||
|
->label(__('Watch Full'))
|
||||||
|
->modalContent(fn (array $arguments) => view('filament.infolists.components.image-modal', ['url' => $arguments['url']]))
|
||||||
|
->modalSubmitAction(false)
|
||||||
|
->modalCancelAction(false)
|
||||||
|
->modalWidth('5xl'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
protected string $view = 'filament.infolists.components.spatie-media-library-file-entry';
|
protected string $view = 'filament.infolists.components.spatie-media-library-file-entry';
|
||||||
|
|
||||||
protected string | Closure | null $collection = null;
|
protected string | Closure | null $collection = null;
|
||||||
@@ -75,7 +95,7 @@ class SpatieMediaLibraryFileEntry extends Entry
|
|||||||
|
|
||||||
public function getVisibility(): string
|
public function getVisibility(): string
|
||||||
{
|
{
|
||||||
return $this->evaluate($this->visibility);
|
return (string) $this->evaluate($this->visibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isDownloadable(): bool
|
public function isDownloadable(): bool
|
||||||
|
|||||||
@@ -728,5 +728,6 @@
|
|||||||
"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"
|
"Data": "Maglumatlar",
|
||||||
|
"Watch Full": "Giňişleýin"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<div class="flex justify-center items-center w-full h-full">
|
||||||
|
<img src="{{ $url }}" class="max-w-full max-h-[80vh] object-contain rounded-lg shadow-lg" alt="Preview" />
|
||||||
|
</div>
|
||||||
@@ -16,23 +16,30 @@
|
|||||||
])
|
])
|
||||||
>
|
>
|
||||||
@foreach ($media as $medium)
|
@foreach ($media as $medium)
|
||||||
<div class="relative group">
|
<div class="flex flex-col items-center gap-2">
|
||||||
<img
|
<img
|
||||||
src="{{ $entry->getMediaUrl($medium, $media->count() > 1 ? 'thumb' : null) }}"
|
src="{{ $entry->getMediaUrl($medium, $media->count() > 1 ? 'thumb' : null) }}"
|
||||||
class="w-full rounded-lg"
|
class="w-full rounded-lg"
|
||||||
/>
|
/>
|
||||||
<a
|
<button
|
||||||
href="{{ $entry->getMediaUrl($medium) }}"
|
type="button"
|
||||||
target="_blank"
|
class="text-sm font-medium text-primary-600 decoration-2 center underline focus:outline-none dark:text-primary-500"
|
||||||
rel="noopener noreferrer"
|
@click="$dispatch('open-modal', { id: 'preview-image' })"
|
||||||
class="absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded-lg"
|
|
||||||
>
|
>
|
||||||
<x-filament::icon
|
{{ __('Watch Full') }}
|
||||||
icon="heroicon-m-eye"
|
</button>
|
||||||
class="h-8 w-8 text-white"
|
</div>
|
||||||
/>
|
|
||||||
</a>
|
<x-filament::modal id="preview-image" width="5xl" :close-button="true">
|
||||||
</div>
|
<x-slot name="heading">
|
||||||
|
{{ $getLabel() }}
|
||||||
|
</x-slot>
|
||||||
|
|
||||||
|
<img
|
||||||
|
src="{{ $entry->getMediaUrl($medium) }}"
|
||||||
|
class="w-full h-full object-contain"
|
||||||
|
/>
|
||||||
|
</x-filament::modal>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
@else
|
@else
|
||||||
|
|||||||
Reference in New Issue
Block a user