@extends('layouts.app') @section('page-title', 'Projects') @push('page-css') @endpush @section('content')

Projects

View and manage all your saved decking projects.

{{ $projects->count() }} project{{ $projects->count() !== 1 ? 's' : '' }} @if($projects->count() > 3) @endif
@if($projects->isEmpty())

No projects yet

Create your first project in the Deck Estimator.

Open Deck Estimator
@else
@foreach($projects as $project) @php // deck_areas is a flat form-data object, not an array of areas $data = is_array($project->deck_areas) ? $project->deck_areas : []; $savedAreas = $data['savedDeckAreas'] ?? []; $areaCount = count($savedAreas); // Build dimensions text — check savedDeckAreas first, fallback to top-level $dims = ''; $dimParts = []; if ($areaCount > 0) { foreach ($savedAreas as $area) { $fd = $area['formData'] ?? []; $l = $fd['deckLength'] ?? null; $w = $fd['deckWidth'] ?? null; if ($l && $w) { $dimParts[] = number_format($l / 1000, 1) . 'm × ' . number_format($w / 1000, 1) . 'm'; } } $dims = $areaCount === 1 ? ($dimParts[0] ?? '') : implode(' + ', $dimParts); } if (!$dims) { $l = $data['deckLength'] ?? null; $w = $data['deckWidth'] ?? null; $unit = $data['currentUnit'] ?? 'mm'; if ($l && $w) { if ($unit === 'mm' && $l >= 1000) { $dims = number_format($l / 1000, 1) . 'm × ' . number_format($w / 1000, 1) . 'm'; } else { $dims = $l . ' × ' . $w . ' ' . $unit; } } } // Extract board info — top-level first, then first savedDeckArea with data $mfr = $data['manufacturer'] ?? ''; $boardType = $data['boardType'] ?? ''; $boardColour = $data['boardColour'] ?? ''; if (!$mfr && !$boardType && $areaCount > 0) { foreach ($savedAreas as $area) { $fd = $area['formData'] ?? []; if (!empty($fd['manufacturer']) || !empty($fd['boardType'])) { $mfr = $fd['manufacturer'] ?? ''; $boardType = $fd['boardType'] ?? ''; $boardColour = $fd['boardColour'] ?? ''; break; } } } $boardText = collect([$mfr ? ucfirst($mfr) : null, $boardType, $boardColour]) ->filter()->implode(' — '); // Notes $notes = $data['projectNotes'] ?? ''; // Client info $clientName = $project->client_name; @endphp

{{ $project->name }}

{{ $project->status }} @if($dims) 📐 {{ $dims }} @endif @if($boardText) 🪵 {{ $boardText }} @endif @if($clientName) 👤 {{ $clientName }} @endif Saved {{ $project->updated_at->diffForHumans() }}
@if($notes)

{{ Str::limit($notes, 80) }}

@endif
Load
@endforeach
@endif
@endsection @push('page-scripts') @endpush