From 1aab5aa7404f1eda0261151420e71a6f2e99b892 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 26 May 2023 11:52:43 -0700 Subject: [PATCH 1/2] Add manual appointment handling. --- .../schedule-calendar/schedule-calendar.component.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/src/components/schedule-calendar/schedule-calendar.component.jsx b/client/src/components/schedule-calendar/schedule-calendar.component.jsx index 743e0d83a..222be1e3a 100644 --- a/client/src/components/schedule-calendar/schedule-calendar.component.jsx +++ b/client/src/components/schedule-calendar/schedule-calendar.component.jsx @@ -48,7 +48,10 @@ export function ScheduleCalendarComponent({ data, refetch, bodyshop }) { () => data .filter((d) => d.__typename === "appointments") - .map((app) => `${app.job.est_ct_fn} ${app.job.est_ct_ln}`), + .map((app) => + `${app.job?.est_ct_fn || ""} ${app.job?.est_ct_ln || ""}`.trim() + ) + .filter((e) => e.length > 0), [data] ); @@ -59,7 +62,9 @@ export function ScheduleCalendarComponent({ data, refetch, bodyshop }) { ? estimatorsFilter.length === 0 ? true : !!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; From 9b96460e4f29739d8a6870a6dc8e42dbf953c2e4 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 26 May 2023 12:03:33 -0700 Subject: [PATCH 2/2] Brought in shop estimator & made list of estimators unique. --- .../schedule-calendar.component.jsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/client/src/components/schedule-calendar/schedule-calendar.component.jsx b/client/src/components/schedule-calendar/schedule-calendar.component.jsx index 222be1e3a..1c9463e23 100644 --- a/client/src/components/schedule-calendar/schedule-calendar.component.jsx +++ b/client/src/components/schedule-calendar/schedule-calendar.component.jsx @@ -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) => {