@extends('layouts.app')

@section('content')
<div class="container py-5">
    <div class="card shadow rounded">
        <div class="card-header bg-primary text-white">
            <h4 class="mb-0"><i class="fas fa-edit"></i> Edit Dataset</h4>
        </div>
        <div class="card-body">
            <form action="{{ route('update', $data->id) }}" method="POST">
                @csrf
                @method('PUT')

                <div class="form-group mb-3">
                    <label for="kecamatan">Kecamatan</label>
                    <input type="text" class="form-control" id="kecamatan" name="kecamatan" value="{{ $data->kecamatan }}" required>
                </div>

                <div class="form-group mb-3">
                    <label for="jumlah_penduduk">Jumlah Penduduk</label>
                    <input type="number" class="form-control" id="jumlah_penduduk" name="jumlah_penduduk" value="{{ $data->jumlah_penduduk }}" required>
                </div>

                <div class="form-group mb-3">
                    <label for="data_tahun">Data Tahun</label>
                    <input type="number" class="form-control" id="data_tahun" name="data_tahun" value="{{ $data->data_tahun }}" required>
                </div>

                <div class="form-group mb-3">
                    <label for="phbs">PHBS (%)</label>
                    <input type="number" step="0.01" class="form-control" id="phbs" name="phbs" value="{{ $data->phbs }}" required>
                </div>

                <div class="form-group mb-3">
                    <label for="pcv1">PCV 1</label>
                    <input type="number" step="0.01" class="form-control" id="pcv1" name="pcv1" value="{{ $data->pcv1 }}" required>
                </div>

                <div class="form-group mb-3">
                    <label for="pcv2">PCV 2</label>
                    <input type="number" step="0.01" class="form-control" id="pcv2" name="pcv2" value="{{ $data->pcv2 }}" required>
                </div>

                <div class="form-group mb-3">
                    <label for="imunisasi">Imunisasi (Rata-rata)</label>
                    <input type="number" step="0.01" class="form-control" id="imunisasi" name="imunisasi" value="{{ $data->imunisasi }}" required>
                </div>

                <div class="form-group mb-3">
                    <label for="merokok">Merokok (%)</label>
                    <input type="number" step="0.01" class="form-control" id="merokok" name="merokok" value="{{ $data->merokok }}" required>
                </div>

                <div class="form-group mb-3">
                    <label for="kasus_2023">Kasus</label>
                    <input type="number" class="form-control" id="kasus_2023" name="kasus_2023" value="{{ old('kasus_2023', $data->kasus_2023) }}" required>
                </div>

                <div class="form-group mb-3">
                    <label for="latitude">Latitude</label>
                    <input type="number" step="0.0000001" class="form-control" id="latitude" name="latitude" value="{{ $data->latitude }}" required>
                </div>

                <div class="form-group mb-3">
                    <label for="longitude">Longitude</label>
                    <input type="number" step="0.0000001" class="form-control" id="longitude" name="longitude" value="{{ $data->longitude }}" required>
                </div>

                <div class="form-group mb-4">
                    <label for="hipotesis">Status</label>
                    <select name="hipotesis" id="hipotesis" class="form-control" required>
                        <option value="Turun" {{ $data->hipotesis == 'Turun' ? 'selected' : '' }}>Turun</option>
                        <option value="Naik" {{ $data->hipotesis == 'Naik' ? 'selected' : '' }}>Naik</option>
                    </select>
                </div>

                <button type="submit" class="btn btn-success w-100">
                    <i class="fas fa-save"></i> Simpan Perubahan
                </button>
            </form>
        </div>
    </div>
</div>
@endsection
