|
@@ -1,20 +1,37 @@
|
|
|
import React from 'react';
|
|
|
import { Button, Tooltip } from 'antd';
|
|
|
import { DeleteOutlined } from '@ant-design/icons';
|
|
|
+import { useDispatch, useSelector } from 'react-redux';
|
|
|
+import { deleteWorkThunk } from '@/states/patient/worklist/slices/workSlice';
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
+import { AppDispatch, RootState } from '@/states/store';
|
|
|
|
|
|
interface ActionButtonProps {
|
|
|
icon: React.ReactNode;
|
|
|
tooltip: React.ReactNode;
|
|
|
+ onClick?: () => void;
|
|
|
}
|
|
|
|
|
|
-const ActionButton: React.FC<ActionButtonProps> = ({ icon, tooltip }) => (
|
|
|
+const ActionButton: React.FC<ActionButtonProps> = ({
|
|
|
+ icon,
|
|
|
+ tooltip,
|
|
|
+ onClick,
|
|
|
+}) => (
|
|
|
<Tooltip title={tooltip}>
|
|
|
- <Button icon={icon} />
|
|
|
+ <Button icon={icon} onClick={onClick} />
|
|
|
</Tooltip>
|
|
|
);
|
|
|
|
|
|
const ActionPanel: React.FC = () => {
|
|
|
+ const dispatch = useDispatch<AppDispatch>();
|
|
|
+ const selectedIds = useSelector(
|
|
|
+ (state: RootState) => state.workSelection.selectedIds
|
|
|
+ );
|
|
|
+
|
|
|
+ const handleDelete = () => {
|
|
|
+ dispatch(deleteWorkThunk(selectedIds)); // Use the selected IDs from the Redux state
|
|
|
+ };
|
|
|
+
|
|
|
return (
|
|
|
<div className="flex flex-wrap gap-2 w-full">
|
|
|
<ActionButton
|
|
@@ -25,6 +42,7 @@ const ActionPanel: React.FC = () => {
|
|
|
defaultMessage="actionPanel.deleteTask"
|
|
|
/>
|
|
|
}
|
|
|
+ onClick={handleDelete}
|
|
|
/>
|
|
|
<ActionButton
|
|
|
icon={<DeleteOutlined />}
|