I am making/trying to make a reservation system with Craft. Logged-in members should be able to make a reservation for a hotel room on the front-end, and change it later.
I am keeping a stock for the available hotel rooms in entries. I have channel section called "rooms". In that section are 2 entries (= 2 different hotels). Every entry has information about the hotel (name, location,...) and has a matrix field with avaialble dates and stock for that date.
What I want to do: a logged-in user can choose a date and choose a number of rooms on that date. He should also fill in all his personal details. I was thinking about making entries of that info in a new channel (e.g. "reservations"). The hard part is: when a user selects a number of rooms, I want the stock of that night edited in the rooms entry. So if we heve 20 rooms available, and a member makes a reservation for 2, the stock should be set to 18.
I guess the first answer to this will be "write a plugin", but I have never written a plugin before, and I have no idea what's the best practice or where to start. Any ideas?