| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,87 @@ |
| 1 |
+/* This file is part of Jeedom. |
|
| 2 |
+* |
|
| 3 |
+* Jeedom is free software: you can redistribute it and/or modify |
|
| 4 |
+* it under the terms of the GNU General Public License as published by |
|
| 5 |
+* the Free Software Foundation, either version 3 of the License, or |
|
| 6 |
+* (at your option) any later version. |
|
| 7 |
+* |
|
| 8 |
+* Jeedom is distributed in the hope that it will be useful, |
|
| 9 |
+* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 10 |
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 11 |
+* GNU General Public License for more details. |
|
| 12 |
+* |
|
| 13 |
+* You should have received a copy of the GNU General Public License |
|
| 14 |
+* along with Jeedom. If not, see <http://www.gnu.org/licenses/>. |
|
| 15 |
+*/ |
|
| 16 |
+ |
|
| 17 |
+/* Permet la réorganisation des commandes dans l'équipement */ |
|
| 18 |
+$("#table_cmd").sortable({
|
|
| 19 |
+ axis: "y", |
|
| 20 |
+ cursor: "move", |
|
| 21 |
+ items: ".cmd", |
|
| 22 |
+ placeholder: "ui-state-highlight", |
|
| 23 |
+ tolerance: "intersect", |
|
| 24 |
+ forcePlaceholderSize: true |
|
| 25 |
+}) |
|
| 26 |
+ |
|
| 27 |
+/* Fonction permettant l'affichage des commandes dans l'équipement */ |
|
| 28 |
+function addCmdToTable(_cmd) {
|
|
| 29 |
+ if (!isset(_cmd)) {
|
|
| 30 |
+ var _cmd = {configuration: {}}
|
|
| 31 |
+ } |
|
| 32 |
+ if (!isset(_cmd.configuration)) {
|
|
| 33 |
+ _cmd.configuration = {}
|
|
| 34 |
+ } |
|
| 35 |
+ var tr = '<tr class="cmd" data-cmd_id="' + init(_cmd.id) + '">' |
|
| 36 |
+ tr += '<td class="hidden-xs">' |
|
| 37 |
+ tr += '<span class="cmdAttr" data-l1key="id"></span>' |
|
| 38 |
+ tr += '</td>' |
|
| 39 |
+ tr += '<td>' |
|
| 40 |
+ tr += '<div class="input-group">' |
|
| 41 |
+ tr += '<input class="cmdAttr form-control input-sm roundedLeft" data-l1key="name" placeholder="{{Nom de la commande}}">'
|
|
| 42 |
+ tr += '<span class="input-group-btn"><a class="cmdAction btn btn-sm btn-default" data-l1key="chooseIcon" title="{{Choisir une icône}}"><i class="fas fa-icons"></i></a></span>'
|
|
| 43 |
+ tr += '<span class="cmdAttr input-group-addon roundedRight" data-l1key="display" data-l2key="icon" style="font-size:19px;padding:0 5px 0 0!important;"></span>' |
|
| 44 |
+ tr += '</div>' |
|
| 45 |
+ tr += '<select class="cmdAttr form-control input-sm" data-l1key="value" style="display:none;margin-top:5px;" title="{{Commande info liée}}">'
|
|
| 46 |
+ tr += '<option value="">{{Aucune}}</option>'
|
|
| 47 |
+ tr += '</select>' |
|
| 48 |
+ tr += '</td>' |
|
| 49 |
+ tr += '<td>' |
|
| 50 |
+ tr += '<span class="type" type="' + init(_cmd.type) + '">' + jeedom.cmd.availableType() + '</span>' |
|
| 51 |
+ tr += '<span class="subType" subType="' + init(_cmd.subType) + '"></span>' |
|
| 52 |
+ tr += '</td>' |
|
| 53 |
+ tr += '<td>' |
|
| 54 |
+ tr += '<label class="checkbox-inline"><input type="checkbox" class="cmdAttr" data-l1key="isVisible" checked/>{{Afficher}}</label> '
|
|
| 55 |
+ tr += '<label class="checkbox-inline"><input type="checkbox" class="cmdAttr" data-l1key="isHistorized" checked/>{{Historiser}}</label> '
|
|
| 56 |
+ tr += '<label class="checkbox-inline"><input type="checkbox" class="cmdAttr" data-l1key="display" data-l2key="invertBinary"/>{{Inverser}}</label> '
|
|
| 57 |
+ tr += '<div style="margin-top:7px;">' |
|
| 58 |
+ tr += '<input class="tooltips cmdAttr form-control input-sm" data-l1key="configuration" data-l2key="minValue" placeholder="{{Min}}" title="{{Min}}" style="width:30%;max-width:80px;display:inline-block;margin-right:2px;">'
|
|
| 59 |
+ tr += '<input class="tooltips cmdAttr form-control input-sm" data-l1key="configuration" data-l2key="maxValue" placeholder="{{Max}}" title="{{Max}}" style="width:30%;max-width:80px;display:inline-block;margin-right:2px;">'
|
|
| 60 |
+ tr += '<input class="tooltips cmdAttr form-control input-sm" data-l1key="unite" placeholder="Unité" title="{{Unité}}" style="width:30%;max-width:80px;display:inline-block;margin-right:2px;">'
|
|
| 61 |
+ tr += '</div>' |
|
| 62 |
+ tr += '</td>' |
|
| 63 |
+ tr += '<td>'; |
|
| 64 |
+ tr += '<span class="cmdAttr" data-l1key="htmlstate"></span>'; |
|
| 65 |
+ tr += '</td>'; |
|
| 66 |
+ tr += '<td>' |
|
| 67 |
+ if (is_numeric(_cmd.id)) {
|
|
| 68 |
+ tr += '<a class="btn btn-default btn-xs cmdAction" data-action="configure"><i class="fas fa-cogs"></i></a> ' |
|
| 69 |
+ tr += '<a class="btn btn-default btn-xs cmdAction" data-action="test"><i class="fas fa-rss"></i> Tester</a>' |
|
| 70 |
+ } |
|
| 71 |
+ tr += '<i class="fas fa-minus-circle pull-right cmdAction cursor" data-action="remove" title="{{Supprimer la commande}}"></i></td>'
|
|
| 72 |
+ tr += '</tr>' |
|
| 73 |
+ $('#table_cmd tbody').append(tr)
|
|
| 74 |
+ var tr = $('#table_cmd tbody tr').last()
|
|
| 75 |
+ jeedom.eqLogic.buildSelectCmd({
|
|
| 76 |
+ id: $('.eqLogicAttr[data-l1key=id]').value(),
|
|
| 77 |
+ filter: {type: 'info'},
|
|
| 78 |
+ error: function (error) {
|
|
| 79 |
+ $('#div_alert').showAlert({message: error.message, level: 'danger'})
|
|
| 80 |
+ }, |
|
| 81 |
+ success: function (result) {
|
|
| 82 |
+ tr.find('.cmdAttr[data-l1key=value]').append(result)
|
|
| 83 |
+ tr.setValues(_cmd, '.cmdAttr') |
|
| 84 |
+ jeedom.cmd.changeType(tr, init(_cmd.subType)) |
|
| 85 |
+ } |
|
| 86 |
+ }) |
|
| 87 |
+} |