Added automatic parts order receiving BOD-218
This commit is contained in:
@@ -101,6 +101,7 @@ function InvoiceEnterModalContainer({
|
||||
|
||||
if (enterAgain) {
|
||||
form.resetFields();
|
||||
form.setFieldsValue({ invoicelines: [] });
|
||||
} else {
|
||||
toggleModalVisible();
|
||||
}
|
||||
@@ -162,7 +163,6 @@ function InvoiceEnterModalContainer({
|
||||
form={form}
|
||||
onFinishFailed={() => {
|
||||
setEnterAgain(false);
|
||||
console.log("Finish failed");
|
||||
}}
|
||||
initialValues={{
|
||||
jobid:
|
||||
@@ -172,6 +172,7 @@ function InvoiceEnterModalContainer({
|
||||
federal_tax_rate: bodyshop.invoice_tax_rates.federal_tax_rate || 0,
|
||||
state_tax_rate: bodyshop.invoice_tax_rates.state_tax_rate || 0,
|
||||
local_tax_rate: bodyshop.invoice_tax_rates.local_tax_rate || 0,
|
||||
...invoiceEnterModal.context.invoice,
|
||||
}}
|
||||
>
|
||||
<InvoiceFormContainer form={form} />
|
||||
|
||||
@@ -41,7 +41,6 @@ export default function InvoiceEnterModalLinesComponent({
|
||||
"invoicelines",
|
||||
]).invoicelines.map((item, idx) => {
|
||||
if (idx === index) {
|
||||
console.log("opt", opt);
|
||||
return {
|
||||
...item,
|
||||
line_desc: opt.line_desc,
|
||||
@@ -60,6 +59,7 @@ export default function InvoiceEnterModalLinesComponent({
|
||||
}}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label={t("invoicelines.fields.line_desc")}
|
||||
key={`${index}line_desc`}
|
||||
|
||||
@@ -4,7 +4,7 @@ import AlertComponent from "../alert/alert.component";
|
||||
import InvoicesListTableComponent from "../invoices-list-table/invoices-list-table.component";
|
||||
import JobInvoicesTotalsComponent from "../job-invoices-total/job-invoices-total.component";
|
||||
import PartsOrderModal from "../parts-order-modal/parts-order-modal.container";
|
||||
import { PartsOrderListTableComponent } from "../parts-order-list-table/parts-order-list-table.component";
|
||||
import PartsOrderListTableComponent from "../parts-order-list-table/parts-order-list-table.component";
|
||||
const tableCol = {
|
||||
xs: {
|
||||
span: 24,
|
||||
|
||||
@@ -5,20 +5,35 @@ import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||
import { DateFormatter } from "../../utils/DateFormatter";
|
||||
import { alphaSort } from "../../utils/sorters";
|
||||
import PartsOrderLineBackorderButton from "../parts-order-line-backorder-button/parts-order-line-backorder-button.component";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({});
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setInvoiceEnterContext: (context) =>
|
||||
dispatch(setModalContext({ context: context, modal: "invoiceEnter" })),
|
||||
});
|
||||
|
||||
export function PartsOrderListTableComponent({
|
||||
setInvoiceEnterContext,
|
||||
bodyshop,
|
||||
job,
|
||||
loading,
|
||||
invoicesQuery,
|
||||
|
||||
handleOnRowClick,
|
||||
}) {
|
||||
const responsibilityCenters = bodyshop.md_responsibility_centers;
|
||||
|
||||
const { t } = useTranslation();
|
||||
const [state, setState] = useState({
|
||||
sortedInfo: {},
|
||||
@@ -71,6 +86,43 @@ export function PartsOrderListTableComponent({
|
||||
<DateFormatter>{record.deliver_by}</DateFormatter>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t("general.labels.actions"),
|
||||
dataIndex: "actions",
|
||||
key: "actions",
|
||||
render: (text, record) => (
|
||||
<Button
|
||||
onClick={() => {
|
||||
logImEXEvent("parts_order_receive_invoice");
|
||||
|
||||
setInvoiceEnterContext({
|
||||
actions: { refetch: refetch },
|
||||
context: {
|
||||
job: job,
|
||||
invoice: {
|
||||
vendorid: record.vendor.id,
|
||||
invoicelines: record.parts_order_lines.map((pol) => {
|
||||
return {
|
||||
joblineid: pol.job_line_id,
|
||||
line_desc: pol.line_desc,
|
||||
quantity: pol.quantity,
|
||||
actual_price: pol.act_price,
|
||||
cost_center: pol.jobline.part_type
|
||||
? responsibilityCenters.defaults.costs[
|
||||
pol.jobline.part_type
|
||||
] || null
|
||||
: null,
|
||||
};
|
||||
}),
|
||||
},
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t("parts_orders.actions.receiveinvoice")}
|
||||
</Button>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
@@ -229,4 +281,7 @@ export function PartsOrderListTableComponent({
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default connect(null, mapDispatchToProps)(PartsOrderListTableComponent);
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(PartsOrderListTableComponent);
|
||||
|
||||
@@ -79,6 +79,10 @@ export const QUERY_INVOICES_BY_JOBID = gql`
|
||||
line_remarks
|
||||
quantity
|
||||
job_line_id
|
||||
jobline {
|
||||
id
|
||||
part_type
|
||||
}
|
||||
backordered_eta
|
||||
backordered_on
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user