diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 304566b29..f07d49c89 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -364,6 +364,27 @@ + + unblock + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + viewjob false diff --git a/client/src/components/job-at-change/schedule-event.component.jsx b/client/src/components/job-at-change/schedule-event.component.jsx index 890786d40..61739c9b1 100644 --- a/client/src/components/job-at-change/schedule-event.component.jsx +++ b/client/src/components/job-at-change/schedule-event.component.jsx @@ -4,6 +4,7 @@ import { Divider, Dropdown, Form, + Input, Menu, notification, Popover, @@ -34,6 +35,8 @@ import ScheduleManualEvent from "../schedule-manual-event/schedule-manual-event. import ScheduleAtChange from "./job-at-change.component"; import ScheduleEventColor from "./schedule-event.color.component"; import ScheduleEventNote from "./schedule-event.note.component"; +import { useMutation } from "@apollo/client"; +import { UPDATE_APPOINTMENT } from "../../graphql/appointments.queries"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -58,16 +61,44 @@ export function ScheduleEventComponent({ const [visible, setVisible] = useState(false); const history = useHistory(); const searchParams = queryString.parse(useLocation().search); - + const [updateAppointment] = useMutation(UPDATE_APPOINTMENT); + const [title, setTitle] = useState(event.title); const blockContent = ( -
+ + setTitle(e.currentTarget.value)} + onBlur={async () => { + await updateAppointment({ + variables: { + appid: event.id, + app: { + title: title, + }, + }, + optimisticResponse: { + update_appointments: { + __typename: "appointments_mutation_response", + returning: [ + { + ...event, + title: title, + __typename: "appointments", + }, + ], + }, + }, + }); + }} + /> + -
+ ); const popoverContent = ( diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 0ef9e896f..0695dce7b 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -27,6 +27,7 @@ "preview": "Preview", "reschedule": "Reschedule", "sendreminder": "Send Reminder", + "unblock": "Unblock", "viewjob": "View Job" }, "errors": { diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 5d9d8cb9c..d04cb960e 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -27,6 +27,7 @@ "preview": "", "reschedule": "Reprogramar", "sendreminder": "", + "unblock": "", "viewjob": "Ver trabajo" }, "errors": { diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 1e0d6141b..4931aed2b 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -27,6 +27,7 @@ "preview": "", "reschedule": "Replanifier", "sendreminder": "", + "unblock": "", "viewjob": "Voir le travail" }, "errors": {