<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Harvest Details</title>
</head>
<body>
    <h1>Harvest Details</h1>

    <div>
        <strong>Date:</strong>
        @if($harvest->plannedTask && $harvest->plannedTask->execution_date)
            {{ $harvest->plannedTask->execution_date->format('Y-m-d') }}
        @else
            {{ $harvest->date->format('Y-m-d') }}
        @endif
    </div>

    <div>
    <strong>Vineyard Row:</strong>
    {{ $harvest->vineyardRow->varietyVariation->grapeVariety->variety_name ?? 'Row #' . ($harvest->vineyardRow->id ?? 'N/A') }}
    </div>

    <div>
        <strong>Variety Variation:</strong> {{ $harvest->varietyVariation->description ?? 'N/A' }}
    </div>

    <div>
        <strong>Weight:</strong> {{ $harvest->weight }} kg
    </div>

    <div>
        <strong>Sugar Content:</strong> {{ $harvest->sugar_content }} °NM
    </div>

    <div>
        <strong>Quality:</strong> {{ $harvest->quality }}
    </div>

    <div>
        <strong>Grape Condition:</strong> {{ $harvest->grape_condition ?? 'N/A' }}
    </div>

    <div>
        <strong>Weather Conditions:</strong> {{ $harvest->weather_conditions ?? 'N/A' }}
    </div>

    @if($harvest->harvest_time)
        <div>
            <strong>Harvest Time:</strong> {{ $harvest->harvest_time }}
        </div>
    @endif

    @if($harvest->notes)
        <div>
            <strong>Notes:</strong>
            <p>{{ $harvest->notes }}</p>
        </div>
    @endif

    <div>
        <strong>Harvested by:</strong> {{ $harvest->user->name ?? 'N/A' }}
    </div>

    <div>
        <a href="{{ route('harvests.edit', $harvest) }}">Edit</a>
        <a href="{{ route('harvests.index') }}">Back to List</a>
    </div>
</body>
</html>
