<?php
/*
    Выбор типа метрики
*/

$page_link = function($metric_type) {
    return $this->url('adm.reports', [                                        
        'lang' => $this->lang,
        'type' => $metric_type,
    ]);
};

?>

<div class="b-content__metric-type-select">
    <div class="select-metric">
        <span>Отчёт по: </span>
        <div class="dropdown" style="display:inline-block;">
            <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                <?= _t($listMetrics[$this->metricType]) ?>
                <span class="caret"></span>
            </button>
            <ul class="dropdown-menu" aria-labelledby="dropdownMenu">
                <?php foreach($listMetrics as $type => $title): ?>
                    <?php $current_class = ($type == $this->metricType) ? 'class="current"' : null; ?>
                    <li><a href="<?= $page_link($type) ?>" <?= $current_class ?> metric="<?= $type ?>"><?= _t($title) ?></a></li>
                <?php endforeach ?>
            </ul>
        </div>
    </div>
    
    <div class="select-dates">
        <span>Выберите дни: </span>
        <input type='text' id="date-value-1" class="date-value" value="<?=$dates[0] ?>" />
        <input type='text' id="date-value-2" class="date-value" value="<?=$dates[1] ?>" />
        <input type="checkbox" id="by-days">
        <label for="by-days"><?= _t('По дням') ?></label>
        <button type="button" class="btn btn-primary"><span><?= _t('Применить') ?></span></button> 
    </div>
    
</div>
