enable/disable days in element date

afacuse

New Member
Hello
I am making a user registration events, the case is quite particular and I could not adapt any compoente.

I have a table called event that has the following fields

Type
Region
city
date

and I have a table named record containing:

user
event

In the event log I have to enable available dates within a date element for the type, region and city.

leave a picture to better explain the idea.

tanks!
 

Attachments

  • example.jpg
    example.jpg
    52.1 KB · Views: 583
There is a way to disable dates on our date element popup, using Javascript in the Advanced tab for the date element, see the wiki:

http://fabrikar.com/forums/index.php?wiki/date-element/

But to help you create that Javascript, I'd need to understand more about what you mean by:

have to enable available dates within a date element for the type, region and city

Does this mean that you need to check the events table, and disable dates for which there is already an event for the Type, Region and City selected in the other elements?

So if I select a different city on the form, the available dates have to change on the date selector popup?

--hugh
 
Hugh, thank you very much, I will try to explain better.

I have a table where the administrator creates events and another table where the user signs up for these events.


The administrator creates an event from the administration of the website.

The event (called Channel fabrik) consists of:

Type (dropdown)
Date (date element)
Region (databasejoin)
City (CascadingDropDown)
places available (field)

You can register for an event, so I did another fabrik call list registration that takes data from the channel list.

user
type
region
city
date


Then check the events is linked to the events that created the channel table administrator.
when you change some data: type, region or city, look for information in the table again and enable channel dispobibles dates on the calendar.


I hope you understand, my English is not very good.
I await your response
Thank you!
 

Attachments

  • channel form.jpg
    channel form.jpg
    32.3 KB · Views: 543
  • user register.jpg
    user register.jpg
    26.1 KB · Views: 473
this is possible to do with the allowdate function on the date element, but its quiet complex.
As an alternative, have you considered changing the date element in user register, to a cascading drop down element? That way it will populate with the event dates when the other options are changed?

-Rob
 
Yes, that was my first choice, I could do it without problems, but the customer's requirement is that the date is through a calendar.

If or if I have to do with a calendar, the date element is the only option?
 
maybe you can guide me and I try to understand how to work in that code.
It is complex, but I need to do to achieve this with fabrik, I have the entire system with the component and is the only thing I is lacking.
e.
 
Well, the main problem I see is one of responsiveness. There are three options I can see working:

1) Make an AJAX call every time one of the various option selections are changed, and retrieve the available dates for that combination of selections.

2) Make an AJAX call only when the calendar widget is opened. This may not work, as AJAX calls are asynchronous, so I'm not sure we can 'block' processing of the calendar until we get the data back from the server.

3) Load a complete copy of the 'Channel' events table on page load, as a Javascript object. This might actually be the best approach, depending on how many events you expect to be handling. If the number is in the hundreds, rather than thousands, this would probably be the best approach. It might even be more efficient even with thousands of rows, and would only become unwieldy if you are expecting tens of thousands of events. The size of the data structure, even with a few thousand rows, would only be about the same as a small to medium sized image.

It would be a trade off between initial page load time, and delays when changing options on the form.

The more I think about it, the more 3) seems like the best solution. Even option 1) could run in to issues with asynchronous processing, if your server is slow, and someone makes an option select, and then immediately hit the date widget button, and the date widget starts calling the allowDate() callback before the AJAX response coes back with the available dates.

So ... really, we just need to know what you expect the maximum number of events to be, from "now" until "the end of time" (NOT just for this month / year, as the user could cycle through the years on the date widget).

-- hugh
 
Couople of questions:

1) With regards to the "Plazas disponibles" (Places available) field in the channel list. Does this mean that when checking for available events, you also need to count the number of places already booked for each event, via the registration table, and not show a given date if there are already 'places available' number of registrations for the event?

2) Will there only ever be one event per day for a given combination of type, date, region and city?

One thing that concerns me is that the current setup never actually sets an 'event_id' on the registration form. It essentially just selects the criteria for an event search. I can see that being a problem. I think you really need to look at actually specifying the event ID in a field on the registration form, once it is submitted. How that could be done is rather dependent on the answers to these questions.

