From a4772d36260f84cd81005d0c42e53e67b6724bc7 Mon Sep 17 00:00:00 2001 From: pepper Date: Wed, 27 Jan 2021 20:07:09 -0500 Subject: [PATCH] Moved AutoBook to tab in book --- src/components/root/Pages/Autobook.js | 34 +++++++++++++------- src/components/root/common/Forms/FormPage.js | 23 +++++++++++-- 2 files changed, 43 insertions(+), 14 deletions(-) diff --git a/src/components/root/Pages/Autobook.js b/src/components/root/Pages/Autobook.js index ed76b68..beb5312 100644 --- a/src/components/root/Pages/Autobook.js +++ b/src/components/root/Pages/Autobook.js @@ -4,6 +4,7 @@ import FormPage from "../common/Forms/FormPage"; import { callAPI } from "../../actions/API"; import { GenericForm } from "../common/Forms/GenericForm"; import moment from "moment"; +import Msgbox from "../../actions/Msgbox"; export default class Book extends Component { constructor(props) { @@ -11,6 +12,7 @@ export default class Book extends Component { this.state = { data: null, timeslots: [], + error: "", }; } preBookedData = { @@ -37,21 +39,24 @@ export default class Book extends Component { this.setState({ timeslots: response.data, }); - // console.log(response.data); }); } credCallback = (credData) => { - console.log(credData); - this.setState({ - data: credData, - }); - console.log(this.state.data); - 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; - console.log(this.preBookedData); + if (credData[0].data.Error) { + this.setState({ + error: credData[0].data.Error, + }); + } else { + this.setState({ + data: credData, + error: "", + }); + 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() { if (this.state.data) { @@ -69,7 +74,12 @@ export default class Book extends Component { ); } else { - return ; + return ( +
+ + {this.state.error ? : null} +
+ ); } } } diff --git a/src/components/root/common/Forms/FormPage.js b/src/components/root/common/Forms/FormPage.js index 97c8a9f..7890af5 100644 --- a/src/components/root/common/Forms/FormPage.js +++ b/src/components/root/common/Forms/FormPage.js @@ -12,6 +12,7 @@ import classnames from "classnames"; import EmailBooking from "./EmailBooking"; import { GenericForm } from "./GenericForm"; +import AutoBook from "../../Pages/Autobook"; const FormPage = ({ timeslots, item }) => { const [activeTab, setActiveTab] = useState("1"); @@ -33,7 +34,7 @@ const FormPage = ({ timeslots, item }) => { toggle("1"); }} > - Web hosting Migration + Auto cPanel Booking @@ -42,6 +43,16 @@ const FormPage = ({ timeslots, item }) => { onClick={() => { toggle("2"); }} + > + Web hosting Migration + + + + { + toggle("3"); + }} > Email Migration @@ -52,11 +63,19 @@ const FormPage = ({ timeslots, item }) => { {/* */} - + + + + {/* */} + + + + + {" "}