v4.1.0: DMS email documents, category-specific Nachweis linking, version system
- Save cover email body as DMS document with new 'email' context type - Show email body separately from attachments in email detail view - Add per-category DMS document assignment in quarterly confirmation (Studiennachweis, Einkommenssituation, Vermögenssituation) - Add VERSION file and context processor for automatic version display - Add MCP server, agent system, import/export, and new migrations - Update compose files and production environment template Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -661,6 +661,15 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Daten -->
|
||||
<div class="sidebar-section">
|
||||
<div class="sidebar-heading">Daten</div>
|
||||
<a class="sidebar-link" href="{% url 'stiftung:import_export_hub' %}">
|
||||
<i class="fas fa-exchange-alt"></i>
|
||||
<span>Import & Export</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- System -->
|
||||
<div class="sidebar-section">
|
||||
<div class="sidebar-heading">System</div>
|
||||
@@ -741,7 +750,7 @@
|
||||
<!-- Footer -->
|
||||
<footer class="main-footer">
|
||||
© 2026 van Hees-Theyssen-Vogel'sche Stiftung ·
|
||||
<small>Vision 2026 · v4.0.0</small>
|
||||
<small>Vision 2026 · v{{ APP_VERSION }}</small>
|
||||
</footer>
|
||||
</main>
|
||||
|
||||
@@ -995,5 +1004,464 @@
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
{% if user.is_authenticated and perms.stiftung.can_use_agent %}
|
||||
<!-- ══════════════════════════════════════════════════════════════
|
||||
AI Agent Chat-Widget
|
||||
══════════════════════════════════════════════════════════════ -->
|
||||
<style>
|
||||
#agent-fab {
|
||||
position: fixed;
|
||||
bottom: 1.5rem;
|
||||
right: 1.5rem;
|
||||
z-index: 9000;
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
border-radius: 50%;
|
||||
background: var(--racing-green);
|
||||
color: #fff;
|
||||
border: none;
|
||||
box-shadow: 0 4px 16px rgba(0,0,0,0.25);
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1.25rem;
|
||||
transition: background 0.2s, transform 0.15s;
|
||||
}
|
||||
#agent-fab:hover { background: var(--racing-green-light); transform: scale(1.07); }
|
||||
|
||||
#agent-panel {
|
||||
position: fixed;
|
||||
bottom: 5.5rem;
|
||||
right: 1.5rem;
|
||||
z-index: 9001;
|
||||
width: min(420px, calc(100vw - 2rem));
|
||||
max-height: calc(100vh - 7rem);
|
||||
background: #fff;
|
||||
border-radius: 1rem;
|
||||
box-shadow: 0 8px 40px rgba(0,0,0,0.2);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
transform: translateY(10px) scale(0.97);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.2s, transform 0.2s;
|
||||
}
|
||||
#agent-panel.open {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
pointer-events: all;
|
||||
}
|
||||
|
||||
#agent-header {
|
||||
background: var(--racing-green);
|
||||
color: #fff;
|
||||
padding: 0.75rem 1rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
#agent-header h6 { margin: 0; font-size: 0.9rem; font-weight: 600; flex: 1; }
|
||||
#agent-header button { background: none; border: none; color: rgba(255,255,255,0.7); cursor: pointer; padding: 0 4px; font-size: 1rem; }
|
||||
#agent-header button:hover { color: #fff; }
|
||||
|
||||
#agent-session-bar {
|
||||
background: #f8f9fa;
|
||||
border-bottom: 1px solid #e9ecef;
|
||||
padding: 0.4rem 0.75rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
#agent-session-bar select {
|
||||
flex: 1;
|
||||
font-size: 0.8rem;
|
||||
border: 1px solid #dee2e6;
|
||||
border-radius: 4px;
|
||||
padding: 2px 6px;
|
||||
background: #fff;
|
||||
}
|
||||
#agent-session-bar button { font-size: 0.75rem; white-space: nowrap; }
|
||||
|
||||
#agent-messages {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 0.75rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
min-height: 200px;
|
||||
}
|
||||
|
||||
.agent-msg {
|
||||
max-width: 85%;
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-radius: 0.75rem;
|
||||
font-size: 0.85rem;
|
||||
line-height: 1.5;
|
||||
word-break: break-word;
|
||||
}
|
||||
.agent-msg.user {
|
||||
background: var(--racing-green);
|
||||
color: #fff;
|
||||
align-self: flex-end;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
.agent-msg.assistant {
|
||||
background: #f0f2f5;
|
||||
color: #212529;
|
||||
align-self: flex-start;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
.agent-msg.tool-indicator {
|
||||
background: #fff3cd;
|
||||
color: #856404;
|
||||
align-self: flex-start;
|
||||
font-size: 0.78rem;
|
||||
padding: 0.3rem 0.6rem;
|
||||
}
|
||||
.agent-msg pre { margin: 0; white-space: pre-wrap; font-family: inherit; }
|
||||
.agent-msg code { background: rgba(0,0,0,0.08); border-radius: 3px; padding: 1px 4px; font-size: 0.82em; }
|
||||
|
||||
#agent-input-area {
|
||||
border-top: 1px solid #e9ecef;
|
||||
padding: 0.6rem 0.75rem;
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
#agent-input {
|
||||
flex: 1;
|
||||
border: 1px solid #dee2e6;
|
||||
border-radius: 0.5rem;
|
||||
padding: 0.4rem 0.65rem;
|
||||
font-size: 0.85rem;
|
||||
resize: none;
|
||||
min-height: 36px;
|
||||
max-height: 120px;
|
||||
outline: none;
|
||||
font-family: inherit;
|
||||
}
|
||||
#agent-input:focus { border-color: var(--racing-green); }
|
||||
#agent-send-btn {
|
||||
background: var(--racing-green);
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 0.5rem;
|
||||
padding: 0 0.75rem;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
transition: background 0.15s;
|
||||
align-self: flex-end;
|
||||
height: 36px;
|
||||
}
|
||||
#agent-send-btn:disabled { background: #adb5bd; cursor: not-allowed; }
|
||||
#agent-send-btn:not(:disabled):hover { background: var(--racing-green-light); }
|
||||
|
||||
.agent-typing { display: flex; gap: 4px; align-items: center; padding: 0.5rem 0.75rem; }
|
||||
.agent-typing span {
|
||||
width: 7px; height: 7px; background: #adb5bd;
|
||||
border-radius: 50%; animation: agent-bounce 1s infinite;
|
||||
}
|
||||
.agent-typing span:nth-child(2) { animation-delay: 0.15s; }
|
||||
.agent-typing span:nth-child(3) { animation-delay: 0.3s; }
|
||||
@keyframes agent-bounce {
|
||||
0%,80%,100% { transform: translateY(0); }
|
||||
40% { transform: translateY(-6px); }
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- FAB Button -->
|
||||
<button id="agent-fab" title="AI-Assistent öffnen" onclick="agentToggle()">
|
||||
<i class="fas fa-robot"></i>
|
||||
</button>
|
||||
|
||||
<!-- Chat Panel -->
|
||||
<div id="agent-panel">
|
||||
<div id="agent-header">
|
||||
<i class="fas fa-robot"></i>
|
||||
<h6>RentmeisterAI</h6>
|
||||
<button onclick="agentNewSession()" title="Neue Unterhaltung"><i class="fas fa-plus"></i></button>
|
||||
<button onclick="agentToggle()" title="Schließen"><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
<div id="agent-session-bar">
|
||||
<select id="agent-session-select" onchange="agentLoadSession(this.value)" title="Sitzung wechseln">
|
||||
<option value="">— Neue Unterhaltung —</option>
|
||||
</select>
|
||||
<button class="btn btn-sm btn-outline-danger" onclick="agentDeleteSession()" title="Sitzung löschen">
|
||||
<i class="fas fa-trash-alt"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div id="agent-messages">
|
||||
<div class="agent-msg assistant">
|
||||
Guten Tag! Ich bin RentmeisterAI. Wie kann ich Ihnen helfen?
|
||||
</div>
|
||||
</div>
|
||||
<div id="agent-input-area">
|
||||
<textarea id="agent-input" placeholder="Nachricht eingeben… (Enter = senden)" rows="1"
|
||||
onkeydown="agentKeydown(event)"></textarea>
|
||||
<button id="agent-send-btn" onclick="agentSend()" title="Senden">
|
||||
<i class="fas fa-paper-plane"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
const CSRF = '{{ csrf_token }}';
|
||||
let currentSessionId = null;
|
||||
let isStreaming = false;
|
||||
|
||||
window.agentToggle = function() {
|
||||
const panel = document.getElementById('agent-panel');
|
||||
const isOpen = panel.classList.contains('open');
|
||||
panel.classList.toggle('open');
|
||||
if (!isOpen) {
|
||||
agentLoadSessions();
|
||||
document.getElementById('agent-input').focus();
|
||||
}
|
||||
};
|
||||
|
||||
window.agentNewSession = function() {
|
||||
currentSessionId = null;
|
||||
document.getElementById('agent-session-select').value = '';
|
||||
document.getElementById('agent-messages').innerHTML =
|
||||
'<div class="agent-msg assistant">Neue Unterhaltung gestartet. Wie kann ich helfen?</div>';
|
||||
};
|
||||
|
||||
window.agentKeydown = function(e) {
|
||||
if (e.key === 'Enter' && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
agentSend();
|
||||
}
|
||||
};
|
||||
|
||||
window.agentSend = async function() {
|
||||
if (isStreaming) return;
|
||||
const input = document.getElementById('agent-input');
|
||||
const msg = input.value.trim();
|
||||
if (!msg) return;
|
||||
|
||||
input.value = '';
|
||||
autoResizeTextarea(input);
|
||||
|
||||
appendMessage('user', msg);
|
||||
const typingEl = appendTyping();
|
||||
setSending(true);
|
||||
|
||||
// Seitenkontext: URL + Titel
|
||||
const pageContext = `Seite: ${document.title}\nURL: ${window.location.href}`;
|
||||
|
||||
try {
|
||||
const res = await fetch('/agent/chat/', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': CSRF,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
message: msg,
|
||||
session_id: currentSessionId,
|
||||
page_context: pageContext,
|
||||
}),
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
const err = await res.json().catch(() => ({}));
|
||||
throw new Error(err.error || `HTTP ${res.status}`);
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
currentSessionId = data.session_id;
|
||||
|
||||
// Session-Select aktualisieren
|
||||
updateSessionSelect(data.session_id);
|
||||
|
||||
// SSE-Stream starten
|
||||
typingEl.remove();
|
||||
await agentStream(data.stream_url);
|
||||
|
||||
} catch (e) {
|
||||
typingEl.remove();
|
||||
appendMessage('assistant', `Fehler: ${e.message}`);
|
||||
} finally {
|
||||
setSending(false);
|
||||
}
|
||||
};
|
||||
|
||||
async function agentStream(url) {
|
||||
const msgEl = appendMessage('assistant', '');
|
||||
const contentEl = msgEl.querySelector('.agent-text');
|
||||
|
||||
return new Promise((resolve) => {
|
||||
const es = new EventSource(url);
|
||||
es.onmessage = function(e) {
|
||||
try {
|
||||
const chunk = JSON.parse(e.data);
|
||||
if (chunk.type === 'text') {
|
||||
contentEl.textContent += chunk.content;
|
||||
scrollMessages();
|
||||
} else if (chunk.type === 'tool_start') {
|
||||
appendToolIndicator(chunk.name);
|
||||
} else if (chunk.type === 'done') {
|
||||
es.close();
|
||||
renderMarkdown(contentEl);
|
||||
agentLoadSessions();
|
||||
resolve();
|
||||
} else if (chunk.type === 'error') {
|
||||
contentEl.textContent = `Fehler: ${chunk.message}`;
|
||||
es.close();
|
||||
resolve();
|
||||
}
|
||||
} catch(err) { /* ignore parse errors */ }
|
||||
};
|
||||
es.onerror = function() {
|
||||
es.close();
|
||||
if (!contentEl.textContent) {
|
||||
contentEl.textContent = 'Verbindungsfehler.';
|
||||
}
|
||||
resolve();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function appendMessage(role, text) {
|
||||
const messages = document.getElementById('agent-messages');
|
||||
const div = document.createElement('div');
|
||||
div.className = `agent-msg ${role}`;
|
||||
const span = document.createElement('span');
|
||||
span.className = 'agent-text';
|
||||
span.textContent = text;
|
||||
div.appendChild(span);
|
||||
messages.appendChild(div);
|
||||
scrollMessages();
|
||||
return div;
|
||||
}
|
||||
|
||||
function appendTyping() {
|
||||
const messages = document.getElementById('agent-messages');
|
||||
const div = document.createElement('div');
|
||||
div.className = 'agent-msg assistant agent-typing-wrap';
|
||||
div.innerHTML = '<div class="agent-typing"><span></span><span></span><span></span></div>';
|
||||
messages.appendChild(div);
|
||||
scrollMessages();
|
||||
return div;
|
||||
}
|
||||
|
||||
function appendToolIndicator(toolName) {
|
||||
const messages = document.getElementById('agent-messages');
|
||||
const div = document.createElement('div');
|
||||
div.className = 'agent-msg tool-indicator';
|
||||
div.innerHTML = `<i class="fas fa-cog fa-spin me-1"></i> Werkzeug: <em>${escHtml(toolName)}</em>`;
|
||||
messages.appendChild(div);
|
||||
scrollMessages();
|
||||
}
|
||||
|
||||
function renderMarkdown(el) {
|
||||
// Simple markdown: **bold**, `code`, newlines
|
||||
let html = escHtml(el.textContent)
|
||||
.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
|
||||
.replace(/`([^`]+)`/g, '<code>$1</code>')
|
||||
.replace(/\n/g, '<br>');
|
||||
el.innerHTML = html;
|
||||
}
|
||||
|
||||
function scrollMessages() {
|
||||
const m = document.getElementById('agent-messages');
|
||||
m.scrollTop = m.scrollHeight;
|
||||
}
|
||||
|
||||
function setSending(v) {
|
||||
isStreaming = v;
|
||||
document.getElementById('agent-send-btn').disabled = v;
|
||||
document.getElementById('agent-input').disabled = v;
|
||||
}
|
||||
|
||||
function autoResizeTextarea(el) {
|
||||
el.style.height = 'auto';
|
||||
el.style.height = Math.min(el.scrollHeight, 120) + 'px';
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const input = document.getElementById('agent-input');
|
||||
if (input) input.addEventListener('input', () => autoResizeTextarea(input));
|
||||
});
|
||||
|
||||
window.agentLoadSessions = async function() {
|
||||
try {
|
||||
const res = await fetch('/agent/sessions/');
|
||||
if (!res.ok) return;
|
||||
const data = await res.json();
|
||||
const sel = document.getElementById('agent-session-select');
|
||||
// Keep current value
|
||||
const current = sel.value;
|
||||
sel.innerHTML = '<option value="">— Neue Unterhaltung —</option>';
|
||||
data.sessions.forEach(s => {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = s.id;
|
||||
opt.textContent = (s.title || 'Unterhaltung').substring(0, 40);
|
||||
sel.appendChild(opt);
|
||||
});
|
||||
if (currentSessionId) sel.value = currentSessionId;
|
||||
else if (current) sel.value = current;
|
||||
} catch(e) { /* ignore */ }
|
||||
};
|
||||
|
||||
window.agentLoadSession = async function(sessionId) {
|
||||
if (!sessionId) { agentNewSession(); return; }
|
||||
currentSessionId = sessionId;
|
||||
try {
|
||||
const res = await fetch(`/agent/sessions/${sessionId}/`);
|
||||
if (!res.ok) return;
|
||||
const data = await res.json();
|
||||
const messages = document.getElementById('agent-messages');
|
||||
messages.innerHTML = '';
|
||||
data.messages.forEach(m => {
|
||||
if (m.role === 'tool') return;
|
||||
const div = appendMessage(m.role, m.content);
|
||||
renderMarkdown(div.querySelector('.agent-text'));
|
||||
});
|
||||
if (data.messages.length === 0) {
|
||||
appendMessage('assistant', 'Wie kann ich Ihnen helfen?');
|
||||
}
|
||||
} catch(e) { /* ignore */ }
|
||||
};
|
||||
|
||||
window.agentDeleteSession = async function() {
|
||||
if (!currentSessionId) return;
|
||||
if (!confirm('Diese Unterhaltung wirklich löschen?')) return;
|
||||
try {
|
||||
await fetch(`/agent/sessions/${currentSessionId}/loeschen/`, {
|
||||
method: 'POST',
|
||||
headers: { 'X-CSRFToken': CSRF },
|
||||
});
|
||||
agentNewSession();
|
||||
agentLoadSessions();
|
||||
} catch(e) { /* ignore */ }
|
||||
};
|
||||
|
||||
function updateSessionSelect(id) {
|
||||
const sel = document.getElementById('agent-session-select');
|
||||
let found = false;
|
||||
for (const opt of sel.options) { if (opt.value === id) { found = true; break; } }
|
||||
if (!found) {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = id;
|
||||
opt.textContent = '(aktuelle Unterhaltung)';
|
||||
sel.appendChild(opt);
|
||||
}
|
||||
sel.value = id;
|
||||
}
|
||||
|
||||
function escHtml(s) {
|
||||
return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
@@ -247,6 +247,12 @@
|
||||
<span>Destinatärunterstützungen</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-3 mb-3">
|
||||
<a href="/admin/stiftung/agentconfig/" class="btn btn-outline-warning w-100" target="_blank">
|
||||
<i class="fas fa-robot d-block mb-2 fa-2x"></i>
|
||||
<span>AI Agent Konfiguration</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-3 mb-3">
|
||||
<a href="/admin/" class="btn btn-outline-warning w-100" target="_blank">
|
||||
<i class="fas fa-user-shield d-block mb-2 fa-2x"></i>
|
||||
|
||||
208
app/templates/stiftung/csv_import_mapping.html
Normal file
208
app/templates/stiftung/csv_import_mapping.html
Normal file
@@ -0,0 +1,208 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}CSV Import – Feldzuordnung{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1><i class="fas fa-columns text-primary"></i> Feldzuordnung: {{ import_label }}</h1>
|
||||
<a href="{% url 'stiftung:import_export_hub' %}" class="btn btn-outline-secondary">
|
||||
<i class="fas fa-arrow-left"></i> Zurück
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<i class="fas fa-file-csv"></i>
|
||||
<strong>{{ filename }}</strong> – {{ total_rows }} Datenzeilen erkannt.
|
||||
Ordnen Sie die CSV-Spalten den Datenbankfeldern zu. Nicht zugeordnete Spalten werden übersprungen.
|
||||
</div>
|
||||
|
||||
<form method="post" action="{% url 'stiftung:csv_import_execute' %}">
|
||||
{% csrf_token %}
|
||||
|
||||
<!-- Mapping Table -->
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-header bg-primary text-white">
|
||||
<h5 class="card-title mb-0">
|
||||
<i class="fas fa-project-diagram"></i> Spalten zuordnen
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th style="width: 5%;">#</th>
|
||||
<th style="width: 25%;">CSV-Spalte</th>
|
||||
<th style="width: 5%;"></th>
|
||||
<th style="width: 30%;">Zuordnung</th>
|
||||
<th style="width: 35%;">Vorschau</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for col in header_previews %}
|
||||
<tr>
|
||||
<td class="text-muted">{{ forloop.counter }}</td>
|
||||
<td><code>{{ col.header }}</code></td>
|
||||
<td class="text-center text-muted"><i class="fas fa-arrow-right"></i></td>
|
||||
<td>
|
||||
<select name="mapping_{{ forloop.counter0 }}" class="form-select form-select-sm mapping-select"
|
||||
data-col-index="{{ forloop.counter0 }}">
|
||||
<option value="__skip__">– Überspringen –</option>
|
||||
{% for field in model_fields %}
|
||||
<option value="{{ field.1 }}">
|
||||
{{ field.0 }}{% if field.3 %} *{% endif %}
|
||||
({{ field.2 }})
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<small class="text-muted">{{ col.preview|truncatechars:60 }}</small>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<small class="text-muted">* = Pflichtfeld. Zuordnungen werden automatisch vorgeschlagen und können manuell geändert werden.</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Preview Table -->
|
||||
{% if preview_rows %}
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-header bg-light">
|
||||
<h5 class="card-title mb-0">
|
||||
<i class="fas fa-table"></i> Vorschau (erste {{ preview_rows|length }} Zeilen)
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-striped mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
{% for col in header_previews %}
|
||||
<th><small>{{ col.header }}</small></th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for row in preview_rows %}
|
||||
<tr>
|
||||
{% for cell in row %}
|
||||
<td><small>{{ cell|truncatechars:40 }}</small></td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Import Mode -->
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-header bg-light">
|
||||
<h5 class="card-title mb-0">
|
||||
<i class="fas fa-cog"></i> Import-Modus
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="import_mode" id="mode_skip" value="skip" checked>
|
||||
<label class="form-check-label" for="mode_skip">
|
||||
<strong>Nur neue importieren</strong>
|
||||
<br><small class="text-muted">Bereits vorhandene Einträge werden übersprungen</small>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="import_mode" id="mode_merge" value="merge">
|
||||
<label class="form-check-label" for="mode_merge">
|
||||
<strong>Zusammenführen</strong>
|
||||
<br><small class="text-muted">Vorhandene Einträge werden mit neuen Daten aktualisiert</small>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="import_mode" id="mode_create" value="create">
|
||||
<label class="form-check-label" for="mode_create">
|
||||
<strong>Alle neu anlegen</strong>
|
||||
<br><small class="text-muted">Keine Duplikatprüfung, alle Zeilen als neue Einträge</small>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Actions -->
|
||||
<div class="d-flex justify-content-between">
|
||||
<a href="{% url 'stiftung:import_export_hub' %}" class="btn btn-outline-secondary">
|
||||
<i class="fas fa-times"></i> Abbrechen
|
||||
</a>
|
||||
<button type="submit" class="btn btn-primary btn-lg">
|
||||
<i class="fas fa-upload"></i> {{ total_rows }} Zeilen importieren
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block javascript %}
|
||||
<script>
|
||||
// Auto-apply mapping from server
|
||||
const autoMapping = {{ auto_mapping_json|safe }};
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
for (const [colIdx, fieldName] of Object.entries(autoMapping)) {
|
||||
const select = document.querySelector(`select[name="mapping_${colIdx}"]`);
|
||||
if (select) {
|
||||
for (const opt of select.options) {
|
||||
if (opt.value === fieldName) {
|
||||
opt.selected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Highlight duplicate mappings
|
||||
const selects = document.querySelectorAll('.mapping-select');
|
||||
selects.forEach(sel => {
|
||||
sel.addEventListener('change', highlightDuplicates);
|
||||
});
|
||||
highlightDuplicates();
|
||||
});
|
||||
|
||||
function highlightDuplicates() {
|
||||
const selects = document.querySelectorAll('.mapping-select');
|
||||
const valueCount = {};
|
||||
|
||||
selects.forEach(sel => {
|
||||
const val = sel.value;
|
||||
if (val && val !== '__skip__') {
|
||||
valueCount[val] = (valueCount[val] || 0) + 1;
|
||||
}
|
||||
});
|
||||
|
||||
selects.forEach(sel => {
|
||||
const val = sel.value;
|
||||
if (val && val !== '__skip__' && valueCount[val] > 1) {
|
||||
sel.classList.add('is-invalid');
|
||||
} else {
|
||||
sel.classList.remove('is-invalid');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -101,11 +101,43 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# E-Mail-Dokument (Cover-Email als DMS-Dokument) #}
|
||||
{% if email_dokument %}
|
||||
<div class="card mb-4 border-primary">
|
||||
<div class="card-header bg-primary text-white">
|
||||
<i class="fas fa-envelope me-2"></i>E-Mail als Dokument
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<strong>{{ email_dokument.titel }}</strong>
|
||||
<br><small class="text-muted">{{ email_dokument.get_human_size }} · Erstellt {{ email_dokument.erstellt_am|date:"d.m.Y H:i" }}</small>
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="{% url 'stiftung:dms_download' email_dokument.pk %}" class="btn btn-outline-primary" title="Herunterladen">
|
||||
<i class="fas fa-download me-1"></i>Herunterladen
|
||||
</a>
|
||||
<a href="{% url 'stiftung:dms_detail' email_dokument.pk %}" class="btn btn-outline-secondary" title="Im DMS anzeigen">
|
||||
<i class="fas fa-external-link-alt me-1"></i>Im DMS
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% if anhaenge_dokumente %}
|
||||
<hr class="my-2">
|
||||
<small class="text-muted"><i class="fas fa-paperclip me-1"></i>Diese E-Mail hat {{ anhaenge_dokumente|length }} Anhang/Anhaenge (siehe unten)</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# Anhaenge / DMS-Dokumente #}
|
||||
{% if dms_dokumente %}
|
||||
{% if anhaenge_dokumente %}
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">
|
||||
<i class="fas fa-paperclip me-2"></i>Anhaenge ({{ dms_dokumente|length }})
|
||||
<i class="fas fa-paperclip me-2"></i>Anhaenge ({{ anhaenge_dokumente|length }})
|
||||
{% if email_dokument %}
|
||||
<small class="text-muted ms-2">gehoeren zur obigen E-Mail</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<table class="table mb-0">
|
||||
@@ -118,17 +150,22 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for dok in dms_dokumente %}
|
||||
{% for dok in anhaenge_dokumente %}
|
||||
<tr>
|
||||
<td>{{ dok.dateiname_original|default:dok.titel }}</td>
|
||||
<td><span class="text-muted small">{{ dok.dateityp|default:"–" }}</span></td>
|
||||
<td><span class="text-muted small">{{ dok.get_human_size }}</span></td>
|
||||
<td>
|
||||
{% if dok.datei %}
|
||||
<a href="{% url 'stiftung:dms_download' dok.pk %}" class="btn btn-sm btn-outline-primary">
|
||||
<i class="fas fa-download me-1"></i>Herunterladen
|
||||
</a>
|
||||
{% endif %}
|
||||
<div class="btn-group btn-group-sm">
|
||||
{% if dok.datei %}
|
||||
<a href="{% url 'stiftung:dms_download' dok.pk %}" class="btn btn-outline-primary" title="Herunterladen">
|
||||
<i class="fas fa-download"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
<a href="{% url 'stiftung:dms_detail' dok.pk %}" class="btn btn-outline-secondary" title="Im DMS anzeigen">
|
||||
<i class="fas fa-external-link-alt"></i>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -136,7 +173,7 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
{% elif not email_dokument %}
|
||||
<div class="card mb-4">
|
||||
<div class="card-body text-muted text-center py-3">
|
||||
<i class="fas fa-paperclip me-1"></i>Keine Anhaenge in dieser E-Mail.
|
||||
|
||||
187
app/templates/stiftung/import_export_hub.html
Normal file
187
app/templates/stiftung/import_export_hub.html
Normal file
@@ -0,0 +1,187 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Daten Import & Export - Stiftungsverwaltung{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1><i class="fas fa-exchange-alt text-primary"></i> Daten Import & Export</h1>
|
||||
</div>
|
||||
|
||||
<!-- Export Section -->
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-header bg-success text-white">
|
||||
<h5 class="card-title mb-0">
|
||||
<i class="fas fa-download"></i> CSV Export
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="text-muted mb-3">Exportieren Sie beliebige Daten als CSV-Datei (Semikolon-getrennt, UTF-8 mit BOM für Excel-Kompatibilität).</p>
|
||||
<div class="row">
|
||||
{% for et in export_types %}
|
||||
<div class="col-md-4 col-lg-3 mb-3">
|
||||
<div class="card h-100 border">
|
||||
<div class="card-body text-center">
|
||||
<h6 class="card-title">{{ et.label }}</h6>
|
||||
<p class="text-muted small mb-2">{{ et.count }} Datensätze</p>
|
||||
<a href="{% url 'stiftung:csv_export' %}?type={{ et.key }}"
|
||||
class="btn btn-outline-success btn-sm {% if et.count == 0 %}disabled{% endif %}">
|
||||
<i class="fas fa-download"></i> Exportieren
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Import Section -->
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-header bg-primary text-white">
|
||||
<h5 class="card-title mb-0">
|
||||
<i class="fas fa-upload"></i> CSV Import
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<p class="text-muted mb-3">Importieren Sie Daten aus CSV-Dateien. Im nächsten Schritt können Sie die Spalten Ihrer CSV-Datei den Datenbankfeldern zuordnen.</p>
|
||||
<form method="post" action="{% url 'stiftung:csv_import_upload' %}" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<div class="row">
|
||||
<div class="col-md-5 mb-3">
|
||||
<label for="import_type" class="form-label"><strong>Import-Typ</strong></label>
|
||||
<select name="import_type" id="import_type" class="form-select" required>
|
||||
<option value="">Bitte wählen...</option>
|
||||
{% for it in import_types %}
|
||||
<option value="{{ it.key }}">{{ it.label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-5 mb-3">
|
||||
<label for="csv_file" class="form-label"><strong>CSV-Datei</strong></label>
|
||||
<input type="file" name="csv_file" id="csv_file" class="form-control" accept=".csv" required>
|
||||
</div>
|
||||
<div class="col-md-2 mb-3 d-flex align-items-end">
|
||||
<button type="submit" class="btn btn-primary w-100">
|
||||
<i class="fas fa-arrow-right"></i> Weiter
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="alert alert-info mb-0">
|
||||
<h6><i class="fas fa-info-circle"></i> Hinweise</h6>
|
||||
<ul class="small mb-0">
|
||||
<li>Unterstützte Formate: CSV (Komma oder Semikolon)</li>
|
||||
<li>Zeichenkodierung: UTF-8 oder Latin-1</li>
|
||||
<li>Datumsformate: TT.MM.JJJJ oder JJJJ-MM-TT</li>
|
||||
<li>Bestehende Datensätze werden anhand eindeutiger Felder aktualisiert</li>
|
||||
<li>Im nächsten Schritt ordnen Sie CSV-Spalten den Feldern zu</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Recent Imports -->
|
||||
{% if recent_imports %}
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-light">
|
||||
<h5 class="card-title mb-0">
|
||||
<i class="fas fa-history"></i> Letzte Imports
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-sm">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Typ</th>
|
||||
<th>Dateiname</th>
|
||||
<th>Status</th>
|
||||
<th>Ergebnis</th>
|
||||
<th>Benutzer</th>
|
||||
<th>Datum</th>
|
||||
<th>Details</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for imp in recent_imports %}
|
||||
<tr>
|
||||
<td><span class="badge bg-primary">{{ imp.get_import_type_display }}</span></td>
|
||||
<td>{{ imp.filename }}</td>
|
||||
<td>
|
||||
{% if imp.status == 'completed' %}
|
||||
<span class="badge bg-success"><i class="fas fa-check"></i> OK</span>
|
||||
{% elif imp.status == 'partial' %}
|
||||
<span class="badge bg-warning"><i class="fas fa-exclamation-triangle"></i> Teilweise</span>
|
||||
{% elif imp.status == 'failed' %}
|
||||
<span class="badge bg-danger"><i class="fas fa-times"></i> Fehler</span>
|
||||
{% elif imp.status == 'processing' %}
|
||||
<span class="badge bg-info"><i class="fas fa-spinner fa-spin"></i> Läuft</span>
|
||||
{% else %}
|
||||
<span class="badge bg-secondary">{{ imp.get_status_display }}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if imp.total_rows > 0 %}
|
||||
<small>{{ imp.imported_rows }}/{{ imp.total_rows }} importiert</small>
|
||||
{% if imp.failed_rows > 0 %}
|
||||
<small class="text-danger">({{ imp.failed_rows }} fehlgeschlagen)</small>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<small class="text-muted">-</small>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td><small>{{ imp.created_by|default:"-" }}</small></td>
|
||||
<td><small>{{ imp.started_at|date:"d.m.Y H:i" }}</small></td>
|
||||
<td>
|
||||
{% if imp.error_log %}
|
||||
<button type="button" class="btn btn-outline-warning btn-sm"
|
||||
data-bs-toggle="modal" data-bs-target="#errorModal{{ imp.id }}">
|
||||
<i class="fas fa-eye"></i>
|
||||
</button>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{% if imp.error_log %}
|
||||
<div class="modal fade" id="errorModal{{ imp.id }}" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header bg-warning text-dark">
|
||||
<h5 class="modal-title">
|
||||
<i class="fas fa-exclamation-triangle"></i> Fehlerprotokoll – {{ imp.filename }}
|
||||
</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-info">
|
||||
<strong>{{ imp.imported_rows }}</strong> importiert,
|
||||
<strong>{{ imp.failed_rows }}</strong> fehlgeschlagen
|
||||
von <strong>{{ imp.total_rows }}</strong> Zeilen.
|
||||
</div>
|
||||
<pre class="bg-light p-3 rounded" style="max-height: 400px; overflow-y: auto;"><code>{{ imp.error_log }}</code></pre>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Schließen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -245,13 +245,35 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="mb-0">
|
||||
<div class="mb-3">
|
||||
<label for="{{ form.studiennachweis_bemerkung.id_for_label }}" class="form-label">{{ form.studiennachweis_bemerkung.label }}</label>
|
||||
{{ form.studiennachweis_bemerkung }}
|
||||
{% if form.studiennachweis_bemerkung.help_text %}
|
||||
<small class="form-text text-muted">{{ form.studiennachweis_bemerkung.help_text }}</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if alle_dms_dokumente or nachweis.studiennachweis_dms_dokument %}
|
||||
<div class="mb-0">
|
||||
<label class="form-label"><i class="fas fa-folder-open me-1"></i>Oder: DMS-Dokument zuweisen</label>
|
||||
{% if nachweis.studiennachweis_dms_dokument %}
|
||||
<div class="alert alert-success py-2 mb-2">
|
||||
<i class="fas fa-check-circle me-1"></i>
|
||||
<strong>{{ nachweis.studiennachweis_dms_dokument.titel }}</strong>
|
||||
<small class="text-muted">({{ nachweis.studiennachweis_dms_dokument.get_human_size }})</small>
|
||||
<a href="{% url 'stiftung:dms_download' nachweis.studiennachweis_dms_dokument.pk %}" class="ms-2"><i class="fas fa-download"></i></a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<select class="form-select form-select-sm" name="studiennachweis_dms_id">
|
||||
<option value="">-- DMS-Dokument waehlen --</option>
|
||||
{% for dok in alle_dms_dokumente %}
|
||||
<option value="{{ dok.pk }}" {% if nachweis.studiennachweis_dms_dokument_id == dok.pk %}selected{% endif %}>
|
||||
{{ dok.titel }} ({{ dok.get_kontext_display }}, {{ dok.get_human_size }})
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -278,12 +300,12 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="mb-0">
|
||||
<div class="mb-3">
|
||||
<label for="{{ form.einkommenssituation_datei.id_for_label }}" class="form-label">{{ form.einkommenssituation_datei.label }}</label>
|
||||
{{ form.einkommenssituation_datei }}
|
||||
{% if nachweis.einkommenssituation_datei %}
|
||||
<div class="mt-2">
|
||||
<small class="text-muted">Aktuelle Datei:
|
||||
<small class="text-muted">Aktuelle Datei:
|
||||
<a href="{{ nachweis.einkommenssituation_datei.url }}" target="_blank" class="text-decoration-none">
|
||||
<i class="fas fa-file-pdf text-danger"></i> {{ nachweis.einkommenssituation_datei.name }}
|
||||
</a>
|
||||
@@ -294,6 +316,28 @@
|
||||
<small class="form-text text-muted">{{ form.einkommenssituation_datei.help_text }}</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if alle_dms_dokumente or nachweis.einkommenssituation_dms_dokument %}
|
||||
<div class="mb-0">
|
||||
<label class="form-label"><i class="fas fa-folder-open me-1"></i>Oder: DMS-Dokument zuweisen</label>
|
||||
{% if nachweis.einkommenssituation_dms_dokument %}
|
||||
<div class="alert alert-success py-2 mb-2">
|
||||
<i class="fas fa-check-circle me-1"></i>
|
||||
<strong>{{ nachweis.einkommenssituation_dms_dokument.titel }}</strong>
|
||||
<small class="text-muted">({{ nachweis.einkommenssituation_dms_dokument.get_human_size }})</small>
|
||||
<a href="{% url 'stiftung:dms_download' nachweis.einkommenssituation_dms_dokument.pk %}" class="ms-2"><i class="fas fa-download"></i></a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<select class="form-select form-select-sm" name="einkommenssituation_dms_id">
|
||||
<option value="">-- DMS-Dokument waehlen --</option>
|
||||
{% for dok in alle_dms_dokumente %}
|
||||
<option value="{{ dok.pk }}" {% if nachweis.einkommenssituation_dms_dokument_id == dok.pk %}selected{% endif %}>
|
||||
{{ dok.titel }} ({{ dok.get_kontext_display }}, {{ dok.get_human_size }})
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -336,6 +380,28 @@
|
||||
<small class="form-text text-muted">{{ form.vermogenssituation_datei.help_text }}</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if alle_dms_dokumente or nachweis.vermogenssituation_dms_dokument %}
|
||||
<div class="mb-0">
|
||||
<label class="form-label"><i class="fas fa-folder-open me-1"></i>Oder: DMS-Dokument zuweisen</label>
|
||||
{% if nachweis.vermogenssituation_dms_dokument %}
|
||||
<div class="alert alert-success py-2 mb-2">
|
||||
<i class="fas fa-check-circle me-1"></i>
|
||||
<strong>{{ nachweis.vermogenssituation_dms_dokument.titel }}</strong>
|
||||
<small class="text-muted">({{ nachweis.vermogenssituation_dms_dokument.get_human_size }})</small>
|
||||
<a href="{% url 'stiftung:dms_download' nachweis.vermogenssituation_dms_dokument.pk %}" class="ms-2"><i class="fas fa-download"></i></a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<select class="form-select form-select-sm" name="vermogenssituation_dms_id">
|
||||
<option value="">-- DMS-Dokument waehlen --</option>
|
||||
{% for dok in alle_dms_dokumente %}
|
||||
<option value="{{ dok.pk }}" {% if nachweis.vermogenssituation_dms_dokument_id == dok.pk %}selected{% endif %}>
|
||||
{{ dok.titel }} ({{ dok.get_kontext_display }}, {{ dok.get_human_size }})
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -374,6 +440,66 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- DMS-Dokumente als Nachweise verknuepfen -->
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header bg-dark text-white">
|
||||
<h5 class="card-title mb-0">
|
||||
<i class="fas fa-folder-open me-2"></i>Dokumente aus dem DMS verknuepfen
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="small text-muted mb-3">
|
||||
Waehlen Sie Dokumente aus dem DMS von {{ destinataer.get_full_name }}, die als Nachweise fuer dieses Quartal dienen sollen.
|
||||
</p>
|
||||
|
||||
{% if verknuepfte_nachweis_dokumente %}
|
||||
<div class="mb-3">
|
||||
<label class="form-label"><strong>Bereits verknuepfte Dokumente:</strong></label>
|
||||
<div class="list-group list-group-flush">
|
||||
{% for dok in verknuepfte_nachweis_dokumente %}
|
||||
<div class="list-group-item d-flex justify-content-between align-items-center px-0">
|
||||
<div>
|
||||
<i class="fas fa-file me-1 text-muted"></i>
|
||||
<strong>{{ dok.titel }}</strong>
|
||||
<span class="badge bg-secondary ms-1">{{ dok.get_kontext_display }}</span>
|
||||
<br><small class="text-muted">{{ dok.dateiname_original }} ({{ dok.get_human_size }})</small>
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="{% url 'stiftung:dms_download' dok.pk %}" class="btn btn-outline-primary" title="Herunterladen"><i class="fas fa-download"></i></a>
|
||||
<button type="submit" name="entferne_dms_dokument" value="{{ dok.pk }}" class="btn btn-outline-danger" title="Verknuepfung entfernen">
|
||||
<i class="fas fa-unlink"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if verfuegbare_dms_dokumente %}
|
||||
<div class="mb-0">
|
||||
<label class="form-label"><strong>Verfuegbare Dokumente hinzufuegen:</strong></label>
|
||||
<select class="form-select form-select-sm" name="dms_dokument_hinzufuegen" id="dms_dokument_hinzufuegen">
|
||||
<option value="">-- Dokument aus dem DMS waehlen --</option>
|
||||
{% for dok in verfuegbare_dms_dokumente %}
|
||||
<option value="{{ dok.pk }}">
|
||||
{{ dok.titel }} ({{ dok.get_kontext_display }}, {{ dok.get_human_size }})
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<small class="form-text text-muted mt-1 d-block">
|
||||
Waehlen Sie ein Dokument und klicken Sie auf "Speichern", um es als Nachweis zu verknuepfen.
|
||||
</small>
|
||||
</div>
|
||||
{% elif not verknuepfte_nachweis_dokumente %}
|
||||
<div class="text-center text-muted py-2">
|
||||
<i class="fas fa-info-circle me-1"></i>Keine DMS-Dokumente fuer {{ destinataer.get_full_name }} vorhanden.
|
||||
<br><small><a href="{% url 'stiftung:dms_upload' %}?destinataer={{ destinataer.pk }}" class="text-decoration-none">Dokument hochladen</a></small>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Internal Notes (Staff Only) -->
|
||||
{% if user.is_staff %}
|
||||
<div class="card shadow mb-4">
|
||||
|
||||
Reference in New Issue
Block a user