aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-28 17:07:30 +1200
committerGitHub <noreply@github.com>2018-06-28 17:07:30 +1200
commitae4933c07d94d912cdea6944f5865567e12f525c (patch)
treeb22c3a7f6acbc2bc28eafdae69f066cbd1ad9649 /web/app/view
parentd67213556dcc87453c0ad5cd6f9e8851c477a2f3 (diff)
parent8e69514733aace4690a9e80a6dd5158d625a66e2 (diff)
downloadtrackermap-web-ae4933c07d94d912cdea6944f5865567e12f525c.tar.gz
trackermap-web-ae4933c07d94d912cdea6944f5865567e12f525c.tar.bz2
trackermap-web-ae4933c07d94d912cdea6944f5865567e12f525c.zip
Merge pull request #686 from Abyss777/notifications_refactor
Implement refactored notifications
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/ArrayListFilter.js9
-rw-r--r--web/app/view/dialog/Notification.js25
-rw-r--r--web/app/view/edit/Notifications.js33
-rw-r--r--web/app/view/permissions/Notifications.js39
4 files changed, 54 insertions, 52 deletions
diff --git a/web/app/view/ArrayListFilter.js b/web/app/view/ArrayListFilter.js
index b6c1512f..519096eb 100644
--- a/web/app/view/ArrayListFilter.js
+++ b/web/app/view/ArrayListFilter.js
@@ -25,7 +25,7 @@ Ext.define('Traccar.view.ArrayListFilter', {
constructor: function (config) {
this.callParent([config]);
this.filter.setFilterFn(function (item) {
- var i, property, value;
+ var i, property, value, splits;
property = item.get(this.getProperty());
value = this.getValue();
if (Ext.isArray(property)) {
@@ -34,6 +34,13 @@ Ext.define('Traccar.view.ArrayListFilter', {
return true;
}
}
+ } else if (property.match(/[ ,]+/)) {
+ splits = property.split(/[ ,]+/).filter(Boolean);
+ for (i = 0; i < splits.length; i++) {
+ if (value.indexOf(splits[i]) !== -1) {
+ return true;
+ }
+ }
} else if (value.indexOf(property) !== -1) {
return true;
}
diff --git a/web/app/view/dialog/Notification.js b/web/app/view/dialog/Notification.js
index 4cba519c..dc4362d9 100644
--- a/web/app/view/dialog/Notification.js
+++ b/web/app/view/dialog/Notification.js
@@ -49,23 +49,14 @@ Ext.define('Traccar.view.dialog.Notification', {
name: 'always',
fieldLabel: Strings.notificationAlways
}, {
- xtype: 'checkboxfield',
- inputValue: true,
- uncheckedValue: false,
- name: 'web',
- fieldLabel: Strings.notificationWeb
- }, {
- xtype: 'checkboxfield',
- inputValue: true,
- uncheckedValue: false,
- name: 'mail',
- fieldLabel: Strings.notificationMail
- }, {
- xtype: 'checkboxfield',
- inputValue: true,
- uncheckedValue: false,
- name: 'sms',
- fieldLabel: Strings.notificationSms
+ fieldLabel: Strings.notificationNotificators,
+ xtype: 'tagfield',
+ name: 'notificators',
+ maxWidth: Traccar.Style.formFieldWidth,
+ store: 'AllNotificators',
+ valueField: 'type',
+ displayField: 'name',
+ queryMode: 'local'
}]
}, {
xtype: 'fieldset',
diff --git a/web/app/view/edit/Notifications.js b/web/app/view/edit/Notifications.js
index 36206825..9e24d3d0 100644
--- a/web/app/view/edit/Notifications.js
+++ b/web/app/view/edit/Notifications.js
@@ -60,20 +60,25 @@ Ext.define('Traccar.view.edit.Notifications', {
renderer: Traccar.AttributeFormatter.getFormatter('always'),
filter: 'boolean'
}, {
- text: Strings.notificationWeb,
- dataIndex: 'web',
- renderer: Traccar.AttributeFormatter.getFormatter('web'),
- filter: 'boolean'
- }, {
- text: Strings.notificationMail,
- dataIndex: 'mail',
- renderer: Traccar.AttributeFormatter.getFormatter('mail'),
- filter: 'boolean'
- }, {
- text: Strings.notificationSms,
- dataIndex: 'sms',
- renderer: Traccar.AttributeFormatter.getFormatter('sms'),
- filter: 'boolean'
+ text: Strings.notificationNotificators,
+ dataIndex: 'notificators',
+ flex: 2,
+ filter: {
+ type: 'arraylist',
+ idField: 'type',
+ labelField: 'name',
+ store: 'AllNotificators'
+ },
+ renderer: function (value) {
+ var result = '', i, notificators;
+ if (value) {
+ notificators = value.split(/[ ,]+/).filter(Boolean);
+ for (i = 0; i < notificators.length; i++) {
+ result += Traccar.app.getNotificatorString(notificators[i]) + (i < notificators.length - 1 ? ', ' : '');
+ }
+ }
+ return result;
+ }
}, {
text: Strings.sharedCalendar,
dataIndex: 'calendarId',
diff --git a/web/app/view/permissions/Notifications.js b/web/app/view/permissions/Notifications.js
index e21d277f..a8570fea 100644
--- a/web/app/view/permissions/Notifications.js
+++ b/web/app/view/permissions/Notifications.js
@@ -42,26 +42,25 @@ Ext.define('Traccar.view.permissions.Notifications', {
renderer: Traccar.AttributeFormatter.getFormatter('always'),
filter: 'boolean'
}, {
- text: Strings.notificationWeb,
- dataIndex: 'web',
- flex: 1,
- minWidth: Traccar.Style.columnWidthNormal,
- renderer: Traccar.AttributeFormatter.getFormatter('web'),
- filter: 'boolean'
- }, {
- text: Strings.notificationMail,
- dataIndex: 'mail',
- flex: 1,
- minWidth: Traccar.Style.columnWidthNormal,
- renderer: Traccar.AttributeFormatter.getFormatter('mail'),
- filter: 'boolean'
- }, {
- text: Strings.notificationSms,
- dataIndex: 'sms',
- flex: 1,
- minWidth: Traccar.Style.columnWidthNormal,
- renderer: Traccar.AttributeFormatter.getFormatter('sms'),
- filter: 'boolean'
+ text: Strings.notificationNotificators,
+ dataIndex: 'notificators',
+ flex: 2,
+ filter: {
+ type: 'arraylist',
+ idField: 'type',
+ labelField: 'name',
+ store: 'AllNotificators'
+ },
+ renderer: function (value) {
+ var result = '', i, notificators;
+ if (value) {
+ notificators = value.split(/[ ,]+/).filter(Boolean);
+ for (i = 0; i < notificators.length; i++) {
+ result += Traccar.app.getNotificatorString(notificators[i]) + (i < notificators.length - 1 ? ', ' : '');
+ }
+ }
+ return result;
+ }
}, {
text: Strings.sharedCalendar,
dataIndex: 'calendarId',