<div class="d-flex justify-content-between align-items-center mb-4">
    <div>
        <h1 class="darlink-title mb-1">Entrée de stock</h1>
        <p class="text-muted mb-0">Réception simple de marchandise sans module fournisseur.</p>
    </div>
    <a href="index.php?page=stock" class="btn btn-outline-secondary">Retour</a>
</div>

<div class="darlink-card p-4">
    <form method="post" action="index.php?page=stock_store_entry">
        <div class="row g-3">
            <div class="col-md-8">
                <label class="form-label">Article</label>
                <select name="article_id" class="form-select" required>
                    <option value="">Sélectionner un article</option>
                    <?php foreach ($articles as $article): ?>
                        <option value="<?= (int)$article['id'] ?>" data-price="<?= htmlspecialchars((string)$article['prix_achat_ht']) ?>">
                            <?= htmlspecialchars($article['reference'] . ' — ' . $article['designation']) ?>
                        </option>
                    <?php endforeach; ?>
                </select>
            </div>
            <div class="col-md-2">
                <label class="form-label">Quantité</label>
                <input type="number" step="1" min="1" name="quantite" class="form-control" required>
            </div>
            <div class="col-md-2">
                <label class="form-label">Prix achat HT</label>
                <input type="number" step="0.01" min="0" name="prix_achat_ht" class="form-control" value="0">
            </div>
            <div class="col-md-12">
                <label class="form-label">Commentaire</label>
                <textarea name="commentaire" class="form-control" rows="3" placeholder="Exemple : livraison fournisseur, entrée initiale..."></textarea>
            </div>
        </div>
        <div class="mt-4 d-flex justify-content-end gap-2">
            <a href="index.php?page=stock" class="btn btn-outline-secondary">Annuler</a>
            <button type="submit" class="btn darlink-btn-primary">Enregistrer l’entrée</button>
        </div>
    </form>
</div>
