Button to change entity state

I followed everything you have said here and everything I work on samba 1.4.48.

But I need to find out how to get this:

when I click on “Table Occupied” I want to save the number of people in the ticket (obtained following this tutorial: Tracking Number of Persons and so A SIMPLE TICKET TAG) and some food that I add, however, that should not be sent to the kitchen until I do I click on Close.

How do I?