All is not lost. You just need to put the chain back on the upper derailleur pulley. The minor bend in the derailleur
pulley cage and hanger can be bent back, by hand even.
In this photo, the pulley that needs to have the chain wrapped back around it is the non-Red one on the right:
Also it looks like you have very little chain-tension, like the chain is about 4" too long. If you have a triple chainring in front, NEVER ride it around in the smallest chainring up front. Only use the smallest chainring with the two biggest cogs in back on hills. Most of the time, you'll want to be in the middle chainring in front. Then on downhills, use the big chainring with the two smallest cogs in back.
For now, be conscious of which gear you are in back and do not shift up any more than necessary to get into the biggest cog. Change gears one at a time and verify it shifted. If you can find the L limit screw, spin it in a couple of turns to prevent the derailleur from moving past the largest cog into spokes.