Browse Source

UI-831: implemented the download CSV feature on call logs

4.3
Maxime Roux 11 years ago
parent
commit
8f25cef22f
1 changed files with 9 additions and 14 deletions
  1. +9
    -14
      submodules/callLogs/callLogs.js

+ 9
- 14
submodules/callLogs/callLogs.js View File

@ -4,19 +4,7 @@ define(function(require){
monster = require('monster');
var app = {
requests: {
'voip.callLogs.listCdrs': {
url: 'accounts/{accountId}/cdrs?created_from={fromDate}&created_to={toDate}',
verb: 'GET'
},
'voip.callLogs.getCdrsCSV': {
url: 'accounts/{accountId}/cdrs?created_from={fromDate}&created_to={toDate}',
verb: 'GET',
headers: {
'Accept': 'application/octet-stream'
}
}
},
requests: {},
subscribe: {
'voip.callLogs.render': 'callLogsRender'
@ -105,7 +93,14 @@ define(function(require){
});
template.find('.filter-div .download-csv').on('click', function(e) {
monster.ui.alert('Not implemented yet!');
var fromDate = template.find('.filter-div input.filter-from').datepicker("getDate"),
toDate = template.find('.filter-div input.filter-to').datepicker("getDate"),
fromDateTimestamp = monster.util.dateToBeginningOfGregorianDay(fromDate),
toDateTimestamp = monster.util.dateToEndOfGregorianDay(toDate);
window.location.href = self.apiUrl + 'accounts/' + self.accountId
+ '/cdrs?created_from=' + fromDateTimestamp + '&created_to=' + toDateTimestamp
+ '&accept=text/csv&auth_token=' + self.authToken;
});
template.find('.search-div input.search-query').on('keyup', function(e) {


Loading…
Cancel
Save