Initial commit - Physiotherapy Clinic Management System

This commit is contained in:
Deploy committed 2026-03-10 00:38:51 +03:00
commit dbb326f2cc
300 files changed
+144285

No files matched your search

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class AppointmentResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'patient' => [
'id' => $this->patient->id,
'name' => $this->patient->fullName(),
'phone' => $this->patient->phone,
],
'therapist' => [
'id' => $this->user->id,
'name' => $this->user->name,
],
'appointment_date' => $this->appointment_date->format('Y-m-d'),
'appointment_time' => $this->appointment_date->format('H:i'),
'duration_minutes' => $this->duration_minutes,
'end_time' => $this->appointment_date->copy()->addMinutes($this->duration_minutes)->format('H:i'),
'status' => $this->status,
'notes' => $this->notes,
'created_at' => $this->created_at?->format('Y-m-d H:i:s'),
];
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class CurrencyResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'code' => $this->code,
'name' => $this->name,
'symbol' => $this->symbol,
'decimal_places' => $this->decimal_places,
'exchange_rate_to_base' => $this->exchange_rate_to_base,
'is_base' => $this->is_base,
'is_active' => $this->is_active,
];
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class InvoiceResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'invoice_number' => $this->invoice_number,
'patient' => [
'id' => $this->patient->id,
'name' => $this->patient->fullName(),
],
'invoice_date' => $this->invoice_date->format('Y-m-d'),
'due_date' => $this->due_date->format('Y-m-d'),
'subtotal' => $this->subtotal,
'tax_amount' => $this->tax_amount,
'discount_amount' => $this->discount_amount,
'total_amount' => $this->total_amount,
'paid_amount' => $this->paid_amount,
'balance' => $this->balance,
'status' => $this->status,
'currency' => new CurrencyResource($this->currency),
'notes' => $this->notes,
'created_at' => $this->created_at?->format('Y-m-d H:i:s'),
];
}
}
@@ -0,0 +1,33 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class LedgerEntryResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'entry_date' => $this->entry_date->format('Y-m-d'),
'account' => [
'id' => $this->chartOfAccount->id,
'code' => $this->chartOfAccount->code,
'name' => $this->chartOfAccount->name,
'type' => $this->chartOfAccount->type,
],
'currency' => new CurrencyResource($this->currency),
'amount' => $this->amount,
'description' => $this->description,
'source_type' => $this->source_type,
'source_id' => $this->source_id,
'created_by' => [
'id' => $this->creator->id,
'name' => $this->creator->name,
],
'created_at' => $this->created_at?->format('Y-m-d H:i:s'),
];
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PackageResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'name' => $this->name,
'number_of_sessions' => $this->number_of_sessions,
'price' => $this->price,
'currency' => new CurrencyResource($this->currency),
'validity_days' => $this->validity_days,
'description' => $this->description,
'is_active' => $this->is_active,
'created_at' => $this->created_at?->format('Y-m-d H:i:s'),
];
}
}
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PatientPackageResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'patient_id' => $this->patient_id,
'package' => new PackageResource($this->package),
'total_sessions' => $this->total_sessions,
'remaining_sessions' => $this->remaining_sessions,
'used_sessions' => $this->total_sessions - $this->remaining_sessions,
'start_date' => $this->start_date->format('Y-m-d'),
'end_date' => $this->end_date->format('Y-m-d'),
'status' => $this->status,
'created_at' => $this->created_at?->format('Y-m-d H:i:s'),
];
}
}
@@ -0,0 +1,36 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PatientProfileResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'patient_code' => $this->patient_code,
'full_name' => $this->fullName(),
'email' => $this->email,
'phone' => $this->phone,
'whatsapp' => $this->whatsapp,
'status' => $this->status,
'upcoming_appointments' => AppointmentResource::collection(
$this->appointments()->where('appointment_date', '>=', now())->orderBy('appointment_date')->limit(5)->get()
),
'past_appointments' => AppointmentResource::collection(
$this->appointments()->where('appointment_date', '<', now())->orderByDesc('appointment_date')->limit(5)->get()
),
'invoices' => InvoiceResource::collection($this->invoices()->orderByDesc('invoice_date')->limit(10)->get()),
'payments' => PaymentResource::collection(
Payment::whereIn('invoice_id', $this->invoices->pluck('id'))->orderByDesc('payment_date')->limit(10)->get()
),
'balance' => $this->invoices->sum('balance'),
'active_packages' => PatientPackageResource::collection(
$this->packages()->where('status', 'active')->get()
),
];
}
}
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PatientResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'patient_code' => $this->patient_code,
'first_name' => $this->first_name,
'last_name' => $this->last_name,
'full_name' => $this->fullName(),
'email' => $this->email,
'phone' => $this->phone,
'whatsapp' => $this->whatsapp,
'national_id' => $this->national_id,
'date_of_birth' => $this->date_of_birth?->format('Y-m-d'),
'gender' => $this->gender,
'address' => $this->address,
'referral_source' => $this->referral_source,
'status' => $this->status,
'emergency_contact' => [
'name' => $this->emergency_contact_name,
'phone' => $this->emergency_contact_phone,
],
'medical_history' => $this->medical_history,
'allergies' => $this->allergies,
'notes' => $this->notes,
'created_at' => $this->created_at?->format('Y-m-d H:i:s'),
'updated_at' => $this->updated_at?->format('Y-m-d H:i:s'),
];
}
}
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PaymentResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'payment_number' => $this->payment_number,
'invoice' => [
'id' => $this->invoice->id,
'number' => $this->invoice->invoice_number,
],
'patient' => [
'id' => $this->invoice->patient->id,
'name' => $this->invoice->patient->fullName(),
],
'payment_date' => $this->payment_date->format('Y-m-d'),
'amount' => $this->amount,
'payment_method' => $this->payment_method,
'reference_number' => $this->reference_number,
'notes' => $this->notes,
'received_by' => [
'id' => $this->receivedBy->id,
'name' => $this->receivedBy->name,
],
'created_at' => $this->created_at?->format('Y-m-d H:i:s'),
];
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class ReminderResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'appointment_id' => $this->appointment_id,
'patient' => [
'id' => $this->appointment->patient->id,
'name' => $this->appointment->patient->fullName(),
],
'channel' => $this->channel,
'content' => $this->content,
'send_at' => $this->send_at?->format('Y-m-d H:i:s'),
'sent_at' => $this->sent_at?->format('Y-m-d H:i:s'),
'status' => $this->status,
'error_message' => $this->error_message,
'response' => $this->response,
'created_at' => $this->created_at?->format('Y-m-d H:i:s'),
];
}
}
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class TherapistResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'name' => $this->name,
'email' => $this->email,
'role' => $this->role,
'specialization' => $this->specialization,
'hourly_rate' => $this->hourly_rate,
'session_rate' => $this->session_rate,
'target_sessions_per_day' => $this->target_sessions_per_day,
'target_sessions_per_month' => $this->target_sessions_per_month,
'working_schedule' => $this->working_schedule,
'created_at' => $this->created_at?->format('Y-m-d H:i:s'),
];
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class WageResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'therapist' => [
'id' => $this->user->id,
'name' => $this->user->name,
],
'period_start' => $this->period_start->format('Y-m-d'),
'period_end' => $this->period_end->format('Y-m-d'),
'sessions_count' => $this->sessions_count,
'hours_worked' => $this->hours_worked,
'base_amount' => $this->base_amount,
'bonus' => $this->bonus,
'deductions' => $this->deductions,
'total_amount' => $this->total_amount,
'currency' => new CurrencyResource($this->currency),
'status' => $this->status,
'notes' => $this->notes,
'created_at' => $this->created_at?->format('Y-m-d H:i:s'),
];
}
}