@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">{{ __('Dashboard') }}<div class="d-flex flex-row-reverse bd-highlight"><a href="{{ route('home.create') }}" class="btn btn-primary">Nouvo Tenant</a></div></div>

                <div class="card-body">
                    @if (session('status'))
                        <div class="alert alert-success" role="alert">
                            {{ session('status') }}
                        </div>
                    @endif
                        @foreach ($tenants as $tenant)
                            <div class="card">
                                <div class="card-header">ID: {{ $tenant->id }}</div>
                                <div class="card-body">
                                    <p>Creato il: {{ $tenant->created_at }}</p>
                                    <p>Aggiornato il: {{ $tenant->updated_at }}</p>
                                    <a href="{{ route('backup', $tenant->id) }}" class="btn btn-primary">Backup</a>
                                </div>
                                <div class="card-footer d-flex flex-row-reverse bd-highlight">
                                    <a href="{{ route('home.show', $tenant->id) }}" class="btn btn-primary">Visualizza</a>
                                    <a href="{{ route('home.edit', $tenant->id) }}" class="btn btn-secondary">Modifica</a>
                                    <form action="{{ route('home.destroy', $tenant->id) }}" method="POST" class="d-inline">
                                        @csrf
                                        @method('DELETE')
                                        <button type="submit" class="btn btn-danger">Elimina</button>
                                    </form>
                                </div>
                            </div>

                        @endforeach
                    {{ __('You are logged in!') }}
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
