From c222e027dd42ecdcc3ad2e0c97e50ff0d7ebaf1e Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Tue, 29 Sep 2020 11:17:06 -0700 Subject: [PATCH] Added alt transport to appointments BOD-392 --- bodyshop_translations.babel | 42 +++++++++++ .../schedule-calendar-header.component.js | 5 +- .../schedule-event.at.component.jsx | 53 ++++++++++++++ .../schedule-event.component.jsx | 8 +++ .../schedule-job-modal.component.jsx | 21 ++++-- .../schedule-job-modal.container.jsx | 1 + .../shop-info.scheduling.component.jsx | 15 +++- client/src/graphql/appointments.queries.js | 6 ++ client/src/graphql/bodyshop.queries.js | 2 + client/src/translations/en_us/common.json | 4 +- client/src/translations/es/common.json | 4 +- client/src/translations/fr/common.json | 4 +- .../down.yaml | 5 ++ .../up.yaml | 5 ++ .../down.yaml | 37 ++++++++++ .../up.yaml | 38 ++++++++++ .../down.yaml | 38 ++++++++++ .../up.yaml | 39 ++++++++++ .../down.yaml | 37 ++++++++++ .../up.yaml | 38 ++++++++++ .../down.yaml | 5 ++ .../up.yaml | 6 ++ .../down.yaml | 71 ++++++++++++++++++ .../up.yaml | 72 +++++++++++++++++++ .../down.yaml | 65 +++++++++++++++++ .../up.yaml | 66 +++++++++++++++++ hasura/migrations/metadata.yaml | 5 ++ 27 files changed, 681 insertions(+), 11 deletions(-) create mode 100644 client/src/components/schedule-event/schedule-event.at.component.jsx create mode 100644 hasura/migrations/1601400921029_alter_table_public_appointments_add_column_alt_transport/down.yaml create mode 100644 hasura/migrations/1601400921029_alter_table_public_appointments_add_column_alt_transport/up.yaml create mode 100644 hasura/migrations/1601400929812_update_permission_user_public_table_appointments/down.yaml create mode 100644 hasura/migrations/1601400929812_update_permission_user_public_table_appointments/up.yaml create mode 100644 hasura/migrations/1601400937507_update_permission_user_public_table_appointments/down.yaml create mode 100644 hasura/migrations/1601400937507_update_permission_user_public_table_appointments/up.yaml create mode 100644 hasura/migrations/1601400944178_update_permission_user_public_table_appointments/down.yaml create mode 100644 hasura/migrations/1601400944178_update_permission_user_public_table_appointments/up.yaml create mode 100644 hasura/migrations/1601401615051_alter_table_public_bodyshops_add_column_appt_alt_transport/down.yaml create mode 100644 hasura/migrations/1601401615051_alter_table_public_bodyshops_add_column_appt_alt_transport/up.yaml create mode 100644 hasura/migrations/1601401627582_update_permission_user_public_table_bodyshops/down.yaml create mode 100644 hasura/migrations/1601401627582_update_permission_user_public_table_bodyshops/up.yaml create mode 100644 hasura/migrations/1601401633544_update_permission_user_public_table_bodyshops/down.yaml create mode 100644 hasura/migrations/1601401633544_update_permission_user_public_table_bodyshops/up.yaml diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index c7d58371d..aa388492d 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -416,6 +416,27 @@ fields + + alt_transport + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + color false @@ -783,6 +804,27 @@ + + saved + 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 de53f065d..f2929c3b7 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 @@ -123,7 +123,10 @@ export function ScheduleCalendarHeaderComponent({ {(loadData.hoursOut || 0) && loadData.hoursOut.toFixed(2)} ({ + //setUserLanguage: language => dispatch(setUserLanguage(language)) +}); + +export function ScheduleAtChange({ bodyshop, event }) { + const [updateAppointment] = useMutation(UPDATE_APPOINTMENT); + const { t } = useTranslation(); + + const onClick = async ({ key }) => { + const result = await updateAppointment({ + variables: { appid: event.id, app: { alt_transport: key } }, + }); + + if (!!!result.errors) { + notification["success"]({ message: t("appointments.successes.saved") }); + } else { + notification["error"]({ + message: t("appointments.errors.saving", { + error: JSON.stringify(result.errors), + }), + }); + } + }; + const menu = ( + + {bodyshop.appt_alt_transport && + bodyshop.appt_alt_transport.map((alt) => ( + {alt} + ))} + + ); + return ( + + e.preventDefault()}> + + + + ); +} +export default connect(mapStateToProps, mapDispatchToProps)(ScheduleAtChange); diff --git a/client/src/components/schedule-event/schedule-event.component.jsx b/client/src/components/schedule-event/schedule-event.component.jsx index 82600aa7a..d7b0b795b 100644 --- a/client/src/components/schedule-event/schedule-event.component.jsx +++ b/client/src/components/schedule-event/schedule-event.component.jsx @@ -7,6 +7,7 @@ import { setModalContext } from "../../redux/modals/modals.actions"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; import PhoneFormatter from "../../utils/PhoneFormatter"; import DataLabel from "../data-label/data-label.component"; +import ScheduleAtChange from "./schedule-event.at.component"; import ScheduleEventColor from "./schedule-event.color.component"; const mapDispatchToProps = (dispatch) => ({ @@ -63,6 +64,10 @@ export function ScheduleEventComponent({ {(event.job && event.job.ownr_ph1) || ""} + + {event.alt_transport || ""} + + ) : null} @@ -129,6 +134,9 @@ export function ScheduleEventComponent({ (event.job && event.job.larhrs.aggregate.sum.mod_lb_hrs) || "0" })`} + {event.alt_transport && ( +
{event.alt_transport}
+ )} ) : (
diff --git a/client/src/components/schedule-job-modal/schedule-job-modal.component.jsx b/client/src/components/schedule-job-modal/schedule-job-modal.component.jsx index bf97c151e..6084bc46f 100644 --- a/client/src/components/schedule-job-modal/schedule-job-modal.component.jsx +++ b/client/src/components/schedule-job-modal/schedule-job-modal.component.jsx @@ -68,7 +68,7 @@ export function ScheduleJobModalComponent({ - + - + + + + {t("appointments.labels.history")} - + +