import React, { Component } from "react";
import { SnackbarHOC, CNotificationHOC } from "educoder";
import { Route, Switch } from "react-router-dom";
import Loadable from "react-loadable";
import Loading from "../../Loading";
import { TPMIndexHOC } from "../tpm/TPMIndexHOC";


const RecruitList = Loadable({
  loader: () => import("./tablist/RecruitList"),
  loading: Loading,
});

//简历详情
const ResumeDetails = Loadable({
  loader: () => import("./Resume/ResumeDetails"),
  loading: Loading,
});

const AddJobPage = Loadable({
  loader: () => import("./routePage/AddJobPage"),
  loading: Loading,
});
const EditJobPage = Loadable({
  loader: () => import("./routePage/EditJobPage"),
  loading: Loading,
});
const JobDetailPage = Loadable({
  loader: () => import("./routePage/JobDetailPage"),
  loading: Loading,
});
const ApplierPage = Loadable({
  loader: () => import("./routePage/ApplierPage"),
  loading: Loading,
});
const AddResumePage = Loadable({
  loader: () => import("./routePage/AddResumePage"),
  loading: Loading,
});
const EditResumePage = Loadable({
  loader: () => import("./routePage/EditResumePage"),
  loading: Loading,
});
//test
const DetailAddResumePage = Loadable({
  loader: () => import("./routePage/DetailAddResumePage"),
  loading: Loading,
});
class Tecruitment extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  render() {
    return (
      <div>
        <Switch {...this.props}>
          {/* 简历详情*  ResumeDetails*/}
          <Route
            path={"/recruitment/resumedetails"}
            render={(props) => {
              return (
                <ResumeDetails {...this.props} {...props} {...this.state} />
              );
            }}
          ></Route>
          {/* 新增职位 */}
          <Route path="/recruitment/addjob">
            <AddJobPage {...this.props} />
          </Route>
          {/* 编辑职位 */}
          <Route
            path="/recruitment/editjob/:jobid"
            render={({ match }) => (
              <EditJobPage {...this.props} jobId={match.params.jobid} />
            )}
          />
          {/* 职位详情 */}
          <Route
            path="/recruitment/jobdetail/addresume/:jobid"
            render={({ match }) => (
              <DetailAddResumePage {...this.props} jobId={match.params.jobid} />
            )}
          />
          <Route
            path="/recruitment/jobdetail/:jobid"
            render={({ match }) => (
              <JobDetailPage {...this.props} jobId={match.params.jobid} />
            )}
          />

          {/* 应聘者列表 */}
          <Route
            path="/recruitment/applier/:jobid"
            render={({ match }) => (
              <ApplierPage {...this.props} jobId={match.params.jobid} />
            )}
          />
          <Route path="/recruitment/addresume" >
            <AddResumePage {...this.props}/>
          </Route>
          <Route path="/recruitment/editresume" >
            <EditResumePage {...this.props}/>
          </Route>
          {/*招聘链接*/}
          <Route
            path="/recruitment"
            render={(props) => (
              <RecruitList {...this.props} {...props} {...this.state} />
            )}
          ></Route>
        </Switch>
      </div>
    );
  }
}

export default CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Tecruitment)));
