mirror of
https://github.com/CyanoFresh/SmartHomePHP.git
synced 2026-02-19 19:01:20 +01:00
Close #52
This commit is contained in:
@@ -296,6 +296,7 @@ class ItemController extends ActiveController
|
||||
return [
|
||||
'success' => true,
|
||||
'data' => $data,
|
||||
'item' => $item,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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,
|
||||
]) ?>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user