diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 31b297cd9..4101a134e 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -17287,6 +17287,27 @@ + + addtoro + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + consumefrominventory 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 d8fb121d0..e9403a0f1 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 @@ -7,9 +7,11 @@ import "./bill-inventory-table.styles.scss"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; +import { selectBillEnterModal } from "../../redux/modals/modals.selectors"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, + billEnterModal: selectBillEnterModal, }); const mapDispatchToProps = (dispatch) => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) @@ -17,6 +19,7 @@ const mapDispatchToProps = (dispatch) => ({ export default connect(mapStateToProps, mapDispatchToProps)(BillInventoryTable); export function BillInventoryTable({ + billEnterModal, bodyshop, form, billEdit, @@ -28,11 +31,18 @@ export function BillInventoryTable({ useEffect(() => { if (inventoryData) { form.setFieldsValue({ - inventory: inventoryData.inventory, + inventory: billEnterModal.context.consumeinventoryid + ? inventoryData.inventory.map((i) => { + if (i.id === billEnterModal.context.consumeinventoryid) + i.consumefrominventory = true; + return i; + }) + : inventoryData.inventory, }); } - }, [inventoryData, form]); + }, [inventoryData, form, billEnterModal.context.consumeinventoryid]); + console.log(form.getFieldsValue()); return ( prev.vendorid !== cur.vendorid} diff --git a/client/src/components/inventory-bill-ro/inventory-bill-ro.component.jsx b/client/src/components/inventory-bill-ro/inventory-bill-ro.component.jsx new file mode 100644 index 000000000..f83811ed7 --- /dev/null +++ b/client/src/components/inventory-bill-ro/inventory-bill-ro.component.jsx @@ -0,0 +1,65 @@ +import { Button } from "antd"; +import React from "react"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { setModalContext } from "../../redux/modals/modals.actions"; +import { selectBodyshop } from "../../redux/user/user.selectors"; +import moment from "moment"; +import { useTranslation } from "react-i18next"; +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop, +}); +const mapDispatchToProps = (dispatch) => ({ + setBillEnterContext: (context) => + dispatch(setModalContext({ context: context, modal: "billEnter" })), +}); +export default connect(mapStateToProps, mapDispatchToProps)(InventoryBillRo); +export function InventoryBillRo({ + bodyshop, + setBillEnterContext, + inventoryline, +}) { + const { t } = useTranslation(); + return ( + + ); +} diff --git a/client/src/components/inventory-list/inventory-list.component.jsx b/client/src/components/inventory-list/inventory-list.component.jsx index 58210eb94..95dcdea13 100644 --- a/client/src/components/inventory-list/inventory-list.component.jsx +++ b/client/src/components/inventory-list/inventory-list.component.jsx @@ -4,10 +4,11 @@ import queryString from "query-string"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useHistory, useLocation } from "react-router-dom"; +import { Link, useHistory, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; +import InventoryBillRo from "../inventory-bill-ro/inventory-bill-ro.component"; const mapStateToProps = createStructuredSelector({ //currentUser: selectCurrentUser bodyshop: selectBodyshop, @@ -75,7 +76,14 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) { key: "consumedbyjob", ellipsis: true, - render: (text, record) => record.bill?.job?.ro_number, + render: (text, record) => + record.bill?.job?.ro_number ? ( + + {record.bill?.job?.ro_number} + + ) : ( + + ), }, ]; diff --git a/client/src/graphql/inventory.queries.js b/client/src/graphql/inventory.queries.js index 51b713e92..51efcd3b8 100644 --- a/client/src/graphql/inventory.queries.js +++ b/client/src/graphql/inventory.queries.js @@ -42,7 +42,10 @@ export const UPDATE_INVENTORY_LINES = gql` export const QUERY_OUTSTANDING_INVENTORY = gql` query QUERY_OUTSTANDING_INVENTORY { - inventory(where: { consumedbybillid: { _is_null: true } }) { + inventory( + where: { consumedbybillid: { _is_null: true } } + order_by: { line_desc: asc } + ) { id actual_cost actual_price diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index c55a48010..c40bfe2be 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1076,6 +1076,7 @@ "inventory": { "actions": { "addtoinventory": "Add to Inventory", + "addtoro": "Add to RO", "consumefrominventory": "Consume from Inventory?" }, "errors": { diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index ca89fc4d9..2793b4bf1 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1076,6 +1076,7 @@ "inventory": { "actions": { "addtoinventory": "", + "addtoro": "", "consumefrominventory": "" }, "errors": { diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index bd63176f0..b7011de21 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1076,6 +1076,7 @@ "inventory": { "actions": { "addtoinventory": "", + "addtoro": "", "consumefrominventory": "" }, "errors": {