@@ -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,13 +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) => `${app.job.est_ct_fn} ${app.job.est_ct_ln}`),
|
.map((app) =>
|
||||||
[data]
|
`${app.job?.est_ct_fn || ""} ${app.job?.est_ct_ln || ""}`.trim()
|
||||||
);
|
)
|
||||||
|
.filter((e) => e.length > 0),
|
||||||
|
...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) => {
|
||||||
@@ -59,7 +66,9 @@ export function ScheduleCalendarComponent({ data, refetch, bodyshop }) {
|
|||||||
? estimatorsFilter.length === 0
|
? estimatorsFilter.length === 0
|
||||||
? true
|
? true
|
||||||
: !!estimatorsFilter.find(
|
: !!estimatorsFilter.find(
|
||||||
(e) => e === `${d.job.est_ct_fn} ${d.job.est_ct_ln}`
|
(e) =>
|
||||||
|
e ===
|
||||||
|
`${d.job?.est_ct_fn || ""} ${d.job?.est_ct_ln || ""}`.trim()
|
||||||
)
|
)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user