In this episode, we add functionality to let users pick a time slot when booking an appointment. We wire up our UI so that when a user clicks a time slot button, it records the chosen time in the form state using Livewire.
You’ll see how we set up a new method to handle the time selection, update the form state accordingly, and make sure both the date and time show up as you interact with the checkout form. To keep things smooth, we also update the way we’re displaying the currently chosen slot, adding a bit of styling so it’s visually clear which time is selected.
There’s a quick detour to fix a small error about initializing the time, which we handle by allowing null values in the form. By the end of this video, the UI both works and visually reflects the user’s selected slot, making the experience much more interactive and clear.