{{define "main"}}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dashboard</title>
    <style>
        body {
            background-color: #1f1f1f;
            /* Dark background */
            font-family: Arial, sans-serif;
            color: #fff;
            /* White text */
            margin: 0;
            padding: 0;
        }

        .container {
            max-width: 800px;
            margin: 50px auto;
            padding: 20px;
        }

        h1 {
            text-align: center;
        }

        .button-group {
            text-align: center;
            margin-top: 20px;
            display: flex;
            flex-direction: column;
            gap: 5rem;
        }

        .button {
            display: inline-block;
            padding: 10px 20px;
            margin: 10px;
            background-color: #007bff;
            /* Blue button */
            color: #fff;
            text-decoration: none;
            border-radius: 5px;
            transition: background-color 0.3s ease;
        }

        .button:hover {
            background-color: #0056b3;
            /* Darker blue on hover */
        }

        .element {
            display: flex;
            gap: 1rem;
        }

        .subgroup {
            display: flex;
            flex-direction: column;
            gap: 2rem;
            background-color: #303030;
            border-radius: 15px;
            padding: 1rem;
        }
    </style>
</head>

<body>
    <div class="container">
        <h1>Dashboard Api:</h1>
        <div class="subgroup" style="gap:0.5rem;">

            <h3>Enviroment Variables:</h3>

            <div class="element">
                <button onclick="toggleImageOption()" class="button">Toggle</button>
                <h5>Image Processing: {{.imageOption}}</h5>

            </div>
            <h5>Concurrent Images: {{.concurrentImages}}</h5>
        </div>
        <div class="button-group">
            <div class="subgroup">

                <div class="element">
                    <a href="/initcwebp" class="button" style="background-color: orange;">Inizializza cwebp</a>

                </div>
                <div class="element">
                    <a href="/health" class="button" style="background-color: green;">Health Check</a>

                </div>
            </div>
            <div class="subgroup">
                <div class="element">
                    <a href="/miogest" class="button">Fetch MioGest</a>
                    <h4>Riceve dati dal xml giornaliero</h4>
                </div>
                <div class="element">
                    <a href="/miogest-sample" class="button">MioGest Sample</a>
                    <h4>Sample del file xml giornaliero</h4>
                </div>
                <div class="element">
                    <a href="/parse" class="button">Parse Update</a>
                    <h4>Prende i dati da miogest e li eabora, scarica e converte le foto</h4>
                </div>
                <div class="element">
                    <a href="/update" class="button">Set Update in db</a>
                    <h4>Aggiorna i dati nel database con i dati provenienti da miogest</h4>
                </div>
            </div>
            <div class="subgroup">
                <div class="element">
                    <a href="/cats" class="button">Sample Caratteristiche</a>
                </div>
                <div class="element">
                    <a href="/categ" class="button">Sample Categorie</a>
                </div>
                <div class="element">
                    <a href="/images/resetimages" class="button" style="background-color: red;">Reset Images</a>
                </div>
            </div>
        </div>
    </div>
</body>
<script>
    function toggleImageOption() {
        fetch("/image-option-toggle", {
            method: "POST",
        })
            .then(response => response.text())
            .then(data => {
                console.log(data);
                location.reload();
            });
    }

</script>

</html>

{{end}}