Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AIDAPP-415]: Display preview of attachments if image when viewing a service request #390

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
),
Expand Down
2 changes: 2 additions & 0 deletions app/Providers/Filament/AdminPanelProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -175,6 +176,7 @@ public function panel(Panel $panel): Panel
FilamentSpatieLaravelHealthPlugin::make()
->usingPage(ProductHealth::class),
FilamentFullCalendarPlugin::make(),
SimpleLightBoxPlugin::make(),
])
->userMenuItems([
'profile' => MenuItem::make()
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
84 changes: 83 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.