aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/NotificationsController.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/NotificationsController.js')
-rw-r--r--web/app/view/NotificationsController.js44
1 files changed, 3 insertions, 41 deletions
diff --git a/web/app/view/NotificationsController.js b/web/app/view/NotificationsController.js
index 70b99f1b..4c83b145 100644
--- a/web/app/view/NotificationsController.js
+++ b/web/app/view/NotificationsController.js
@@ -24,57 +24,19 @@ Ext.define('Traccar.view.NotificationsController', {
],
init: function () {
- this.userId = this.getView().user.getId();
this.getView().getStore().load({
- scope: this,
- callback: function (records, operation, success) {
- var notificationsStore = Ext.create('Traccar.store.Notifications');
- notificationsStore.load({
- params: {
- userId: this.userId
- },
- scope: this,
- callback: function (records, operation, success) {
- var i, index, attributes, storeRecord;
- if (success) {
- for (i = 0; i < records.length; i++) {
- index = this.getView().getStore().findExact('type', records[i].get('type'));
- attributes = records[i].get('attributes');
- storeRecord = this.getView().getStore().getAt(index);
- storeRecord.set('attributes', attributes);
- storeRecord.commit();
- }
- }
- }
- });
+ params: {
+ userId: this.getView().user.getId()
}
});
},
- onBeforeCheckChange: function (column, rowIndex, checked, eOpts) {
- var fields, record, data;
- fields = column.dataIndex.split('\.', 2);
- record = this.getView().getStore().getAt(rowIndex);
- data = record.get(fields[0]);
- if (!data[fields[1]]) {
- data[fields[1]] = 'true';
- } else {
- delete data[fields[1]];
- }
- record.set(fields[0], data);
- record.commit();
- },
-
onCheckChange: function (column, rowIndex, checked, eOpts) {
var record = this.getView().getStore().getAt(rowIndex);
Ext.Ajax.request({
scope: this,
url: 'api/users/notifications',
- jsonData: {
- userId: this.userId,
- type: record.get('type'),
- attributes: record.get('attributes')
- },
+ jsonData: record.data,
callback: function (options, success, response) {
if (!success) {
Traccar.app.showError(response);