Added parts location to receiving an invoice. BOD-357
This commit is contained in:
@@ -39,7 +39,7 @@ function InvoiceEnterModalContainer({
|
|||||||
|
|
||||||
const handleFinish = (values) => {
|
const handleFinish = (values) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { upload, ...remainingValues } = values;
|
const { upload, location, ...remainingValues } = values;
|
||||||
insertInvoice({
|
insertInvoice({
|
||||||
variables: {
|
variables: {
|
||||||
invoice: [
|
invoice: [
|
||||||
@@ -67,6 +67,7 @@ function InvoiceEnterModalContainer({
|
|||||||
.filter((il) => il.joblineid !== "noline")
|
.filter((il) => il.joblineid !== "noline")
|
||||||
.map((li) => li.joblineid),
|
.map((li) => li.joblineid),
|
||||||
status: bodyshop.md_order_statuses.default_received || "Received*",
|
status: bodyshop.md_order_statuses.default_received || "Received*",
|
||||||
|
location: location,
|
||||||
},
|
},
|
||||||
}).then((joblineresult) => {
|
}).then((joblineresult) => {
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import { Button, Form, Input, Statistic, Switch, Upload } from "antd";
|
import { Button, Form, Input, Select, Statistic, Switch, Upload } from "antd";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||||
@@ -9,8 +12,16 @@ import VendorSearchSelect from "../vendor-search-select/vendor-search-select.com
|
|||||||
import InvoiceFormLines from "./invoice-form.lines.component";
|
import InvoiceFormLines from "./invoice-form.lines.component";
|
||||||
import "./invoice-form.styles.scss";
|
import "./invoice-form.styles.scss";
|
||||||
import { CalculateInvoiceTotal } from "./invoice-form.totals.utility";
|
import { CalculateInvoiceTotal } from "./invoice-form.totals.utility";
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
//currentUser: selectCurrentUser
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
|
||||||
export default function InvoiceFormComponent({
|
export function InvoiceFormComponent({
|
||||||
|
bodyshop,
|
||||||
form,
|
form,
|
||||||
vendorAutoCompleteOptions,
|
vendorAutoCompleteOptions,
|
||||||
lineData,
|
lineData,
|
||||||
@@ -143,6 +154,19 @@ export default function InvoiceFormComponent({
|
|||||||
>
|
>
|
||||||
<CurrencyInput min={0} />
|
<CurrencyInput min={0} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
label={t("invoices.fields.allpartslocation")}
|
||||||
|
name="location"
|
||||||
|
>
|
||||||
|
<Select style={{ width: "10rem" }}>
|
||||||
|
{bodyshop.md_parts_locations.map((loc, idx) => (
|
||||||
|
<Select.Option key={idx} value={loc}>
|
||||||
|
{loc}
|
||||||
|
</Select.Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
</div>
|
</div>
|
||||||
<InvoiceFormLines
|
<InvoiceFormLines
|
||||||
lineData={lineData}
|
lineData={lineData}
|
||||||
@@ -242,3 +266,8 @@ export default function InvoiceFormComponent({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(InvoiceFormComponent);
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ export default function JobInvoiceTotals({ loading, invoices, jobTotals }) {
|
|||||||
if (loading) return <LoadingSkeleton />;
|
if (loading) return <LoadingSkeleton />;
|
||||||
if (!!!jobTotals)
|
if (!!!jobTotals)
|
||||||
return (
|
return (
|
||||||
<AlertComponent type='error' message={t("jobs.errors.nofinancial")} />
|
<AlertComponent type="error" message={t("jobs.errors.nofinancial")} />
|
||||||
);
|
);
|
||||||
|
|
||||||
const totals = JSON.parse(jobTotals);
|
const totals = jobTotals;
|
||||||
|
|
||||||
let invoiceTotals = Dinero({ amount: 0 });
|
let invoiceTotals = Dinero({ amount: 0 });
|
||||||
invoices.forEach((i) =>
|
invoices.forEach((i) =>
|
||||||
@@ -33,7 +33,7 @@ export default function JobInvoiceTotals({ loading, invoices, jobTotals }) {
|
|||||||
const discrepancy = Dinero(totals.parts.parts.total).subtract(invoiceTotals);
|
const discrepancy = Dinero(totals.parts.parts.total).subtract(invoiceTotals);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='job-invoices-totals-container'>
|
<div className="job-invoices-totals-container">
|
||||||
<Statistic
|
<Statistic
|
||||||
title={t("jobs.labels.partstotal")}
|
title={t("jobs.labels.partstotal")}
|
||||||
value={Dinero(totals.parts.parts.total).toFormat()}
|
value={Dinero(totals.parts.parts.total).toFormat()}
|
||||||
|
|||||||
@@ -76,9 +76,21 @@ export const GET_LINE_TICKET_BY_PK = gql`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export const UPDATE_JOB_LINE_STATUS = gql`
|
export const UPDATE_JOB_LINE_STATUS = gql`
|
||||||
mutation UPDATE_JOB_LINE_STATUS($ids: [uuid!]!, $status: String!) {
|
mutation UPDATE_JOB_LINE_STATUS(
|
||||||
update_joblines(where: { id: { _in: $ids } }, _set: { status: $status }) {
|
$ids: [uuid!]!
|
||||||
|
$status: String!
|
||||||
|
$location: String
|
||||||
|
) {
|
||||||
|
update_joblines(
|
||||||
|
where: { id: { _in: $ids } }
|
||||||
|
_set: { status: $status, location: $location }
|
||||||
|
) {
|
||||||
affected_rows
|
affected_rows
|
||||||
|
returning {
|
||||||
|
id
|
||||||
|
status
|
||||||
|
location
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@@ -106,6 +118,7 @@ export const UPDATE_JOB_LINE = gql`
|
|||||||
oem_partno
|
oem_partno
|
||||||
notes
|
notes
|
||||||
location
|
location
|
||||||
|
status
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user