Treatment:
{{ $treatment->name }}
Plan:
{{ $plan->name }}
Duration:
{{ $plan->duration_months }} {{ Str::plural('month', $plan->duration_months) }}
@php
$hasDiscount = (Session::get('uc_plan')['hasInsurance'] === 'yes' && $plan->discounts->isNotEmpty()) || Session::has('stack_discount');
$originalPrice = $plan->price;
@endphp
@if($hasDiscount)
Original Price:
${{ number_format($originalPrice, 2) }}
@if(Session::get('uc_plan')['hasInsurance'] === 'yes' && $plan->discounts->isNotEmpty())
Insurance Discount:
@php
$insuranceDiscount = $plan->discounts->first();
$insuranceDiscountAmount = 0;
if ($insuranceDiscount->type === 'percentage') {
$insuranceDiscountAmount = $originalPrice * ($insuranceDiscount->value / 100);
$discountDisplay = $insuranceDiscount->value . '%';
} else {
$insuranceDiscountAmount = $insuranceDiscount->value;
$discountDisplay = '$' . number_format($insuranceDiscount->value, 2);
}
@endphp
-{{ $discountDisplay }}
@endif
@if(Session::has('stack_discount') && Session::has('extrahelp_discount_id'))
@php
$extraHelpDiscount = \App\Models\Discount::find(Session::get('extrahelp_discount_id'));
$remainingPrice = $originalPrice;
// Apply insurance discount first if applicable
if(Session::get('uc_plan')['hasInsurance'] === 'yes' && $plan->discounts->isNotEmpty()) {
$insuranceDiscount = $plan->discounts->first();
if ($insuranceDiscount->type === 'percentage') {
$remainingPrice = $remainingPrice * (1 - ($insuranceDiscount->value / 100));
} else {
$remainingPrice = $remainingPrice - $insuranceDiscount->value;
}
$remainingPrice = max(0, $remainingPrice);
}
// Calculate ExtraHelp discount
$extraHelpDiscountAmount = 0;
if ($extraHelpDiscount && $extraHelpDiscount->status === 'active') {
if ($extraHelpDiscount->type === 'percentage') {
$extraHelpDiscountAmount = $remainingPrice * ($extraHelpDiscount->value / 100);
$extraHelpDisplay = $extraHelpDiscount->value . '%';
} else {
$extraHelpDiscountAmount = min($extraHelpDiscount->value, $remainingPrice);
$extraHelpDisplay = '$' . number_format($extraHelpDiscount->value, 2);
}
}
@endphp
ExtraHelp Discount:
-{{ $extraHelpDisplay }}
Total Discount:
-${{ number_format(($insuranceDiscountAmount ?? 0) + $extraHelpDiscountAmount, 2) }}
@endif
@endif
Total:
@php
$finalAmount = $plan->price;
$totalDiscount = 0;
// Apply insurance discount if applicable
if(Session::get('uc_plan')['hasInsurance'] === 'yes' && $plan->discounts->isNotEmpty()) {
$insuranceDiscount = $plan->discounts->first();
if ($insuranceDiscount->type === 'percentage') {
$insuranceDiscountAmount = $finalAmount * ($insuranceDiscount->value / 100);
} else {
$insuranceDiscountAmount = $insuranceDiscount->value;
}
$totalDiscount += $insuranceDiscountAmount;
}
// Apply ExtraHelp discount if applicable
if(Session::has('stack_discount') && Session::has('extrahelp_discount_id')) {
$extraHelpDiscount = \App\Models\Discount::find(Session::get('extrahelp_discount_id'));
if ($extraHelpDiscount && $extraHelpDiscount->status === 'active') {
$remainingPrice = $finalAmount - $totalDiscount;
if ($extraHelpDiscount->type === 'percentage') {
$extraHelpDiscountAmount = $remainingPrice * ($extraHelpDiscount->value / 100);
} else {
$extraHelpDiscountAmount = min($extraHelpDiscount->value, $remainingPrice);
}
$totalDiscount += $extraHelpDiscountAmount;
}
}
// Calculate final amount
$finalAmount = $finalAmount - $totalDiscount;
$finalAmount = max(0, $finalAmount);
@endphp
${{ number_format($finalAmount, 2) }}
By completing your purchase, you agree to our Terms of Service and acknowledge that your subscription will automatically renew unless canceled.