@extends('layouts.layout-user')
@section('content')
<h2 style="display: inline-block; margin-right: 10px;">Edit Data Pelaporan Bahaya</h2>
<div class="row">
    <div class="w-full">
        <span class="card shadow text-decoration-none" style="display: flex;">
            <div class="card-body" style="display: flex; flex-direction: column;">
                <form class="form-horizontal" action="{{ route('pelaporan.update', $pelaporans->id) }}" method="POST" enctype="multipart/form-data" style="display: flex; flex-wrap: wrap;">
                    @csrf
                    @method('PUT')
                    <div class="container">
                        <div class="row">
                            <div class="col-lg-6">
                                <div style="width: 100%;">
                                    <span>Judul Pelaporan</span>
                                    <div class="input-group input-group-merge" style="max-width: 400px; margin-bottom: 10px;">
                                        <input type="text" class="form-control" name="judul" value="{{ $pelaporans->judul }}" aria-describedby="defaultFormControlHelp">
                                    </div>
                                    <span>Keterangan Pelaporan</span>
                                    <div class="input-group input-group-merge" style="max-width: 400px; margin-bottom: 10px;">
                                        <textarea class="form-control" name="keterangan" aria-describedby="defaultFormControlHelp">{{ $pelaporans->keterangan }}</textarea>
                                    </div>
                                    <label for="tanggal">Tanggal</label>
                                    <div class="input-group input-group-merge" style="max-width: 400px; margin-bottom: 10px;">
                                        <input class="form-control" type="date" name="tanggal"  value="{{ $pelaporans->tanggal }}">
                                    </div>
                                    <span>Lokasi</span>
                                    <div class="input-group input-group-merge" style="max-width: 400px; margin-bottom: 10px;">
                                        <input type="text" class="form-control" name="lokasi"  value="{{ $pelaporans->lokasi }}" aria-describedby="defaultFormControlHelp">
                                    </div>
                                    <span>Tingkat Bahaya</span>
                                    <div class="input-group input-group-merge" style="max-width: 400px; margin-bottom: 10px;">
                                        <select class="form-select" name="status" aria-label="Default select example">
                                            <option value="{{ $pelaporans->status }}">{{ $pelaporans->status }}</option>
                                            <option value="Ringan">Ringan</option>
                                            <option value="Sedang">Sedang</option>
                                            <option value="Berat">Berat</option>
                                        </select>
                                    </div>
                                    <span>Saran Tindakan</span>
                                    <div class="input-group input-group-merge" style="max-width: 400px; margin-bottom: 10px;">
                                        <textarea class="form-control" value="{{ $pelaporans->saran }}" name="saran" placeholder="Masukkan saran tindakan" aria-describedby="defaultFormControlHelp">{{ $pelaporans->saran }}</textarea>
                                    </div>
                                    <span>Foto</span>
                                    <div class="input-group input-group-merge" style="max-width: 400px; margin-bottom: 10px;">
                                        <input type="file" class="form-control" name="foto">
                                    </div>
                                </div>
                                <div style="width: 100%; text-align: left; margin-bottom:5%;">
                                    <a href="{{ route('pelaporan.index') }}" class="btn  btn-delete" style="display: inline-block; width: 100px; background-color: #ffffff; color: #4f60e0; border: 2px solid #4f60e0; border-radius: 4px; cursor: pointer; text-align: center;">Back</a>
                                    <button type="submit" name="submit" class="btn  btn-delete" style="background-color: #4f60e0; color: #fff; border: none; border-radius: 4px; cursor: pointer;">Update</button>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div style="width: 100%;">

                                    <div style="display: flex; justify-content: left; align-items: left; flex-direction: column; width:300px;">
                                        <span>Foto saat ini:</span>
                                        <img src="{{ asset('foto/' . $pelaporans->foto) }}" alt="Foto Pelaporan" style="width: 100%; height: 300px; object-fit: cover;">
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                </form>
            </div>
        </span>
    </div>

</div>


@endsection
