IO-940 Clear event color and ats.

This commit is contained in:
Patrick Fic
2021-04-26 13:40:39 -07:00
parent ccc1a37ebb
commit 438692ea7c
2 changed files with 17 additions and 3 deletions

View File

@@ -21,7 +21,10 @@ export function ScheduleEventColor({ bodyshop, event }) {
const onClick = async ({ key }) => {
const result = await updateAppointment({
variables: { appid: event.id, app: { color: key } },
variables: {
appid: event.id,
app: { color: key === "null" ? null : key },
},
});
if (!!!result.errors) {
@@ -34,6 +37,13 @@ export function ScheduleEventColor({ bodyshop, event }) {
});
}
};
const selectedColor =
event.color &&
bodyshop.appt_colors &&
bodyshop.appt_colors.filter((color) => color.color.hex === event.color)[0]
?.label;
const menu = (
<Menu selectedKeys={[event.color]} onClick={onClick}>
{bodyshop.appt_colors &&
@@ -42,11 +52,15 @@ export function ScheduleEventColor({ bodyshop, event }) {
{color.label}
</Menu.Item>
))}
<Menu.Divider />
<Menu.Item key={"null"}>{t("general.actions.clear")}</Menu.Item>
</Menu>
);
console.log(`event`, event);
return (
<Dropdown overlay={menu}>
<a href=" #" onClick={(e) => e.preventDefault()}>
{selectedColor}
<DownOutlined />
</a>
</Dropdown>