Merged in feature/IO-2264-schedule-filter (pull request #818)
Brought in shop estimator & made list of estimators unique.
This commit is contained in:
@@ -21,6 +21,7 @@ import ScheduleVerifyIntegrity from "../schedule-verify-integrity/schedule-verif
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import _ from "lodash";
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
@@ -44,16 +45,19 @@ export function ScheduleCalendarComponent({ data, refetch, bodyshop }) {
|
|||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
const estimators = useMemo(
|
const estimators = useMemo(() => {
|
||||||
() =>
|
return _.uniq([
|
||||||
data
|
...data
|
||||||
.filter((d) => d.__typename === "appointments")
|
.filter((d) => d.__typename === "appointments")
|
||||||
.map((app) =>
|
.map((app) =>
|
||||||
`${app.job?.est_ct_fn || ""} ${app.job?.est_ct_ln || ""}`.trim()
|
`${app.job?.est_ct_fn || ""} ${app.job?.est_ct_ln || ""}`.trim()
|
||||||
)
|
)
|
||||||
.filter((e) => e.length > 0),
|
.filter((e) => e.length > 0),
|
||||||
[data]
|
...bodyshop.md_estimators.map((e) =>
|
||||||
);
|
`${e.est_ct_fn || ""} ${e.est_ct_ln || ""}`.trim()
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
}, [data, bodyshop.md_estimators]);
|
||||||
|
|
||||||
const filteredData = useMemo(() => {
|
const filteredData = useMemo(() => {
|
||||||
return data.filter((d) => {
|
return data.filter((d) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user