Forums

Change amount based on week day

webix 22 Oct, 2019
Hi dear chrono-team,

im using chronoforms for request form including event cost calculation:

Field one: Select Event (dropdown)
Field two: select wished Date and Time (datetime picker)

Let's say there is a event costs 100 € under the week but 110 € on weekend. Is it possible to calculate amount not only event depending, but also depending on week day?

For now im using data value on advanced tab for dropdown to calculate fix amount for each available event.

As next i would interested if it's possible to make open hours based on seleted day in diteimepicker. E.g.:
  1. day 1-5: 10 o'clock to midnight
  2. day 6-7: 8 o'clock to midnight

Thanks in advance
Alex
healyhatman 22 Oct, 2019
Sure, you can do anything you feel like. Something like onChange of the dropdown, call a custom function, with something like
function pricePerDayOfWeek() {
var day = moment(jQuery('input[name="calendar_name"]').val()).day();
var price = 100;
if(day == 0 || day == 6) {
// Day is a Saturday or Sunday
price = 110;
}
jQuery('#priceDiv').html("The price will be " + price + " Euros";
}
webix 22 Oct, 2019
Thanks for quick reply. I'll try asap =)
This topic is locked and no more replies can be posted.