aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/edit
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/edit')
-rw-r--r--web/app/view/edit/Attributes.js10
-rw-r--r--web/app/view/edit/Devices.js3
-rw-r--r--web/app/view/edit/DevicesController.js8
-rw-r--r--web/app/view/edit/Geofences.js12
-rw-r--r--web/app/view/edit/Groups.js10
-rw-r--r--web/app/view/edit/GroupsController.js18
-rw-r--r--web/app/view/edit/Maintenances.js77
-rw-r--r--web/app/view/edit/MaintenancesController.js31
-rw-r--r--web/app/view/edit/Notifications.js45
-rw-r--r--web/app/view/edit/Users.js16
-rw-r--r--web/app/view/edit/UsersController.js23
11 files changed, 217 insertions, 36 deletions
diff --git a/web/app/view/edit/Attributes.js b/web/app/view/edit/Attributes.js
index cb07eda1..af4f5a90 100644
--- a/web/app/view/edit/Attributes.js
+++ b/web/app/view/edit/Attributes.js
@@ -48,7 +48,7 @@ Ext.define('Traccar.view.edit.Attributes', {
if (this.attributesStore) {
attribute = Ext.getStore(this.attributesStore).getById(value);
}
- return attribute && attribute.get('name') ? attribute.get('name') : value;
+ return attribute && attribute.get('name') || value;
}
}, {
text: Strings.stateValue,
@@ -58,13 +58,7 @@ Ext.define('Traccar.view.edit.Attributes', {
if (this.attributesStore) {
attribute = Ext.getStore(this.attributesStore).getById(record.get('name'));
}
- if (attribute && attribute.get('dataType') === 'speed') {
- return Ext.getStore('SpeedUnits').formatValue(value, Traccar.app.getAttributePreference('speedUnit', 'kn'), true);
- } else if (attribute && attribute.get('dataType') === 'distance') {
- return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getAttributePreference('distanceUnit', 'km'), true);
- } else {
- return value;
- }
+ return Traccar.AttributeFormatter.renderAttribute(value, attribute);
}
}]
}
diff --git a/web/app/view/edit/Devices.js b/web/app/view/edit/Devices.js
index 2f7f80ee..21fdb32a 100644
--- a/web/app/view/edit/Devices.js
+++ b/web/app/view/edit/Devices.js
@@ -104,7 +104,8 @@ Ext.define('Traccar.view.edit.Devices', {
}, {
text: Strings.deviceIdentifier,
dataIndex: 'uniqueId',
- hidden: true
+ hidden: true,
+ filter: 'string'
}, {
text: Strings.sharedPhone,
dataIndex: 'phone',
diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js
index a0bf9dc4..2b4ff14f 100644
--- a/web/app/view/edit/DevicesController.js
+++ b/web/app/view/edit/DevicesController.js
@@ -59,8 +59,8 @@ Ext.define('Traccar.view.edit.DevicesController', {
init: function () {
var self = this, readonly, deviceReadonly;
- deviceReadonly = Traccar.app.getPreference('deviceReadonly', false) && !Traccar.app.getUser().get('admin');
- readonly = Traccar.app.getPreference('readonly', false) && !Traccar.app.getUser().get('admin');
+ deviceReadonly = Traccar.app.getPreference('deviceReadonly', false) && !Traccar.app.getUser().get('administrator');
+ readonly = Traccar.app.getPreference('readonly', false) && !Traccar.app.getUser().get('administrator');
this.lookupReference('toolbarAddButton').setDisabled(readonly || deviceReadonly);
this.lookupReference('toolbarDeviceMenu').setHidden(readonly || deviceReadonly);
@@ -98,8 +98,8 @@ Ext.define('Traccar.view.edit.DevicesController', {
updateButtons: function (selected) {
var readonly, deviceReadonly, empty, deviceMenu;
- deviceReadonly = Traccar.app.getPreference('deviceReadonly', false) && !Traccar.app.getUser().get('admin');
- readonly = Traccar.app.getPreference('readonly', false) && !Traccar.app.getUser().get('admin');
+ deviceReadonly = Traccar.app.getPreference('deviceReadonly', false) && !Traccar.app.getUser().get('administrator');
+ readonly = Traccar.app.getPreference('readonly', false) && !Traccar.app.getUser().get('administrator');
empty = selected.length === 0;
this.lookupReference('toolbarEditButton').setDisabled(empty || readonly || deviceReadonly);
this.lookupReference('toolbarRemoveButton').setDisabled(empty || readonly || deviceReadonly);
diff --git a/web/app/view/edit/Geofences.js b/web/app/view/edit/Geofences.js
index 9c564bc3..0e1e6773 100644
--- a/web/app/view/edit/Geofences.js
+++ b/web/app/view/edit/Geofences.js
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -48,6 +48,16 @@ Ext.define('Traccar.view.edit.Geofences', {
text: Strings.sharedDescription,
dataIndex: 'description',
filter: 'string'
+ }, {
+ text: Strings.sharedCalendar,
+ dataIndex: 'calendarId',
+ hidden: true,
+ filter: {
+ type: 'list',
+ labelField: 'name',
+ store: 'AllCalendars'
+ },
+ renderer: Traccar.AttributeFormatter.getFormatter('calendarId')
}]
}
});
diff --git a/web/app/view/edit/Groups.js b/web/app/view/edit/Groups.js
index 0808201d..1ff4de80 100644
--- a/web/app/view/edit/Groups.js
+++ b/web/app/view/edit/Groups.js
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -70,6 +70,14 @@ Ext.define('Traccar.view.edit.Groups', {
glyph: 'xf003@FontAwesome',
tooltip: Strings.sharedNotifications,
tooltipType: 'title'
+ }, {
+ xtype: 'button',
+ disabled: true,
+ handler: 'onMaintenancesClick',
+ reference: 'toolbarMaintenancesButton',
+ glyph: 'xf0ad@FontAwesome',
+ tooltip: Strings.sharedMaintenances,
+ tooltipType: 'title'
}]
},
diff --git a/web/app/view/edit/GroupsController.js b/web/app/view/edit/GroupsController.js
index 04c9692f..2e62a283 100644
--- a/web/app/view/edit/GroupsController.js
+++ b/web/app/view/edit/GroupsController.js
@@ -25,6 +25,7 @@ Ext.define('Traccar.view.edit.GroupsController', {
'Traccar.view.permissions.ComputedAttributes',
'Traccar.view.permissions.Drivers',
'Traccar.view.permissions.SavedCommands',
+ 'Traccar.view.permissions.Maintenances',
'Traccar.view.BaseWindow',
'Traccar.model.Group'
],
@@ -39,6 +40,8 @@ Ext.define('Traccar.view.edit.GroupsController', {
this.lookupReference('toolbarAttributesButton').setHidden(
Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes'));
this.lookupReference('toolbarCommandsButton').setHidden(Traccar.app.getPreference('limitCommands', false));
+ this.lookupReference('toolbarMaintenancesButton').setHidden(
+ Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableMaintenances'));
},
onGeofencesClick: function () {
@@ -111,6 +114,20 @@ Ext.define('Traccar.view.edit.GroupsController', {
}).show();
},
+ onMaintenancesClick: function () {
+ var group = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedMaintenances,
+ items: {
+ xtype: 'linkMaintenancesView',
+ baseObjectName: 'groupId',
+ linkObjectName: 'maintenanceId',
+ storeName: 'Maintenances',
+ baseObject: group.getId()
+ }
+ }).show();
+ },
+
onSelectionChange: function (selection, selected) {
var disabled = selected.length === 0;
this.lookupReference('toolbarGeofencesButton').setDisabled(disabled);
@@ -118,6 +135,7 @@ Ext.define('Traccar.view.edit.GroupsController', {
this.lookupReference('toolbarDriversButton').setDisabled(disabled);
this.lookupReference('toolbarCommandsButton').setDisabled(disabled);
this.lookupReference('toolbarNotificationsButton').setDisabled(disabled);
+ this.lookupReference('toolbarMaintenancesButton').setDisabled(disabled);
this.callParent(arguments);
}
});
diff --git a/web/app/view/edit/Maintenances.js b/web/app/view/edit/Maintenances.js
new file mode 100644
index 00000000..da129154
--- /dev/null
+++ b/web/app/view/edit/Maintenances.js
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2018 Andrey Kunitsyn (andrey@traccar.org)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+Ext.define('Traccar.view.edit.Maintenances', {
+ extend: 'Traccar.view.GridPanel',
+ xtype: 'maintenancesView',
+
+ requires: [
+ 'Traccar.view.edit.MaintenancesController',
+ 'Traccar.view.edit.Toolbar'
+ ],
+
+ controller: 'maintenances',
+ store: 'Maintenances',
+
+ tbar: {
+ xtype: 'editToolbar'
+ },
+
+ listeners: {
+ selectionchange: 'onSelectionChange'
+ },
+
+ columns: {
+ defaults: {
+ flex: 1,
+ minWidth: Traccar.Style.columnWidthNormal
+ },
+ items: [{
+ text: Strings.sharedName,
+ dataIndex: 'name',
+ filter: 'string'
+ }, {
+ text: Strings.sharedType,
+ dataIndex: 'type',
+ filter: {
+ type: 'list',
+ idField: 'key',
+ labelField: 'name',
+ store: 'MaintenanceTypes'
+ },
+ renderer: function (value) {
+ var attribute = Ext.getStore('MaintenanceTypes').getById(value);
+ return attribute && attribute.get('name') || value;
+ }
+ }, {
+ text: Strings.maintenanceStart,
+ dataIndex: 'start',
+ renderer: function (value, metaData, record) {
+ return Traccar.AttributeFormatter.renderAttribute(
+ value, Ext.getStore('MaintenanceTypes').getById(record.get('type')));
+ }
+ }, {
+ text: Strings.maintenancePeriod,
+ dataIndex: 'period',
+ renderer: function (value, metaData, record) {
+ return Traccar.AttributeFormatter.renderAttribute(
+ value, Ext.getStore('MaintenanceTypes').getById(record.get('type')));
+ }
+ }]
+ }
+});
diff --git a/web/app/view/edit/MaintenancesController.js b/web/app/view/edit/MaintenancesController.js
new file mode 100644
index 00000000..19762e61
--- /dev/null
+++ b/web/app/view/edit/MaintenancesController.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2018 Andrey Kunitsyn (andrey@traccar.org)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+Ext.define('Traccar.view.edit.MaintenancesController', {
+ extend: 'Traccar.view.edit.ToolbarController',
+ alias: 'controller.maintenances',
+
+ requires: [
+ 'Traccar.view.dialog.Maintenance',
+ 'Traccar.model.Maintenance'
+ ],
+
+ objectModel: 'Traccar.model.Maintenance',
+ objectDialog: 'Traccar.view.dialog.Maintenance',
+ removeTitle: Strings.sharedMaintenance
+});
diff --git a/web/app/view/edit/Notifications.js b/web/app/view/edit/Notifications.js
index e17100a4..9e24d3d0 100644
--- a/web/app/view/edit/Notifications.js
+++ b/web/app/view/edit/Notifications.js
@@ -1,6 +1,6 @@
/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
+ * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -60,20 +60,35 @@ 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.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.notificationSms,
- dataIndex: 'sms',
- renderer: Traccar.AttributeFormatter.getFormatter('sms'),
- filter: 'boolean'
+ text: Strings.sharedCalendar,
+ dataIndex: 'calendarId',
+ hidden: true,
+ filter: {
+ type: 'list',
+ labelField: 'name',
+ store: 'AllCalendars'
+ },
+ renderer: Traccar.AttributeFormatter.getFormatter('calendarId')
}]
}
});
diff --git a/web/app/view/edit/Users.js b/web/app/view/edit/Users.js
index b0a67ffd..e2dd9aa6 100644
--- a/web/app/view/edit/Users.js
+++ b/web/app/view/edit/Users.js
@@ -1,6 +1,6 @@
/*
- * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2016 - 2017 Andrey Kunitsyn (andrey@traccar.org)
+ * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -95,6 +95,14 @@ Ext.define('Traccar.view.edit.Users', {
glyph: 'xf093@FontAwesome',
tooltip: Strings.sharedSavedCommands,
tooltipType: 'title'
+ }, {
+ xtype: 'button',
+ disabled: true,
+ handler: 'onMaintenancesClick',
+ reference: 'userMaintenancesButton',
+ glyph: 'xf0ad@FontAwesome',
+ tooltip: Strings.sharedMaintenances,
+ tooltipType: 'title'
}]
},
@@ -117,8 +125,8 @@ Ext.define('Traccar.view.edit.Users', {
filter: 'string'
}, {
text: Strings.userAdmin,
- dataIndex: 'admin',
- renderer: Traccar.AttributeFormatter.getFormatter('admin'),
+ dataIndex: 'administrator',
+ renderer: Traccar.AttributeFormatter.getFormatter('administrator'),
filter: 'boolean'
}, {
text: Strings.serverReadonly,
diff --git a/web/app/view/edit/UsersController.js b/web/app/view/edit/UsersController.js
index db82b4f4..9d998162 100644
--- a/web/app/view/edit/UsersController.js
+++ b/web/app/view/edit/UsersController.js
@@ -31,6 +31,7 @@ Ext.define('Traccar.view.edit.UsersController', {
'Traccar.view.permissions.Drivers',
'Traccar.view.permissions.SavedCommands',
'Traccar.view.permissions.Notifications',
+ 'Traccar.view.permissions.Maintenances',
'Traccar.view.BaseWindow',
'Traccar.model.User'
],
@@ -41,7 +42,7 @@ Ext.define('Traccar.view.edit.UsersController', {
init: function () {
Ext.getStore('Users').load();
- this.lookupReference('userUsersButton').setHidden(!Traccar.app.getUser().get('admin'));
+ this.lookupReference('userUsersButton').setHidden(!Traccar.app.getUser().get('administrator'));
this.lookupReference('userDriversButton').setHidden(
Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers'));
this.lookupReference('userAttributesButton').setHidden(
@@ -49,6 +50,8 @@ Ext.define('Traccar.view.edit.UsersController', {
this.lookupReference('userCalendarsButton').setHidden(
Traccar.app.getBooleanAttributePreference('ui.disableCalendars'));
this.lookupReference('userCommandsButton').setHidden(Traccar.app.getPreference('limitCommands', false));
+ this.lookupReference('userMaintenancesButton').setHidden(
+ Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableMaintenances'));
},
onEditClick: function () {
@@ -63,7 +66,7 @@ Ext.define('Traccar.view.edit.UsersController', {
onAddClick: function () {
var user, dialog;
user = Ext.create('Traccar.model.User');
- if (Traccar.app.getUser().get('admin')) {
+ if (Traccar.app.getUser().get('administrator')) {
user.set('deviceLimit', -1);
}
if (Traccar.app.getUser().get('expirationTime')) {
@@ -209,6 +212,21 @@ Ext.define('Traccar.view.edit.UsersController', {
}).show();
},
+ onMaintenancesClick: function () {
+ var user = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedMaintenances,
+ items: {
+ xtype: 'linkMaintenancesView',
+ baseObjectName: 'userId',
+ linkObjectName: 'maintenanceId',
+ storeName: 'AllMaintenances',
+ linkStoreName: 'Maintenances',
+ baseObject: user.getId()
+ }
+ }).show();
+ },
+
onSelectionChange: function (selection, selected) {
var disabled = selected.length === 0;
this.lookupReference('userDevicesButton').setDisabled(disabled);
@@ -219,6 +237,7 @@ Ext.define('Traccar.view.edit.UsersController', {
this.lookupReference('userAttributesButton').setDisabled(disabled);
this.lookupReference('userDriversButton').setDisabled(disabled);
this.lookupReference('userCommandsButton').setDisabled(disabled);
+ this.lookupReference('userMaintenancesButton').setDisabled(disabled);
this.lookupReference('userUsersButton').setDisabled(disabled || selected[0].get('userLimit') === 0);
this.callParent(arguments);
}