Added predictive completion time based on cycle times for job scheduling. BOD-401
This commit is contained in:
@@ -3873,6 +3873,27 @@
|
|||||||
</concept_node>
|
</concept_node>
|
||||||
</children>
|
</children>
|
||||||
</folder_node>
|
</folder_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>target_touchtime</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>zip_post</name>
|
<name>zip_post</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ const FormDatePicker = ({ value, onChange, onBlur, ...restProps }, ref) => {
|
|||||||
value={value ? moment(value) : null}
|
value={value ? moment(value) : null}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
format={dateFormat}
|
format={dateFormat}
|
||||||
|
onBlur={onBlur}
|
||||||
{...restProps}
|
{...restProps}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,13 +15,14 @@ const DateTimePicker = ({ value, onChange, onBlur }, ref) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<FormDatePicker value={value} onChange={onChange} />
|
<FormDatePicker value={value} onBlur={onBlur} onChange={onChange} />
|
||||||
|
|
||||||
<TimePicker
|
<TimePicker
|
||||||
value={value ? moment(value) : null}
|
value={value ? moment(value) : null}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
showSecond={false}
|
showSecond={false}
|
||||||
minuteStep={15}
|
minuteStep={15}
|
||||||
|
onBlur={onBlur}
|
||||||
format="hh:mm a"
|
format="hh:mm a"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,29 +1,43 @@
|
|||||||
import { Button, Checkbox, Col, Row } from "antd";
|
import { Button, Col, Form, Row, Switch } from "antd";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import { DateFormatter } from "../../utils/DateFormatter";
|
import { DateFormatter } from "../../utils/DateFormatter";
|
||||||
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component";
|
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component";
|
||||||
import EmailInput from "../form-items-formatted/email-form-item.component";
|
import EmailInput from "../form-items-formatted/email-form-item.component";
|
||||||
|
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||||
import ScheduleDayViewContainer from "../schedule-day-view/schedule-day-view.container";
|
import ScheduleDayViewContainer from "../schedule-day-view/schedule-day-view.container";
|
||||||
import ScheduleExistingAppointmentsList from "../schedule-existing-appointments-list/schedule-existing-appointments-list.component";
|
import ScheduleExistingAppointmentsList from "../schedule-existing-appointments-list/schedule-existing-appointments-list.component";
|
||||||
|
|
||||||
export default function ScheduleJobModalComponent({
|
const mapStateToProps = createStructuredSelector({
|
||||||
jobId,
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
|
||||||
|
export function ScheduleJobModalComponent({
|
||||||
|
bodyshop,
|
||||||
|
form,
|
||||||
existingAppointments,
|
existingAppointments,
|
||||||
appData,
|
lbrHrsData,
|
||||||
setAppData,
|
jobId,
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [smartOptions, setSmartOptions] = useState([]);
|
||||||
|
|
||||||
const handleAuto = async () => {
|
const handleAuto = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const response = await axios.post("/scheduling/job", {
|
const response = await axios.post("/scheduling/job", {
|
||||||
jobId: "661dd1d5-bf06-426f-8bd2-bd9e41de8eb1",
|
jobId: jobId,
|
||||||
});
|
});
|
||||||
setAppData({ ...appData, smartDates: response.data });
|
if (response.data) setSmartOptions(response.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("error", error, error.message);
|
console.log("error", error, error.message);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -34,60 +48,100 @@ export default function ScheduleJobModalComponent({
|
|||||||
//TODO Existing appointments list only refreshes sometimes after modal close. May have to do with the container class.
|
//TODO Existing appointments list only refreshes sometimes after modal close. May have to do with the container class.
|
||||||
return (
|
return (
|
||||||
<Row gutter={[32, 32]}>
|
<Row gutter={[32, 32]}>
|
||||||
<Col span={14}>
|
<Col span={12}>
|
||||||
<div className="imex-flex-row imex-flex-row__flex-space-around">
|
<LayoutFormRow grow>
|
||||||
<strong>{t("appointments.fields.time")}</strong>
|
<Form.Item
|
||||||
<DateTimePicker
|
name={"start"}
|
||||||
value={appData.start}
|
label={t("appointments.fields.time")}
|
||||||
onChange={(e) => {
|
rules={[
|
||||||
setAppData({ ...appData, start: e });
|
{
|
||||||
}}
|
required: true,
|
||||||
/>
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<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"
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
<Button onClick={handleAuto} loading={loading}>
|
<Button onClick={handleAuto} loading={loading}>
|
||||||
{t("appointments.actions.smartscheduling")}
|
{t("appointments.actions.smartscheduling")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
<div className="imex-flex-row imex-flex-row__flex-space-around">
|
||||||
<div className="imex-flex-row imex-flex-row__flex-space-around">
|
{smartOptions.map((d, idx) => (
|
||||||
{appData.smartDates.map((d, idx) => (
|
<Button
|
||||||
<Button
|
className="imex-flex-row__margin"
|
||||||
className="imex-flex-row__margin"
|
key={idx}
|
||||||
key={idx}
|
onClick={() => {
|
||||||
onClick={() => {
|
form.setFieldsValue({ start: new moment(d).add(8, "hours") });
|
||||||
setAppData({
|
}}
|
||||||
...appData,
|
>
|
||||||
start: new moment(d).add(8, "hours"),
|
<DateFormatter>{d}</DateFormatter>
|
||||||
});
|
</Button>
|
||||||
}}
|
))}
|
||||||
>
|
</div>
|
||||||
<DateFormatter>{d}</DateFormatter>
|
</LayoutFormRow>
|
||||||
</Button>
|
<LayoutFormRow grow>
|
||||||
))}
|
<Form.Item
|
||||||
</div>
|
name={"scheduled_completion"}
|
||||||
|
label={t("jobs.fields.scheduled_completion")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<DateTimePicker />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name={"notifyCustomer"}
|
||||||
|
valuePropName="checked"
|
||||||
|
label={t("jobs.labels.appointmentconfirmation")}
|
||||||
|
>
|
||||||
|
<Switch />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name={"email"} label={t("jobs.fields.ownr_ea")}>
|
||||||
|
<EmailInput />
|
||||||
|
</Form.Item>
|
||||||
|
</LayoutFormRow>
|
||||||
{t("appointments.labels.history")}
|
{t("appointments.labels.history")}
|
||||||
<ScheduleExistingAppointmentsList
|
<ScheduleExistingAppointmentsList
|
||||||
existingAppointments={existingAppointments}
|
existingAppointments={existingAppointments}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Checkbox
|
|
||||||
defaultChecked={appData.notifyCustomer}
|
|
||||||
onChange={(e) =>
|
|
||||||
setAppData({ ...appData, notifyCustomer: e.target.checked })
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t("jobs.labels.appointmentconfirmation")}
|
|
||||||
</Checkbox>
|
|
||||||
<EmailInput
|
|
||||||
defaultValue={appData.email}
|
|
||||||
title={t("owner.fields.ownr_ea")}
|
|
||||||
onChange={(e) => setAppData({ ...appData, email: e.target.value })}
|
|
||||||
/>
|
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={10}>
|
<Col span={12}>
|
||||||
<div style={{ height: "70vh" }}>
|
<Form.Item shouldUpdate>
|
||||||
<ScheduleDayViewContainer day={appData.start} />
|
{() => {
|
||||||
</div>
|
const values = form.getFieldsValue();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ height: "70vh" }}>
|
||||||
|
<ScheduleDayViewContainer day={values.start} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(ScheduleJobModalComponent);
|
||||||
|
|||||||
@@ -1,23 +1,24 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
|
||||||
import ScheduleJobModalComponent from "./schedule-job-modal.component";
|
|
||||||
import { useMutation, useQuery } from "@apollo/react-hooks";
|
import { useMutation, useQuery } from "@apollo/react-hooks";
|
||||||
import {
|
//import moment from "moment";
|
||||||
INSERT_APPOINTMENT,
|
import { Form, Modal, notification } from "antd";
|
||||||
CANCEL_APPOINTMENT_BY_ID,
|
import moment from "moment-business-days";
|
||||||
QUERY_APPOINTMENTS_BY_JOBID,
|
import React, { useEffect, useState } from "react";
|
||||||
} from "../../graphql/appointments.queries";
|
|
||||||
import moment from "moment";
|
|
||||||
import { notification, Modal } from "antd";
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { UPDATE_JOBS } from "../../graphql/jobs.queries";
|
|
||||||
import { setEmailOptions } from "../../redux/email/email.actions";
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
|
||||||
import { selectSchedule } from "../../redux/modals/modals.selectors";
|
|
||||||
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
|
||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
|
import {
|
||||||
|
CANCEL_APPOINTMENT_BY_ID,
|
||||||
|
INSERT_APPOINTMENT,
|
||||||
|
QUERY_APPOINTMENTS_BY_JOBID,
|
||||||
|
} from "../../graphql/appointments.queries";
|
||||||
|
import { QUERY_LBR_HRS_BY_PK, UPDATE_JOBS } from "../../graphql/jobs.queries";
|
||||||
|
import { setEmailOptions } from "../../redux/email/email.actions";
|
||||||
|
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
||||||
|
import { selectSchedule } from "../../redux/modals/modals.selectors";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
|
import ScheduleJobModalComponent from "./schedule-job-modal.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -36,26 +37,23 @@ export function ScheduleJobModalContainer({
|
|||||||
}) {
|
}) {
|
||||||
const { visible, context, actions } = scheduleModal;
|
const { visible, context, actions } = scheduleModal;
|
||||||
const { jobId, job, previousEvent } = context;
|
const { jobId, job, previousEvent } = context;
|
||||||
|
|
||||||
const { refetch } = actions;
|
const { refetch } = actions;
|
||||||
const [loading, setLoading] = useState(false);
|
const [form] = Form.useForm();
|
||||||
const [appData, setAppData] = useState({
|
|
||||||
notifyCustomer: !!(job && job.ownr_ea),
|
const { data: lbrHrsData } = useQuery(QUERY_LBR_HRS_BY_PK, {
|
||||||
email: (job && job.ownr_ea) || "",
|
variables: { id: job && job.id },
|
||||||
start: null,
|
skip: !job || !job.id,
|
||||||
smartDates: [],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
const [cancelAppointment] = useMutation(CANCEL_APPOINTMENT_BY_ID);
|
const [cancelAppointment] = useMutation(CANCEL_APPOINTMENT_BY_ID);
|
||||||
const [insertAppointment] = useMutation(INSERT_APPOINTMENT);
|
const [insertAppointment] = useMutation(INSERT_APPOINTMENT);
|
||||||
const [updateJobStatus] = useMutation(UPDATE_JOBS);
|
const [updateJobStatus] = useMutation(UPDATE_JOBS);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setAppData({
|
form.resetFields();
|
||||||
notifyCustomer: !!(job && job.ownr_ea),
|
}, [job, form]);
|
||||||
email: (job && job.ownr_ea) || "",
|
|
||||||
start: null,
|
|
||||||
smartDates: [],
|
|
||||||
});
|
|
||||||
}, [job, setAppData]);
|
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@@ -65,7 +63,7 @@ export function ScheduleJobModalContainer({
|
|||||||
skip: !visible || !!!jobId,
|
skip: !visible || !!!jobId,
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleOk = async () => {
|
const handleFinish = async (values) => {
|
||||||
logImEXEvent("schedule_new_appointment");
|
logImEXEvent("schedule_new_appointment");
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@@ -90,11 +88,10 @@ export function ScheduleJobModalContainer({
|
|||||||
const appt = await insertAppointment({
|
const appt = await insertAppointment({
|
||||||
variables: {
|
variables: {
|
||||||
app: {
|
app: {
|
||||||
//...appData,
|
|
||||||
jobid: jobId,
|
jobid: jobId,
|
||||||
bodyshopid: bodyshop.id,
|
bodyshopid: bodyshop.id,
|
||||||
start: moment(appData.start),
|
start: moment(values.start),
|
||||||
end: moment(appData.start).add(bodyshop.appt_length || 60, "minutes"),
|
end: moment(values.start).add(bodyshop.appt_length || 60, "minutes"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -117,7 +114,8 @@ export function ScheduleJobModalContainer({
|
|||||||
fields: {
|
fields: {
|
||||||
status: bodyshop.md_ro_statuses.default_scheduled,
|
status: bodyshop.md_ro_statuses.default_scheduled,
|
||||||
date_scheduled: new Date(),
|
date_scheduled: new Date(),
|
||||||
scheduled_in: appData.start,
|
scheduled_in: values.start,
|
||||||
|
scheduled_completion: values.scheduled_completion,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -133,10 +131,10 @@ export function ScheduleJobModalContainer({
|
|||||||
}
|
}
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
toggleModalVisible();
|
toggleModalVisible();
|
||||||
if (appData.notifyCustomer) {
|
if (values.notifyCustomer) {
|
||||||
setEmailOptions({
|
setEmailOptions({
|
||||||
messageOptions: {
|
messageOptions: {
|
||||||
to: [appData.email],
|
to: [values.email],
|
||||||
replyTo: bodyshop.email,
|
replyTo: bodyshop.email,
|
||||||
},
|
},
|
||||||
template: {
|
template: {
|
||||||
@@ -154,21 +152,34 @@ export function ScheduleJobModalContainer({
|
|||||||
<Modal
|
<Modal
|
||||||
visible={visible}
|
visible={visible}
|
||||||
onCancel={() => toggleModalVisible()}
|
onCancel={() => toggleModalVisible()}
|
||||||
onOk={handleOk}
|
onOk={() => form.submit()}
|
||||||
width={"90%"}
|
width={"90%"}
|
||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
|
forceRender
|
||||||
okButtonProps={{
|
okButtonProps={{
|
||||||
disabled: appData.start ? false : true,
|
|
||||||
loading: loading,
|
loading: loading,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ScheduleJobModalComponent
|
<Form
|
||||||
jobId={jobId}
|
form={form}
|
||||||
existingAppointments={existingAppointments}
|
layout="vertical"
|
||||||
appData={appData}
|
onFinish={handleFinish}
|
||||||
setAppData={setAppData}
|
initialValues={{
|
||||||
/>
|
notifyCustomer: !!(job && job.ownr_ea),
|
||||||
|
email: (job && job.ownr_ea) || "",
|
||||||
|
start: null,
|
||||||
|
// smartDates: [],
|
||||||
|
scheduled_completion: null,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ScheduleJobModalComponent
|
||||||
|
existingAppointments={existingAppointments}
|
||||||
|
lbrHrsData={lbrHrsData}
|
||||||
|
form={form}
|
||||||
|
jobId={jobId}
|
||||||
|
/>
|
||||||
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,25 +27,65 @@ export default function ShopInfoComponent({ form, saveLoading }) {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Button type="primary" loading={saveLoading} htmlType="submit">
|
<Button
|
||||||
|
type="primary"
|
||||||
|
loading={saveLoading}
|
||||||
|
onClick={() => form.submit()}
|
||||||
|
>
|
||||||
{t("general.actions.save")}
|
{t("general.actions.save")}
|
||||||
</Button>
|
</Button>
|
||||||
<Collapse>
|
<Collapse>
|
||||||
<Collapse.Panel key="shopinfo" header={t("bodyshop.labels.shopinfo")}>
|
<Collapse.Panel key="shopinfo" header={t("bodyshop.labels.shopinfo")}>
|
||||||
<LayoutFormRow>
|
<LayoutFormRow>
|
||||||
<Form.Item label={t("bodyshop.fields.shopname")} name="shopname">
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.shopname")}
|
||||||
|
name="shopname"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("bodyshop.fields.address1")} name="address1">
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.address1")}
|
||||||
|
name="address1"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("bodyshop.fields.address2")} name="address2">
|
<Form.Item label={t("bodyshop.fields.address2")} name="address2">
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("bodyshop.fields.city")} name="city">
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.city")}
|
||||||
|
name="city"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("bodyshop.fields.state")} name="state">
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.state")}
|
||||||
|
name="state"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("bodyshop.fields.zip_post")} name="zip_post">
|
<Form.Item label={t("bodyshop.fields.zip_post")} name="zip_post">
|
||||||
@@ -65,6 +105,12 @@ export default function ShopInfoComponent({ form, saveLoading }) {
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.federal_tax_id")}
|
label={t("bodyshop.fields.federal_tax_id")}
|
||||||
name="federal_tax_id"
|
name="federal_tax_id"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -91,18 +137,36 @@ export default function ShopInfoComponent({ form, saveLoading }) {
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.invoice_federal_tax_rate")}
|
label={t("bodyshop.fields.invoice_federal_tax_rate")}
|
||||||
name={["invoice_tax_rates", "federal_tax_rate"]}
|
name={["invoice_tax_rates", "federal_tax_rate"]}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.invoice_state_tax_rate")}
|
label={t("bodyshop.fields.invoice_state_tax_rate")}
|
||||||
name={["invoice_tax_rates", "state_tax_rate"]}
|
name={["invoice_tax_rates", "state_tax_rate"]}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.invoice_local_tax_rate")}
|
label={t("bodyshop.fields.invoice_local_tax_rate")}
|
||||||
name={["invoice_tax_rates", "local_tax_rate"]}
|
name={["invoice_tax_rates", "local_tax_rate"]}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -467,6 +531,18 @@ export default function ShopInfoComponent({ form, saveLoading }) {
|
|||||||
>
|
>
|
||||||
<Switch />
|
<Switch />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name={["target_touchtime"]}
|
||||||
|
label={t("bodyshop.fields.target_touchtime")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<InputNumber min={0.1} precision={1} />
|
||||||
|
</Form.Item>
|
||||||
</Collapse.Panel>
|
</Collapse.Panel>
|
||||||
<Collapse.Panel
|
<Collapse.Panel
|
||||||
key="speedprint"
|
key="speedprint"
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ export const QUERY_BODYSHOP = gql`
|
|||||||
enforce_class
|
enforce_class
|
||||||
md_labor_rates
|
md_labor_rates
|
||||||
deliverchecklist
|
deliverchecklist
|
||||||
|
target_touchtime
|
||||||
employees {
|
employees {
|
||||||
id
|
id
|
||||||
first_name
|
first_name
|
||||||
@@ -136,6 +137,7 @@ export const UPDATE_SHOP = gql`
|
|||||||
enforce_class
|
enforce_class
|
||||||
md_labor_rates
|
md_labor_rates
|
||||||
deliverchecklist
|
deliverchecklist
|
||||||
|
target_touchtime
|
||||||
employees {
|
employees {
|
||||||
id
|
id
|
||||||
first_name
|
first_name
|
||||||
|
|||||||
@@ -121,6 +121,28 @@ export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const QUERY_LBR_HRS_BY_PK = gql`
|
||||||
|
query QUERY_LBR_HRS_BY_PK($id: uuid!) {
|
||||||
|
jobs_by_pk(id: $id) {
|
||||||
|
id
|
||||||
|
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAB" } }) {
|
||||||
|
aggregate {
|
||||||
|
sum {
|
||||||
|
mod_lb_hrs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" } }) {
|
||||||
|
aggregate {
|
||||||
|
sum {
|
||||||
|
mod_lb_hrs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export const QUERY_JOB_COSTING_DETAILS = gql`
|
export const QUERY_JOB_COSTING_DETAILS = gql`
|
||||||
query QUERY_JOB_COSTING_DETAILS($id: uuid!) {
|
query QUERY_JOB_COSTING_DETAILS($id: uuid!) {
|
||||||
jobs_by_pk(id: $id) {
|
jobs_by_pk(id: $id) {
|
||||||
|
|||||||
@@ -254,6 +254,7 @@
|
|||||||
"pre_production_statuses": "Pre-Production Statuses",
|
"pre_production_statuses": "Pre-Production Statuses",
|
||||||
"production_statuses": "Production Statuses"
|
"production_statuses": "Production Statuses"
|
||||||
},
|
},
|
||||||
|
"target_touchtime": "Target Touch Time",
|
||||||
"zip_post": "Zip/Postal Code"
|
"zip_post": "Zip/Postal Code"
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
|||||||
@@ -254,6 +254,7 @@
|
|||||||
"pre_production_statuses": "",
|
"pre_production_statuses": "",
|
||||||
"production_statuses": ""
|
"production_statuses": ""
|
||||||
},
|
},
|
||||||
|
"target_touchtime": "",
|
||||||
"zip_post": ""
|
"zip_post": ""
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
|||||||
@@ -254,6 +254,7 @@
|
|||||||
"pre_production_statuses": "",
|
"pre_production_statuses": "",
|
||||||
"production_statuses": ""
|
"production_statuses": ""
|
||||||
},
|
},
|
||||||
|
"target_touchtime": "",
|
||||||
"zip_post": ""
|
"zip_post": ""
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."bodyshops" DROP COLUMN "target_touchtime";
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."bodyshops" ADD COLUMN "target_touchtime" numeric NULL
|
||||||
|
DEFAULT 3.5;
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: bodyshops
|
||||||
|
schema: public
|
||||||
|
type: drop_select_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
allow_aggregations: false
|
||||||
|
columns:
|
||||||
|
- accountingconfig
|
||||||
|
- address1
|
||||||
|
- address2
|
||||||
|
- appt_length
|
||||||
|
- city
|
||||||
|
- country
|
||||||
|
- created_at
|
||||||
|
- deliverchecklist
|
||||||
|
- email
|
||||||
|
- enforce_class
|
||||||
|
- federal_tax_id
|
||||||
|
- id
|
||||||
|
- inhousevendorid
|
||||||
|
- insurance_vendor_id
|
||||||
|
- intakechecklist
|
||||||
|
- invoice_tax_rates
|
||||||
|
- logo_img_path
|
||||||
|
- md_categories
|
||||||
|
- md_classes
|
||||||
|
- md_ins_cos
|
||||||
|
- md_labor_rates
|
||||||
|
- md_messaging_presets
|
||||||
|
- md_notes_presets
|
||||||
|
- md_order_statuses
|
||||||
|
- md_parts_locations
|
||||||
|
- md_rbac
|
||||||
|
- md_referral_sources
|
||||||
|
- md_responsibility_centers
|
||||||
|
- md_ro_statuses
|
||||||
|
- messagingservicesid
|
||||||
|
- phone
|
||||||
|
- prodtargethrs
|
||||||
|
- production_config
|
||||||
|
- region_config
|
||||||
|
- scoreboard_target
|
||||||
|
- shopname
|
||||||
|
- shoprates
|
||||||
|
- speedprint
|
||||||
|
- ssbuckets
|
||||||
|
- state
|
||||||
|
- state_tax_id
|
||||||
|
- stripe_acct_id
|
||||||
|
- template_header
|
||||||
|
- textid
|
||||||
|
- updated_at
|
||||||
|
- zip_post
|
||||||
|
computed_fields: []
|
||||||
|
filter:
|
||||||
|
associations:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: bodyshops
|
||||||
|
schema: public
|
||||||
|
type: create_select_permission
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: bodyshops
|
||||||
|
schema: public
|
||||||
|
type: drop_select_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
allow_aggregations: false
|
||||||
|
columns:
|
||||||
|
- accountingconfig
|
||||||
|
- address1
|
||||||
|
- address2
|
||||||
|
- appt_length
|
||||||
|
- city
|
||||||
|
- country
|
||||||
|
- created_at
|
||||||
|
- deliverchecklist
|
||||||
|
- email
|
||||||
|
- enforce_class
|
||||||
|
- federal_tax_id
|
||||||
|
- id
|
||||||
|
- inhousevendorid
|
||||||
|
- insurance_vendor_id
|
||||||
|
- intakechecklist
|
||||||
|
- invoice_tax_rates
|
||||||
|
- logo_img_path
|
||||||
|
- md_categories
|
||||||
|
- md_classes
|
||||||
|
- md_ins_cos
|
||||||
|
- md_labor_rates
|
||||||
|
- md_messaging_presets
|
||||||
|
- md_notes_presets
|
||||||
|
- md_order_statuses
|
||||||
|
- md_parts_locations
|
||||||
|
- md_rbac
|
||||||
|
- md_referral_sources
|
||||||
|
- md_responsibility_centers
|
||||||
|
- md_ro_statuses
|
||||||
|
- messagingservicesid
|
||||||
|
- phone
|
||||||
|
- prodtargethrs
|
||||||
|
- production_config
|
||||||
|
- region_config
|
||||||
|
- scoreboard_target
|
||||||
|
- shopname
|
||||||
|
- shoprates
|
||||||
|
- speedprint
|
||||||
|
- ssbuckets
|
||||||
|
- state
|
||||||
|
- state_tax_id
|
||||||
|
- stripe_acct_id
|
||||||
|
- target_touchtime
|
||||||
|
- template_header
|
||||||
|
- textid
|
||||||
|
- updated_at
|
||||||
|
- zip_post
|
||||||
|
computed_fields: []
|
||||||
|
filter:
|
||||||
|
associations:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: bodyshops
|
||||||
|
schema: public
|
||||||
|
type: create_select_permission
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: bodyshops
|
||||||
|
schema: public
|
||||||
|
type: drop_update_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- accountingconfig
|
||||||
|
- address1
|
||||||
|
- address2
|
||||||
|
- appt_length
|
||||||
|
- city
|
||||||
|
- country
|
||||||
|
- created_at
|
||||||
|
- deliverchecklist
|
||||||
|
- email
|
||||||
|
- enforce_class
|
||||||
|
- federal_tax_id
|
||||||
|
- id
|
||||||
|
- inhousevendorid
|
||||||
|
- insurance_vendor_id
|
||||||
|
- intakechecklist
|
||||||
|
- invoice_tax_rates
|
||||||
|
- logo_img_path
|
||||||
|
- md_categories
|
||||||
|
- md_classes
|
||||||
|
- md_ins_cos
|
||||||
|
- md_labor_rates
|
||||||
|
- md_messaging_presets
|
||||||
|
- md_notes_presets
|
||||||
|
- md_order_statuses
|
||||||
|
- md_parts_locations
|
||||||
|
- md_rbac
|
||||||
|
- md_referral_sources
|
||||||
|
- md_responsibility_centers
|
||||||
|
- md_ro_statuses
|
||||||
|
- phone
|
||||||
|
- prodtargethrs
|
||||||
|
- production_config
|
||||||
|
- scoreboard_target
|
||||||
|
- shopname
|
||||||
|
- shoprates
|
||||||
|
- speedprint
|
||||||
|
- ssbuckets
|
||||||
|
- state
|
||||||
|
- state_tax_id
|
||||||
|
- updated_at
|
||||||
|
- zip_post
|
||||||
|
filter:
|
||||||
|
associations:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: bodyshops
|
||||||
|
schema: public
|
||||||
|
type: create_update_permission
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: bodyshops
|
||||||
|
schema: public
|
||||||
|
type: drop_update_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- accountingconfig
|
||||||
|
- address1
|
||||||
|
- address2
|
||||||
|
- appt_length
|
||||||
|
- city
|
||||||
|
- country
|
||||||
|
- created_at
|
||||||
|
- deliverchecklist
|
||||||
|
- email
|
||||||
|
- enforce_class
|
||||||
|
- federal_tax_id
|
||||||
|
- id
|
||||||
|
- inhousevendorid
|
||||||
|
- insurance_vendor_id
|
||||||
|
- intakechecklist
|
||||||
|
- invoice_tax_rates
|
||||||
|
- logo_img_path
|
||||||
|
- md_categories
|
||||||
|
- md_classes
|
||||||
|
- md_ins_cos
|
||||||
|
- md_labor_rates
|
||||||
|
- md_messaging_presets
|
||||||
|
- md_notes_presets
|
||||||
|
- md_order_statuses
|
||||||
|
- md_parts_locations
|
||||||
|
- md_rbac
|
||||||
|
- md_referral_sources
|
||||||
|
- md_responsibility_centers
|
||||||
|
- md_ro_statuses
|
||||||
|
- phone
|
||||||
|
- prodtargethrs
|
||||||
|
- production_config
|
||||||
|
- scoreboard_target
|
||||||
|
- shopname
|
||||||
|
- shoprates
|
||||||
|
- speedprint
|
||||||
|
- ssbuckets
|
||||||
|
- state
|
||||||
|
- state_tax_id
|
||||||
|
- target_touchtime
|
||||||
|
- updated_at
|
||||||
|
- zip_post
|
||||||
|
filter:
|
||||||
|
associations:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: bodyshops
|
||||||
|
schema: public
|
||||||
|
type: create_update_permission
|
||||||
@@ -510,6 +510,7 @@ tables:
|
|||||||
- state
|
- state
|
||||||
- state_tax_id
|
- state_tax_id
|
||||||
- stripe_acct_id
|
- stripe_acct_id
|
||||||
|
- target_touchtime
|
||||||
- template_header
|
- template_header
|
||||||
- textid
|
- textid
|
||||||
- updated_at
|
- updated_at
|
||||||
@@ -564,6 +565,7 @@ tables:
|
|||||||
- ssbuckets
|
- ssbuckets
|
||||||
- state
|
- state
|
||||||
- state_tax_id
|
- state_tax_id
|
||||||
|
- target_touchtime
|
||||||
- updated_at
|
- updated_at
|
||||||
- zip_post
|
- zip_post
|
||||||
filter:
|
filter:
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ exports.job = async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
const BearerToken = req.headers.authorization;
|
const BearerToken = req.headers.authorization;
|
||||||
const { jobId } = req.body;
|
const { jobId } = req.body;
|
||||||
|
console.log("exports.job -> jobId", jobId)
|
||||||
|
|
||||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
|
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
Reference in New Issue
Block a user