Added basic bucketed smart scheduling BOD-4

This commit is contained in:
Patrick Fic
2020-06-24 11:20:27 -07:00
parent 73ff905b58
commit 997ea6cbcf
8 changed files with 148 additions and 52 deletions

View File

@@ -3,11 +3,12 @@ import axios from "axios";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { auth } from "../../firebase/firebase.utils";
import { DateFormatter } from "../../utils/DateFormatter";
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component";
import EmailInput from "../form-items-formatted/email-form-item.component";
import ScheduleDayViewContainer from "../schedule-day-view/schedule-day-view.container";
import ScheduleExistingAppointmentsList from "../schedule-existing-appointments-list/schedule-existing-appointments-list.component";
import { DateTimeFormatter } from "../../utils/DateFormatter";
import moment from "moment";
export default function ScheduleJobModalComponent({
existingAppointments,
@@ -41,7 +42,7 @@ export default function ScheduleJobModalComponent({
return (
<Row gutter={[32, 32]}>
<Col span={14}>
<div className='imex-flex-row imex-flex-row__flex-space-around'>
<div className="imex-flex-row imex-flex-row__flex-space-around">
<strong>{t("appointments.fields.time")}</strong>
<DateTimePicker
value={appData.start}
@@ -53,15 +54,20 @@ export default function ScheduleJobModalComponent({
{t("appointments.actions.smartscheduling")}
</Button>
</div>
<div className='imex-flex-row imex-flex-row__flex-space-around'>
<div className="imex-flex-row imex-flex-row__flex-space-around">
{appData.smartDates.map((d, idx) => (
<Button
className='imex-flex-row__margin'
className="imex-flex-row__margin"
key={idx}
onClick={() => {
setAppData({ ...appData, start: d });
}}>
<DateTimeFormatter>{d}</DateTimeFormatter>
console.log("new Date(d)", new Date(d));
setAppData({
...appData,
start: new moment(d).add(8, "hours"),
});
}}
>
<DateFormatter>{d}</DateFormatter>
</Button>
))}
</div>
@@ -75,7 +81,8 @@ export default function ScheduleJobModalComponent({
defaultChecked={appData.notifyCustomer}
onChange={(e) =>
setAppData({ ...appData, notifyCustomer: e.target.checked })
}>
}
>
{t("jobs.labels.appointmentconfirmation")}
</Checkbox>
<EmailInput

View File

@@ -53,7 +53,7 @@ export function ScheduleJobModalContainer({
start: null,
smartDates: [],
});
}, [job, , setAppData]);
}, [job, setAppData]);
const { t } = useTranslation();
@@ -158,7 +158,8 @@ export function ScheduleJobModalContainer({
okButtonProps={{
disabled: appData.start ? false : true,
loading: loading,
}}>
}}
>
<ScheduleJobModalComponent
existingAppointments={existingAppointments}
appData={appData}