@extends('layouts.admin')

@section('content')
    <div class="container py-4">
        <h4 class="fw-bold mb-3">Ekstrakurikuler</h4>

        <form action="{{ route('admin.ekskul.store') }}" method="POST" enctype="multipart/form-data" class="row g-3 mb-4">
            @csrf
            <div class="col-md-5">
                <input type="text" name="nama" class="form-control" placeholder="Nama Ekskul">
            </div>
            <div class="col-md-4">
                <input type="file" name="foto" class="form-control">
            </div>
            <div class="col-md-3">
                <button class="btn btn-primary w-100">Tambah</button>
            </div>
        </form>

        <div class="row g-4">
            @foreach ($ekskuls as $item)
                <div class="col-lg-3 col-md-4 col-6">
                    <div class="card shadow-sm">
                        <img src="{{ asset('storage/' . $item->foto) }}" class="card-img-top"
                            style="height:150px;object-fit:cover">
                        <div class="card-body text-center">
                            <h6 class="fw-bold">{{ $item->nama }}</h6>
                            <form action="{{ route('admin.ekskul.destroy', $item->id) }}" method="POST">
                                @csrf
                                @method('DELETE')
                                <button class="btn btn-danger btn-sm">Hapus</button>
                            </form>

                        </div>
                    </div>
                </div>
            @endforeach
        </div>
    </div>
@endsection
