@extends('layouts.admin')

@section('title', 'Edit Rule')

@section('content')

<form action="{{ route('rule.update', $rule->id) }}" method="POST">
@csrf
@method('PUT')

<div class="mb-3">
    <label>Gejala</label>
    <select name="gejala_id" class="form-control">
        @foreach($gejalas as $g)
            <option value="{{ $g->id }}" 
                {{ $rule->gejala_id == $g->id ? 'selected' : '' }}>
                {{ $g->nama }}
            </option>
        @endforeach
    </select>
</div>

<div class="mb-3">
    <label>Penyakit</label>
    <select name="penyakit_id" class="form-control">
        @foreach($penyakits as $p)
            <option value="{{ $p->id }}" 
                {{ $rule->penyakit_id == $p->id ? 'selected' : '' }}>
                {{ $p->nama }}
            </option>
        @endforeach
    </select>
</div>

<div class="mb-3">
    <label>MB</label>
    <input type="number" step="0.01" name="mb" value="{{ $rule->mb }}" class="form-control">
</div>

<div class="mb-3">
    <label>MD</label>
    <input type="number" step="0.01" name="md" value="{{ $rule->md }}" class="form-control">
</div>

<button class="btn btn-success">Update</button>
<a href="{{ route('rule.index') }}" class="btn btn-secondary">Kembali</a>

</form>

@endsection