diff --git a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx index 8f59adfb1..83ade9d5c 100644 --- a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx +++ b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx @@ -81,11 +81,7 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) { / {job.owner_owing} - {job.converted && ( - - - - )} + {job.alt_transport} @@ -183,6 +179,9 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) { {`${job.v_vin || t("general.labels.na")}`} + + + diff --git a/client/src/components/jobs-related-ros/jobs-related-ros.component.jsx b/client/src/components/jobs-related-ros/jobs-related-ros.component.jsx index a94d1a650..dce3f0393 100644 --- a/client/src/components/jobs-related-ros/jobs-related-ros.component.jsx +++ b/client/src/components/jobs-related-ros/jobs-related-ros.component.jsx @@ -1,112 +1,19 @@ -import React, { useState } from "react"; -import { useQuery, useMutation } from "@apollo/client"; -import { Tag, Space, Button, Popover, Card, Form } from "antd"; -import { - DELETE_RELATED_RO, - INSERT_RELATED_ROS, - QUERY_RELATED_ROS, -} from "../../graphql/jobs.queries"; -import LoadingSpinner from "../loading-spinner/loading-spinner.component"; -import AlertComponent from "../alert/alert.component"; -import { PlusCircleOutlined } from "@ant-design/icons"; -import JobSearchSelectComponent from "../job-search-select/job-search-select.component"; -import { useTranslation } from "react-i18next"; +import { Space, Tag } from "antd"; +import React from "react"; import { Link } from "react-router-dom"; -export default function JobsRelatedRos({ jobid }) { - const [roSearchVisible, setRoSearchVisible] = useState(false); - const [saveLoading, setSaveLoading] = useState(false); - const [insertRelationship] = useMutation(INSERT_RELATED_ROS); - const [deleteRelationship] = useMutation(DELETE_RELATED_RO); - const { loading, error, data } = useQuery(QUERY_RELATED_ROS, { - variables: { jobid }, - skip: !jobid, - }); - const { t } = useTranslation(); - if (loading) return ; - if (error) return ; - - const relatedJobs = data.relatedjobs.map((r) => { - if (r.parentjob === jobid) { - return { relationshipid: r.id, ...r.childjob_rel }; - } - return { relationshipid: r.id, ...r.parentjob_rel }; - }); - - const handleAddRo = async ({ relatedjobid }) => { - setSaveLoading(true); - - await insertRelationship({ - variables: { relationship: { parentjob: jobid, childjob: relatedjobid } }, - update(cache, { data }) { - cache.modify({ - fields: { - relatedjobs(rj, { readField }) { - return [rj, data.insert_relatedjobs_one]; - }, - }, - }); - }, - }); - setSaveLoading(false); - setRoSearchVisible(false); - }; - const handleDelete = async (id) => { - setSaveLoading(true); - - await deleteRelationship({ - variables: { - relationshipid: id, - }, - - update(cache, { data }) { - cache.modify({ - fields: { - relatedjobs(rj, { readField }) { - return rj.filter((r) => r.id !== id); - }, - }, - }); - }, - }); - setSaveLoading(false); - setRoSearchVisible(false); - }; - - const popContent = ( - -
- - - - - - - -
-
- ); - +export default function JobsRelatedRos({ jobid, job }) { return ( - {relatedJobs.map((r) => ( - handleDelete(r.relationshipid)}> - {r.ro_number} - - ))} - - - + {job.vehicle.jobs + .filter((j) => j.id !== job.id) + .map((j) => ( + + {`${j.ro_number || "N/A"}${ + j.clm_no ? ` | ${j.clm_no}` : "" + }${j.status ? ` | ${j.status}` : ""}`} + + ))} ); } diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 4f957d051..d0e9a3daf 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -384,6 +384,12 @@ export const GET_JOB_BY_PK = gql` v_model_desc v_make_desc v_color + jobs { + id + ro_number + status + clm_no + } } available_jobs { id