<?php include("views/components/utilisateurs/head.php") ?>

<body id="conteneur-admin">
    <?php include("views/components/utilisateurs/section_employe.php") ?>
    <div class="conteneur-admin plat">
        <?php if (isset($_GET["infos_requises"])) : ?>
            <p class="alert alert-warning alert-dismissible fade show mt-3">
                <span class="material-icons">
                    warning
                </span>
                Toutes les informations sont requises, sauf l'image.
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </p>
        <?php endif; ?>

        <?php if (isset($_GET["echec_ajout_plat"])) : ?>
            <p class="alert alert-danger alert-dismissible fade show mt-3">
                <span class="material-icons">
                    error
                </span>
                Échec de l'ajout d'un nouveau plat... Réessayer plustard.
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </p>
        <?php endif; ?>
        <h3 id="modifier-ajouter">Ajouter un plat</h3>
        <section>
            <form action="admin-menu-enregistrer" method="POST" class="un-employe-plat" enctype="multipart/form-data">
                <label>
                    <p>Nom:</p>
                    <input type="text" name="nom" placeholder="Nom de l'entrée" autofocus>
                </label>
                <label>
                    <p>Description:</p>
                    <input type="text" name="description" placeholder="Description">
                </label>
                <label>
                    <p>Prix:</p>
                    <input type="number" step="any" name="prix">
                </label>
                <div class="plat-select">
                    <label>
                        <p>Catégorie:</p>
                        <select name="categorie" class="categorie-plat">
                            <?php foreach ($categories as $categorie) : ?>
                                <option value="<?= $categorie->id ?>"><?= $categorie->nom ?></option>
                            <?php endforeach; ?>
                        </select>
                    </label>
                    <label>
                        <p>Tags:</p>
                        <select name="tags" multiple>
                            <?php foreach ($tags as $tag) : ?>
                                <option value="<?= $tag->id ?>"><?= $tag->nom ?></option>
                            <?php endforeach; ?>
                        </select>
                    </label>
                </div>
                <label>
                    <p>Image</p>
                    <input type="file" name="image">
                </label>
                <input type="submit" value="Ajouter" class="menu-bouton bouton-modifier-ajouter">
            </form>
        </section>
    </div>
    <?php include("views/components/foot_js.php") ?>