Hi
I'm building an app in which the user can request vacation leaves: he must be able do request full days, half a day, or just some hours.
The user will also have a display that indicates how many days and hours of leave the user has left.
At the data table, I'm thinking about creating a "From" and a "To" column, for the start and end dates, respectively, with the number of hours.
I need help with two points:
1 - How do I limit the hour selection to a certain number of hours? For example, if the user works from 9 to 5 and wants to take half a day, he should only be able to take the morning or the afternoon off, and if he wants to take some hours off, I need to limit the selection to working hours.
2 - How do I make a countdown of the days and hours of leave the user has left? I'm thinking about creating a field with a starting value (let's say 25 days), that's being updated everytime a request is approved. The formula I have in mind for full days should be a count of the number of days between "From" and "To" columns. For the hours, I'm thinking on having an "hours" panel next to "days" (on the total leave time left), with an initial value of "23" (hours): when it reaches <"00" it starts on "23" again, and it's subtracted a day on the "days" counter.
Is there an easier way to do this? I feel like I'm complicating this exercise...