I am creating a form submit and i want my staff to submit hours of operation in a business directory.
Any ideas to have a clean design with each day of the week and a drop down for each hour of the day, and an option for Closed.?
please any help really struggling with this.
@Sean_Knight , Darren and I were having this exact conversation several weeks ago and he created something rather elegant, but fairly complicated to get this to work efficiently.
@Uzo this example is a good option for those that have one establishment.
What would you build for apps that have multiple businesses with varying hours? I guess a transposition of an open close times per day (14 columns) into a working table?
for us, its for a chamber of commerce glide page crm where staff manages the data of the member business and one of the data sets is hours of operation.
So indeed multiple business-
As Bob mentioned earlier, I have something that you might be able to use. It’s a little complicated, so not easy to explain. I’ll make a video later today and share.
@Sean_Knight - this may or may not be useful for you, but it is what @Robert_Petitto referred to in his earlier reply.
Typically, for this sort of thing there are two approaches you can take.
The first approach involves creating a series of columns in your Businesses table. Essentially a pair of Open/Close time columns for each day of the week. This approach is okay, but can become a bit fiddly if you ever want to present them as a list. It’s the approach that Bob alluded to here…
The second approach would involve creating a second table, and using one row per day per business, and then relating that back to your Businesses table. This approach is much cleaner, but can eat up your row count very quickly.
What I am sharing below introduces a third approach, where you store the open/close times for each business in a single column in the Businesses table as a JSON object, and use a helper table to manipulate the object. This is a technique that I’ve been developing over the past few months and have used in a handful of projects.
Here is a video that gives a walk through of how it works:
And here is a copyable template:
@Robert_Petitto - I’m not sure if you ended up using this idea in your project, but just in case - there are a couple of things I’ve changed in this template version:
I’ve abandoned the JQ plugin in favour of pure JavaScript. I did this because in one of my other projects I found that the JQ plugin doesn’t scale well.
I fixed the bug where the hour of the day comparison sometimes doesn’t work (for partial hours)
I found and fixed another bug where editing hours sometimes didn’t save correctly. This bug was a side effect of the fact that you can’t reset multiple rows with a single action. Fixed this with a variant of @Jeff_Hager’s parent_id approach.
@Darren_Murphy this is so helpful. I have open/close hours for restaurants in my local directory app and was contemplating adding this feature but had not yet tackled the logic. I will definitely add this method to an update. Thanks!
Actually, I skipped over that part in the video. In hindsight, I probably should have explained it but I was worried about the video being too long
It’s the business/parent-set User Specific Column in the Business Hours Helper table.
The form that is used for editing the hours for each business is a custom form, with each of the Open/Close times being written to User Specific columns. There is some if-then-else logic that determines what should be written to each of these columns as the form is opened, and they are cleared when the form is saved. The “bug” was that it is possible for a user to dismiss the form without saving, in which case the User Specific column values for that row are not cleared. This can mess up the if-then-else logic because those values will still be there when you view the next business, and so it can appear as though that businesses hours are messed up. The parent-set value addresses this. When the form is opened, that column is set to the business ID, and then that’s included in the if-then-else logic, ie. only consider the User Specific Values valid if the parent-id matches the current business ID.
hmm, I wonder if this might be an issue with Private Templates. When they are published, the link includes a token, and I’m guessing that might expire.
I just published it again and generated a new link. Try the following:
After you click “Copy in Glide”, you should see the following:
At that point you can choose which team you want it in, and then click on copy and it should work.