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 { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import _ from "lodash";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
@@ -44,16 +45,19 @@ export function ScheduleCalendarComponent({ data, refetch, bodyshop }) {
|
||||
[]
|
||||
);
|
||||
|
||||
const estimators = useMemo(
|
||||
() =>
|
||||
data
|
||||
const estimators = useMemo(() => {
|
||||
return _.uniq([
|
||||
...data
|
||||
.filter((d) => d.__typename === "appointments")
|
||||
.map((app) =>
|
||||
`${app.job?.est_ct_fn || ""} ${app.job?.est_ct_ln || ""}`.trim()
|
||||
)
|
||||
.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(() => {
|
||||
return data.filter((d) => {
|
||||
|
||||
Reference in New Issue
Block a user