update
This commit is contained in:
@@ -82,6 +82,18 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
setDefaultDate();
|
||||
checkCurrentLogo();
|
||||
|
||||
// *** FIX 3: Gespeicherten Tab wiederherstellen (oder 'quotes' als Default) ***
|
||||
const savedTab = localStorage.getItem('activeTab') || 'quotes';
|
||||
showTab(savedTab);
|
||||
|
||||
// Hash-basierte Tab-Navigation (z.B. nach OAuth Redirect /#settings)
|
||||
if (window.location.hash) {
|
||||
const hashTab = window.location.hash.replace('#', '');
|
||||
if (['quotes', 'invoices', 'customers', 'settings'].includes(hashTab)) {
|
||||
showTab(hashTab);
|
||||
}
|
||||
}
|
||||
|
||||
// Setup form handlers
|
||||
document.getElementById('customer-form').addEventListener('submit', handleCustomerSubmit);
|
||||
document.getElementById('quote-form').addEventListener('submit', handleQuoteSubmit);
|
||||
@@ -108,6 +120,9 @@ function showTab(tabName) {
|
||||
document.getElementById(`${tabName}-tab`).classList.remove('hidden');
|
||||
document.getElementById(`tab-${tabName}`).classList.add('bg-blue-800');
|
||||
|
||||
// *** FIX 3: Tab-Auswahl persistieren ***
|
||||
localStorage.setItem('activeTab', tabName);
|
||||
|
||||
if (tabName === 'quotes') {
|
||||
loadQuotes();
|
||||
} else if (tabName === 'invoices') {
|
||||
@@ -1113,6 +1128,7 @@ function viewInvoicePDF(id) {
|
||||
window.open(`/api/invoices/${id}/pdf`, '_blank');
|
||||
}
|
||||
|
||||
// *** FIX 2: Verbesserte Erfolgsmeldung mit QBO DocNumber ***
|
||||
async function exportToQBO(id) {
|
||||
if (!confirm('Rechnung wirklich an QuickBooks Online senden?')) return;
|
||||
|
||||
@@ -1127,8 +1143,8 @@ async function exportToQBO(id) {
|
||||
const result = await response.json();
|
||||
|
||||
if (response.ok) {
|
||||
alert(`✅ Erfolg! QBO ID: ${result.qbo_id}`);
|
||||
// Optional: Liste neu laden um Status zu aktualisieren
|
||||
alert(`✅ Erfolg! QBO ID: ${result.qbo_id}, Rechnungsnr: ${result.qbo_doc_number}`);
|
||||
// Liste neu laden um aktualisierte invoice_number anzuzeigen
|
||||
loadInvoices();
|
||||
} else {
|
||||
alert(`❌ Fehler: ${result.error}`);
|
||||
|
||||
Reference in New Issue
Block a user