@extends('admin.layout.template') @section('title', 'Quotation Details') @section('content')
{{-- ================= PROJECT HEADER ================= --}}
{{-- LEFT SIDE --}}

{{ $quotation->project_name }} {{ $quotation->project_number }}

Customer : {{ $quotation->customer_name }}

Phone : {{ $quotation->customer_phone }}

Address : {{ $quotation->address }}

Project Type : {{ $quotation->project_type ?? '-' }}

Expected Completion : {{ $quotation->expected_completion_date ? \Carbon\Carbon::parse($quotation->expected_completion_date)->format('d M Y') : '-' }}

Status : {{ ucfirst($quotation->status) }}

{{-- RIGHT SIDE --}}

Employee : {{ $quotation->employee_name ?? '-' }}

Contact : {{ $quotation->employee_contact ?? '-' }}

Created By : {{ $quotation->creator->name ?? '-' }} - {{$quotation->creator->role->name ?? '' }}

{{-- PDF Buttons --}}
{{-- ================= PROJECT SUMMARY ================= --}}
Total Areas

{{ $quotation->areas->count() }}

Total Items

{{ $quotation->areas->sum(fn($area) => $area->items->count()) }}

Subtotal

₹ {{ number_format($quotation->subtotal, 2) }}

GST (18%)

₹ {{ number_format($quotation->tax, 2) }}

Grand Total

₹ {{ number_format($quotation->grand_total, 2) }}

Room Wise Quotation
@foreach($quotation->areas as $area)
Area: {{ $area->name }} @if($area->room) (Room: {{ $area->room->name }}) @endif

{{ $area->area_name }}

@foreach($groupedItems[$area->id] ?? [] as $item) @endforeach
Img Item Size Qty Rate Total
@if($item->variant && $item->variant->primaryImage) @endif {{ ucfirst($item->category) }},
{{ $item->product->name ?? '' }},
{{ $item->variant->sku ?? '' }},
{{ $item->product?->category?->productModel?->name ?? '' }}
@php $measurement = null; $detailsData = null; $itemDetails = $item->details()->first(); // Decode measurement if ($itemDetails && $itemDetails->measurement) { $decoded = json_decode($itemDetails->measurement, true); if (is_string($decoded)) { $decoded = json_decode($decoded, true); } $measurement = $decoded; } // Decode details (for mattress) if ($itemDetails && $itemDetails->details) { $decodedDetails = json_decode($itemDetails->details, true); if (is_string($decodedDetails)) { $decodedDetails = json_decode($decodedDetails, true); } $detailsData = $decodedDetails; } @endphp @if($item->category == 'curtain' || $item->category == 'wallpaper') @if(isset($measurement['width']) && isset($measurement['height'])) {{ $measurement['width'] }} x {{ $measurement['height'] }} {{ $measurement['unit'] ?? '' }} @elseif(isset($measurement['curtain'])) {{ $measurement['curtain']['width'] ?? '' }} x {{ $measurement['curtain']['height'] ?? '' }} {{ $measurement['curtain']['unit'] ?? '' }} @elseif(isset($measurement['wallpaper'])) {{ $measurement['wallpaper']['width'] ?? '' }} x {{ $measurement['wallpaper']['height'] ?? '' }} {{ $measurement['wallpaper']['unit'] ?? '' }} @else - @endif @elseif($item->category == 'mattress') @if($detailsData && isset($detailsData['size'])) {{ $detailsData['size'] }} {{ $detailsData['unit'] ?? '' }} @else - @endif @else - @endif {{ number_format($item->calculated_qty ?? 0, 2) }} @if($item->projectItem?->curtain?->productModel?->unit_type == 'meter') m @elseif($item->projectItem?->curtain?->productModel?->unit_type == 'sqft') sqft @endif {{ number_format($item->price ?? 0, 2) }} {{ number_format($item->total ?? 0, 2) }}
@endforeach
Subtotal : {{ number_format($quotation->subtotal,2) }}
GST : {{ number_format($quotation->tax,2) }}
Grand Total : {{ number_format($quotation->grand_total,2) }}
@endsection