not going to mess around with your code since i don't have access to any sample data, but personally whenever i want to have something displayed or hidden based on a condition, i use inline css with a condition or ternary expression like this: