import { createContext, useEffect, useState } from 'react' import { ReloadOutlined, ReadOutlined, RightOutlined, LeftOutlined, SearchOutlined, MailOutlined } from '@ant-design/icons' import { Button, Modal, Form, Input, Checkbox, Select, Radio, DatePicker, Divider } from 'antd' import dayjs from 'dayjs' import { getEmailDirAction } from '@/actions/EmailActions' import { objectMapper } from '@/utils/commons' import useConversationStore from '@/stores/ConversationStore' const yearsArray = Array.from({ length: new Date().getFullYear() - 2004 + 1 }, (_, i) => ({ key: 2004 + i, value: 2004 + i, label: 2004 + i })) const MailOrderSearchModal = ({ ...props }) => { const [currentMailboxOPI] = useConversationStore((state) => [state.currentMailboxOPI]) const [setMailboxNestedDirsActive, setMailboxActiveNode] = useConversationStore((state) => [state.setMailboxNestedDirsActive, state.setMailboxActiveNode]) const [open, setOpen] = useState(false) const [form] = Form.useForm() const [loading, setLoading] = useState(false) const [formValues, setFormValues] = useState() const onSubmitSearchMailOrder = async (values) => { console.log('Received values of form: ', values) setFormValues(values) // setOpen(false) setLoading(true) const valuesToSub = objectMapper(values, { year: { key: 'year', transform: (val) => (val ? dayjs(val).year() : '') }, important: { key: 'important', transform: (val) => (val ? '1' : '0') }, by_success: { key: 'by_success', transform: (val) => (val ? '1' : '0') }, if_want_book: { key: 'if_want_book', transform: (val) => (val ? '1' : '0') }, if_thinking: { key: 'if_thinking', transform: (val) => (val ? '1' : '0') }, by_start_date: { key: 'by_start_date', transform: (val) => (val ? '1' : '0') }, }) const result = await getEmailDirAction({ ...valuesToSub, opi_sn: currentMailboxOPI }, true) console.log('res', result) setLoading(false) // setMailboxActiveNode({ // key: 1130915, // parent: -1, // iconIndex: 13, // title: 'QYCAH250101022', // parentTitle: '1月', // parentIconIndex: 1, // VKey: 1130915, // VName: 'QYCAH250101022', // VParent: -1, // ImageIndex: 13, // COLI_SN: 1130915, // OrderSourceType: 227001, // IsTrue: 0, // ApplyDate: '2025-01-01T00:06:00', // StartDate: '2024-12-16', // IsSuccess: 0, // OPI_SN: 586, // }) setOpen(false) } return ( <> setOpen(false)} // footer={null} destroyOnHidden modalRender={(dom) => (
onSubmitSearchMailOrder(values)} className='[&_.ant-form-item]:m-2'> {dom}
)}>
成行订单 要预定 犹豫中
按出发日期 {/* */}
) } export default MailOrderSearchModal