Merge remote-tracking branch 'origin/feature/IO-2776-cdk-fortellis' into feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration
This commit is contained in:
@@ -113,6 +113,7 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId, title }) {
|
||||
rowKey="center"
|
||||
dataSource={allocationsSummary}
|
||||
locale={{ emptyText: t("dms.labels.refreshallocations") }}
|
||||
scroll={{ x: true }}
|
||||
summary={() => {
|
||||
const totals =
|
||||
allocationsSummary &&
|
||||
|
||||
@@ -90,7 +90,7 @@ export function JobDetailCardsPartsComponent({ loading, data, jobRO }) {
|
||||
.filter(onlyUnique)
|
||||
.map((s) => {
|
||||
return {
|
||||
text: s || "No Status*",
|
||||
text: s || t("dashboard.errors.status"),
|
||||
value: [s]
|
||||
};
|
||||
})) ||
|
||||
@@ -103,7 +103,7 @@ export function JobDetailCardsPartsComponent({ loading, data, jobRO }) {
|
||||
<div>
|
||||
<CardTemplate loading={loading} title={t("jobs.labels.cards.parts")}>
|
||||
<PartsStatusPie joblines_status={joblines_status} />
|
||||
<Table key="id" columns={columns} dataSource={filteredJobLines ? filteredJobLines : []} />
|
||||
<Table key="id" columns={columns} dataSource={filteredJobLines || []} />
|
||||
</CardTemplate>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -318,7 +318,7 @@ export function JobLinesComponent({
|
||||
.filter(onlyUnique)
|
||||
.map((s) => {
|
||||
return {
|
||||
text: s || "No Status*",
|
||||
text: s || t("dashboard.errors.status"),
|
||||
value: [s]
|
||||
};
|
||||
})) ||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { useMemo } from "react";
|
||||
import { Col, Row, Tag, Tooltip } from "antd";
|
||||
import { Tag, Tooltip } from "antd";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop
|
||||
@@ -11,65 +12,67 @@ const mapDispatchToProps = () => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
|
||||
export const DEFAULT_COL_LAYOUT = { xs: 24, sm: 24, md: 8, lg: 4, xl: 4, xxl: 4 };
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobPartsQueueCount);
|
||||
|
||||
export function JobPartsQueueCount({ bodyshop, parts, defaultColLayout = DEFAULT_COL_LAYOUT }) {
|
||||
export function JobPartsQueueCount({ bodyshop, parts }) {
|
||||
const { t } = useTranslation();
|
||||
const partsStatus = useMemo(() => {
|
||||
if (!parts) return null;
|
||||
const statusKeys = ["default_bo", "default_ordered", "default_received", "default_returned"];
|
||||
return parts.reduce(
|
||||
(acc, val) => {
|
||||
if (val.part_type === "PAS" || val.part_type === "PASL") return acc;
|
||||
acc.total = acc.total + val.count;
|
||||
acc[val.status] = acc[val.status] + val.count;
|
||||
|
||||
return acc;
|
||||
},
|
||||
{
|
||||
total: 0,
|
||||
null: 0,
|
||||
[bodyshop.md_order_statuses.default_bo]: 0,
|
||||
[bodyshop.md_order_statuses.default_ordered]: 0,
|
||||
[bodyshop.md_order_statuses.default_received]: 0,
|
||||
[bodyshop.md_order_statuses.default_returned]: 0
|
||||
...Object.fromEntries(statusKeys.map((key) => [bodyshop.md_order_statuses[key], 0]))
|
||||
}
|
||||
);
|
||||
}, [bodyshop, parts]);
|
||||
|
||||
if (!parts) return null;
|
||||
return (
|
||||
<Row>
|
||||
<Col {...defaultColLayout}>
|
||||
<Tooltip title="Total">
|
||||
<Tag>{partsStatus.total}</Tag>
|
||||
</Tooltip>
|
||||
</Col>
|
||||
<Col {...defaultColLayout}>
|
||||
<Tooltip title="No Status">
|
||||
<Tag color="gold">{partsStatus["null"]}</Tag>
|
||||
</Tooltip>
|
||||
</Col>
|
||||
<Col {...defaultColLayout}>
|
||||
<Tooltip title={bodyshop.md_order_statuses.default_ordered}>
|
||||
<Tag color="blue">{partsStatus[bodyshop.md_order_statuses.default_ordered]}</Tag>
|
||||
</Tooltip>
|
||||
</Col>
|
||||
<Col {...defaultColLayout}>
|
||||
<Tooltip title={bodyshop.md_order_statuses.default_received}>
|
||||
<Tag color="green">{partsStatus[bodyshop.md_order_statuses.default_received]}</Tag>
|
||||
</Tooltip>
|
||||
</Col>
|
||||
<Col {...defaultColLayout}>
|
||||
<Tooltip title={bodyshop.md_order_statuses.default_returned}>
|
||||
<Tag color="orange">{partsStatus[bodyshop.md_order_statuses.default_returned]}</Tag>
|
||||
</Tooltip>
|
||||
</Col>
|
||||
<Col {...defaultColLayout}>
|
||||
<Tooltip title={bodyshop.md_order_statuses.default_bo}>
|
||||
<Tag color="red">{partsStatus[bodyshop.md_order_statuses.default_bo]}</Tag>
|
||||
</Tooltip>
|
||||
</Col>
|
||||
</Row>
|
||||
<div
|
||||
style={{
|
||||
display: "grid",
|
||||
gridTemplateColumns: "repeat(auto-fit, minmax(40px, 1fr))",
|
||||
gap: "8px",
|
||||
width: "100%",
|
||||
justifyItems: "start"
|
||||
}}
|
||||
>
|
||||
<Tooltip title="Total">
|
||||
<Tag style={{ minWidth: "40px", textAlign: "center" }}>{partsStatus.total}</Tag>
|
||||
</Tooltip>
|
||||
<Tooltip title={t("dashboard.errors.status_normal")}>
|
||||
<Tag color="gold" style={{ minWidth: "40px", textAlign: "center" }}>
|
||||
{partsStatus["null"]}
|
||||
</Tag>
|
||||
</Tooltip>
|
||||
<Tooltip title={bodyshop.md_order_statuses.default_bo}>
|
||||
<Tag color="red" style={{ minWidth: "40px", textAlign: "center" }}>
|
||||
{partsStatus[bodyshop.md_order_statuses.default_bo]}
|
||||
</Tag>
|
||||
</Tooltip>
|
||||
<Tooltip title={bodyshop.md_order_statuses.default_ordered}>
|
||||
<Tag color="blue" style={{ minWidth: "40px", textAlign: "center" }}>
|
||||
{partsStatus[bodyshop.md_order_statuses.default_ordered]}
|
||||
</Tag>
|
||||
</Tooltip>
|
||||
<Tooltip title={bodyshop.md_order_statuses.default_received}>
|
||||
<Tag color="green" style={{ minWidth: "40px", textAlign: "center" }}>
|
||||
{partsStatus[bodyshop.md_order_statuses.default_received]}
|
||||
</Tag>
|
||||
</Tooltip>
|
||||
<Tooltip title={bodyshop.md_order_statuses.default_returned}>
|
||||
<Tag color="orange" style={{ minWidth: "40px", textAlign: "center" }}>
|
||||
{partsStatus[bodyshop.md_order_statuses.default_returned]}
|
||||
</Tag>
|
||||
</Tooltip>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ export function JobsList({ bodyshop }) {
|
||||
.filter(onlyUnique)
|
||||
.map((s) => {
|
||||
return {
|
||||
text: s || "No Status*",
|
||||
text: s || t("dashboard.errors.status"),
|
||||
value: [s]
|
||||
};
|
||||
})
|
||||
|
||||
@@ -165,7 +165,7 @@ export function JobsReadyList({ bodyshop }) {
|
||||
.filter(onlyUnique)
|
||||
.map((s) => {
|
||||
return {
|
||||
text: s || "No Status*",
|
||||
text: s || t("dashboard.errors.status"),
|
||||
value: [s]
|
||||
};
|
||||
})
|
||||
|
||||
@@ -145,7 +145,7 @@ export function PartsQueueJobLinesComponent({ loading, jobLines }) {
|
||||
.filter(onlyUnique)
|
||||
.map((s) => {
|
||||
return {
|
||||
text: s || "No Status*",
|
||||
text: s || t("dashboard.errors.status"),
|
||||
value: [s]
|
||||
};
|
||||
})) ||
|
||||
|
||||
@@ -171,7 +171,7 @@ export function PartsQueueListComponent({ bodyshop }) {
|
||||
filters:
|
||||
bodyshop.md_ro_statuses.active_statuses.map((s) => {
|
||||
return {
|
||||
text: s || "No Status*",
|
||||
text: s || t("dashboard.errors.status"),
|
||||
value: [s]
|
||||
};
|
||||
}) || [],
|
||||
|
||||
@@ -34,8 +34,9 @@ const getEmployeeName = (employeeId, employees) => {
|
||||
return employee ? `${employee.first_name} ${employee.last_name}` : "";
|
||||
};
|
||||
|
||||
const r = ({ technician, state, activeStatuses, data, bodyshop, refetch, treatments }) => {
|
||||
const productionListColumnsData = ({ technician, state, activeStatuses, data, bodyshop, refetch, treatments }) => {
|
||||
const { Enhanced_Payroll } = treatments;
|
||||
|
||||
return [
|
||||
{
|
||||
title: i18n.t("jobs.actions.viewdetail"),
|
||||
@@ -313,7 +314,7 @@ const r = ({ technician, state, activeStatuses, data, bodyshop, refetch, treatme
|
||||
activeStatuses
|
||||
?.map((s) => {
|
||||
return {
|
||||
text: s || "No Status*",
|
||||
text: s || i18n.t("dashboard.errors.status"),
|
||||
value: [s]
|
||||
};
|
||||
})
|
||||
@@ -584,4 +585,4 @@ const r = ({ technician, state, activeStatuses, data, bodyshop, refetch, treatme
|
||||
}
|
||||
];
|
||||
};
|
||||
export default r;
|
||||
export default productionListColumnsData;
|
||||
|
||||
@@ -425,7 +425,15 @@ export function ShopInfoGeneral({ form, bodyshop }) {
|
||||
]
|
||||
: [])
|
||||
]
|
||||
: [])
|
||||
: []),
|
||||
<Form.Item
|
||||
key="accumulatePayableLines"
|
||||
name={["accountingconfig", "accumulatePayableLines"]}
|
||||
label={t("bodyshop.fields.accumulatePayableLines")}
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
]}
|
||||
</LayoutFormRow>
|
||||
<FeatureWrapper featureName="scoreboard" noauth={() => null}>
|
||||
|
||||
@@ -138,6 +138,15 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
)}
|
||||
{bodyshop.pbs_serialnumber && (
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.dms.ro_posting")}
|
||||
valuePropName="checked"
|
||||
name={["pbs_configuration", "ro_posting"]}
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
)}
|
||||
{bodyshop.pbs_serialnumber && (
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.dms.appostingaccount")}
|
||||
|
||||
@@ -103,7 +103,7 @@ export function SimplifiedPartsJobsListComponent({
|
||||
return record.status || t("general.labels.na");
|
||||
},
|
||||
filteredValue: filter?.status || null,
|
||||
filters: bodyshop.md_ro_statuses?.parts_statuses.map((s) => {
|
||||
filters: bodyshop?.md_ro_statuses?.parts_statuses?.map((s) => {
|
||||
return { text: s, value: [s] };
|
||||
}),
|
||||
onFilter: (value, record) => value.includes(record.status)
|
||||
|
||||
@@ -111,7 +111,7 @@ export function TechLookupJobsList({ bodyshop }) {
|
||||
.filter(onlyUnique)
|
||||
.map((s) => {
|
||||
return {
|
||||
text: s || "No Status*",
|
||||
text: s || t("dashboard.errors.status"),
|
||||
value: [s]
|
||||
};
|
||||
})) ||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { getAuth, updatePassword, updateProfile } from "@firebase/auth";
|
||||
import { getFirestore } from "@firebase/firestore";
|
||||
import { getMessaging, getToken, onMessage } from "@firebase/messaging";
|
||||
import { store } from "../redux/store";
|
||||
import * as amplitude from '@amplitude/analytics-browser';
|
||||
//import * as amplitude from '@amplitude/analytics-browser';
|
||||
import posthog from 'posthog-js'
|
||||
|
||||
const config = JSON.parse(import.meta.env.VITE_APP_FIREBASE_CONFIG);
|
||||
@@ -91,14 +91,14 @@ export const logImEXEvent = (eventName, additionalParams, stateProp = null) => {
|
||||
// dbevent: false,
|
||||
// env: `master-AIO|${import.meta.env.VITE_APP_GIT_SHA_DATE}`
|
||||
// });
|
||||
console.log(
|
||||
"%c[Analytics]",
|
||||
"background-color: green ;font-weight:bold;",
|
||||
eventName,
|
||||
eventParams
|
||||
);
|
||||
// console.log(
|
||||
// "%c[Analytics]",
|
||||
// "background-color: green ;font-weight:bold;",
|
||||
// eventName,
|
||||
// eventParams
|
||||
// );
|
||||
logEvent(analytics, eventName, eventParams);
|
||||
amplitude.track(eventName, eventParams);
|
||||
//amplitude.track(eventName, eventParams);
|
||||
posthog.capture(eventName, eventParams);
|
||||
|
||||
} finally {
|
||||
|
||||
@@ -42,7 +42,7 @@ export const QUERY_ALL_BILLS_PAGINATED = gql`
|
||||
ro_number
|
||||
}
|
||||
}
|
||||
bills_aggregate {
|
||||
bills_aggregate(where: $where) {
|
||||
aggregate {
|
||||
count(distinct: true)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import { persistor, store } from "./redux/store";
|
||||
import reportWebVitals from "./reportWebVitals";
|
||||
import "./translations/i18n";
|
||||
import "./utils/CleanAxios";
|
||||
import * as amplitude from "@amplitude/analytics-browser";
|
||||
//import * as amplitude from "@amplitude/analytics-browser";
|
||||
import { PostHogProvider } from "posthog-js/react";
|
||||
import posthog from "posthog-js";
|
||||
|
||||
@@ -26,23 +26,23 @@ registerSW({ immediate: true });
|
||||
// Dinero.globalLocale = "en-CA";
|
||||
Dinero.globalRoundingMode = "HALF_EVEN";
|
||||
|
||||
amplitude.init(import.meta.env.VITE_APP_AMP_KEY, {
|
||||
defaultTracking: true,
|
||||
serverUrl: import.meta.env.VITE_APP_AMP_URL
|
||||
// {
|
||||
// attribution: {
|
||||
// excludeReferrers: true,
|
||||
// initialEmptyValue: true,
|
||||
// resetSessionOnNewCampaign: true,
|
||||
// },
|
||||
// fileDownloads: true,
|
||||
// formInteractions: true,
|
||||
// pageViews: {
|
||||
// trackHistoryChanges: 'all'
|
||||
// },
|
||||
// sessions: true
|
||||
// }
|
||||
});
|
||||
// amplitude.init(import.meta.env.VITE_APP_AMP_KEY, {
|
||||
// defaultTracking: true,
|
||||
// serverUrl: import.meta.env.VITE_APP_AMP_URL
|
||||
// // {
|
||||
// // attribution: {
|
||||
// // excludeReferrers: true,
|
||||
// // initialEmptyValue: true,
|
||||
// // resetSessionOnNewCampaign: true,
|
||||
// // },
|
||||
// // fileDownloads: true,
|
||||
// // formInteractions: true,
|
||||
// // pageViews: {
|
||||
// // trackHistoryChanges: 'all'
|
||||
// // },
|
||||
// // sessions: true
|
||||
// // }
|
||||
// });
|
||||
|
||||
posthog.init(import.meta.env.VITE_PUBLIC_POSTHOG_KEY, {
|
||||
autocapture: false,
|
||||
|
||||
@@ -16,7 +16,6 @@ import { DateFormatter } from "../../utils/DateFormatter";
|
||||
import { TemplateList } from "../../utils/TemplateConstants";
|
||||
import { pageLimit } from "../../utils/config";
|
||||
import { alphaSort, dateSort } from "../../utils/sorters";
|
||||
import useLocalStorage from "../../utils/useLocalStorage";
|
||||
import { QUERY_ALL_VENDORS } from "../../graphql/vendors.queries";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
|
||||
@@ -24,16 +23,12 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
setBillEnterContext: (context) => dispatch(setModalContext({ context: context, modal: "billEnter" }))
|
||||
});
|
||||
|
||||
export function BillsListPage({ loading, data, refetch, total, setBillEnterContext }) {
|
||||
export function BillsListPage({ loading, data, refetch, total, setBillEnterContext, handleTableChange, sortedInfo }) {
|
||||
const search = queryString.parse(useLocation().search);
|
||||
const [openSearchResults, setOpenSearchResults] = useState([]);
|
||||
const [searchLoading, setSearchLoading] = useState(false);
|
||||
const { page } = search;
|
||||
const history = useNavigate();
|
||||
const [state, setState] = useLocalStorage("bills_list_sort", {
|
||||
sortedInfo: {},
|
||||
filteredInfo: { vendorname: [] }
|
||||
});
|
||||
const Templates = TemplateList("bill");
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -50,7 +45,7 @@ export function BillsListPage({ loading, data, refetch, total, setBillEnterConte
|
||||
}),
|
||||
filters: (vendorsData?.vendors || []).map((v) => ({ text: v.name, value: v.id })),
|
||||
filteredValue: search.vendorIds ? search.vendorIds.split(",") : null,
|
||||
sortOrder: state.sortedInfo.columnKey === "vendorname" && state.sortedInfo.order,
|
||||
sortOrder: sortedInfo.columnKey === "vendorname" && sortedInfo.order,
|
||||
render: (text, record) => <span>{record.vendor.name}</span>
|
||||
},
|
||||
{
|
||||
@@ -58,7 +53,7 @@ export function BillsListPage({ loading, data, refetch, total, setBillEnterConte
|
||||
dataIndex: "invoice_number",
|
||||
key: "invoice_number",
|
||||
sorter: (a, b) => alphaSort(a.invoice_number, b.invoice_number),
|
||||
sortOrder: state.sortedInfo.columnKey === "invoice_number" && state.sortedInfo.order
|
||||
sortOrder: sortedInfo.columnKey === "invoice_number" && sortedInfo.order
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.ro_number"),
|
||||
@@ -68,7 +63,7 @@ export function BillsListPage({ loading, data, refetch, total, setBillEnterConte
|
||||
sortObject: (order) => ({
|
||||
job: { ro_number: order === "descend" ? "desc" : "asc" }
|
||||
}),
|
||||
sortOrder: state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
||||
sortOrder: sortedInfo.columnKey === "ro_number" && sortedInfo.order,
|
||||
render: (text, record) => record.job && <Link to={`/manage/jobs/${record.job.id}`}>{record.job.ro_number}</Link>
|
||||
},
|
||||
{
|
||||
@@ -76,7 +71,7 @@ export function BillsListPage({ loading, data, refetch, total, setBillEnterConte
|
||||
dataIndex: "date",
|
||||
key: "date",
|
||||
sorter: (a, b) => dateSort(a.date, b.date),
|
||||
sortOrder: state.sortedInfo.columnKey === "date" && state.sortedInfo.order,
|
||||
sortOrder: sortedInfo.columnKey === "date" && sortedInfo.order,
|
||||
render: (text, record) => <DateFormatter>{record.date}</DateFormatter>
|
||||
},
|
||||
{
|
||||
@@ -84,7 +79,7 @@ export function BillsListPage({ loading, data, refetch, total, setBillEnterConte
|
||||
dataIndex: "total",
|
||||
key: "total",
|
||||
sorter: (a, b) => a.total - b.total,
|
||||
sortOrder: state.sortedInfo.columnKey === "total" && state.sortedInfo.order,
|
||||
sortOrder: sortedInfo.columnKey === "total" && sortedInfo.order,
|
||||
render: (text, record) => <CurrencyFormatter>{record.total}</CurrencyFormatter>
|
||||
},
|
||||
{
|
||||
@@ -92,7 +87,7 @@ export function BillsListPage({ loading, data, refetch, total, setBillEnterConte
|
||||
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,
|
||||
sortOrder: sortedInfo.columnKey === "is_credit_memo" && sortedInfo.order,
|
||||
render: (text, record) => <Checkbox checked={record.is_credit_memo} />
|
||||
},
|
||||
{
|
||||
@@ -100,7 +95,7 @@ export function BillsListPage({ loading, data, refetch, total, setBillEnterConte
|
||||
dataIndex: "exported",
|
||||
key: "exported",
|
||||
sorter: (a, b) => a.exported - b.exported,
|
||||
sortOrder: state.sortedInfo.columnKey === "exported" && state.sortedInfo.order,
|
||||
sortOrder: sortedInfo.columnKey === "exported" && sortedInfo.order,
|
||||
render: (text, record) => <Checkbox checked={record.exported} />
|
||||
},
|
||||
{
|
||||
@@ -164,37 +159,7 @@ export function BillsListPage({ loading, data, refetch, total, setBillEnterConte
|
||||
}
|
||||
];
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
setState({
|
||||
sortedInfo: sorter,
|
||||
filteredInfo: { ...state.filteredInfo, vendorname: filters.vendorname || [] }
|
||||
});
|
||||
|
||||
search.page = pagination.current;
|
||||
if (filters.vendorname && filters.vendorname.length) {
|
||||
search.vendorIds = filters.vendorname.join(",");
|
||||
} else {
|
||||
delete search.vendorIds;
|
||||
}
|
||||
if (sorter && sorter.column && sorter.column.sortObject) {
|
||||
search.searchObj = JSON.stringify(sorter.column.sortObject(sorter.order));
|
||||
delete search.sortcolumn;
|
||||
delete search.sortorder;
|
||||
} else {
|
||||
delete search.searchObj;
|
||||
search.sortcolumn = sorter.order ? sorter.columnKey : null;
|
||||
search.sortorder = sorter.order;
|
||||
}
|
||||
history({ search: queryString.stringify(search) });
|
||||
logImEXEvent("bills_list_sort_filter", { pagination, filters, sorter });
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!search.vendorIds && state.filteredInfo.vendorname && state.filteredInfo.vendorname.length) {
|
||||
search.vendorIds = state.filteredInfo.vendorname.join(",");
|
||||
history({ search: queryString.stringify(search) });
|
||||
}
|
||||
}, []);
|
||||
// (State & URL handling moved to container - Option C)
|
||||
|
||||
useEffect(() => {
|
||||
if (search.search && search.search.trim() !== "") {
|
||||
|
||||
@@ -3,13 +3,14 @@ import queryString from "query-string";
|
||||
import { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import AlertComponent from "../../components/alert/alert.component";
|
||||
import BillDetailEditContainer from "../../components/bill-detail-edit/bill-detail-edit.container";
|
||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import { QUERY_ALL_BILLS_PAGINATED } from "../../graphql/bills.queries";
|
||||
import { setBreadcrumbs, setSelectedHeader } from "../../redux/application/application.actions";
|
||||
import BillsPageComponent from "./bills.page.component";
|
||||
import useLocalStorage from "../../utils/useLocalStorage";
|
||||
import { pageLimit } from "../../utils/config";
|
||||
import FeatureWrapperComponent from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
@@ -23,7 +24,9 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
|
||||
export function BillsPageContainer({ setBreadcrumbs, setSelectedHeader }) {
|
||||
const { t } = useTranslation();
|
||||
const searchParams = queryString.parse(useLocation().search);
|
||||
const location = useLocation();
|
||||
const history = useNavigate();
|
||||
const searchParams = queryString.parse(location.search);
|
||||
const { page, sortcolumn, sortorder, searchObj } = searchParams;
|
||||
|
||||
useEffect(() => {
|
||||
@@ -37,6 +40,12 @@ export function BillsPageContainer({ setBreadcrumbs, setSelectedHeader }) {
|
||||
setBreadcrumbs([{ link: "/manage/bills", label: t("titles.bc.bills-list") }]);
|
||||
}, [t, setBreadcrumbs, setSelectedHeader]);
|
||||
|
||||
// Persisted table state (sorting & filtering)
|
||||
const [persistState, setPersistState] = useLocalStorage("bills_list_sort", {
|
||||
sortedInfo: {},
|
||||
filteredInfo: { vendorname: [] }
|
||||
});
|
||||
|
||||
const { loading, error, data, refetch } = useQuery(QUERY_ALL_BILLS_PAGINATED, {
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only",
|
||||
@@ -54,6 +63,90 @@ export function BillsPageContainer({ setBreadcrumbs, setSelectedHeader }) {
|
||||
}
|
||||
});
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
const search = queryString.parse(location.search);
|
||||
|
||||
const vendorArr = filters?.vendorname ?? [];
|
||||
const newVendorIds = vendorArr.length ? vendorArr.join(",") : undefined;
|
||||
const vendorFilterChanged = search.vendorIds !== newVendorIds;
|
||||
|
||||
search.page = vendorFilterChanged || !search.page ? 1 : pagination.current;
|
||||
newVendorIds ? (search.vendorIds = newVendorIds) : delete search.vendorIds;
|
||||
|
||||
const { columnKey, order, column } = sorter || {};
|
||||
if (column?.sortObject) {
|
||||
search.searchObj = JSON.stringify(column.sortObject(order));
|
||||
delete search.sortcolumn;
|
||||
delete search.sortorder;
|
||||
} else {
|
||||
delete search.searchObj;
|
||||
search.sortcolumn = order ? columnKey : null;
|
||||
search.sortorder = order ?? null; // keep explicit null to mirror prior behavior
|
||||
}
|
||||
|
||||
setPersistState({
|
||||
sortedInfo: sorter || {},
|
||||
filteredInfo: { vendorname: vendorArr }
|
||||
});
|
||||
|
||||
history({ search: queryString.stringify(search) });
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const search = queryString.parse(location.search);
|
||||
let changed = false;
|
||||
|
||||
const vendorPersisted = persistState.filteredInfo.vendorname || [];
|
||||
if (!search.vendorIds && vendorPersisted.length) {
|
||||
search.vendorIds = vendorPersisted.join(",");
|
||||
search.page = 1; // reset page when injecting filter
|
||||
changed = true;
|
||||
}
|
||||
|
||||
const { sortedInfo } = persistState;
|
||||
if (!search.searchObj && !search.sortcolumn && sortedInfo?.order) {
|
||||
const { columnKey, order } = sortedInfo;
|
||||
if (columnKey) {
|
||||
const dir = order === "descend" ? "desc" : "asc";
|
||||
if (columnKey === "vendorname") {
|
||||
search.searchObj = JSON.stringify({ vendor: { name: dir } });
|
||||
} else if (columnKey === "ro_number") {
|
||||
search.searchObj = JSON.stringify({ job: { ro_number: dir } });
|
||||
} else {
|
||||
search.sortcolumn = columnKey;
|
||||
search.sortorder = order;
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
history({ search: queryString.stringify(search) });
|
||||
return;
|
||||
}
|
||||
|
||||
const hasPersistSort = !!sortedInfo?.order;
|
||||
const hasUrlSort = !!(search.searchObj || (search.sortcolumn && search.sortorder));
|
||||
if (!hasPersistSort && hasUrlSort) {
|
||||
let derived = {};
|
||||
if (search.searchObj) {
|
||||
try {
|
||||
const o = JSON.parse(search.searchObj);
|
||||
if (o.vendor?.name) {
|
||||
derived = { columnKey: "vendorname", order: o.vendor.name === "desc" ? "descend" : "ascend" };
|
||||
} else if (o.job?.ro_number) {
|
||||
derived = { columnKey: "ro_number", order: o.job.ro_number === "desc" ? "descend" : "ascend" };
|
||||
}
|
||||
} catch {
|
||||
/* ignore parse errors */
|
||||
}
|
||||
} else {
|
||||
derived = { columnKey: search.sortcolumn, order: search.sortorder };
|
||||
}
|
||||
if (derived.order) setPersistState((prev) => ({ ...prev, sortedInfo: derived }));
|
||||
}
|
||||
}, [location.search]);
|
||||
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
return (
|
||||
<FeatureWrapperComponent
|
||||
@@ -71,6 +164,8 @@ export function BillsPageContainer({ setBreadcrumbs, setSelectedHeader }) {
|
||||
loading={loading}
|
||||
refetch={refetch}
|
||||
total={data ? data.bills_aggregate.aggregate.count : 0}
|
||||
handleTableChange={handleTableChange}
|
||||
sortedInfo={persistState.sortedInfo || {}}
|
||||
/>
|
||||
|
||||
<BillDetailEditContainer />
|
||||
|
||||
@@ -50,7 +50,7 @@ export const socket = SocketIO(
|
||||
|
||||
export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, insertAuditTrail }) {
|
||||
const { t } = useTranslation();
|
||||
const [logLevel, setLogLevel] = useState("DEBUG");
|
||||
const [logLevel, setLogLevel] = useState(determineDmsType(bodyshop) === "pbs" ? "INFO" : "DEBUG");
|
||||
const history = useNavigate();
|
||||
const [logs, setLogs] = useState([]);
|
||||
const search = queryString.parse(useLocation().search);
|
||||
|
||||
@@ -97,7 +97,7 @@ export function TechAssignedProdJobs({ setTimeTicketTaskContext, technician, bod
|
||||
.filter(onlyUnique)
|
||||
.map((s) => {
|
||||
return {
|
||||
text: s || "No Status*",
|
||||
text: s || t("dashboard.errors.status"),
|
||||
value: [s]
|
||||
};
|
||||
})) ||
|
||||
|
||||
@@ -49,7 +49,7 @@ import {
|
||||
validatePasswordResetSuccess
|
||||
} from "./user.actions";
|
||||
import UserActionTypes from "./user.types";
|
||||
import * as amplitude from '@amplitude/analytics-browser';
|
||||
//import * as amplitude from '@amplitude/analytics-browser';
|
||||
import posthog from 'posthog-js';
|
||||
|
||||
const fpPromise = FingerprintJS.load();
|
||||
@@ -92,7 +92,7 @@ export function* isUserAuthenticated() {
|
||||
}
|
||||
|
||||
LogRocket.identify(user.email);
|
||||
amplitude.setUserId(user.email);
|
||||
//amplitude.setUserId(user.email);
|
||||
posthog.identify(user.email);
|
||||
|
||||
const eulaQuery = yield client.query({
|
||||
@@ -139,7 +139,7 @@ export function* signOutStart() {
|
||||
imexshopid: state.user.bodyshop.imexshopid,
|
||||
type: "messaging"
|
||||
});
|
||||
amplitude.reset();
|
||||
//amplitude.reset();
|
||||
} catch {
|
||||
console.log("No FCM token. Skipping unsubscribe.");
|
||||
}
|
||||
@@ -365,7 +365,7 @@ export function* SetAuthLevelFromShopDetails({ payload }) {
|
||||
}
|
||||
|
||||
try {
|
||||
amplitude.setGroup('Shop', payload.shopname);
|
||||
//amplitude.setGroup('Shop', payload.shopname);
|
||||
window.$crisp.push(["set", "user:company", [payload.shopname]]);
|
||||
if (authRecord[0] && authRecord[0].user.validemail) {
|
||||
window.$crisp.push(["set", "user:email", [authRecord[0].user.email]]);
|
||||
|
||||
@@ -281,6 +281,7 @@
|
||||
},
|
||||
"fields": {
|
||||
"ReceivableCustomField": "QBO Receivable Custom Field {{number}}",
|
||||
"accumulatePayableLines": "Accumulate Payable Lines",
|
||||
"address1": "Address 1",
|
||||
"address2": "Address 2",
|
||||
"appt_alt_transport": "Appointment Alternative Transportation Options",
|
||||
@@ -321,6 +322,7 @@
|
||||
"itc_local": "Local Tax is ITC?",
|
||||
"itc_state": "State Tax is ITC?",
|
||||
"mappingname": "DMS Mapping Name",
|
||||
"ro_posting": "Create $0 RO?",
|
||||
"sendmaterialscosting": "Materials Cost as % of Sale",
|
||||
"srcco": "Source Company #/Dealer #"
|
||||
},
|
||||
@@ -996,6 +998,7 @@
|
||||
"insco": "No Ins. Co.*",
|
||||
"refreshrequired": "You must refresh the dashboard data to see this component.",
|
||||
"status": "No Status*",
|
||||
"status_normal": "No Status",
|
||||
"updatinglayout": "Error saving updated layout {{message}}"
|
||||
},
|
||||
"labels": {
|
||||
|
||||
@@ -281,6 +281,7 @@
|
||||
},
|
||||
"fields": {
|
||||
"ReceivableCustomField": "",
|
||||
"accumulatePayableLines": "",
|
||||
"address1": "",
|
||||
"address2": "",
|
||||
"appt_alt_transport": "",
|
||||
@@ -321,6 +322,7 @@
|
||||
"itc_local": "",
|
||||
"itc_state": "",
|
||||
"mappingname": "",
|
||||
"ro_posting": "",
|
||||
"sendmaterialscosting": "",
|
||||
"srcco": ""
|
||||
},
|
||||
@@ -996,6 +998,7 @@
|
||||
"insco": "",
|
||||
"refreshrequired": "",
|
||||
"status": "",
|
||||
"status_normal": "",
|
||||
"updatinglayout": ""
|
||||
},
|
||||
"labels": {
|
||||
|
||||
@@ -281,6 +281,7 @@
|
||||
},
|
||||
"fields": {
|
||||
"ReceivableCustomField": "",
|
||||
"accumulatePayableLines": "",
|
||||
"address1": "",
|
||||
"address2": "",
|
||||
"appt_alt_transport": "",
|
||||
@@ -321,6 +322,7 @@
|
||||
"itc_local": "",
|
||||
"itc_state": "",
|
||||
"mappingname": "",
|
||||
"ro_posting": "",
|
||||
"sendmaterialscosting": "",
|
||||
"srcco": ""
|
||||
},
|
||||
@@ -996,6 +998,7 @@
|
||||
"insco": "",
|
||||
"refreshrequired": "",
|
||||
"status": "",
|
||||
"status_normal": "",
|
||||
"updatinglayout": ""
|
||||
},
|
||||
"labels": {
|
||||
|
||||
Reference in New Issue
Block a user