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/Devices.js8
-rw-r--r--web/app/view/edit/DevicesController.js17
-rw-r--r--web/app/view/edit/Drivers.js57
-rw-r--r--web/app/view/edit/DriversController.js32
-rw-r--r--web/app/view/edit/Groups.js8
-rw-r--r--web/app/view/edit/GroupsController.js19
-rw-r--r--web/app/view/edit/Users.js7
-rw-r--r--web/app/view/edit/UsersController.js18
8 files changed, 166 insertions, 0 deletions
diff --git a/web/app/view/edit/Devices.js b/web/app/view/edit/Devices.js
index 267a38be..97cbba2b 100644
--- a/web/app/view/edit/Devices.js
+++ b/web/app/view/edit/Devices.js
@@ -83,6 +83,14 @@ Ext.define('Traccar.view.edit.Devices', {
tooltip: Strings.sharedComputedAttributes,
tooltipType: 'title'
}, {
+ xtype: 'button',
+ disabled: true,
+ handler: 'onDriversClick',
+ reference: 'toolbarDriversButton',
+ glyph: 'xf2c2@FontAwesome',
+ tooltip: Strings.sharedDrivers,
+ tooltipType: 'title'
+ }, {
disabled: true,
handler: 'onCommandClick',
reference: 'deviceCommandButton',
diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js
index 2457d5cb..0cdf18ac 100644
--- a/web/app/view/edit/DevicesController.js
+++ b/web/app/view/edit/DevicesController.js
@@ -24,6 +24,7 @@ Ext.define('Traccar.view.edit.DevicesController', {
'Traccar.view.dialog.Device',
'Traccar.view.permissions.DeviceGeofences',
'Traccar.view.permissions.DeviceAttributes',
+ 'Traccar.view.permissions.DeviceDrivers',
'Traccar.view.BaseWindow',
'Traccar.model.Device',
'Traccar.model.Command'
@@ -93,6 +94,21 @@ Ext.define('Traccar.view.edit.DevicesController', {
}).show();
},
+ onDriversClick: function () {
+ var device = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedDrivers,
+ items: {
+ xtype: 'deviceDriversView',
+ baseObjectName: 'deviceId',
+ linkObjectName: 'driverId',
+ storeName: 'Drivers',
+ urlApi: 'api/devices/drivers',
+ baseObject: device.getId()
+ }
+ }).show();
+ },
+
onCommandClick: function () {
var device, deviceId, command, dialog, typesStore, online;
device = this.getView().getSelectionModel().getSelection()[0];
@@ -122,6 +138,7 @@ Ext.define('Traccar.view.edit.DevicesController', {
this.lookupReference('toolbarRemoveButton').setDisabled(empty || readonly || deviceReadonly);
this.lookupReference('toolbarGeofencesButton').setDisabled(empty || readonly);
this.lookupReference('toolbarAttributesButton').setDisabled(empty || readonly);
+ this.lookupReference('toolbarDriversButton').setDisabled(empty || readonly);
this.lookupReference('deviceCommandButton').setDisabled(empty || readonly);
},
diff --git a/web/app/view/edit/Drivers.js b/web/app/view/edit/Drivers.js
new file mode 100644
index 00000000..59d8d2c4
--- /dev/null
+++ b/web/app/view/edit/Drivers.js
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 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.Drivers', {
+ extend: 'Ext.grid.Panel',
+ xtype: 'driversView',
+
+ requires: [
+ 'Ext.grid.filters.Filters',
+ 'Traccar.view.edit.DriversController',
+ 'Traccar.view.edit.Toolbar'
+ ],
+
+ plugins: 'gridfilters',
+
+ controller: 'drivers',
+ store: 'Drivers',
+
+ tbar: {
+ xtype: 'editToolbar'
+ },
+
+ listeners: {
+ selectionchange: 'onSelectionChange'
+ },
+
+ columns: {
+ defaults: {
+ flex: 1,
+ minWidth: Traccar.Style.columnWidthNormal
+ },
+ items: [{
+ text: Strings.sharedName,
+ dataIndex: 'name',
+ filter: 'string'
+ }, {
+ text: Strings.sharedDescription,
+ dataIndex: 'uniqueId',
+ filter: 'string'
+ }]
+ }
+});
diff --git a/web/app/view/edit/DriversController.js b/web/app/view/edit/DriversController.js
new file mode 100644
index 00000000..2840c2a7
--- /dev/null
+++ b/web/app/view/edit/DriversController.js
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 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.DriversController', {
+ extend: 'Traccar.view.edit.ToolbarController',
+ alias: 'controller.drivers',
+
+ requires: [
+ 'Traccar.view.dialog.Driver',
+ 'Traccar.model.Driver'
+ ],
+
+ objectModel: 'Traccar.model.Driver',
+ objectDialog: 'Traccar.view.dialog.Driver',
+ removeTitle: Strings.sharedDriver
+
+});
diff --git a/web/app/view/edit/Groups.js b/web/app/view/edit/Groups.js
index d4d08305..deb797f1 100644
--- a/web/app/view/edit/Groups.js
+++ b/web/app/view/edit/Groups.js
@@ -49,6 +49,14 @@ Ext.define('Traccar.view.edit.Groups', {
glyph: 'xf0ae@FontAwesome',
tooltip: Strings.sharedComputedAttributes,
tooltipType: 'title'
+ }, {
+ xtype: 'button',
+ disabled: true,
+ handler: 'onDriversClick',
+ reference: 'toolbarDriversButton',
+ glyph: 'xf2c2@FontAwesome',
+ tooltip: Strings.sharedDrivers,
+ tooltipType: 'title'
}]
},
diff --git a/web/app/view/edit/GroupsController.js b/web/app/view/edit/GroupsController.js
index 602bb095..a170b3e9 100644
--- a/web/app/view/edit/GroupsController.js
+++ b/web/app/view/edit/GroupsController.js
@@ -23,6 +23,7 @@ Ext.define('Traccar.view.edit.GroupsController', {
'Traccar.view.dialog.Group',
'Traccar.view.permissions.GroupGeofences',
'Traccar.view.permissions.GroupAttributes',
+ 'Traccar.view.permissions.GroupDrivers',
'Traccar.view.BaseWindow',
'Traccar.model.Group'
],
@@ -65,10 +66,28 @@ Ext.define('Traccar.view.edit.GroupsController', {
}).show();
},
+ onDriversClick: function () {
+ var admin, group;
+ admin = Traccar.app.getUser().get('admin');
+ group = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedDrivers,
+ items: {
+ xtype: 'groupDriversView',
+ baseObjectName: 'groupId',
+ linkObjectName: 'driverId',
+ storeName: admin ? 'AllDrivers' : 'Drivers',
+ urlApi: 'api/groups/drivers',
+ baseObject: group.getId()
+ }
+ }).show();
+ },
+
onSelectionChange: function (selected) {
var disabled = selected.length > 0;
this.lookupReference('toolbarGeofencesButton').setDisabled(disabled);
this.lookupReference('toolbarAttributesButton').setDisabled(disabled);
+ this.lookupReference('toolbarDriversButton').setDisabled(disabled);
this.callParent(arguments);
}
});
diff --git a/web/app/view/edit/Users.js b/web/app/view/edit/Users.js
index 0aafb3dd..5c1c8efe 100644
--- a/web/app/view/edit/Users.js
+++ b/web/app/view/edit/Users.js
@@ -82,6 +82,13 @@ Ext.define('Traccar.view.edit.Users', {
glyph: 'xf0ae@FontAwesome',
tooltip: Strings.sharedComputedAttributes,
tooltipType: 'title'
+ }, {
+ disabled: true,
+ handler: 'onDriversClick',
+ reference: 'userDriversButton',
+ glyph: 'xf2c2@FontAwesome',
+ tooltip: Strings.sharedDrivers,
+ tooltipType: 'title'
}]
},
diff --git a/web/app/view/edit/UsersController.js b/web/app/view/edit/UsersController.js
index a6f150be..1fa17dfe 100644
--- a/web/app/view/edit/UsersController.js
+++ b/web/app/view/edit/UsersController.js
@@ -28,6 +28,7 @@ Ext.define('Traccar.view.edit.UsersController', {
'Traccar.view.permissions.UserCalendars',
'Traccar.view.permissions.UserUsers',
'Traccar.view.permissions.UserAttributes',
+ 'Traccar.view.permissions.UserDrivers',
'Traccar.view.Notifications',
'Traccar.view.BaseWindow',
'Traccar.model.User'
@@ -172,6 +173,22 @@ Ext.define('Traccar.view.edit.UsersController', {
}).show();
},
+ onDriversClick: function () {
+ var user = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedDrivers,
+ items: {
+ xtype: 'userDriversView',
+ baseObjectName: 'userId',
+ linkObjectName: 'driverId',
+ storeName: 'AllDrivers',
+ linkStoreName: 'Drivers',
+ urlApi: 'api/permissions/drivers',
+ baseObject: user.getId()
+ }
+ }).show();
+ },
+
onSelectionChange: function (selection, selected) {
var disabled = selected.length === 0;
@@ -181,6 +198,7 @@ Ext.define('Traccar.view.edit.UsersController', {
this.lookupReference('userNotificationsButton').setDisabled(disabled);
this.lookupReference('userCalendarsButton').setDisabled(disabled);
this.lookupReference('userAttributesButton').setDisabled(disabled);
+ this.lookupReference('userDriversButton').setDisabled(disabled);
this.lookupReference('userUsersButton').setDisabled(disabled || selected[0].get('userLimit') === 0);
this.callParent(arguments);
}