IO-1642 Resolve delivery checklist not including dates.

This commit is contained in:
Patrick Fic
2022-01-17 12:35:43 -08:00
parent e2941bfe84
commit 34ae2c56b7
4 changed files with 28 additions and 21 deletions

View File

@@ -171,7 +171,12 @@ export function JobChecklistForm({
}); });
} }
}; };
console.log(job,{
removeFromProduction: true,
actual_completion:
job && job.actual_completion && moment(job.actual_completion),
actual_delivery: job && job.actual_delivery && moment(job.actual_delivery),
});
return ( return (
<Card <Card
title={t("checklist.labels.checklist")} title={t("checklist.labels.checklist")}
@@ -195,21 +200,26 @@ export function JobChecklistForm({
addToProduction: true, addToProduction: true,
allow_text_message: job.owner && job.owner.allow_text_message, allow_text_message: job.owner && job.owner.allow_text_message,
scheduled_completion: scheduled_completion:
(job && job.scheduled_completion) || (job &&
(job.labbrs && job.larhrs job.scheduled_completion &&
? moment().businessAdd( moment(job.scheduled_completion)) ||
(job.labhrs.aggregate.sum.mod_lb_hrs + (job &&
job.larhrs.aggregate.sum.mod_lb_hrs) / job.labhrs &&
bodyshop.target_touchtime, job.larhrs &&
"days" moment().businessAdd(
) (job.labhrs.aggregate.sum.mod_lb_hrs ||
: null), 0 + job.larhrs.aggregate.sum.mod_lb_hrs ||
scheduled_delivery: job && job.scheduled_delivery, 0) / bodyshop.target_touchtime,
"days"
)),
scheduled_delivery: job && moment(job.scheduled_delivery),
}), }),
...(type === "deliver" && { ...(type === "deliver" && {
removeFromProduction: true, removeFromProduction: true,
actual_completion: job && job.actual_completion, actual_completion:
actual_delivery: job && job.actual_delivery, job && job.actual_completion && moment(job.actual_completion),
actual_delivery:
job && job.actual_delivery && moment(job.actual_delivery),
}), }),
...formItems ...formItems
.filter((fi) => fi.value) .filter((fi) => fi.value)

View File

@@ -8,9 +8,6 @@ import { DateFormatter } from "../../utils/DateFormatter";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
const OneCalendarDay = 60 * 60 * 24 * 1000;
const Now = new Date();
export default function ProductionListDate({ record, field, time }) { export default function ProductionListDate({ record, field, time }) {
const [updateAlert] = useMutation(UPDATE_JOB); const [updateAlert] = useMutation(UPDATE_JOB);
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
@@ -78,11 +75,7 @@ export default function ProductionListDate({ record, field, time }) {
: "" : ""
} }
> >
<DateFormatter <DateFormatter bordered={false}>{record[field]}</DateFormatter>
bordered={false}
>
{record[field]}
</DateFormatter>
</div> </div>
</Dropdown> </Dropdown>
</div> </div>

View File

@@ -262,6 +262,9 @@ export const QUERY_DELIVER_CHECKLIST = gql`
jobs_by_pk(id: $jobId) { jobs_by_pk(id: $jobId) {
id id
ro_number ro_number
actual_completion
actual_delivery
} }
} }
`; `;

View File

@@ -69,6 +69,7 @@ export function JobsDeliverContainer({
checklistConfig={ checklistConfig={
(data && data.bodyshops_by_pk.deliverchecklist) || {} (data && data.bodyshops_by_pk.deliverchecklist) || {}
} }
job={data ? data.jobs_by_pk : {}}
/> />
</div> </div>
</RbacWrapper> </RbacWrapper>