123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- // Copyright (C) 2012-2025 Zammad Foundation, https://zammad-foundation.org/
- import { useDateFormat } from '@vueuse/shared'
- import { shallowRef, reactive } from 'vue'
- import type { FormRef } from '#shared/components/Form/types.ts'
- import type { EmailInboundMetaInformation } from '../types/email-inbound-outbound.ts'
- import type { ShallowRef, Ref } from 'vue'
- export const useEmailInboundMessagesForm = (
- metaInformationInbound: Ref<Maybe<EmailInboundMetaInformation>>,
- ) => {
- const formEmailInboundMessages: ShallowRef<FormRef | undefined> = shallowRef()
- const emailInboundMessageSchema = [
- {
- isLayout: true,
- element: 'div',
- attrs: {
- class: 'flex flex-col gap-y-2.5 gap-x-3',
- },
- children: [
- {
- isLayout: true,
- component: 'CommonLabel',
- children:
- '$t("%s email(s) were found in your mailbox. They will all be moved from your mailbox into Zammad.", $metaInformationInbound.contentMessages)',
- },
- {
- isLayout: true,
- component: 'CommonLabel',
- children:
- '$t(\'You can import some of your emails as an "archive", which means that no notifications are sent and the tickets will be in a target state that you define.\')',
- },
- {
- isLayout: true,
- component: 'CommonLabel',
- children:
- '$t("You can find archived emails in Zammad anytime using the search function, like for any other ticket.")',
- },
- {
- name: 'archive',
- label: __('Archive emails'),
- type: 'toggle',
- value: true,
- props: {
- variants: {
- true: __('yes'),
- false: __('no'),
- },
- },
- },
- {
- name: 'archive_before',
- if: '$values.archive',
- type: 'datetime',
- label: __('Archive cut-off time'),
- required: true,
- help: __(
- 'Emails before the cut-off time are imported as archived tickets. Emails after the cut-off time are imported as regular tickets.',
- ),
- props: {
- // With an extra hour on top, so the current selection works.
- maxDate: useDateFormat(
- new Date(new Date().getTime() + 60 * 60 * 1000),
- 'YYYY-MM-DDTHH:mm',
- ).value,
- },
- },
- {
- name: 'archive_state_id',
- if: '$values.archive',
- label: __('Archive ticket target state'),
- type: 'select',
- },
- ],
- },
- ]
- const emailInboundMessageSchemaData = reactive({
- metaInformationInbound,
- })
- return {
- formEmailInboundMessages,
- emailInboundMessageSchema,
- emailInboundMessageSchemaData,
- }
- }
|