Baseline adding a job to the schedule.
This commit is contained in:
@@ -834,6 +834,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>schedule</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -25,3 +25,13 @@ export const QUERY_ALL_APPOINTMENTS = gql`
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const INSERT_APPOINTMENT = gql`
|
||||
mutation INSERT_APPOINTMENT($app: [appointments_insert_input!]!) {
|
||||
insert_appointments(objects: $app) {
|
||||
returning {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -16,13 +16,15 @@ import JobsDocumentsContainer from "../../components/jobs-documents/jobs-documen
|
||||
import JobNotesContainer from "../../components/jobs-notes/jobs-notes.container";
|
||||
import JobDetailFormContext from "./jobs-detail.page.context";
|
||||
import JobsDetailDatesComponent from "../../components/jobs-detail-dates/jobs-detail-dates.component";
|
||||
import ScheduleJobModalContainer from "../../components/schedule-job-modal/schedule-job-modal.container";
|
||||
|
||||
export default function JobsDetailPage({
|
||||
job,
|
||||
mutationUpdateJob,
|
||||
mutationConvertJob,
|
||||
handleSubmit,
|
||||
refetch
|
||||
refetch,
|
||||
scheduleModalState
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -41,12 +43,18 @@ export default function JobsDetailPage({
|
||||
|
||||
return (
|
||||
<div>
|
||||
<ScheduleJobModalContainer
|
||||
scheduleModalState={scheduleModalState}
|
||||
jobId={job.id}
|
||||
/>
|
||||
|
||||
<Form onSubmit={handleSubmit} {...formItemLayout} autoComplete={"off"}>
|
||||
<JobsDetailHeader
|
||||
job={job}
|
||||
mutationConvertJob={mutationConvertJob}
|
||||
refetch={refetch}
|
||||
handleSubmit={handleSubmit}
|
||||
scheduleModalState={scheduleModalState}
|
||||
/>
|
||||
|
||||
{isFieldsTouched() ? (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Form, notification } from "antd";
|
||||
import React, { useEffect } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useMutation, useQuery } from "react-apollo";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import AlertComponent from "../../components/alert/alert.component";
|
||||
@@ -16,6 +16,8 @@ function JobsDetailPageContainer({ match, form }) {
|
||||
const { jobId } = match.params;
|
||||
const { t } = useTranslation();
|
||||
|
||||
const scheduleModalState = useState(false);
|
||||
|
||||
const { loading, error, data, refetch } = useQuery(GET_JOB_BY_PK, {
|
||||
variables: { id: jobId },
|
||||
fetchPolicy: "network-only"
|
||||
@@ -71,6 +73,7 @@ function JobsDetailPageContainer({ match, form }) {
|
||||
handleSubmit={handleSubmit}
|
||||
getFieldDecorator={form.getFieldDecorator}
|
||||
refetch={refetch}
|
||||
scheduleModalState={scheduleModalState}
|
||||
/>
|
||||
</JobDetailFormContext.Provider>
|
||||
) : (
|
||||
|
||||
@@ -66,7 +66,8 @@
|
||||
"addNote": "Add Note",
|
||||
"convert": "Convert",
|
||||
"postInvoices": "Post Invoices",
|
||||
"printCenter": "Print Center"
|
||||
"printCenter": "Print Center",
|
||||
"schedule": "Schedule"
|
||||
},
|
||||
"errors": {
|
||||
"creating": "Error encountered while creating job. {{error}}",
|
||||
|
||||
@@ -66,7 +66,8 @@
|
||||
"addNote": "Añadir la nota",
|
||||
"convert": "Convertir",
|
||||
"postInvoices": "Contabilizar facturas",
|
||||
"printCenter": "Centro de impresión"
|
||||
"printCenter": "Centro de impresión",
|
||||
"schedule": "Programar"
|
||||
},
|
||||
"errors": {
|
||||
"creating": "",
|
||||
|
||||
@@ -66,7 +66,8 @@
|
||||
"addNote": "Ajouter une note",
|
||||
"convert": "Convertir",
|
||||
"postInvoices": "Poster des factures",
|
||||
"printCenter": "Centre d'impression"
|
||||
"printCenter": "Centre d'impression",
|
||||
"schedule": "Programme"
|
||||
},
|
||||
"errors": {
|
||||
"creating": "",
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
role: anonymous
|
||||
table:
|
||||
name: users
|
||||
schema: public
|
||||
type: drop_select_permission
|
||||
@@ -0,0 +1,12 @@
|
||||
- args:
|
||||
permission:
|
||||
allow_aggregations: false
|
||||
columns:
|
||||
- authid
|
||||
filter: {}
|
||||
limit: null
|
||||
role: anonymous
|
||||
table:
|
||||
name: users
|
||||
schema: public
|
||||
type: create_select_permission
|
||||
Reference in New Issue
Block a user