mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-24 06:54:55 +00:00
86 lines
1.8 KiB
Vue
86 lines
1.8 KiB
Vue
<script>
|
|
import TemplatesPicker from './TemplatesPicker.vue';
|
|
import WhatsAppTemplateReply from './WhatsAppTemplateReply.vue';
|
|
export default {
|
|
components: {
|
|
TemplatesPicker,
|
|
WhatsAppTemplateReply,
|
|
},
|
|
props: {
|
|
show: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
inboxId: {
|
|
type: Number,
|
|
default: undefined,
|
|
},
|
|
},
|
|
emits: ['onSend', 'cancel', 'update:show'],
|
|
data() {
|
|
return {
|
|
selectedWaTemplate: null,
|
|
};
|
|
},
|
|
computed: {
|
|
localShow: {
|
|
get() {
|
|
return this.show;
|
|
},
|
|
set(value) {
|
|
this.$emit('update:show', value);
|
|
},
|
|
},
|
|
modalHeaderContent() {
|
|
return this.selectedWaTemplate
|
|
? this.$t('WHATSAPP_TEMPLATES.MODAL.TEMPLATE_SELECTED_SUBTITLE', {
|
|
templateName: this.selectedWaTemplate.name,
|
|
})
|
|
: this.$t('WHATSAPP_TEMPLATES.MODAL.SUBTITLE');
|
|
},
|
|
},
|
|
methods: {
|
|
pickTemplate(template) {
|
|
this.selectedWaTemplate = template;
|
|
},
|
|
onResetTemplate() {
|
|
this.selectedWaTemplate = null;
|
|
},
|
|
onSendMessage(message) {
|
|
this.$emit('onSend', message);
|
|
},
|
|
onClose() {
|
|
this.$emit('cancel');
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<woot-modal v-model:show="localShow" :on-close="onClose" size="modal-big">
|
|
<woot-modal-header
|
|
:header-title="$t('WHATSAPP_TEMPLATES.MODAL.TITLE')"
|
|
:header-content="modalHeaderContent"
|
|
/>
|
|
<div class="row modal-content">
|
|
<TemplatesPicker
|
|
v-if="!selectedWaTemplate"
|
|
:inbox-id="inboxId"
|
|
@on-select="pickTemplate"
|
|
/>
|
|
<WhatsAppTemplateReply
|
|
v-else
|
|
:template="selectedWaTemplate"
|
|
@reset-template="onResetTemplate"
|
|
@send-message="onSendMessage"
|
|
/>
|
|
</div>
|
|
</woot-modal>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.modal-content {
|
|
padding: 1.5625rem 2rem;
|
|
}
|
|
</style>
|