@include('Admin.Includes.header')
@if (session('success')) @endif @if ($errors->any())
@endif

Quote/Order Details

Back to List @php $isEditable = !($quote->deposit_payment_status === 'succeeded' || $quote->quote_type === 'order'); @endphp @if($isEditable) Edit Quote @endif
Quote/Order Information
Quote Number: {{ $quote->quote_number ?? 'N/A' }}
Order Number: {{ $quote->order_number ?? 'N/A' }}
Quote Type: @php $typeColors = [ 'quote' => 'primary', 'estimate' => 'info', 'order' => 'success', ]; $typeColor = $typeColors[$quote->quote_type] ?? 'secondary'; @endphp {{ ucfirst($quote->quote_type) }}
Status: @php $statusColors = [ 'pending' => 'warning', 'approved' => 'success', 'rejected' => 'danger', ]; $statusColor = $statusColors[$quote->status] ?? 'secondary'; @endphp {{ ucfirst($quote->status) }}
Created At: {{ $quote->created_at->format('M d, Y H:i:s') }}
@php $jobType = $quote->job_type ?? ($quote->raw_data['job_type'] ?? null); $jobTypeColors = [ 'local_job' => 'primary', 'interstate_job' => 'info', ]; $jobTypeColor = $jobTypeColors[$jobType] ?? 'secondary'; @endphp @if($jobType) @endif @php $calloutFee = $quote->callout_fee ?? ($quote->raw_data['callout_fee'] ?? 0); $extraMovers = $quote->extra_movers ?? ($quote->raw_data['extra_movers'] ?? 0); $extraMoversCost = $quote->extra_movers_cost ?? ($quote->raw_data['extra_movers_cost'] ?? 0); $assembleDisassembleCost = $quote->raw_data['breakdown']['assemble_disassemble_cost'] ?? ($quote->raw_data['assemble_disassemble_cost'] ?? 0); $storageItemsCost = $quote->raw_data['breakdown']['storage_items_cost'] ?? ($quote->raw_data['storage_items_cost'] ?? 0); @endphp @if(($jobType === 'local_job' || $jobType === 'interstate_job') && $calloutFee > 0) @endif @if($extraMovers > 0) @endif
Total Cost: ${{ number_format($quote->total_cost, 2) }}
Job Type: {{ ucfirst(str_replace('_', ' ', $jobType)) }}
Movers Cost: ${{ number_format($quote->movers_cost, 2) }}
Callout Fee: ${{ number_format($calloutFee, 2) }}
Extra Movers: {{ $extraMovers }} movers (included in Movers Cost)
Assemble/Disassemble: ${{ number_format($assembleDisassembleCost, 2) }}
Storage Items: ${{ number_format($storageItemsCost, 2) }}
@if ($quote->deposit_amount || $quote->remaining_amount)
Payment Information
Deposit Amount: ${{ number_format($quote->deposit_amount ?? 0, 2) }} {{ $quote->deposit_payment_status ? ucfirst($quote->deposit_payment_status) : 'Pending' }}
Remaining Amount: ${{ number_format($quote->remaining_amount ?? 0, 2) }} {{ $quote->remaining_payment_status ? ucfirst($quote->remaining_payment_status) : 'Pending' }}
@endif
Apply Discount
@php $willApplyOnRemaining = ($quote->deposit_payment_status === 'succeeded' && $quote->remaining_amount > 0); @endphp @if($willApplyOnRemaining)
Note: Discount will be applied on the Remaining Amount (after deposit payment), not the total cost.
@endif
@csrf
@php $discountAppliesOnRemaining = ($quote->deposit_payment_status === 'succeeded' && $quote->remaining_amount > 0); // Use original remaining amount if available, otherwise use current remaining amount $originalRemaining = $quote->raw_data['original_remaining_amount'] ?? null; $originalTotal = $quote->raw_data['original_total_cost'] ?? null; if ($discountAppliesOnRemaining) { // For remaining: use original remaining if available, otherwise calculate from original total or use current if ($originalRemaining !== null) { $maxFixedAmount = $originalRemaining; } elseif ($originalTotal !== null) { $maxFixedAmount = $originalTotal - ($quote->deposit_amount ?? 0); } else { $maxFixedAmount = $quote->remaining_amount; } } else { // For total: use original total if available, otherwise use current total $maxFixedAmount = $originalTotal ?? $quote->total_cost; } @endphp raw_data['discount_type']) || $quote->raw_data['discount_type'] === 'percentage') max="100" @else max="{{ $maxFixedAmount }}" @endif data-max-percentage="100" data-max-fixed="{{ $maxFixedAmount }}" data-original-total="{{ $originalTotal ?? $quote->total_cost }}" data-original-remaining="{{ $originalRemaining ?? ($discountAppliesOnRemaining ? ($quote->remaining_amount ?? 0) : 0) }}" data-deposit-amount="{{ $quote->deposit_amount ?? 0 }}" required> {{-- @if(isset($quote->raw_data['discount_type']) && $quote->raw_data['discount_type'] === 'fixed') Enter discount amount in dollars @else Enter discount percentage (0-100) @endif --}}
@php $discountOnRemaining = ($quote->deposit_payment_status === 'succeeded' && $quote->remaining_amount > 0); if ($discountOnRemaining) { // Show original remaining amount $originalAmount = $quote->raw_data['original_remaining_amount'] ?? $quote->remaining_amount; $label = 'Original Remaining:'; } else { // Show original total cost $originalAmount = $quote->raw_data['original_total_cost'] ?? $quote->total_cost; $label = 'Original Total:'; } @endphp
{{ $label }} ${{ number_format($originalAmount, 2) }}
@if(isset($quote->raw_data['discount']) || (isset($quote->raw_data['breakdown']['discount_amount']) && $quote->raw_data['breakdown']['discount_amount'] > 0))
@php $currentDiscount = $quote->raw_data['discount'] ?? 0; $discountType = $quote->raw_data['discount_type'] ?? 'percentage'; $discountAmount = $quote->raw_data['breakdown']['discount_amount'] ?? 0; $discountOnRemaining = isset($quote->raw_data['breakdown']['discount_on_remaining']) && $quote->raw_data['breakdown']['discount_on_remaining']; if($discountAmount == 0 && $currentDiscount > 0) { // Calculate discount amount if not in breakdown if($discountOnRemaining) { $originalAmount = $quote->raw_data['original_remaining_amount'] ?? $quote->remaining_amount; } else { $originalAmount = $quote->raw_data['original_total_cost'] ?? $quote->total_cost; } if($discountType === 'percentage') { $discountAmount = ($originalAmount * $currentDiscount) / 100; } else { $discountAmount = $currentDiscount; } } @endphp
Current Discount: @if($discountType === 'percentage') {{ number_format($currentDiscount, 2) }}% @else ${{ number_format($currentDiscount, 2) }} @endif @if($discountOnRemaining) On Remaining @else On Total @endif @if($discountAmount > 0) (Amount: -${{ number_format($discountAmount, 2) }}) @endif
@endif
Customer & Booking Information
Customer Information
Name: {{ $quote->booking->name ?? ($quote->user->name ?? 'N/A') }}
Email: {{ $quote->booking->email ?? ($quote->user->email ?? 'N/A') }}
Phone: {{ $quote->booking->phone ?? ($quote->user->phone ?? 'N/A') }}
Booking Details {{-- --}}
Booking ID: {{ $quote->booking->id ?? 'N/A' }}
Move Date: {{ $quote->booking && $quote->booking->move_date ? $quote->booking->move_date->format('M d, Y') : 'N/A' }}
Time: {{ ucfirst($quote->booking->time_preference ?? 'N/A') }}
Status: {{ $quote->booking && $quote->booking->is_completed ? 'Completed' : ucfirst($quote->booking->status ?? 'Pending') }}
Booking Items
@if ($quote->booking && $quote->booking->bookingItems && $quote->booking->bookingItems->count() > 0) @foreach ($quote->booking->bookingItems as $item) @php $entity = $item->entity; $isStorageItem = $item->entity_type === \App\Models\StorageItem::class; // Determine type label based on assemble/disassemble type if ($item->is_assemble_disassemble) { switch ($item->assemble_disassemble_type) { case 'assemble': $typeLabel = 'Assemble'; break; case 'disassemble': $typeLabel = 'Disassemble'; break; case 'both': $typeLabel = 'Both'; break; default: $typeLabel = 'Assemble/Disassemble'; } } else { $typeLabel = $isStorageItem ? 'Storage' : 'Regular'; } $typeClass = $item->is_assemble_disassemble ? 'bg-info' : ($isStorageItem ? 'bg-secondary' : 'bg-primary'); $priceDisplay = null; if ($isStorageItem && $entity) { $unitPrice = (float) ($entity->price ?? 0); $totalPrice = $unitPrice * $item->quantity; $priceDisplay = $totalPrice; } elseif ($item->is_assemble_disassemble && $entity) { $unitPrice = 0; switch ($item->assemble_disassemble_type) { case 'assemble': $unitPrice = (float) ($entity->assemble_price ?? 0); break; case 'disassemble': $unitPrice = (float) ($entity->disassemble_price ?? 0); break; case 'both': $unitPrice = (float) ($entity->both_price ?? 0); break; } $totalPrice = $unitPrice * $item->quantity; $priceDisplay = $totalPrice; } @endphp @endforeach @else @endif
Item Name Type Quantity Price
{{ $entity->name ?? ($entity->title ?? 'N/A') }} {{ $typeLabel }} {{ $item->quantity }} @if (!is_null($priceDisplay)) ${{ number_format($priceDisplay, 2) }} @else - @endif
No booking items available.
@if ($quote->booking)
Property Information
@if ($quote->booking->pickUpProperty)
↑ Pickup Location
Location: {{ $quote->booking->pickUpProperty->location ?? 'N/A' }}
Type: {{ ucfirst(str_replace('_', ' ', optional($quote->booking->pickUpProperty->propertyDetails)->property_category ?? 'N/A')) }}
@if ($quote->booking->pickUpProperty->propertyDetails) @php $pickupDetails = $quote->booking->pickUpProperty->propertyDetails; @endphp

Flights: {{ str_replace('_', ' ', $pickupDetails->flights_of_stairs ?? 'N/A') }}
Access: {{ str_replace('_', ' ', $pickupDetails->access_required ?? 'N/A') }}

Internal: {{ str_replace('_', ' ', $pickupDetails->internal_levels ?? 'N/A') }}
Levels: {{ str_replace('_', ' ', $pickupDetails->levels_in_house ?? 'N/A') }}

Truck: {{ str_replace('_', ' ', $pickupDetails->truck_parking ?? 'N/A') }}
Walk Distance: {{ str_replace('_', ' ', $pickupDetails->walk_distance ?? 'N/A') }}
@if ($pickupDetails->storage_name || $pickupDetails->storage_units)

Name: {{ $pickupDetails->storage_name ?? 'N/A' }}
Units: {{ $pickupDetails->storage_units ?? 'N/A' }}
@endif @if ($pickupDetails->comments)

{{ $pickupDetails->comments ?? 'N/A' }}

@endif
@endif
@endif @if ($quote->booking->dropOffProperty)
↓ Dropoff Location
Location: {{ $quote->booking->dropOffProperty->location ?? 'N/A' }}
Type: {{ ucfirst(str_replace('_', ' ', optional($quote->booking->dropOffProperty->propertyDetails)->property_category ?? 'N/A')) }}
@if ($quote->booking->dropOffProperty->propertyDetails) @php $dropoffDetails = $quote->booking->dropOffProperty->propertyDetails; @endphp

Flights: {{ str_replace('_', ' ', $dropoffDetails->flights_of_stairs ?? 'N/A') }}
Access: {{ str_replace('_', ' ', $dropoffDetails->access_required ?? 'N/A') }}

Internal: {{ str_replace('_', ' ', $dropoffDetails->internal_levels ?? 'N/A') }}
Levels: {{ str_replace('_', ' ', $dropoffDetails->levels_in_house ?? 'N/A') }}

Truck: {{ str_replace('_', ' ', $dropoffDetails->truck_parking ?? 'N/A') }}
Walk Distance: {{ str_replace('_', ' ', $dropoffDetails->walk_distance ?? 'N/A') }}
@if ($dropoffDetails->storage_name || $dropoffDetails->storage_units)

Name: {{ $dropoffDetails->storage_name ?? 'N/A' }}
Units: {{ $dropoffDetails->storage_units ?? 'N/A' }}
@endif @if ($dropoffDetails->comments)

{{ $dropoffDetails->comments ?? 'N/A' }}

@endif
@endif
@endif
@endif
Truck Information
@php $truckCubicCapacity = $quote->raw_data['truck_cubic_capacity'] ?? ($quote->truck->cubic_capacity ?? 0); @endphp @php $generalSettings = \App\General\GeneralSettingsClass::getAllSettings(); $jobType = $quote->job_type ?? ($quote->raw_data['job_type'] ?? 'local_job'); // Get movers and price based on job type if ($jobType === 'interstate_job') { $numberOfMovers = (int)($generalSettings['_interstate_job_number_of_movers'] ?? 2); $moverPrice = (float)($generalSettings['_interstate_job_mover_per_hour_price'] ?? 110); $jobTypeLabel = 'Interstate Job'; } else { $numberOfMovers = (int)($generalSettings['_local_job_number_of_movers'] ?? 2); $moverPrice = (float)($generalSettings['_local_job_mover_per_hour_price'] ?? 85); $jobTypeLabel = 'Local Job'; } @endphp
Truck Name: {{ $quote->truck->truck_name ?? 'N/A' }}
Cubic Capacity: {{ number_format($truckCubicCapacity, 2) }} m³
Number of Movers: {{ $numberOfMovers }} ({{ $jobTypeLabel }})
Mover Price/Hour: ${{ number_format($moverPrice, 2) }} ({{ $jobTypeLabel }})
@if (optional($quote->truck)->truck_image) Truck @endif
Calculation Details
@php $jobType = $quote->job_type ?? ($quote->raw_data['job_type'] ?? null); $jobTypeColors = [ 'local_job' => 'primary', 'interstate_job' => 'info', ]; $jobTypeColor = $jobTypeColors[$jobType] ?? 'secondary'; $timeFromCubicMeters = $quote->time_from_cubic_meters_minutes ?? ($quote->raw_data['time_from_cubic_meters_minutes'] ?? 0); $timeFromCubicMetersHours = $quote->time_from_cubic_meters_hours ?? ($quote->raw_data['time_from_cubic_meters_hours'] ?? 0); $timeFromCubicMetersRemainingMinutes = $quote->time_from_cubic_meters_remaining_minutes ?? ($quote->raw_data['time_from_cubic_meters_remaining_minutes'] ?? 0); $calloutFeeTime = $quote->raw_data['callout_fee_time'] ?? 0; $calloutFeeHours = $quote->raw_data['callout_fee_hours'] ?? 0; $calloutFeeRemainingMinutes = $quote->raw_data['callout_fee_remaining_minutes'] ?? 0; $calloutFeeTimeOriginal = $quote->raw_data['callout_fee_time_original'] ?? 0; $calloutFeeMultiplier = $quote->raw_data['callout_fee_multiplier'] ?? 1.20; $totalVolume = $quote->total_cubic_meters ?? 0; $moverPerHourPrice = $quote->mover_per_hour_price ?? 0; $numberOfMovers = $quote->number_of_movers ?? 2; $extraMovers = $quote->extra_movers ?? ($quote->raw_data['extra_movers'] ?? 0); // Get settings for minimum rate display $generalSettings = \App\General\GeneralSettingsClass::getAllSettings(); $localJobMovers = (int)($generalSettings['_local_job_number_of_movers'] ?? 2); $localJobPrice = (float)($generalSettings['_local_job_mover_per_hour_price'] ?? 85); $interstateJobMovers = (int)($generalSettings['_interstate_job_number_of_movers'] ?? 2); $interstateJobPrice = (float)($generalSettings['_interstate_job_mover_per_hour_price'] ?? 110); $localJobMinRate = $localJobMovers * $localJobPrice; $interstateJobMinRate = $interstateJobMovers * $interstateJobPrice; // Calculate base mover rate (with minimum for local/interstate) $baseMoverRate = $numberOfMovers * $moverPerHourPrice; // Apply minimum rates from settings $effectiveBaseRate = $jobType === 'interstate_job' ? max($interstateJobMinRate, $baseMoverRate) : max($localJobMinRate, $baseMoverRate); // Include extra movers ($50/hour each) $moverPerHourPriceTotal = $effectiveBaseRate + ($extraMovers * 50); @endphp
{{ $jobType ? ucfirst(str_replace('_', ' ', $jobType)) : 'N/A' }} {{ ucfirst(str_replace('_', ' ', $quote->calculation_type ?? 'N/A')) }}
📦 Volume Calculation
@if($timeFromCubicMeters > 0) @endif
Total Volume: {{ number_format($totalVolume, 2) }} m³
Time per m³ (load + unload): 14 minutes
Total Time Required: {{ $timeFromCubicMetersHours }}h {{ $timeFromCubicMetersRemainingMinutes }}m ({{ number_format($timeFromCubicMeters, 2) }} min)
Calculation: {{ number_format($totalVolume, 2) }} m³ × 14 min = {{ number_format($timeFromCubicMeters, 2) }} min
@if(($jobType === 'local_job' || $jobType === 'interstate_job') && $calloutFeeTime > 0)
🚚 Callout Fee Calculation
@if($calloutFeeTimeOriginal > 0 ) @if($jobType === 'local_job') @endif @if($jobType === 'interstate_job') @endif @endif @if($calloutFeeTimeOriginal > 0) @endif
Base to Pickup + Dropoff to Base: {{ number_format($calloutFeeTimeOriginal, 2) }} minutes
Base to Pickup + Dropoff to Base + Pickup to Dropoff: {{ number_format($calloutFeeTimeOriginal, 2) }} minutes
Multiplier (20% buffer): {{ number_format(($calloutFeeMultiplier - 1) * 100, 0) }}%
Total Callout Time: {{ $calloutFeeHours }}h {{ $calloutFeeRemainingMinutes }}m ({{ number_format($calloutFeeTime, 2) }} min)
Calculation: {{ number_format($calloutFeeTimeOriginal, 2) }} min × {{ number_format($calloutFeeMultiplier, 2) }} = {{ number_format($calloutFeeTime, 2) }} min
@endif
👥 Movers & Pricing
@php $totalMovers = $numberOfMovers + $extraMovers; $extraMoverRate = $extraMovers * 50; @endphp @if($extraMovers > 0) @endif @if($extraMovers > 0) @endif
Base Movers: {{ $numberOfMovers }} movers
Extra Movers: {{ $extraMovers }} movers (@ $50/hour each)
Total Movers: {{ $totalMovers }} movers
Base Mover Rate/Hour: ${{ number_format($effectiveBaseRate, 2) }} @if($effectiveBaseRate > $baseMoverRate) (min: ${{ number_format($jobType === 'interstate_job' ? $interstateJobMinRate : $localJobMinRate, 2) }}/hour) @else ({{ $numberOfMovers }} × ${{ number_format($moverPerHourPrice, 2) }}) @endif
Extra Mover Rate/Hour: ${{ number_format($extraMoverRate, 2) }} ({{ $extraMovers }} × $50.00)
Total Mover Rate/Hour: ${{ number_format($moverPerHourPriceTotal, 2) }} @if($extraMovers > 0) (${{ number_format($effectiveBaseRate, 2) }} + ${{ number_format($extraMoverRate, 2) }} = ${{ number_format($moverPerHourPriceTotal, 2) }}) @endif

Cost Breakdown
@if ($quote->raw_data && isset($quote->raw_data['breakdown'])) @php $moversCost = $quote->raw_data['breakdown']['movers_cost'] ?? 0; $calloutFee = $quote->raw_data['breakdown']['callout_fee'] ?? 0; $timeFromCubicMetersInHours = $timeFromCubicMeters > 0 ? ($timeFromCubicMetersHours + ($timeFromCubicMetersRemainingMinutes / 60)) : 0; $calloutFeeInHours = $calloutFeeTime > 0 ? ($calloutFeeHours + ($calloutFeeRemainingMinutes / 60)) : 0; @endphp @if($moversCost > 0 && $timeFromCubicMeters > 0) @endif @if($calloutFee > 0 && $calloutFeeTime > 0) @endif @foreach ($quote->raw_data['breakdown'] as $key => $value) @if($key !== 'movers_cost' && $key !== 'callout_fee' && $key !== 'extra_movers' && $key !== 'extra_movers_cost' && $key !== 'minimum_order' && $key !== 'minimum_order_cost' && $key !== 'discount_percent' && $key !== 'discount_on_remaining') @if($key === 'discount_amount') @php $discountType = $quote->raw_data['discount_type'] ?? 'percentage'; $discountValue = $quote->raw_data['discount'] ?? 0; $discountOnRemaining = isset($quote->raw_data['breakdown']['discount_on_remaining']) && $quote->raw_data['breakdown']['discount_on_remaining']; @endphp @else @endif @endif @endforeach @else @endif @php $originalTotalCost = $quote->raw_data['original_total_cost'] ?? $quote->total_cost; $hasDiscount = isset($quote->raw_data['breakdown']['discount_amount']) && $quote->raw_data['breakdown']['discount_amount'] > 0; $discountOnRemaining = isset($quote->raw_data['breakdown']['discount_on_remaining']) && $quote->raw_data['breakdown']['discount_on_remaining']; $originalRemaining = $quote->raw_data['original_remaining_amount'] ?? null; @endphp @if($hasDiscount) @if($discountOnRemaining) {{-- Discount applied on remaining amount --}} @if($originalRemaining && $originalRemaining != $quote->remaining_amount) @endif @else {{-- Discount applied on total cost --}} @if($originalTotalCost != $quote->total_cost) @endif @endif @endif @if($quote->deposit_amount > 0) @endif @if($hasDiscount && $discountOnRemaining) {{-- Show calculation when discount is on remaining --}} @elseif($quote->remaining_amount > 0) @endif
Item Amount
Movers Cost:
{{ $timeFromCubicMetersHours }}h {{ $timeFromCubicMetersRemainingMinutes }}m × ${{ number_format($moverPerHourPriceTotal, 2) }}/hour
${{ number_format($moversCost, 2) }}
Callout Fee:
{{ $calloutFeeHours }}h {{ $calloutFeeRemainingMinutes }}m × ${{ number_format($moverPerHourPriceTotal, 2) }}/hour
${{ number_format($calloutFee, 2) }}
Discount @if($discountType === 'percentage') ({{ number_format($discountValue, 2) }}%) @else (Fixed: ${{ number_format($discountValue, 2) }}) @endif @if($discountOnRemaining) On Remaining @else On Total @endif : @if($discountOnRemaining)
Applied on Remaining Amount (after deposit) @else
Applied on Total Cost @endif
-${{ number_format($value, 2) }}
{{ ucfirst(str_replace('_', ' ', $key)) }}: ${{ number_format($value, 2) }}
No breakdown data available.
Original Remaining Amount: ${{ number_format($originalRemaining, 2) }}
Original Total Cost: ${{ number_format($originalTotalCost, 2) }}
Total Cost: ${{ number_format($quote->total_cost, 2) }}
Deposit Amount: -${{ number_format($quote->deposit_amount, 2) }}
Remaining Amount (After Discount): ${{ number_format($quote->remaining_amount, 2) }}
Remaining Amount: ${{ number_format($quote->remaining_amount, 2) }}
@include('Admin.Includes.footer')