mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-03 20:48:07 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			72 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			72 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
<template>
 | 
						|
  <div class="flex flex-col">
 | 
						|
    <woot-modal-header :header-title="$t('CONVERSATION.CUSTOM_SNOOZE.TITLE')" />
 | 
						|
    <form class="modal-content" @submit.prevent="chooseTime">
 | 
						|
      <date-picker
 | 
						|
        v-model="snoozeTime"
 | 
						|
        type="datetime"
 | 
						|
        inline
 | 
						|
        :lang="lang"
 | 
						|
        :disabled-date="disabledDate"
 | 
						|
        :disabled-time="disabledTime"
 | 
						|
        :popup-style="{ width: '100%' }"
 | 
						|
      />
 | 
						|
      <div class="flex flex-row justify-end gap-2 py-2 px-0 w-full">
 | 
						|
        <woot-button variant="clear" @click.prevent="onClose">
 | 
						|
          {{ this.$t('CONVERSATION.CUSTOM_SNOOZE.CANCEL') }}
 | 
						|
        </woot-button>
 | 
						|
        <woot-button>
 | 
						|
          {{ this.$t('CONVERSATION.CUSTOM_SNOOZE.APPLY') }}
 | 
						|
        </woot-button>
 | 
						|
      </div>
 | 
						|
    </form>
 | 
						|
  </div>
 | 
						|
</template>
 | 
						|
 | 
						|
<script>
 | 
						|
import DatePicker from 'vue2-datepicker';
 | 
						|
 | 
						|
export default {
 | 
						|
  components: {
 | 
						|
    DatePicker,
 | 
						|
  },
 | 
						|
 | 
						|
  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('choose-time', 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>
 | 
						|
<style lang="scss" scoped>
 | 
						|
.modal-content {
 | 
						|
  @apply pt-2 px-5 pb-6;
 | 
						|
}
 | 
						|
</style>
 |