File size: 1,411 Bytes
110c62c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// 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');
    });
});