diff --git a/src/components/manage/VFPanel/VFPanel.jsx b/src/components/manage/VFPanel/VFPanel.jsx index 8645d90..4d980f6 100644 --- a/src/components/manage/VFPanel/VFPanel.jsx +++ b/src/components/manage/VFPanel/VFPanel.jsx @@ -158,6 +158,11 @@ const VFPanel = ({ moment: Moment, toastify }) => { }, [searchableText]); const feedbacks = useSelector((state) => state.getFeedbacks); + const can_delete_feedbacks = useSelector( + (state) => + state.getFeedbacks.result?.actions?.can_delete_feedbacks ?? false, + ); + const isUnauthorized = useMemo( () => feedbacks?.error && feedbacks?.error?.status === 401, // eslint-disable-next-line react-hooks/exhaustive-deps @@ -251,7 +256,10 @@ const VFPanel = ({ moment: Moment, toastify }) => { {intl.formatMessage(messages.feedbacks_controlpanel)} - + {itemsSelected.length > 0 && ( @@ -261,13 +269,15 @@ const VFPanel = ({ moment: Moment, toastify }) => { {intl.formatMessage(messages.items_selected)}
- + {can_delete_feedbacks && ( + + )}
)} @@ -293,27 +303,29 @@ const VFPanel = ({ moment: Moment, toastify }) => { > - - { - if (o.checked) { - setItemsSelected(feedbacks?.result?.items); - } else { - setItemsSelected([]); + {can_delete_feedbacks && ( + + - + onChange={(e, o) => { + if (o.checked) { + setItemsSelected(feedbacks?.result?.items); + } else { + setItemsSelected([]); + } + }} + /> + + )} { {feedbacks?.loaded && feedbacks.result?.items?.map((item) => ( - - is.url === item.url, - )} - onChange={(e, o) => { - if (o.checked) { - let s = [...itemsSelected]; - s.push(item); - setItemsSelected(s); - } else { - setItemsSelected( - itemsSelected.filter( - (i) => i.url !== item.url, - ), - ); - } - }} - /> - + {can_delete_feedbacks && ( + + is.url === item.url, + )} + onChange={(e, o) => { + if (o.checked) { + let s = [...itemsSelected]; + s.push(item); + setItemsSelected(s); + } else { + setItemsSelected( + itemsSelected.filter( + (i) => i.url !== item.url, + ), + ); + } + }} + /> + + )} { +const VFPanelMenu = ({ toastify, doSearch, can_delete_feedbacks }) => { const intl = useIntl(); const dispatch = useDispatch(); const [openConfirm, setOpenConfirm] = useState(false); @@ -99,21 +99,23 @@ const VFPanelMenu = ({ toastify, doSearch }) => { - - - - - + {can_delete_feedbacks && ( + + + + + + )}