<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Building Cache</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
</head>
<body>
    <div class="container">
        <h1>Building Cache</h1>
        <p>Please wait while we build the item cache. This may take a few moments.</p>
        <div id="progress" class="progress">
            <div id="progress-bar" class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 0%"></div>
        </div>
    </div>

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script>
        $(document).ready(function() {
            $.post('/start_build_cache', function(data) {
                if (data.status === "success") {
                    $('#progress-bar').css('width', '100%').attr('aria-valuenow', 100);
                    window.location.href = '/';
                } else {
                    alert('Error building cache');
                }
            });
        });
    </script>
</body>
</html>
