* feat: Remove foundation * chore: Minor fix * Minor fix * Update _forms.scss * chore: More changes * chore: Minor fix * chore: Clean up * fix: font-weight * chore: More changes * chore: Setting page * chore: Editor fix * chore: Reports page * chore: More changes * chore: Minor changes * chore: More fixes * chore: More changes * chore: More changes * chore: More changes * chore: Minor fix * chore: More changes * chore: More changes * chore: More changes * chore: More changes * chore: Clean up * chore: Minor fix * chore: Clean ups * chore: Rename basic file * chore: Remove unused files * chore: Fix expanded input * Fix campaign rendering * chore: Clean up * chore: More changes * chore: Remove unused files * fix: Overflow issue * chore: Minor fix * chore: Clean up * chore: Minor fix * chore: Remove unused files * chore: Minor fix * chore: Minor fix * fix: autoprefixer start/end value has mixed support * chore: Minor fix * chore: Remove unused files * chore: Minor fix * chore: Minor fix * chore: Minor fix * Add responsive design to label settings * fix inbox view * chore: Minor fix * w-60% to w-2/3 * chore: Fix team * chore: Fix button * w-[34%] to w-1/3 * chore: Fix border * Add support mobile views in team page * chore: fix snackbar * chore: clean up * chore: Clean up * fix: loading state alignment * fix: alert styles * chore: Minor fix * fix: spacing for agent bot row * fix: layout * fix: layout for SLA * fix: checkbox * fix: SLA checkbox spacing * Update inbox settings pages * fix macros listing page layout * fix canned responses * chore: Fix bot page * chore: fix automation page * chore: fix agents page * chore: fix canned response editor * chore: Fix settings table * chore: fix settings layout * chore: Minor fix * fix: canned response table layou * fix: layout for table header for webhooks * fix: webhook row layout * fix: dashboard app modal layout * fix: add title to canned response truncated shortcode * fix: dashboard apps row layuot * fix: layouts hooks * fix: body color * fix: delete action color in portal locales * fix: text color for campagin title * fix: success button color --------- Co-authored-by: Pranav <pranav@chatwoot.com> Co-authored-by: Vishnu Narayanan <iamwishnu@gmail.com> Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
143 lines
3.9 KiB
Vue
143 lines
3.9 KiB
Vue
<template>
|
|
<div class="w-full">
|
|
<div class="templates__list-search gap-1">
|
|
<fluent-icon icon="search" class="search-icon" size="16" />
|
|
<input
|
|
ref="search"
|
|
v-model="query"
|
|
type="search"
|
|
:placeholder="$t('WHATSAPP_TEMPLATES.PICKER.SEARCH_PLACEHOLDER')"
|
|
class="templates__search-input"
|
|
/>
|
|
</div>
|
|
<div class="template__list-container">
|
|
<div v-for="(template, i) in filteredTemplateMessages" :key="template.id">
|
|
<button
|
|
class="template__list-item"
|
|
@click="$emit('onSelect', template)"
|
|
>
|
|
<div>
|
|
<div class="flex items-center justify-between mb-2.5">
|
|
<p class="label-title">
|
|
{{ template.name }}
|
|
</p>
|
|
<span
|
|
class="inline-block py-1 px-2 rounded-sm text-xs leading-none cursor-default bg-white dark:bg-slate-700 text-slate-800 dark:text-slate-100"
|
|
>
|
|
{{ $t('WHATSAPP_TEMPLATES.PICKER.LABELS.LANGUAGE') }} :
|
|
{{ template.language }}
|
|
</span>
|
|
</div>
|
|
<div>
|
|
<p class="strong">
|
|
{{ $t('WHATSAPP_TEMPLATES.PICKER.LABELS.TEMPLATE_BODY') }}
|
|
</p>
|
|
<p class="label-body">{{ getTemplatebody(template) }}</p>
|
|
</div>
|
|
<div class="label-category">
|
|
<p class="strong">
|
|
{{ $t('WHATSAPP_TEMPLATES.PICKER.LABELS.CATEGORY') }}
|
|
</p>
|
|
<p>{{ template.category }}</p>
|
|
</div>
|
|
</div>
|
|
</button>
|
|
<hr v-if="i != filteredTemplateMessages.length - 1" :key="`hr-${i}`" />
|
|
</div>
|
|
<div v-if="!filteredTemplateMessages.length">
|
|
<p>
|
|
{{ $t('WHATSAPP_TEMPLATES.PICKER.NO_TEMPLATES_FOUND') }}
|
|
<strong>{{ query }}</strong>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
// TODO: Remove this when we support all formats
|
|
const formatsToRemove = ['DOCUMENT', 'IMAGE', 'VIDEO'];
|
|
|
|
export default {
|
|
props: {
|
|
inboxId: {
|
|
type: Number,
|
|
default: undefined,
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
query: '',
|
|
};
|
|
},
|
|
computed: {
|
|
whatsAppTemplateMessages() {
|
|
// TODO: Remove the last filter when we support all formats
|
|
return this.$store.getters['inboxes/getWhatsAppTemplates'](this.inboxId)
|
|
.filter(template => template.status.toLowerCase() === 'approved')
|
|
.filter(template => {
|
|
return template.components.every(component => {
|
|
return !formatsToRemove.includes(component.format);
|
|
});
|
|
});
|
|
},
|
|
filteredTemplateMessages() {
|
|
return this.whatsAppTemplateMessages.filter(template =>
|
|
template.name.toLowerCase().includes(this.query.toLowerCase())
|
|
);
|
|
},
|
|
},
|
|
methods: {
|
|
getTemplatebody(template) {
|
|
return template.components.find(component => component.type === 'BODY')
|
|
.text;
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.templates__list-search {
|
|
@apply items-center flex bg-slate-25 dark:bg-slate-900 mb-2.5 py-0 px-2.5 rounded-md border border-solid border-slate-100 dark:border-slate-700;
|
|
|
|
.search-icon {
|
|
@apply text-slate-400 dark:text-slate-300;
|
|
}
|
|
|
|
.templates__search-input {
|
|
@apply bg-transparent border-0 text-xs h-9 m-0;
|
|
}
|
|
}
|
|
.template__list-container {
|
|
@apply bg-slate-25 dark:bg-slate-900 rounded-md max-h-[18.75rem] overflow-y-auto p-2.5;
|
|
|
|
.template__list-item {
|
|
@apply rounded-lg cursor-pointer block p-2.5 text-left w-full hover:bg-woot-50 dark:hover:bg-slate-800;
|
|
|
|
.label-title {
|
|
@apply text-sm;
|
|
}
|
|
|
|
.label-category {
|
|
@apply mt-5;
|
|
|
|
span {
|
|
@apply text-sm font-semibold;
|
|
}
|
|
}
|
|
|
|
.label-body {
|
|
font-family: monospace;
|
|
}
|
|
}
|
|
}
|
|
|
|
.strong {
|
|
@apply text-xs font-semibold;
|
|
}
|
|
|
|
hr {
|
|
@apply border-b border-solid border-slate-100 dark:border-slate-700 my-2.5 mx-auto max-w-[95%];
|
|
}
|
|
</style>
|