IO-1055 Blocked Day improvements.

This commit is contained in:
Patrick Fic
2021-05-10 15:55:33 -07:00
parent 5a40ce21ca
commit ef4d6de1fe
5 changed files with 56 additions and 24 deletions

View File

@@ -24,6 +24,15 @@ export function ScheduleEventComponent({
}) {
const { t } = useTranslation();
const [visible, setVisible] = useState(false);
const blockContent = (
<div>
<Button onClick={() => handleCancel(event.id)} disabled={event.arrived}>
{t("appointments.actions.cancel")}
</Button>
</div>
);
const popoverContent = (
<div>
{!event.isintake ? (
@@ -167,7 +176,7 @@ export function ScheduleEventComponent({
visible={visible}
onVisibleChange={(vis) => setVisible(vis)}
trigger="click"
content={popoverContent}
content={event.block ? blockContent : popoverContent}
style={{ height: "100%", width: "100%" }}
>
{RegularEvent}

View File

@@ -30,26 +30,27 @@ export default function ScheduleEventContainer({ bodyshop, event, refetch }) {
return;
}
const jobUpdate = await updateJob({
variables: {
jobId: event.job.id,
if (event.job) {
const jobUpdate = await updateJob({
variables: {
jobId: event.job.id,
job: {
date_scheduled: null,
scheduled_in: null,
status: bodyshop.md_ro_statuses.default_imported,
job: {
date_scheduled: null,
scheduled_in: null,
status: bodyshop.md_ro_statuses.default_imported,
},
},
},
});
if (!!jobUpdate.errors) {
notification["error"]({
message: t("jobs.errors.updating", {
message: JSON.stringify(jobUpdate.errors),
}),
});
return;
if (!!jobUpdate.errors) {
notification["error"]({
message: t("jobs.errors.updating", {
message: JSON.stringify(jobUpdate.errors),
}),
});
return;
}
}
if (refetch) refetch();
};