MAJOR CHANGE: Renamed invoices to bills BOD-410
This commit is contained in:
@@ -5,13 +5,14 @@ import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import AccountingPayablesTable from "../../components/accounting-payables-table/accounting-payables-table.component";
|
||||
import AlertComponent from "../../components/alert/alert.component";
|
||||
import { QUERY_INVOICES_FOR_EXPORT } from "../../graphql/accounting.queries";
|
||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import { QUERY_BILLS_FOR_EXPORT } from "../../graphql/accounting.queries";
|
||||
import {
|
||||
setBreadcrumbs,
|
||||
setSelectedHeader,
|
||||
} from "../../redux/application/application.actions";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
@@ -20,6 +21,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
setSelectedHeader: (key) => dispatch(setSelectedHeader(key)),
|
||||
});
|
||||
|
||||
export function AccountingPayablesContainer({
|
||||
bodyshop,
|
||||
setBreadcrumbs,
|
||||
@@ -38,7 +40,7 @@ export function AccountingPayablesContainer({
|
||||
]);
|
||||
}, [t, setBreadcrumbs, setSelectedHeader]);
|
||||
|
||||
const { loading, error, data } = useQuery(QUERY_INVOICES_FOR_EXPORT);
|
||||
const { loading, error, data } = useQuery(QUERY_BILLS_FOR_EXPORT);
|
||||
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
|
||||
@@ -47,7 +49,7 @@ export function AccountingPayablesContainer({
|
||||
<RbacWrapper action="accounting:payables">
|
||||
<AccountingPayablesTable
|
||||
loadaing={loading}
|
||||
invoices={data ? data.invoices : []}
|
||||
bills={data ? data.bills : []}
|
||||
/>
|
||||
</RbacWrapper>
|
||||
</div>
|
||||
|
||||
@@ -13,17 +13,17 @@ import { alphaSort } from "../../utils/sorters";
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setPartsOrderContext: (context) =>
|
||||
dispatch(setModalContext({ context: context, modal: "partsOrder" })),
|
||||
setInvoiceEnterContext: (context) =>
|
||||
dispatch(setModalContext({ context: context, modal: "invoiceEnter" })),
|
||||
setBillEnterContext: (context) =>
|
||||
dispatch(setModalContext({ context: context, modal: "billEnter" })),
|
||||
});
|
||||
|
||||
export function InvoicesListPage({
|
||||
export function BillsListPage({
|
||||
loading,
|
||||
data,
|
||||
refetch,
|
||||
total,
|
||||
setPartsOrderContext,
|
||||
setInvoiceEnterContext,
|
||||
setBillEnterContext,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [state, setState] = useState({
|
||||
@@ -35,7 +35,7 @@ export function InvoicesListPage({
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t("invoices.fields.vendorname"),
|
||||
title: t("bills.fields.vendorname"),
|
||||
dataIndex: "vendorname",
|
||||
key: "vendorname",
|
||||
// sorter: (a, b) => alphaSort(a.vendor.name, b.vendor.name),
|
||||
@@ -44,7 +44,7 @@ export function InvoicesListPage({
|
||||
render: (text, record) => <span>{record.vendor.name}</span>,
|
||||
},
|
||||
{
|
||||
title: t("invoices.fields.invoice_number"),
|
||||
title: t("bills.fields.invoice_number"),
|
||||
dataIndex: "invoice_number",
|
||||
key: "invoice_number",
|
||||
sorter: (a, b) => alphaSort(a.invoice_number, b.invoice_number),
|
||||
@@ -53,7 +53,7 @@ export function InvoicesListPage({
|
||||
state.sortedInfo.order,
|
||||
},
|
||||
{
|
||||
title: t("invoices.fields.date"),
|
||||
title: t("bills.fields.date"),
|
||||
dataIndex: "date",
|
||||
key: "date",
|
||||
sorter: (a, b) => a.date - b.date,
|
||||
@@ -62,7 +62,7 @@ export function InvoicesListPage({
|
||||
render: (text, record) => <DateFormatter>{record.date}</DateFormatter>,
|
||||
},
|
||||
{
|
||||
title: t("invoices.fields.total"),
|
||||
title: t("bills.fields.total"),
|
||||
dataIndex: "total",
|
||||
key: "total",
|
||||
sorter: (a, b) => a.total - b.total,
|
||||
@@ -73,7 +73,7 @@ export function InvoicesListPage({
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t("invoices.fields.is_credit_memo"),
|
||||
title: t("bills.fields.is_credit_memo"),
|
||||
dataIndex: "is_credit_memo",
|
||||
key: "is_credit_memo",
|
||||
sorter: (a, b) => a.is_credit_memo - b.is_credit_memo,
|
||||
@@ -88,8 +88,8 @@ export function InvoicesListPage({
|
||||
key: "actions",
|
||||
render: (text, record) => (
|
||||
<div>
|
||||
<Link to={`/manage/invoices?invoiceid=${record.id}`}>
|
||||
<Button>{t("invoices.actions.edit")}</Button>
|
||||
<Link to={`/manage/bills?billid=${record.id}`}>
|
||||
<Button>{t("bills.actions.edit")}</Button>
|
||||
</Link>
|
||||
<Button
|
||||
disabled={record.is_credit_memo}
|
||||
@@ -99,9 +99,9 @@ export function InvoicesListPage({
|
||||
context: {
|
||||
jobId: record.jobid,
|
||||
vendorId: record.vendorid,
|
||||
returnFromInvoice: record.id,
|
||||
returnFromBill: record.id,
|
||||
invoiceNumber: record.invoice_number,
|
||||
linesToOrder: record.invoicelines.map((i) => {
|
||||
linesToOrder: record.billlines.map((i) => {
|
||||
return {
|
||||
line_desc: i.line_desc,
|
||||
db_price: i.actual_price,
|
||||
@@ -115,7 +115,7 @@ export function InvoicesListPage({
|
||||
})
|
||||
}
|
||||
>
|
||||
{t("invoices.actions.return")}
|
||||
{t("bills.actions.return")}
|
||||
</Button>
|
||||
</div>
|
||||
),
|
||||
@@ -132,9 +132,7 @@ export function InvoicesListPage({
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Typography.Title level={4}>
|
||||
{t("invoices.labels.invoices")}
|
||||
</Typography.Title>
|
||||
<Typography.Title level={4}>{t("bills.labels.bills")}</Typography.Title>
|
||||
<Table
|
||||
loading={loading}
|
||||
size="small"
|
||||
@@ -145,13 +143,13 @@ export function InvoicesListPage({
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
setInvoiceEnterContext({
|
||||
setBillEnterContext({
|
||||
actions: { refetch: refetch },
|
||||
context: {},
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t("jobs.actions.postInvoices")}
|
||||
{t("jobs.actions.postbills")}
|
||||
</Button>
|
||||
<div className="imex-table-header__search">
|
||||
<Input.Search
|
||||
@@ -179,4 +177,4 @@ export function InvoicesListPage({
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default connect(null, mapDispatchToProps)(InvoicesListPage);
|
||||
export default connect(null, mapDispatchToProps)(BillsListPage);
|
||||
@@ -4,13 +4,13 @@ import { useQuery } from "react-apollo";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import InvoiceDetailEditContainer from "../../components/invoice-detail-edit/invoice-detail-edit.container";
|
||||
import { QUERY_ALL_INVOICES_PAGINATED } from "../../graphql/invoices.queries";
|
||||
import BillDetailEditContainer from "../../components/bill-detail-edit/bill-detail-edit.container";
|
||||
import { QUERY_ALL_BILLS_PAGINATED } from "../../graphql/bills.queries";
|
||||
import {
|
||||
setBreadcrumbs,
|
||||
setSelectedHeader,
|
||||
} from "../../redux/application/application.actions";
|
||||
import InvoicesPageComponent from "./invoices.page.component";
|
||||
import BillsPageComponent from "./bills.page.component";
|
||||
import AlertComponent from "../../components/alert/alert.component";
|
||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
|
||||
@@ -19,21 +19,21 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
setSelectedHeader: (key) => dispatch(setSelectedHeader(key)),
|
||||
});
|
||||
|
||||
export function InvoicesPageContainer({ setBreadcrumbs, setSelectedHeader }) {
|
||||
export function BillsPageContainer({ setBreadcrumbs, setSelectedHeader }) {
|
||||
const { t } = useTranslation();
|
||||
const searchParams = queryString.parse(useLocation().search);
|
||||
const { page, sortcolumn, sortorder, search } = searchParams;
|
||||
|
||||
useEffect(() => {
|
||||
document.title = t("titles.invoices-list");
|
||||
setSelectedHeader("invoices");
|
||||
document.title = t("titles.bills-list");
|
||||
setSelectedHeader("bills");
|
||||
setBreadcrumbs([
|
||||
{ link: "/manage/invoices", label: t("titles.bc.invoices-list") },
|
||||
{ link: "/manage/bills", label: t("titles.bc.bills-list") },
|
||||
]);
|
||||
}, [t, setBreadcrumbs, setSelectedHeader]);
|
||||
|
||||
const { loading, error, data, refetch } = useQuery(
|
||||
QUERY_ALL_INVOICES_PAGINATED,
|
||||
QUERY_ALL_BILLS_PAGINATED,
|
||||
{
|
||||
variables: {
|
||||
search: search || "",
|
||||
@@ -54,18 +54,18 @@ export function InvoicesPageContainer({ setBreadcrumbs, setSelectedHeader }) {
|
||||
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
return (
|
||||
<RbacWrapper action="invoices:list">
|
||||
<RbacWrapper action="bills:list">
|
||||
<div>
|
||||
<InvoicesPageComponent
|
||||
data={data ? data.search_invoices : []}
|
||||
<BillsPageComponent
|
||||
data={data ? data.search_bills : []}
|
||||
loading={loading}
|
||||
refetch={refetch}
|
||||
total={data ? data.search_invoices_aggregate.aggregate.count : 0}
|
||||
total={data ? data.search_bills_aggregate.aggregate.count : 0}
|
||||
/>
|
||||
|
||||
<InvoiceDetailEditContainer />
|
||||
<BillDetailEditContainer />
|
||||
</div>
|
||||
</RbacWrapper>
|
||||
);
|
||||
}
|
||||
export default connect(null, mapDispatchToProps)(InvoicesPageContainer);
|
||||
export default connect(null, mapDispatchToProps)(BillsPageContainer);
|
||||
@@ -74,15 +74,13 @@ const ContractDetailPage = lazy(() =>
|
||||
const ContractsList = lazy(() =>
|
||||
import("../contracts/contracts.page.container")
|
||||
);
|
||||
const InvoicesListPage = lazy(() =>
|
||||
import("../invoices/invoices.page.container")
|
||||
);
|
||||
const BillsListPage = lazy(() => import("../bills/bills.page.container"));
|
||||
|
||||
const JobCostingModal = lazy(() =>
|
||||
import("../../components/job-costing-modal/job-costing-modal.container")
|
||||
);
|
||||
const EnterInvoiceModalContainer = lazy(() =>
|
||||
import("../../components/invoice-enter-modal/invoice-enter-modal.container")
|
||||
const BillEnterModalContainer = lazy(() =>
|
||||
import("../../components/bill-enter-modal/bill-enter-modal.container")
|
||||
);
|
||||
const TimeTicketModalContainer = lazy(() =>
|
||||
import("../../components/time-ticket-modal/time-ticket-modal.container")
|
||||
@@ -174,7 +172,7 @@ export function Manage({ match, conflict }) {
|
||||
<PaymentModalContainer />
|
||||
</Elements>
|
||||
<BreadCrumbs />
|
||||
<EnterInvoiceModalContainer />
|
||||
<BillEnterModalContainer />
|
||||
<JobCostingModal />
|
||||
<EmailOverlayContainer />
|
||||
<TimeTicketModalContainer />
|
||||
@@ -280,8 +278,8 @@ export function Manage({ match, conflict }) {
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path={`${match.path}/invoices`}
|
||||
component={InvoicesListPage}
|
||||
path={`${match.path}/bills`}
|
||||
component={BillsListPage}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
|
||||
Reference in New Issue
Block a user