56 lines
2.3 KiB
JavaScript
56 lines
2.3 KiB
JavaScript
Vue.component('VoiceCallHistory', {
|
|
//language=Vue
|
|
template: `
|
|
<tt-card>
|
|
|
|
<tt-table :fetch-url="window['TT_CONFIG']['VOICE_CALL_HISTORY_API_URL'] + '?do=getCalls'"
|
|
:config="VoiceCallHistoryTableConfig"
|
|
small ssr ref="table">
|
|
<template v-slot:top-buttons>
|
|
<button type="button" class="btn btn-primary" @click="importCallsFromToday">
|
|
<template v-if="importCallsFromTodayLoading">
|
|
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
|
</template>
|
|
<template v-else>
|
|
<i class="fas fa-sync-alt"></i>
|
|
Re-Import Calls from Today
|
|
</template>
|
|
</button>
|
|
|
|
</template>
|
|
</tt-table>
|
|
</tt-card>
|
|
`, data() {
|
|
return {
|
|
window: window,
|
|
VoiceCallHistoryTableConfig: {
|
|
headers: [{text: "Call-ID", key: "uid"},
|
|
{text: "Voice Account", key: "voice_account"},
|
|
{text: "Time Range", key: "start", filter: "date"},
|
|
{text: "Source", key: "source"},
|
|
{text: "Destination", key: "destination"},
|
|
{
|
|
text: "Billable",
|
|
key: "billable",
|
|
filter: "iconSelect",
|
|
filterOptions: [{value: 1, text: 'Yes', icon: 'fas fa-check text-success'},
|
|
{value: 0, text: 'No', icon: 'fas fa-times text-danger'}]
|
|
},
|
|
{text: "Duration", key: "duration", filter: "numberRange"},],
|
|
tableHeader: 'Voice Call History',
|
|
key: 'VoiceCallHistory',
|
|
},
|
|
importCallsFromTodayLoading: false,
|
|
}
|
|
},
|
|
methods: {
|
|
async importCallsFromToday() {
|
|
this.importCallsFromTodayLoading = true;
|
|
const response = await axios.get(window['TT_CONFIG']['VOICE_CALL_HISTORY_API_URL'] + '?do=importCallsFromToday');
|
|
window.notify(response.data.status === 'success' ? 'success' : 'error', response.data.message);
|
|
await this.$refs.table.fetchData();
|
|
this.importCallsFromTodayLoading = false;
|
|
},
|
|
}
|
|
})
|