Initial Codes
This commit is contained in:
@@ -0,0 +1,234 @@
|
||||
/* QBO Excel Sync - Modern Web Interface Styles */
|
||||
|
||||
:root {
|
||||
--primary: #2563eb;
|
||||
--primary-dark: #1d4ed8;
|
||||
--secondary: #64748b;
|
||||
--success: #059669;
|
||||
--success-light: #d1fae5;
|
||||
--warning: #d97706;
|
||||
--warning-light: #fef3c7;
|
||||
--danger: #dc2626;
|
||||
--danger-light: #fee2e2;
|
||||
--bg: #f8fafc;
|
||||
--bg-card: #ffffff;
|
||||
--border: #e2e8f0;
|
||||
--text: #1e293b;
|
||||
--text-muted: #64748b;
|
||||
--shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
|
||||
--shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
|
||||
--shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
|
||||
--radius: 8px;
|
||||
--radius-lg: 12px;
|
||||
--font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
--font-mono: 'JetBrains Mono', monospace;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }
|
||||
|
||||
/* Header */
|
||||
.main-header { background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%); color: white; padding: 16px 24px; }
|
||||
.header-content { max-width: 1400px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
|
||||
.logo-section { display: flex; align-items: center; gap: 16px; }
|
||||
.title-group h1 { font-size: 20px; font-weight: 700; }
|
||||
.title-group .subtitle { font-size: 13px; opacity: 0.8; }
|
||||
.header-status { display: flex; align-items: center; gap: 12px; }
|
||||
.connection-status { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: rgba(255,255,255,0.15); border-radius: 20px; font-size: 13px; }
|
||||
.connection-status.connected { background: rgba(5,150,105,0.3); }
|
||||
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
|
||||
.environment-badge { padding: 4px 12px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
|
||||
.environment-badge.sandbox { background: var(--warning); }
|
||||
.environment-badge.production { background: var(--success); }
|
||||
|
||||
/* Navigation */
|
||||
.main-nav { background: var(--bg-card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
|
||||
.nav-content { max-width: 1400px; margin: 0 auto; display: flex; gap: 4px; padding: 0 24px; }
|
||||
.nav-link { display: flex; align-items: center; gap: 8px; padding: 16px 20px; color: var(--text-muted); text-decoration: none; font-weight: 500; font-size: 14px; border-bottom: 2px solid transparent; transition: all 0.2s; }
|
||||
.nav-link:hover { color: var(--text); background: var(--bg); }
|
||||
.nav-link.active { color: var(--primary); border-bottom-color: var(--primary); }
|
||||
|
||||
/* Main Content */
|
||||
.main-content { max-width: 1400px; margin: 0 auto; padding: 24px; }
|
||||
.page-header { margin-bottom: 24px; }
|
||||
.page-header h2 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
|
||||
.page-header p { color: var(--text-muted); font-size: 15px; }
|
||||
|
||||
/* Cards */
|
||||
.card { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 20px; }
|
||||
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
|
||||
.card-header h3 { font-size: 16px; font-weight: 600; }
|
||||
.card-body { padding: 20px; }
|
||||
|
||||
/* Forms */
|
||||
.form { display: flex; flex-direction: column; gap: 16px; }
|
||||
.form-group { display: flex; flex-direction: column; gap: 6px; }
|
||||
.form-group label { font-size: 14px; font-weight: 500; }
|
||||
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
|
||||
input[type="text"], input[type="password"], input[type="number"], textarea, select { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; font-family: var(--font); transition: border-color 0.2s; }
|
||||
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
|
||||
small { font-size: 12px; color: var(--text-muted); }
|
||||
.checkbox-label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
|
||||
.checkbox-label input { width: 18px; height: 18px; }
|
||||
|
||||
/* Buttons */
|
||||
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border: none; border-radius: var(--radius); font-size: 14px; font-weight: 600; font-family: var(--font); cursor: pointer; transition: all 0.2s; }
|
||||
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%); color: white; }
|
||||
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow); }
|
||||
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
|
||||
.btn-secondary:hover:not(:disabled) { background: var(--border); }
|
||||
.btn-danger { background: var(--danger); color: white; }
|
||||
.btn-sm { padding: 6px 12px; font-size: 13px; }
|
||||
.btn-icon { padding: 8px; }
|
||||
.button-group { display: flex; gap: 12px; flex-wrap: wrap; }
|
||||
.actions-row { display: flex; justify-content: flex-end; gap: 12px; }
|
||||
|
||||
/* Tables */
|
||||
.table-container { overflow-x: auto; }
|
||||
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
|
||||
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
|
||||
.data-table th { background: var(--bg); font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; }
|
||||
.data-table tbody tr:hover { background: var(--bg); }
|
||||
.data-table input, .data-table select { width: 100%; padding: 6px 10px; font-size: 13px; }
|
||||
.data-table tr.error td { background: var(--danger-light); }
|
||||
.data-table tr.warning td { background: var(--warning-light); }
|
||||
|
||||
/* Tabs */
|
||||
.tabs-header { display: flex; border-bottom: 1px solid var(--border); padding: 0 20px; }
|
||||
.tab-btn { padding: 12px 20px; background: none; border: none; border-bottom: 2px solid transparent; font-size: 14px; font-weight: 500; color: var(--text-muted); cursor: pointer; }
|
||||
.tab-btn:hover { color: var(--text); }
|
||||
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
|
||||
.tab-content { display: none; padding: 20px; }
|
||||
.tab-content.active { display: block; }
|
||||
.tab-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
|
||||
|
||||
/* File Upload */
|
||||
.file-upload-area { border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 40px; text-align: center; cursor: pointer; transition: all 0.2s; }
|
||||
.file-upload-area:hover, .file-upload-area.dragover { border-color: var(--primary); background: rgba(37,99,235,0.05); }
|
||||
.upload-link { color: var(--primary); font-weight: 500; }
|
||||
.file-info { display: flex; align-items: center; gap: 16px; padding: 16px; background: var(--bg); border-radius: var(--radius); margin-top: 16px; }
|
||||
.file-details { flex: 1; }
|
||||
.file-name { font-weight: 600; display: block; }
|
||||
.file-meta { font-size: 13px; color: var(--text-muted); }
|
||||
|
||||
/* Progress */
|
||||
.progress-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
|
||||
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary) 0%, #7c3aed 100%); border-radius: 4px; width: 50%; animation: pulse 1.5s ease-in-out infinite; }
|
||||
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
|
||||
.progress-section { margin-bottom: 20px; }
|
||||
.progress-text { font-size: 13px; color: var(--text-muted); display: block; margin-top: 8px; }
|
||||
|
||||
/* Validation */
|
||||
.validation-summary { margin-bottom: 20px; }
|
||||
.validation-stats { display: flex; gap: 24px; padding: 16px; background: var(--bg); border-radius: var(--radius); }
|
||||
|
||||
/* Log Output */
|
||||
.log-output { background: #1e293b; color: #e2e8f0; font-family: var(--font-mono); font-size: 12px; padding: 16px; border-radius: var(--radius); max-height: 200px; overflow-y: auto; }
|
||||
.log-output .log-info { color: #60a5fa; }
|
||||
.log-output .log-warning { color: #fbbf24; }
|
||||
.log-output .log-error { color: #f87171; }
|
||||
|
||||
/* Alerts */
|
||||
.alert { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border-radius: var(--radius); margin-bottom: 20px; }
|
||||
.alert-warning { background: var(--warning-light); color: #92400e; }
|
||||
.alert a { color: inherit; font-weight: 600; }
|
||||
|
||||
/* Dashboard */
|
||||
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 32px; }
|
||||
.stat-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 24px; display: flex; gap: 16px; border: 1px solid var(--border); }
|
||||
.stat-card.connected .stat-icon { color: var(--success); background: var(--success-light); }
|
||||
.stat-card.disconnected .stat-icon { color: var(--danger); background: var(--danger-light); }
|
||||
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; background: var(--bg); }
|
||||
.stat-content h3 { font-size: 13px; color: var(--text-muted); font-weight: 500; }
|
||||
.stat-value { font-size: 24px; font-weight: 700; }
|
||||
.section { margin-bottom: 32px; }
|
||||
.section-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
|
||||
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
|
||||
.action-card { display: flex; align-items: center; gap: 16px; padding: 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); text-decoration: none; color: var(--text); transition: all 0.2s; }
|
||||
.action-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
|
||||
.action-card.primary { background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%); color: white; border: none; }
|
||||
.action-card.primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
|
||||
.action-icon { width: 48px; height: 48px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.2); }
|
||||
.action-content { flex: 1; }
|
||||
.action-content h4 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
|
||||
.action-content p { font-size: 13px; opacity: 0.8; }
|
||||
.data-types-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
|
||||
.data-type-card { padding: 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); text-align: center; }
|
||||
.data-type-icon { width: 48px; height: 48px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
|
||||
.data-type-icon.check { background: #dbeafe; color: #2563eb; }
|
||||
.data-type-icon.invoice { background: #d1fae5; color: #059669; }
|
||||
.data-type-icon.bill { background: #fef3c7; color: #d97706; }
|
||||
.data-type-icon.customer { background: #ede9fe; color: #7c3aed; }
|
||||
.data-type-icon.vendor { background: #fce7f3; color: #db2777; }
|
||||
.data-type-icon.account { background: #cffafe; color: #0891b2; }
|
||||
.data-type-card h4 { font-size: 15px; margin-bottom: 8px; }
|
||||
.data-type-card p { font-size: 12px; color: var(--text-muted); }
|
||||
|
||||
/* Connection Page */
|
||||
.connection-layout { display: grid; gap: 20px; }
|
||||
.connection-status-display { text-align: center; padding: 32px; }
|
||||
.connection-status-display.connected .status-icon { color: var(--success); }
|
||||
.connection-status-display.disconnected .status-icon { color: var(--danger); }
|
||||
.connection-status-display h4 { font-size: 20px; margin-top: 16px; }
|
||||
.company-name { color: var(--text-muted); }
|
||||
.connection-actions { display: flex; justify-content: center; gap: 12px; margin-top: 20px; }
|
||||
.help-section { margin-bottom: 20px; }
|
||||
.help-section h4 { font-size: 14px; margin-bottom: 8px; }
|
||||
.help-section ol { padding-left: 20px; }
|
||||
.help-section li { margin-bottom: 6px; font-size: 13px; }
|
||||
.help-section code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); }
|
||||
.help-note { background: #eff6ff; padding: 12px 16px; border-radius: var(--radius); font-size: 13px; color: #1e40af; }
|
||||
|
||||
/* Templates Page */
|
||||
.templates-layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; }
|
||||
.templates-sidebar { background: var(--bg-card); border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; }
|
||||
.sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
|
||||
.filter-group { padding: 12px 16px; border-bottom: 1px solid var(--border); }
|
||||
.filter-group select { width: 100%; }
|
||||
.template-list { list-style: none; }
|
||||
.template-item { padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.2s; }
|
||||
.template-item:hover { background: var(--bg); }
|
||||
.template-item.active { background: rgba(37,99,235,0.1); border-left: 3px solid var(--primary); }
|
||||
.template-name { display: block; font-weight: 500; }
|
||||
.template-type { font-size: 12px; color: var(--text-muted); }
|
||||
.template-detail { background: var(--bg-card); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 24px; }
|
||||
.empty-detail, .empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
|
||||
.detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
|
||||
.detail-actions { display: flex; gap: 12px; }
|
||||
.badge { display: inline-block; padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: 600; text-transform: uppercase; background: var(--bg); color: var(--text-muted); }
|
||||
|
||||
/* Settings Page */
|
||||
.settings-layout { max-width: 800px; }
|
||||
.settings-actions { margin-top: 24px; }
|
||||
|
||||
/* Modal */
|
||||
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
|
||||
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
|
||||
.modal-content { position: relative; background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 90%; max-width: 800px; max-height: 90vh; overflow: auto; }
|
||||
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
|
||||
.modal-header h3 { font-size: 18px; }
|
||||
.modal-body { padding: 24px; }
|
||||
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; }
|
||||
|
||||
/* Toast */
|
||||
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 12px; }
|
||||
.toast { display: flex; align-items: center; gap: 12px; padding: 14px 20px; background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow-lg); border-left: 4px solid var(--border); animation: toast-in 0.3s ease; max-width: 400px; }
|
||||
.toast.success { border-left-color: var(--success); }
|
||||
.toast.warning { border-left-color: var(--warning); }
|
||||
.toast.error { border-left-color: var(--danger); }
|
||||
.toast-message { flex: 1; font-size: 14px; }
|
||||
.toast-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; }
|
||||
@keyframes toast-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
|
||||
|
||||
/* Config Row */
|
||||
.config-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 768px) {
|
||||
.header-content { flex-direction: column; gap: 16px; }
|
||||
.templates-layout { grid-template-columns: 1fr; }
|
||||
.stats-grid { grid-template-columns: 1fr; }
|
||||
.action-grid { grid-template-columns: 1fr; }
|
||||
.nav-content { overflow-x: auto; }
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
/* QBO Excel Sync - Main JavaScript */
|
||||
|
||||
// Toast notification system
|
||||
function showToast(message, type = 'info', duration = 4000) {
|
||||
let container = document.querySelector('.toast-container');
|
||||
if (!container) {
|
||||
container = document.createElement('div');
|
||||
container.className = 'toast-container';
|
||||
document.body.appendChild(container);
|
||||
}
|
||||
|
||||
const toast = document.createElement('div');
|
||||
toast.className = `toast ${type}`;
|
||||
toast.innerHTML = `
|
||||
<span class="toast-message">${escapeHtml(message)}</span>
|
||||
<button class="toast-close" onclick="this.parentElement.remove()">×</button>
|
||||
`;
|
||||
container.appendChild(toast);
|
||||
|
||||
setTimeout(() => {
|
||||
toast.style.animation = 'toast-out 0.3s ease forwards';
|
||||
setTimeout(() => toast.remove(), 300);
|
||||
}, duration);
|
||||
}
|
||||
|
||||
// HTML escape utility
|
||||
function escapeHtml(text) {
|
||||
if (text === null || text === undefined) return '';
|
||||
const div = document.createElement('div');
|
||||
div.textContent = String(text);
|
||||
return div.innerHTML;
|
||||
}
|
||||
|
||||
// Format date for display
|
||||
function formatDate(dateString) {
|
||||
if (!dateString) return '';
|
||||
const date = new Date(dateString);
|
||||
return date.toLocaleDateString('en-US', {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric'
|
||||
});
|
||||
}
|
||||
|
||||
// Format currency for display
|
||||
function formatCurrency(amount, currency = 'USD') {
|
||||
if (amount === null || amount === undefined) return '';
|
||||
return new Intl.NumberFormat('en-US', {
|
||||
style: 'currency',
|
||||
currency: currency
|
||||
}).format(amount);
|
||||
}
|
||||
|
||||
// Debounce function for search inputs
|
||||
function debounce(func, wait) {
|
||||
let timeout;
|
||||
return function executedFunction(...args) {
|
||||
const later = () => {
|
||||
clearTimeout(timeout);
|
||||
func(...args);
|
||||
};
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(later, wait);
|
||||
};
|
||||
}
|
||||
|
||||
// API request helper with error handling
|
||||
async function apiRequest(url, options = {}) {
|
||||
const defaultOptions = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await fetch(url, { ...defaultOptions, ...options });
|
||||
const data = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || `HTTP ${response.status}`);
|
||||
}
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error('API request error:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
// Confirm dialog helper
|
||||
function confirmAction(message) {
|
||||
return confirm(message);
|
||||
}
|
||||
|
||||
// Loading state management
|
||||
function setLoading(element, isLoading, loadingText = 'Loading...') {
|
||||
if (isLoading) {
|
||||
element.dataset.originalText = element.textContent;
|
||||
element.textContent = loadingText;
|
||||
element.disabled = true;
|
||||
} else {
|
||||
element.textContent = element.dataset.originalText || element.textContent;
|
||||
element.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize tooltips (basic implementation)
|
||||
function initTooltips() {
|
||||
document.querySelectorAll('[data-tooltip]').forEach(el => {
|
||||
el.addEventListener('mouseenter', () => {
|
||||
const tooltip = document.createElement('div');
|
||||
tooltip.className = 'tooltip';
|
||||
tooltip.textContent = el.dataset.tooltip;
|
||||
document.body.appendChild(tooltip);
|
||||
|
||||
const rect = el.getBoundingClientRect();
|
||||
tooltip.style.top = `${rect.top - tooltip.offsetHeight - 8}px`;
|
||||
tooltip.style.left = `${rect.left + (rect.width - tooltip.offsetWidth) / 2}px`;
|
||||
|
||||
el._tooltip = tooltip;
|
||||
});
|
||||
|
||||
el.addEventListener('mouseleave', () => {
|
||||
if (el._tooltip) {
|
||||
el._tooltip.remove();
|
||||
delete el._tooltip;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Copy to clipboard
|
||||
async function copyToClipboard(text) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
showToast('Copied to clipboard', 'success');
|
||||
} catch (err) {
|
||||
showToast('Failed to copy', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
// File size formatter
|
||||
function formatFileSize(bytes) {
|
||||
if (bytes === 0) return '0 Bytes';
|
||||
const k = 1024;
|
||||
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
||||
}
|
||||
|
||||
// Check connection status
|
||||
async function checkConnectionStatus() {
|
||||
try {
|
||||
const response = await fetch('/api/connection/test');
|
||||
const data = await response.json();
|
||||
return data.connected === true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Update connection indicator
|
||||
function updateConnectionIndicator(isConnected) {
|
||||
const indicator = document.querySelector('.connection-status');
|
||||
if (indicator) {
|
||||
indicator.className = `connection-status ${isConnected ? 'connected' : 'disconnected'}`;
|
||||
indicator.querySelector('span:last-child').textContent = isConnected ? 'Connected' : 'Not Connected';
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize on DOM ready
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
initTooltips();
|
||||
|
||||
// Add active class to current nav item
|
||||
const currentPath = window.location.pathname;
|
||||
document.querySelectorAll('.nav-link').forEach(link => {
|
||||
if (link.getAttribute('href') === currentPath) {
|
||||
link.classList.add('active');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Export for use in other scripts
|
||||
window.QBO = {
|
||||
showToast,
|
||||
escapeHtml,
|
||||
formatDate,
|
||||
formatCurrency,
|
||||
debounce,
|
||||
apiRequest,
|
||||
confirmAction,
|
||||
setLoading,
|
||||
copyToClipboard,
|
||||
formatFileSize,
|
||||
checkConnectionStatus,
|
||||
updateConnectionIndicator
|
||||
};
|
||||
Reference in New Issue
Block a user