|
|
|
@ -1,7 +1,8 @@
|
|
|
|
|
<template>
|
|
|
|
|
<csc-page :title="$t('pages.conversations.title')">
|
|
|
|
|
<q-infinite-scroll :handler="loadMore" :offset=1 ref="infinite">
|
|
|
|
|
<q-card v-for="conversation in conversations" :key="conversation.caller"
|
|
|
|
|
<q-card v-for="(conversation, index) in conversations"
|
|
|
|
|
:key="conversation.caller"
|
|
|
|
|
class="conversation-card">
|
|
|
|
|
<csc-collapsible :icon="getCollapsibleIcons(conversation)"
|
|
|
|
|
:label="getCollapsibleLabel(conversation)"
|
|
|
|
@ -10,7 +11,19 @@
|
|
|
|
|
<div v-if="hasCallOption(conversation.type)">
|
|
|
|
|
<q-card-separator />
|
|
|
|
|
<q-card-actions align="center">
|
|
|
|
|
<q-btn flat round small color="primary" icon="call">{{ $t('pages.conversations.buttons.call') }}</q-btn>
|
|
|
|
|
<q-btn flat round small color="primary" icon="call">
|
|
|
|
|
{{ $t('pages.conversations.buttons.call') }}
|
|
|
|
|
<q-popover ref="popover">
|
|
|
|
|
<q-list separator link>
|
|
|
|
|
<q-item @click="call(conversation, 'audioOnly'), $refs.popover[index].close()">
|
|
|
|
|
{{ $t('pages.conversations.buttons.audioCall') }}
|
|
|
|
|
</q-item>
|
|
|
|
|
<q-item @click="call(conversation, 'audioVideo'), $refs.popover[index].close()">
|
|
|
|
|
{{ $t('pages.conversations.buttons.videoCall') }}
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-popover>
|
|
|
|
|
</q-btn>
|
|
|
|
|
</q-card-actions>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
@ -24,8 +37,8 @@
|
|
|
|
|
<script>
|
|
|
|
|
import CscPage from '../CscPage'
|
|
|
|
|
import CscCollapsible from '../card/CscCollapsible'
|
|
|
|
|
import { QBtn, QCardActions, QCard,
|
|
|
|
|
QCardSeparator, QInfiniteScroll, QSpinnerDots } from 'quasar-framework'
|
|
|
|
|
import { QBtn, QCardActions, QCard, QCardSeparator, QInfiniteScroll,
|
|
|
|
|
QPopover, QList, QItem, QSpinnerDots } from 'quasar-framework'
|
|
|
|
|
export default {
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
@ -39,6 +52,9 @@
|
|
|
|
|
QCardSeparator,
|
|
|
|
|
CscCollapsible,
|
|
|
|
|
QInfiniteScroll,
|
|
|
|
|
QPopover,
|
|
|
|
|
QList,
|
|
|
|
|
QItem,
|
|
|
|
|
QSpinnerDots
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
@ -47,13 +63,20 @@
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
call(conversation, localMedia) {
|
|
|
|
|
let number = conversation.direction == 'out' ?
|
|
|
|
|
conversation.callee : conversation.caller;
|
|
|
|
|
this.$store.dispatch('call/start',
|
|
|
|
|
{ number: number, localMedia: localMedia });
|
|
|
|
|
},
|
|
|
|
|
loadMore(index, done) {
|
|
|
|
|
this.$store.dispatch('conversations/loadConversations').then(() => {
|
|
|
|
|
done();
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
done();
|
|
|
|
|
this.$refs.infinite.stop();
|
|
|
|
|
});
|
|
|
|
|
this.$store.dispatch('conversations/loadConversations')
|
|
|
|
|
.then(() => {
|
|
|
|
|
done();
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
done();
|
|
|
|
|
this.$refs.infinite.stop();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
hasCallOption(type) {
|
|
|
|
|
return (['call', 'call forward', 'sms', 'voicemail']
|
|
|
|
@ -81,9 +104,12 @@
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
getCollapsibleLabel(item) {
|
|
|
|
|
let prefix = item.status == 'ok' ? this.$t('pages.conversations.labels.successful')
|
|
|
|
|
let prefix = item.status == 'ok' ?
|
|
|
|
|
this.$t('pages.conversations.labels.successful')
|
|
|
|
|
: this.$t('pages.conversations.labels.unsuccessful');
|
|
|
|
|
let direction = item.direction == 'in' ? this.$t('pages.conversations.labels.from') : this.$t('pages.conversations.labels.to');
|
|
|
|
|
let direction = item.direction == 'in' ?
|
|
|
|
|
this.$t('pages.conversations.labels.from') :
|
|
|
|
|
this.$t('pages.conversations.labels.to');
|
|
|
|
|
return `${prefix} ${item.type} ${direction} ${item.caller}`;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|