@extends('layouts.app')
@section('title','Create Waste')
@include('layouts.select2')

@section('content')
<div class="row">
    <div class="col-md-12">
        <div class="tile">
            <div class="tile-title-w-btn">
                <h3 class="title"><i class="bi bi-list-ul"></i> {{__('lang.new_waste')}}</h3>
                <a href="{{route('wastes.index')}}" class="btn btn-primary" title="{{__('lang.wastes')}}">
                    <i class='bi bi-list'></i>
                </a>
            </div>
            <div class="tile-body">
                <form action="{{route('wastes.store')}}" method="post">
                    @csrf
                    @include('waste.partials._form')
                    <x-buttons.save />
                </form>
                <br>
                @if($lastWaste)
                <div class="d-flex justify-content-between align-items-center">
                    <h3>{{__('lang.last_inserted_waste')}}</h3>
                    @include('waste.partials.actions', ['el' => $lastWaste])
                </div>
                <table class="table table-sm table-striped">
                    <tr>
                        <th>ID</th>
                        <td>{{$lastWaste->id}}</td>
                    </tr>
                    <tr>
                        <th>{{__('lang.book')}}</th>
                        <td>{{$lastWaste->book->title}}</td>
                    </tr>
                    <tr>
                        <th>{{__('lang.waste_type')}}</th>
                        <td>{{$lastWaste->waste_type}}</td>
                    </tr>
                    <tr>
                        <th>{{__('lang.date')}}</th>
                        <td>{{$lastWaste->date}}</td>
                    </tr>
                    <tr>
                        <th>{{__('lang.details')}}</th>
                        <td>{{$lastWaste->details}}</td>
                    </tr>
                </table>
                @endif
            </div>
        </div>
    </div>
</div>
@endsection