Transfered alt_transport to job from event and added to production boards. IO-462
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import { useMutation } from "react-apollo";
|
||||
import { UPDATE_APPOINTMENT } from "../../graphql/appointments.queries";
|
||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -16,12 +16,12 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
});
|
||||
|
||||
export function ScheduleAtChange({ bodyshop, event }) {
|
||||
const [updateAppointment] = useMutation(UPDATE_APPOINTMENT);
|
||||
const [updateJob] = useMutation(UPDATE_JOB);
|
||||
const { t } = useTranslation();
|
||||
|
||||
const onClick = async ({ key }) => {
|
||||
const result = await updateAppointment({
|
||||
variables: { appid: event.id, app: { alt_transport: key } },
|
||||
const result = await updateJob({
|
||||
variables: { jobId: event.job.id, job: { alt_transport: key } },
|
||||
});
|
||||
|
||||
if (!!!result.errors) {
|
||||
@@ -35,7 +35,10 @@ export function ScheduleAtChange({ bodyshop, event }) {
|
||||
}
|
||||
};
|
||||
const menu = (
|
||||
<Menu selectedKeys={[event.alt_transport]} onClick={onClick}>
|
||||
<Menu
|
||||
selectedKeys={[event.job && event.job.alt_transport]}
|
||||
onClick={onClick}
|
||||
>
|
||||
{bodyshop.appt_alt_transport &&
|
||||
bodyshop.appt_alt_transport.map((alt) => (
|
||||
<Menu.Item key={alt}>{alt}</Menu.Item>
|
||||
|
||||
@@ -64,8 +64,8 @@ export function ScheduleEventComponent({
|
||||
{(event.job && event.job.ownr_ph1) || ""}
|
||||
</PhoneFormatter>
|
||||
</DataLabel>
|
||||
<DataLabel label={t("appointments.fields.alt_transport")}>
|
||||
{event.alt_transport || ""}
|
||||
<DataLabel label={t("jobs.fields.alt_transport")}>
|
||||
{(event.job && event.job.alt_transport) || ""}
|
||||
<ScheduleAtChange event={event} />
|
||||
</DataLabel>
|
||||
</div>
|
||||
@@ -134,8 +134,8 @@ export function ScheduleEventComponent({
|
||||
(event.job && event.job.larhrs.aggregate.sum.mod_lb_hrs) || "0"
|
||||
})`}
|
||||
</div>
|
||||
{event.alt_transport && (
|
||||
<div style={{ margin: ".1rem" }}>{event.alt_transport}</div>
|
||||
{event.job && event.job.alt_transport && (
|
||||
<div style={{ margin: ".1rem" }}>{event.job.alt_transport}</div>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user