<!DOCTYPE html>
<html>

<head>
  <!-- Basic -->
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <!-- Mobile Metas -->
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
  <!-- Site Metas -->
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <meta name="author" content="" />

  <title>NutriPosy</title>
  <link rel="icon" type="image/png" href="images/nutriposy.png">

  <!-- bootstrap core css -->
  <link rel="stylesheet" type="text/css" href="css/bootstrap.css" />

  <!-- fonts style -->
  <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap" rel="stylesheet">

  <!-- owl slider stylesheet -->
  <link rel="stylesheet" type="text/css"
    href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css" />

  <!-- font awesome style -->
  <link href="css/font-awesome.min.css" rel="stylesheet" />
  <!-- nice select -->
  <link rel="stylesheet"
    href="https://cdnjs.cloudflare.com/ajax/libs/jquery-nice-select/1.1.0/css/nice-select.min.css"
    integrity="sha256-mLBIhmBvigTFWPSCtvdu6a76T+3Xyt+K571hupeFLg4=" crossorigin="anonymous" />
  <!-- datepicker -->
  <link rel="stylesheet"
    href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/css/datepicker.css">
  <!-- Custom styles for this template -->
  <link href="css/style.css" rel="stylesheet" />
  <!-- responsive style -->
  <link href="css/responsive.css" rel="stylesheet" />

</head>

<body>

  <div class="hero_area">
    <!-- header section starts -->
    <header class="header_section">
      <div class="header_bottom">
        <div class="container-fluid">
          <nav class="navbar navbar-expand-lg custom_nav-container">
            <a class="navbar-brand" href="#">
              <img src="images/nutriposy.png" alt="">
            </a>

            <!-- ✅ PERBAIKAN tombol hamburger -->
            <button class="navbar-toggler" type="button" data-toggle="collapse"
              data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
              aria-label="Toggle navigation">
              <span class="navbar-toggler-icon"></span>
            </button>

            <div class="collapse navbar-collapse" id="navbarSupportedContent">
              <div class="d-flex mr-auto flex-column flex-lg-row align-items-center">
                <ul class="navbar-nav">
                  <li class="nav-item active">
                    <a class="nav-link" href="{{ route('dashboard') }}">Beranda</a>
                  </li>
                </ul>
              </div>
            </div>
          </nav>
        </div>
      </div>
    </header>
    <!-- end header section -->

    <section class="book_section layout_padding">
      <div class="container">
        <h4>Pendaftaran <span>Balita</span></h4>

        <!-- ✅ ALERT BERHASIL -->
        @if(session('success'))
        <div class="alert alert-success alert-dismissible fade show" role="alert">
          {{ session('success') }}
          <button type="button" class="close" data-dismiss="alert" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        @endif

        <form action="{{ route('balita.store') }}" method="POST">
          @csrf
          <div class="form-row">
            <div class="form-group col-lg-4">
              <label for="nik">NIK</label>
              <input type="text" name="nik" class="form-control @error('nik') is-invalid @enderror" id="nik"
                value="{{ old('nik') }}" placeholder="Masukkan NIK">
              @error('nik')
              <div class="invalid-feedback">{{ $message }}</div>
              @enderror
            </div>
            <div class="form-group col-lg-4">
              <label for="nama_anak">Nama Anak</label>
              <input type="text" name="nama_anak" class="form-control @error('nama_anak') is-invalid @enderror"
                id="nama_anak" value="{{ old('nama_anak') }}" placeholder="Masukkan nama anak">
              @error('nama_anak')
              <div class="invalid-feedback">{{ $message }}</div>
              @enderror
            </div>
            <div class="form-group col-lg-4">
              <label for="jenis_kelamin">Jenis Kelamin</label>
              <select name="jenis_kelamin" class="form-control @error('jenis_kelamin') is-invalid @enderror"
                id="jenis_kelamin">
                <option value="">-- Pilih Jenis Kelamin --</option>
                <option value="Laki-laki" {{ old('jenis_kelamin') == 'Laki-laki' ? 'selected' : '' }}>Laki-laki</option>
                <option value="Perempuan" {{ old('jenis_kelamin') == 'Perempuan' ? 'selected' : '' }}>Perempuan</option>
              </select>
              @error('jenis_kelamin')
              <div class="invalid-feedback">{{ $message }}</div>
              @enderror
            </div>
          </div>
          <div class="form-row">
            <div class="form-group col-lg-4">
              <label for="tanggal_lahir">Tanggal Lahir</label>
              <input type="date" name="tanggal_lahir"
                class="form-control @error('tanggal_lahir') is-invalid @enderror" id="tanggal_lahir"
                value="{{ old('tanggal_lahir') }}">
              @error('tanggal_lahir')
              <div class="invalid-feedback">{{ $message }}</div>
              @enderror
            </div>
            <div class="form-group col-lg-4">
              <label for="tempat_lahir">Tempat Lahir</label>
              <input type="text" name="tempat_lahir"
                class="form-control @error('tempat_lahir') is-invalid @enderror" id="tempat_lahir"
                value="{{ old('tempat_lahir') }}" placeholder="Masukkan tempat lahir">
              @error('tempat_lahir')
              <div class="invalid-feedback">{{ $message }}</div>
              @enderror
            </div>
            <div class="form-group col-lg-4">
              <label for="ibu_kandung">Nama Ibu Kandung</label>
              <input type="text" name="ibu_kandung"
                class="form-control @error('ibu_kandung') is-invalid @enderror" id="ibu_kandung"
                value="{{ old('ibu_kandung') }}" placeholder="Masukkan nama ibu">
              @error('ibu_kandung')
              <div class="invalid-feedback">{{ $message }}</div>
              @enderror
            </div>
          </div>
          <div class="form-row">
            <div class="form-group col-lg-4">
              <label for="nama_ayah">Nama Ayah</label>
              <input type="text" name="nama_ayah" class="form-control @error('nama_ayah') is-invalid @enderror"
                id="nama_ayah" value="{{ old('nama_ayah') }}" placeholder="Masukkan nama ayah">
              @error('nama_ayah')
              <div class="invalid-feedback">{{ $message }}</div>
              @enderror
            </div>
            <div class="form-group col-lg-8">
              <label for="alamat">Alamat</label>
              <textarea name="alamat" class="form-control @error('alamat') is-invalid @enderror" id="alamat" rows="2"
                placeholder="Masukkan alamat lengkap">{{ old('alamat') }}</textarea>
              @error('alamat')
              <div class="invalid-feedback">{{ $message }}</div>
              @enderror
            </div>
          </div>
          <div class="btn-box">
            <button type="submit" class="btn btn-primary">Simpan Data</button>
          </div>
        </form>
      </div>
    </section>

    <!-- footer section -->
    <footer class="footer_section">
      <div class="container">
        <p>
          &copy; <span id="displayYear"></span> All Rights Reserved By
          <a href="#">NutriPosy</a>
        </p>
      </div>
    </footer>
  </div>

  <!-- ✅ Tambahkan jQuery & Bootstrap JS sebelum </body> -->
  <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>

  <!-- ✅ Script untuk auto-close alert -->
  <script>
    setTimeout(function () {
      $('.alert').alert('close');
    }, 3000); // hilang setelah 3 detik
  </script>

</body>

</html>
