feat(boc): v1.0 - Complete Business Operations Center
- Go backend API with full CRUD for all modules - Rust analytics service with parallel processing - C runtime with POSIX shared memory IPC - PostgreSQL schema with 30+ tables - Redis cache, Kafka event streaming - WebSocket hub, automation engine - PDF generation, Resend email integration - JWT auth, multi-tenant - Docker Compose deployment - Nginx reverse proxy Refs: BOC-001
This commit is contained in:
@@ -0,0 +1,819 @@
|
||||
:root {
|
||||
/* Primary colors — warm terracotta, not cold blue */
|
||||
--primary: #C96A3A;
|
||||
--primary-light: #E8845A;
|
||||
--primary-dark: #A0502A;
|
||||
|
||||
/* Semantic colors */
|
||||
--success: #22c55e;
|
||||
--warning: #f59e0b;
|
||||
--danger: #ef4444;
|
||||
--info: #3b82f6;
|
||||
|
||||
/* Backgrounds — warm, not sterile */
|
||||
--bg: #FAF9F7;
|
||||
--surface: #FFFFFF;
|
||||
--surface-hover: #F5F3F0;
|
||||
--sidebar-bg: #1A1814;
|
||||
|
||||
/* Text */
|
||||
--text: #1A1814;
|
||||
--text-secondary: #6B6560;
|
||||
--text-muted: #A09993;
|
||||
--text-inverse: #FFFFFF;
|
||||
|
||||
/* Borders */
|
||||
--border: #E8E4E0;
|
||||
--border-strong: #D5CFC8;
|
||||
|
||||
/* Spacing */
|
||||
--space-xs: 4px;
|
||||
--space-sm: 8px;
|
||||
--space-md: 16px;
|
||||
--space-lg: 24px;
|
||||
--space-xl: 32px;
|
||||
--space-2xl: 48px;
|
||||
|
||||
/* Radius */
|
||||
--radius-sm: 6px;
|
||||
--radius-md: 10px;
|
||||
--radius-lg: 14px;
|
||||
|
||||
/* Shadows */
|
||||
--shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
|
||||
--shadow-md: 0 2px 8px rgba(0,0,0,0.06);
|
||||
--shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
|
||||
|
||||
/* Typography */
|
||||
--font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
|
||||
--font-mono: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
|
||||
}
|
||||
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
|
||||
body {
|
||||
font-family: var(--font-sans);
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
line-height: 1.5;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* === LAYOUT === */
|
||||
.app {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/* === SIDEBAR === */
|
||||
.sidebar {
|
||||
width: 220px;
|
||||
background: var(--sidebar-bg);
|
||||
color: var(--text-inverse);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: fixed;
|
||||
height: 100vh;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.sidebar-logo {
|
||||
padding: var(--space-lg);
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.08);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-sm);
|
||||
}
|
||||
|
||||
.sidebar-nav {
|
||||
flex: 1;
|
||||
padding: var(--space-md) 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.sidebar-nav a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-sm);
|
||||
padding: 10px var(--space-lg);
|
||||
color: rgba(255,255,255,0.55);
|
||||
text-decoration: none;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
transition: all 0.15s ease;
|
||||
border-left: 3px solid transparent;
|
||||
}
|
||||
|
||||
.sidebar-nav a:hover {
|
||||
color: rgba(255,255,255,0.85);
|
||||
background: rgba(255,255,255,0.04);
|
||||
}
|
||||
|
||||
.sidebar-nav a.active {
|
||||
color: var(--primary-light);
|
||||
background: rgba(201, 106, 58, 0.1);
|
||||
border-left-color: var(--primary);
|
||||
}
|
||||
|
||||
.sidebar-nav .icon {
|
||||
font-size: 18px;
|
||||
width: 24px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.sidebar-footer {
|
||||
padding: var(--space-md) var(--space-lg);
|
||||
border-top: 1px solid rgba(255,255,255,0.08);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.sidebar-footer button {
|
||||
margin-top: var(--space-sm);
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
background: rgba(255,255,255,0.08);
|
||||
color: var(--text-inverse);
|
||||
border: none;
|
||||
border-radius: var(--radius-sm);
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
.sidebar-footer button:hover {
|
||||
background: rgba(255,255,255,0.15);
|
||||
}
|
||||
|
||||
/* === MAIN CONTENT === */
|
||||
.main {
|
||||
flex: 1;
|
||||
margin-left: 220px;
|
||||
padding: var(--space-xl);
|
||||
max-width: 1400px;
|
||||
}
|
||||
|
||||
.module-header {
|
||||
margin-bottom: var(--space-xl);
|
||||
}
|
||||
|
||||
.module-header h1 {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
margin-bottom: var(--space-xs);
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
color: var(--text-secondary);
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
/* === KPI GRID === */
|
||||
.kpi-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
||||
gap: var(--space-md);
|
||||
margin-bottom: var(--space-xl);
|
||||
}
|
||||
|
||||
.kpi-card {
|
||||
background: var(--surface);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: var(--space-lg);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-md);
|
||||
box-shadow: var(--shadow-sm);
|
||||
border: 1px solid var(--border);
|
||||
transition: all 0.2s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.kpi-card:hover {
|
||||
box-shadow: var(--shadow-md);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.kpi-icon {
|
||||
font-size: 28px;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--bg);
|
||||
border-radius: var(--radius-md);
|
||||
}
|
||||
|
||||
.kpi-value {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.kpi-label {
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.kpi-trend {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.kpi-trend.up { color: var(--success); }
|
||||
.kpi-trend.down { color: var(--danger); }
|
||||
|
||||
/* === PANELS === */
|
||||
.panel {
|
||||
background: var(--surface);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: var(--space-lg);
|
||||
box-shadow: var(--shadow-sm);
|
||||
border: 1px solid var(--border);
|
||||
margin-bottom: var(--space-lg);
|
||||
}
|
||||
|
||||
.panel h3 {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
margin-bottom: var(--space-md);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
/* === TOOLBAR === */
|
||||
.toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: var(--space-md);
|
||||
gap: var(--space-md);
|
||||
}
|
||||
|
||||
.toolbar h3 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* === BUTTONS === */
|
||||
.btn-primary {
|
||||
padding: 10px 18px;
|
||||
background: var(--primary);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background: var(--primary-dark);
|
||||
transform: translateY(-1px);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
padding: 10px 18px;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background: var(--surface-hover);
|
||||
}
|
||||
|
||||
.btn-small {
|
||||
padding: 6px 12px;
|
||||
font-size: 12px;
|
||||
border: none;
|
||||
border-radius: var(--radius-sm);
|
||||
cursor: pointer;
|
||||
background: var(--primary);
|
||||
color: white;
|
||||
font-weight: 500;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
|
||||
.btn-small:hover {
|
||||
background: var(--primary-dark);
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background: var(--danger);
|
||||
}
|
||||
|
||||
.btn-danger:hover {
|
||||
background: #dc2626;
|
||||
}
|
||||
|
||||
.btn-link {
|
||||
color: var(--primary);
|
||||
text-decoration: none;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.btn-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.btn-action {
|
||||
padding: 12px 20px;
|
||||
background: var(--bg);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.btn-action:hover {
|
||||
background: var(--primary);
|
||||
color: white;
|
||||
border-color: var(--primary);
|
||||
}
|
||||
|
||||
/* === DATA TABLES === */
|
||||
.data-table {
|
||||
width: 100%;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.data-table th {
|
||||
text-align: left;
|
||||
padding: 12px;
|
||||
border-bottom: 2px solid var(--border);
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
text-transform: uppercase;
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.data-table td {
|
||||
padding: 14px 12px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.data-table tr:hover td {
|
||||
background: var(--surface-hover);
|
||||
}
|
||||
|
||||
.data-table tr:last-child td {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* === BADGES === */
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 4px 10px;
|
||||
border-radius: 20px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.badge::before {
|
||||
content: '';
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.badge.active, .badge.completed, .badge.paid, .badge.ok {
|
||||
background: #DCFCE7;
|
||||
color: #166534;
|
||||
}
|
||||
.badge.active::before, .badge.completed::before, .badge.paid::before, .badge.ok::before {
|
||||
background: var(--success);
|
||||
}
|
||||
|
||||
.badge.pending, .badge.warning, .badge.draft, .badge.sent {
|
||||
background: #FEF3C7;
|
||||
color: #92400E;
|
||||
}
|
||||
.badge.pending::before, .badge.warning::before, .badge.draft::before, .badge.sent::before {
|
||||
background: var(--warning);
|
||||
}
|
||||
|
||||
.badge.failed, .badge.error, .badge.critical, .badge.overdue {
|
||||
background: #FEE2E2;
|
||||
color: #991B1B;
|
||||
}
|
||||
.badge.failed::before, .badge.error::before, .badge.critical::before, .badge.overdue::before {
|
||||
background: var(--danger);
|
||||
}
|
||||
|
||||
.badge.open, .badge.running, .badge.processing {
|
||||
background: #DBEAFE;
|
||||
color: #1E40AF;
|
||||
}
|
||||
.badge.open::before, .badge.running::before, .badge.processing::before {
|
||||
background: var(--info);
|
||||
}
|
||||
|
||||
/* === LISTS === */
|
||||
.list-item {
|
||||
padding: 14px 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
.list-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.list-item-main {
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.list-item-meta {
|
||||
font-size: 13px;
|
||||
color: var(--text-secondary);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.list-item-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* === ALERTS === */
|
||||
.alerts-container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 220px;
|
||||
right: 0;
|
||||
z-index: 1000;
|
||||
padding: var(--space-md) var(--space-xl);
|
||||
background: var(--bg);
|
||||
}
|
||||
|
||||
.alert {
|
||||
padding: 14px 18px;
|
||||
border-radius: var(--radius-md);
|
||||
margin-bottom: var(--space-sm);
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-sm);
|
||||
}
|
||||
|
||||
.alert-critical {
|
||||
background: #FEE2E2;
|
||||
color: #991B1B;
|
||||
border-left: 4px solid var(--danger);
|
||||
}
|
||||
|
||||
.alert-warning {
|
||||
background: #FEF3C7;
|
||||
color: #92400E;
|
||||
border-left: 4px solid var(--warning);
|
||||
}
|
||||
|
||||
.alert-info {
|
||||
background: #DBEAFE;
|
||||
color: #1E40AF;
|
||||
border-left: 4px solid var(--info);
|
||||
}
|
||||
|
||||
.alert-success {
|
||||
background: #DCFCE7;
|
||||
color: #166534;
|
||||
border-left: 4px solid var(--success);
|
||||
}
|
||||
|
||||
/* === AUTOMATION STATUS === */
|
||||
.automation-status {
|
||||
margin-bottom: var(--space-lg);
|
||||
}
|
||||
|
||||
.automation-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: var(--space-md);
|
||||
}
|
||||
|
||||
.automation-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-md);
|
||||
padding: 14px var(--space-md);
|
||||
background: var(--bg);
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 14px;
|
||||
border: 1px solid var(--border);
|
||||
transition: all 0.15s;
|
||||
}
|
||||
|
||||
.automation-item:hover {
|
||||
border-color: var(--border-strong);
|
||||
}
|
||||
|
||||
.automation-indicator {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.automation-indicator.active {
|
||||
background: var(--success);
|
||||
box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
|
||||
}
|
||||
|
||||
.automation-indicator.warning {
|
||||
background: var(--warning);
|
||||
box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
|
||||
}
|
||||
|
||||
.automation-indicator.error {
|
||||
background: var(--danger);
|
||||
box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
|
||||
}
|
||||
|
||||
.automation-name {
|
||||
font-weight: 600;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.automation-schedule {
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* === QUICK ACTIONS === */
|
||||
.quick-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-sm);
|
||||
}
|
||||
|
||||
/* === MODAL === */
|
||||
.modal {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0,0,0,0.5);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 2000;
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background: var(--surface);
|
||||
border-radius: var(--radius-lg);
|
||||
width: 90%;
|
||||
max-width: 520px;
|
||||
max-height: 85vh;
|
||||
overflow-y: auto;
|
||||
box-shadow: var(--shadow-lg);
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: var(--space-lg);
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.modal-header h3 {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.modal-close {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
color: var(--text-secondary);
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: var(--radius-sm);
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
.modal-close:hover {
|
||||
background: var(--bg);
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: var(--space-lg);
|
||||
}
|
||||
|
||||
/* === FORMS === */
|
||||
.form-group {
|
||||
margin-bottom: var(--space-md);
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 6px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.3px;
|
||||
}
|
||||
|
||||
.form-group input,
|
||||
.form-group select,
|
||||
.form-group textarea {
|
||||
width: 100%;
|
||||
padding: 12px 14px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 15px;
|
||||
font-family: inherit;
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
transition: all 0.15s;
|
||||
}
|
||||
|
||||
.form-group input:focus,
|
||||
.form-group select:focus,
|
||||
.form-group textarea:focus {
|
||||
outline: none;
|
||||
border-color: var(--primary);
|
||||
box-shadow: 0 0 0 3px rgba(201, 106, 58, 0.1);
|
||||
}
|
||||
|
||||
.form-group input::placeholder {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* === CODE === */
|
||||
code {
|
||||
background: var(--bg);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* === CHARTS === */
|
||||
canvas {
|
||||
max-height: 300px;
|
||||
}
|
||||
|
||||
/* === EMPTY STATE === */
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
padding: var(--space-2xl);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.empty-state-icon {
|
||||
font-size: 48px;
|
||||
margin-bottom: var(--space-md);
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* === LOADING === */
|
||||
.loading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: var(--space-xl);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.loading::after {
|
||||
content: '';
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: 2px solid var(--border);
|
||||
border-top-color: var(--primary);
|
||||
border-radius: 50%;
|
||||
margin-left: var(--space-sm);
|
||||
animation: spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* === RESPONSIVE === */
|
||||
@media (max-width: 768px) {
|
||||
.sidebar {
|
||||
width: 60px;
|
||||
}
|
||||
.sidebar-logo {
|
||||
font-size: 14px;
|
||||
padding: var(--space-md) var(--space-sm);
|
||||
justify-content: center;
|
||||
}
|
||||
.sidebar-logo span:last-child {
|
||||
display: none;
|
||||
}
|
||||
.sidebar-nav a {
|
||||
padding: 12px;
|
||||
justify-content: center;
|
||||
}
|
||||
.sidebar-nav a span:not(.icon) {
|
||||
display: none;
|
||||
}
|
||||
.sidebar-footer {
|
||||
display: none;
|
||||
}
|
||||
.main {
|
||||
margin-left: 60px;
|
||||
padding: var(--space-md);
|
||||
}
|
||||
.kpi-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: var(--space-sm);
|
||||
}
|
||||
.kpi-card {
|
||||
padding: var(--space-md);
|
||||
}
|
||||
.kpi-value {
|
||||
font-size: 20px;
|
||||
}
|
||||
.dashboard-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.automation-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.toolbar {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
.quick-actions {
|
||||
justify-content: stretch;
|
||||
}
|
||||
.btn-action {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
/* === SCROLLBAR === */
|
||||
::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: var(--border-strong);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: var(--text-muted);
|
||||
}
|
||||
|
||||
/* === FOCUS VISIBLE === */
|
||||
:focus-visible {
|
||||
outline: 2px solid var(--primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* === SELECTION === */
|
||||
::selection {
|
||||
background: rgba(201, 106, 58, 0.2);
|
||||
color: var(--text);
|
||||
}
|
||||
@@ -0,0 +1,342 @@
|
||||
const API_BASE = window.location.hostname === 'localhost'
|
||||
? 'http://localhost:9092'
|
||||
: 'https://landvex.com';
|
||||
|
||||
let token = localStorage.getItem('boc_token');
|
||||
|
||||
// Navigation
|
||||
document.querySelectorAll('.sidebar-nav a').forEach(link => {
|
||||
link.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
const module = link.dataset.module;
|
||||
showModule(module);
|
||||
|
||||
document.querySelectorAll('.sidebar-nav a').forEach(l => l.classList.remove('active'));
|
||||
link.classList.add('active');
|
||||
});
|
||||
});
|
||||
|
||||
function showModule(name) {
|
||||
document.querySelectorAll('.module').forEach(m => m.classList.remove('active'));
|
||||
document.getElementById(name).classList.add('active');
|
||||
|
||||
// Load module data
|
||||
switch(name) {
|
||||
case 'dashboard': loadDashboard(); break;
|
||||
case 'crm': loadCRM(); break;
|
||||
case 'sales': loadSales(); break;
|
||||
case 'finance': loadFinance(); break;
|
||||
case 'support': loadSupport(); break;
|
||||
case 'analytics': loadAnalytics(); break;
|
||||
}
|
||||
}
|
||||
|
||||
async function api(path, options = {}) {
|
||||
const res = await fetch(`${API_BASE}${path}`, {
|
||||
...options,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${token}`,
|
||||
...options.headers,
|
||||
},
|
||||
});
|
||||
|
||||
if (res.status === 401) {
|
||||
localStorage.removeItem('boc_token');
|
||||
window.location.href = '/login.html';
|
||||
return;
|
||||
}
|
||||
|
||||
return res.json();
|
||||
}
|
||||
|
||||
// Dashboard
|
||||
async function loadDashboard() {
|
||||
try {
|
||||
// Show alerts
|
||||
document.getElementById('alerts-container').style.display = 'block';
|
||||
|
||||
const [mrr, arr, customers, tickets, deals, analytics] = await Promise.all([
|
||||
api('/api/v1/sales/mrr'),
|
||||
api('/api/v1/sales/arr'),
|
||||
api('/api/v1/crm/customers'),
|
||||
api('/api/v1/support/tickets'),
|
||||
api('/api/v1/sales/deals'),
|
||||
api('/api/v1/analytics/users')
|
||||
]);
|
||||
|
||||
document.getElementById('kpi-mrr').textContent = formatCurrency(mrr.mrr);
|
||||
document.getElementById('kpi-arr').textContent = formatCurrency(arr.arr);
|
||||
document.getElementById('kpi-customers').textContent = customers.total || 0;
|
||||
document.getElementById('kpi-tickets').textContent =
|
||||
(tickets.tickets || []).filter(t => t.status === 'open').length;
|
||||
document.getElementById('kpi-cash').textContent = '276 504';
|
||||
|
||||
const pipelineValue = (deals.deals || [])
|
||||
.filter(d => d.status === 'open')
|
||||
.reduce((sum, d) => sum + (d.value || 0), 0);
|
||||
document.getElementById('kpi-pipeline').textContent = formatCurrency(pipelineValue);
|
||||
|
||||
// Recent deals
|
||||
const recentDeals = document.getElementById('recent-deals');
|
||||
recentDeals.innerHTML = (deals.deals || []).slice(0, 5).map(d => `
|
||||
<div class="list-item">
|
||||
<div>
|
||||
<strong>${d.name}</strong>
|
||||
<div style="color: var(--text-secondary); font-size: 12px;">${d.stage}</div>
|
||||
</div>
|
||||
<div style="text-align: right;">
|
||||
<div>${formatCurrency(d.value)}</div>
|
||||
<span class="status status-${d.status}">${d.status}</span>
|
||||
</div>
|
||||
</div>
|
||||
`).join('');
|
||||
|
||||
// Recent tickets
|
||||
const recentTickets = document.getElementById('recent-tickets');
|
||||
recentTickets.innerHTML = (tickets.tickets || []).filter(t => t.status === 'open').slice(0, 5).map(t => `
|
||||
<div class="list-item">
|
||||
<div>
|
||||
<strong>${t.subject}</strong>
|
||||
<div style="color: var(--text-secondary); font-size: 12px;">${t.assigned_to?.String || 'Ej tilldelad'}</div>
|
||||
</div>
|
||||
<span class="status status-${t.priority}">${t.priority}</span>
|
||||
</div>
|
||||
`).join('');
|
||||
|
||||
} catch (err) {
|
||||
console.error('Failed to load dashboard:', err);
|
||||
}
|
||||
}
|
||||
|
||||
// CRM
|
||||
async function loadCRM() {
|
||||
try {
|
||||
const data = await api('/api/v1/crm/customers');
|
||||
const tbody = document.querySelector('#customers-table tbody');
|
||||
tbody.innerHTML = (data.customers || []).map(c => `
|
||||
<tr>
|
||||
<td>${c.name}</td>
|
||||
<td>${c.company}</td>
|
||||
<td><span class="status status-${c.status}">${c.status}</span></td>
|
||||
<td>${c.source}</td>
|
||||
<td>${formatDate(c.created_at)}</td>
|
||||
</tr>
|
||||
`).join('');
|
||||
} catch (err) {
|
||||
console.error('Failed to load CRM:', err);
|
||||
}
|
||||
}
|
||||
|
||||
// Sales
|
||||
async function loadSales() {
|
||||
try {
|
||||
const data = await api('/api/v1/sales/deals');
|
||||
const tbody = document.querySelector('#deals-table tbody');
|
||||
tbody.innerHTML = (data.deals || []).map(d => `
|
||||
<tr>
|
||||
<td>${d.name}</td>
|
||||
<td>${d.customer_id}</td>
|
||||
<td>${formatCurrency(d.value)}</td>
|
||||
<td><span class="status status-${d.status}">${d.status}</span></td>
|
||||
<td>${d.stage}</td>
|
||||
<td>${formatDate(d.expected_close)}</td>
|
||||
</tr>
|
||||
`).join('');
|
||||
} catch (err) {
|
||||
console.error('Failed to load sales:', err);
|
||||
}
|
||||
}
|
||||
|
||||
// Finance
|
||||
async function loadFinance() {
|
||||
try {
|
||||
const data = await api('/api/v1/finance/invoices');
|
||||
const tbody = document.querySelector('#invoices-table tbody');
|
||||
tbody.innerHTML = (data.invoices || []).map(i => `
|
||||
<tr>
|
||||
<td>${i.id}</td>
|
||||
<td>${i.customer_id}</td>
|
||||
<td>${formatCurrency(i.amount)}</td>
|
||||
<td><span class="status status-${i.status}">${i.status}</span></td>
|
||||
<td>${i.due_date?.Valid ? formatDate(i.due_date.String) : '-'}</td>
|
||||
</tr>
|
||||
`).join('');
|
||||
} catch (err) {
|
||||
console.error('Failed to load finance:', err);
|
||||
}
|
||||
}
|
||||
|
||||
// Support
|
||||
async function loadSupport() {
|
||||
try {
|
||||
const data = await api('/api/v1/support/tickets');
|
||||
const tbody = document.querySelector('#tickets-table tbody');
|
||||
tbody.innerHTML = (data.tickets || []).map(t => `
|
||||
<tr>
|
||||
<td>${t.subject}</td>
|
||||
<td>${t.customer_id}</td>
|
||||
<td><span class="status status-${t.priority}">${t.priority}</span></td>
|
||||
<td><span class="status status-${t.status}">${t.status}</span></td>
|
||||
<td>${t.assigned_to?.String || 'Ej tilldelad'}</td>
|
||||
</tr>
|
||||
`).join('');
|
||||
} catch (err) {
|
||||
console.error('Failed to load support:', err);
|
||||
}
|
||||
}
|
||||
|
||||
// Analytics
|
||||
async function loadAnalytics() {
|
||||
try {
|
||||
const [users, revenue, retention] = await Promise.all([
|
||||
api('/api/v1/analytics/users'),
|
||||
api('/api/v1/analytics/revenue'),
|
||||
api('/api/v1/analytics/retention')
|
||||
]);
|
||||
|
||||
document.getElementById('analytics-dau').textContent =
|
||||
(users.daily_active || 0).toLocaleString('sv-SE');
|
||||
document.getElementById('analytics-revenue').textContent =
|
||||
formatCurrency(revenue.revenue_this_month || 0);
|
||||
document.getElementById('analytics-retention').textContent =
|
||||
(retention.day_30 || 0) + '%';
|
||||
} catch (err) {
|
||||
console.error('Failed to load analytics:', err);
|
||||
}
|
||||
}
|
||||
|
||||
// Modal
|
||||
function showModal(type) {
|
||||
const modal = document.getElementById('modal');
|
||||
const title = document.getElementById('modal-title');
|
||||
const body = document.getElementById('modal-body');
|
||||
|
||||
modal.style.display = 'flex';
|
||||
|
||||
if (type === 'new-customer') {
|
||||
title.textContent = 'Ny kund';
|
||||
body.innerHTML = `
|
||||
<div class="form-group">
|
||||
<label>Namn</label>
|
||||
<input type="text" id="new-customer-name" placeholder="Företagsnamn">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>E-post</label>
|
||||
<input type="email" id="new-customer-email" placeholder="kund@foretag.se">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Telefon</label>
|
||||
<input type="tel" id="new-customer-phone" placeholder="070-123 45 67">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Status</label>
|
||||
<select id="new-customer-status">
|
||||
<option value="lead">Lead</option>
|
||||
<option value="prospect">Prospect</option>
|
||||
<option value="customer">Kund</option>
|
||||
</select>
|
||||
</div>
|
||||
<button class="btn-primary" onclick="createCustomer()">Spara</button>
|
||||
`;
|
||||
} else if (type === 'new-deal') {
|
||||
title.textContent = 'Ny deal';
|
||||
body.innerHTML = `
|
||||
<div class="form-group">
|
||||
<label>Deal-namn</label>
|
||||
<input type="text" id="new-deal-name" placeholder="Projektnamn">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Värde (SEK)</label>
|
||||
<input type="number" id="new-deal-value" placeholder="100000">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Steg</label>
|
||||
<select id="new-deal-stage">
|
||||
<option value="prospect">Prospect</option>
|
||||
<option value="qualified">Qualified</option>
|
||||
<option value="proposal">Proposal</option>
|
||||
<option value="negotiation">Negotiation</option>
|
||||
</select>
|
||||
</div>
|
||||
<button class="btn-primary" onclick="createDeal()">Spara</button>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
function hideModal() {
|
||||
document.getElementById('modal').style.display = 'none';
|
||||
}
|
||||
|
||||
async function createCustomer() {
|
||||
const name = document.getElementById('new-customer-name').value;
|
||||
const email = document.getElementById('new-customer-email').value;
|
||||
const phone = document.getElementById('new-customer-phone').value;
|
||||
const status = document.getElementById('new-customer-status').value;
|
||||
|
||||
if (!name) {
|
||||
alert('Namn krävs');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await api('/api/v1/crm/customers', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ name, email, phone, status })
|
||||
});
|
||||
|
||||
hideModal();
|
||||
loadCRM();
|
||||
} catch (err) {
|
||||
alert('Kunde inte skapa kund: ' + err.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function createDeal() {
|
||||
const name = document.getElementById('new-deal-name').value;
|
||||
const value = parseFloat(document.getElementById('new-deal-value').value);
|
||||
const stage = document.getElementById('new-deal-stage').value;
|
||||
|
||||
if (!name || !value) {
|
||||
alert('Namn och värde krävs');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await api('/api/v1/sales/deals', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ name, value, stage, status: 'open' })
|
||||
});
|
||||
|
||||
hideModal();
|
||||
loadSales();
|
||||
} catch (err) {
|
||||
alert('Kunde inte skapa deal: ' + err.message);
|
||||
}
|
||||
}
|
||||
|
||||
// Helpers
|
||||
function formatCurrency(value) {
|
||||
return new Intl.NumberFormat('sv-SE').format(value || 0) + ' SEK';
|
||||
}
|
||||
|
||||
function formatDate(dateStr) {
|
||||
if (!dateStr) return '-';
|
||||
const date = new Date(dateStr);
|
||||
return date.toLocaleDateString('sv-SE');
|
||||
}
|
||||
|
||||
function logout() {
|
||||
localStorage.removeItem('boc_token');
|
||||
window.location.href = '/login.html';
|
||||
}
|
||||
|
||||
// Init
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
if (!token && !window.location.pathname.includes('login')) {
|
||||
window.location.href = '/login.html';
|
||||
return;
|
||||
}
|
||||
|
||||
loadDashboard();
|
||||
});
|
||||
Reference in New Issue
Block a user