From a8b6bf4f917ed1a453585eb51445e28bdc107d11 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 28 Jan 2023 07:36:48 -0800 Subject: Delete report button --- modern/src/reports/ScheduledPage.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/modern/src/reports/ScheduledPage.js b/modern/src/reports/ScheduledPage.js index 831588b0..7dd225ba 100644 --- a/modern/src/reports/ScheduledPage.js +++ b/modern/src/reports/ScheduledPage.js @@ -10,6 +10,7 @@ import { useTranslation } from '../common/components/LocalizationProvider'; import PageLayout from '../common/components/PageLayout'; import ReportsMenu from './components/ReportsMenu'; import TableShimmer from '../common/components/TableShimmer'; +import RemoveDialog from '../common/components/RemoveDialog'; const useStyles = makeStyles((theme) => ({ columnAction: { @@ -24,8 +25,10 @@ const ScheduledPage = () => { const calendars = useSelector((state) => state.calendars.items); + const [timestamp, setTimestamp] = useState(Date.now()); const [items, setItems] = useState([]); const [loading, setLoading] = useState(false); + const [removingId, setRemovingId] = useState(); useEffectAsync(async () => { setLoading(true); @@ -39,7 +42,7 @@ const ScheduledPage = () => { } finally { setLoading(false); } - }, []); + }, [timestamp]); const formatType = (type) => { switch (type) { @@ -76,7 +79,7 @@ const ScheduledPage = () => { {item.description} {calendars[item.calendarId].name} - {}}> + setRemovingId(item.id)}> @@ -84,6 +87,18 @@ const ScheduledPage = () => { )) : ()} + { + setRemovingId(null); + if (removed) { + setTimestamp(Date.now()); + } + }} + /> ); }; -- cgit v1.2.3