@extends('layouts.app')

@section('title','Edit Mata Pelajaran')

@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 Mata Pelajaran
            </h3>

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

        </div>

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

            <i class="fas fa-arrow-left mr-1"></i>

            Kembali

        </a>

    </div>

    <form action="{{ route('mata-pelajaran.update',$mapel->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="fas fa-book-open text-warning mr-2"></i>

                    Form Edit Mata Pelajaran

                </h5>

            </div>

            <div class="card-body">

                <div class="row">

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

                        <label>Kode Mata Pelajaran</label>

                        <div class="input-group">

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

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

                                    <i class="fas fa-barcode"></i>

                                </span>

                            </div>

                            <input
                                type="text"
                                name="kode_mapel"
                                value="{{ old('kode_mapel',$mapel->kode_mapel) }}"
                                class="form-control @error('kode_mapel') is-invalid @enderror"
                                placeholder="Kode Mata Pelajaran">

                            @error('kode_mapel')

                                <div class="invalid-feedback">

                                    {{ $message }}

                                </div>

                            @enderror

                        </div>

                    </div>

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

                        <label>Nama Mata Pelajaran</label>

                        <div class="input-group">

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

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

                                    <i class="fas fa-book"></i>

                                </span>

                            </div>

                            <input
                                type="text"
                                name="nama_mapel"
                                value="{{ old('nama_mapel',$mapel->nama_mapel) }}"
                                class="form-control @error('nama_mapel') is-invalid @enderror"
                                placeholder="Nama Mata Pelajaran">

                            @error('nama_mapel')

                                <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="fas fa-save mr-1"></i>

                    Update Data

                </button>

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

                    Batal

                </a>

            </div>

        </div>

    </form>

</div>

@endsection