Spaces:
Running
Running
Upload 4 files
Browse files- base64-data.js +0 -0
- bundle.js +0 -0
- dark-theme.css +77 -0
- db.js +134 -0
base64-data.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
bundle.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
dark-theme.css
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* dark-theme.css - Professional VS Code Grey Theme Overrides */
|
| 2 |
+
|
| 3 |
+
.dark-theme {
|
| 4 |
+
/* Base Colors Overrides */
|
| 5 |
+
--bg-color: #0f172a;
|
| 6 |
+
--card-bg: #1e293b;
|
| 7 |
+
--text-color: #f1f5f9;
|
| 8 |
+
--label-color: #94a3b8;
|
| 9 |
+
--border-color: #334155;
|
| 10 |
+
--input-bg: #1e293b;
|
| 11 |
+
--accent-color: #3b82f6;
|
| 12 |
+
--accent-hover: #60a5fa;
|
| 13 |
+
--text-muted: #94a3b8;
|
| 14 |
+
|
| 15 |
+
/* Premium Glassmorphism */
|
| 16 |
+
--glass-bg: rgba(15, 23, 42, 0.7);
|
| 17 |
+
--glass-border: rgba(30, 41, 59, 0.5);
|
| 18 |
+
--glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
|
| 19 |
+
|
| 20 |
+
/* Branding Gradients */
|
| 21 |
+
--primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 22 |
+
--secondary-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
|
| 23 |
+
--surface-gradient: radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 40%),
|
| 24 |
+
radial-gradient(circle at 90% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 40%);
|
| 25 |
+
|
| 26 |
+
/* Dynamic Overrides */
|
| 27 |
+
--shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
|
| 28 |
+
--shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
/* Scrollbar Overrides for Dark Mode */
|
| 32 |
+
.dark-theme ::-webkit-scrollbar-track {
|
| 33 |
+
background: #1e1e1e;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
.dark-theme ::-webkit-scrollbar-thumb {
|
| 37 |
+
background: #424242;
|
| 38 |
+
border: 3px solid #1e1e1e;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
.dark-theme ::-webkit-scrollbar-thumb:hover {
|
| 42 |
+
background: #4f4f4f;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.dark-theme .form-group input:hover,
|
| 46 |
+
.dark-theme .form-group textarea:hover {
|
| 47 |
+
box-shadow: var(--shadow-md);
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/* Specific UI Overrides where variables aren't enough */
|
| 51 |
+
.dark-theme .form-group input:focus,
|
| 52 |
+
.dark-theme .form-group textarea:focus {
|
| 53 |
+
box-shadow: 0 0 20px 3px rgba(0, 122, 204, 0.3), 0 4px 15px rgba(0, 0, 0, 0.5);
|
| 54 |
+
background-color: #2d2d2d;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
.dark-theme .history-item {
|
| 60 |
+
background: #252526;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
.dark-theme .history-item:hover {
|
| 64 |
+
background: #2d2d2d;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
.dark-theme .btn-history-print {
|
| 68 |
+
background: #333333;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
.dark-theme .btn-history-print:hover {
|
| 72 |
+
background: #007acc;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
.dark-theme .photo-preview-container {
|
| 76 |
+
background: #252526;
|
| 77 |
+
}
|
db.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* db.js
|
| 3 |
+
* IndexedDB-based local storage for Aadhaar History
|
| 4 |
+
* Works offline and on static hosts like Netlify.
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
const DB_NAME = 'AadhaarHistoryDB';
|
| 8 |
+
const STORE_NAME = 'history';
|
| 9 |
+
const DB_VERSION = 1;
|
| 10 |
+
|
| 11 |
+
const dbService = {
|
| 12 |
+
_db: null,
|
| 13 |
+
|
| 14 |
+
async init() {
|
| 15 |
+
if (this._db) return this._db;
|
| 16 |
+
|
| 17 |
+
return new Promise((resolve, reject) => {
|
| 18 |
+
const request = indexedDB.open(DB_NAME, DB_VERSION);
|
| 19 |
+
|
| 20 |
+
request.onupgradeneeded = (event) => {
|
| 21 |
+
const db = event.target.result;
|
| 22 |
+
if (!db.objectStoreNames.contains(STORE_NAME)) {
|
| 23 |
+
db.createObjectStore(STORE_NAME, { keyPath: 'id' });
|
| 24 |
+
}
|
| 25 |
+
};
|
| 26 |
+
|
| 27 |
+
request.onsuccess = (event) => {
|
| 28 |
+
this._db = event.target.result;
|
| 29 |
+
resolve(this._db);
|
| 30 |
+
};
|
| 31 |
+
|
| 32 |
+
request.onerror = (event) => {
|
| 33 |
+
console.error('IndexedDB error:', event.target.error);
|
| 34 |
+
reject(event.target.error);
|
| 35 |
+
};
|
| 36 |
+
});
|
| 37 |
+
},
|
| 38 |
+
|
| 39 |
+
async getAll() {
|
| 40 |
+
const db = await this.init();
|
| 41 |
+
return new Promise((resolve, reject) => {
|
| 42 |
+
const transaction = db.transaction([STORE_NAME], 'readonly');
|
| 43 |
+
const store = transaction.objectStore(STORE_NAME);
|
| 44 |
+
const request = store.getAll();
|
| 45 |
+
|
| 46 |
+
request.onsuccess = () => {
|
| 47 |
+
// Sort by timestamp descending (newest first)
|
| 48 |
+
const results = request.result || [];
|
| 49 |
+
results.sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp));
|
| 50 |
+
resolve(results);
|
| 51 |
+
};
|
| 52 |
+
|
| 53 |
+
request.onerror = (event) => {
|
| 54 |
+
console.error('Failed to get history:', event.target.error);
|
| 55 |
+
resolve([]);
|
| 56 |
+
};
|
| 57 |
+
});
|
| 58 |
+
},
|
| 59 |
+
|
| 60 |
+
async save(item) {
|
| 61 |
+
const db = await this.init();
|
| 62 |
+
|
| 63 |
+
// Ensure item has ID and Timestamp
|
| 64 |
+
if (!item.id) item.id = Date.now().toString();
|
| 65 |
+
if (!item.timestamp) item.timestamp = new Date().toLocaleString();
|
| 66 |
+
|
| 67 |
+
return new Promise((resolve, reject) => {
|
| 68 |
+
const transaction = db.transaction([STORE_NAME], 'readwrite');
|
| 69 |
+
const store = transaction.objectStore(STORE_NAME);
|
| 70 |
+
const request = store.put(item);
|
| 71 |
+
|
| 72 |
+
request.onsuccess = async () => {
|
| 73 |
+
await this.enforceLimit(50);
|
| 74 |
+
resolve(item);
|
| 75 |
+
};
|
| 76 |
+
|
| 77 |
+
request.onerror = (event) => {
|
| 78 |
+
console.error('Failed to save history:', event.target.error);
|
| 79 |
+
reject(event.target.error);
|
| 80 |
+
};
|
| 81 |
+
});
|
| 82 |
+
},
|
| 83 |
+
|
| 84 |
+
async delete(id) {
|
| 85 |
+
const db = await this.init();
|
| 86 |
+
return new Promise((resolve, reject) => {
|
| 87 |
+
const transaction = db.transaction([STORE_NAME], 'readwrite');
|
| 88 |
+
const store = transaction.objectStore(STORE_NAME);
|
| 89 |
+
const request = store.delete(id);
|
| 90 |
+
|
| 91 |
+
request.onsuccess = () => resolve({ status: 'deleted' });
|
| 92 |
+
request.onerror = (event) => {
|
| 93 |
+
console.error('Failed to delete history:', event.target.error);
|
| 94 |
+
reject(event.target.error);
|
| 95 |
+
};
|
| 96 |
+
});
|
| 97 |
+
},
|
| 98 |
+
|
| 99 |
+
async clear() {
|
| 100 |
+
const db = await this.init();
|
| 101 |
+
return new Promise((resolve, reject) => {
|
| 102 |
+
const transaction = db.transaction([STORE_NAME], 'readwrite');
|
| 103 |
+
const store = transaction.objectStore(STORE_NAME);
|
| 104 |
+
const request = store.clear();
|
| 105 |
+
|
| 106 |
+
request.onsuccess = () => resolve();
|
| 107 |
+
request.onerror = (event) => reject(event.target.error);
|
| 108 |
+
});
|
| 109 |
+
},
|
| 110 |
+
|
| 111 |
+
async enforceLimit(limit = 50) {
|
| 112 |
+
const all = await this.getAll();
|
| 113 |
+
if (all.length > limit) {
|
| 114 |
+
const toDelete = all.slice(limit);
|
| 115 |
+
const db = await this.init();
|
| 116 |
+
const transaction = db.transaction([STORE_NAME], 'readwrite');
|
| 117 |
+
const store = transaction.objectStore(STORE_NAME);
|
| 118 |
+
|
| 119 |
+
toDelete.forEach(item => {
|
| 120 |
+
store.delete(item.id);
|
| 121 |
+
});
|
| 122 |
+
|
| 123 |
+
return new Promise((resolve) => {
|
| 124 |
+
transaction.oncomplete = () => resolve();
|
| 125 |
+
});
|
| 126 |
+
}
|
| 127 |
+
return Promise.resolve();
|
| 128 |
+
}
|
| 129 |
+
};
|
| 130 |
+
|
| 131 |
+
// Auto-initialize
|
| 132 |
+
dbService.init().catch(console.error);
|
| 133 |
+
|
| 134 |
+
window.dbService = dbService;
|