IO-3164 Schedule Completion Business Days
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
This commit is contained in:
@@ -44,18 +44,16 @@ export function JobsDetailHeaderActionsToggleProduction({
|
||||
variables: { id: job.id },
|
||||
onCompleted: (data) => {
|
||||
if (data?.jobs_by_pk) {
|
||||
const totalHours =
|
||||
(data.jobs_by_pk.labhrs?.aggregate?.sum?.mod_lb_hrs || 0) +
|
||||
(data.jobs_by_pk.larhrs?.aggregate?.sum?.mod_lb_hrs || 0);
|
||||
form.setFieldsValue({
|
||||
actual_in: data.jobs_by_pk.actual_in ? data.jobs_by_pk.actual_in : dayjs(),
|
||||
scheduled_completion: data.jobs_by_pk.scheduled_completion
|
||||
? data.jobs_by_pk.scheduled_completion
|
||||
: data.jobs_by_pk.labhrs &&
|
||||
data.jobs_by_pk.larhrs &&
|
||||
dayjs().businessDaysAdd(
|
||||
(data.jobs_by_pk.labhrs.aggregate.sum.mod_lb_hrs ||
|
||||
0 + data.jobs_by_pk.larhrs.aggregate.sum.mod_lb_hrs ||
|
||||
0) / bodyshop.target_touchtime,
|
||||
"day"
|
||||
),
|
||||
: totalHours && bodyshop.ss_configuration.nobusinessdays
|
||||
? dayjs().businessDaysAdd(totalHours / (bodyshop.target_touchtime || 1), "day")
|
||||
: dayjs().add(totalHours / (bodyshop.target_touchtime || 1), "day"),
|
||||
actual_completion: data.jobs_by_pk.actual_completion,
|
||||
scheduled_delivery: data.jobs_by_pk.scheduled_delivery,
|
||||
actual_delivery: data.jobs_by_pk.actual_delivery
|
||||
|
||||
Reference in New Issue
Block a user