TOPIC:

booking form 3 years 6 months ago #193977

  • Topic Author
  • mozart2
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 30
  • Thanks: 0
hi there,

is it possible that in the booking form you can populate the calendar and see the availability?

thanx for reply

moz

Please Log in or Create an account to join the conversation.

booking form 3 years 6 months ago #194228

  • lovre's Avatar
  • lovre
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 2667
  • Karma: 76
  • Thanks: 329
Hi,

maybe you will find this for a good start and a foundation to build upon.

I've built a form where you submit results for the arrival and the departure. The dates selected previously by the users get disabled. This way you get a availability overview and a somewhat of a base system for a serious booking application.

You can go right ahead and integrate this form with ContentBuilder and create a availability/bookers overview as you wish. Your users could then edit submissions, you could limit their permissions to a number of edits/submits...and much more.

The form definitely needs more work if it's going to be used on real projects... There are a few crucial parts missing, such as few validations to keep the user data valid...Maybe even a Administration system... A confirmation process would be a must. I think this could be done easily with CB also.

The whole code is in the forms before form piece:
$db = JFactory::getDBO();
$sql = "SELECT value FROM #__facileforms_subrecords WHERE name='bookingIn' OR name='bookingOut' ORDER BY id ASC";
$db->setQuery($sql);
$rows = $db->loadObjectList();
$size = count($rows);

for ($i = 0; $i < $size; $i++) 
{
	$string = $rows[$i]->value;
	$pieces = explode("-", $string);
	$pieces[1]-=1;
	$string = implode(",", $pieces);

	if (!($i % 2)) $result .=  '{ from: ['.$string.'],';
	else  $result .=  ' to: ['.$string.'] },';
}
echo '<script type="text/javascript">
		JQuery(document).ready(function () {
			JQuery("#ff_elem15965_calendarButton").pickadate({
				format: "yyyy-mm-dd", 
				selectYears: 60,
				disable: ['.$result.'],
				min: true,
				selectMonths: true,
				editable: true,
				firstDay: 1,
				onSet: function() {JQuery("#ff_elem15965").val(this.get("value"));}
			});
				
			JQuery("#ff_elem15966_calendarButton").pickadate({
				format: "yyyy-mm-dd", 
				selectYears: 60, 
				disable: ['.$result.'],
				min: true,
				selectMonths: true,
				editable: true,
				firstDay: 1,
				onSet: function() {JQuery("#ff_elem15966").val(this.get("value"));}
			});
		});
	</script>';
so we're basically checking the DB to see previous submissions and build up a string to pass to the calendar disable parameter.

I've attached a form to the post... Just download, unzip and install to your BFs, it should work out of the box.

If you need some help/hints on how to get this to the next level do not hesitate to ask.

EDIT: Unfortunately the form doesn't work out of the box... You will need to get your calendar elements' HTML ID's from the frontend and replace them in the code...you need to replace the: ff_elemXXXX_calendarButton AND ff_elemXXX because BFs assigns new ids to elements on an install.

Regards,

Lovre
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
===========================================
Need to renew Pro Support?
Buy Here!
===========================================
Satisfied?
Consider a membership!
===========================================
Like us on Facebook
===========================================
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: Post by lovre.
  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.035 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!