@extends('admin.template')

@section('content')
<div class="content-wrapper">
    <div class="row">
        <div class="col-md-12 grid-margin stretch-card">
            <div class="card">
                <div class="card-body">
                    <h4 class="card-title">Edit Data Sampah Tahunan</h4>
                    <p class="card-description">
                        Form edit data sampah per tahun (satuan Ton)
                    </p>

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

                        <div class="form-group">
                            <label>Tahun</label>
                            <input type="number" name="tahun" class="form-control"
                                   value="{{ old('tahun', $sampah->tahun) }}" required>
                        </div>

                        <div class="form-group">
                            <label>Total Sampah</label>
                            <div class="input-group">
                                <input type="number" step="0.01" name="total_sampah"
                                       class="form-control"
                                       value="{{ old('total_sampah', $sampah->total_sampah) }}" required>
                                <div class="input-group-append">
                                    <span class="input-group-text">Ton</span>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label>Total Sampah Dikelola</label>
                            <div class="input-group">
                                <input type="number" step="0.01" name="total_kelola"
                                       class="form-control"
                                       value="{{ old('total_kelola', $sampah->total_kelola) }}" required>
                                <div class="input-group-append">
                                    <span class="input-group-text">Ton</span>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label>Total Sampah Daur Ulang</label>
                            <div class="input-group">
                                <input type="number" step="0.01" name="total_daur_ulang"
                                       class="form-control"
                                       value="{{ old('total_daur_ulang', $sampah->total_daur_ulang) }}" required>
                                <div class="input-group-append">
                                    <span class="input-group-text">Ton</span>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label>Sisa Sampah</label>
                            <div class="input-group">
                                <input type="number" step="0.01"
                                       class="form-control"
                                       value="{{ $sampah->sisa_sampah }}"
                                       readonly>
                                <div class="input-group-append">
                                    <span class="input-group-text">Ton</span>
                                </div>
                            </div>
                            <small class="text-muted">
                                Sisa sampah dihitung otomatis oleh sistem
                            </small>
                        </div>

                        <button type="submit" class="btn btn-primary mr-2">
                            Simpan
                        </button>
                        <a href="{{ route('admin.sampah.index') }}" class="btn btn-light">
                            Batal
                        </a>
                    </form>

                </div>
            </div>
        </div>
    </div>
</div>
@endsection
