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

    <a href="{{ route('grape-varieties.create') }}">Create New Variety</a>

    <table>
        <thead>
            <tr>
                <th>Name</th>
                <th>Wine Type</th>
                <th>Origin</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            @forelse($varieties as $variety)
                <tr>
                    <td>{{ $variety->variety_name }}</td>
                    <td>{{ $variety->wine_type }}</td>
                    <td>{{ $variety->origin }}</td>
                    <td>
                        <a href="{{ route('grape-varieties.show', $variety) }}">View</a>
                        <a href="{{ route('grape-varieties.edit', $variety) }}">Edit</a>
                        <form action="{{ route('grape-varieties.destroy', $variety) }}" method="POST" style="display: inline;">
                            @csrf
                            @method('DELETE')
                            <button type="submit">Delete</button>
                        </form>
                    </td>
                </tr>
            @empty
                <tr>
                    <td colspan="4">No grape varieties found.</td>
                </tr>
            @endforelse
        </tbody>
    </table>

    {{ $varieties->links() }}
</body>
</html>
