From 563c1d24022e85151d455b466ff7fccfbc104025 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 3 Feb 2023 11:48:07 -0800 Subject: [PATCH] IO-2162 Resolve smart scheduling issues. --- .../schedule-job-modal.component.jsx | 6 ++++++ .../schedule-job-modal/schedule-job-modal.scss | 1 + client/src/redux/application/application.sagas.js | 12 ++++++++++++ 3 files changed, 19 insertions(+) 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 121291c89..2afb79bc4 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 @@ -15,6 +15,7 @@ import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; +import { calculateScheduleLoad } from "../../redux/application/application.actions"; import { selectBodyshop } from "../../redux/user/user.selectors"; import { DateFormatter } from "../../utils/DateFormatter"; import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component"; @@ -28,6 +29,7 @@ const mapStateToProps = createStructuredSelector({ }); const mapDispatchToProps = (dispatch) => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) + calculateScheduleLoad: (endDate) => dispatch(calculateScheduleLoad(endDate)), }); export function ScheduleJobModalComponent({ @@ -36,6 +38,7 @@ export function ScheduleJobModalComponent({ existingAppointments, lbrHrsData, jobId, + calculateScheduleLoad, }) { const { t } = useTranslation(); const [loading, setLoading] = useState(false); @@ -57,6 +60,9 @@ export function ScheduleJobModalComponent({ const handleDateBlur = () => { const values = form.getFieldsValue(); + if (values.start) { + calculateScheduleLoad(values.start); + } if (lbrHrsData) { const totalHours = lbrHrsData.jobs_by_pk.labhrs.aggregate.sum.mod_lb_hrs + diff --git a/client/src/components/schedule-job-modal/schedule-job-modal.scss b/client/src/components/schedule-job-modal/schedule-job-modal.scss index 40c831662..6c2c42694 100644 --- a/client/src/components/schedule-job-modal/schedule-job-modal.scss +++ b/client/src/components/schedule-job-modal/schedule-job-modal.scss @@ -1,5 +1,6 @@ .schedule-job-modal { height: 70vh; + overflow-y: auto; .rbc-calendar { .rbc-toolbar { .rbc-btn-group { diff --git a/client/src/redux/application/application.sagas.js b/client/src/redux/application/application.sagas.js index 8a9a4d588..02e86c6cc 100644 --- a/client/src/redux/application/application.sagas.js +++ b/client/src/redux/application/application.sagas.js @@ -92,6 +92,18 @@ export function* calculateScheduleLoad({ payload: end }) { code: "Job has no scheduled in date", }); } + if(!item.actual_completion && item.actual_in && !item.inproduction){ + problemJobs.push({ + ...item, + code: "Job has an actual in date, but no actual completion date and is not marked as in production", + }); + } + if (item.actual_in && moment(item.actual_in).isAfter(moment())) { + problemJobs.push({ + ...item, + code: "Job has an actual in date set in the future", + }); + } if ( item.actual_completion && moment(item.actual_completion).isAfter(moment())