Added order parts link to job drawer BOD-210
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { PrinterFilled } from "@ant-design/icons";
|
import { PrinterFilled } from "@ant-design/icons";
|
||||||
import { useQuery } from "@apollo/react-hooks";
|
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 queryString from "query-string";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -75,20 +75,22 @@ export function JobDetailCards({ setPrintCenterContext }) {
|
|||||||
visible={!!selected}
|
visible={!!selected}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
width={drawerPercentage}
|
width={drawerPercentage}
|
||||||
placement='right'
|
placement="right"
|
||||||
onClose={handleDrawerClose}>
|
onClose={handleDrawerClose}
|
||||||
|
>
|
||||||
{loading ? <LoadingSpinner /> : null}
|
{loading ? <LoadingSpinner /> : null}
|
||||||
{error ? <AlertComponent message={error.message} type='error' /> : null}
|
{error ? <AlertComponent message={error.message} type="error" /> : null}
|
||||||
{data ? (
|
{data ? (
|
||||||
<PageHeader
|
<PageHeader
|
||||||
ghost={true}
|
ghost={true}
|
||||||
tags={[
|
tags={[
|
||||||
<OwnerTagPopoverComponent key='owner' job={data.jobs_by_pk} />,
|
<OwnerTagPopoverComponent key="owner" job={data.jobs_by_pk} />,
|
||||||
<VehicleTagPopoverComponent key='vehicle' job={data.jobs_by_pk} />,
|
<VehicleTagPopoverComponent key="vehicle" job={data.jobs_by_pk} />,
|
||||||
<Tag
|
<Tag
|
||||||
color='#f50'
|
color="#f50"
|
||||||
key='production'
|
key="production"
|
||||||
style={{ display: data.jobs_by_pk.inproduction ? "" : "none" }}>
|
style={{ display: data.jobs_by_pk.inproduction ? "" : "none" }}
|
||||||
|
>
|
||||||
{t("jobs.labels.inproduction")}
|
{t("jobs.labels.inproduction")}
|
||||||
</Tag>,
|
</Tag>,
|
||||||
]}
|
]}
|
||||||
@@ -103,20 +105,27 @@ export function JobDetailCards({ setPrintCenterContext }) {
|
|||||||
}
|
}
|
||||||
subTitle={data.jobs_by_pk.status}
|
subTitle={data.jobs_by_pk.status}
|
||||||
extra={
|
extra={
|
||||||
<Button
|
<Space>
|
||||||
onClick={() => {
|
<Button
|
||||||
setPrintCenterContext({
|
onClick={() => {
|
||||||
actions: { refetch: refetch },
|
setPrintCenterContext({
|
||||||
context: {
|
actions: { refetch: refetch },
|
||||||
id: data.jobs_by_pk.id,
|
context: {
|
||||||
type: "job",
|
id: data.jobs_by_pk.id,
|
||||||
},
|
type: "job",
|
||||||
});
|
},
|
||||||
}}>
|
});
|
||||||
<PrinterFilled />
|
}}
|
||||||
{t("jobs.actions.printCenter")}
|
>
|
||||||
</Button>
|
<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]}>
|
<Row gutter={[16, 16]}>
|
||||||
<Col {...colBreakPoints}>
|
<Col {...colBreakPoints}>
|
||||||
<JobDetailCardsInsuranceComponent
|
<JobDetailCardsInsuranceComponent
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { TemplateList } from "../../utils/TemplateConstants";
|
|||||||
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 { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import { onlyUnique } from "../../utils/arrayHelper";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -85,9 +86,16 @@ export function TimeTicketsSummaryEmployees({
|
|||||||
{t("timetickets.labels.jobhours")}
|
{t("timetickets.labels.jobhours")}
|
||||||
</Typography.Title>
|
</Typography.Title>
|
||||||
}
|
}
|
||||||
itemLayout='horizontal'
|
itemLayout="horizontal"
|
||||||
dataSource={jobTickets}
|
//dataSource={jobTickets}
|
||||||
renderItem={(item) => {
|
>
|
||||||
|
{jobTickets.map((item, idx) => {
|
||||||
|
const costCenters = item.tickets
|
||||||
|
.map((i) => i.cost_center)
|
||||||
|
.filter(onlyUnique);
|
||||||
|
|
||||||
|
console.log("costCenters", costCenters);
|
||||||
|
|
||||||
const actHrs = item.tickets.reduce(
|
const actHrs = item.tickets.reduce(
|
||||||
(acc, val) => acc + val.actualhrs,
|
(acc, val) => acc + val.actualhrs,
|
||||||
0
|
0
|
||||||
@@ -109,15 +117,19 @@ export function TimeTicketsSummaryEmployees({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<List.Item
|
<List.Item
|
||||||
|
key={idx}
|
||||||
actions={[
|
actions={[
|
||||||
<Button
|
<Button
|
||||||
onClick={() => handlePrintEmployeeTicket(item.employee.id)}>
|
onClick={() => handlePrintEmployeeTicket(item.employee.id)}
|
||||||
|
>
|
||||||
{t("timetickets.actions.printemployee")}
|
{t("timetickets.actions.printemployee")}
|
||||||
</Button>,
|
</Button>,
|
||||||
]}>
|
]}
|
||||||
|
>
|
||||||
<LoadingSkeleton loading={loading}>
|
<LoadingSkeleton loading={loading}>
|
||||||
<List.Item.Meta
|
<List.Item.Meta
|
||||||
title={`${item.employee.first_name} ${item.employee.last_name}`}
|
title={`${item.employee.first_name} ${item.employee.last_name}`}
|
||||||
|
description="cost center?"
|
||||||
/>
|
/>
|
||||||
<Space>
|
<Space>
|
||||||
<Statistic
|
<Statistic
|
||||||
@@ -145,15 +157,15 @@ export function TimeTicketsSummaryEmployees({
|
|||||||
</LoadingSkeleton>
|
</LoadingSkeleton>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
);
|
);
|
||||||
}}
|
})}
|
||||||
/>
|
</List>
|
||||||
<List
|
<List
|
||||||
header={
|
header={
|
||||||
<Typography.Title level={3}>
|
<Typography.Title level={3}>
|
||||||
{t("timetickets.labels.clockhours")}
|
{t("timetickets.labels.clockhours")}
|
||||||
</Typography.Title>
|
</Typography.Title>
|
||||||
}
|
}
|
||||||
itemLayout='horizontal'
|
itemLayout="horizontal"
|
||||||
dataSource={shiftTickets}
|
dataSource={shiftTickets}
|
||||||
renderItem={(item) => {
|
renderItem={(item) => {
|
||||||
const clockHrs = item.tickets.reduce((acc, val) => {
|
const clockHrs = item.tickets.reduce((acc, val) => {
|
||||||
@@ -169,10 +181,12 @@ export function TimeTicketsSummaryEmployees({
|
|||||||
<List.Item
|
<List.Item
|
||||||
actions={[
|
actions={[
|
||||||
<Button
|
<Button
|
||||||
onClick={() => handlePrintEmployeeTicket(item.employee.id)}>
|
onClick={() => handlePrintEmployeeTicket(item.employee.id)}
|
||||||
|
>
|
||||||
{t("timetickets.actions.printemployee")}
|
{t("timetickets.actions.printemployee")}
|
||||||
</Button>,
|
</Button>,
|
||||||
]}>
|
]}
|
||||||
|
>
|
||||||
<LoadingSkeleton loading={loading}>
|
<LoadingSkeleton loading={loading}>
|
||||||
<List.Item.Meta
|
<List.Item.Meta
|
||||||
title={`${item.employee.first_name} ${item.employee.last_name}`}
|
title={`${item.employee.first_name} ${item.employee.last_name}`}
|
||||||
|
|||||||
Reference in New Issue
Block a user