Refactored the onInventoryClick method for easier maintaining

Hey @AppleTechOnline,

I'd refactored this huge ```onInventoryClick``` event handler with a ```switch``` statement for easier maintaining of further features as well as doing a little bit of housekeeping (removing superfluous lines, simplifing ```if``` conditions and fixing the indentation).

It would be great, if you could do a CR and test the stuff.