feat: patient view, media player, and rich editor enhancements
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Resources\PatientResource\Pages;
|
||||
|
||||
use App\Filament\Resources\PatientResource;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
use Filament\Support\Enums\Width;
|
||||
|
||||
class ViewPatient extends ViewRecord
|
||||
{
|
||||
protected static string $resource = PatientResource::class;
|
||||
|
||||
protected Width|string|null $maxContentWidth = Width::SevenExtraLarge;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('printPrescription')
|
||||
->label(__('prescriptions.actions.print_prescription'))
|
||||
->icon('heroicon-o-printer')
|
||||
->color('info')
|
||||
->visible(fn () => $this->getRecord()->prescriptions()->exists())
|
||||
->url(fn () => route('prescription.print', $this->getRecord()->prescriptions()->latest()->first()))
|
||||
->openUrlInNewTab(),
|
||||
|
||||
Action::make('printAdmission')
|
||||
->label(__('prescriptions.actions.print_admission'))
|
||||
->icon('heroicon-o-printer')
|
||||
->color('warning')
|
||||
->visible(fn () => $this->getRecord()->surgeryAppointment !== null)
|
||||
->url(fn () => route('surgery-appointment.print.admission', $this->getRecord()))
|
||||
->openUrlInNewTab(),
|
||||
|
||||
Action::make('printLab')
|
||||
->label(__('prescriptions.actions.print_lab'))
|
||||
->icon('heroicon-o-beaker')
|
||||
->color('gray')
|
||||
->url(fn () => route('patient.print.lab', $this->getRecord()))
|
||||
->openUrlInNewTab(),
|
||||
|
||||
Action::make('edit')
|
||||
->label(__('filament-actions::edit.single.label'))
|
||||
->icon('heroicon-o-pencil-square')
|
||||
->color('primary')
|
||||
->url(fn () => PatientResource::getUrl('edit', ['record' => $this->getRecord()])),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
use App\Filament\Resources\PatientResource\Pages\CreatePatient;
|
||||
use App\Filament\Resources\PatientResource\Pages\EditPatient;
|
||||
use App\Filament\Resources\PatientResource\Pages\ViewPatient;
|
||||
use App\Models\Doctor;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\Treatment;
|
||||
@@ -32,7 +33,7 @@ class VisitsRelationManager extends RelationManager
|
||||
|
||||
public static function canViewForRecord(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): bool
|
||||
{
|
||||
return in_array($pageClass, [CreatePatient::class, EditPatient::class]);
|
||||
return in_array($pageClass, [CreatePatient::class, EditPatient::class, ViewPatient::class]);
|
||||
}
|
||||
|
||||
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
|
||||
@@ -136,6 +137,18 @@ public function form(Schema $schema): Schema
|
||||
]);
|
||||
}
|
||||
|
||||
private static function jalaliDate(?string $date): string
|
||||
{
|
||||
if (! $date) {
|
||||
return '-';
|
||||
}
|
||||
try {
|
||||
return \Morilog\Jalali\Jalalian::fromCarbon(\Carbon\Carbon::parse($date))->format('Y/m/d');
|
||||
} catch (\Exception $e) {
|
||||
return $date;
|
||||
}
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
@@ -219,8 +232,10 @@ public function table(Table $table): Table
|
||||
->recordActions([
|
||||
EditAction::make()
|
||||
->slideOver()
|
||||
->modalWidth('4xl'),
|
||||
DeleteAction::make(),
|
||||
->modalWidth('4xl')
|
||||
->modalHeading(fn () => __('filament-actions::edit.single.modal.heading', ['label' => $this->getOwnerRecord()->full_name])),
|
||||
DeleteAction::make()
|
||||
->modalHeading(fn () => __('filament-actions::delete.single.modal.heading', ['label' => $this->getOwnerRecord()->full_name])),
|
||||
])
|
||||
->toolbarActions([]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user