labels
@@ -17423,6 +17554,27 @@
+
+ deleteconfirm
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
frombillinvoicenumber
false
@@ -17533,6 +17685,27 @@
successes
+
+ deleted
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
inserted
false
@@ -17554,6 +17727,27 @@
+
+ updated
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
diff --git a/client/src/components/bill-inventory-table/bill-inventory-table.component.jsx b/client/src/components/bill-inventory-table/bill-inventory-table.component.jsx
index e9403a0f1..9b2222397 100644
--- a/client/src/components/bill-inventory-table/bill-inventory-table.component.jsx
+++ b/client/src/components/bill-inventory-table/bill-inventory-table.component.jsx
@@ -74,6 +74,7 @@ export function BillInventoryTable({
| {t("billlines.fields.quantity")} |
{t("billlines.fields.actual_price")} |
{t("billlines.fields.actual_cost")} |
+ {t("inventory.fields.comment")} |
{t("inventory.actions.consumefrominventory")} |
@@ -136,6 +137,16 @@ export function BillInventoryTable({
+
+
+
+
+ |
{
+ setLoading(true);
+ const result = await deleteInventoryLine({
+ variables: { lineId: inventoryline.id },
+ // update(cache, { errors }) {
+ // cache.modify({
+ // fields: {
+ // inventory(existingInventory, { readField }) {
+ // console.log(existingInventory);
+ // return existingInventory.filter(
+ // (invRef) => inventoryline.id !== readField("id", invRef)
+ // );
+ // },
+ // },
+ // });
+ // },
+ });
+
+ if (!!!result.errors) {
+ notification["success"]({ message: t("inventory.successes.deleted") });
+ } else {
+ //Check if it's an fkey violation.
+
+ notification["error"]({
+ message: t("bills.errors.deleting", {
+ error: JSON.stringify(result.errors),
+ }),
+ });
+ }
+ if (refetch) refetch();
+ setLoading(false);
+ };
+
+ return (
+ >}>
+
+
+
+
+ );
+}
diff --git a/client/src/components/inventory-list/inventory-list.component.jsx b/client/src/components/inventory-list/inventory-list.component.jsx
index 95dcdea13..9baa66de0 100644
--- a/client/src/components/inventory-list/inventory-list.component.jsx
+++ b/client/src/components/inventory-list/inventory-list.component.jsx
@@ -1,4 +1,4 @@
-import { SyncOutlined } from "@ant-design/icons";
+import { EditFilled, SyncOutlined, FileAddFilled } from "@ant-design/icons";
import { Button, Card, Input, Space, Table, Typography } from "antd";
import queryString from "query-string";
import React from "react";
@@ -6,18 +6,28 @@ import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { Link, useHistory, useLocation } from "react-router-dom";
import { createStructuredSelector } from "reselect";
+import { setModalContext } from "../../redux/modals/modals.actions";
import { selectBodyshop } from "../../redux/user/user.selectors";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import InventoryBillRo from "../inventory-bill-ro/inventory-bill-ro.component";
+import InventoryLineDelete from "../inventory-line-delete/inventory-line-delete.component";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
- //setUserLanguage: language => dispatch(setUserLanguage(language))
+ setInventoryUpsertContext: (context) =>
+ dispatch(setModalContext({ context: context, modal: "inventoryUpsert" })),
});
-export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
+export function JobsList({
+ bodyshop,
+ refetch,
+ loading,
+ jobs,
+ total,
+ setInventoryUpsertContext,
+}) {
const search = queryString.parse(useLocation().search);
const { page, sortcolumn, sortorder } = search;
const history = useHistory();
@@ -31,6 +41,15 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
sorter: true, //(a, b) => alphaSort(a.line_desc, b.line_desc),
sortOrder: sortcolumn === "line_desc" && sortorder,
+ render: (text, record) =>
+ record.billline?.bill?.job ? (
+
+ {text}
+ {`(${record.billline?.bill?.job?.v_model_yr} ${record.billline?.bill?.job?.v_make_desc} ${record.billline?.bill?.job?.v_model_desc})`}
+
+ ) : (
+ text
+ ),
},
{
title: t("inventory.labels.frombillinvoicenumber"),
@@ -40,7 +59,12 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
//sorter: true, // (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
//sortOrder: sortcolumn === "ownr_ln" && sortorder,
- render: (text, record) => record.billline?.bill?.invoice_number,
+ render: (text, record) =>
+ (
+ (record.billline?.bill?.invoice_number || "") +
+ " " +
+ (record.manualinvoicenumber || "")
+ ).trim(),
},
{
title: t("inventory.labels.fromvendor"),
@@ -50,7 +74,12 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
//sorter: true, // (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
//sortOrder: sortcolumn === "ownr_ln" && sortorder,
- render: (text, record) => record.billline?.bill?.vendor?.name,
+ render: (text, record) =>
+ (
+ (record.billline?.bill?.vendor?.name || "") +
+ " " +
+ (record.manualvendor || "")
+ ).trim(),
},
{
title: t("billlines.fields.actual_price"),
@@ -70,6 +99,11 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
{record.actual_cost}
),
},
+ {
+ title: t("inventory.fields.comment"),
+ dataIndex: "comment",
+ key: "comment",
+ },
{
title: t("inventory.labels.consumedbyjob"),
dataIndex: "consumedbyjob",
@@ -85,6 +119,30 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
),
},
+ {
+ title: t("general.labels.actions"),
+ dataIndex: "actions",
+ key: "actions",
+
+ ellipsis: true,
+ render: (text, record) => (
+
+
+
+
+ ),
+ },
];
const handleTableChange = (pagination, filters, sorter) => {
@@ -113,7 +171,16 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
>
)}
-
+
-
-
-
+ {Simple_Inventory.treatment === "on" && (
+ <>
+
+
+
+
+
+
+ >
+ )}
);
diff --git a/client/src/graphql/inventory.queries.js b/client/src/graphql/inventory.queries.js
index 51efcd3b8..1bf9d5928 100644
--- a/client/src/graphql/inventory.queries.js
+++ b/client/src/graphql/inventory.queries.js
@@ -52,6 +52,10 @@ export const QUERY_OUTSTANDING_INVENTORY = gql`
quantity
billlineid
line_desc
+ comment
+ manualinvoicenumber
+ manualvendor
+ consumedbybillid
billline {
bill {
invoice_number
@@ -83,6 +87,10 @@ export const QUERY_INVENTORY_PAGINATED = gql`
line_desc
actual_price
actual_cost
+ comment
+ manualinvoicenumber
+ manualvendor
+ consumedbybillid
bill {
id
invoice_number
@@ -96,6 +104,12 @@ export const QUERY_INVENTORY_PAGINATED = gql`
bill {
id
invoice_number
+ job {
+ id
+ v_make_desc
+ v_model_desc
+ v_model_yr
+ }
vendor {
id
name
@@ -113,3 +127,55 @@ export const QUERY_INVENTORY_PAGINATED = gql`
}
}
`;
+
+export const DELETE_INVENTORY_LINE = gql`
+ mutation DELETE_INVENTORY_LINE($lineId: uuid!) {
+ delete_inventory_by_pk(id: $lineId) {
+ id
+ }
+ }
+`;
+
+export const INSERT_INVENTORY_LINE = gql`
+ mutation INSERT_INVENTORY_LINE($inventoryItem: inventory_insert_input!) {
+ insert_inventory_one(object: $inventoryItem) {
+ id
+ line_desc
+ consumedbybillid
+ billlineid
+ actual_price
+ actual_cost
+ comment
+ manualinvoicenumber
+ manualvendor
+ bill {
+ invoice_number
+ }
+ }
+ }
+`;
+
+export const UPDATE_INVENTORY_LINE = gql`
+ mutation UPDATE_INVENTORY_LINE(
+ $inventoryId: uuid!
+ $inventoryItem: inventory_set_input!
+ ) {
+ update_inventory_by_pk(
+ pk_columns: { id: $inventoryId }
+ _set: $inventoryItem
+ ) {
+ id
+ line_desc
+ consumedbybillid
+ billlineid
+ actual_price
+ actual_cost
+ comment
+ manualinvoicenumber
+ manualvendor
+ bill {
+ invoice_number
+ }
+ }
+ }
+`;
diff --git a/client/src/pages/inventory/inventory.page.jsx b/client/src/pages/inventory/inventory.page.jsx
index 26cc2f2dc..f7c4eca31 100644
--- a/client/src/pages/inventory/inventory.page.jsx
+++ b/client/src/pages/inventory/inventory.page.jsx
@@ -7,6 +7,7 @@ import {
setSelectedHeader,
} from "../../redux/application/application.actions";
import InventoryList from "../../components/inventory-list/inventory-list.container";
+import InventoryUpsertModalContainer from "../../components/inventory-upsert-modal/inventory-upsert-modal.container";
const mapDispatchToProps = (dispatch) => ({
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
@@ -24,6 +25,7 @@ export function InventoryPage({ setBreadcrumbs, setSelectedHeader }) {
return (
+
);
diff --git a/client/src/redux/modals/modals.reducer.js b/client/src/redux/modals/modals.reducer.js
index a2fde0c7e..72859b08f 100644
--- a/client/src/redux/modals/modals.reducer.js
+++ b/client/src/redux/modals/modals.reducer.js
@@ -23,6 +23,7 @@ const INITIAL_STATE = {
reportCenter: { ...baseModal },
partsReceive: { ...baseModal },
contractFinder: { ...baseModal },
+ inventoryUpsert: { ...baseModal },
ca_bc_eftTableConvert: { ...baseModal },
};
diff --git a/client/src/redux/modals/modals.selectors.js b/client/src/redux/modals/modals.selectors.js
index 410aebd3b..82d4f706d 100644
--- a/client/src/redux/modals/modals.selectors.js
+++ b/client/src/redux/modals/modals.selectors.js
@@ -70,6 +70,10 @@ export const selectContractFinder = createSelector(
[selectModals],
(modals) => modals.contractFinder
);
+export const selectInventoryUpsert = createSelector(
+ [selectModals],
+ (modals) => modals.inventoryUpsert
+);
export const selectCaBcEtfTableConvert = createSelector(
[selectModals],
diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json
index 94299f2e5..c11263fe2 100644
--- a/client/src/translations/en_us/common.json
+++ b/client/src/translations/en_us/common.json
@@ -355,6 +355,7 @@
"page": "Employees -> List"
},
"inventory": {
+ "delete": "Inventory -> Delete",
"list": "Inventory -> List"
},
"jobs": {
@@ -1079,13 +1080,21 @@
"actions": {
"addtoinventory": "Add to Inventory",
"addtoro": "Add to RO",
- "consumefrominventory": "Consume from Inventory?"
+ "consumefrominventory": "Consume from Inventory?",
+ "edit": "Edit Inventory LIne",
+ "new": "New Inventory Line"
},
"errors": {
"inserting": "Error inserting inventory item. {{error}}"
},
+ "fields": {
+ "comment": "Comment",
+ "manualinvoicenumber": "Invoice Number",
+ "manualvendor": "Vendor"
+ },
"labels": {
"consumedbyjob": "Consumed by Job",
+ "deleteconfirm": "Are you sure you want to delete this from inventory? The associated bill will not be modified or deleted. ",
"frombillinvoicenumber": "Original Bill Invoice Number",
"fromvendor": "Original Bill Vendor",
"inventory": "Inventory",
@@ -1093,7 +1102,9 @@
"showavailable": "Show Only Available Inventory"
},
"successes": {
- "inserted": "Added line to inventory."
+ "deleted": "Inventory lined deleted.",
+ "inserted": "Added line to inventory.",
+ "updated": "Inventory line updated."
}
},
"joblines": {
diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json
index afefc5c9b..25d8103dd 100644
--- a/client/src/translations/es/common.json
+++ b/client/src/translations/es/common.json
@@ -355,6 +355,7 @@
"page": ""
},
"inventory": {
+ "delete": "",
"list": ""
},
"jobs": {
@@ -1079,13 +1080,21 @@
"actions": {
"addtoinventory": "",
"addtoro": "",
- "consumefrominventory": ""
+ "consumefrominventory": "",
+ "edit": "",
+ "new": ""
},
"errors": {
"inserting": ""
},
+ "fields": {
+ "comment": "",
+ "manualinvoicenumber": "",
+ "manualvendor": ""
+ },
"labels": {
"consumedbyjob": "",
+ "deleteconfirm": "",
"frombillinvoicenumber": "",
"fromvendor": "",
"inventory": "",
@@ -1093,7 +1102,9 @@
"showavailable": ""
},
"successes": {
- "inserted": ""
+ "deleted": "",
+ "inserted": "",
+ "updated": ""
}
},
"joblines": {
diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json
index ccc887091..b0b95f0ba 100644
--- a/client/src/translations/fr/common.json
+++ b/client/src/translations/fr/common.json
@@ -355,6 +355,7 @@
"page": ""
},
"inventory": {
+ "delete": "",
"list": ""
},
"jobs": {
@@ -1079,13 +1080,21 @@
"actions": {
"addtoinventory": "",
"addtoro": "",
- "consumefrominventory": ""
+ "consumefrominventory": "",
+ "edit": "",
+ "new": ""
},
"errors": {
"inserting": ""
},
+ "fields": {
+ "comment": "",
+ "manualinvoicenumber": "",
+ "manualvendor": ""
+ },
"labels": {
"consumedbyjob": "",
+ "deleteconfirm": "",
"frombillinvoicenumber": "",
"fromvendor": "",
"inventory": "",
@@ -1093,7 +1102,9 @@
"showavailable": ""
},
"successes": {
- "inserted": ""
+ "deleted": "",
+ "inserted": "",
+ "updated": ""
}
},
"joblines": {
diff --git a/client/src/utils/CleanAxios.js b/client/src/utils/CleanAxios.js
index 19b71e969..0ddc62be6 100644
--- a/client/src/utils/CleanAxios.js
+++ b/client/src/utils/CleanAxios.js
@@ -6,6 +6,8 @@ if (process.env.NODE_ENV === "production") {
process.env.REACT_APP_AXIOS_BASE_API_URL || "https://api.imex.online/";
}
+axios.defaults.withCredentials = true;
+
export const axiosAuthInterceptorId = axios.interceptors.request.use(
async (config) => {
if (!config.headers.Authorization) {
diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml
index cb631341f..d41498645 100644
--- a/hasura/metadata/tables.yaml
+++ b/hasura/metadata/tables.yaml
@@ -2166,11 +2166,14 @@
- actual_cost
- actual_price
- billlineid
+ - comment
- consumedbybillid
- created_at
- id
- joblineid
- line_desc
+ - manualinvoicenumber
+ - manualvendor
- quantity
- shopid
- updated_at
@@ -2182,11 +2185,14 @@
- actual_cost
- actual_price
- billlineid
+ - comment
- consumedbybillid
- created_at
- id
- joblineid
- line_desc
+ - manualinvoicenumber
+ - manualvendor
- quantity
- shopid
- updated_at
@@ -2207,11 +2213,14 @@
- actual_cost
- actual_price
- billlineid
+ - comment
- consumedbybillid
- created_at
- id
- joblineid
- line_desc
+ - manualinvoicenumber
+ - manualvendor
- quantity
- shopid
- updated_at
@@ -2225,6 +2234,18 @@
- active:
_eq: true
check: null
+ delete_permissions:
+ - role: user
+ permission:
+ filter:
+ bodyshop:
+ associations:
+ _and:
+ - user:
+ authid:
+ _eq: X-Hasura-User-Id
+ - active:
+ _eq: true
- table:
schema: public
name: ioevents
diff --git a/hasura/migrations/1654731244827_alter_table_public_inventory_add_column_manualinvoicenumber/down.sql b/hasura/migrations/1654731244827_alter_table_public_inventory_add_column_manualinvoicenumber/down.sql
new file mode 100644
index 000000000..876d914dd
--- /dev/null
+++ b/hasura/migrations/1654731244827_alter_table_public_inventory_add_column_manualinvoicenumber/down.sql
@@ -0,0 +1,4 @@
+-- Could not auto-generate a down migration.
+-- Please write an appropriate down migration for the SQL below:
+-- alter table "public"."inventory" add column "manualinvoicenumber" text
+-- null;
diff --git a/hasura/migrations/1654731244827_alter_table_public_inventory_add_column_manualinvoicenumber/up.sql b/hasura/migrations/1654731244827_alter_table_public_inventory_add_column_manualinvoicenumber/up.sql
new file mode 100644
index 000000000..4f00baf8c
--- /dev/null
+++ b/hasura/migrations/1654731244827_alter_table_public_inventory_add_column_manualinvoicenumber/up.sql
@@ -0,0 +1,2 @@
+alter table "public"."inventory" add column "manualinvoicenumber" text
+ null;
diff --git a/hasura/migrations/1654731253232_alter_table_public_inventory_add_column_comment/down.sql b/hasura/migrations/1654731253232_alter_table_public_inventory_add_column_comment/down.sql
new file mode 100644
index 000000000..8c1ef5a86
--- /dev/null
+++ b/hasura/migrations/1654731253232_alter_table_public_inventory_add_column_comment/down.sql
@@ -0,0 +1,4 @@
+-- Could not auto-generate a down migration.
+-- Please write an appropriate down migration for the SQL below:
+-- alter table "public"."inventory" add column "comment" text
+-- null;
diff --git a/hasura/migrations/1654731253232_alter_table_public_inventory_add_column_comment/up.sql b/hasura/migrations/1654731253232_alter_table_public_inventory_add_column_comment/up.sql
new file mode 100644
index 000000000..9d6de6e5d
--- /dev/null
+++ b/hasura/migrations/1654731253232_alter_table_public_inventory_add_column_comment/up.sql
@@ -0,0 +1,2 @@
+alter table "public"."inventory" add column "comment" text
+ null;
diff --git a/hasura/migrations/1654731265455_alter_table_public_inventory_add_column_manualvendor/down.sql b/hasura/migrations/1654731265455_alter_table_public_inventory_add_column_manualvendor/down.sql
new file mode 100644
index 000000000..e89c2f198
--- /dev/null
+++ b/hasura/migrations/1654731265455_alter_table_public_inventory_add_column_manualvendor/down.sql
@@ -0,0 +1,4 @@
+-- Could not auto-generate a down migration.
+-- Please write an appropriate down migration for the SQL below:
+-- alter table "public"."inventory" add column "manualvendor" text
+-- null;
diff --git a/hasura/migrations/1654731265455_alter_table_public_inventory_add_column_manualvendor/up.sql b/hasura/migrations/1654731265455_alter_table_public_inventory_add_column_manualvendor/up.sql
new file mode 100644
index 000000000..3d8e9c871
--- /dev/null
+++ b/hasura/migrations/1654731265455_alter_table_public_inventory_add_column_manualvendor/up.sql
@@ -0,0 +1,2 @@
+alter table "public"."inventory" add column "manualvendor" text
+ null;
diff --git a/hasura/migrations/1654733904736_alter_table_public_inventory_alter_column_quantity/down.sql b/hasura/migrations/1654733904736_alter_table_public_inventory_alter_column_quantity/down.sql
new file mode 100644
index 000000000..a75b52e85
--- /dev/null
+++ b/hasura/migrations/1654733904736_alter_table_public_inventory_alter_column_quantity/down.sql
@@ -0,0 +1 @@
+ALTER TABLE "public"."inventory" ALTER COLUMN "quantity" drop default;
diff --git a/hasura/migrations/1654733904736_alter_table_public_inventory_alter_column_quantity/up.sql b/hasura/migrations/1654733904736_alter_table_public_inventory_alter_column_quantity/up.sql
new file mode 100644
index 000000000..66e3ac26d
--- /dev/null
+++ b/hasura/migrations/1654733904736_alter_table_public_inventory_alter_column_quantity/up.sql
@@ -0,0 +1 @@
+alter table "public"."inventory" alter column "quantity" set default '1';
diff --git a/server.js b/server.js
index 952d1cc67..d3b809531 100644
--- a/server.js
+++ b/server.js
@@ -36,6 +36,7 @@ const io = new Server(server, {
"https://www.imex.online",
],
methods: ["GET", "POST"],
+ credentials: true,
},
});
exports.io = io;
@@ -48,7 +49,7 @@ app.use(bodyParser.json({ limit: "50mb" }));
app.use(bodyParser.urlencoded({ limit: "50mb", extended: true }));
//app.use(enforce.HTTPS({ trustProtoHeader: true }));
app.use(
- cors()
+ cors({ credentials: true })
// cors({
// credentials: true,
// origin: [
|