aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/dialog/NotificationController.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/dialog/NotificationController.js')
-rw-r--r--web/app/view/dialog/NotificationController.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/web/app/view/dialog/NotificationController.js b/web/app/view/dialog/NotificationController.js
index ad65c333..5da669a4 100644
--- a/web/app/view/dialog/NotificationController.js
+++ b/web/app/view/dialog/NotificationController.js
@@ -23,5 +23,31 @@ Ext.define('Traccar.view.dialog.NotificationController', {
init: function () {
this.lookupReference('calendarCombo').setHidden(
Traccar.app.getBooleanAttributePreference('ui.disableCalendars'));
+ },
+
+ onTypeChange: function (view, value) {
+ this.lookupReference('alarmsField').setHidden(value !== 'alarm');
+ },
+
+ onAlarmsLoad: function (view) {
+ var attributes, record = view.up('form').getRecord();
+ attributes = record.get('attributes') || {};
+ if (attributes['alarms']) {
+ view.suspendEvents(false);
+ view.setValue(attributes['alarms'].split(','));
+ view.resumeEvents();
+ }
+ },
+
+ onAlarmsChange: function (view, value) {
+ var attributes, record = view.up('window').down('form').getRecord();
+ attributes = record.get('attributes') || {};
+
+ value = value.join();
+ if (attributes['alarms'] !== value) {
+ attributes['alarms'] = value;
+ record.set('attributes', attributes);
+ record.dirty = true;
+ }
}
});