Fixed remove from production button not closing drawer. BOD-315

This commit is contained in:
Patrick Fic
2020-09-09 12:16:03 -07:00
parent eff6f361ee
commit c4c646ba35
5 changed files with 20 additions and 6 deletions

View File

@@ -9,11 +9,12 @@ export default function BarcodePopupComponent({ value, children }) {
<Popover <Popover
content={ content={
<Barcode <Barcode
value={value} value={value || ""}
background='transparent' background="transparent"
displayValue={false} displayValue={false}
/> />
}> }
>
{children ? children : <Tag>{t("general.labels.barcode")}</Tag>} {children ? children : <Tag>{t("general.labels.barcode")}</Tag>}
</Popover> </Popover>
</div> </div>

View File

@@ -37,7 +37,7 @@ export function PartsStatusPie({ bodyshop, joblines_status }) {
const Calculatedata = useCallback( const Calculatedata = useCallback(
(data) => { (data) => {
if (data.length > 0) { if (data && data.length > 0) {
const statusMapping = {}; const statusMapping = {};
data.map((i) => { data.map((i) => {
if (!statusMapping[i.status]) if (!statusMapping[i.status])

View File

@@ -3,7 +3,7 @@ import { Descriptions, Drawer } from "antd";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import CurrencyFormatter from "../../utils/CurrencyFormatter"; import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { DateFormatter } from "../../utils/DateFormatter"; import { DateFormatter } from "../../utils/DateFormatter";
import PartsPieGraph from "../parts-status-pie/parts-status-pie.component"; import PartsStatusPie from "../parts-status-pie/parts-status-pie.component";
import Barcode from "react-barcode"; import Barcode from "react-barcode";
import ProductionRemoveButton from "../production-remove-button/production-remove-button.component"; import ProductionRemoveButton from "../production-remove-button/production-remove-button.component";
import queryString from "query-string"; import queryString from "query-string";
@@ -62,7 +62,7 @@ export default function ProductionListDetail({ jobs }) {
<DateFormatter>{theJob.scheduled_completion}</DateFormatter> <DateFormatter>{theJob.scheduled_completion}</DateFormatter>
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label={t("jobs.labels.parts")}> <Descriptions.Item label={t("jobs.labels.parts")}>
<PartsPieGraph partsList={theJob.partcount} /> <PartsStatusPie joblines_status={theJob.joblines_status} />
</Descriptions.Item> </Descriptions.Item>
</Descriptions> </Descriptions>
<ProductionRemoveButton jobId={theJob.id} /> <ProductionRemoveButton jobId={theJob.id} />

View File

@@ -4,11 +4,16 @@ import React, { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { logImEXEvent } from "../../firebase/firebase.utils"; import { logImEXEvent } from "../../firebase/firebase.utils";
import { UPDATE_JOB } from "../../graphql/jobs.queries"; import { UPDATE_JOB } from "../../graphql/jobs.queries";
import queryString from "query-string";
import { useHistory, useLocation } from "react-router-dom";
export default function ProductionRemoveButton({ jobId }) { export default function ProductionRemoveButton({ jobId }) {
const [removeJobFromProduction] = useMutation(UPDATE_JOB); const [removeJobFromProduction] = useMutation(UPDATE_JOB);
const { t } = useTranslation(); const { t } = useTranslation();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const search = queryString.parse(useLocation().search);
const history = useHistory();
const { selected } = search;
const handleRemoveFromProd = async () => { const handleRemoveFromProd = async () => {
logImEXEvent("production_remove_job"); logImEXEvent("production_remove_job");
@@ -19,6 +24,8 @@ export default function ProductionRemoveButton({ jobId }) {
if (!!!result.errors) { if (!!!result.errors) {
notification["success"]({ message: t("production.successes.removed") }); notification["success"]({ message: t("production.successes.removed") });
delete search.selected;
history.push({ search: queryString.stringify(search) });
} else { } else {
notification["error"]({ notification["error"]({
message: t("production.errors.removing", { message: t("production.errors.removing", {
@@ -26,6 +33,7 @@ export default function ProductionRemoveButton({ jobId }) {
}), }),
}); });
} }
setLoading(false); setLoading(false);
}; };

View File

@@ -74,6 +74,11 @@ export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
special_coverage_policy special_coverage_policy
production_vars production_vars
kanbanparent kanbanparent
joblines_status {
part_type
count
status
}
employee_body employee_body
employee_body_rel { employee_body_rel {
id id