feat: Download Agent wise report (#1517)
This commit is contained in:
parent
e6f7f5530b
commit
0619894560
8 changed files with 61 additions and 3 deletions
|
@ -33,7 +33,7 @@ const getters = {
|
|||
},
|
||||
};
|
||||
|
||||
const actions = {
|
||||
export const actions = {
|
||||
fetchAccountReport({ commit }, reportObj) {
|
||||
commit(types.default.TOGGLE_ACCOUNT_REPORT_LOADING, true);
|
||||
Report.getAccountReports(
|
||||
|
@ -68,6 +68,17 @@ const actions = {
|
|||
commit(types.default.TOGGLE_ACCOUNT_REPORT_LOADING, false);
|
||||
});
|
||||
},
|
||||
downloadAgentReports(_, reportObj) {
|
||||
return Report.getAgentReports(reportObj.from, reportObj.to)
|
||||
.then(response => {
|
||||
let csvContent = 'data:text/csv;charset=utf-8,' + response.data;
|
||||
var encodedUri = encodeURI(csvContent);
|
||||
window.open(encodedUri);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue