This commit is contained in:
Alex Solomaha
2017-04-20 23:32:39 +03:00
parent 40cfce69f9
commit 4c53cfb565
4 changed files with 13 additions and 5 deletions

View File

@@ -296,6 +296,7 @@ class ItemController extends ActiveController
return [
'success' => true,
'data' => $data,
'item' => $item,
];
}

View File

@@ -8,7 +8,8 @@
<div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">
<div class="panel-item panel-item-variable <?= $widget->html_class ?> withripple"
title="<?= $widget->getName() ?>"
data-item-id="<?= $widget->item_id ?>">
data-item-id="<?= $widget->item_id ?>"
data-item-type="<?= $widget->item->type ?>">
<div class="item-variable-icon">
<i class="fa <?= $widget->icon ?>"></i>
</div>

View File

@@ -57,7 +57,7 @@ $this->title = 'Панель Управления';
<?php endforeach; ?>
</div>
<div class="row panel-items-rgb">
<?php foreach ($room->getItemWidgets()->rgb()->all() as $widget): ?>
<?php foreach ($room->getItemWidgets()->rgb()->active()->all() as $widget): ?>
<?= $this->render('_rgb', [
'widget' => $widget,
]) ?>

View File

@@ -223,16 +223,22 @@ $(document).ready(function () {
var $modal = $('#item-chart-modal');
var $this = $(this);
var type = parseInt($this.data('item-type'));
var title = $this.data('original-title');
var itemId = $this.data('item-id');
var data;
if (type !== 20 && type !== 21 && type !== 22 && type !== 23) {
return;
}
$.ajax({
url: itemValueChartUrl + '&item_id=' + itemId,
dataType: 'json',
}).success(function (result) {
$modal.find('.item-chart-name').html(title);
var $canvas = $modal.find('#item-chart');
Date.prototype.formatMMDDYYYY = function () {
@@ -244,7 +250,6 @@ $(document).ready(function () {
data = [];
$.each(result.data, function (key, value) {
console.log(key);
labels.push(new Date(key * 1000).formatMMDDYYYY());
data.push(parseInt(value));
});
@@ -255,9 +260,10 @@ $(document).ready(function () {
datasets: [{
label: title,
data: data,
lineTension: 0,
backgroundColor: 'transparent',
borderColor: '#009688',
}],
borderColor: '#009688'
}]
};
// Get the context of the canvas element we want to select