@extends('layout.app')
@section('content')
<div class="pagetitle">

    <h1>Data Makanan</h1>
    <nav>
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{{ route('admindash') }}">Home</a></li>
            <li class="breadcrumb-item active"><a href="{{ route('makanan') }}"> Data makanan</a></li>
        </ol>
    </nav>

</div><!-- End Page Title -->

<section class="section">
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-body">
                    <div class="d-flex justify-content-between align-items-center">
                        <h5 class="card-title mb-2">Data Makanan</h5>
                        <div class="text-center">
                            <a href="{{ route('tambahmakanan') }}" class="btn btn-primary">Tambah</a>
                        </div>
                    </div>
                    <style>
                        .accordion-button {
                            font-size: 1.3rem; /* Ukuran font lebih besar */
                        }
                        .accordion-body {
                            font-size: 1.1rem; /* Ukuran font lebih besar */
                        }
                    </style>
                    <div class="accordion-item mb-4">
                        <h3 class="accordion-header" id="flush-headingOne">
                          <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseOne" aria-expanded="false" aria-controls="flush-collapseOne">
                            <strong> Satuan yang harus di ikuti dan diperhatikan </strong>
                          </button>
                        </h3>
                        <div id="flush-collapseOne" class="accordion-collapse collapse" aria-labelledby="flush-headingOne" data-bs-parent="#accordionFlushExample">
                          <div class="accordion-body">Komposisi gizi pangan dihitung per <code>100 gram</code>, dengan Berat Dapat Dimakan (BDD) 100 % </div>
                        </div>
                    </div>
                    
                    <!-- Table with stripped rows -->
                    <table class="table datatable">
                        <thead>
                            <tr>
                                <th class="text-center">No</th>
                                <th class="text-center">Name</th>
                                <th class="text-center">Kategori</th>
                                <th class="text-center">Jenis Makanan</th>
                                <th class="text-center">Lemak (g)</th>
                                <th class="text-center">Natrium (mg)</th>
                                <th class="text-center">Energi (Kal)</th>
                                <th class="text-center">Karbohidrat (g)</th>
                                <th class="text-center">Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach ($makanans as $mknn)
                            <tr>
                                <td class="text-center">{{ $loop->iteration }}</td>
                                <td class="text-center">{{ $mknn->nama }}</td>
                                <td class="text-center">{{ $mknn->kategori->kategori }}</td>
                                <td class="text-center">{{ $mknn->jenis->name }}</td>
                                <td class="text-center">{{ $mknn->lemak }}</td>
                                <td class="text-center">{{ $mknn->natrium }}</td>
                                <td class="text-center">{{ $mknn->energi }}</td>
                                <td class="text-center">{{ $mknn->karbohidrat }}</td>
                                <td class="text-center">
                                    <a href="{{ route('editmakanan', $mknn->id) }}" class="btn btn-sm btn-warning">Edit</a>
                                    <form action="{{ url('/makanan', $mknn->id) }}" method="POST" style="display: inline;">
                                        @csrf
                                        @method('DELETE')
                                        <button type="submit" class="btn btn-sm btn-danger">Hapus</button>
                                    </form>
                                </td>
                            </tr>
                            @endforeach
                        </tbody>
                    </table>
                    <!-- End Table with stripped rows -->
                </div>
            </div>
        </div>
    </div>
</section>
@endsection