Spaces:
Running
Running
| // Initialize Odoo connection (mock for demo) | |
| class OdooLibrary { | |
| constructor() { | |
| this.odooUrl = 'https://odoo.example.com'; | |
| this.dbName = 'library_db'; | |
| this.username = 'admin'; | |
| this.password = 'admin'; | |
| this.connected = false; | |
| } | |
| async connect() { | |
| console.log('Connecting to Odoo...'); | |
| // In a real app, this would make an API call to authenticate | |
| return new Promise(resolve => { | |
| setTimeout(() => { | |
| this.connected = true; | |
| console.log('Connected to Odoo'); | |
| resolve(true); | |
| }, 1000); | |
| }); | |
| } | |
| async getBooks() { | |
| if (!this.connected) await this.connect(); | |
| console.log('Fetching books from Odoo...'); | |
| // Mock data | |
| return [ | |
| { id: 1, name: "The Great Gatsby", author: "F. Scott Fitzgerald", available: true }, | |
| { id: 2, name: "To Kill a Mockingbird", author: "Harper Lee", available: false } | |
| ]; | |
| } | |
| } | |
| // Initialize when DOM is loaded | |
| document.addEventListener('DOMContentLoaded', () => { | |
| const library = new OdooLibrary(); | |
| window.odooLibrary = library; | |
| // Add animations to elements | |
| document.querySelectorAll('section').forEach((section, index) => { | |
| section.style.animationDelay = `${index * 0.1}s`; | |
| section.classList.add('animate-fade-in'); | |
| }); | |
| }); |