<div class="modal fade" id="modifierProduitFiniModal<?= $p['id'] ?>" tabindex="-1" aria-labelledby="modifierProduitFiniModalLabel<?= $p['id'] ?>" aria-hidden="true">
  <div class="modal-dialog">
    <form method="POST" action="/eagle_client_istanbulcups/api/production/modifier_produit_fini.php">
      <div class="modal-content">
        <div class="modal-header bg-warning text-dark">
          <h5 class="modal-title">Modifier Produit Fini #<?= $p['id'] ?></h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
        </div>
        <div class="modal-body">
          <input type="hidden" name="id" value="<?= $p['id'] ?>">
          <div class="mb-3">
            <label for="produit_id_pf_<?= $p['id'] ?>" class="form-label">Produit</label>
            <select name="produit_id" id="produit_id_pf_<?= $p['id'] ?>" class="form-select" required>
              <?php
              foreach ($produits as $prod) {
                  $selected = $prod['id'] == $p['produit_id'] ? "selected" : "";
                  echo "<option value='{$prod['id']}' $selected>" . htmlspecialchars($prod['nom']) . "</option>";
              }
              ?>
            </select>
          </div>
          <div class="mb-3">
            <label for="quantite_pf_<?= $p['id'] ?>" class="form-label">Quantité</label>
            <input type="number" name="quantite" id="quantite_pf_<?= $p['id'] ?>" class="form-control" min="1" value="<?= (int)$p['quantite'] ?>" required>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
          <button type="submit" class="btn btn-warning">Modifier</button>
        </div>
      </div>
    </form>
  </div>
</div>
