diff --git a/src/components/root/common/Forms/CPanelForm.js b/src/components/root/common/Forms/CPanelForm.js new file mode 100644 index 0000000..7f98334 --- /dev/null +++ b/src/components/root/common/Forms/CPanelForm.js @@ -0,0 +1,406 @@ +import React, { useState } from "react"; +import { Formik, Form, ErrorMessage } from "formik"; +import * as Yup from "yup"; +import moment from "moment"; + +import { callAPI } from "../../../actions/API"; +import Msgbox from "../../../actions/Msgbox"; +import { builfArrayFromObject } from "../../../actions/Error"; + +export const CPanelForm = (timeslots) => { + const [respID, setRespID] = useState(0); + const [error, setError] = useState(0); + + return ( + { + console.log(values); + callAPI + .post("/book/", values) + .then(function (response) { + setRespID(response.data.id); + resetForm({ values: "" }); + }) + .catch(function (error) { + setError(builfArrayFromObject(error.response.data)); + setRespID(0); + }); + }} + render={({ + errors, + touched, + handleChange, + values, + handleBlur, + handleReset, + }) => ( +
+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+
+ + + +
+ +
+ + + +
+ +
+ + + +
+
+ + + +
+
+
+
+ + + +
+ +
+ + + +
+
+ + + +
+
+
+
+ + + +
+ +
+ +