-- hugh
 
Hug, thank you very much for the reply.
Below my answers.

On the number of events.
Sounds good the third solution , the number does not really know, but I think we can greatly reduce two preconditions to bring full charge.
I think in the sql query , to search the data , we can bring from today's date (not past events ) and the events AVAILABLE ON the next 31 days .

So with this we might have 1000 events at most , being a very extreme case . I really think they are going to walk in the hundreds , not the thousands if we have these preconditions.

On the available places .
Exactly , we need to do the testing calculation available places ,
if the places is full , do not show on the calendar.

Type , date, region and city.
There will never be more than one event in a combination of these types .

event id
You're right , in the event registration , whether or id would have to handle the event.

I hope I have been clear and have no unanswered questions .
Again thank you very much
e.
 
OK, my next question is ... should the date selection on the registration form ONLY be active once they have selected all three other criteria - type, region and city? This would require a little extra custom Javascript on the form, to disable the date element unless the other three options are selected. We can't really provide available dates, if they haven't selected all three of those.

So ... before we can proceed, you need to sort out storing the event ID when the registration form is submitted. This will probably require a form submission script, which does a lookup on the events table to match the type, region, city and date to the actual event, and inserts that row id in to a hidden event_id join on the registration form.

You will also need to create some custom validation as well, to ensure that a submission is still valid. The issue being, even if we only show available dates on the registration form, you may have more than one person using the form at the same time. So two users both load the form at the same time, pick the same event, and submit ... and the first submission may fill up the available spaces. So although there was available places when the second user filled out the form, by the time they submit their form, those spaces are gone.

As you can see, this is not a trivial task. Here's a summary:

1) Custom PHP to store the event ID with the registration form.
2) Custom Javascript to only enable date selection when type, region and city are selected.
3) Custom PHP validation.
4) Custom PHP and Javascript code to build the available dates data.
5) Custom Javascript to handle the actual date availability in the date selector.

Off the top of my head, I''d say that's at least half a days work. I'll have to talk to Rob, to see if we think that is reasonable as part of a Pro sub, or whether we'd have to charge for at least some of it as additional custo dvelopment work.

-- hugh
 
Yes, the date the form, only active with the three selection criteria .
I understand about the two people at the same time doing the same registrio . It is something that can happen , but I think the person who arrives later with a notice that the seats are no longer available would be nice .


ok , please talk to rob and let me know .
I hope your answer!
thank you very much .
 
Sorry, I meant to reply yesterday. As per our live chat just now, he wanted to know what your PHP or javascript skills are like, ie can you do any of the work, or do you need us to do it all?

-- hugh
 
all depends on the price, I have a little knowledge of php, but js. I prefer that you do, but before I know the price
 
Please, I need you to communicate, almost a month ago I am with this and I can not solve the problem. I'm already exhausted all means of communication.
I ask again please to contact me.
 
I responded to the email you gave me two days ago, but it looks like you may have given me the wrong email. Anyway, we spoke on Skype yesterday, got logged on to his site, went through his set up, etc.

I know what needs doing to what, so now I'm just trying to find the time. But as per the email:

Please note that this week is Thanks Giving week in the US, which means that Thursday and Fri are holidays. I'll be working on Fri, but will be off on Thursday,"

I'll be working a few hours on Friday, but I have family in town for Thanksgiving, and it's probably going to be the weekend before I can do this.

-- hugh
 
Just FYI, I've been trying to work on your site this weekend, but it is soooooo painfully slow, it's pretty much impossible to work on.

It'll be OK for a few minutes, responding just fine, then it just becomes unusable for long periods of time, where it'll take 30 to 60 seconds to load a simple backend page, and about half the time it just times out and won't load a page at all, or it'll log my session out entirely.

I'm trying, I really am, but I just can't get anything done at the moment.

As far as I can tell, the problem is on the server, not the network between us, as the ping times across the network always seem OK, at about 60ms.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top