diff --git a/client/src/components/schedule-block-day/schedule-block-day.component.jsx b/client/src/components/schedule-block-day/schedule-block-day.component.jsx index 67d15bf80..ddfc76f85 100644 --- a/client/src/components/schedule-block-day/schedule-block-day.component.jsx +++ b/client/src/components/schedule-block-day/schedule-block-day.component.jsx @@ -5,7 +5,7 @@ import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; -import { INSERT_APPOINTMENT } from "../../graphql/appointments.queries"; +import { INSERT_APPOINTMENT_BLOCK } from "../../graphql/appointments.queries"; import { selectBodyshop } from "../../redux/user/user.selectors"; import { logImEXEvent } from "../../firebase/firebase.utils"; @@ -17,7 +17,7 @@ const mapDispatchToProps = (dispatch) => ({}); export function ScheduleBlockDay({ date, children, refetch, bodyshop }) { const { t } = useTranslation(); - const [insertBlock] = useMutation(INSERT_APPOINTMENT); + const [insertBlock] = useMutation(INSERT_APPOINTMENT_BLOCK); const handleMenu = async (e) => { e.domEvent.stopPropagation(); diff --git a/client/src/components/schedule-job-modal/schedule-job-modal.component.jsx b/client/src/components/schedule-job-modal/schedule-job-modal.component.jsx index 647add47e..41106603a 100644 --- a/client/src/components/schedule-job-modal/schedule-job-modal.component.jsx +++ b/client/src/components/schedule-job-modal/schedule-job-modal.component.jsx @@ -1,4 +1,4 @@ -import { Button, Col, Form, Row, Select, Switch, Card } from "antd"; +import { Button, Card, Col, Form, Row, Select, Switch } from "antd"; import axios from "axios"; import moment from "moment"; import React, { useState } from "react"; @@ -124,8 +124,12 @@ export function ScheduleJobModalComponent({ > - - + + {() => ( + + + + )} diff --git a/client/src/graphql/appointments.queries.js b/client/src/graphql/appointments.queries.js index 100d9fcaa..c16c652bc 100644 --- a/client/src/graphql/appointments.queries.js +++ b/client/src/graphql/appointments.queries.js @@ -54,6 +54,25 @@ export const QUERY_ALL_ACTIVE_APPOINTMENTS = gql` } `; + +export const INSERT_APPOINTMENT_BLOCK = gql` + mutation INSERT_APPOINTMENT_BLOCK( + $app: [appointments_insert_input!]! + ) { + insert_appointments(objects: $app) { + returning { + id + start + end + arrived + title + isintake + block + } + } + } +`; + export const INSERT_APPOINTMENT = gql` mutation INSERT_APPOINTMENT( $app: [appointments_insert_input!]! diff --git a/server/scheduling/scheduling-job.js b/server/scheduling/scheduling-job.js index 1bb8e9461..aedf11473 100644 --- a/server/scheduling/scheduling-job.js +++ b/server/scheduling/scheduling-job.js @@ -102,17 +102,17 @@ exports.job = async (req, res) => { (bucket) => bucket.gte <= jobHrs && (!!bucket.lt ? bucket.lt > jobHrs : true) )[0]; - console.log(pjobBucket.id, JobBucket.id, pjobBucket.id === JobBucket.id); if (pjobBucket.id === JobBucket.id) { //Theyre the same classification. Add it to the matrix. const compDate = moment(pjob.scheduled_completion); //Is the schedule completion behind today? If so, use today as it. let dateToUse; dateToUse = compDate.isValid() - ? moment().diff(compDate, "days") <= 0 + ? moment().diff(compDate, "days") < 0 ? compDate.format("yyyy-MM-DD") : todayIsoString : todayIsoString; + bucketMatrix[dateToUse] = { ...bucketMatrix[dateToUse], out: (bucketMatrix[dateToUse].out || 0) + 1,