@php
$configData = Helper::appClasses();
@endphp

@extends('layouts/layoutMaster')

@section('title', 'Config')

@section('vendor-style')
@vite([
'resources/assets/vendor/libs/datatables-bs5/datatables.bootstrap5.scss',
'resources/assets/vendor/libs/datatables-buttons-bs5/buttons.bootstrap5.scss',
'resources/assets/vendor/libs/flatpickr/flatpickr.scss',
'resources/assets/vendor/libs/@form-validation/form-validation.scss'
])
@endsection

<!-- Vendor Scripts -->
@section('vendor-script')
@vite([
'resources/assets/vendor/libs/moment/moment.js',
'resources/assets/vendor/libs/flatpickr/flatpickr.js',
'resources/assets/vendor/libs/@form-validation/popular.js',
'resources/assets/vendor/libs/@form-validation/bootstrap5.js',
'resources/assets/vendor/libs/@form-validation/auto-focus.js'
])
@endsection

@section('content')
<div class="row justify-content-center">
  <div class="col-xxl-10 col-xl-10 col-md-6 mb-4">
    <div class="card">
      <div class="card-header pb-0"><h5 class="card-title mb-0">Token</h5></div>
      <div class="card-body">
        <button class="btn btn-primary" onclick="generaToken()">Genera Token</button>

        <span id="tokenEventi"></span>

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

@endsection

@section('page-script')


<script type="module">
</script>

<script>
function generaToken(){
  $.ajax({
    type: "POST",
    async: false,
    dataType: 'json',
    url: "{{ route('config.createToken') }}",
    data: {
      _token : "{{csrf_token()}}",
    },
    success: function(data){
      $('#tokenEventi').text(data['token']);
    },
    error: function(XMLHttpRequest, textStatus, exception) { alert("Ajax failure\n" + XMLHttpRequest.responseText + "\n" + exception); },
  });
}
</script>
@endsection
