Continuation of Help with asynchronous request script

0

I solved with the help of Marcos Brinner, the problem that was with DetePicker as #

But he painted another question about the asynchronous request, between DetePicker (Timetable) and Schedules.

I thought that following the reasoning of the other previous requests, I could bring the schedules of individual attention of each professional, by selecting the desired date and available in their calendar. But to no avail.

With the help of friends to understand why, I'm posting a temporary address so friends can see what's happening (or rather, what's not happening).

At the address, friends will be able to Download the used files as well as the images of the Calendar and Schedules tables.

Thanks in advance to everyone for the attention to my problem.

    
asked by anonymous 12.12.2017 / 16:56

1 answer

1

First of all, as soon as the user selects a caledario, in addition to returning the format of the caledario, you can put the ID of the calendar in a hidden field, to use it later for the search of the times. / p>

To get the jQuery datepicker date from the jQuery UI you need to do so

var data = $('#datepicker').datepicker('getDate');
data =  $.datepicker.formatDate('yy-mm-dd', data);

More information: link

That way you'll get the date, and format it to ISO_8601 (yy-mm-dd), which is the default of writing to the database.

Your database is not following the formal rules, I placed in DRIVE a DER and an image of how it should be, it is not 100% in the rules, for example, the date write directly to the agendar table, it could be written to an external table and passed only ID of it to agendar .

More about formal rules: link

When you save a query, you change the status of the time to unavailable, and compares it in queries, to bring only the available times, you can leave 0 for available and 1 for not available, you choose. >

In this case your query looks like this, but you will need to change it if you normalize BD

"SELECT * FROM calendarios as c inner join horarios as h where c.cod_calendario = " . $_POST['cod_prof']. " and h.status = 0"; 

I hope this helps!

    
12.12.2017 / 19:00