<style>
</style>

<x-app-layout>
  <x-slot name="header">
    <h2 class="font-semibold text-xl text-gray-800 leading-tight">
      <i class="fas fa-industry"></i> Aziende
    </h2>
  </x-slot>

  <div class="row justify-content-center mb-4">
    <div class="col-xl-10 col-lg-10">
      <div class="card">
        <div class="card-body">

          {{ $dataTable_azienda->table() }}

          {{ $dataTable_azienda->scripts() }}



        </div>
      </div>
    </div>
  </div>

</x-app-layout>

<script>
$(document).ready(function(){
  $.ajaxSetup({
    headers: {
      'X-CSRF-TOKEN': '{{csrf_token()}}'
    }
  });

  $("#dataTable_azienda").attr('width', '100%');

  // Editor edit
  $("#dataTable_azienda").on('click', 'a#editor_edit', function (e) {
    e.preventDefault();
    window.LaravelDataTables["dataTable_azienda-editor"].edit( $(this).closest('tr'), {
      title: 'Modifica',
      buttons: 'Aggiorna'
    });
  });

  // Editor delete
  $("#dataTable_ddt").on('click', 'a#editor_delete', function (e) {
    e.preventDefault();
    window.LaravelDataTables["dataTable_azienda-editor"].remove( $(this).closest('tr'), {
      title: 'Cancella record',
      message: 'Sei sicuro di voler eliminare il record selezionato?',
      buttons: 'Cancella record'
    } );
  } );
});
</script>
