Index: frontend/js/AdminPanel.js
===================================================================
--- frontend/js/AdminPanel.js	(revision c164f8f00c59f28d9cb253011c0a27c7471171ee)
+++ frontend/js/AdminPanel.js	(revision c164f8f00c59f28d9cb253011c0a27c7471171ee)
@@ -0,0 +1,49 @@
+document.getElementById('startScraperButton').addEventListener('click', function() {
+
+    fetch('/admin/start-scraper', { method: 'POST' })
+        .then(response => response.json())
+        .then(data => alert(data.message))
+        .catch(error => console.error('Error:', error));
+
+    fetchLastUpdateTime();
+});
+function popupConfirm(){
+    const div = document.getElementById('warning').style.display = 'block';
+}
+function popupClose(){
+    const div = document.getElementById('warning').style.display = 'none';
+}
+document.getElementById('confirmDrop').addEventListener('click', function() {
+
+    fetch('/admin/drop-db', {method: 'GET'}).then(r => alert("Database dropped")).catch(err => console.error(err));
+    popupClose();
+});
+function fetchLastUpdateTime() {
+    fetch('/admin/last-update-time')
+        .then(response => response.json())
+        .then(data => {
+            document.getElementById('lastUpdateTime').textContent = new Date(data.lastUpdateTime).toLocaleString();
+        })
+        .catch(error => console.error('Error fetching last update time:', error));
+}
+function fetchCurrentOptionsCount() {
+    fetch('/admin/current-options-count')
+        .then(response => response.json())
+        .then(data => {
+            document.getElementById('currentOptionsCount').textContent = data.currentOptionsCount;
+        })
+        .catch(error => console.error('Error fetching current options count:', error));
+}
+
+// Fetch data when the page loads
+document.addEventListener('DOMContentLoaded', function() {
+    fetchLastUpdateTime();
+    fetchCurrentOptionsCount();
+});
+
+
+document.getElementById('logoutButton').addEventListener('click', function() {
+    sessionStorage.removeItem('loggedIn');
+    sessionStorage.removeItem('userEmail');
+    window.location.href = 'index.html'; // Redirect
+});
Index: frontend/js/formHandler.js
===================================================================
--- frontend/js/formHandler.js	(revision c164f8f00c59f28d9cb253011c0a27c7471171ee)
+++ frontend/js/formHandler.js	(revision c164f8f00c59f28d9cb253011c0a27c7471171ee)
@@ -0,0 +1,137 @@
+document.addEventListener('DOMContentLoaded', function() {
+    const form = document.getElementById('form-id'); // Ensure the form has the correct ID
+    const loadingOverlay = document.getElementById('loadingOverlay');
+
+    form.addEventListener('submit', function(event) {
+        event.preventDefault(); // Prevent the default form submission
+
+        // Collect form data
+        const formData = new FormData(form);
+        const data = {};
+        let isValid = true;
+        let errorMessage = "";
+
+        // Validate form data
+        formData.forEach((value, key) => {
+            data[key] = value;
+            if (key === "departureDate") {
+                const today = new Date();
+                const departureDate = new Date(value);
+                if (departureDate <= today) {
+                    isValid = false;
+                    errorMessage += "Датумот на поаѓање е грешен!.\n";
+                }
+            }
+            if (key === "destination" && !value) {
+                isValid = false;
+                errorMessage += "Внесете дестинација.\n";
+            }
+
+        });
+
+        if (!isValid) {
+            alert(errorMessage);
+            return;
+        }
+
+        // Show the loading overlay
+        loadingOverlay.style.display = 'flex';
+
+        // Send form data to the server
+        fetch('/submit', {
+            method: 'POST',
+            headers: {
+                'Content-Type': 'application/json'
+            },
+            body: JSON.stringify(data)
+        })
+            .then(response => response.json())
+            .then(data => {
+
+                loadingOverlay.style.display = 'none';
+
+                const dataList = document.getElementById('givenOptions');
+                dataList.innerHTML = '';
+                if (data.length === 0) {
+                    const wrapper = document.createElement('div');
+                    const text = document.createElement('p');
+                    text.textContent = "Не се пронајдени резултати за вашето пребарување!";
+                    wrapper.appendChild(text);
+                    dataList.appendChild(wrapper);
+                }
+                data.forEach(item => {
+
+                    const optionDiv = document.createElement('div');
+                    optionDiv.classList.add('option');
+                    //Option from
+
+                    //image
+                    const img = document.createElement('img');
+                    img.classList.add('image');
+                    img.src = item.imgSrc; // Use item.imageSrc if available
+                    optionDiv.appendChild(img);
+                    const WrapperDiv = document.createElement('div');
+                    optionDiv.appendChild(WrapperDiv);
+                    //hotel
+                    const nameParagraph = document.createElement('p');
+                    nameParagraph.id = 'name';
+                    nameParagraph.textContent = item.hotelName;
+                    WrapperDiv.appendChild(nameParagraph);
+
+                    //Destination
+                    const countryParagraph = document.createElement('p');
+                    countryParagraph.id = 'country';
+                    countryParagraph.style.fontSize = '20px';
+                    countryParagraph.textContent = item.country;
+                    WrapperDiv.appendChild(countryParagraph);
+                    const dateParagraph = document.createElement('h2');
+                    dateParagraph.id = 'date';
+                    dateParagraph.textContent = item.dateRange;
+                    WrapperDiv.appendChild(dateParagraph);
+                    //price
+                    const priceHeading = document.createElement('h1');
+                    priceHeading.textContent = 'Цена:';
+                    WrapperDiv.appendChild(priceHeading);
+                    const priceParagraph = document.createElement('h2');
+                    priceParagraph.id = 'price';
+                    priceParagraph.textContent = item.price + "EUR";
+                    WrapperDiv.appendChild(priceParagraph);
+
+                    //  link and button
+                    const link = document.createElement('a');
+                    link.id = 'link';
+                    link.href = item.link; // Use item.link if available
+                    link.target = '_blank'; // Open link in new tab
+
+                    const button = document.createElement('button');
+                    button.classList.add('btn', 'login-button');
+                    button.textContent = 'Линк до страна';
+                    const btnWrapDiv = document.createElement('div');
+                    btnWrapDiv.classList.add('btnWrapper');
+                    const favBtn = document.createElement('button');
+                    favBtn.classList.add('favBtn','btn');
+                    favBtn.id = 'favBtnId';
+                    favBtn.textContent = 'Додадете во омилени';
+                    favBtn.setAttribute('data-option-id', item.id);
+                    favBtn.addEventListener('click', function () {
+                        const optionId = this.getAttribute('data-option-id');
+                        saveFavoriteOption(optionId);
+                    });
+
+                    btnWrapDiv.appendChild(link);
+                    link.appendChild(button);
+                    btnWrapDiv.appendChild(favBtn);
+
+                    optionDiv.appendChild(btnWrapDiv);
+                    // Append option div to dataList
+                    dataList.appendChild(optionDiv);
+                });
+                updateFavoriteButtons();
+            })
+            .catch(error => {
+                console.error('Error fetching data:', error);
+                // Hide the loading overlay in case of error
+                loadingOverlay.style.display = 'none';
+            });
+    });
+});
Index: frontend/js/loginHandler.js
===================================================================
--- frontend/js/loginHandler.js	(revision c164f8f00c59f28d9cb253011c0a27c7471171ee)
+++ frontend/js/loginHandler.js	(revision c164f8f00c59f28d9cb253011c0a27c7471171ee)
@@ -0,0 +1,154 @@
+document.addEventListener('DOMContentLoaded', function() {
+    const loginForm = document.getElementById('loginForm');
+    const registerForm = document.getElementById('registerForm');
+    const loginResponse = document.getElementById('loginResponse');
+    const registerResponse = document.getElementById('registerResponse');
+
+    checkSession();
+
+    loginForm.addEventListener('submit', function(event) {
+        event.preventDefault();
+
+        const email = loginForm.email.value;
+        const password = loginForm.password.value;
+
+        const data = {
+            email: email,
+            password: password
+        };
+
+        fetch('/account/login', {
+            method: 'POST',
+            headers: {
+                'Content-Type': 'application/json'
+            },
+            body: JSON.stringify(data)
+        })
+            .then(response => response.json())
+            .then(data => {
+                if (data.sessionId) {
+                    loginResponse.textContent = data.message;
+                    sessionStorage.setItem('loggedIn', 'true');
+                    sessionStorage.setItem('user', JSON.stringify(email));
+                    sessionStorage.setItem('isAdmin', data.isAdmin);
+                    document.cookie = `sessionId=${data.sessionId}; path=/`;
+                    showLoggedInState();
+                    closeLoginPopup();
+                } else {
+                    throw new Error(data.message);
+                }
+            })
+            .catch(error => {
+                showMessage('loginResponse', 'error', error.message);
+            });
+    });
+
+    registerForm.addEventListener('submit', function(event) {
+        event.preventDefault();
+
+        const username = registerForm.username.value;
+        const email = registerForm.email.value;
+        const password = registerForm.password.value;
+
+        const data = {
+            username: username,
+            email: email,
+            password: password
+        };
+
+        fetch('/account/register', {
+            method: 'POST',
+            headers: {
+                'Content-Type': 'application/json'
+            },
+            body: JSON.stringify(data)
+        })
+            .then(response => response.json())
+            .then(data => {
+                if (response.ok) {
+                    showMessage('registerResponse', 'success', data.message);
+                    closeRegisterPopup();
+                } else {
+                    throw new Error(data.message);
+                }
+            })
+            .catch(error => {
+                showMessage('registerResponse', 'error', error.message);
+            });
+    });
+});
+
+function checkSession() {
+    fetch('/account/session', {
+        method: 'GET',
+        credentials: 'include'
+    })
+        .then(response => response.json())
+        .then(data => {
+            if (data.loggedIn) {
+                sessionStorage.setItem('loggedIn', 'true');
+                sessionStorage.setItem('user', JSON.stringify(data.user));
+                sessionStorage.setItem('isAdmin', data.isAdmin);
+                showLoggedInState();
+            } else {
+                sessionStorage.clear();
+                showLoggedOutState();
+            }
+        })
+        .catch(error => {
+            console.error('Error checking session:', error);
+            sessionStorage.clear();
+            showLoggedOutState();
+        });
+}
+
+function logout() {
+    fetch('/account/logout', {
+        method: 'POST',
+        credentials: 'include'
+    })
+        .then(response => {
+            if (response.ok) {
+                sessionStorage.clear();
+                document.cookie = "sessionId=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
+                showLoggedOutState();
+            } else {
+                throw new Error('Logout failed');
+            }
+        })
+        .catch(error => {
+            console.error('Error logging out:', error);
+        });
+}
+
+
+function handleCredentialResponse(response) {
+    const email = JSON.parse(atob(response.credential.split('.')[1])).email;
+    fetch('/account/login', {
+        method: 'POST',
+        headers: {
+            'Content-Type': 'application/json'
+        },
+        body: JSON.stringify({ id_token: response.credential })
+    })
+        .then(response => response.json())
+        .then(data => {
+            if (data.sessionId) {
+                sessionStorage.setItem('loggedIn', 'true');
+                sessionStorage.setItem('user', JSON.stringify(email));
+                sessionStorage.setItem('isAdmin', data.isAdmin);
+                document.cookie = `sessionId=${data.sessionId}; path=/`;
+                showLoggedInState();
+                closeLoginPopup();
+            } else {
+                throw new Error(data.message);
+            }
+        })
+        .catch(error => {
+            console.error(error);
+            showMessage('loginResponse', 'error', 'Google login failed');
+        });
+}
+
+
+
Index: frontend/js/siteFlow.js
===================================================================
--- frontend/js/siteFlow.js	(revision c164f8f00c59f28d9cb253011c0a27c7471171ee)
+++ frontend/js/siteFlow.js	(revision c164f8f00c59f28d9cb253011c0a27c7471171ee)
@@ -0,0 +1,290 @@
+function getUserDetails() {
+    return JSON.parse(sessionStorage.getItem('user'));
+}
+
+function deleteAccount() {
+    fetch('/delete-account', {
+        method: 'POST',
+        headers: {
+            'Content-Type': 'application/json'
+        },
+        body: JSON.stringify(getUserDetails())
+    })
+        .then(response => response.json())
+        .then(data => {
+            if (data.success) {
+                sessionStorage.clear();
+                logout();
+                alert('Account deleted successfully');
+            } else {
+                alert('Failed to delete account: ' + data.message);
+            }
+        })
+        .catch(error => {
+            console.error('Error:', error);
+            alert('Failed to delete account: ' + error.message);
+        });
+}
+
+function logout() {
+    sessionStorage.clear();
+    document.cookie = "sessionId=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
+    showLoggedOutState();
+    fetch('/account/logout', {
+        method: 'POST',
+        credentials: 'include'
+    });
+}
+
+function openAccountDetails() {
+    document.getElementById('AccountDetailsOverlay').style.display = 'block';
+}
+
+function confirmDelete() {
+    document.getElementById('confDel').style.display = 'block';
+}
+
+function closeConfirmDelete() {
+    document.getElementById('confDel').style.display = 'none';
+}
+
+function openLoginPopup() {
+    document.getElementById('loginPopup').style.display = 'block';
+}
+
+function closeLoginPopup() {
+    document.getElementById('loginPopup').style.display = 'none';
+}
+
+function openRegisterPopup() {
+    document.getElementById('registerPopup').style.display = 'block';
+}
+
+function closeRegisterPopup() {
+    document.getElementById('registerPopup').style.display = 'none';
+}
+
+function showLoggedInState() {
+    document.getElementById('loginButton').style.display = 'none';
+    document.getElementById('logoutButton').style.display = 'block';
+    document.getElementById('savedTripsButton').style.display = 'block';
+    document.getElementById('accBtn').style.display = 'block';
+
+    var style = document.createElement('style');
+    style.innerHTML = '.favBtn { display: block; }';
+    document.head.appendChild(style);
+
+    if (sessionStorage.getItem('isAdmin') === 'true') {
+        document.getElementById('adminPanelButton').style.display = 'block';
+    }
+}
+
+
+function showMessage(elementId, type, message) {
+    const element = document.getElementById(elementId);
+    if (!element) {
+        console.error(`Element with id ${elementId} not found`);
+        return;
+    }
+    element.textContent = message;
+    element.className = `message ${type}`;
+}
+
+
+function showLoggedOutState() {
+    document.getElementById('loginButton').style.display = 'block';
+    document.getElementById('logoutButton').style.display = 'none';
+    document.getElementById('savedTripsButton').style.display = 'none';
+    document.getElementById('accBtn').style.display = 'none';
+    var style = document.createElement('style');
+    style.innerHTML = '.favBtn { display: none; }';
+    document.head.appendChild(style);
+    document.getElementById('loginResponse').style.display = 'none';
+    document.getElementById('adminPanelButton').style.display = 'none';
+}
+
+function goToAdminPanel() {
+    window.location.href = '/admin-panel';
+}
+function showLoginFeedback(success, message) {
+    const loginResponse = document.getElementById('loginResponse');
+    loginResponse.textContent = message;
+    loginResponse.style.color = success ? 'green' : 'red';
+    loginResponse.style.display = 'block';
+}
+
+window.onclick = function(event) {
+    const loginPopup = document.getElementById('loginPopup');
+    const registerPopup = document.getElementById('registerPopup');
+    const accountPopup = document.getElementById('AccountDetailsOverlay');
+    if (event.target === loginPopup) {
+        loginPopup.style.display = 'none';
+    }
+    if (event.target === registerPopup) {
+        registerPopup.style.display = 'none';
+    }
+    if (event.target === accountPopup) {
+        accountPopup.style.display = 'none';
+    }
+}
+
+document.addEventListener('DOMContentLoaded', function() {
+    checkSession();
+
+    document.querySelectorAll('.favBtn').forEach(button => {
+        button.addEventListener('click', function() {
+            const optionId = this.getAttribute('data-option-id');
+            saveFavoriteOption(optionId);
+        });
+    });
+
+    document.getElementById('savedTripsButton').addEventListener('click', function() {
+        document.getElementById('savedTripsOverlay').style.display = 'block';
+        fetchSavedTrips();
+        //fetchPriceChanges();
+    });
+
+    document.querySelector('.close').addEventListener('click', function() {
+        document.getElementById('savedTripsOverlay').style.display = 'none';
+    });
+});
+
+
+function saveFavoriteOption(optionId) {
+    const mail = sessionStorage.getItem('user').replace(/^"|"$/g, '');
+    fetch('/save-favorite', {
+        method: 'POST',
+        headers: {
+            'Content-Type': 'application/json'
+        },
+        body: JSON.stringify({ optionId: optionId, user: mail })
+    })
+        .then(response => {
+            if (response.ok) {
+                return response.json();
+            }
+            throw new Error('Network response was not ok.');
+        })
+        .then(data => {
+            console.log('Option saved:', data);
+            // Update the UI to reflect that the option was saved
+            updateFavoriteButtons();
+        })
+        .catch(error => {
+            console.error('Error:', error);
+        });
+}
+
+function updateFavoriteButtons() {
+    const mail = sessionStorage.getItem('user').replace(/^"|"$/g, '');
+    fetch('/get-saved-trips', {
+        method: 'POST',
+        headers: {
+            'Content-Type': 'application/json'
+        },
+        body: JSON.stringify({ userEmail: mail })
+    })
+        .then(response => response.json())
+        .then(data => {
+            // Extract the option IDs of saved trips
+            const savedOptionIds = data.savedTrips.map(trip => trip.id);
+
+            document.querySelectorAll('.favBtn').forEach(button => {
+                const optionId = parseInt(button.getAttribute('data-option-id'), 10);
+                if (savedOptionIds.includes(optionId)) {
+                    button.disabled = true;
+                    button.textContent = 'Зачувано';
+                } else {
+                    button.disabled = false;
+                    button.textContent = 'Додадете во омилени';
+                }
+            });
+        })
+        .catch(error => {
+            console.error('Error fetching saved options:', error);
+        });
+}
+
+function fetchSavedTrips() {
+    const userEmail = sessionStorage.getItem('user').replace(/^"|"$/g, '');
+    fetch('/get-saved-trips', {
+        method: 'POST',
+        headers: {
+            'Content-Type': 'application/json'
+        },
+        body: JSON.stringify({ userEmail: userEmail })
+    })
+        .then(response => response.json())
+        .then(data => {
+
+            const savedTripsList = document.getElementById('savedTripsList');
+            savedTripsList.innerHTML = '';
+            data.savedTrips.forEach(trip => {
+                const tripDiv = document.createElement('div');
+                tripDiv.classList.add('option');
+
+                const closeButton = document.createElement('button');
+                closeButton.classList.add('remove-option');
+                closeButton.textContent = '×';
+                closeButton.onclick = function() {
+                    removeFromSaved(trip.id);
+                };
+                tripDiv.appendChild(closeButton);
+
+                const hotelName = document.createElement('p');
+                hotelName.textContent = trip.hotelName;
+                const country = document.createElement('p');
+                country.textContent = trip.country;
+                const price = document.createElement('p');
+                price.textContent = trip.price + "€";
+
+                tripDiv.appendChild(hotelName);
+                tripDiv.appendChild(country);
+                tripDiv.appendChild(price);
+
+                savedTripsList.appendChild(tripDiv);
+            });
+
+
+            const priceChangesList = document.getElementById('priceChangesList');
+            priceChangesList.innerHTML = '';
+            const priceChanges = data.savedTrips.filter(trip => trip.priceChanged);
+            if (priceChanges.length > 0) {
+                priceChanges.forEach(change => {
+                    const changeDiv = document.createElement('div');
+                    changeDiv.classList.add('price-change');
+                    changeDiv.textContent = `Цената на ${change.hotelName} има промена од ${change.price}€ во ${change.newPrice}€`;
+                    priceChangesList.appendChild(changeDiv);
+                });
+            } else {
+                priceChangesList.textContent = "нема промена на цената.";
+            }
+        })
+        .catch(error => {
+            console.error('Error fetching saved trips:', error);
+        });
+}
+function removeFromSaved(optionId) {
+    const userEmail = sessionStorage.getItem('user').replace(/^"|"$/g, '');
+    fetch('/remove-from-saved', {
+        method: 'POST',
+        headers: {
+            'Content-Type': 'application/json'
+        },
+        body: JSON.stringify({ optionId: optionId, userEmail: userEmail })
+    })
+        .then(response => {
+            if (response.ok) {
+                return response.json();
+            }
+            throw new Error('Network response was not ok.');
+        })
+        .then(data => {
+            if (data.success) {
+                fetchSavedTrips();
+            }
+        })
+        .catch(error => {
+            console.error('Error:', error);
+        });
+}
