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 { 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 {
</div>
);
} 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 { 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
</NavLink>
</NavItem>
<NavItem>
@ -42,6 +43,16 @@ const FormPage = ({ timeslots, item }) => {
onClick={() => {
toggle("2");
}}
>
Web hosting Migration
</NavLink>
</NavItem>
<NavItem>
<NavLink
className={classnames({ active: activeTab === "3" })}
onClick={() => {
toggle("3");
}}
>
Email Migration
</NavLink>
@ -52,11 +63,19 @@ const FormPage = ({ timeslots, item }) => {
<Row>
<Col>
{/* <CPanelForm timeslots={timeslots} key={timeslots.id} /> */}
<GenericForm timeslots={timeslots} key={timeslots.id} />
<AutoBook />
</Col>
</Row>
</TabPane>
<TabPane tabId="2">
<Row>
<Col>
{/* <CPanelForm timeslots={timeslots} key={timeslots.id} /> */}
<GenericForm timeslots={timeslots} key={timeslots.id} />
</Col>
</Row>
</TabPane>
<TabPane tabId="3">
<Row>
<Col sm="12">
<EmailBooking />{" "}