Fixed logic to handle the select/unselect of portfolio checkboxes and the toggling of the active/inactive states of the action buttons