Choose enclosed attachments before generating; drop instant-generate

The generate form now lets the user pick which extra attachments
(basis_anhaenge) to enclose — none selected by default. Only the chosen
ones are attached, and their names are passed to the LLM so the cover
letter's "Anlagen" list and wording reflect exactly what is enclosed.

Job offers keep only "Als Bewerbung übernehmen" (draft first); the
"Übernehmen & KI-Unterlagen" button and its route are removed.

REST API: POST /applications/:id/generate accepts an optional `anlagen`
array of attachment IDs (Swagger updated).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-04 17:36:14 +02:00
co-authored by Claude Opus 4.8
parent 360e04d677
commit 26872ece08
6 changed files with 77 additions and 43 deletions
+31 -1
View File
@@ -233,7 +233,37 @@
<textarea name="llm_notizen" rows="4"
class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-800 dark:text-white leading-relaxed"
placeholder="z. B.&#10;Musterfirma GmbH&#10;Musterstraße 12&#10;45128 Essen&#10;Ansprechpartner: Frau Müller"><%= application.llm_notizen || '' %></textarea>
<div class="flex justify-end mt-3">
<!-- Optional extra attachments to enclose (none by default). -->
<div class="mt-4">
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Zusätzliche Anlagen</label>
<% if (basisAnhaenge && basisAnhaenge.length) { %>
<p class="text-xs text-gray-500 dark:text-gray-400 mb-2">
Wähle aus, welche Anlagen (z. B. Zeugnisse) mitgeschickt werden. Standardmäßig
ist nichts ausgewählt; die Auswahl wird auch im Anschreiben unter „Anlagen“ berücksichtigt.
</p>
<div class="space-y-1.5">
<% basisAnhaenge.forEach(function(ba){ %>
<label class="flex items-center gap-2 text-sm text-gray-700 dark:text-gray-200">
<input type="checkbox" name="anlage" value="<%= ba.id %>"
class="rounded border-gray-300 dark:border-gray-600 text-blue-600">
<%= ba.name || ba.dateiname %>
<% if (ba.name && ba.dateiname && ba.name !== ba.dateiname) { %>
<span class="text-xs text-gray-400">(<%= ba.dateiname %>)</span>
<% } %>
</label>
<% }); %>
</div>
<% } else { %>
<p class="text-xs text-gray-400 dark:text-gray-500">
Keine zusätzlichen Anlagen hinterlegt. Unter
<a href="/vorlagen" class="text-blue-600 dark:text-blue-400 hover:underline">Vorlagen</a>
kannst du statische Anlagen (z. B. Zeugnisse) hochladen.
</p>
<% } %>
</div>
<div class="flex justify-end mt-4">
<button type="submit" <%= genStatus === 'ausstehend' ? 'disabled' : '' %>
class="inline-flex items-center gap-1.5 px-4 py-2 text-sm bg-blue-600 hover:bg-blue-700 disabled:opacity-50 text-white rounded-md transition-colors">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+3 -11
View File
@@ -143,20 +143,12 @@
Zur Bewerbung
</a>
<% } else { %>
<form action="/jobangebote/<%= j.id %>/uebernehmen-generieren" method="POST">
<button type="submit"
class="inline-flex items-center justify-center gap-1.5 px-3 py-1.5 text-xs bg-green-600 hover:bg-green-700 text-white rounded-md transition-colors w-full"
title="Bewerbung anlegen und sofort KI-Unterlagen (Anschreiben + Lebenslauf) generieren">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"></path></svg>
Übernehmen &amp; KI-Unterlagen
</button>
</form>
<form action="/jobangebote/<%= j.id %>/uebernehmen" method="POST">
<button type="submit"
class="inline-flex items-center justify-center gap-1.5 px-3 py-1.5 text-xs border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors w-full"
title="Nur einen Bewerbungs-Entwurf anlegen (ohne KI-Generierung)">
class="inline-flex items-center justify-center gap-1.5 px-3 py-1.5 text-xs bg-green-600 hover:bg-green-700 text-white rounded-md transition-colors w-full"
title="Aus diesem Angebot einen Bewerbungs-Entwurf anlegen">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path></svg>
Nur als Entwurf
Als Bewerbung übernehmen
</button>
</form>
<% } %>