Added timeslots from api

This commit is contained in:
pepper 2021-01-19 19:56:18 -05:00
parent ec75fb476f
commit 03ee5d6fa8
2 changed files with 5 additions and 18 deletions

View File

@ -23,16 +23,8 @@ const InputValidation = Yup.object().shape({
.required("Please enter a domain"),
username: Yup.string().min(2, "Too Short!").required("Required"),
original_server: Yup.string()
.matches(
/^((([1-9]?\d|1\d\d|2[0-5][0-5]|2[0-4]\d)\.){3}([1-9]?\d|1\d\d|2[0-5][0-5]|2[0-4]\d))|(((https?):\/\/)?(www.)?[a-z0-9]+(\.[a-z]{2,}){1,3}(#?\/?[a-zA-Z0-9#]+)*\/?(\?[a-zA-Z0-9-_]+=[a-zA-Z0-9-%]+&?)?)|([a-z0-9]{0,4}-[a-z0-9]{0,2}-[a-z0-9]{0,3})$/i,
"Please enter a valid IPv4 Address or domain"
)
.required("Please enter a valid IPv4 or domain"),
new_server: Yup.string()
.matches(
/^((([1-9]?\d|1\d\d|2[0-5][0-5]|2[0-4]\d)\.){3}([1-9]?\d|1\d\d|2[0-5][0-5]|2[0-4]\d))|(((https?):\/\/)?(www.)?[a-z0-9]+(\.[a-z]{2,}){1,3}(#?\/?[a-zA-Z0-9#]+)*\/?(\?[a-zA-Z0-9-_]+=[a-zA-Z0-9-%]+&?)?)|([a-z0-9]{0,4}-[a-z0-9]{0,2}-[a-z0-9]{0,3})$/i,
"Please enter a valid IPv4 Address or domain"
)
.required("Please enter a valid IPv4 or domain"),
agent_booked: Yup.string()
.min(2, "Too short!")
@ -44,7 +36,7 @@ const InputValidation = Yup.object().shape({
booked_date: Yup.date().required("Please enter a date!"),
});
export const CPanelBooking = () => {
export const CPanelBooking = (timeslots) => {
const [respID, setRespID] = useState(0);
const [error, setError] = useState(0);
@ -70,6 +62,7 @@ export const CPanelBooking = () => {
});
setSubmitting(false);
};
return (
<Formik
initialValues={initialValues}
@ -108,12 +101,7 @@ export const CPanelBooking = () => {
className="has-success"
>
<option>Select</option>
<option>00:00-03:00</option>
<option>03:00-06:00</option>
<option>06:00-09:00</option>
<option>08:00-12:00</option>
<option>12:00-18:00</option>
<option>18:00-00:00</option>
{timeslots.timeslots.map((slot) => <option>{slot}</option>)}
</Input>
</FormGroup>
</Col>

View File

@ -13,7 +13,7 @@ import classnames from "classnames";
import { CPanelBooking } from "./CPanelBooking";
import EmailBooking from "./EmailBooking";
const FormPage = ({ item }) => {
const FormPage = ({ timeslots, item }) => {
const [activeTab, setActiveTab] = useState("1");
const toggle = (tab) => {
@ -23,7 +23,6 @@ const FormPage = ({ item }) => {
// Parent page from the Book section,
// Can be expanded to offer email migration bookings,
// elements below do the POST requests.
return (
<div>
<Nav tabs>
@ -52,7 +51,7 @@ const FormPage = ({ item }) => {
<TabPane tabId="1">
<Row>
<Col sm="12">
<CPanelBooking />
<CPanelBooking timeslots={timeslots} />
</Col>
</Row>
</TabPane>