@extends('admin.layouts.master') @section('title', 'خطة علاج رقم '.$plan->id) @section('content')
خطة علاج للمريض: {{ $plan->patient?->first_name }} {{ $plan->patient?->last_name }}
رجوع لملف المريض
@csrf @method('DELETE')
@if($errors->any())
من فضلك صحح الأخطاء التالية:
@endif @php $total = 0; foreach ($plan->items as $it) { $line = ($it->price - $it->discount) * $it->quantity; $total += max($line, 0); } @endphp
بيانات خطة العلاج

المريض: {{ $plan->patient?->first_name }} {{ $plan->patient?->last_name }}
كود: {{ $plan->patient?->code ?? '-' }}

الطبيب: {{ $plan->doctor?->user?->name ?? '-' }}

السن: @if($plan->patient?->birth_date) {{ \Carbon\Carbon::parse($plan->patient->birth_date)->age }} سنة @else — @endif

العنوان: {{ $plan->title ?: '-' }}

الحالة:

@csrf @method('PATCH')

إجمالي تقديري: {{ number_format($total, 2) }} ريال

ملاحظات الخطة:
{{ $plan->description ?: '-' }}

{{-- بنود الخطة + إضافة بند جديد --}}
بنود خطة العلاج
@csrf
@php $subtotal = 0; $totalDiscount = 0; $grandTotal = 0; foreach ($plan->items as $item) { $lineBase = $item->price * $item->quantity; $discountAmount = $item->discount ?? 0; if ($discountAmount > $lineBase) { $discountAmount = $lineBase; } $lineTotal = $lineBase - $discountAmount; $subtotal += $lineBase; $totalDiscount += $discountAmount; $grandTotal += $lineTotal; } @endphp {{-- جدول البنود --}}
@forelse($plan->items as $item) @php $lineBase = $item->price * $item->quantity; $discountAmount = $item->discount ?? 0; if ($discountAmount > $lineBase) { $discountAmount = $lineBase; } $lineTotal = $lineBase - $discountAmount; $st = $item->status; $b = match($st) { 'planned' => 'secondary', 'in_progress' => 'warning', 'done' => 'success', 'cancelled' => 'danger', default => 'secondary', }; @endphp @empty @endforelse
# الخدمة السن / السطح العدد السعر الخصم الإجمالي الحالة الزيارة إجراءات
{{ $item->id }} @if($item->service) {{ $item->service->name }} @else @endif @if($item->notes)
{{ $item->notes }} @endif
{{ $item->tooth_number ?: '-' }}
{{ $item->surface ?: '' }}
{{ $item->quantity }} {{ number_format($item->price, 2) }} {{ number_format($discountAmount, 2) }} {{ number_format($lineTotal, 2) }}
@csrf @method('PATCH')
@if($item->visit) زيارة رقم {{ $item->visit->id }}
{{ $item->visit->visit_date ?? '' }} @else — @endif
@csrf @method('DELETE')
لا توجد بنود مضافة لهذه الخطة بعد.
الإجمالي قبل الخصم {{ number_format($subtotal, 2) }}
إجمالي الخصومات {{ number_format($totalDiscount, 2) }}
الإجمالي النهائي {{ number_format($grandTotal, 2) }}
@endsection @section('js') @endsection