You've had good advice already. I'll just add a couple of thoughts:
Why do you think you may need the Ubiquiti switch? By that, I mean do you know you
need a managed switch (VLANs, tagging, port mirroring, LAGG etc)? Or was it just a 'nice switch' recommended by someone? Do you need 10Gb or just gigabit? Do you need PoE? All of these can and will influence choices. Do you have much networking experience, or do you need plug and play?
An enterprise pull Brocade switch is cheap on eBay even for 10Gb, and you can get free licences on
STH forums. They're manual config though, and some models are loud while others are quiet (guide available on STH). You'll get solid, enterprise grade 10Gb PoE cheaper that way than even a low end basic Ubiquiti switch. If all you need is unmanaged non-POE gigabit, though, things change significantly. Basically any rack-mountable gigabit unmanaged switch will do, whether brand new or (again) enterprise pull for cheap on eBay with the understanding that you'll get better quality underlying hardware as a trade off for the second hand nature. Most 'not the cheapest' gigabit switches come with the option of screw-in rack ears these days - Netgear, TP-Link etc.
How are you designing this network cupboard? Is there a rack to mount hardware in, or is it just a shelf/board with stuff randomly placed on it? This matters, as the recommendation for rack mount vs desktop/standalone hardware may differ somewhat. You talk about patch panels, so I assume rack mount. It may (will) be cheaper to get a wall mounted frame rather than full cabinet, if you only need a few bits of equipment (patch panel, switch, router).
As said above, patch panels tidy things up and make moving connections or changing out switching easier. Additionally, if done properly your infrastructure cable (i.e. the runs between rooms back to the rack/network cupboard) will be solid core copper cabling. Such cables are great for in-wall placement but they become friable and snap with repeated bending/moving/usage. They are also more difficult to get into RJ45 plastic Ethernet jacks, which are designed for stranded cable. Because of this, patch cables (ones you physically use and interact with) are made of
stranded copper cable, with many fine strands twisting to make one overall 'cable' (think long hair in a ponytail). This means your solid core infrastructure cables terminate (are punched down) into jacks on a patch panel, and then you have smaller stranded patch leads with RJ45 connectors on from the patch to the switch.
For the relatively cheap price of a patch panel, I'd get one. You can even buy one that accepts modules rather than having the terminals built in. That way you can easily punch down each cable into a module before clicking/plugging in the module to the patch panel. It's a time saver overall, and makes things easier. Lots of options, check out some YouTube videos on 'network closets' (most of them are American).