@component('admin/layouts/main')
  @slot('main')
    <div class="flex justify-between items-center mb-6">
      <h1 class="text-2xl font-bold">Expériences Professionnelles</h1>
      <a href="/admin/experiences/create" class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700">
        Nouvelle expérience
      </a>
    </div>

    <div class="bg-white rounded shadow overflow-hidden">
      <table class="w-full">
        <thead class="bg-gray-50">
          <tr>
            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Nom</th>
            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Lieu</th>
            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Période</th>
            <th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
          </tr>
        </thead>
        <tbody class="divide-y divide-gray-200">
          @each(experience in experiences)
            <tr>
              <td class="px-6 py-4 whitespace-nowrap">
                <div class="text-sm font-medium text-gray-900">{{ experience.name }}</div>
              </td>
              <td class="px-6 py-4 whitespace-nowrap">
                <div class="text-sm text-gray-500">{{ experience.place || '-' }}</div>
              </td>
              <td class="px-6 py-4 whitespace-nowrap">
                <div class="text-sm text-gray-500">
                  {{ experience.start.toFormat('MM/yyyy') }} - {{ experience.end ? experience.end.toFormat('MM/yyyy') : 'En cours' }}
                </div>
              </td>
              <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
                <a href="/admin/experiences/{{ experience.id }}/edit" class="text-indigo-600 hover:text-indigo-900 mr-4">Modifier</a>
                <form action="/admin/experiences/{{ experience.id }}/delete" method="POST" class="inline" onsubmit="return confirm('Êtes-vous sûr ?')">
                  {{{ csrfField() }}}
                  <button type="submit" class="text-red-600 hover:text-red-900">Supprimer</button>
                </form>
              </td>
            </tr>
          @endeach
        </tbody>
      </table>
    </div>
  @endslot
@end
