Templates Plugins Courses

ZQ Drag-n-Drop Calendar - Is it possible to restrict the drag feature

Hi,

Is it possible to restrict users from being able to drag (all or certain) events in their calendar? - I don’t what them to be able to change the event times if the event was created by another user. Is this possible or could it be added in please?

Quite urgent and would appreciate any assistance or advice for a workaround if this is not possible.

Thanks!

Hi @mman,

Thanks for asking. Unfortunately, this plugin doesn’t implement the feature to disable the dragging functionality per se, but if you’d like to restrict your users from changing or creating calendar events/schedules, you can simply use plugin’s events in combination with a couple of actions, especially the Calendar Schedule Was Clicked or Calendar Data Was Changed event.

And set a condition to it so only the current user can proceed with certain actions (or any other logic you prefer). As for actions - you can use the Show/Hide Calendar Creation Button or Show/Hide Schedule Creation Button as a workaround.

Hope it helps.

Best,
Alex

Thanks for the quick reply @alexander

Much appreciated for the explanation and for suggesting a workaround. The main problem at the moment I am facing from getting the “Calendar Data Was Changed” event working is the calendar is not pulling the Event ID correctly. Please see the screenshots below - I’ve set up two workflows to test this:

Workflow 1 - Clicking on the event and opening when the criteria “_Type is personal” is met.

image

When looking at this workflow run under debug mode, everything works as expected. So I’m able to pull the Event ID correctly and search for the CalendarEvent to get the data “_type”

Workflow 2 - Changing data (dragging the event) when criteria “_isDraggable is no” will revert the event data to the previously saved data - so the data/time of the event doesn’t change

As can be seen above the condition is exactly the same as for workflow 1, but instead we are looking at the “_isDraggable” data field. This isn’t reliable as one of three things happen when events are dragged (to change the start/end time and date).

  1. The correct Event ID is passed through and everything works as expected
  2. The Event ID returns as empty
  3. The Event ID of a different event is returned

Edit: It seems that the Event ID/data for the first calendar event dragged from the time of load is saved and consistently used. Even when a Refresh Calendar step is used.

Hope you can take a look into this please,
Happy to explain more or arrange access to see this happen.

Hi @mman,

Thanks for your feedback. Sorry for misunderstanding, but are you actually trying to implement the restriction or user filtering with this setup? Because if you are willing to make sure that only the current user is able to preview or modify its calendar information, you can simply use plugin’s Owner’s email and Current user’s email fields:

image

Meaning, it is possible to dynamically set user’s signup/login email and only current user will be able to access his calendar information.

You can find more guidance in our docs.

Hope it helps. :pray:

Hi @alexander,

So no, the calendar has a two main event types - 1. Personal events that they can drag and reschedule easily; 2. Events generated by either themselves or another user dictating a time to meet/chat, however we don’t want to allow them to reschedule the date/time of the event through drag and dropping as we require both users to approve changes. So instead, we used the Event ID to identify the CalendarEvent and the data field “_isDraggable” to see whether the user is allowed to drag/reschedule this calendar event.

Our database setup is:

  • Calendars - data fields: all required for ZQ Calendar
  • CalendarEvents - data fields: all required for ZQ Calendar; isDraggable (Bool)
  • User - data fields: Student; other non-related fields
  • Student - data fields: List of CalendarEvents

Whenever an event is created, we link it to the database Student under List of CalendarEvents
This is to help with searching for events when we have a large number of users and events, rather than using “Do search for”. Hence why I filter events using the EventID.

But the main issue is that the plugin isn’t correctly pulling across the correct EventID. So if I create two events on the calendar of different types (one with isDraggable set to yes [lets call this Event A] and the other to no [Event B]).

So, when I drag Event A things work as expected, but when I drag Event B, I can drag it when I’m not supposed to be able to, and in the debug menu it’s showing the ID of Event A when it should be Event B.

Hope this explanation provides a better idea of the issue.
Thanks! :slight_smile:

Hi @mman,

Thanks a lot for your feedback. I’m afraid the possible issue is actually in the searching/filtering implementation. Perhaps it would be best to simply Do a search for and adding the same constraint for ID to be equal with calendar Event's ID value, whether it is first on second event.

Try to still use this implementation. But if you have the same or any other issues, you can go to Settings - Collaboration tab within your editor. Add our [email protected] account to your collaborator’s list. Also, please tell us your app name and page name where this problem occurs on test.

Note: avoid the warning message regarding plan, as we are an agency and you can easily add us to your collaborators.

We’ll investigate it inside your app and get back to you with a feedback asap. :pray:

Hi @alexander

Thanks for the reply,

I’ve given this a try and there still seems to be the same issues - the ID being pulled across is empty. Tried this a few times and still has the same issue.
image
image

I’ve added you as a collaborator - the app name: Studentrank (smooj.uk); Page name: calendar

Cheers,

Hi @mman,

Thanks for your feedback. Unfortunately, we are not able to test it out as we have read-only mode and when previewing the calendar page, the app redirects us to index, which makes it hard to investigate.

Could you please create a new testing account and share all steps required to follow, in order to successfully reproduce the problem, or give full permissions to your editor if you don’t mind. This way, we can test the app much faster.

Thanks for understanding.

Hi @mman,

I’m reaching out with an update. We managed to fix our plugin, it was a state-related issue, which is why it was not updating the Event ID on drag-n-drop, but it was updating for clicked event. Now, you should be able to drag and drop different events and it will keep their appropriate Event IDs.

Please upgrade the plugin to the latest version, refresh your app and give it a try again. But a small note: we are not aware of the custom ‘isDraggable’ implementation, it should not cause any trouble, but if you simply place the calendar with a couple of events, then try to drag them into different dates, it updates the EventID as well.

Also, you do not need to use the ‘refresh’ action, because once you drag the event, it updates and even keeps it on page refresh.

Let me know if you manage to make things work on your side as well. :pray:

Hi @alexander

Brill - thanks for the update and for info regarding the refresh action. However, for some reason, the calendars aren’t displaying properly after the plugin update. I’ve attached screenshots of before and after the plugin update - and I created a new calendar page (calendar1) where I deleted and re-created the calendar element.

Before update:


After update:

When looking at the debugger, it’s throwing out an element error as can be seen below.

Thanks
Matt

Uh, oh! Sorry about this one, @mman

We’ll just have to publish this plugin again with some tweaks, because this ‘$jscomp’ error pops up when Bubble minifies plugin code, so we just need to push another update with disabling this feature on purpose, then you’ll be able to give it a try again. :pray:

1 Like

Hi @mman,

You can upgrade the plugin to the latest version then give it a try again. Plugin should be up-and-running on your side as well.

Thanks for patience!

1 Like

Hi @alexander

Brilliant! Thanks for the help - everything currently working as expected :relaxed:

Much appreciated!

2 Likes

Thanks @mman, I’m glad it is working on your side!

If you like our plugin so far, could you please rate it by going to Plugins tab in Bubble editor? You can find the plugin by name and give it as many stars as it deserves. The more feedback we get, the more motivated we are to build great plugins :pray:

1 Like

More than happy to submit!

1 Like

Hi @mman,

We have fixed the plugin. Please upgrade it to the latest version, refresh your app and give it a try. Also please note that you can Create or Delete without actually refreshing the calendar. It updates both database and front-end automatically.

Best,

1 Like

Brilliant! Thanks @alexander and the team for getting this fix out, much appreciated.

1 Like