Added order parts link to job drawer BOD-210

This commit is contained in:
Patrick Fic
2020-07-31 11:41:17 -07:00
parent a1b03048e3
commit a87e9ca9f8
2 changed files with 56 additions and 33 deletions

View File

@@ -1,6 +1,6 @@
import { PrinterFilled } from "@ant-design/icons";
import { useQuery } from "@apollo/react-hooks";
import { Button, Col, Drawer, Grid, PageHeader, Row, Tag } from "antd";
import { Button, Col, Drawer, Grid, PageHeader, Row, Tag, Space } from "antd";
import queryString from "query-string";
import React from "react";
import { useTranslation } from "react-i18next";
@@ -75,20 +75,22 @@ export function JobDetailCards({ setPrintCenterContext }) {
visible={!!selected}
destroyOnClose
width={drawerPercentage}
placement='right'
onClose={handleDrawerClose}>
placement="right"
onClose={handleDrawerClose}
>
{loading ? <LoadingSpinner /> : null}
{error ? <AlertComponent message={error.message} type='error' /> : null}
{error ? <AlertComponent message={error.message} type="error" /> : null}
{data ? (
<PageHeader
ghost={true}
tags={[
<OwnerTagPopoverComponent key='owner' job={data.jobs_by_pk} />,
<VehicleTagPopoverComponent key='vehicle' job={data.jobs_by_pk} />,
<OwnerTagPopoverComponent key="owner" job={data.jobs_by_pk} />,
<VehicleTagPopoverComponent key="vehicle" job={data.jobs_by_pk} />,
<Tag
color='#f50'
key='production'
style={{ display: data.jobs_by_pk.inproduction ? "" : "none" }}>
color="#f50"
key="production"
style={{ display: data.jobs_by_pk.inproduction ? "" : "none" }}
>
{t("jobs.labels.inproduction")}
</Tag>,
]}
@@ -103,20 +105,27 @@ export function JobDetailCards({ setPrintCenterContext }) {
}
subTitle={data.jobs_by_pk.status}
extra={
<Button
onClick={() => {
setPrintCenterContext({
actions: { refetch: refetch },
context: {
id: data.jobs_by_pk.id,
type: "job",
},
});
}}>
<PrinterFilled />
{t("jobs.actions.printCenter")}
</Button>
}>
<Space>
<Button
onClick={() => {
setPrintCenterContext({
actions: { refetch: refetch },
context: {
id: data.jobs_by_pk.id,
type: "job",
},
});
}}
>
<PrinterFilled />
{t("jobs.actions.printCenter")}
</Button>
<Link to={`/manage/jobs/${data.jobs_by_pk.id}?tab=repairdata`}>
<Button>{t("parts.actions.order")}</Button>
</Link>
</Space>
}
>
<Row gutter={[16, 16]}>
<Col {...colBreakPoints}>
<JobDetailCardsInsuranceComponent