How-To

End-of-day by weekday or resource.

ABPro 2.0.3

If you are using Service Based Duration, bookings are not constrained by timeslots boundaries.

In order to prevent a service from creating a booking that goes beyond the end of the day ABPro uses the grid end time as 'End of Day'.

ABPro does not support different end-of-day for different weekdays.

This How-to is a work around to let you set day-of-the-week specific end-of-day values.

This only effects Service Based Duration's determination of what 'end-of-day' is so bookings can be prevented from going too late.

Edit file: \components\com_rsappt_pro2\script.js

 

End-of-day by day of the week 

Around line 1900 look for:

if(document.getElementById("end_of_day").value === "24:00"){  
    //not a valid time to parse
    document.getElementById("end_of_day").value = "23:59:59";
}

Immediately before that, insert the following code:

var ts_date = Date.parse(startdate + " " + starttime);
var day_of_the_week = ts_date.getDay();
switch (day_of_the_week) {
    case 0: { document.getElementById("end_of_day").value = "16:00"; break } // Sunday
    case 1: { document.getElementById("end_of_day").value = "17:00"; break } // Monday
    case 2: { document.getElementById("end_of_day").value = "17:00"; break } // Tuesday
    case 3: { document.getElementById("end_of_day").value = "17:00"; break } // Wednesday
    case 4: { document.getElementById("end_of_day").value = "20:00"; break } // Thursday
    case 5: { document.getElementById("end_of_day").value = "20:00"; break } // Friday
    case 6: { document.getElementById("end_of_day").value = "17:00"; break } // Saturday
}

if(document.getElementById("end_of_day").value === "24:00"){  
    //not a valid time to parse
    document.getElementById("end_of_day").value = "23:59:59";
}

You can now set specific end-of-day times for each weekday.

 

 

End-of-day by Resource

If instead of 'switch'ing by day of the week, you could hard code resource IDs to make end-of-day a different value for different resources.

Around line 1900 look for:

if(document.getElementById("end_of_day").value === "24:00"){  
    //not a valid time to parse
    document.getElementById("end_of_day").value = "23:59:59";
}

Immediately before that, insert the following code:

var my_res = document.getElementById("selected_resource_id").value;
switch (my_res) {
    case "2": { document.getElementById("end_of_day").value = "15:00"; break } // end-of-day is 15:00 for resource 2
    case "50": { document.getElementById("end_of_day").value = "13:00"; break } // end-of-day is 13:00 for resource 50.
}

if(document.getElementById("end_of_day").value === "24:00"){  
    //not a valid time to parse
    document.getElementById("end_of_day").value = "23:59:59";
} 

 

(The above line numbers are based on ABPro 2.0.3 for Joomla 2.5)

 

## UPDATE Aug 9/13 ##

Validation to use the end of the last timeslot as end of day, see

http://appointmentbookingpro.com/component/kunena/22-abpro-2-0-x-joomla-2-5/15631-booking-past-end-of-day-for-a-resource.html?Itemid=0#15652