Added parts returning as a part of BOD-19
This commit is contained in:
@@ -5446,6 +5446,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>return</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>
|
||||||
</children>
|
</children>
|
||||||
</folder_node>
|
</folder_node>
|
||||||
<folder_node>
|
<folder_node>
|
||||||
@@ -12218,6 +12239,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>newpartsorder</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>orderhistory</name>
|
<name>orderhistory</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -12260,6 +12302,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>returnpartsorder</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>
|
||||||
</children>
|
</children>
|
||||||
</folder_node>
|
</folder_node>
|
||||||
<folder_node>
|
<folder_node>
|
||||||
|
|||||||
@@ -1,21 +1,29 @@
|
|||||||
import { Button, Descriptions, Table, Checkbox } from "antd";
|
import { SyncOutlined } from "@ant-design/icons";
|
||||||
|
import { Button, Checkbox, Descriptions, Table } from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { DateFormatter } from "../../utils/DateFormatter";
|
import { DateFormatter } from "../../utils/DateFormatter";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
import { SyncOutlined } from "@ant-design/icons";
|
|
||||||
|
|
||||||
export default function InvoicesListTableComponent({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
setPartsOrderContext: (context) =>
|
||||||
|
dispatch(setModalContext({ context: context, modal: "partsOrder" })),
|
||||||
|
});
|
||||||
|
|
||||||
|
export function InvoicesListTableComponent({
|
||||||
|
job,
|
||||||
loading,
|
loading,
|
||||||
invoices,
|
invoices,
|
||||||
selectedInvoice,
|
selectedInvoice,
|
||||||
handleOnRowClick,
|
handleOnRowClick,
|
||||||
refetch,
|
refetch,
|
||||||
|
setPartsOrderContext,
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
sortedInfo: {},
|
sortedInfo: {},
|
||||||
});
|
});
|
||||||
@@ -61,15 +69,52 @@ export default function InvoicesListTableComponent({
|
|||||||
<CurrencyFormatter>{record.total}</CurrencyFormatter>
|
<CurrencyFormatter>{record.total}</CurrencyFormatter>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: t("invoices.fields.is_credit_memo"),
|
||||||
|
dataIndex: "is_credit_memo",
|
||||||
|
key: "is_credit_memo",
|
||||||
|
sorter: (a, b) => a.is_credit_memo - b.is_credit_memo,
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "is_credit_memo" &&
|
||||||
|
state.sortedInfo.order,
|
||||||
|
render: (text, record) => <Checkbox checked={record.is_credit_memo} />,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: t("general.labels.actions"),
|
title: t("general.labels.actions"),
|
||||||
dataIndex: "actions",
|
dataIndex: "actions",
|
||||||
key: "actions",
|
key: "actions",
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Link
|
<div>
|
||||||
to={`/manage/invoices?invoiceid=${record.id}&vendorid=${record.vendorid}`}>
|
<Link
|
||||||
<Button>{t("invoices.actions.edit")}</Button>
|
to={`/manage/invoices?invoiceid=${record.id}&vendorid=${record.vendorid}`}>
|
||||||
</Link>
|
<Button>{t("invoices.actions.edit")}</Button>
|
||||||
|
</Link>
|
||||||
|
<Button
|
||||||
|
disabled={record.is_credit_memo}
|
||||||
|
onClick={() =>
|
||||||
|
setPartsOrderContext({
|
||||||
|
actions: {},
|
||||||
|
context: {
|
||||||
|
jobId: job.id,
|
||||||
|
vendorId: record.vendorid,
|
||||||
|
returnFromInvoice: record.id,
|
||||||
|
invoiceNumber: record.invoice_number,
|
||||||
|
linesToOrder: record.invoicelines.map((i) => {
|
||||||
|
return {
|
||||||
|
line_desc: i.line_desc,
|
||||||
|
db_price: i.actual_price,
|
||||||
|
act_price: i.actual_cost,
|
||||||
|
quantity: i.quantity,
|
||||||
|
joblineid: i.joblineid,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
isReturn: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}>
|
||||||
|
{t("invoices.actions.return")}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -208,7 +253,7 @@ export default function InvoicesListTableComponent({
|
|||||||
)}
|
)}
|
||||||
expandedRowRender={rowExpander}
|
expandedRowRender={rowExpander}
|
||||||
pagination={{ position: "top", defaultPageSize: 25 }}
|
pagination={{ position: "top", defaultPageSize: 25 }}
|
||||||
columns={columns.map((item) => ({ ...item }))}
|
columns={columns}
|
||||||
rowKey='id'
|
rowKey='id'
|
||||||
dataSource={invoices}
|
dataSource={invoices}
|
||||||
onChange={handleTableChange}
|
onChange={handleTableChange}
|
||||||
@@ -239,3 +284,4 @@ export default function InvoicesListTableComponent({
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
export default connect(null, mapDispatchToProps)(InvoicesListTableComponent);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Button, Table, Statistic, Checkbox } from "antd";
|
import { Checkbox, Statistic, Table } from "antd";
|
||||||
|
import Dinero from "dinero.js";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
import Dinero from "dinero.js";
|
|
||||||
|
|
||||||
export default function JobReconciliationInvoiceTable({
|
export default function JobReconciliationInvoiceTable({
|
||||||
invoiceLineState,
|
invoiceLineState,
|
||||||
|
|||||||
@@ -5,10 +5,7 @@ import { connect } from "react-redux";
|
|||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
||||||
import { selectReconciliation } from "../../redux/modals/modals.selectors";
|
import { selectReconciliation } from "../../redux/modals/modals.selectors";
|
||||||
import {
|
import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors";
|
||||||
selectBodyshop,
|
|
||||||
selectCurrentUser,
|
|
||||||
} from "../../redux/user/user.selectors";
|
|
||||||
import JobReconciliationModalComponent from "./job-reconciliation-modal.component";
|
import JobReconciliationModalComponent from "./job-reconciliation-modal.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
@@ -27,7 +24,7 @@ function InvoiceEnterModalContainer({
|
|||||||
currentUser,
|
currentUser,
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { actions, context, visible } = reconciliationModal;
|
const { context, visible } = reconciliationModal;
|
||||||
const { job, invoices } = context;
|
const { job, invoices } = context;
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Button, Table, Statistic } from "antd";
|
import { Statistic, Table } from "antd";
|
||||||
|
import Dinero from "dinero.js";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
import Dinero from "dinero.js";
|
|
||||||
|
|
||||||
export default function JobReconcilitionPartsTable({
|
export default function JobReconcilitionPartsTable({
|
||||||
jobLineState,
|
jobLineState,
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import AlertComponent from "../alert/alert.component";
|
|||||||
import InvoicesListTableComponent from "../invoices-list-table/invoices-list-table.component";
|
import InvoicesListTableComponent from "../invoices-list-table/invoices-list-table.component";
|
||||||
import JobInvoicesTotalsComponent from "../job-invoices-total/job-invoices-total.component";
|
import JobInvoicesTotalsComponent from "../job-invoices-total/job-invoices-total.component";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container";
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
setInvoiceEnterContext: (context) =>
|
setInvoiceEnterContext: (context) =>
|
||||||
dispatch(setModalContext({ context: context, modal: "invoiceEnter" })),
|
dispatch(setModalContext({ context: context, modal: "invoiceEnter" })),
|
||||||
@@ -24,6 +26,7 @@ export function JobsDetailPliComponent({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
<PartsOrderModalContainer />
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setInvoiceEnterContext({
|
setInvoiceEnterContext({
|
||||||
@@ -59,6 +62,7 @@ export function JobsDetailPliComponent({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<InvoicesListTableComponent
|
<InvoicesListTableComponent
|
||||||
|
job={job}
|
||||||
loading={invoicesQuery.loading}
|
loading={invoicesQuery.loading}
|
||||||
handleOnRowClick={handleOnRowClick}
|
handleOnRowClick={handleOnRowClick}
|
||||||
selectedInvoice={selectedInvoice}
|
selectedInvoice={selectedInvoice}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import CurrencyInput from "../form-items-formatted/currency-form-item.component"
|
|||||||
export default function PartsOrderModalComponent({
|
export default function PartsOrderModalComponent({
|
||||||
vendorList,
|
vendorList,
|
||||||
sendTypeState,
|
sendTypeState,
|
||||||
|
isReturn
|
||||||
}) {
|
}) {
|
||||||
const [sendType, setSendType] = sendTypeState;
|
const [sendType, setSendType] = sendTypeState;
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ export default function PartsOrderModalComponent({
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<VendorSearchSelect options={vendorList} />
|
<VendorSearchSelect options={vendorList} disabled={isReturn} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="deliver_by"
|
name="deliver_by"
|
||||||
|
|||||||
@@ -18,7 +18,11 @@ import {
|
|||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||||
import PartsOrderModalComponent from "./parts-order-modal.component";
|
import PartsOrderModalComponent from "./parts-order-modal.component";
|
||||||
import RenderTemplate from "../../utils/RenderTemplate";
|
import RenderTemplate, {
|
||||||
|
displayTemplateInWindow,
|
||||||
|
} from "../../utils/RenderTemplate";
|
||||||
|
import moment from "moment";
|
||||||
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
@@ -41,7 +45,15 @@ export function PartsOrderModalContainer({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { visible, context, actions } = partsOrderModal;
|
const { visible, context, actions } = partsOrderModal;
|
||||||
const { jobId, linesToOrder } = context;
|
const {
|
||||||
|
jobId,
|
||||||
|
linesToOrder,
|
||||||
|
isReturn,
|
||||||
|
vendorId,
|
||||||
|
returnFromInvoice,
|
||||||
|
invoiceNumber,
|
||||||
|
} = context;
|
||||||
|
|
||||||
const { refetch } = actions;
|
const { refetch } = actions;
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
@@ -56,7 +68,7 @@ export function PartsOrderModalContainer({
|
|||||||
const [insertInvoice] = useMutation(INSERT_NEW_INVOICE);
|
const [insertInvoice] = useMutation(INSERT_NEW_INVOICE);
|
||||||
|
|
||||||
const handleFinish = async (values) => {
|
const handleFinish = async (values) => {
|
||||||
insertPartOrder({
|
const insertResult = await insertPartOrder({
|
||||||
variables: {
|
variables: {
|
||||||
po: [
|
po: [
|
||||||
{
|
{
|
||||||
@@ -67,117 +79,123 @@ export function PartsOrderModalContainer({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
.then((r) => {
|
if (!!insertResult.error) {
|
||||||
updateJobLines({
|
notification["error"]({
|
||||||
variables: {
|
message: t("parts_orders.errors.creating"),
|
||||||
ids: values.parts_order_lines.data.map((item) => item.job_line_id),
|
description: JSON.stringify(insertResult.error),
|
||||||
status: bodyshop.md_order_statuses.default_ordered || "Ordered*",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then((response) => {
|
|
||||||
notification["success"]({
|
|
||||||
message: t("parts_orders.successes.created"),
|
|
||||||
});
|
|
||||||
|
|
||||||
if (values.vendorid === bodyshop.inhousevendorid) {
|
|
||||||
console.log("Inhouse Invoice needs to be psoted.");
|
|
||||||
let invoiceToPost = {
|
|
||||||
vendorid: bodyshop.inhousevendorid,
|
|
||||||
jobid: jobId,
|
|
||||||
total: 0,
|
|
||||||
invoice_number: `${jobId}`, //TODO Add INhouse invoice generation?
|
|
||||||
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,
|
|
||||||
invoicelines: {
|
|
||||||
data: values.parts_order_lines.data.map((p) => {
|
|
||||||
return {
|
|
||||||
joblineid: p.job_line_id,
|
|
||||||
actual_price: 0,
|
|
||||||
actual_cost: 0,
|
|
||||||
line_desc: p.line_desc,
|
|
||||||
quantity: p.quantity || 1,
|
|
||||||
cost_center:
|
|
||||||
bodyshop.md_responsibility_centers.defaults.PAO ||
|
|
||||||
"Other*",
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
insertInvoice({
|
|
||||||
variables: { invoice: invoiceToPost },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (refetch) refetch();
|
|
||||||
toggleModalVisible();
|
|
||||||
|
|
||||||
if (sendType === "e") {
|
|
||||||
//TODO Remove hardcoding
|
|
||||||
setEmailOptions({
|
|
||||||
messageOptions: {
|
|
||||||
to:
|
|
||||||
data.vendors.filter((item) => item.id === values.id)[0] ||
|
|
||||||
null,
|
|
||||||
replyTo: bodyshop.email,
|
|
||||||
},
|
|
||||||
template: {
|
|
||||||
name: "parts_order_confirmation",
|
|
||||||
variables: {
|
|
||||||
id: r.data.insert_parts_orders.returning[0].id,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
RenderTemplate(
|
|
||||||
{
|
|
||||||
name: "parts_order_confirmation",
|
|
||||||
variables: {
|
|
||||||
id: r.data.insert_parts_orders.returning[0].id,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
bodyshop
|
|
||||||
).then((html) => {
|
|
||||||
var newWin = window.open();
|
|
||||||
newWin.document.write(html);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
notification["error"]({
|
|
||||||
message: t("parts_orders.errors.creating"),
|
|
||||||
description: error.message,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//end no good
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
notification["error"]({
|
|
||||||
message: t("parts_orders.errors.creating"),
|
|
||||||
description: error.message,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const jobLinesResult = await updateJobLines({
|
||||||
|
variables: {
|
||||||
|
ids: values.parts_order_lines.data.map((item) => item.job_line_id),
|
||||||
|
status: isReturn
|
||||||
|
? bodyshop.md_order_statuses.default_returned || "Returned*"
|
||||||
|
: bodyshop.md_order_statuses.default_ordered || "Ordered*",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (!!jobLinesResult.errors) {
|
||||||
|
notification["error"]({
|
||||||
|
message: t("parts_orders.errors.creating"),
|
||||||
|
description: JSON.stringify(jobLinesResult.errors),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
notification["success"]({
|
||||||
|
message: t("parts_orders.successes.created"),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (values.vendorid === bodyshop.inhousevendorid) {
|
||||||
|
console.log("Inhouse Invoice needs to be psoted.");
|
||||||
|
let invoiceToPost = {
|
||||||
|
vendorid: bodyshop.inhousevendorid,
|
||||||
|
jobid: jobId,
|
||||||
|
total: 0,
|
||||||
|
invoice_number: `${jobId}`, //TODO Add INhouse invoice generation?
|
||||||
|
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,
|
||||||
|
invoicelines: {
|
||||||
|
data: values.parts_order_lines.data.map((p) => {
|
||||||
|
return {
|
||||||
|
joblineid: p.job_line_id,
|
||||||
|
actual_price: 0,
|
||||||
|
actual_cost: 0,
|
||||||
|
line_desc: p.line_desc,
|
||||||
|
quantity: p.quantity || 1,
|
||||||
|
cost_center:
|
||||||
|
bodyshop.md_responsibility_centers.defaults.PAO || "Other*",
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
await insertInvoice({
|
||||||
|
variables: { invoice: invoiceToPost },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (refetch) refetch();
|
||||||
|
toggleModalVisible();
|
||||||
|
|
||||||
|
if (sendType === "e") {
|
||||||
|
//TODO Remove hardcoding
|
||||||
|
setEmailOptions({
|
||||||
|
messageOptions: {
|
||||||
|
to: data.vendors.filter((item) => item.id === values.id)[0] || null,
|
||||||
|
replyTo: bodyshop.email,
|
||||||
|
},
|
||||||
|
template: {
|
||||||
|
name: isReturn
|
||||||
|
? TemplateList.parts_return_confirmation.key
|
||||||
|
: TemplateList.parts_order_confirmation.key,
|
||||||
|
variables: {
|
||||||
|
id: insertResult.data.insert_parts_orders.returning[0].id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
displayTemplateInWindow(
|
||||||
|
await RenderTemplate(
|
||||||
|
{
|
||||||
|
name: isReturn
|
||||||
|
? TemplateList.parts_return_confirmation.key
|
||||||
|
: TemplateList.parts_order_confirmation.key,
|
||||||
|
variables: {
|
||||||
|
id: insertResult.data.insert_parts_orders.returning[0].id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const initialValues =
|
const initialValues = {
|
||||||
linesToOrder &&
|
jobid: jobId,
|
||||||
linesToOrder.reduce((acc, value) => {
|
return: isReturn,
|
||||||
acc.push({
|
deliver_by: isReturn ? moment(new Date()) : null,
|
||||||
line_desc: value.line_desc,
|
vendorid: vendorId,
|
||||||
oem_partno: value.oem_partno,
|
returnfrominvoice: returnFromInvoice,
|
||||||
db_price: value.db_price,
|
|
||||||
act_price: value.act_price,
|
parts_order_lines: {
|
||||||
quantity: value.part_qty,
|
data: linesToOrder
|
||||||
job_line_id: value.id,
|
? linesToOrder.reduce((acc, value) => {
|
||||||
status: bodyshop.md_order_statuses.default_ordered || "Ordered*",
|
acc.push({
|
||||||
});
|
line_desc: value.line_desc,
|
||||||
return acc;
|
oem_partno: value.oem_partno,
|
||||||
}, []);
|
db_price: value.db_price,
|
||||||
|
act_price: value.act_price,
|
||||||
|
quantity: value.part_qty,
|
||||||
|
job_line_id: isReturn ? value.joblineid : value.id,
|
||||||
|
});
|
||||||
|
return acc;
|
||||||
|
}, [])
|
||||||
|
: [],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visible && !!linesToOrder) {
|
if (visible && !!linesToOrder) {
|
||||||
@@ -188,6 +206,11 @@ export function PartsOrderModalContainer({
|
|||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
visible={visible}
|
visible={visible}
|
||||||
|
title={
|
||||||
|
isReturn
|
||||||
|
? `${t("parts_orders.labels.returnpartsorder")} ${invoiceNumber}`
|
||||||
|
: t("parts_orders.labels.newpartsorder")
|
||||||
|
}
|
||||||
onCancel={() => toggleModalVisible()}
|
onCancel={() => toggleModalVisible()}
|
||||||
width='90%'
|
width='90%'
|
||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
@@ -199,10 +222,11 @@ export function PartsOrderModalContainer({
|
|||||||
form={form}
|
form={form}
|
||||||
autoComplete='no'
|
autoComplete='no'
|
||||||
onFinish={handleFinish}
|
onFinish={handleFinish}
|
||||||
initialValues={{ parts_order_lines: { data: initialValues } }}>
|
initialValues={initialValues}>
|
||||||
<PartsOrderModalComponent
|
<PartsOrderModalComponent
|
||||||
vendorList={(data && data.vendors) || []}
|
vendorList={(data && data.vendors) || []}
|
||||||
sendTypeState={sendTypeState}
|
sendTypeState={sendTypeState}
|
||||||
|
isReturn={isReturn}
|
||||||
/>
|
/>
|
||||||
</Form>
|
</Form>
|
||||||
</LoadingSpinner>
|
</LoadingSpinner>
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ export default function ShopInfoOrderStatusComponent({ form }) {
|
|||||||
{fields.map((field, index) => (
|
{fields.map((field, index) => (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
key={field.key}
|
key={field.key}
|
||||||
style={{ padding: 0, margin: 2 }}
|
style={{ padding: 0, margin: 2 }}>
|
||||||
>
|
|
||||||
<div style={{ display: "flex" }}>
|
<div style={{ display: "flex" }}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
style={{ padding: 0, margin: 2 }}
|
style={{ padding: 0, margin: 2 }}
|
||||||
@@ -37,10 +36,9 @@ export default function ShopInfoOrderStatusComponent({ form }) {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: t("general.validation.required")
|
message: t("general.validation.required"),
|
||||||
}
|
},
|
||||||
]}
|
]}>
|
||||||
>
|
|
||||||
<Input onBlur={handleBlur} />
|
<Input onBlur={handleBlur} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<DeleteFilled
|
<DeleteFilled
|
||||||
@@ -53,12 +51,11 @@ export default function ShopInfoOrderStatusComponent({ form }) {
|
|||||||
))}
|
))}
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
<Button
|
<Button
|
||||||
type="dashed"
|
type='dashed'
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
add();
|
add();
|
||||||
}}
|
}}
|
||||||
style={{ width: "100%" }}
|
style={{ width: "100%" }}>
|
||||||
>
|
|
||||||
{t("bodyshop.actions.newstatus")}
|
{t("bodyshop.actions.newstatus")}
|
||||||
</Button>
|
</Button>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -73,11 +70,10 @@ export default function ShopInfoOrderStatusComponent({ form }) {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: t("general.validation.required")
|
message: t("general.validation.required"),
|
||||||
}
|
},
|
||||||
]}
|
]}
|
||||||
name={["md_order_statuses", "default_bo"]}
|
name={["md_order_statuses", "default_bo"]}>
|
||||||
>
|
|
||||||
<Select>
|
<Select>
|
||||||
{options.map((item, idx) => (
|
{options.map((item, idx) => (
|
||||||
<Select.Option key={idx}>{item}</Select.Option>
|
<Select.Option key={idx}>{item}</Select.Option>
|
||||||
@@ -89,11 +85,10 @@ export default function ShopInfoOrderStatusComponent({ form }) {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: t("general.validation.required")
|
message: t("general.validation.required"),
|
||||||
}
|
},
|
||||||
]}
|
]}
|
||||||
name={["md_order_statuses", "default_ordered"]}
|
name={["md_order_statuses", "default_ordered"]}>
|
||||||
>
|
|
||||||
<Select>
|
<Select>
|
||||||
{options.map((item, idx) => (
|
{options.map((item, idx) => (
|
||||||
<Select.Option key={idx}>{item}</Select.Option>
|
<Select.Option key={idx}>{item}</Select.Option>
|
||||||
@@ -105,11 +100,10 @@ export default function ShopInfoOrderStatusComponent({ form }) {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: t("general.validation.required")
|
message: t("general.validation.required"),
|
||||||
}
|
},
|
||||||
]}
|
]}
|
||||||
name={["md_order_statuses", "default_canceled"]}
|
name={["md_order_statuses", "default_canceled"]}>
|
||||||
>
|
|
||||||
<Select>
|
<Select>
|
||||||
{options.map((item, idx) => (
|
{options.map((item, idx) => (
|
||||||
<Select.Option key={idx}>{item}</Select.Option>
|
<Select.Option key={idx}>{item}</Select.Option>
|
||||||
@@ -121,11 +115,25 @@ export default function ShopInfoOrderStatusComponent({ form }) {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: t("general.validation.required")
|
message: t("general.validation.required"),
|
||||||
}
|
},
|
||||||
]}
|
]}
|
||||||
name={["md_order_statuses", "default_received"]}
|
name={["md_order_statuses", "default_received"]}>
|
||||||
>
|
<Select>
|
||||||
|
{options.map((item, idx) => (
|
||||||
|
<Select.Option key={idx}>{item}</Select.Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.statuses.default_returned")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_order_statuses", "default_returned"]}>
|
||||||
<Select>
|
<Select>
|
||||||
{options.map((item, idx) => (
|
{options.map((item, idx) => (
|
||||||
<Select.Option key={idx}>{item}</Select.Option>
|
<Select.Option key={idx}>{item}</Select.Option>
|
||||||
|
|||||||
@@ -4,7 +4,13 @@ const { Option } = Select;
|
|||||||
|
|
||||||
//To be used as a form element only.
|
//To be used as a form element only.
|
||||||
|
|
||||||
const VendorSearchSelect = ({ value, onChange, options, onSelect }) => {
|
const VendorSearchSelect = ({
|
||||||
|
value,
|
||||||
|
onChange,
|
||||||
|
options,
|
||||||
|
onSelect,
|
||||||
|
disabled,
|
||||||
|
}) => {
|
||||||
const [option, setOption] = useState(value);
|
const [option, setOption] = useState(value);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -21,15 +27,15 @@ const VendorSearchSelect = ({ value, onChange, options, onSelect }) => {
|
|||||||
width: 300,
|
width: 300,
|
||||||
}}
|
}}
|
||||||
onChange={setOption}
|
onChange={setOption}
|
||||||
optionFilterProp="name"
|
optionFilterProp='name'
|
||||||
onSelect={onSelect}
|
onSelect={onSelect}
|
||||||
>
|
disabled={disabled || false}>
|
||||||
{options
|
{options
|
||||||
? options.map((o) => (
|
? options.map((o) => (
|
||||||
<Option key={o.id} value={o.id} name={o.name} discount={o.discount}>
|
<Option key={o.id} value={o.id} name={o.name} discount={o.discount}>
|
||||||
<div style={{ display: "flex" }}>
|
<div style={{ display: "flex" }}>
|
||||||
{o.name}
|
{o.name}
|
||||||
<Tag color="green">{`${o.discount * 100}%`}</Tag>
|
<Tag color='green'>{`${o.discount * 100}%`}</Tag>
|
||||||
</div>
|
</div>
|
||||||
</Option>
|
</Option>
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ export const QUERY_INVOICES_BY_JOBID = gql`
|
|||||||
actual_cost
|
actual_cost
|
||||||
cost_center
|
cost_center
|
||||||
id
|
id
|
||||||
|
joblineid
|
||||||
line_desc
|
line_desc
|
||||||
applicable_taxes
|
applicable_taxes
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -379,7 +379,8 @@
|
|||||||
"invoices": {
|
"invoices": {
|
||||||
"actions": {
|
"actions": {
|
||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"receive": "Receive Part"
|
"receive": "Receive Part",
|
||||||
|
"return": "Return Items"
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
"creating": "Error adding invoice.",
|
"creating": "Error adding invoice.",
|
||||||
@@ -780,8 +781,10 @@
|
|||||||
"labels": {
|
"labels": {
|
||||||
"email": "Send by Email",
|
"email": "Send by Email",
|
||||||
"inthisorder": "Parts in this Order",
|
"inthisorder": "Parts in this Order",
|
||||||
|
"newpartsorder": "New Parts Order",
|
||||||
"orderhistory": "Order History",
|
"orderhistory": "Order History",
|
||||||
"print": "Show Printed Form"
|
"print": "Show Printed Form",
|
||||||
|
"returnpartsorder": "Return Parts Order"
|
||||||
},
|
},
|
||||||
"successes": {
|
"successes": {
|
||||||
"created": "Parts order created successfully. "
|
"created": "Parts order created successfully. "
|
||||||
|
|||||||
@@ -379,7 +379,8 @@
|
|||||||
"invoices": {
|
"invoices": {
|
||||||
"actions": {
|
"actions": {
|
||||||
"edit": "",
|
"edit": "",
|
||||||
"receive": ""
|
"receive": "",
|
||||||
|
"return": ""
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
"creating": "",
|
"creating": "",
|
||||||
@@ -780,8 +781,10 @@
|
|||||||
"labels": {
|
"labels": {
|
||||||
"email": "Enviar por correo electrónico",
|
"email": "Enviar por correo electrónico",
|
||||||
"inthisorder": "Partes en este pedido",
|
"inthisorder": "Partes en este pedido",
|
||||||
|
"newpartsorder": "",
|
||||||
"orderhistory": "Historial de pedidos",
|
"orderhistory": "Historial de pedidos",
|
||||||
"print": "Mostrar formulario impreso"
|
"print": "Mostrar formulario impreso",
|
||||||
|
"returnpartsorder": ""
|
||||||
},
|
},
|
||||||
"successes": {
|
"successes": {
|
||||||
"created": "Pedido de piezas creado con éxito."
|
"created": "Pedido de piezas creado con éxito."
|
||||||
|
|||||||
@@ -379,7 +379,8 @@
|
|||||||
"invoices": {
|
"invoices": {
|
||||||
"actions": {
|
"actions": {
|
||||||
"edit": "",
|
"edit": "",
|
||||||
"receive": ""
|
"receive": "",
|
||||||
|
"return": ""
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
"creating": "",
|
"creating": "",
|
||||||
@@ -780,8 +781,10 @@
|
|||||||
"labels": {
|
"labels": {
|
||||||
"email": "Envoyé par email",
|
"email": "Envoyé par email",
|
||||||
"inthisorder": "Pièces dans cette commande",
|
"inthisorder": "Pièces dans cette commande",
|
||||||
|
"newpartsorder": "",
|
||||||
"orderhistory": "Historique des commandes",
|
"orderhistory": "Historique des commandes",
|
||||||
"print": "Afficher le formulaire imprimé"
|
"print": "Afficher le formulaire imprimé",
|
||||||
|
"returnpartsorder": ""
|
||||||
},
|
},
|
||||||
"successes": {
|
"successes": {
|
||||||
"created": "Commande de pièces créée avec succès."
|
"created": "Commande de pièces créée avec succès."
|
||||||
|
|||||||
@@ -8,15 +8,24 @@ export const TemplateList = {
|
|||||||
title: "Appointment Reminder",
|
title: "Appointment Reminder",
|
||||||
description: "Sent to a customer as a reminder of an upcoming appointment.",
|
description: "Sent to a customer as a reminder of an upcoming appointment.",
|
||||||
drivingId: "Appointment Id",
|
drivingId: "Appointment Id",
|
||||||
|
key: "appointment_reminder",
|
||||||
},
|
},
|
||||||
parts_order_confirmation: {
|
parts_order_confirmation: {
|
||||||
title: "Parts Order Confirmation",
|
title: "Parts Order Confirmation",
|
||||||
description: "Parts order template including part details",
|
description: "Parts order template including part details",
|
||||||
drivingId: "Parts order Id",
|
drivingId: "Parts order Id",
|
||||||
|
key: "parts_order_confirmation",
|
||||||
},
|
},
|
||||||
estimate_detail: {
|
estimate_detail: {
|
||||||
title: "Estimate Detail Lines",
|
title: "Estimate Detail Lines",
|
||||||
description: "Est Detail",
|
description: "Est Detail",
|
||||||
drivingId: "test does not exist.",
|
drivingId: "test does not exist.",
|
||||||
|
key: "estimate_detail",
|
||||||
|
},
|
||||||
|
parts_return_confirmation: {
|
||||||
|
title: "Parts Return Confirmation",
|
||||||
|
description: "Parts Return template including part details",
|
||||||
|
drivingId: "Parts order Id",
|
||||||
|
key: "parts_return_confirmation",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."parts_orders" DROP COLUMN "return";
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."parts_orders" ADD COLUMN "return" boolean NOT NULL
|
||||||
|
DEFAULT false;
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: drop_insert_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
check:
|
||||||
|
job:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
columns:
|
||||||
|
- deliver_by
|
||||||
|
- order_date
|
||||||
|
- order_number
|
||||||
|
- status
|
||||||
|
- user_email
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- id
|
||||||
|
- jobid
|
||||||
|
- vendorid
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: create_insert_permission
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: drop_insert_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
check:
|
||||||
|
job:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
columns:
|
||||||
|
- created_at
|
||||||
|
- deliver_by
|
||||||
|
- id
|
||||||
|
- jobid
|
||||||
|
- order_date
|
||||||
|
- order_number
|
||||||
|
- return
|
||||||
|
- status
|
||||||
|
- updated_at
|
||||||
|
- user_email
|
||||||
|
- vendorid
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: create_insert_permission
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: drop_select_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
allow_aggregations: false
|
||||||
|
columns:
|
||||||
|
- deliver_by
|
||||||
|
- order_date
|
||||||
|
- order_number
|
||||||
|
- status
|
||||||
|
- user_email
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- id
|
||||||
|
- jobid
|
||||||
|
- vendorid
|
||||||
|
computed_fields: []
|
||||||
|
filter:
|
||||||
|
job:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: create_select_permission
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: drop_select_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
allow_aggregations: false
|
||||||
|
columns:
|
||||||
|
- created_at
|
||||||
|
- deliver_by
|
||||||
|
- id
|
||||||
|
- jobid
|
||||||
|
- order_date
|
||||||
|
- order_number
|
||||||
|
- return
|
||||||
|
- status
|
||||||
|
- updated_at
|
||||||
|
- user_email
|
||||||
|
- vendorid
|
||||||
|
computed_fields: []
|
||||||
|
filter:
|
||||||
|
job:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: create_select_permission
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."parts_orders" DROP COLUMN "returnfrominvoice";
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."parts_orders" ADD COLUMN "returnfrominvoice" uuid NULL;
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: alter table "public"."parts_orders" drop constraint "parts_orders_returnfrominvoice_fkey";
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: |-
|
||||||
|
alter table "public"."parts_orders"
|
||||||
|
add constraint "parts_orders_returnfrominvoice_fkey"
|
||||||
|
foreign key ("returnfrominvoice")
|
||||||
|
references "public"."invoices"
|
||||||
|
("id") on update restrict on delete restrict;
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
- args:
|
||||||
|
relationship: parts_orders
|
||||||
|
table:
|
||||||
|
name: invoices
|
||||||
|
schema: public
|
||||||
|
type: drop_relationship
|
||||||
|
- args:
|
||||||
|
relationship: invoice
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: drop_relationship
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
- args:
|
||||||
|
name: parts_orders
|
||||||
|
table:
|
||||||
|
name: invoices
|
||||||
|
schema: public
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on:
|
||||||
|
column: returnfrominvoice
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: create_array_relationship
|
||||||
|
- args:
|
||||||
|
name: invoice
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: returnfrominvoice
|
||||||
|
type: create_object_relationship
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: drop_insert_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
check:
|
||||||
|
job:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
columns:
|
||||||
|
- created_at
|
||||||
|
- deliver_by
|
||||||
|
- id
|
||||||
|
- jobid
|
||||||
|
- order_date
|
||||||
|
- order_number
|
||||||
|
- return
|
||||||
|
- status
|
||||||
|
- updated_at
|
||||||
|
- user_email
|
||||||
|
- vendorid
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: create_insert_permission
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: drop_insert_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
check:
|
||||||
|
job:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
columns:
|
||||||
|
- created_at
|
||||||
|
- deliver_by
|
||||||
|
- id
|
||||||
|
- jobid
|
||||||
|
- order_date
|
||||||
|
- order_number
|
||||||
|
- return
|
||||||
|
- returnfrominvoice
|
||||||
|
- status
|
||||||
|
- updated_at
|
||||||
|
- user_email
|
||||||
|
- vendorid
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: create_insert_permission
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: drop_select_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
allow_aggregations: false
|
||||||
|
columns:
|
||||||
|
- created_at
|
||||||
|
- deliver_by
|
||||||
|
- id
|
||||||
|
- jobid
|
||||||
|
- order_date
|
||||||
|
- order_number
|
||||||
|
- return
|
||||||
|
- status
|
||||||
|
- updated_at
|
||||||
|
- user_email
|
||||||
|
- vendorid
|
||||||
|
computed_fields: []
|
||||||
|
filter:
|
||||||
|
job:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: create_select_permission
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: drop_select_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
allow_aggregations: false
|
||||||
|
columns:
|
||||||
|
- created_at
|
||||||
|
- deliver_by
|
||||||
|
- id
|
||||||
|
- jobid
|
||||||
|
- order_date
|
||||||
|
- order_number
|
||||||
|
- return
|
||||||
|
- returnfrominvoice
|
||||||
|
- status
|
||||||
|
- updated_at
|
||||||
|
- user_email
|
||||||
|
- vendorid
|
||||||
|
computed_fields: []
|
||||||
|
filter:
|
||||||
|
job:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: create_select_permission
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: drop_update_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- deliver_by
|
||||||
|
- order_date
|
||||||
|
- order_number
|
||||||
|
- status
|
||||||
|
- user_email
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- id
|
||||||
|
- jobid
|
||||||
|
- vendorid
|
||||||
|
filter:
|
||||||
|
job:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: create_update_permission
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: drop_update_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- created_at
|
||||||
|
- deliver_by
|
||||||
|
- id
|
||||||
|
- jobid
|
||||||
|
- order_date
|
||||||
|
- order_number
|
||||||
|
- returnfrominvoice
|
||||||
|
- status
|
||||||
|
- updated_at
|
||||||
|
- user_email
|
||||||
|
- vendorid
|
||||||
|
filter:
|
||||||
|
job:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
localPresets:
|
||||||
|
- key: ""
|
||||||
|
value: ""
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: parts_orders
|
||||||
|
schema: public
|
||||||
|
type: create_update_permission
|
||||||
@@ -1188,6 +1188,13 @@ tables:
|
|||||||
table:
|
table:
|
||||||
schema: public
|
schema: public
|
||||||
name: invoicelines
|
name: invoicelines
|
||||||
|
- name: parts_orders
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on:
|
||||||
|
column: returnfrominvoice
|
||||||
|
table:
|
||||||
|
schema: public
|
||||||
|
name: parts_orders
|
||||||
insert_permissions:
|
insert_permissions:
|
||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
@@ -2837,6 +2844,9 @@ tables:
|
|||||||
schema: public
|
schema: public
|
||||||
name: parts_orders
|
name: parts_orders
|
||||||
object_relationships:
|
object_relationships:
|
||||||
|
- name: invoice
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: returnfrominvoice
|
||||||
- name: job
|
- name: job
|
||||||
using:
|
using:
|
||||||
foreign_key_constraint_on: jobid
|
foreign_key_constraint_on: jobid
|
||||||
@@ -2868,29 +2878,33 @@ tables:
|
|||||||
- active:
|
- active:
|
||||||
_eq: true
|
_eq: true
|
||||||
columns:
|
columns:
|
||||||
- deliver_by
|
|
||||||
- order_date
|
|
||||||
- order_number
|
|
||||||
- status
|
|
||||||
- user_email
|
|
||||||
- created_at
|
- created_at
|
||||||
- updated_at
|
- deliver_by
|
||||||
- id
|
- id
|
||||||
- jobid
|
- jobid
|
||||||
|
- order_date
|
||||||
|
- order_number
|
||||||
|
- return
|
||||||
|
- returnfrominvoice
|
||||||
|
- status
|
||||||
|
- updated_at
|
||||||
|
- user_email
|
||||||
- vendorid
|
- vendorid
|
||||||
select_permissions:
|
select_permissions:
|
||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
columns:
|
columns:
|
||||||
- deliver_by
|
|
||||||
- order_date
|
|
||||||
- order_number
|
|
||||||
- status
|
|
||||||
- user_email
|
|
||||||
- created_at
|
- created_at
|
||||||
- updated_at
|
- deliver_by
|
||||||
- id
|
- id
|
||||||
- jobid
|
- jobid
|
||||||
|
- order_date
|
||||||
|
- order_number
|
||||||
|
- return
|
||||||
|
- returnfrominvoice
|
||||||
|
- status
|
||||||
|
- updated_at
|
||||||
|
- user_email
|
||||||
- vendorid
|
- vendorid
|
||||||
filter:
|
filter:
|
||||||
job:
|
job:
|
||||||
@@ -2906,15 +2920,16 @@ tables:
|
|||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
columns:
|
columns:
|
||||||
- deliver_by
|
|
||||||
- order_date
|
|
||||||
- order_number
|
|
||||||
- status
|
|
||||||
- user_email
|
|
||||||
- created_at
|
- created_at
|
||||||
- updated_at
|
- deliver_by
|
||||||
- id
|
- id
|
||||||
- jobid
|
- jobid
|
||||||
|
- order_date
|
||||||
|
- order_number
|
||||||
|
- returnfrominvoice
|
||||||
|
- status
|
||||||
|
- updated_at
|
||||||
|
- user_email
|
||||||
- vendorid
|
- vendorid
|
||||||
filter:
|
filter:
|
||||||
job:
|
job:
|
||||||
|
|||||||
Reference in New Issue
Block a user