Скрытие графика при отсутствии выбранных категорий для отображения, формирование…

Скрытие графика при отсутствии выбранных категорий для отображения, формирование списка актуальных категорий таблицы
parent b2f8429a
......@@ -3,14 +3,14 @@ $(document).ready(function(){
var
selectorGraphChartStat = '#chart-graph-stat',
selectorActiveLine = '.b-filter__switch.current-metric .m-filter__switch-item_active',
selectorActiveTime = '.b-filter__switch.time .m-filter__switch-item_active',
selectorActiveDays = '.b-filter__switch.days .m-filter__switch-item_active',
selectorActiveData = '.b-filter__switch.metric-data .m-filter__switch-item_active',
//selectorActiveTime = '.b-filter__switch.time .m-filter__switch-item_active',
//selectorActiveDays = '.b-filter__switch.days .m-filter__switch-item_active',
//selectorActiveData = '.b-filter__switch.metric-data .m-filter__switch-item_active',
activeLine = $(selectorActiveLine).data('filter-category'),
activeTime,
//activeTime,
activeDays,
toggelDates = [],
selectedCategoriesId = [],
//selectedCategoriesId = [],
weekDatesDataStart,
colorsActiveLines = {
'shows' : '#2CA02C',
......@@ -125,6 +125,14 @@ $(document).ready(function(){
// Определяем названия в легенде:
var selectedCategoriesId = $.TableStat.CheckedCategories();
//console.log('AAA selectedCategoriesId = ', selectedCategoriesId);
// Скрываем график, если в таблице не выбраны категории:
if (selectedCategoriesId.length == 0) {
$(selectorGraphChartStat).hide();
return false;
} else {
$(selectorGraphChartStat).show();
}
for (var i = 1; i <= activeLines.length; i++) {
var currentActiveLine = activeLines[i-1];
if (selectedCategoriesId.indexOf(currentActiveLine) > -1) {
......
......@@ -116,25 +116,13 @@ $(document).ready(function(){
Render: function(dataLineChartStat) {
// Формируем список переключателей (категорий) activeLines:
if (dataLineChartStat.report == 'common') {
activeLines = ['shows', 'clicks', 'transactions', 'salemoney', 'admoney'];
}
if (dataLineChartStat.report == 'transaction') {
activeLines = ['localmoney', 'usdollarmoney'];
}
/*
// Автоматизировать формирование списка категорий таблицы:
activeLines = [];
$('thead.metric.sortable th input[type="checkbox"]', $table).each(function(){
if ($(this).is(":checked")) {
listCats.push($(this).data('field'));
}
})
*/
$('thead.metric.sortable th b.cat', $table).each(function(){
activeLines.push($(this).attr('id'));
});
//console.log('AAA TableStat render: ', dataLineChartStat);
console.log('AAA activeLines: ', activeLines);
//console.log('AAA activeLines: ', activeLines);
dataTable = {};
activeLines.forEach(function(item){
......@@ -155,7 +143,7 @@ $(document).ready(function(){
if ($(this).is(":checked")) {
listCats.push($(this).data('field'));
}
})
});
return listCats;
},
......
......@@ -189,7 +189,7 @@ $system_link = $this->url('adm.system.actions');
<input type="checkbox" data-field="<?= $name ?>" checked />
</span>
<?php endif; ?>
<b id="<?= $name ?>"><?= _t($name)?><!--<b class="arrow asc">&and;</b><b class="arrow desc">&or;</b>--></b>
<b class="cat" id="<?= $name ?>"><?= _t($name)?><!--<b class="arrow asc">&and;</b><b class="arrow desc">&or;</b>--></b>
</th>
<?php endforeach; ?>
</tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment