Baseline adding a job to the schedule.

This commit is contained in:
Patrick Fic
2020-02-05 15:08:47 -08:00
parent 0714eb21a5
commit 1a14fb8da6
12 changed files with 149 additions and 6 deletions

View File

@@ -0,0 +1,34 @@
import React, { useState } from "react";
import ScheduleJobModalComponent from "./schedule-job-modal.component";
import { useMutation } from "react-apollo";
import { INSERT_APPOINTMENT } from "../../graphql/appointments.queries";
import moment from "moment";
export default function ScheduleJobModalContainer({
scheduleModalState,
jobId
}) {
const [scheduleModalVisible, setscheduleModalVisible] = scheduleModalState;
const [appData, setAppData] = useState({ jobid: jobId, start: null });
const [insertAppointment] = useMutation(INSERT_APPOINTMENT);
return (
<ScheduleJobModalComponent
appData={appData}
setAppData={setAppData}
//Spreadable Modal Props
visible={scheduleModalVisible}
onCancel={() => setscheduleModalVisible(false)}
onOk={() => {
//TODO: Customize the amount of minutes it will add.
insertAppointment({
variables: {
app: { ...appData, end: moment(appData.start).add(60, "minutes") }
}
}).then(r => {
setscheduleModalVisible(false);
});
}}
/>
);
}