@extends('frontend::layouts.master') @section('title', __('frontend.appointment_detail')) @section('content') @include('frontend::components.section.breadcrumb')
{{ __('frontend.appointment_detail') }}
@php $id = $appointment ? $appointment->id : 0; $status = $appointment ? $appointment->status : null; $pay_status = $appointment ? optional($appointment->appointmenttransaction)->payment_status : 0; @endphp @if ($pay_status == 1 && $status == 'checkout') @endif
@if(empty($appointment->serviceRating) && $appointment->status == 'checkout' && optional($appointment->appointmenttransaction)->payment_status)
{{ __('frontend.havent_rated') }}
@endif
{{ __('frontend.appointment_id') }}
#{{ $appointment->id }}
{{ __('frontend.booking_detail') }}
{{ __('frontend.appointment_date_time') }}

{{ DateFormate($appointment->appointment_date) }} at {{ \Carbon\Carbon::parse($appointment->appointment_time)->format(setting('time_formate') ?? 'h:i A') }}

{{ __('frontend.doctor') }} @if ($appointment->doctor === null)
-
@else
avatar
{{getDisplayName($appointment->doctor)}}
@php $doctorEmail = optional($appointment->doctor)->email; @endphp @if ($doctorEmail) {{ $doctorEmail }} @else - @endif
@endif
{{ __('frontend.clinic_name') }}
avatar {{ $appointment->cliniccenter ? optional($appointment->cliniccenter)->name : '-' }}
{{ __('frontend.booking_status') }}
{{ $appointment->status === 'checkout' ? 'Complete' : \Illuminate\Support\Str::title(str_replace('_', ' ', $appointment->status)) }}
{{ __('frontend.payment_status') }}
@if($appointment->appointmenttransaction && $appointment->appointmenttransaction->payment_status) @if($appointment->status == 'cancelled') @if($appointment->advance_paid_amount > 0) {{ __('frontend.advance_refunded') }} @else {{ __('frontend.payment_refunded') }} @endif @else @if($appointment->appointmenttransaction->payment_method == 'cash') {{ __('frontend.pending') }} @else {{ __('frontend.paid') }} @endif @endif @elseif($advancePaid) @if($appointment->status == 'cancelled') {{ __('frontend.advance_refunded') }} @else {{ __('frontend.advance_paid') }} @endif @else {{ __('frontend.pending') }} @endif
{{ __('frontend.booked_for') }}
@if ($appointment->user === null)
-
@elseif($appointment->otherPatient)
avatar
{{ optional($appointment->otherPatient)->first_name . ' ' . optional($appointment->otherPatient)->last_name ?? '-' }}
@else
avatar
{{ optional($appointment->user)->first_name . ' ' . optional($appointment->user)->last_name ?? '-' }}
@php $userEmail = optional($appointment->user)->email; @endphp @if ($userEmail) {{ $userEmail }} @else - @endif
@endif
{{ __('frontend.service_detail') }}
@if ($appointment->patientEncounter == null)
avatar
{{ optional($appointment->clinicservice)->name ?? '-' }} {{ optional($appointment->clinicservice)->description ?? ' ' }}
@php if ( optional($appointment->appointmenttransaction)->discount_type === 'percentage' ) { $payable_Amount = $appointment->service_price - $appointment->service_price * (optional($appointment->appointmenttransaction)->discount_value / 100); } else { $payable_Amount = $appointment->service_price - optional($appointment->appointmenttransaction)->discount_value; } $total_tax = 0; $sub_total = $payable_Amount + $appointment->appointmenttransaction->inclusive_tax_price; $inclusive_tax_data = json_decode($appointment->appointmenttransaction->inclusive_tax, true); // decode tax details @endphp @if (optional($appointment->appointmenttransaction)->discount_value > 0)
{{ Currency::format($sub_total) }} @if (optional($appointment->appointmenttransaction)->discount_type === 'percentage') ({{ optional($appointment->appointmenttransaction)->discount_value ?? '--' }}% off) @else ({{ Currency::format(optional($appointment->appointmenttransaction)->discount_value) ?? '--' }} off) @endif
{{ Currency::format($appointment->service_price) }}
{{-- @if($appointment->appointmenttransaction->inclusive_tax_price != null && $appointment->patientEncounter == null) @php $total_tax = 0; $sub_total = $payable_Amount + $appointment->appointmenttransaction->inclusive_tax_price; $inclusive_tax_data = json_decode($appointment->appointmenttransaction->inclusive_tax, true); // decode tax details @endphp
  • {{ __('appointment.service_price') }} {{ Currency::format($payable_Amount) }}
  • @if(!empty($inclusive_tax_data)) @foreach ($inclusive_tax_data as $t) @if ($t['type'] == 'percent') @php $tax_amount = $payable_Amount * $t['value'] / 100 ; // for inclusive, this is reverse calculated $total_tax += $tax_amount; @endphp
  • {{ $t['title'] }} ({{ $t['value'] }}%) {{ Currency::format($tax_amount) }}
  • @elseif($t['type'] == 'fixed') @php $tax_amount = $t['value']; $total_tax += $tax_amount; @endphp
  • {{ $t['title'] }} {{ Currency::format($tax_amount) }}
  • @endif @endforeach
  • {{ __('messages.sub_total') }} {{ Currency::format($sub_total) }}
  • @endif @endif --}} @else
    {{ Currency::format($appointment->service_amount) }}
    @endif @if($appointment->appointmenttransaction->inclusive_tax_price != null && $appointment->patientEncounter == null) {{ __('messages.lbl_with_inclusive_tax') }} @endif
    @endif @if ( $appointment->patientEncounter !== null && optional(optional($appointment->patientEncounter)->billingrecord)->billingItem != null) @foreach (optional(optional($appointment->patientEncounter)->billingrecord)->billingItem as $billingItem)
    avatar
    {{ optional($billingItem->clinicservice)->name }} {{ optional($billingItem->clinicservice)->description ?? ' ' }}
    @php if ($billingItem->discount_type === 'percentage') { $payable_Amount = $billingItem->service_amount - $billingItem->service_amount * ($billingItem->discount_value / 100); } else { $payable_Amount = $billingItem->service_amount - $billingItem->discount_value; } @endphp @if ($billingItem->discount_value > 0)
    {{ Currency::format($billingItem->total_amount) }} * {{ $billingItem->quantity }} = {{ Currency::format($billingItem->total_amount * $billingItem->quantity) }} @if ($billingItem->discount_type === 'percentage') ({{ $billingItem->discount_value ?? '--' }}% off) @else ({{ Currency::format($billingItem->discount_value) ?? '--' }} off) @endif @if($billingItem->inclusive_tax_amount > 0) {{ __('messages.lbl_with_inclusive_tax') }} @endif
    {{ Currency::format($billingItem->service_amount * $billingItem->quantity) }}
    @else
    {{ Currency::format($billingItem->total_amount) }} * {{ $billingItem->quantity }} = {{ Currency::format($billingItem->total_amount * $billingItem->quantity) }} @if($billingItem->inclusive_tax_amount > 0) {{ __('messages.lbl_with_inclusive_tax') }}
    @endif @endif {{-- @if (!empty($billingItem->clinicservice->inclusive_tax_price)) @php $quantity = $billingItem->quantity; $inclusive_tax_price_per_unit = $billingItem->clinicservice->inclusive_tax_price; $inclusive_tax_price = $inclusive_tax_price_per_unit * $quantity; $inclusive_tax_data = json_decode($billingItem->clinicservice->inclusive_tax, true); $service_total = $payable_Amount * $quantity; $item_subtotal = ($payable_Amount + $inclusive_tax_price_per_unit) * $quantity; $total_item_tax = 0; @endphp
    • {{ __('appointment.service_price') }} {{ Currency::format($service_total) }}
    • @if (!empty($inclusive_tax_data)) @foreach ($inclusive_tax_data as $t) @if ($t['type'] == 'percent') @php $tax_per_unit = $payable_Amount * $t['value'] / 100 ; $tax_total = $tax_per_unit * $quantity; $total_item_tax += $tax_total; @endphp
    • {{ $t['title'] }} ({{ $t['value'] }}% of {{ Currency::format($payable_Amount) }} × {{ $quantity }}) {{ Currency::format($tax_total) }}
    • @elseif ($t['type'] == 'fixed') @php $tax_total = $t['value'] * $quantity; $total_item_tax += $tax_total; @endphp
    • {{ $t['title'] }} ({{ Currency::format($t['value']) }} × {{ $quantity }}) {{ Currency::format($tax_total) }}
    • @endif @endforeach
    • {{ __('appointment.sub_total') }} {{ Currency::format($item_subtotal) }}
    • @endif
    @endif --}}
    @endforeach @endif
    @if ($appointment->status == 'checkout' || $appointment->status == 'check_in')
    {{ __('frontend.encounter_details') }}
    View
    @endif @if($review)
    {{ __('frontend.your_review') }}
    • {{ $review->rating }}
      {{ $review->title }}
      {{ optional($review->clinic_service)->name }}
      user
      By {{ optional($review->user)->gender == 'female' ? 'Miss.' : 'Mr.' }} {{ optional($review->user)->first_name.' '.optional($review->user)->last_name }}
      {{ $review->updated_at->diffForHumans() }}

      {{ $review->review_msg }}

    @endif
    @php $service_total_amount = 0; // Initialize outside the loop $total_tax = 0; @endphp @if ($appointment->patientEncounter !== null) @foreach (optional(optional($appointment->patientEncounter)->billingrecord)->billingItem as $item) @php $quantity = $item->quantity ?? 1; $service_total_amount += $item->total_amount; // Sum up service amounts if($quantity > 1) { if (isset($item->inclusive_tax_amount) && $item->inclusive_tax_amount > 0) { $service_total_amount += $item->inclusive_tax_amount * $quantity; } if (!empty($item->discount_type)) { if ($item->discount_type === 'fixed') { $service_total_amount -= $item->discount_value * $quantity; } elseif ($item->discount_type === 'percentage') { $service_total_amount -= ($item->total_amount * $item->discount_value / 100); } } } @endphp @endforeach @endif