Merged in release/2022-05-06 (pull request #461)
release/2022-05-06 Approved-by: Patrick Fic
This commit is contained in:
@@ -0,0 +1,47 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { Button, Popconfirm } from "antd";
|
||||||
|
import { DeleteFilled } from "@ant-design/icons";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { DELETE_PARTS_ORDER_LINE } from "../../graphql/parts-orders.queries";
|
||||||
|
import { useMutation } from "@apollo/client";
|
||||||
|
|
||||||
|
export default function PartsOrderDeleteLine({
|
||||||
|
disabled,
|
||||||
|
partsLineId,
|
||||||
|
partsOrderId,
|
||||||
|
}) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [deletePartsOrderLine] = useMutation(DELETE_PARTS_ORDER_LINE);
|
||||||
|
return (
|
||||||
|
<Popconfirm
|
||||||
|
title={t("parts_orders.labels.confirmdelete")}
|
||||||
|
disabled={disabled}
|
||||||
|
onConfirm={async () => {
|
||||||
|
//Delete the parts return.!
|
||||||
|
|
||||||
|
await deletePartsOrderLine({
|
||||||
|
variables: { partsOrderLineId: partsLineId },
|
||||||
|
update(cache) {
|
||||||
|
cache.modify({
|
||||||
|
id: cache.identify({
|
||||||
|
__typename: "parts_orders",
|
||||||
|
id: partsOrderId,
|
||||||
|
}),
|
||||||
|
fields: {
|
||||||
|
parts_order_lines(cached, { readField }) {
|
||||||
|
return cached.filter((c) => {
|
||||||
|
return readField("id", c) !== partsLineId;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button disabled={disabled}>
|
||||||
|
<DeleteFilled />
|
||||||
|
</Button>
|
||||||
|
</Popconfirm>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ import { TemplateList } from "../../utils/TemplateConstants";
|
|||||||
import DataLabel from "../data-label/data-label.component";
|
import DataLabel from "../data-label/data-label.component";
|
||||||
import PartsOrderBackorderEta from "../parts-order-backorder-eta/parts-order-backorder-eta.component";
|
import PartsOrderBackorderEta from "../parts-order-backorder-eta/parts-order-backorder-eta.component";
|
||||||
import PartsOrderCmReceived from "../parts-order-cm-received/parts-order-cm-received.component";
|
import PartsOrderCmReceived from "../parts-order-cm-received/parts-order-cm-received.component";
|
||||||
|
import PartsOrderDeleteLine from "../parts-order-delete-line/parts-order-delete-line.component";
|
||||||
import PartsOrderLineBackorderButton from "../parts-order-line-backorder-button/parts-order-line-backorder-button.component";
|
import PartsOrderLineBackorderButton from "../parts-order-line-backorder-button/parts-order-line-backorder-button.component";
|
||||||
import PartsReceiveModalContainer from "../parts-receive-modal/parts-receive-modal.container";
|
import PartsReceiveModalContainer from "../parts-receive-modal/parts-receive-modal.container";
|
||||||
import PrintWrapper from "../print-wrapper/print-wrapper.component";
|
import PrintWrapper from "../print-wrapper/print-wrapper.component";
|
||||||
@@ -391,12 +392,21 @@ export function PartsOrderListTableComponent({
|
|||||||
dataIndex: "actions",
|
dataIndex: "actions",
|
||||||
key: "actions",
|
key: "actions",
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<PartsOrderLineBackorderButton
|
<Space wrap>
|
||||||
disabled={jobRO}
|
<PartsOrderDeleteLine
|
||||||
partsOrderStatus={record.status}
|
disabled={jobRO}
|
||||||
partsLineId={record.id}
|
partsOrderStatus={record.status}
|
||||||
jobLineId={record.job_line_id}
|
partsLineId={record.id}
|
||||||
/>
|
partsOrderId={selectedpartsorder}
|
||||||
|
jobLineId={record.job_line_id}
|
||||||
|
/>
|
||||||
|
<PartsOrderLineBackorderButton
|
||||||
|
disabled={jobRO}
|
||||||
|
partsOrderStatus={record.status}
|
||||||
|
partsLineId={record.id}
|
||||||
|
jobLineId={record.job_line_id}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default function TimeTicketsAttendanceTable() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
"x"
|
"text"
|
||||||
);
|
);
|
||||||
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|||||||
@@ -292,6 +292,14 @@ export const DELETE_PARTS_ORDER = gql`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const DELETE_PARTS_ORDER_LINE = gql`
|
||||||
|
mutation DELETE_PARTS_ORDER_LINE($partsOrderLineId: uuid!) {
|
||||||
|
delete_parts_order_lines_by_pk(id: $partsOrderLineId) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export const MUTATION_UPDATE_PO_CM_REECEIVED = gql`
|
export const MUTATION_UPDATE_PO_CM_REECEIVED = gql`
|
||||||
mutation MUTATION_UPDATE_PO_CM_REECEIVED(
|
mutation MUTATION_UPDATE_PO_CM_REECEIVED(
|
||||||
$partsLineId: uuid!
|
$partsLineId: uuid!
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ export default async function RenderTemplate(
|
|||||||
templateObject,
|
templateObject,
|
||||||
bodyshop,
|
bodyshop,
|
||||||
renderAsHtml = false,
|
renderAsHtml = false,
|
||||||
renderAsExcel = false
|
renderAsExcel = false,
|
||||||
|
renderAsText = false
|
||||||
) {
|
) {
|
||||||
//Query assets that match the template name. Must be in format <<templateName>>.query
|
//Query assets that match the template name. Must be in format <<templateName>>.query
|
||||||
let { contextData, useShopSpecificTemplate } = await fetchContextData(
|
let { contextData, useShopSpecificTemplate } = await fetchContextData(
|
||||||
@@ -54,6 +55,7 @@ export default async function RenderTemplate(
|
|||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
...(renderAsExcel ? { recipe: "html-to-xlsx" } : {}),
|
...(renderAsExcel ? { recipe: "html-to-xlsx" } : {}),
|
||||||
|
...(renderAsText ? { recipe: "text" } : {}),
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
...contextData,
|
...contextData,
|
||||||
@@ -254,6 +256,9 @@ export const GenerateDocument = async (
|
|||||||
} else if (sendType === "x") {
|
} else if (sendType === "x") {
|
||||||
console.log("excel");
|
console.log("excel");
|
||||||
await RenderTemplate(template, bodyshop, false, true);
|
await RenderTemplate(template, bodyshop, false, true);
|
||||||
|
} else if (sendType === "x") {
|
||||||
|
console.log("text");
|
||||||
|
await RenderTemplate(template, bodyshop, false, false, true);
|
||||||
} else {
|
} else {
|
||||||
await RenderTemplate(template, bodyshop);
|
await RenderTemplate(template, bodyshop);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user