References - https://v3-migration.vuejs.org/breaking-changes/v-model - https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html
63 lines
1.4 KiB
Vue
63 lines
1.4 KiB
Vue
<script>
|
|
import { defineModel } from 'vue';
|
|
import ConversationForm from './ConversationForm.vue';
|
|
|
|
export default {
|
|
components: {
|
|
ConversationForm,
|
|
},
|
|
props: {
|
|
contact: {
|
|
type: Object,
|
|
default: () => ({}),
|
|
},
|
|
},
|
|
emits: ['cancel'],
|
|
setup() {
|
|
const show = defineModel('show', { type: Boolean, default: false });
|
|
return { show };
|
|
},
|
|
watch: {
|
|
'contact.id'(id) {
|
|
this.$store.dispatch('contacts/fetchContactableInbox', id);
|
|
},
|
|
},
|
|
mounted() {
|
|
const { id } = this.contact;
|
|
this.$store.dispatch('contacts/fetchContactableInbox', id);
|
|
},
|
|
methods: {
|
|
onCancel() {
|
|
this.$emit('cancel');
|
|
},
|
|
onSuccess() {
|
|
this.$emit('cancel');
|
|
},
|
|
async onSubmit(params, isFromWhatsApp) {
|
|
const data = await this.$store.dispatch('contactConversations/create', {
|
|
params,
|
|
isFromWhatsApp,
|
|
});
|
|
return data;
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<woot-modal v-model:show="show" :on-close="onCancel">
|
|
<div class="flex flex-col h-auto overflow-auto">
|
|
<woot-modal-header
|
|
:header-title="$t('NEW_CONVERSATION.TITLE')"
|
|
:header-content="$t('NEW_CONVERSATION.DESC')"
|
|
/>
|
|
<ConversationForm
|
|
:contact="contact"
|
|
:on-submit="onSubmit"
|
|
@success="onSuccess"
|
|
@cancel="onCancel"
|
|
/>
|
|
</div>
|
|
</woot-modal>
|
|
</template>
|