All threads / Creating appointments with calendar integration

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Creating appointments with calendar integration

Daniel Kehoe asked in General

Hi, I'm working on an app for a personal trainer, at the moment I've got a User class with STI for clients and trainers. The way I would like the appointments to work is from the trainers side they can create appointments by choosing a date, time, trainer and client. Then from the clients side they will have the ability to create/ request an appointment by choosing a date, time and themselves as the client, however this will need confirmation and which trainer will be assigned to the appointment from one of the trainers before the appointment can be completed.

I'm just unsure about the actual implementation of this at the moment I've got an appointment model with appointment_at as datetime, duration as integer, confirmed as boolean, client_id, trainer_id. It is working at the moment and saving appointments, but only from the trainers point, with the client appointment creation the trainer_id wont be entered into the database until its confirmed by the trainer. So I wondered is it possible and good practice to have conditional if statements in the appointments controller create action to check for user type and in the case of the client appointment creation allow the trainer_id to be nil until confirmed. Also what would be the best way to implement the trainer confirmation.

To have the whole thing looking more elegant I would like to have appointments displayed in a calendar, and I like the look of simple calendar, ideally being able to alter between day view of hours and week view of days would be the best way, is this possible with simple calendar?

Thanks
Daniel

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 33,665+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.