feat: patient view, media player, and rich editor enhancements
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Infolists\Components;
|
||||
|
||||
use Filament\Infolists\Components\Entry;
|
||||
use Filament\Support\Components\Contracts\HasEmbeddedView;
|
||||
|
||||
class MediaFilesEntry extends Entry implements HasEmbeddedView
|
||||
{
|
||||
public function toEmbeddedHtml(): string
|
||||
{
|
||||
$record = $this->getRecord();
|
||||
$field = $this->getName();
|
||||
|
||||
if (! $record) {
|
||||
return $this->wrapEmbeddedHtml('<span class="text-sm text-gray-400">-</span>');
|
||||
}
|
||||
|
||||
$files = $record->{$field} ?? [];
|
||||
$files = is_array($files) ? array_filter($files) : [];
|
||||
|
||||
if (empty($files)) {
|
||||
return $this->wrapEmbeddedHtml('<span class="text-sm text-gray-400">-</span>');
|
||||
}
|
||||
|
||||
$html = view('filament.infolists.media-player-embed', [
|
||||
'patientId' => $record->id,
|
||||
'field' => $field,
|
||||
])->render();
|
||||
|
||||
return $this->wrapEmbeddedHtml($html);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user