If you only have to support a demonstration of the concept, e.g., your prototype only has to be functional for the first five seats, you can keep your structure, with a different popup for each seat. The trick will be adding logic so the “Remove Selection” group/button in the repeater knows which seat to unselect.
Two ways I would approach this. The first is a kind of straightforward “brute force” method, and the second is less intuitive but more elegant with less code.
You obviously wouldn’t want to do either of these approaches for every seat. If you need to support any and every seat, I think the best approach would be to have a repeater for your seats. Then you can more easily target the appropriate row in the seat repeater and have one place for your code to handle any seat. Because the seat layout is not a clean repeated array, creating this seat repeater would be difficult–but not impossible. I’ve created some funky repeater layouts before, including a circle that could be rotated (think “Nest thermostat” dial.)
The basic approach would be to place one seat image in your repeater cell, then create a dynamic panel from it. Duplicate the state and replace the image widget with a hotspot of the same dimensions. Use this state to show a gap where there is no seat (e.g., to the right of seat 043. Looks like your seat rows are all lined up vertically, which is nice. If you have “offset” seats (e.g. seat row B starts half a seat width; or in your case, the handicapped seats have a special arrangement) you can add states with hotspots of various widths. Or for these special seats, maybe don’t include them in the repeater and handle them separately–maybe even just as above for the 7 or so handicapped seats.
In the seat repeater datasheet, include a column for the seat number, and a column for “selection state” (avoid using column names of “Selected” or “State” as these terms mean specific things in interaction code syntax; maybe use “Reserved” or “SelState” --something like that.
In the Item Loaded event, add some conditional cases to handle whether to show or hide the seat, and whether to show it as selected or not. (Add additional states as needed, e.g, “unavailable”, “handicapped” “VIP” etc. E.g.,
If "[[Item.SeatNum]]" equals "" Set Panel State of Seat to State2
// a gap
If "[[Item.Reserved]]" equals "true" Set Selected of SeatImage to "true"
Set the style for this seat repeater so the LAYOUT is set to Horizontal; select the Wrap (Grid) option and “Items per column” to the number of seats in the widest “seat row arrangement” (e.g., looks to be the top seat row with 32 seats.) Wherever there is a gap, include a blank row in your repeater datasheet.
Then, to add a seat, just use the Update Rows action with a rule of [[Item.SeatNum == 001]]
(or more generically and extensible, set OnLoadVariable to the seat number and a rule of [[Item.SeatNum == OnLoadVariable]]
…Then select the “Reserved” column and set the value to “true”. Do the same to remove a seat, setting the value to “false” (for some reason if you set a column value to blank it gets ignored.) Now, when you do this from inside the other repeater (“Selection Repeater”) you’ll need to be careful of syntax. Use “Item.” to refer to the same repeater and “TargetItem.” to refer to columns in another repeater. Place this action before the Delete Rows action. So, something like,
Update Rows
Seat Repeater set Reserved to "false" where [[TargetItem.SeatNum == Item.Seat_Number]]"
Delete Rows
Selection Repeater this row