This week I started tackling some of the odds and ends I’d like to address in the project.
One of them is the ability to edit shifts instead of having to remove and recreate them when changes are necessary. Now managers can use the edit button to adjust start and end times, as well as the assigned employee. The time and employee selection offer the same validation as a new shift, and changes are reflected without refreshing.
I am still working with regex to try and offer more forgiving time entry than strototime() can offer. My goal is to break up the pieces of the time (hours, minutes, morning/afternoon if available) into an array using the the pattern and preg_match(), then rebuild the time in a known good format to pass on to strototime(). The current version of my regex reads like this:
The problem is that it fails when someone enters a time like 18:00 in the 24 hour format. Adding a ? on the last block prevents the pattern from working at all.
Other stuff. Shifts and punches that can be selected now have a hover border, making it easier to tell they can be selected. Modal dialogs (the popups to add a shift, timepair, user etc) and success boxes are displayed in a fixed position so their display is more consistent. Before they would float down the page depending on the amount of rows.