From d5f55c58738d251889a22c43edcf8bc4895c2c79 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 19 Jul 2022 13:41:14 -0700 Subject: [PATCH] IO-1979 Resolve various employee vacation bugs. --- bodyshop_translations.babel | 21 +++ .../schedule-calendar-header.component.js | 5 +- .../shop-employees-add-vacation.component.jsx | 2 +- .../shop-info/shop-info.general.component.jsx | 2 +- client/src/graphql/appointments.queries.js | 132 +++++++++--------- client/src/translations/en_us/common.json | 3 +- client/src/translations/es/common.json | 3 +- client/src/translations/fr/common.json | 3 +- 8 files changed, 100 insertions(+), 71 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index a255053d6..bcf0fb69d 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -14777,6 +14777,27 @@ + + vacationadded + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + diff --git a/client/src/components/schedule-calendar-wrapper/schedule-calendar-header.component.js b/client/src/components/schedule-calendar-wrapper/schedule-calendar-header.component.js index be54fac39..fbdc59a77 100644 --- a/client/src/components/schedule-calendar-wrapper/schedule-calendar-header.component.js +++ b/client/src/components/schedule-calendar-wrapper/schedule-calendar-header.component.js @@ -37,9 +37,12 @@ export function ScheduleCalendarHeaderComponent({ ...otherProps }) { const ATSToday = useMemo(() => { + console.log("eeee", events); if (!events) return []; return _.groupBy( - events.filter((e) => moment(date).isSame(moment(e.start), "day")), + events.filter( + (e) => !e.vacation && moment(date).isSame(moment(e.start), "day") + ), "job.alt_transport" ); }, [events, date]); diff --git a/client/src/components/shop-employees/shop-employees-add-vacation.component.jsx b/client/src/components/shop-employees/shop-employees-add-vacation.component.jsx index d12bfcc03..0dd0a4fd9 100644 --- a/client/src/components/shop-employees/shop-employees-add-vacation.component.jsx +++ b/client/src/components/shop-employees/shop-employees-add-vacation.component.jsx @@ -43,7 +43,7 @@ export default function ShopEmployeeAddVacation({ employee }) { }); } else { notification["success"]({ - message: t("employees.successes.added"), + message: t("employees.successes.vacationadded"), }); } setLoading(false); diff --git a/client/src/components/shop-info/shop-info.general.component.jsx b/client/src/components/shop-info/shop-info.general.component.jsx index 835848a10..04a71f491 100644 --- a/client/src/components/shop-info/shop-info.general.component.jsx +++ b/client/src/components/shop-info/shop-info.general.component.jsx @@ -1494,7 +1494,7 @@ export default function ShopInfoGeneral({ form }) { } const ReceivableCustomFieldSelect = ( - VIN Claim No. Deductible Amount diff --git a/client/src/graphql/appointments.queries.js b/client/src/graphql/appointments.queries.js index 8a6ba4bde..e508e274e 100644 --- a/client/src/graphql/appointments.queries.js +++ b/client/src/graphql/appointments.queries.js @@ -1,75 +1,77 @@ import { gql } from "@apollo/client"; export const QUERY_ALL_ACTIVE_APPOINTMENTS = gql` - query QUERY_ALL_ACTIVE_APPOINTMENTS( - $start: timestamptz! - $end: timestamptz! - $startd: date! - $endd: date! +query QUERY_ALL_ACTIVE_APPOINTMENTS( + $start: timestamptz! + $end: timestamptz! + $startd: date! + $endd: date! +) { + employee_vacation( + where: { _or: [{ start: { _gte: $startd } }, + { end: { _lte: $endd } }, + {_and:[{start:{_lte: $startd}},{end:{_gte:$endd}}]}] } ) { - employee_vacation( - where: { _or: [{ start: { _gte: $startd } }, { end: { _lte: $endd } }] } - ) { + id + start + end + employee { id - start - end - employee { - id - last_name - first_name + last_name + first_name + } + } + appointments( + where: { + canceled: { _eq: false } + end: { _lte: $end } + start: { _gte: $start } + } + ) { + start + id + end + arrived + title + isintake + block + color + note + job { + alt_transport + ro_number + ownr_ln + ownr_co_nm + ownr_fn + ownr_ph1 + ownr_ph2 + ownr_ea + clm_total + id + clm_no + ins_co_nm + v_model_yr + v_make_desc + v_model_desc + labhrs: joblines_aggregate( + where: { mod_lbr_ty: { _neq: "LAR" }, removed: { _eq: false } } + ) { + aggregate { + sum { + mod_lb_hrs + } + } + } + larhrs: joblines_aggregate( + where: { mod_lbr_ty: { _eq: "LAR" }, removed: { _eq: false } } + ) { + aggregate { + sum { + mod_lb_hrs + } + } } } - appointments( - where: { - canceled: { _eq: false } - end: { _lte: $end } - start: { _gte: $start } - } - ) { - start - id - end - arrived - title - isintake - block - color - note - job { - alt_transport - ro_number - ownr_ln - ownr_co_nm - ownr_fn - ownr_ph1 - ownr_ph2 - ownr_ea - clm_total - id - clm_no - ins_co_nm - v_model_yr - v_make_desc - v_model_desc - labhrs: joblines_aggregate( - where: { mod_lbr_ty: { _neq: "LAR" }, removed: { _eq: false } } - ) { - aggregate { - sum { - mod_lb_hrs - } - } - } - larhrs: joblines_aggregate( - where: { mod_lbr_ty: { _eq: "LAR" }, removed: { _eq: false } } - ) { - aggregate { - sum { - mod_lb_hrs - } - } - } - } } } `; diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index e9e055244..7007e80fa 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -922,7 +922,8 @@ }, "successes": { "delete": "Employee deleted successfully.", - "save": "Employee saved successfully." + "save": "Employee saved successfully.", + "vacationadded": "Employee vacation added." }, "validation": { "unique_employee_number": "You must enter a unique employee number." diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 40fb43865..41508420f 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -922,7 +922,8 @@ }, "successes": { "delete": "Empleado eliminado con éxito.", - "save": "Empleado guardado con éxito." + "save": "Empleado guardado con éxito.", + "vacationadded": "" }, "validation": { "unique_employee_number": "" diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index e32f0f832..be68ebc77 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -922,7 +922,8 @@ }, "successes": { "delete": "L'employé a bien été supprimé.", - "save": "L'employé a enregistré avec succès." + "save": "L'employé a enregistré avec succès.", + "vacationadded": "" }, "validation": { "unique_employee_number": ""