IO-979 Delete parts orders.
This commit is contained in:
@@ -26439,6 +26439,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>confirmdelete</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>email</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -413,6 +413,18 @@ export function JobLinesComponent({
|
||||
scroll={{
|
||||
x: true,
|
||||
}}
|
||||
onRow={(record, rowIndex) => {
|
||||
return {
|
||||
onDoubleClick: (event) => {
|
||||
const notMatchingLines = selectedLines.filter(
|
||||
(i) => i.id !== record.id
|
||||
);
|
||||
notMatchingLines.length !== selectedLines.length
|
||||
? setSelectedLines(notMatchingLines)
|
||||
: setSelectedLines([...selectedLines, record]);
|
||||
}, // double click row
|
||||
};
|
||||
}}
|
||||
rowSelection={{
|
||||
selectedRowKeys: selectedLines.map((item) => item.id),
|
||||
onSelectAll: (selected, selectedRows, changeRows) => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EyeFilled, SyncOutlined } from "@ant-design/icons";
|
||||
import { DeleteFilled, EyeFilled, SyncOutlined } from "@ant-design/icons";
|
||||
import { useMutation } from "@apollo/client";
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
@@ -7,6 +8,7 @@ import {
|
||||
Grid,
|
||||
Input,
|
||||
PageHeader,
|
||||
Popconfirm,
|
||||
Space,
|
||||
Table,
|
||||
} from "antd";
|
||||
@@ -17,6 +19,7 @@ import { connect } from "react-redux";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import { DELETE_PARTS_ORDER } from "../../graphql/parts-orders.queries";
|
||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
@@ -74,6 +77,8 @@ export function PartsOrderListTableComponent({
|
||||
const search = queryString.parse(useLocation().search);
|
||||
const selectedpartsorder = search.partsorderid;
|
||||
|
||||
const [deletePartsOrder] = useMutation(DELETE_PARTS_ORDER);
|
||||
|
||||
const parts_orders = billsQuery.data ? billsQuery.data.parts_orders : [];
|
||||
const { refetch } = billsQuery;
|
||||
|
||||
@@ -88,7 +93,6 @@ export function PartsOrderListTableComponent({
|
||||
disabled={jobRO || record.return}
|
||||
onClick={() => {
|
||||
logImEXEvent("parts_order_receive_bill");
|
||||
|
||||
setPartsReceiveContext({
|
||||
actions: { refetch: refetch },
|
||||
context: {
|
||||
@@ -107,6 +111,31 @@ export function PartsOrderListTableComponent({
|
||||
>
|
||||
{t("parts_orders.actions.receive")}
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title={t("parts_orders.labels.confirmdelete")}
|
||||
onConfirm={async () => {
|
||||
//Delete the parts return.!
|
||||
|
||||
await deletePartsOrder({
|
||||
variables: { partsOrderId: record.id },
|
||||
update(cache) {
|
||||
cache.modify({
|
||||
fields: {
|
||||
parts_orders(existingPartsOrders, { readField }) {
|
||||
return existingPartsOrders.filter(
|
||||
(billref) => record.id !== readField("id", billref)
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Button disabled={jobRO || !record.return}>
|
||||
<DeleteFilled />
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
<Button
|
||||
disabled={jobRO}
|
||||
onClick={() => {
|
||||
@@ -327,8 +356,9 @@ export function PartsOrderListTableComponent({
|
||||
extra={recordActions(record)}
|
||||
/>
|
||||
<Table
|
||||
scroll={{ x: true, //y: "50rem"
|
||||
}}
|
||||
scroll={{
|
||||
x: true, //y: "50rem"
|
||||
}}
|
||||
columns={columns}
|
||||
rowKey="id"
|
||||
dataSource={record.parts_order_lines}
|
||||
@@ -368,9 +398,10 @@ export function PartsOrderListTableComponent({
|
||||
</Drawer>
|
||||
<Table
|
||||
loading={billsQuery.loading}
|
||||
scroll={{ x: true,
|
||||
scroll={{
|
||||
x: true,
|
||||
//y: "50rem"
|
||||
}}
|
||||
}}
|
||||
columns={columns}
|
||||
rowKey="id"
|
||||
dataSource={parts_orders}
|
||||
|
||||
@@ -10,6 +10,14 @@ export const INSERT_NEW_PARTS_ORDERS = gql`
|
||||
}
|
||||
`;
|
||||
|
||||
export const DELETE_PARTS_ORDER = gql`
|
||||
mutation DELETE_PARTS_ORDER($partsOrderId: uuid!) {
|
||||
delete_parts_orders_by_pk(id: $partsOrderId) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const MUTATION_UPDATE_BO_ETA = gql`
|
||||
mutation MUTATION_UPDATE_BO_ETA(
|
||||
$partsLineId: uuid!
|
||||
|
||||
@@ -1435,7 +1435,7 @@
|
||||
"general": "General",
|
||||
"insurance": "Insurance Information",
|
||||
"labor": "Labor",
|
||||
"partssublet": "Parts/Sublet",
|
||||
"partssublet": "Parts & Bills",
|
||||
"rates": "Rates",
|
||||
"repairdata": "Repair Data",
|
||||
"totals": "Totals"
|
||||
@@ -1577,6 +1577,7 @@
|
||||
},
|
||||
"labels": {
|
||||
"allpartsto": "All Parts Location",
|
||||
"confirmdelete": "Are you sure you want to delete this item? It cannot be recovered. ",
|
||||
"email": "Send by Email",
|
||||
"inthisorder": "Parts in this Order",
|
||||
"newpartsorder": "New Parts Order",
|
||||
|
||||
@@ -1577,6 +1577,7 @@
|
||||
},
|
||||
"labels": {
|
||||
"allpartsto": "",
|
||||
"confirmdelete": "",
|
||||
"email": "Enviar por correo electrónico",
|
||||
"inthisorder": "Partes en este pedido",
|
||||
"newpartsorder": "",
|
||||
|
||||
@@ -1577,6 +1577,7 @@
|
||||
},
|
||||
"labels": {
|
||||
"allpartsto": "",
|
||||
"confirmdelete": "",
|
||||
"email": "Envoyé par email",
|
||||
"inthisorder": "Pièces dans cette commande",
|
||||
"newpartsorder": "",
|
||||
|
||||
Reference in New Issue
Block a user