IO-1148 Prefill scheduled completion on intake if not present.

This commit is contained in:
Patrick Fic
2021-05-25 14:58:50 -07:00
parent c9812c36c0
commit 73b0542b62
3 changed files with 32 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ import {
} from "../../../../redux/user/user.selectors";
import ConfigFormComponents from "../../../config-form-components/config-form-components.component";
import DateTimePicker from "../../../form-date-time-picker/form-date-time-picker.component";
import moment from "moment-business-days";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
@@ -133,7 +134,14 @@ export function JobChecklistForm({
initialValues={{
...(type === "intake" && {
addToProduction: true,
scheduled_completion: job && job.scheduled_completion,
scheduled_completion:
(job && job.scheduled_completion) ||
moment().businessAdd(
(job.labhrs.aggregate.sum.mod_lb_hrs +
job.larhrs.aggregate.sum.mod_lb_hrs) /
bodyshop.target_touchtime,
"days"
),
scheduled_delivery: job && job.scheduled_delivery,
}),
...(type === "deliver" && {

View File

@@ -173,6 +173,7 @@ function JobsDocumentsComponent({
backgroundImage: <FileExcelFilled />,
height: "100%",
width: "100%",
cursor: "pointer",
};
}}
onClickThumbnail={(index) => {

View File

@@ -197,6 +197,28 @@ export const QUERY_INTAKE_CHECKLIST = gql`
scheduled_delivery
intakechecklist
status
labhrs: joblines_aggregate(
where: {
_and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }]
}
) {
aggregate {
sum {
mod_lb_hrs
}
}
}
larhrs: joblines_aggregate(
where: {
_and: [{ mod_lbr_ty: { _eq: "LAR" } }, { removed: { _eq: false } }]
}
) {
aggregate {
sum {
mod_lb_hrs
}
}
}
}
}
`;