Baseline adding a job to the schedule.
This commit is contained in:
@@ -18,9 +18,11 @@ export default function JobsDetailHeader({
|
||||
job,
|
||||
mutationConvertJob,
|
||||
refetch,
|
||||
handleSubmit
|
||||
handleSubmit,
|
||||
scheduleModalState
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [scheduleModalVisible, setscheduleModalVisible] = scheduleModalState;
|
||||
|
||||
const tombstoneTitle = (
|
||||
<div>
|
||||
@@ -58,6 +60,15 @@ export default function JobsDetailHeader({
|
||||
);
|
||||
|
||||
const menuExtra = [
|
||||
<Button
|
||||
key="schedule"
|
||||
//TODO: Enabled logic based on status.
|
||||
onClick={() => {
|
||||
setscheduleModalVisible(true);
|
||||
}}
|
||||
>
|
||||
{t("jobs.actions.schedule")}
|
||||
</Button>,
|
||||
<Button
|
||||
key="convert"
|
||||
type="dashed"
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import React from "react";
|
||||
import { Modal, Tabs, DatePicker, TimePicker } from "antd";
|
||||
import moment from "moment";
|
||||
export default function ScheduleJobModalComponent({
|
||||
appData,
|
||||
setAppData,
|
||||
...props
|
||||
}) {
|
||||
return (
|
||||
<Modal {...props} maskClosable={false}>
|
||||
<Tabs defaultActiveKey="1">
|
||||
<Tabs.TabPane tab="SMART Scheduling" key="auto">
|
||||
Automatic Job Selection.
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane tab="Manual Scheduling" key="manual">
|
||||
Manual Job Selection Scheduled Time
|
||||
<DatePicker
|
||||
value={appData.start}
|
||||
onChange={e => {
|
||||
setAppData({ ...appData, start: e });
|
||||
}}
|
||||
/>
|
||||
<TimePicker
|
||||
value={appData.start}
|
||||
format={"HH:mm"}
|
||||
minuteStep={15}
|
||||
onChange={e => {
|
||||
setAppData({ ...appData, start: e });
|
||||
}}
|
||||
/>
|
||||
</Tabs.TabPane>
|
||||
</Tabs>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
@@ -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);
|
||||
});
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user