IO-1914 Consume from inventory screen.
This commit is contained in:
@@ -17287,6 +17287,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>addtoro</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>consumefrominventory</name>
|
<name>consumefrominventory</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -7,9 +7,11 @@ import "./bill-inventory-table.styles.scss";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import { selectBillEnterModal } from "../../redux/modals/modals.selectors";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
|
billEnterModal: selectBillEnterModal,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
@@ -17,6 +19,7 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
export default connect(mapStateToProps, mapDispatchToProps)(BillInventoryTable);
|
export default connect(mapStateToProps, mapDispatchToProps)(BillInventoryTable);
|
||||||
|
|
||||||
export function BillInventoryTable({
|
export function BillInventoryTable({
|
||||||
|
billEnterModal,
|
||||||
bodyshop,
|
bodyshop,
|
||||||
form,
|
form,
|
||||||
billEdit,
|
billEdit,
|
||||||
@@ -28,11 +31,18 @@ export function BillInventoryTable({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (inventoryData) {
|
if (inventoryData) {
|
||||||
form.setFieldsValue({
|
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 (
|
return (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
shouldUpdate={(prev, cur) => prev.vendorid !== cur.vendorid}
|
shouldUpdate={(prev, cur) => prev.vendorid !== cur.vendorid}
|
||||||
|
|||||||
@@ -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 (
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
setBillEnterContext({
|
||||||
|
actions: {
|
||||||
|
//refetch: refetch
|
||||||
|
},
|
||||||
|
context: {
|
||||||
|
disableInvNumber: true,
|
||||||
|
//job: { id: job.id },
|
||||||
|
consumeinventoryid: inventoryline.id,
|
||||||
|
bill: {
|
||||||
|
vendorid: bodyshop.inhousevendorid,
|
||||||
|
invoice_number: "ih",
|
||||||
|
isinhouse: true,
|
||||||
|
date: moment(),
|
||||||
|
total: 0,
|
||||||
|
|
||||||
|
// billlines: selectedLines.map((p) => {
|
||||||
|
// return {
|
||||||
|
// joblineid: p.id,
|
||||||
|
// actual_price: p.act_price,
|
||||||
|
// actual_cost: 0, //p.act_price,
|
||||||
|
// line_desc: p.line_desc,
|
||||||
|
// line_remarks: p.line_remarks,
|
||||||
|
// part_type: p.part_type,
|
||||||
|
// quantity: p.quantity || 1,
|
||||||
|
// applicable_taxes: {
|
||||||
|
// local: false,
|
||||||
|
// state: false,
|
||||||
|
// federal: false,
|
||||||
|
// },
|
||||||
|
// };
|
||||||
|
// }),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("inventory.actions.addtoro")}
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -4,10 +4,11 @@ import queryString from "query-string";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
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 { createStructuredSelector } from "reselect";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
|
import InventoryBillRo from "../inventory-bill-ro/inventory-bill-ro.component";
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -75,7 +76,14 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
key: "consumedbyjob",
|
key: "consumedbyjob",
|
||||||
|
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (text, record) => record.bill?.job?.ro_number,
|
render: (text, record) =>
|
||||||
|
record.bill?.job?.ro_number ? (
|
||||||
|
<Link to={`/manage/jobs/${record.bill?.job?.id}`}>
|
||||||
|
{record.bill?.job?.ro_number}
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
<InventoryBillRo inventoryline={record} />
|
||||||
|
),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,10 @@ export const UPDATE_INVENTORY_LINES = gql`
|
|||||||
|
|
||||||
export const QUERY_OUTSTANDING_INVENTORY = gql`
|
export const QUERY_OUTSTANDING_INVENTORY = gql`
|
||||||
query QUERY_OUTSTANDING_INVENTORY {
|
query QUERY_OUTSTANDING_INVENTORY {
|
||||||
inventory(where: { consumedbybillid: { _is_null: true } }) {
|
inventory(
|
||||||
|
where: { consumedbybillid: { _is_null: true } }
|
||||||
|
order_by: { line_desc: asc }
|
||||||
|
) {
|
||||||
id
|
id
|
||||||
actual_cost
|
actual_cost
|
||||||
actual_price
|
actual_price
|
||||||
|
|||||||
@@ -1076,6 +1076,7 @@
|
|||||||
"inventory": {
|
"inventory": {
|
||||||
"actions": {
|
"actions": {
|
||||||
"addtoinventory": "Add to Inventory",
|
"addtoinventory": "Add to Inventory",
|
||||||
|
"addtoro": "Add to RO",
|
||||||
"consumefrominventory": "Consume from Inventory?"
|
"consumefrominventory": "Consume from Inventory?"
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
|
|||||||
@@ -1076,6 +1076,7 @@
|
|||||||
"inventory": {
|
"inventory": {
|
||||||
"actions": {
|
"actions": {
|
||||||
"addtoinventory": "",
|
"addtoinventory": "",
|
||||||
|
"addtoro": "",
|
||||||
"consumefrominventory": ""
|
"consumefrominventory": ""
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
|
|||||||
@@ -1076,6 +1076,7 @@
|
|||||||
"inventory": {
|
"inventory": {
|
||||||
"actions": {
|
"actions": {
|
||||||
"addtoinventory": "",
|
"addtoinventory": "",
|
||||||
|
"addtoro": "",
|
||||||
"consumefrominventory": ""
|
"consumefrominventory": ""
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
|
|||||||
Reference in New Issue
Block a user