feat: initial project setup with Laravel 12 and Filament v4
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Patient;
|
||||
use App\Models\Prescription;
|
||||
use Illuminate\Http\Request;
|
||||
use Morilog\Jalali\Jalalian;
|
||||
|
||||
class PrescriptionPrintController extends Controller
|
||||
{
|
||||
public function print(Request $request, Prescription $prescription)
|
||||
{
|
||||
$prescription->load('patientRecord');
|
||||
$type = $request->query('type', 'prescription');
|
||||
|
||||
return view('prints.prescription', [
|
||||
'prescription' => $prescription,
|
||||
'type' => $type,
|
||||
]);
|
||||
}
|
||||
|
||||
public function printAdmission(Prescription $prescription)
|
||||
{
|
||||
$prescription->load('patientRecord');
|
||||
|
||||
return view('prints.prescription-admission', [
|
||||
'prescription' => $prescription,
|
||||
]);
|
||||
}
|
||||
|
||||
public function printPatientLab(Patient $patient)
|
||||
{
|
||||
return view('prints.patient-lab', [
|
||||
'patient' => $patient,
|
||||
'issueDate' => Jalalian::now()->format('Y/m/d'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function printSurgeryAdmission(Patient $patient)
|
||||
{
|
||||
$appointment = $patient->surgeryAppointment?->load('surgeryCenter');
|
||||
|
||||
$surgeryDate = '';
|
||||
$centerName = '';
|
||||
|
||||
if ($appointment) {
|
||||
try {
|
||||
$surgeryDate = Jalalian::fromCarbon($appointment->surgery_date)->format('Y/m/d');
|
||||
} catch (\Throwable) {
|
||||
$surgeryDate = $appointment->surgery_date?->format('Y-m-d') ?? '';
|
||||
}
|
||||
$centerName = $appointment->surgeryCenter?->name ?? '';
|
||||
}
|
||||
|
||||
return view('prints.surgery-admission', [
|
||||
'patient' => $patient,
|
||||
'surgeryDate' => $surgeryDate,
|
||||
'centerName' => $centerName,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user