Merge branch 'feature/IO-2445-block-types' into release/2023-11-10

This commit is contained in:
Patrick Fic
2023-11-09 13:39:21 -08:00
5 changed files with 59 additions and 4 deletions

View File

@@ -364,6 +364,27 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>unblock</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node> <concept_node>
<name>viewjob</name> <name>viewjob</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>

View File

@@ -4,6 +4,7 @@ import {
Divider, Divider,
Dropdown, Dropdown,
Form, Form,
Input,
Menu, Menu,
notification, notification,
Popover, Popover,
@@ -34,6 +35,8 @@ import ScheduleManualEvent from "../schedule-manual-event/schedule-manual-event.
import ScheduleAtChange from "./job-at-change.component"; import ScheduleAtChange from "./job-at-change.component";
import ScheduleEventColor from "./schedule-event.color.component"; import ScheduleEventColor from "./schedule-event.color.component";
import ScheduleEventNote from "./schedule-event.note.component"; import ScheduleEventNote from "./schedule-event.note.component";
import { useMutation } from "@apollo/client";
import { UPDATE_APPOINTMENT } from "../../graphql/appointments.queries";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop, bodyshop: selectBodyshop,
@@ -58,16 +61,44 @@ export function ScheduleEventComponent({
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const history = useHistory(); const history = useHistory();
const searchParams = queryString.parse(useLocation().search); const searchParams = queryString.parse(useLocation().search);
const [updateAppointment] = useMutation(UPDATE_APPOINTMENT);
const [title, setTitle] = useState(event.title);
const blockContent = ( const blockContent = (
<div> <Space direction="vertical" wrap>
<Input
value={title}
onChange={(e) => 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",
},
],
},
},
});
}}
/>
<Button <Button
onClick={() => handleCancel({ id: event.id })} onClick={() => handleCancel({ id: event.id })}
disabled={event.arrived} disabled={event.arrived}
> >
{t("appointments.actions.cancel")} {t("appointments.actions.unblock")}
</Button> </Button>
</div> </Space>
); );
const popoverContent = ( const popoverContent = (

View File

@@ -27,6 +27,7 @@
"preview": "Preview", "preview": "Preview",
"reschedule": "Reschedule", "reschedule": "Reschedule",
"sendreminder": "Send Reminder", "sendreminder": "Send Reminder",
"unblock": "Unblock",
"viewjob": "View Job" "viewjob": "View Job"
}, },
"errors": { "errors": {

View File

@@ -27,6 +27,7 @@
"preview": "", "preview": "",
"reschedule": "Reprogramar", "reschedule": "Reprogramar",
"sendreminder": "", "sendreminder": "",
"unblock": "",
"viewjob": "Ver trabajo" "viewjob": "Ver trabajo"
}, },
"errors": { "errors": {

View File

@@ -27,6 +27,7 @@
"preview": "", "preview": "",
"reschedule": "Replanifier", "reschedule": "Replanifier",
"sendreminder": "", "sendreminder": "",
"unblock": "",
"viewjob": "Voir le travail" "viewjob": "Voir le travail"
}, },
"errors": { "errors": {