main setup created.
This commit is contained in:
@@ -0,0 +1,383 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>PRISM Dashboard - Construction Job Management</title>
|
||||
<style>
|
||||
:root {
|
||||
--gruvbox-bg0: #282828;
|
||||
--gruvbox-bg1: #3c3836;
|
||||
--gruvbox-bg2: #504945;
|
||||
--gruvbox-bg3: #665c54;
|
||||
--gruvbox-fg0: #fbf1c7;
|
||||
--gruvbox-fg1: #ebdbb2;
|
||||
--gruvbox-fg2: #d5c4a1;
|
||||
--gruvbox-orange: #fe8019;
|
||||
--gruvbox-green: #b8bb26;
|
||||
--gruvbox-blue: #83a598;
|
||||
--gruvbox-purple: #d3869b;
|
||||
--gruvbox-red: #fb4934;
|
||||
--gruvbox-yellow: #fabd2f;
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'SF Pro Display', 'Segoe UI', system-ui, -apple-system, sans-serif;
|
||||
background: linear-gradient(135deg, var(--gruvbox-bg0) 0%, var(--gruvbox-bg2) 50%, var(--gruvbox-bg1) 100%);
|
||||
min-height: 100vh;
|
||||
color: var(--gruvbox-fg1);
|
||||
}
|
||||
|
||||
|
||||
.main-content {
|
||||
padding: 2rem;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.welcome-section {
|
||||
background: var(--gruvbox-bg1);
|
||||
padding: 2rem;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
|
||||
margin-bottom: 2rem;
|
||||
border: 1px solid var(--gruvbox-bg3);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.welcome-section h2 {
|
||||
color: var(--gruvbox-orange);
|
||||
margin-bottom: 1rem;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.welcome-section p {
|
||||
color: var(--gruvbox-fg2);
|
||||
line-height: 1.6;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.dashboard-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.dashboard-card {
|
||||
background: var(--gruvbox-bg1);
|
||||
padding: 1.75rem;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
|
||||
transition: all 0.3s ease;
|
||||
border: 1px solid var(--gruvbox-bg3);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.dashboard-card:hover {
|
||||
transform: translateY(-8px);
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
|
||||
border-color: var(--gruvbox-blue);
|
||||
}
|
||||
|
||||
.dashboard-card h3 {
|
||||
color: var(--gruvbox-fg0);
|
||||
margin-bottom: 1rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.dashboard-card .icon {
|
||||
font-size: 1.5rem;
|
||||
color: var(--gruvbox-green);
|
||||
}
|
||||
|
||||
.dashboard-card p {
|
||||
color: var(--gruvbox-fg2);
|
||||
line-height: 1.6;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.stat-number {
|
||||
font-size: 2.5rem;
|
||||
font-weight: 800;
|
||||
color: var(--gruvbox-orange);
|
||||
margin-bottom: 0.5rem;
|
||||
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.recent-activity {
|
||||
background: var(--gruvbox-bg1);
|
||||
padding: 1.75rem;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
|
||||
border: 1px solid var(--gruvbox-bg3);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.recent-activity h3 {
|
||||
color: var(--gruvbox-fg0);
|
||||
margin-bottom: 1rem;
|
||||
font-size: 1.2rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.activity-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
padding: 1.25rem 0;
|
||||
border-bottom: 1px solid var(--gruvbox-bg3);
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.activity-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.activity-item:hover {
|
||||
background: rgba(131, 165, 152, 0.05);
|
||||
border-radius: 8px;
|
||||
padding-left: 0.5rem;
|
||||
margin-left: -0.5rem;
|
||||
margin-right: -0.5rem;
|
||||
}
|
||||
|
||||
.activity-icon {
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
background: linear-gradient(135deg, var(--gruvbox-blue) 0%, var(--gruvbox-purple) 100%);
|
||||
color: var(--gruvbox-bg0);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1.3rem;
|
||||
font-weight: 600;
|
||||
box-shadow: 0 4px 12px rgba(131, 165, 152, 0.3);
|
||||
}
|
||||
|
||||
.activity-content {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.activity-content h4 {
|
||||
color: var(--gruvbox-fg0);
|
||||
font-size: 0.95rem;
|
||||
margin-bottom: 0.25rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.activity-content p {
|
||||
color: var(--gruvbox-fg2);
|
||||
font-size: 0.85rem;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.loading {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 200px;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border: 4px solid var(--gruvbox-bg3);
|
||||
border-top: 4px solid var(--gruvbox-orange);
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.error-message {
|
||||
background: rgba(251, 73, 52, 0.1);
|
||||
color: var(--gruvbox-red);
|
||||
padding: 1.25rem;
|
||||
border-radius: 8px;
|
||||
margin: 1rem 0;
|
||||
border: 1px solid rgba(251, 73, 52, 0.3);
|
||||
backdrop-filter: blur(5px);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
|
||||
.main-content {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.dashboard-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.welcome-section {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.dashboard-card {
|
||||
padding: 1.25rem;
|
||||
}
|
||||
|
||||
.recent-activity {
|
||||
padding: 1.25rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<main class="main-content">
|
||||
<div id="loading" class="loading">
|
||||
<div class="loading-spinner"></div>
|
||||
<p>Loading dashboard...</p>
|
||||
</div>
|
||||
|
||||
<div id="dashboard-content" style="display: none;">
|
||||
<div class="welcome-section">
|
||||
<h2>Welcome back!</h2>
|
||||
<p>Here's your construction job management overview. Stay organized and efficient with PRISM.</p>
|
||||
</div>
|
||||
|
||||
<div class="dashboard-grid">
|
||||
<div class="dashboard-card">
|
||||
<h3><span class="icon">📋</span> Active Jobs</h3>
|
||||
<div class="stat-number" id="active-jobs">-</div>
|
||||
<p>Currently active construction projects</p>
|
||||
</div>
|
||||
|
||||
<div class="dashboard-card">
|
||||
<h3><span class="icon">👷</span> Team Members</h3>
|
||||
<div class="stat-number" id="team-members">-</div>
|
||||
<p>People working on your projects</p>
|
||||
</div>
|
||||
|
||||
<div class="dashboard-card">
|
||||
<h3><span class="icon">✅</span> Completed This Month</h3>
|
||||
<div class="stat-number" id="completed-month">-</div>
|
||||
<p>Jobs finished in the last 30 days</p>
|
||||
</div>
|
||||
|
||||
<div class="dashboard-card">
|
||||
<h3><span class="icon">📊</span> Revenue</h3>
|
||||
<div class="stat-number" id="revenue">$0</div>
|
||||
<p>Total revenue this quarter</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="recent-activity">
|
||||
<h3>Recent Activity</h3>
|
||||
<div id="activity-list">
|
||||
<div class="activity-item">
|
||||
<div class="activity-icon">🔄</div>
|
||||
<div class="activity-content">
|
||||
<h4>System Initialized</h4>
|
||||
<p>Welcome to PRISM dashboard</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="error-content" class="error-message" style="display: none;">
|
||||
Unable to load dashboard. Please try refreshing the page.
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script type="module">
|
||||
import PocketBase from '/pocketbase.es.mjs';
|
||||
import { initMenuBar, getCurrentPage } from '/components.js';
|
||||
|
||||
// Initialize PocketBase
|
||||
const pb = new PocketBase('https://pocketbase.ccllc.pro');
|
||||
|
||||
// Check authentication and load dashboard
|
||||
async function initDashboard() {
|
||||
try {
|
||||
// Check if user is authenticated
|
||||
if (!pb.authStore.isValid) {
|
||||
// Redirect to login if not authenticated
|
||||
window.location.href = '/';
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize menu bar
|
||||
const menuBar = initMenuBar(getCurrentPage());
|
||||
|
||||
const user = pb.authStore.model;
|
||||
menuBar.updateUserName(user.name || user.email);
|
||||
|
||||
// Hide loading and show dashboard
|
||||
document.getElementById('loading').style.display = 'none';
|
||||
document.getElementById('dashboard-content').style.display = 'block';
|
||||
|
||||
// Load dashboard data
|
||||
await loadDashboardData();
|
||||
|
||||
} catch (error) {
|
||||
console.error('Dashboard initialization failed:', error.message);
|
||||
showError('Failed to initialize dashboard. Please try logging in again.');
|
||||
setTimeout(() => {
|
||||
window.location.href = '/';
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
|
||||
async function loadDashboardData() {
|
||||
try {
|
||||
// This is a placeholder for actual API calls to your collections
|
||||
// For now, we'll show some mock data
|
||||
|
||||
// Mock data - replace with actual API calls to your collections
|
||||
document.getElementById('active-jobs').textContent = '12';
|
||||
document.getElementById('team-members').textContent = '8';
|
||||
document.getElementById('completed-month').textContent = '5';
|
||||
document.getElementById('revenue').textContent = '$125,000';
|
||||
|
||||
// Example: Load data from your API collection
|
||||
// const records = await pb.collection('api').getList(1, 50);
|
||||
// Process your data here...
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error loading dashboard data:', error.message);
|
||||
// Show error but don't redirect - user is authenticated
|
||||
document.getElementById('error-content').style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
function logout() {
|
||||
pb.authStore.clear();
|
||||
window.location.href = '/';
|
||||
}
|
||||
|
||||
// Make logout function globally available
|
||||
window.logout = logout;
|
||||
|
||||
function showError(message) {
|
||||
document.getElementById('loading').style.display = 'none';
|
||||
document.getElementById('dashboard-content').style.display = 'none';
|
||||
document.getElementById('error-content').textContent = message;
|
||||
document.getElementById('error-content').style.display = 'block';
|
||||
}
|
||||
|
||||
// Initialize dashboard when page loads
|
||||
document.addEventListener('DOMContentLoaded', initDashboard);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user