@include('components.theme.pages.header')

<section>
    <!-- basic table -->
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    {{ Form::open(['route' => 'rule.store']) }}
                    @csrf
                    @if(session()->has('success'))
                        <div class="alert alert-success">
                            {{ session()->get('success') }}
                        </div>
                    @else
                        @if(session()->has('error'))
                            <div class="alert alert-danger">
                                {{ session()->get('error') }}
                            </div>
                        @endif
                    @endif
                        <div class="row">
                            <div class="col-md-6 form-group mb-3">
                                <label for="exampleEmail1">Kode Rule</label>
                                <input type="text" class="form-control form-control-user {{ $errors->has('kode_rule') ? 'is-invalid' : '' }}" id="email" name="kode_rule" aria-describedby="emailHelp" placeholder="Enter Kode Rule." value="<?= old('kode_rule') ?>">
                                @if($errors->has('kode_rule'))<span class="small text-danger mt-2">{{ $errors->first('kode_rule') }}</span>@endif
                            </div>
                            <div class="col-md-6 form-group mb-3">
                                <label for="exampleEmail1">Penyakit</label>
                                <select class="form-control form-control-user {{ $errors->has('kode_penyakit') ? 'is-invalid' : '' }}" id="exampleFormControlSelect1" name="kode_penyakit">
                                    <option value="">-- Pilih Penyakit --</option>
                                    @foreach($penyakit as $kode)
                                        <option value="{{ $kode->kode_penyakit }}">{{ $kode->nama_penyakit }}</option>
                                    @endforeach
                                </select>
                            </div>
                        </div>
                        <div class="form-group mb-3">
                            <label for="exampleEmail1">Kode Gejala</label>
                            <input type="text" class="form-control form-control-user {{ $errors->has('kode_gejala') ? 'is-invalid' : '' }}" id="email" name="kode_gejala" aria-describedby="emailHelp" placeholder="Contoh: G001, dst" value="<?= old('kode_gejala') ?>">
                            @if($errors->has('kode_gejala'))<span class="small text-danger mt-2">{{ $errors->first('kode_gejala') }}</span>@endif
                        </div>
                        <div class="form-group mb-0">
                            <button type="submit" class="btn btn-primary">Simpan</button>
                            <a href="{{ route('rule') }}" class="btn btn-light btn-light">Kembali</a>
                        </div>
                    {{ Form::close() }}
                </div>
            </div>
        </div>
    </div>
</section>

@include('components.theme.pages.footer')
