From 7db1c1cdcf617e146e927c4aadde239959a9d3de Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 7 Mar 2017 15:32:22 +0500 Subject: Implement SMS commands --- web/app/view/DevicesController.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'web/app/view/DevicesController.js') diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js index ad0dd36..d65055e 100644 --- a/web/app/view/DevicesController.js +++ b/web/app/view/DevicesController.js @@ -74,28 +74,30 @@ Ext.define('Traccar.view.DevicesController', { }, onCommandClick: function () { - var device, deviceId, command, dialog, comboStore; + var device, deviceId, command, dialog, comboStore, online; device = this.getView().getSelectionModel().getSelection()[0]; + online = device.get('status') === 'online'; deviceId = device.get('id'); command = Ext.create('Traccar.model.Command'); command.set('deviceId', deviceId); + command.set('textChannel', !online); dialog = Ext.create('Traccar.view.CommandDialog'); comboStore = dialog.down('form').down('combobox').getStore(); comboStore.getProxy().setExtraParam('deviceId', deviceId); dialog.down('form').loadRecord(command); + dialog.lookupReference('textChannelCheckBox').setDisabled(!online); dialog.show(); }, updateButtons: function (selected) { - var readonly, deviceReadonly, empty, online; + var readonly, deviceReadonly, empty; deviceReadonly = Traccar.app.getPreference('deviceReadonly', false) && !Traccar.app.getUser().get('admin'); readonly = Traccar.app.getPreference('readonly', false) && !Traccar.app.getUser().get('admin'); empty = selected.getCount() === 0; - online = selected.getLastSelected().get('status') === 'online'; this.lookupReference('toolbarEditButton').setDisabled(empty || readonly || deviceReadonly); this.lookupReference('toolbarRemoveButton').setDisabled(empty || readonly || deviceReadonly); this.lookupReference('toolbarGeofencesButton').setDisabled(empty || readonly); - this.lookupReference('deviceCommandButton').setDisabled(empty || readonly || !online); + this.lookupReference('deviceCommandButton').setDisabled(empty || readonly); }, onSelectionChange: function (selected) { -- cgit v1.2.3