
import { useState, useEffect } from 'react';
import { connect } from '@umijs/max';

import { ConfigProvider, Modal, Tabs } from 'antd';

import FormJobseekerResumeBasic from '../resume/basic';
import FormJobseekerResumeContact from '../resume/contact';
import FormJobseekerResumeCredential from '../resume/credential';
import FormJobseekerResumeExperience from '../resume/experience';
import FormJobseekerResumeIntroduction from '../resume/introduction';
import FormJobseekerResumeSkill from '../resume/skill';
import FormJobseekerResumeTrain from '../resume/train';
import FormJobseekerResumeIntentionBasic from '../resume/intention/basic';
import FormJobseekerResumeIntentionArea from '../resume/intention/area';
import FormJobseekerResumeIntentionIndustry from '../resume/intention/industry';
import FormJobseekerResumeIntentionPost from '../resume/intention/post';




const PagesMainJobseekerListCreate: React.FC = ({ dispatch, dictModel, openModel, id }: any) => {
    const [openPreview, setOpenPreview] = useState(false);

    useEffect(() => {
        setOpenPreview(openModel.openModal)
    }, [openModel.openModal])


    return (
        <>
            <ConfigProvider
                theme={{
                    token: {
                        colorPrimary: '#4FBE70',
                    }
                }}
            >
                <Modal
                    open={openPreview}
                    title={id ? '编辑简历' : '添加简历'}
                    centered
                    maskClosable={false}
                    footer={null}
                    destroyOnClose
                    width={1200}
                    onCancel={() => {
                        dispatch({ type: 'openModel/getOpenModal', payload: false })
                    }}
                >
                    <Tabs
                        destroyInactiveTabPane={true}
                        type="card"
                        items={[
                            {
                                label: '基本信息',
                                key: '1',
                                children: (
                                    <>
                                        <FormJobseekerResumeBasic id={id}></FormJobseekerResumeBasic>
                                    </>
                                ),
                            },
                            {
                                label: '联系信息',
                                key: '2',
                                children: (
                                    <>
                                        <FormJobseekerResumeContact id={id}></FormJobseekerResumeContact>
                                    </>
                                ),
                            },
                            {
                                label: '个人简介',
                                key: '3',
                                children: (
                                    <>
                                        <FormJobseekerResumeIntroduction id={id}></FormJobseekerResumeIntroduction>
                                    </>
                                ),
                            },
                            {
                                label: '专业技能掌握程度',
                                key: '4',
                                children: (
                                    <>
                                        <FormJobseekerResumeSkill id={id}></FormJobseekerResumeSkill>
                                    </>
                                ),
                            },
                            {
                                label: '培训经历',
                                key: '5',
                                children: (
                                    <>
                                        <FormJobseekerResumeTrain id={id}></FormJobseekerResumeTrain>
                                    </>
                                ),
                            },
                            {
                                label: '工作经历',
                                key: '6',
                                children: (
                                    <>
                                        <FormJobseekerResumeExperience id={id}></FormJobseekerResumeExperience>
                                    </>
                                ),
                            },
                            {
                                label: '证书',
                                key: '7',
                                children: (
                                    <>
                                        <FormJobseekerResumeCredential id={id}></FormJobseekerResumeCredential>
                                    </>
                                ),
                            },
                            {
                                label: '基本意向',
                                key: '8',
                                children: (
                                    <>
                                        <FormJobseekerResumeIntentionBasic id={id}></FormJobseekerResumeIntentionBasic>
                                    </>
                                ),
                            },  {
                                label: '意向地区',
                                key: '9',
                                children: (
                                    <>
                                        <FormJobseekerResumeIntentionArea id={id}></FormJobseekerResumeIntentionArea>
                                    </>
                                ),
                            },  {
                                label: '意向行业',
                                key: '10',
                                children: (
                                    <>
                                        <FormJobseekerResumeIntentionIndustry id={id}></FormJobseekerResumeIntentionIndustry>
                                    </>
                                ),
                            },  {
                                label: '意向职位',
                                key: '11',
                                children: (
                                    <>
                                        <FormJobseekerResumeIntentionPost id={id}></FormJobseekerResumeIntentionPost>
                                    </>
                                ),
                            }
                        ]}
                    >

                    </Tabs>

                </Modal>
            </ConfigProvider >
        </>
    );
};



export default connect(({ dictModel, openModel }: any) => ({
    dictModel, openModel
}))(PagesMainJobseekerListCreate);