Added scheduling routes for smart scheduling BOD-4

This commit is contained in:
Patrick Fic
2020-06-03 10:55:13 -07:00
parent d99dd89d67
commit 47f858920b
5 changed files with 115 additions and 8 deletions

View File

@@ -4,6 +4,8 @@ import { useTranslation } from "react-i18next";
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component";
import ScheduleDayViewContainer from "../schedule-day-view/schedule-day-view.container";
import ScheduleExistingAppointmentsList from "../schedule-existing-appointments-list/schedule-existing-appointments-list.component";
import axios from "axios";
import { auth } from "../../firebase/firebase.utils";
export default function ScheduleJobModalComponent({
existingAppointments,
@@ -13,18 +15,37 @@ export default function ScheduleJobModalComponent({
setFormData,
}) {
const { t } = useTranslation();
const handleAuto = async () => {
try {
const response = await axios.post(
"/scheduling/job",
{ jobId: "661dd1d5-bf06-426f-8bd2-bd9e41de8eb1" },
{
headers: {
Authorization: `Bearer ${await auth.currentUser.getIdToken(true)}`,
},
}
);
console.log("response", response);
} catch (error) {
console.log("error", error, error.message);
}
};
//TODO Existing appointments list only refreshes sometimes after modal close. May have to do with the container class.
return (
<Row>
<Col span={14}>
<Tabs defaultActiveKey='1'>
<Tabs.TabPane tab='SMART Scheduling' key='auto'>
<Tabs defaultActiveKey="1">
<Tabs.TabPane tab="SMART Scheduling" key="auto">
Automatic Job Selection.
<button onClick={handleAuto}>Get dates.</button>
</Tabs.TabPane>
<Tabs.TabPane tab='Manual Scheduling' key='manual'>
<Tabs.TabPane tab="Manual Scheduling" key="manual">
<Row>
Manual Job Selection Scheduled Time
<div style={{height: "300px"}}>
<div style={{ height: "300px" }}>
<DateTimePicker
value={appData.start}
onChange={(e) => {
@@ -45,7 +66,8 @@ export default function ScheduleJobModalComponent({
defaultChecked={formData.notifyCustomer}
onChange={(e) =>
setFormData({ ...formData, notifyCustomer: e.target.checked })
}>
}
>
{t("jobs.labels.appointmentconfirmation")}
</Checkbox>
</Col>