Closed (fixed)
Project:
Availability Calendars
Version:
7.x-2.2
Component:
User interface
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Jun 2011 at 15:57 UTC
Updated:
12 Jul 2011 at 14:21 UTC
Jump to comment: Most recent file
Comments
Comment #1
fietserwinYes it can. It requires a custom form (typically containing 2 date fields, a submit button and probably a reset button) and a bit of custom javascript to glue the calendar API to your own form. Off you go. I'm currently working on the example below, a copy of my current project. I'll give it a try here.
In turn I ask you to test and review the example, and come up with improvements. I'm also looking which parts can be made generic and thus added to the availability calendars module by default, reducing the need for custom code on the other side.
In my current project, the code below posts to a webform that retrieves the arrival and departure date (and a hidden field for the accommodation nid, not included in the example below) and lets the user fill in other fields like name, address and email before sending an email to the accommodation owner. I leave that up to you.
Notes:
- there is a custom state 'option', replace with your own requested state
- after sending the form, the calendar is NOT updated (not even into the option state). That is left to the owner of the accommodation after approval.
Your form:
Include it on your page where the calendar is displayed:
The javascript (example.reservation-formlet.js):
And some css (add your colors, text-decoration, more borders, margins and paddings, etc. yourself):
Comment #2
rogical commentedreally appreciate!
I will test it and feedback as soon as possible.
Comment #3
fietserwinAwaiting your comments.
Note: see also these comments: http://drupal.org/node/306467#comment-1026074 and my reaction (introducing the above stuff): http://drupal.org/node/306467#comment-4216740
Note: edited the code by adding weights to the form elements (I removed them in stripping it to the bare necessary, but they are needed as the submit button floats right and thus must be rendered first for the other elements to appear to the left of it.)
Comment #4
rogical commentedI've copied your code as a module example, and figured out the form, the screenshot was attached.
But the javascript seems not working, there's no response when I click the calendar date.
BTW, when I using Availability Calendar, I keep thinking what's the better between Availability Calendar and 'Calendar + Date', then I aslo tested 'Calendar + Date'.
The advantage of 'Calendar + Date' is it can show the notes/node in the specific date square, while Availability Calendar's notes area are belong to weeks.
The shortage of 'Calendar + Date' is it's not good to show the available status, while AC is already be.
Comment #5
fietserwin* does the javascript get loaded:
- availability-calendars.js
- example.reservation-formlet.js
(show source, ctrl + U in most browsers)
* Do you see any error messages in the browser about javascript errors? (firebug console)
* Does the cursor change into a pointer and does the cell border change color on hover?
Comment #6
rogical commentedthe javascript were all loaded, and no errors found in the console.
no pointer and cell border color change when hover on the cell, as well as on click.
I'm using Drupal 7.2, and found that when loading the calendar page, it even brokes my login button on login block.
Comment #7
fietserwinWhat browser are you using? (I'm currently testing older no-standard browsers, read IE8-, and looks like I am getting same problems)
I always develop on modern standard compliant browsers and only at the end of a project, as the customer does not come up with last minute changes anymore, I start testing IE. IE9 seems to work fine though.
Attached, a slightly modified module archive (mainly css to get what I intended: a form of just 2 lines).
Comment #8
rogical commentedactually I'm using the latest Firefox and Chromium, but none of them works. As I'm still using WinXP, so not tested with IE9 yet.
I have a online test envirionment, you can see it throungh:
http://www.cms-cloud.com/node/26
http://www.cms-cloud.com/node/add/availability-calendars
No errors throw out, but just doesn't work. I'm also try to debug, no progress so far as I'm not familiar with CA api yet.
Comment #9
fietserwinI had a look at your site, thank you for sharing. Please visit the settings page for this module and define which states are considered available. Due to an error in the install, the states that are created by default are all set to not available. Hence there is no day that is made selectable.
Please also note that IE8 (and probably older versions as well) will not work with the current version of Availability Calendars (a property of an object may not be called 'class' in IE8). So I changed the category of this issue to a bug report and will communicate here when I committed a patch. But please keep continue to use this issue for your findings regarding the custom code.
Comment #10
rogical commentedIt works now!
Now I'm trying to figure out a submit solution, I prefer to use node type than webform.
As webform is a standalone data, not good compatible with views/panels yet, so I try to use node type.
Some modules may be used: references, node reference url, eva ... I'm still processing, maybe will create a new field or other stuffs.
I will feedback here later after get the submit solution done.
BTW, one suggestion here is: in the booking process, user may want to specify the time period, such as 2 hours in a day. I think you must have been used the Outlook Calendar in the Microsoft Windows, it can be booked on hours, minutes. This could be a new feature later.
Comment #11
fietserwinForget about that. This module will not do so. See #470994: search , especially comment #16. Use other modules, like the ones people suggested in #721762: Hourly booking or #306467: Integrate Availability Calendars with booking process (was: ability to reserve).
But I'm interested in your way of integrating the submit data, so keep posting.
Comment #12
fietserwinThe fix for the IE8 error has been committed and can be found in the 7.x-2.x-dev version. But, please post your findings about how you integrated this into your booking process, and any other remarks about the above discussed functionality.
Comment #13
rogical commentedThanks, I'm tied up a project recently, will not able to make my solution done soon.
My idea is make a new content type with a start/end date filed, and use panels to override the node/add form, and get the corresponding calendar to the form, when user click the calendar date, it will fill the date field in the content type.
Finally, user can view his own booking and author can view all the booking through views.
The approve process is difficult, ideally when the booking node was posted, and author can just click to approve on viewing the booking node. This is what I say may need to write a custom field.
As make a new field in D7 is not much difficult, so it's available.
Comment #14
fietserwinAs per #1151382: Use fields in Drupal 7, I'm currently converting the module to a field. I'm not sure if it will, but it might help you to better place and order all those fields/inputs. Stay tuned.