2019-08-14 09:48:44 +00:00
|
|
|
<template>
|
2022-08-01 05:23:50 +00:00
|
|
|
<div
|
|
|
|
class="conversation-details-wrap"
|
|
|
|
:class="{ 'with-border-left': !isOnExpandedLayout }"
|
|
|
|
>
|
2021-03-02 17:14:04 +00:00
|
|
|
<conversation-header
|
2019-11-17 07:39:10 +00:00
|
|
|
v-if="currentChat.id"
|
2021-03-02 17:14:04 +00:00
|
|
|
:chat="currentChat"
|
2019-11-17 07:39:10 +00:00
|
|
|
:is-contact-panel-open="isContactPanelOpen"
|
2022-08-01 05:23:50 +00:00
|
|
|
:show-back-button="isOnExpandedLayout"
|
2020-08-17 05:55:13 +00:00
|
|
|
@contact-panel-toggle="onToggleContactPanel"
|
2019-12-16 12:53:14 +00:00
|
|
|
/>
|
2022-06-01 05:43:10 +00:00
|
|
|
<woot-tabs
|
|
|
|
v-if="dashboardApps.length && currentChat.id"
|
|
|
|
:index="activeIndex"
|
|
|
|
class="dashboard-app--tabs"
|
|
|
|
@change="onDashboardAppTabChange"
|
|
|
|
>
|
|
|
|
<woot-tabs-item
|
|
|
|
v-for="tab in dashboardAppTabs"
|
|
|
|
:key="tab.key"
|
|
|
|
:name="tab.name"
|
|
|
|
:show-badge="false"
|
|
|
|
/>
|
|
|
|
</woot-tabs>
|
|
|
|
<div v-if="!activeIndex" class="messages-and-sidebar">
|
2021-03-02 17:14:04 +00:00
|
|
|
<messages-view
|
|
|
|
v-if="currentChat.id"
|
|
|
|
:inbox-id="inboxId"
|
|
|
|
:is-contact-panel-open="isContactPanelOpen"
|
|
|
|
@contact-panel-toggle="onToggleContactPanel"
|
|
|
|
/>
|
2022-08-01 05:23:50 +00:00
|
|
|
<empty-state v-else :is-on-expanded-layout="isOnExpandedLayout" />
|
2021-03-02 17:14:04 +00:00
|
|
|
<div v-show="showContactPanel" class="conversation-sidebar-wrap">
|
|
|
|
<contact-panel
|
|
|
|
v-if="showContactPanel"
|
|
|
|
:conversation-id="currentChat.id"
|
2021-04-09 09:02:29 +00:00
|
|
|
:inbox-id="currentChat.inbox_id"
|
2021-03-02 17:14:04 +00:00
|
|
|
:on-toggle="onToggleContactPanel"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-06-01 05:43:10 +00:00
|
|
|
<dashboard-app-frame
|
|
|
|
v-else
|
|
|
|
:key="currentChat.id"
|
|
|
|
:config="dashboardApps[activeIndex - 1].content"
|
|
|
|
:current-chat="currentChat"
|
|
|
|
/>
|
2019-08-14 09:48:44 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import { mapGetters } from 'vuex';
|
2021-03-02 17:14:04 +00:00
|
|
|
import ContactPanel from 'dashboard/routes/dashboard/conversation/ContactPanel';
|
|
|
|
import ConversationHeader from './ConversationHeader';
|
2022-06-01 05:43:10 +00:00
|
|
|
import DashboardAppFrame from '../DashboardApp/Frame.vue';
|
2019-11-17 07:39:10 +00:00
|
|
|
import EmptyState from './EmptyState';
|
|
|
|
import MessagesView from './MessagesView';
|
2019-08-14 09:48:44 +00:00
|
|
|
|
|
|
|
export default {
|
2019-08-25 05:34:33 +00:00
|
|
|
components: {
|
2021-03-02 17:14:04 +00:00
|
|
|
ContactPanel,
|
|
|
|
ConversationHeader,
|
2022-06-01 05:43:10 +00:00
|
|
|
DashboardAppFrame,
|
|
|
|
EmptyState,
|
|
|
|
MessagesView,
|
2019-08-25 05:34:33 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
inboxId: {
|
2019-09-02 14:56:28 +00:00
|
|
|
type: [Number, String],
|
2019-11-17 07:39:10 +00:00
|
|
|
default: '',
|
|
|
|
required: false,
|
2019-08-25 05:34:33 +00:00
|
|
|
},
|
2019-11-14 08:16:43 +00:00
|
|
|
isContactPanelOpen: {
|
|
|
|
type: Boolean,
|
2021-08-11 06:25:55 +00:00
|
|
|
default: true,
|
2019-11-14 08:16:43 +00:00
|
|
|
},
|
2022-08-01 05:23:50 +00:00
|
|
|
isOnExpandedLayout: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
2019-08-25 05:34:33 +00:00
|
|
|
},
|
2022-06-01 05:43:10 +00:00
|
|
|
data() {
|
|
|
|
return { activeIndex: 0 };
|
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
computed: {
|
2022-06-01 05:43:10 +00:00
|
|
|
...mapGetters({
|
|
|
|
currentChat: 'getSelectedChat',
|
|
|
|
dashboardApps: 'dashboardApps/getRecords',
|
|
|
|
}),
|
|
|
|
dashboardAppTabs() {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
key: 'messages',
|
|
|
|
name: this.$t('CONVERSATION.DASHBOARD_APP_TAB_MESSAGES'),
|
|
|
|
},
|
|
|
|
...this.dashboardApps.map(dashboardApp => ({
|
|
|
|
key: `dashboard-${dashboardApp.id}`,
|
|
|
|
name: dashboardApp.title,
|
|
|
|
})),
|
|
|
|
];
|
|
|
|
},
|
2021-03-02 17:14:04 +00:00
|
|
|
showContactPanel() {
|
|
|
|
return this.isContactPanelOpen && this.currentChat.id;
|
2019-11-14 08:16:43 +00:00
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
2021-04-09 09:02:29 +00:00
|
|
|
watch: {
|
|
|
|
'currentChat.inbox_id'(inboxId) {
|
|
|
|
if (inboxId) {
|
2022-06-03 05:42:22 +00:00
|
|
|
this.$store.dispatch('inboxAssignableAgents/fetch', [inboxId]);
|
2021-04-09 09:02:29 +00:00
|
|
|
}
|
|
|
|
},
|
2021-11-15 11:52:44 +00:00
|
|
|
'currentChat.id'() {
|
|
|
|
this.fetchLabels();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.fetchLabels();
|
2022-06-01 05:43:10 +00:00
|
|
|
this.$store.dispatch('dashboardApps/get');
|
2021-04-09 09:02:29 +00:00
|
|
|
},
|
2019-08-25 05:34:33 +00:00
|
|
|
methods: {
|
2021-11-15 11:52:44 +00:00
|
|
|
fetchLabels() {
|
|
|
|
if (!this.currentChat.id) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.$store.dispatch('conversationLabels/get', this.currentChat.id);
|
|
|
|
},
|
2019-11-14 08:16:43 +00:00
|
|
|
onToggleContactPanel() {
|
2020-08-17 05:55:13 +00:00
|
|
|
this.$emit('contact-panel-toggle');
|
2019-11-14 08:16:43 +00:00
|
|
|
},
|
2022-06-01 05:43:10 +00:00
|
|
|
onDashboardAppTabChange(index) {
|
|
|
|
this.activeIndex = index;
|
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
2021-03-02 17:14:04 +00:00
|
|
|
<style lang="scss" scoped>
|
2021-05-20 08:21:46 +00:00
|
|
|
@import '~dashboard/assets/scss/woot';
|
2021-03-02 17:14:04 +00:00
|
|
|
|
|
|
|
.conversation-details-wrap {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2021-05-07 12:58:47 +00:00
|
|
|
min-width: 0;
|
2021-03-02 17:14:04 +00:00
|
|
|
width: 100%;
|
2021-03-15 13:05:56 +00:00
|
|
|
background: var(--color-background-light);
|
2022-08-01 05:23:50 +00:00
|
|
|
|
|
|
|
&.with-border-left {
|
|
|
|
border-left: 1px solid var(--color-border);
|
|
|
|
}
|
2021-03-02 17:14:04 +00:00
|
|
|
}
|
|
|
|
|
2022-06-01 05:43:10 +00:00
|
|
|
.dashboard-app--tabs {
|
|
|
|
background: var(--white);
|
|
|
|
margin-top: -1px;
|
2022-07-08 06:53:01 +00:00
|
|
|
min-height: var(--dashboard-app-tabs-height);
|
2022-06-01 05:43:10 +00:00
|
|
|
}
|
|
|
|
|
2021-03-02 17:14:04 +00:00
|
|
|
.messages-and-sidebar {
|
|
|
|
display: flex;
|
|
|
|
background: var(--color-background-light);
|
|
|
|
margin: 0;
|
2022-03-15 15:39:14 +00:00
|
|
|
height: 100%;
|
|
|
|
min-height: 0;
|
2021-03-02 17:14:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.conversation-sidebar-wrap {
|
|
|
|
height: auto;
|
2021-03-08 08:00:33 +00:00
|
|
|
flex: 0 0;
|
2021-03-02 17:14:04 +00:00
|
|
|
overflow: hidden;
|
|
|
|
overflow: auto;
|
|
|
|
background: white;
|
|
|
|
flex-basis: 28rem;
|
|
|
|
|
|
|
|
@include breakpoint(large up) {
|
2021-03-08 08:00:33 +00:00
|
|
|
flex-basis: 30em;
|
2021-03-02 17:14:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@include breakpoint(xlarge up) {
|
2021-03-08 08:00:33 +00:00
|
|
|
flex-basis: 31em;
|
2021-03-02 17:14:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@include breakpoint(xxlarge up) {
|
2021-03-08 08:00:33 +00:00
|
|
|
flex-basis: 33rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
@include breakpoint(xxxlarge up) {
|
|
|
|
flex-basis: 40rem;
|
2021-03-02 17:14:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
&::v-deep .contact--panel {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
max-width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|