aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/command/CommandDialog.js23
-rw-r--r--web/app/view/command/CommandDialogController.js21
2 files changed, 40 insertions, 4 deletions
diff --git a/web/app/view/command/CommandDialog.js b/web/app/view/command/CommandDialog.js
index ef99c4db6..7f4b3c592 100644
--- a/web/app/view/command/CommandDialog.js
+++ b/web/app/view/command/CommandDialog.js
@@ -37,7 +37,28 @@ Ext.define('Traccar.view.command.CommandDialog', {
fieldLabel: strings.command_type,
store: 'CommandTypes',
displayField: 'name',
- valueField: 'key'
+ valueField: 'key',
+ listeners: {
+ select: 'onSelect'
+ }
+ }, {
+ xtype: 'fieldcontainer',
+ reference: 'paramPositionFix',
+ name: 'other',
+ hidden: true,
+
+ items: [{
+ xtype: 'numberfield',
+ fieldLabel: strings.command_frequency,
+ name: 'frequency'
+ }, {
+ xtype: 'combobox',
+ fieldLabel: strings.command_unit,
+ name: 'unit',
+ store: 'TimeUnits',
+ displayField: 'name',
+ valueField: 'multiplier'
+ }]
}]
},
diff --git a/web/app/view/command/CommandDialogController.js b/web/app/view/command/CommandDialogController.js
index 08624bf73..14d4ba2e0 100644
--- a/web/app/view/command/CommandDialogController.js
+++ b/web/app/view/command/CommandDialogController.js
@@ -18,10 +18,25 @@ Ext.define('Traccar.view.command.CommandDialogController', {
extend: 'Ext.app.ViewController',
alias: 'controller.commanddialog',
+ onSelect: function(selected) {
+ this.lookupReference('paramPositionFix').setHidden(selected.getValue() !== 'positionFix');
+ },
+
onSendClick: function(button) {
- var dialog = button.up('window').down('form');
- dialog.updateRecord();
- var record = dialog.getRecord();
+ var other;
+ var form = button.up('window').down('form');
+ form.updateRecord();
+ var record = form.getRecord();
+
+ if (record.get('type') === 'positionFix') {
+ other = this.lookupReference('paramPositionFix');
+ var value = other.down('numberfield[name="frequency"]').getValue();
+ value *= other.down('combobox[name="unit"]').getValue();
+
+ record.set('other', {
+ frequency: value
+ });
+ }
Ext.Ajax.request({
scope: this,