@extends('layouts.main')

@section('title')
Anagrafica
@stop

{{-- Page content --}}
@section('content')

<section class="content-header">
                <h1>Anagrafica</h1>
                <ol class="breadcrumb">
                    <li>
                        <a href="{{ route('home') }}">
                            <i class="livicon" data-name="home" data-size="14" data-color="#000"></i>
                            Home
                        </a>
                    </li>
                    <li>
                        <a href="{{ URL::to('anagrafica') }}">
                            Anagrafica
                        </a>
                    </li>
                    <li class="active">Lista</li>
                </ol>
            </section>
            <section class="content">

        


<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    @if(Session::has('ok_message'))
        <div class="alert alert-success">{{Session::get('ok_message')}}</div>
    @endif
    
    <label>
        <a class="btn btn-success" href="/anagrafica/create"><span class="glyphicon glyphicon-plus-sign"></span> Aggiungi</a>
    </label>
    
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>Tipo</th>
            <th>Ragione sociale</th>
            <th>Nome</th>
            <th>Cognome</th>
            <th>Email</th>
            <th>Telefono</th>
            <th>Azioni</th>
        </tr>
        </thead>

        <tbody>
            @foreach($listaAnagrafica as $ln)
            <tr>
            <td>{{$ln->tipo['nome']}}</td>
            <td>{{$ln['ragione_sociale']}}</td>
            <td>{{$ln['nome']}}</td>
            <td>{{$ln['cognome']}}</td>
            <td>{{$ln['email']}}</td>
            <td>{{$ln['telefono']}}</td>
            <td>
                
                <a class="btn btn-sm btn-info" href="/anagrafica/{{$ln['id']}}" title="Visualizza"><span class="glyphicon glyphicon-search"></span></a>
                <a class="btn btn-sm btn-warning" href="/anagrafica/{{$ln['id']}}/edit" title="Modifica"><span class="glyphicon glyphicon-edit"></span></a>

            {!! Form::open([
                'method' => 'DELETE',
                'route' => ['anagrafica.destroy', $ln['id']],
                'onsubmit' => 'return confirm("Sei sicuro di eliminare il record?");',
                'style' => 'display: inline'
                
            ]) !!}
            <button class="btn btn-sm btn-danger" title="Cancella"><span class="glyphicon glyphicon-remove"></span></button>
            {!! Form::close() !!}                

            </td>
            </tr>
            @endforeach
        </tbody>
    </table>
</div>

                
            </section>
@stop

@push('scripts')
<script>
</script>
@endpush