feat: initial project setup with Laravel 12 and Filament v4

This commit is contained in:
SajjadMahmoody
2026-04-03 17:25:17 +03:30
parent eca5d74b36
commit 09ee1cb743
324 changed files with 78304 additions and 23 deletions
@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\PrescriptionResource\Pages;
use App\Filament\Resources\PrescriptionResource;
use Filament\Resources\Pages\CreateRecord;
use Filament\Support\Enums\Width;
class CreatePrescription extends CreateRecord
{
protected static string $resource = PrescriptionResource::class;
protected Width|string|null $maxContentWidth = Width::SevenExtraLarge;
public string $printType = '';
protected function mutateFormDataBeforeCreate(array $data): array
{
$data['doctor'] = auth()->user()?->name;
$data['issue_datetime'] = now();
return $data;
}
protected function getFormActions(): array
{
return [];
}
protected function getRedirectUrl(): string
{
$record = $this->getRecord();
if ($this->printType === 'prescription') {
return route('prescription.print', $record);
}
if ($this->printType === 'lab') {
return route('prescription.print', ['prescription' => $record, 'type' => 'lab']);
}
if ($this->printType === 'admission') {
return route('prescription.print.admission', $record);
}
return static::getResource()::getUrl('index');
}
}
@@ -0,0 +1,59 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\PrescriptionResource\Pages;
use App\Filament\Resources\PrescriptionResource;
use Filament\Actions\Action;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
use Filament\Support\Enums\Width;
class EditPrescription extends EditRecord
{
protected static string $resource = PrescriptionResource::class;
protected Width|string|null $maxContentWidth = Width::SevenExtraLarge;
protected function mutateFormDataBeforeSave(array $data): array
{
$data['doctor'] = auth()->user()?->name;
$data['issue_datetime'] = now();
return $data;
}
protected function getHeaderActions(): array
{
return [
Action::make('printPrescription')
->label(__('prescriptions.actions.print_prescription'))
->icon('heroicon-o-printer')
->color('info')
->url(fn () => route('prescription.print', $this->getRecord()))
->openUrlInNewTab(),
Action::make('printAdmission')
->label(__('prescriptions.actions.print_admission'))
->icon('heroicon-o-printer')
->color('warning')
->visible(fn () => $this->getRecord()->patientRecord?->surgeryAppointment !== null)
->url(fn () => route('prescription.print.admission', $this->getRecord()))
->openUrlInNewTab(),
Action::make('printLab')
->label(__('prescriptions.actions.print_lab'))
->icon('heroicon-o-beaker')
->color('gray')
->url(fn () => route('prescription.print', ['prescription' => $this->getRecord(), 'type' => 'lab']))
->openUrlInNewTab(),
DeleteAction::make(),
];
}
protected function getFormActions(): array
{
return [];
}
}
@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\PrescriptionResource\Pages;
use App\Filament\Resources\PrescriptionResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListPrescriptions extends ListRecords
{
protected static string $resource = PrescriptionResource::class;
protected function getHeaderActions(): array
{
return [
CreateAction::make()
->icon('heroicon-o-plus'),
];
}
}