diff --git a/src/components/accessories/table/Table.tsx b/src/components/accessories/table/Table.tsx index f04200578..364905f7e 100644 --- a/src/components/accessories/table/Table.tsx +++ b/src/components/accessories/table/Table.tsx @@ -125,7 +125,11 @@ const Table: FunctionComponent = ({ title={labels?.edit?.tooltip ?? "Edit"} size="small" disabled={disableAction(row, "edit")} - onClick={() => onEdit && onEdit(row)} + onClick={ + disableAction(row, "edit") + ? () => {} + : () => onEdit && onEdit(row) + } > @@ -137,7 +141,11 @@ const Table: FunctionComponent = ({ size="small" title={labels?.delete?.tooltip ?? "Delete"} disabled={disableAction(row, "delete")} - onClick={handleOpenConfirmation(row, "delete")} + onClick={ + disableAction(row, "delete") + ? () => {} + : handleOpenConfirmation(row, "delete") + } > = ({ size="small" title={labels?.print?.tooltip ?? "Print"} disabled={disableAction(row, "print")} - onClick={() => onPrint && onPrint(row)} + onClick={ + disableAction(row, "print") + ? () => {} + : () => onPrint && onPrint(row) + } > @@ -164,7 +176,11 @@ const Table: FunctionComponent = ({ size="small" title={labels?.view?.tooltip ?? "View details"} disabled={disableAction(row, "view")} - onClick={() => onView && onView(row)} + onClick={ + disableAction(row, "view") + ? () => {} + : () => onView && onView(row) + } > @@ -176,7 +192,9 @@ const Table: FunctionComponent = ({ size="small" title={labels?.pay?.tooltip ?? "Add a payment"} disabled={disableAction(row, "pay")} - onClick={() => onPay && onPay(row)} + onClick={ + disableAction(row, "pay") ? () => {} : () => onPay && onPay(row) + } > @@ -189,7 +207,11 @@ const Table: FunctionComponent = ({ size="small" title={labels?.close?.tooltip ?? "Close the bill"} disabled={disableAction(row, "close")} - onClick={() => onClose && onClose(row)} + onClick={ + disableAction(row, "close") + ? () => {} + : () => onClose && onClose(row) + } > @@ -202,7 +224,11 @@ const Table: FunctionComponent = ({ size="small" title={labels?.cancel?.tooltip ?? "Cancel"} disabled={disableAction(row, "cancel")} - onClick={handleOpenConfirmation(row, "cancel")} + onClick={ + disableAction(row, "cancel") + ? () => {} + : handleOpenConfirmation(row, "cancel") + } > @@ -214,7 +240,9 @@ const Table: FunctionComponent = ({ size="small" title={addTitle ?? labels?.add?.tooltip ?? "Add"} disabled={disableAction(row, "add")} - onClick={() => onAdd && onAdd(row)} + onClick={ + disableAction(row, "add") ? () => {} : () => onAdd && onAdd(row) + } > @@ -226,7 +254,11 @@ const Table: FunctionComponent = ({ size="small" disabled={disableAction(row, "restore")} title={labels?.restore?.tooltip ?? t("common.restore")} - onClick={handleOpenConfirmation(row, "restore")} + onClick={ + disableAction(row, "restore") + ? () => {} + : handleOpenConfirmation(row, "restore") + } > @@ -238,7 +270,11 @@ const Table: FunctionComponent = ({ size="small" disabled={disableAction(row, "softDelete")} title={labels?.softDelete?.tooltip ?? t("common.softDelete")} - onClick={handleOpenConfirmation(row, "softDelete")} + onClick={ + disableAction(row, "softDelete") + ? () => {} + : handleOpenConfirmation(row, "softDelete") + } >