@extends('layouts.app')

@section('title','Edit Kelas')

@section('content')

<div class="container-fluid">

    {{-- Header --}}
    <div class="d-flex justify-content-between align-items-center mb-4">

        <div>

            <h3 class="font-weight-bold mb-1">
                Edit Data Kelas
            </h3>

            <p class="text-muted mb-0">
                Perbarui informasi kelas.
            </p>

        </div>

        <a href="{{ route('kelas.index') }}"
           class="btn btn-secondary btn-modern">

            <i class="bi bi-arrow-left-circle mr-1"></i>

            Kembali

        </a>

    </div>

    <form action="{{ route('kelas.update',$kelas->id) }}"
          method="POST">

        @csrf
        @method('PUT')

        <div class="card card-modern">

            <div class="card-header bg-white border-0">

                <h5 class="mb-0">

                    <i class="bi bi-pencil-square text-warning mr-2"></i>

                    Form Edit Kelas

                </h5>

            </div>

            <div class="card-body">

                <div class="row">

                    {{-- Kode --}}
                    <div class="col-md-6 mb-3">

                        <label>Kode Kelas</label>

                        <div class="input-group">

                            <div class="input-group-prepend">

                                <span class="input-group-text">

                                    <i class="bi bi-upc-scan"></i>

                                </span>

                            </div>

                            <input
                                type="text"
                                name="kode_kelas"
                                value="{{ old('kode_kelas',$kelas->kode_kelas) }}"
                                class="form-control @error('kode_kelas') is-invalid @enderror">

                            @error('kode_kelas')
                                <div class="invalid-feedback">
                                    {{ $message }}
                                </div>
                            @enderror

                        </div>

                    </div>

                    {{-- Nama --}}
                    <div class="col-md-6 mb-3">

                        <label>Nama Kelas</label>

                        <div class="input-group">

                            <div class="input-group-prepend">

                                <span class="input-group-text">

                                    <i class="bi bi-building"></i>

                                </span>

                            </div>

                            <input
                                type="text"
                                name="nama_kelas"
                                value="{{ old('nama_kelas',$kelas->nama_kelas) }}"
                                class="form-control @error('nama_kelas') is-invalid @enderror">

                            @error('nama_kelas')
                                <div class="invalid-feedback">
                                    {{ $message }}
                                </div>
                            @enderror

                        </div>

                    </div>

                </div>

            </div>

            <div class="card-footer bg-white">

                <button
                    class="btn btn-warning btn-modern">

                    <i class="bi bi-check-circle-fill mr-1"></i>

                    Update Data

                </button>

                <a href="{{ route('kelas.index') }}"
                   class="btn btn-light btn-modern">

                    Batal

                </a>

            </div>

        </div>

    </form>

</div>

@endsection