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