mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 11:37:58 +00:00
These fixes are all auto generated and can be merged directly Fixes the following issues 1. Event used on components should be hypenated 2. Attribute orders in components 3. Use `unmounted` instead of `destroyed` 4. Add explicit `emits` declarations for components, autofixed [using this script](https://gist.github.com/scmmishra/6f549109b96400006bb69bbde392eddf) We ignore the top level v-if for now, we will fix it later
74 lines
1.7 KiB
Vue
74 lines
1.7 KiB
Vue
<script>
|
|
import DatePicker from 'vue-datepicker-next';
|
|
|
|
export default {
|
|
components: {
|
|
DatePicker,
|
|
},
|
|
emits: ['close', 'chooseTime'],
|
|
|
|
data() {
|
|
return {
|
|
snoozeTime: null,
|
|
lang: {
|
|
days: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
yearFormat: 'YYYY',
|
|
monthFormat: 'MMMM',
|
|
},
|
|
};
|
|
},
|
|
|
|
methods: {
|
|
onClose() {
|
|
this.$emit('close');
|
|
},
|
|
chooseTime() {
|
|
this.$emit('chooseTime', this.snoozeTime);
|
|
},
|
|
disabledDate(date) {
|
|
// Disable all the previous dates
|
|
const yesterday = new Date();
|
|
yesterday.setDate(yesterday.getDate() - 1);
|
|
return date < yesterday;
|
|
},
|
|
disabledTime(date) {
|
|
// Allow only time after 1 hour
|
|
const now = new Date();
|
|
now.setHours(now.getHours() + 1);
|
|
return date < now;
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<div class="flex flex-col">
|
|
<woot-modal-header :header-title="$t('CONVERSATION.CUSTOM_SNOOZE.TITLE')" />
|
|
<form class="modal-content" @submit.prevent="chooseTime">
|
|
<DatePicker
|
|
v-model:value="snoozeTime"
|
|
type="datetime"
|
|
inline
|
|
:lang="lang"
|
|
:disabled-date="disabledDate"
|
|
:disabled-time="disabledTime"
|
|
:popup-style="{ width: '100%' }"
|
|
/>
|
|
<div class="flex flex-row justify-end w-full gap-2 px-0 py-2">
|
|
<woot-button variant="clear" @click.prevent="onClose">
|
|
{{ $t('CONVERSATION.CUSTOM_SNOOZE.CANCEL') }}
|
|
</woot-button>
|
|
<woot-button>
|
|
{{ $t('CONVERSATION.CUSTOM_SNOOZE.APPLY') }}
|
|
</woot-button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</template>
|
|
|
|
<style lang="scss" scoped>
|
|
.modal-content {
|
|
@apply pt-2 px-5 pb-6;
|
|
}
|
|
</style>
|