<?php
    $statGeneral = stats::countStatistiquesGenerale();
    $stat147 = stats::countStatistiquesByLieu("147");
    $statLyon = stats::countStatistiquesByLieu("LYON");
    $statPerol = stats::countStatistiquesByLieu("PEROLS");
    $statCambacere = stats::countStatistiquesByLieu("CAMBACERE");
    $statBlagnac = stats::countStatistiquesByLieu("BLAGNAC");
    $statBouchardo = stats::countStatistiquesByLieu("BOUCHARDO"); 
?>
<div class="row" style="margin-top: 20x;">
    
    <div class="col-md-10" style="margin-top: 30px;">
        <h6 class="bg-light p-2">Général</h6>
        <?php
        $config = array(
            "id" => "ContratActif",
            "charts" => "doughnut",
            "label" => "Général",
            "data" => array(
                array("label" => "Contrats actifs", "nb" => $statGeneral["ContratOn"]),
                array("label" => "Contrats en arrêt", "nb" => $statGeneral["ContratOff"]))
        );

        chart::printCanvas($config);
        ?>  
    </div>
    
    <div class="col-md-5" style="margin-top: 30px;">
        <h6 class="bg-light p-2">Paris - 147</h6>
        <?php
        $config = array(
            "id" => "stat147ContratActif",
            "charts" => "doughnut",
            "label" => "Paris - 147",
            "data" => array(
                array("label" => "Contrats actifs", "nb" => $stat147["ContratOn"]),
                array("label" => "Contrats en arrêt", "nb" => $stat147["ContratOff"]))
        );

        chart::printCanvas($config);
        ?>  
    </div>
    <div class="col-md-5" style="margin-top: 30px;">
        <h6 class="bg-light p-2">Lyon</h6>
        <?php
        $config = array(
            "id" => "statLyonContratActif",
            "charts" => "doughnut",
            "label" => "Lyon",
            "data" => array(
                array("label" => "Contrats actifs", "nb" => $statLyon["ContratOn"]),
                array("label" => "Contrats en arrêt", "nb" => $statLyon["ContratOff"]))
        );

        chart::printCanvas($config);
        ?>  
    </div>
    
    <div class="col-md-5" style="margin-top: 30px;">
        <h6 class="bg-light p-2">Montpellier - Pérols</h6>
        <?php
        $config = array(
            "id" => "statPerolContratActif",
            "charts" => "doughnut",
            "label" => "Montpellier - Pérols",
            "data" => array(
                array("label" => "Contrats actifs", "nb" => $statPerol["ContratOn"]),
                array("label" => "Contrats en arrêt", "nb" => $statPerol["ContratOff"]))
        );

        chart::printCanvas($config);
        ?>  
    </div>
    <div class="col-md-5" style="margin-top: 30px;">
        <h6 class="bg-light p-2">Paris - Cambacérès</h6>
        <?php
        $config = array(
            "id" => "statCambacereContratActif",
            "charts" => "doughnut",
            "label" => "Paris - Cambacérès",
            "data" => array(
                array("label" => "Contrats actifs", "nb" => $statCambacere["ContratOn"]),
                array("label" => "Contrats en arrêt", "nb" => $statCambacere["ContratOff"]))
        );

        chart::printCanvas($config);
        ?>  
    </div>
    
    <div class="col-md-5" style="margin-top: 30px;">
        <h6 class="bg-light p-2">Toulouse - Blagnac</h6>
        <?php
        $config = array(
            "id" => "statBlagnacContratActif",
            "charts" => "doughnut",
            "label" => "Toulouse - Blagnac",
            "data" => array(
                array("label" => "Contrats actifs", "nb" => $statBlagnac["ContratOn"]),
                array("label" => "Contrats en arrêt", "nb" => $statBlagnac["ContratOff"]))
        );

        chart::printCanvas($config);
        ?>  
    </div>
    <div class="col-md-5" style="margin-top: 40px;">
        <h6 class="bg-light p-2">Paris - Bouchardo</h6>
        <?php
        $config = array(
            "id" => "statBouchardoContratActif",
            "charts" => "doughnut",
            "label" => "Paris - Bouchardo",
            "data" => array(
                array("label" => "Contrats actifs", "nb" => $statBouchardo["ContratOn"]),
                array("label" => "Contrats en arrêt", "nb" => $statBouchardo["ContratOff"]))
        );

        chart::printCanvas($config);
        ?>  
    </div>
    
</div>