<x-layout bodyClass="g-sidenav-show bg-gray-200">

  <x-navbars.sidebar_triage
    role="{{ $request->user()->role }}"
    activePage="teachers_list_subject"
    teacher_id="{{ $current_teacher->id }}"
  >
  </x-navbars.sidebar_triage>

  <div
    class="main-content position-relative max-height-vh-100 h-100 bg-gray-100">
    <!-- Navbar -->
    <x-navbars.navs.auth
      titlePage="Edit subject"
      role="{{ $request->user()->role }}"
      firstName="{{ $current_teacher->firstName }}"
      last_name="{{ $current_teacher->lastName }}"
    ></x-navbars.navs.auth>
    <!-- End Navbar -->

    <div class="container-fluid px-md-4 px-2">
      @if (session('status'))
        <div class="row">
          <div
            class="alert alert-success alert-dismissible text-white"
            role="alert"
          >
            <span class="text-sm">{{ Session::get('status') }}</span>
            <button
              class="btn-close py-3 text-lg opacity-10"
              data-bs-dismiss="alert"
              type="button"
              aria-label="Close"
            >
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
        </div>
      @endif

      <div class="card card-plain h-100">
        <div class="card-header p-3 pb-0">
          <div class="row">
            <div class="col-md-8 d-flex align-items-center">
              <h6 class="mb-3">Edit Subject id:{{ $subject->id }}</h6>
            </div>
          </div>
        </div>
        <div class="card-body p-3">
          <form
            action="{{ route('teacherEditSubject', $subject->id) }}"
            method="POST"
            enctype="multipart/form-data"
          >
            @csrf
            @method('PUT')
            <div class="row">

              <div class="col-md-12 mb-3">
                <label class="form-label">Title :</label>
                <input
                  class="form-control border border-2 p-2"
                  name="subjectTitle"
                  type="text"
                  value="{{ old('subjectTitle', $subject->subjectTitle) }}"
                  placeholder="e.g. Cantonese language"
                >

                @error('subjectTitle')
                  <p class='text-danger inputerror'>{{ $message }} </p>
                @enderror
              </div>

              <div class="col-md-12 mb-3">
                <label for="floatingTextarea2">Details :</label>
                <textarea
                  class="form-control border border-2 p-2"
                  id="floatingTextarea2"
                  name="syllabusDetails"
                  placeholder="Some description about this subject ..."
                  rows="4"
                  cols="50"
                >{{ old('syllabusDetails', $subject->syllabusDetails) }}</textarea>

                @error('syllabusDetails')
                  <p class='text-danger inputerror'>{{ $message }} </p>
                @enderror
              </div>
            </div>
            <button
              class="btn bg-gradient-dark"
              type="submit"
            >
              <i class="material-icons opacity-10">save</i> Save
            </button>
            <a
              class="btn bg-gradient-dark"
              href="{{ route('teacherShowSubject') }}"
            >Cancel</a>
          </form>

        </div>
      </div>
    </div>

    <x-footers.auth></x-footers.auth>
  </div>

</x-layout>
