Persoenliche Angaben unter Vorlagen statt hardcoded/Settings-Modal
- settings-Tabelle um email/telefon/ort/webseite/geburtsdatum erweitert (CREATE + ALTER-Migration + Default-INSERT) - Vorlagen-Seite: neuer Bereich "Persoenliche Angaben" (8 Felder), POST /vorlagen/persoenlich; Settings-Modal + Zahnrad-Button entfernt - Generierung: Kontakt kommt verbindlich aus den Settings (buildHeader laesst gespeicherte Werte ueber die KI-Extraktion gewinnen), bewerber- Fakten + Prompt angepasst; Design-Vorschau zeigt echte Kontaktdaten - main.js: Settings-Modal-Handling entfernt; /api/settings bleibt bestehen Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -9,29 +9,24 @@ const sunIcon = document.getElementById('sunIcon');
|
||||
const moonIcon = document.getElementById('moonIcon');
|
||||
|
||||
// Modal Elements
|
||||
const settingsModal = document.getElementById('settingsModal');
|
||||
const applicationModal = document.getElementById('applicationModal');
|
||||
const deleteModal = document.getElementById('deleteModal');
|
||||
const pdfExportModal = document.getElementById('pdfExportModal');
|
||||
|
||||
// Form Elements
|
||||
const settingsForm = document.getElementById('settingsForm');
|
||||
const applicationForm = document.getElementById('applicationForm');
|
||||
const pdfExportForm = document.getElementById('pdfExportForm');
|
||||
const filterForm = document.getElementById('filterForm');
|
||||
|
||||
// Button Elements
|
||||
const settingsBtn = document.getElementById('settingsBtn');
|
||||
const addApplicationBtn = document.getElementById('addApplicationBtn');
|
||||
const exportPdfBtn = document.getElementById('exportPdfBtn');
|
||||
|
||||
// Close Modal Buttons
|
||||
const closeSettingsModal = document.getElementById('closeSettingsModal');
|
||||
const closeApplicationModal = document.getElementById('closeApplicationModal');
|
||||
const closeDeleteModal = document.getElementById('closeDeleteModal');
|
||||
const closePdfModal = document.getElementById('closePdfModal');
|
||||
|
||||
const cancelSettings = document.getElementById('cancelSettings');
|
||||
const cancelApplication = document.getElementById('cancelApplication');
|
||||
const cancelDelete = document.getElementById('cancelDelete');
|
||||
const cancelPdfExport = document.getElementById('cancelPdfExport');
|
||||
@@ -96,51 +91,6 @@ function resetApplicationForm() {
|
||||
currentApplicationId = null;
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// Settings Management
|
||||
// ============================================
|
||||
|
||||
function loadSettings() {
|
||||
fetch('/api/settings')
|
||||
.then(response => response.json())
|
||||
.then(settings => {
|
||||
if (settings) {
|
||||
document.getElementById('userName').value = settings.name || '';
|
||||
document.getElementById('userAddress').value = settings.adresse || '';
|
||||
document.getElementById('customerNumber').value = settings.kundennummer || '';
|
||||
}
|
||||
})
|
||||
.catch(error => console.error('Error loading settings:', error));
|
||||
}
|
||||
|
||||
function saveSettings(event) {
|
||||
event.preventDefault();
|
||||
|
||||
const formData = new FormData(settingsForm);
|
||||
const settings = {
|
||||
name: formData.get('name'),
|
||||
adresse: formData.get('adresse'),
|
||||
kundennummer: formData.get('kundennummer')
|
||||
};
|
||||
|
||||
fetch('/api/settings', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(settings)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
hideModal(settingsModal);
|
||||
// Refresh page to update settings in header
|
||||
location.reload();
|
||||
}
|
||||
})
|
||||
.catch(error => console.error('Error saving settings:', error));
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// Application Management (CRUD)
|
||||
// ============================================
|
||||
@@ -723,15 +673,6 @@ function loadPdfLibraries() {
|
||||
// Dark Mode Toggle
|
||||
darkModeToggle.addEventListener('click', toggleDarkMode);
|
||||
|
||||
// Settings Modal
|
||||
settingsBtn.addEventListener('click', () => {
|
||||
loadSettings();
|
||||
showModal(settingsModal);
|
||||
});
|
||||
closeSettingsModal.addEventListener('click', () => hideModal(settingsModal));
|
||||
cancelSettings.addEventListener('click', () => hideModal(settingsModal));
|
||||
settingsForm.addEventListener('submit', saveSettings);
|
||||
|
||||
// Application Modal
|
||||
addApplicationBtn.addEventListener('click', openAddApplicationModal);
|
||||
closeApplicationModal.addEventListener('click', () => {
|
||||
@@ -779,7 +720,6 @@ document.addEventListener('click', (e) => {
|
||||
|
||||
// Close modals when clicking outside
|
||||
document.addEventListener('click', (e) => {
|
||||
if (e.target === settingsModal) hideModal(settingsModal);
|
||||
if (e.target === applicationModal) {
|
||||
hideModal(applicationModal);
|
||||
resetApplicationForm();
|
||||
@@ -791,7 +731,6 @@ document.addEventListener('click', (e) => {
|
||||
// Close modals with Escape key
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Escape') {
|
||||
if (!settingsModal.classList.contains('hidden')) hideModal(settingsModal);
|
||||
if (!applicationModal.classList.contains('hidden')) {
|
||||
hideModal(applicationModal);
|
||||
resetApplicationForm();
|
||||
|
||||
Reference in New Issue
Block a user