@component('admin/layouts/main')
  @slot('main')
    <h1 class="text-2xl font-bold mb-6">{{ experience ? 'Modifier l\'expérience' : 'Nouvelle expérience' }}</h1>
    <form action="{{ experience ? `/admin/experiences/${experience.id}` : '/admin/experiences' }}" method="post" class="bg-white p-6 rounded shadow max-w-2xl">
      {{{ csrfField() }}}
      <div class="space-y-4">
        <div>
          <label for="name" class="block text-sm font-medium text-gray-700 mb-1">Nom / Titre</label>
          <input type="text" name="name" id="name" value="{{ experience?.name || '' }}" required
            class="w-full px-3 py-2 border rounded" />
        </div>
        <div>
          <label for="place" class="block text-sm font-medium text-gray-700 mb-1">Lieu / Entreprise</label>
          <input type="text" name="place" id="place" value="{{ experience?.place || '' }}"
            class="w-full px-3 py-2 border rounded" />
        </div>
        <div class="grid grid-cols-2 gap-4">
          <div>
            <label for="start" class="block text-sm font-medium text-gray-700 mb-1">Date de début</label>
            <input type="date" name="start" id="start" value="{{ experience?.start ? experience.start.toISODate() : '' }}" required
              class="w-full px-3 py-2 border rounded" />
          </div>
          <div>
            <label for="end" class="block text-sm font-medium text-gray-700 mb-1">Date de fin</label>
            <input type="date" name="end" id="end" value="{{ experience?.end ? experience.end.toISODate() : '' }}"
              class="w-full px-3 py-2 border rounded" />
            <p class="text-xs text-gray-500 mt-1">Laisser vide pour "En cours"</p>
          </div>
        </div>
        <div>
          <label for="missions" class="block text-sm font-medium text-gray-700 mb-1">Missions / Description</label>
          <textarea name="missions" id="missions" rows="5" class="w-full px-3 py-2 border rounded">{{ experience?.missions || '' }}</textarea>
        </div>
        <button type="submit" class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700">
          Enregistrer
        </button>
      </div>
    </form>
  @endslot
@end
