<div class="card card-primary">
    <div class="card-header">
        <h3 class="card-title">Note</h3>
    </div>
    <div class="card-body">
        <div class="row">
            <table class="table table-hover text-nowrap">
                <thead>
                    <tr>
                        <th>Data</th>
                        <th>Creata da</th>
                        <th>Nota</th>
                        <th style="width:150px">&nbsp;</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach ($notes as $note)
                        <tr>
                            <td>{{ date('d/m/Y H:i', strtotime($note->created)) }}
                            </td>
                            <td></td>
                            <td>{{ $note->text }}</td>
                            <td><button onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()"
                                    wire:click.prevent="removeNote({{ $note->id }})" type="button"
                                    class="btn btn-success btn-block"><i
                                        class="fa fa-trash"></i>&nbsp;Elimina</button>
                            </td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
        <div class="row">
            <textarea class="form-control" rows="5" wire:model="noteText"></textarea>
            @if (!$this->validated)
                <button type="button" class="btn btn-primary mt-2"
                    wire:click.prevent="addNote()">Aggiungi</button>
            @endif
        </div>
    </div>
</div>
