Moved AutoBook to tab in book

This commit is contained in:
pepper 2021-01-27 20:07:09 -05:00
parent 99abdc0a6f
commit a4772d3626
2 changed files with 43 additions and 14 deletions

View File

@ -4,6 +4,7 @@ import FormPage from "../common/Forms/FormPage";
import { callAPI } from "../../actions/API"; import { callAPI } from "../../actions/API";
import { GenericForm } from "../common/Forms/GenericForm"; import { GenericForm } from "../common/Forms/GenericForm";
import moment from "moment"; import moment from "moment";
import Msgbox from "../../actions/Msgbox";
export default class Book extends Component { export default class Book extends Component {
constructor(props) { constructor(props) {
@ -11,6 +12,7 @@ export default class Book extends Component {
this.state = { this.state = {
data: null, data: null,
timeslots: [], timeslots: [],
error: "",
}; };
} }
preBookedData = { preBookedData = {
@ -37,21 +39,24 @@ export default class Book extends Component {
this.setState({ this.setState({
timeslots: response.data, timeslots: response.data,
}); });
// console.log(response.data);
}); });
} }
credCallback = (credData) => { credCallback = (credData) => {
console.log(credData); if (credData[0].data.Error) {
this.setState({ this.setState({
data: credData, error: credData[0].data.Error,
}); });
console.log(this.state.data); } else {
this.preBookedData.domain = this.state.data[0].data.main_domain; this.setState({
this.preBookedData.additional_domains = this.state.data[0].data.other_domains; data: credData,
this.preBookedData.username = this.state.data[1].username; error: "",
this.preBookedData.original_server = this.state.data[1].hostname; });
console.log(this.preBookedData); this.preBookedData.domain = this.state.data[0].data.main_domain;
this.preBookedData.additional_domains = this.state.data[0].data.other_domains;
this.preBookedData.username = this.state.data[1].username;
this.preBookedData.original_server = this.state.data[1].hostname;
}
}; };
render() { render() {
if (this.state.data) { if (this.state.data) {
@ -69,7 +74,12 @@ export default class Book extends Component {
</div> </div>
); );
} else { } else {
return <CredChecker credCallback={this.credCallback} />; return (
<div>
<CredChecker credCallback={this.credCallback} />
{this.state.error ? <Msgbox msg={this.state.error} /> : null}
</div>
);
} }
} }
} }

View File

@ -12,6 +12,7 @@ import classnames from "classnames";
import EmailBooking from "./EmailBooking"; import EmailBooking from "./EmailBooking";
import { GenericForm } from "./GenericForm"; import { GenericForm } from "./GenericForm";
import AutoBook from "../../Pages/Autobook";
const FormPage = ({ timeslots, item }) => { const FormPage = ({ timeslots, item }) => {
const [activeTab, setActiveTab] = useState("1"); const [activeTab, setActiveTab] = useState("1");
@ -33,7 +34,7 @@ const FormPage = ({ timeslots, item }) => {
toggle("1"); toggle("1");
}} }}
> >
Web hosting Migration Auto cPanel Booking
</NavLink> </NavLink>
</NavItem> </NavItem>
<NavItem> <NavItem>
@ -42,6 +43,16 @@ const FormPage = ({ timeslots, item }) => {
onClick={() => { onClick={() => {
toggle("2"); toggle("2");
}} }}
>
Web hosting Migration
</NavLink>
</NavItem>
<NavItem>
<NavLink
className={classnames({ active: activeTab === "3" })}
onClick={() => {
toggle("3");
}}
> >
Email Migration Email Migration
</NavLink> </NavLink>
@ -52,11 +63,19 @@ const FormPage = ({ timeslots, item }) => {
<Row> <Row>
<Col> <Col>
{/* <CPanelForm timeslots={timeslots} key={timeslots.id} /> */} {/* <CPanelForm timeslots={timeslots} key={timeslots.id} /> */}
<GenericForm timeslots={timeslots} key={timeslots.id} /> <AutoBook />
</Col> </Col>
</Row> </Row>
</TabPane> </TabPane>
<TabPane tabId="2"> <TabPane tabId="2">
<Row>
<Col>
{/* <CPanelForm timeslots={timeslots} key={timeslots.id} /> */}
<GenericForm timeslots={timeslots} key={timeslots.id} />
</Col>
</Row>
</TabPane>
<TabPane tabId="3">
<Row> <Row>
<Col sm="12"> <Col sm="12">
<EmailBooking />{" "} <EmailBooking />{" "}