WIP Transfer.
This commit is contained in:
@@ -45,6 +45,23 @@ export function ScheduleJobModalComponent({
|
||||
}
|
||||
};
|
||||
|
||||
const handleDateBlur = () => {
|
||||
const values = form.getFieldsValue();
|
||||
if (lbrHrsData) {
|
||||
const totalHours =
|
||||
lbrHrsData.jobs_by_pk.labhrs.aggregate.sum.mod_lb_hrs +
|
||||
lbrHrsData.jobs_by_pk.larhrs.aggregate.sum.mod_lb_hrs;
|
||||
|
||||
if (values.start && !values.scheduled_completion)
|
||||
form.setFieldsValue({
|
||||
scheduled_completion: moment(values.start).businessAdd(
|
||||
totalHours / bodyshop.target_touchtime,
|
||||
"days"
|
||||
),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//TODO Existing appointments list only refreshes sometimes after modal close. May have to do with the container class.
|
||||
return (
|
||||
<Row gutter={[32, 32]}>
|
||||
@@ -60,24 +77,7 @@ export function ScheduleJobModalComponent({
|
||||
},
|
||||
]}
|
||||
>
|
||||
<DateTimePicker
|
||||
onBlur={() => {
|
||||
const values = form.getFieldsValue();
|
||||
if (lbrHrsData) {
|
||||
const totalHours =
|
||||
lbrHrsData.jobs_by_pk.labhrs.aggregate.sum.mod_lb_hrs +
|
||||
lbrHrsData.jobs_by_pk.larhrs.aggregate.sum.mod_lb_hrs;
|
||||
|
||||
if (values.start && !values.scheduled_completion)
|
||||
form.setFieldsValue({
|
||||
scheduled_completion: moment(values.start).businessAdd(
|
||||
totalHours / bodyshop.target_touchtime,
|
||||
"days"
|
||||
),
|
||||
});
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<DateTimePicker onBlur={handleDateBlur} />
|
||||
</Form.Item>
|
||||
<Button onClick={handleAuto} loading={loading}>
|
||||
{t("appointments.actions.smartscheduling")}
|
||||
@@ -89,6 +89,7 @@ export function ScheduleJobModalComponent({
|
||||
key={idx}
|
||||
onClick={() => {
|
||||
form.setFieldsValue({ start: new moment(d).add(8, "hours") });
|
||||
handleDateBlur();
|
||||
}}
|
||||
>
|
||||
<DateFormatter>{d}</DateFormatter>
|
||||
|
||||
Reference in New Issue
Block a user