<div class="panel panel-primary panel-padding-large panel-margin-bottom">
    <div class="panel-heading">
        <h2 class="panel-title">
            <span class="the-title">Souke en quelques chiffres</span>
        </h2>
    </div>
    <div class="panel-body">
        <div class="row">
            <?= few_numbers_item($countProducersActive, 'Producteurs', 'actifs sur les 3 derniers mois'); ?>
            <?= few_numbers_item(few_numbers_format_number($countUsersActive), 'Clients', 'actifs sur les 3 derniers mois'); ?>
        </div>
        <div class="row">
            <?= few_numbers_item(few_numbers_format_number($countPointSalesActive), 'Points de vente', 'actifs sur les 3 derniers mois'); ?>
            <?= few_numbers_item(few_numbers_format_number($averageOrdersPerDay), 'Commandes clients / jour', 'en moyenne sur les 7 derniers jours'); ?>
        </div>
        <div class="row">
            <?= few_numbers_item(few_numbers_format_number($numberVisitsByDay), 'Visiteurs / jour', 'en moyenne sur les 30 derniers jours'); ?>
            <?= few_numbers_item(few_numbers_format_number($turnoverLastThirtyDays).' €', 'CA total producteurs', 'sur les 30 derniers jours'); ?>
        </div>
        <?php if($countProducersWithOptionTimeSaved): ?>
        <!--<div class="row">
            <?= few_numbers_item($timeSavedByProducersAverage.' h', 'Heures gagnées par semaine', 'moyenne sur '.$countProducersWithOptionTimeSaved.' producteur'.(($countProducersWithOptionTimeSaved) ? 's' : '')); ?>
        </div>-->
        <?php endif; ?>
    </div>
</div>

<?php

function few_numbers_item($number, $description, $detail = null) {
    $html = '<div class="col-md-12 col-lg-12 item"><div class="number">'.$number.'</div><div class="description">'.$description.'</div>';

    if($detail) {
        $html .= '<div class="detail">'.$detail.'</div>';
    }

    $html .= '</div>';

    return $html;
}

function few_numbers_format_number($number) {
    return number_format($number, 0, '', ' ');
}

?>