@extends('layouts.layout')
@section('content')
<!--data sayur -->
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-body">
                    @if(Session::has('alert-success'))
                        <div class="alert alert-success">
                            {{ Session::get('alert-success') }}
                        </div>
                    @endif
                    <a href="{{route('HalamanMonitoring.create')}}" class="btn btn-info pull-right">Tambah Data</a><br><br>
                    <table class="table table-striped">
                        <tr>
                            <th>No</th>
                            <th>Foto</th>
                            <th>Nama</th>
                            <th>Family</th>
                            <th>Tanggal Tanam</th>
                            <th>Usia Tanaman</th>
                            <th>Hama</th>
                            <th>Action</th>
                        </tr>
                        <?php $no=1; ?>
                        @foreach($sayurs as $sayur)
                            <tr>
                                <td>{{$no++}}</td>
                                <td><img src="<?php echo asset("image/$sayur->foto")?>" style="max-height:40px; max-width: 40px; margin-top:10px;" /> </img> </td>
                                <td>{{$sayur->nama}}</td>
                                <td>{{$sayur->family}}</td>
                                <td>{{$sayur->tanggal_tanam}}</td>
                                <td>{{$sayur->usia}}</td>
                                <td>{{$sayur->hama}}</td>

                                <td>
                                    <form method="POST" action="{{ route('HalamanMonitoring.destroy', $sayur->id) }}" accept-charset="UTF-8">
                                        <input name="_method" type="hidden" value="DELETE">
                                        <input name="_token" type="hidden" value="{{ csrf_token() }}">
                                        <a href="{{route('HalamanMonitoring.edit', $sayur->id)}}" class="btn btn-primary">Edit</a>
                                        <a href="{{route('HalamanMonitoring.show', $sayur->id)}}" class="btn btn-warning">Lihat</a>
                                        <input type="submit" class="btn btn-danger" onclick="return confirm('Anda yakin akan menghapus data ?');" value="Delete">
                                    </form>
                                </td>
                            </tr>
                        @endforeach
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection