diff --git a/app-modules/service-management/src/Filament/Resources/ServiceRequestResource/Pages/ViewServiceRequest.php b/app-modules/service-management/src/Filament/Resources/ServiceRequestResource/Pages/ViewServiceRequest.php index a7473cf25..f7ca1ca68 100644 --- a/app-modules/service-management/src/Filament/Resources/ServiceRequestResource/Pages/ViewServiceRequest.php +++ b/app-modules/service-management/src/Filament/Resources/ServiceRequestResource/Pages/ViewServiceRequest.php @@ -48,8 +48,7 @@ use Filament\Actions\EditAction; use Filament\Infolists\Components\Actions\Action as InfolistAction; use Filament\Infolists\Components\Group; -use Filament\Infolists\Components\IconEntry; -use Filament\Infolists\Components\IconEntry\IconEntrySize; +use Filament\Infolists\Components\ImageEntry; use Filament\Infolists\Components\Section; use Filament\Infolists\Components\TextEntry; use Filament\Infolists\Components\ViewEntry; @@ -134,33 +133,17 @@ public function infolist(Infolist $infolist): Infolist fn (ServiceRequest $record) => $record ->getMedia($uploadsMediaCollection->getName()) ->map( - fn (Media $media) => IconEntry::make($media->getKey()) + fn (Media $media) => ImageEntry::make($media->getKey()) ->label($media->name) - ->state($media->mime_type) - ->icon(fn (string $state): string => match ($media->mime_type) { - 'application/pdf', - 'application/vnd.ms-word', - 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'image/pdf', - 'text/markdown', - 'text/plain' => 'heroicon-o-document-text', - 'application/vnd.ms-excel', - 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'text/csv' => 'heroicon-o-table-cells', - 'application/vnd.ms-powerpoint', - 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'heroicon-o-presentation-chart-bar', - 'image/jpeg' => 'heroicon-o-camera', - 'image/png' => 'heroicon-o-photo', - default => 'heroicon-o-paper-clip', - }) - ->size(IconEntrySize::TwoExtraLarge) + ->state($mediaUrl = $media->getTemporaryUrl(now()->addHour())) ->hintAction( InfolistAction::make('download') ->label('Download') ->icon('heroicon-m-arrow-down-tray') ->color('primary') - ->url($media->getTemporaryUrl(now()->addMinute()), true) + ->url($mediaUrl, true) ) + ->simpleLightbox($mediaUrl) ) ->toArray() ), diff --git a/app/Providers/Filament/AdminPanelProvider.php b/app/Providers/Filament/AdminPanelProvider.php index 39d9b99e4..3bbbeca9b 100644 --- a/app/Providers/Filament/AdminPanelProvider.php +++ b/app/Providers/Filament/AdminPanelProvider.php @@ -65,6 +65,7 @@ use Illuminate\View\Middleware\ShareErrorsFromSession; use Saade\FilamentFullCalendar\FilamentFullCalendarPlugin; use ShuvroRoy\FilamentSpatieLaravelHealth\FilamentSpatieLaravelHealthPlugin; +use SolutionForest\FilamentSimpleLightBox\SimpleLightBoxPlugin; use Spatie\Multitenancy\Http\Middleware\EnsureValidTenantSession; class AdminPanelProvider extends PanelProvider @@ -175,6 +176,7 @@ public function panel(Panel $panel): Panel FilamentSpatieLaravelHealthPlugin::make() ->usingPage(ProductHealth::class), FilamentFullCalendarPlugin::make(), + SimpleLightBoxPlugin::make(), ]) ->userMenuItems([ 'profile' => MenuItem::make() diff --git a/composer.json b/composer.json index ac013ce5d..486190708 100644 --- a/composer.json +++ b/composer.json @@ -81,6 +81,7 @@ "shuvroroy/filament-spatie-laravel-health": "^2.1.0", "socialiteproviders/google": "^4.1", "socialiteproviders/microsoft-azure": "^5.2", + "solution-forest/filament-simplelightbox": "^0.0.10", "spatie/laravel-cookie-consent": "^3.3", "spatie/laravel-data": "^3.11", "spatie/laravel-health": "v1.24.1", diff --git a/composer.lock b/composer.lock index a185e023c..d9c2e4caf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5a7591a46a611e909a946e86d0465375", + "content-hash": "89a584d0f21d211d2a819d97335e76f4", "packages": [ { "name": "amphp/amp", @@ -12905,6 +12905,88 @@ }, "time": "2024-03-15T03:02:10+00:00" }, + { + "name": "solution-forest/filament-simplelightbox", + "version": "0.0.10", + "source": { + "type": "git", + "url": "https://github.com/solutionforest/Filament-SimpleLightBox.git", + "reference": "873fe865b11eaded4a469dcc8816ee61599375f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/solutionforest/Filament-SimpleLightBox/zipball/873fe865b11eaded4a469dcc8816ee61599375f3", + "reference": "873fe865b11eaded4a469dcc8816ee61599375f3", + "shasum": "" + }, + "require": { + "filament/filament": "^3.0", + "filament/infolists": "^3.0", + "filament/tables": "^3.0", + "illuminate/contracts": "^10.0|^11.0", + "php": "^8.1", + "spatie/laravel-package-tools": "^1.15.0" + }, + "require-dev": { + "laravel/pint": "^1.0", + "nunomaduro/collision": "^7.9", + "nunomaduro/larastan": "^2.0.1", + "orchestra/testbench": "^8.0", + "pestphp/pest": "^2.0", + "pestphp/pest-plugin-arch": "^2.0", + "pestphp/pest-plugin-laravel": "^2.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "spatie/laravel-ray": "^1.26" + }, + "type": "library", + "extra": { + "laravel": { + "aliases": { + "FilamentSimpleLightBox": "SolutionForest\\FilamentSimpleLightBox\\Facades\\FilamentSimpleLightBox" + }, + "providers": [ + "SolutionForest\\FilamentSimpleLightBox\\FilamentSimpleLightBoxServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "SolutionForest\\FilamentSimpleLightBox\\": "src/", + "SolutionForest\\FilamentSimpleLightBox\\Database\\Factories\\": "database/factories/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "alan", + "email": "info@solutionforest.net", + "role": "Developer" + } + ], + "description": "This is my package filament-simplelightbox", + "homepage": "https://github.com/solutionforest/filament-simplelightbox", + "keywords": [ + "filament-simplelightbox", + "laravel", + "solutionforest" + ], + "support": { + "issues": "https://github.com/solutionforest/filament-simplelightbox/issues", + "source": "https://github.com/solutionforest/filament-simplelightbox" + }, + "funding": [ + { + "url": "https://github.com/SolutionForest", + "type": "github" + } + ], + "time": "2024-08-06T04:15:14+00:00" + }, { "name": "spatie/color", "version": "1.7.0",