Transfered alt_transport to job from event and added to production boards. IO-462

This commit is contained in:
Patrick Fic
2020-12-16 15:58:07 -08:00
parent 41c1e75b31
commit 536fd606ed
29 changed files with 1927 additions and 34 deletions

View File

@@ -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>