@extends('layouts.admin')

@section('title', 'Tambah Gejala')

@section('content')

<div class="card shadow-sm">

    <div class="card-body">

        @if($errors->any())

            <div class="alert alert-danger">

                <ul class="mb-0">

                    @foreach($errors->all() as $error)

                        <li>{{ $error }}</li>

                    @endforeach

                </ul>

            </div>

        @endif

        <form action="{{ route('gejala.store') }}" method="POST">

            @csrf

            <!-- KODE -->
            <div class="mb-3">

                <label class="form-label">

                    Kode Gejala

                </label>

                <input
                    type="text"
                    name="kode"
                    class="form-control"
                    value="{{ $kode }}"
                    readonly>

            </div>

            <!-- NAMA -->
            <div class="mb-3">

                <label class="form-label">

                    Nama Gejala

                </label>

                <input
                    type="text"
                    name="nama"
                    class="form-control"
                    placeholder="Masukkan nama gejala"
                    value="{{ old('nama') }}"
                    required>

            </div>

            <!-- MB -->
            <div class="mb-3">

                <label class="form-label">

                    MB (Measure of Belief)

                </label>

                <input
                    type="number"
                    name="mb"
                    class="form-control"
                    step="0.01"
                    min="0"
                    max="1"
                    value="{{ old('mb') }}"
                    placeholder="Contoh : 0.80"
                    required>

                <small class="text-muted">

                    Nilai MB berada pada rentang 0 sampai 1.

                </small>

            </div>

            <!-- MD -->
            <div class="mb-3">

                <label class="form-label">

                    MD (Measure of Disbelief)

                </label>

                <input
                    type="number"
                    name="md"
                    class="form-control"
                    step="0.01"
                    min="0"
                    max="1"
                    value="{{ old('md') }}"
                    placeholder="Contoh : 0.20"
                    required>

                <small class="text-muted">

                    Nilai MD berada pada rentang 0 sampai 1 dan tidak boleh lebih besar dari MB.

                </small>

            </div>

            <hr>

            <!-- BUTTON -->
            <div class="d-flex justify-content-between">

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

                    ← Kembali

                </a>

                <button
                    type="submit"
                    class="btn btn-success">

                    Simpan Gejala

                </button>

            </div>

        </form>

    </div>

</div>

@endsection