Add flipping functionality for each panel on the grid