<?php 
    /**
    *
    * copyright (c) 2013-2023 Heliac Technologies
    * license http://opensource.org/licenses/gpl-license.php GNU GPL v3 
    *
    * linee guida per l'utilizzo del logo http://www.geecom.org/index.php?alias=linee-guida-per-luso-del-logo-geecom
    * 
    */
    
    $tipoComponente = "componenteMail";
?>

<div id="aggiungi-componente" class="modal fade" tabindex="-1" aria-labelledby="aggiungi un componente" aria-hidden="true" role="dialog">
  <div class="modal-dialog modal-lg" role="document">

    <!-- Modal content-->
    <div class="modal-content">
        <div class="modal-header">
            <h5 class="modal-title">Aggiungi un componente</h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Chiudi">
                <span aria-hidden="true">&times;</span>
            </button>
        </div>
        <div class="modal-body">
            <div class="row d-flex align-items-stretch">
            <?php 
                $queryComponenti = "SELECT * FROM geecAd_componenti WHERE tipo LIKE '$tipoComponente' ORDER BY nome ASC";
                $risComponenti = $geecomDb->eseguiQueryLettura($queryComponenti);
                while($componente = $risComponenti->fetch_assoc()) {
                    echo"<div class=\"col-6 col-sm-4 col-md-3 col-lg-2 p-1 mb-2\">
                        <a href=\"../controller/controllerComunicazioni.php?operazione=aggiungiComponente&id={$comunicazione->getId()}&idComponente={$componente["id"]}\" class=\"btn btn-light btn-block\">"
                        . "<img class=\"img-fluid\" src=\"{$componente["icona"]}\">"
                        . "<h6>{$componente["nome"]}</h6>
                        </a>
                    </div>";
                }
            ?>
            </div>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">Annulla</button>
        </div>
    </div>
  </div>
</div>