aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/ReportController.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-11-14 00:50:32 +1300
committerGitHub <noreply@github.com>2017-11-14 00:50:32 +1300
commit5f16db69f6cf531469dd1a96cab3b173697cdce6 (patch)
tree1a1558d294a2f0a7d018b9319c7ff17e87a6661b /web/app/view/ReportController.js
parent76b715085f300d220b4714d2b56eb0aee059324e (diff)
parentbe7876d44dd63d9c7fc1b6e61f0caa01b1bb423e (diff)
downloadtrackermap-web-5f16db69f6cf531469dd1a96cab3b173697cdce6.tar.gz
trackermap-web-5f16db69f6cf531469dd1a96cab3b173697cdce6.tar.bz2
trackermap-web-5f16db69f6cf531469dd1a96cab3b173697cdce6.zip
Merge pull request #621 from Abyss777/retry_geocode
Add "Show Address" link in State panel
Diffstat (limited to 'web/app/view/ReportController.js')
-rw-r--r--web/app/view/ReportController.js35
1 files changed, 34 insertions, 1 deletions
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js
index 80e56ba4..e266bf47 100644
--- a/web/app/view/ReportController.js
+++ b/web/app/view/ReportController.js
@@ -40,6 +40,9 @@ Ext.define('Traccar.view.ReportController', {
selectreport: 'selectReport'
}
},
+ global: {
+ routegeocode: 'onGeocode'
+ },
store: {
'#ReportEvents': {
add: 'loadRelatedPositions',
@@ -423,6 +426,29 @@ Ext.define('Traccar.view.ReportController', {
this.updateButtons();
},
+ onGeocode: function (positionId) {
+ var position = Ext.getStore('ReportRoute').getById(positionId);
+ if (position && !position.get('address')) {
+ Ext.Ajax.request({
+ scope: this,
+ method: 'GET',
+ url: 'api/server/geocode',
+ params: {
+ latitude: position.get('latitude'),
+ longitude: position.get('longitude')
+ },
+ success: function (response) {
+ position.set('address', response.responseText);
+ position.commit();
+ this.fireEvent('selectReport', position);
+ },
+ failure: function (response) {
+ Traccar.app.showError(response);
+ }
+ });
+ }
+ },
+
routeColumns: [{
text: Strings.reportDeviceName,
dataIndex: 'deviceId',
@@ -455,7 +481,14 @@ Ext.define('Traccar.view.ReportController', {
}, {
text: Strings.positionAddress,
dataIndex: 'address',
- renderer: Traccar.AttributeFormatter.getFormatter('address')
+ renderer: function (value, metaData, record) {
+ if (!value) {
+ return '<a href="#" onclick="Ext.fireEvent(\'routegeocode\', ' +
+ record.getId() + ')" >' +
+ Strings.stateShowAddress + '</a>';
+ }
+ return Traccar.AttributeFormatter.getFormatter('address')(value);
+ }
}],
eventsColumns: [{