Added parts location to receiving an invoice. BOD-357
This commit is contained in:
@@ -39,7 +39,7 @@ function InvoiceEnterModalContainer({
|
||||
|
||||
const handleFinish = (values) => {
|
||||
setLoading(true);
|
||||
const { upload, ...remainingValues } = values;
|
||||
const { upload, location, ...remainingValues } = values;
|
||||
insertInvoice({
|
||||
variables: {
|
||||
invoice: [
|
||||
@@ -67,6 +67,7 @@ function InvoiceEnterModalContainer({
|
||||
.filter((il) => il.joblineid !== "noline")
|
||||
.map((li) => li.joblineid),
|
||||
status: bodyshop.md_order_statuses.default_received || "Received*",
|
||||
location: location,
|
||||
},
|
||||
}).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 { 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 FormDatePicker from "../form-date-picker/form-date-picker.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 "./invoice-form.styles.scss";
|
||||
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,
|
||||
vendorAutoCompleteOptions,
|
||||
lineData,
|
||||
@@ -143,6 +154,19 @@ export default function InvoiceFormComponent({
|
||||
>
|
||||
<CurrencyInput min={0} />
|
||||
</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>
|
||||
<InvoiceFormLines
|
||||
lineData={lineData}
|
||||
@@ -242,3 +266,8 @@ export default function InvoiceFormComponent({
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(InvoiceFormComponent);
|
||||
|
||||
@@ -12,10 +12,10 @@ export default function JobInvoiceTotals({ loading, invoices, jobTotals }) {
|
||||
if (loading) return <LoadingSkeleton />;
|
||||
if (!!!jobTotals)
|
||||
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 });
|
||||
invoices.forEach((i) =>
|
||||
@@ -33,7 +33,7 @@ export default function JobInvoiceTotals({ loading, invoices, jobTotals }) {
|
||||
const discrepancy = Dinero(totals.parts.parts.total).subtract(invoiceTotals);
|
||||
|
||||
return (
|
||||
<div className='job-invoices-totals-container'>
|
||||
<div className="job-invoices-totals-container">
|
||||
<Statistic
|
||||
title={t("jobs.labels.partstotal")}
|
||||
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`
|
||||
mutation UPDATE_JOB_LINE_STATUS($ids: [uuid!]!, $status: String!) {
|
||||
update_joblines(where: { id: { _in: $ids } }, _set: { status: $status }) {
|
||||
mutation UPDATE_JOB_LINE_STATUS(
|
||||
$ids: [uuid!]!
|
||||
$status: String!
|
||||
$location: String
|
||||
) {
|
||||
update_joblines(
|
||||
where: { id: { _in: $ids } }
|
||||
_set: { status: $status, location: $location }
|
||||
) {
|
||||
affected_rows
|
||||
returning {
|
||||
id
|
||||
status
|
||||
location
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -106,6 +118,7 @@ export const UPDATE_JOB_LINE = gql`
|
||||
oem_partno
|
||||
notes
|
||||
location
|
||||
status
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user