mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-03 04:27:53 +00:00
Fixes: CW-3602, CW-3606, CW-3605, CW-3601, CW-3603, CW-3600, CW-3598 - [CW-3602](https://linear.app/chatwoot/issue/CW-3602/chat-list-infinite-loader-fetching-only-odd-numbered-pages) Chat list pagination broken - [CW-3606](https://linear.app/chatwoot/issue/CW-3606/saving-greeting-message-is-not-working-in-inbox-settings) Greetings message not getting saved - [CW-3605](https://linear.app/chatwoot/issue/CW-3605/copy-and-paste-image-attachment-not-working-in-widget) Paste not working on widget - [CW-3601](https://linear.app/chatwoot/issue/CW-3601/edit-category-is-not-working-properly) Edit category not updating - [CW-3603](https://linear.app/chatwoot/issue/CW-3603/delete-filter-is-not-working) Delete filter modal not toggling - [CW-3600](https://linear.app/chatwoot/issue/CW-3600/portal-editor-is-not-working-properly) Portal editor events were flaky - [CW-3598](https://linear.app/chatwoot/issue/CW-3598/rearrange-of-pre-chat-form-fields-throws-an-error) Prechat form re-order bug --------- Co-authored-by: Vishnu Narayanan <iamwishnu@gmail.com>
109 lines
2.6 KiB
Vue
109 lines
2.6 KiB
Vue
<script>
|
|
import Modal from 'dashboard/components/Modal.vue';
|
|
import { useVuelidate } from '@vuelidate/core';
|
|
import { required, minLength } from '@vuelidate/validators';
|
|
|
|
export default {
|
|
components: {
|
|
Modal,
|
|
},
|
|
props: {
|
|
show: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
isCreating: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
},
|
|
emits: ['create', 'cancel', 'update:show'],
|
|
setup() {
|
|
return { v$: useVuelidate() };
|
|
},
|
|
data() {
|
|
return {
|
|
attributeValue: '',
|
|
attributeName: '',
|
|
};
|
|
},
|
|
validations: {
|
|
attributeName: {
|
|
required,
|
|
minLength: minLength(2),
|
|
},
|
|
},
|
|
computed: {
|
|
localShow: {
|
|
get() {
|
|
return this.show;
|
|
},
|
|
set(value) {
|
|
this.$emit('update:show', value);
|
|
},
|
|
},
|
|
attributeNameError() {
|
|
if (this.v$.attributeName.$error) {
|
|
return this.$t('CUSTOM_ATTRIBUTES.FORM.NAME.ERROR');
|
|
}
|
|
return '';
|
|
},
|
|
},
|
|
methods: {
|
|
addCustomAttribute() {
|
|
this.$emit('create', {
|
|
attributeValue: this.attributeValue,
|
|
attributeName: this.attributeName || '',
|
|
});
|
|
this.reset();
|
|
this.$emit('cancel');
|
|
},
|
|
onClose() {
|
|
this.reset();
|
|
this.$emit('cancel');
|
|
},
|
|
reset() {
|
|
this.attributeValue = '';
|
|
this.attributeName = '';
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<Modal v-model:show="localShow" :on-close="onClose">
|
|
<woot-modal-header
|
|
:header-title="$t('CUSTOM_ATTRIBUTES.ADD.TITLE')"
|
|
:header-content="$t('CUSTOM_ATTRIBUTES.ADD.DESC')"
|
|
/>
|
|
<form class="w-full" @submit.prevent="addCustomAttribute">
|
|
<woot-input
|
|
v-model="attributeName"
|
|
:class="{ error: v$.attributeName.$error }"
|
|
class="w-full"
|
|
:error="attributeNameError"
|
|
:label="$t('CUSTOM_ATTRIBUTES.FORM.NAME.LABEL')"
|
|
:placeholder="$t('CUSTOM_ATTRIBUTES.FORM.NAME.PLACEHOLDER')"
|
|
@input="v$.attributeName.$touch"
|
|
/>
|
|
<woot-input
|
|
v-model="attributeValue"
|
|
class="w-full"
|
|
:label="$t('CUSTOM_ATTRIBUTES.FORM.VALUE.LABEL')"
|
|
:placeholder="$t('CUSTOM_ATTRIBUTES.FORM.VALUE.PLACEHOLDER')"
|
|
/>
|
|
<div class="flex items-center justify-end gap-2 px-0 py-2">
|
|
<woot-button
|
|
:is-disabled="v$.attributeName.$invalid || isCreating"
|
|
:is-loading="isCreating"
|
|
>
|
|
{{ $t('CUSTOM_ATTRIBUTES.FORM.CREATE') }}
|
|
</woot-button>
|
|
<woot-button variant="clear" @click.prevent="onClose">
|
|
{{ $t('CUSTOM_ATTRIBUTES.FORM.CANCEL') }}
|
|
</woot-button>
|
|
</div>
|
|
</form>
|
|
</Modal>
|
|
</template>
|