Notice: ABPro's Stripe payment processor uses the Legacy Checkout and is not SCA compatible. read more..

How-To

Hide Grid unless Resource selected

 

If you wish to have ABPro only show the availability grid after a resource has been selected you can edit file:

\components\com_rsappt_pro3\script.js

 

For ABPro 4.0.1

Around line 1122 look for:

    if((document.getElementById("resources") != null && document.getElementById("resources").selectedIndex == 0 && !show_grid_for_single_resource_mobile)
        && document.getElementById("mobile") != null){
        document.getElementById("gad_container").style.visibility = "hidden";
        document.getElementById("gad_container").style.display = "none";
        document.getElementById("table_here").style.visibility = "hidden";
        document.getElementById("table_here").style.display = "none";
    } else {
        document.getElementById("gad_container").style.visibility = "visible";
        document.getElementById("gad_container").style.display = "";
        document.getElementById("table_here").style.visibility = "visible";
        document.getElementById("table_here").style.display = "";
    }

 

Add the red code:

    if((document.getElementById("resources") != null && document.getElementById("resources").selectedIndex == 0 && !show_grid_for_single_resource_mobile)
        && document.getElementById("mobile") != null){
        document.getElementById("gad_container").style.visibility = "hidden";
        document.getElementById("gad_container").style.display = "none";
        document.getElementById("table_here").style.visibility = "hidden";
        document.getElementById("table_here").style.display = "none";
    } else {
        if(document.getElementById("resources").selectedIndex == 0){
            document.getElementById("gad_container").style.visibility = "hidden";
            document.getElementById("gad_container").style.display = "none";
        } else {
            document.getElementById("gad_container").style.visibility = "visible";
            document.getElementById("gad_container").style.display = "";
        }
    document.getElementById("table_here").style.visibility = "visible";
    document.getElementById("table_here").style.display = "";
}

 

 

Previous ABPro versions

Around line 1778 look for:

jQuery.ajax({
    type: "GET",
    dataType: 'html',
    cache: false,
    url: presetIndex()+"?option=com_rsappt_pro3&controller=ajax&task="+task+"&format=raw",
    data: data,
    success: function(data) {
        document.body.style.cursor = "default";
        document.getElementById("table_here").style.visibility = "visible";
        document.getElementById("table_here").style.display = "";



Add the red code:

jQuery.ajax({ 
    type: "GET",
    dataType: 'html',
    cache: false,
    url: presetIndex()+"?option=com_rsappt_pro3&controller=ajax&task="+task+"&format=raw",
    data: data,
    success: function(data) {
        document.body.style.cursor = "default";
        if(document.getElementById("resources").selectedIndex == 0){
            document.getElementById("gad_container").style.visibility = "hidden";
            document.getElementById("gad_container").style.display = "none";
        } 
        document.getElementById("table_here").style.visibility = "visible";
        document.getElementById("table_here").style.display = "";

 


Prior to ABPro 3.0.3, the code did not use JQuery so you will be looking for this code around line 1152:

function showTable() {
if (xhr.readyState === 4) {
    document.getElementById("table_here").style.visibility = "visible"; 
    document.getElementById("table_here").style.display = "";

function showTable() { 
if (xhr.readyState === 4) {
        if(document.getElementById("resources").selectedIndex == 0){
            document.getElementById("gad_container").style.visibility = "hidden";
            document.getElementById("gad_container").style.display = "none";
        } 
    document.getElementById("table_here").style.visibility = "visible"; 
    document.getElementById("table_here").style.display = "";

 


Note: as this is JavaScript code, you will need to refresh your browser to load it before you will see the changes.

You will also probably want change the resource dropdown text to say something like 'Select a Resource' rather than 'All (day view)' since it no longer shows all resources when none are selected. This is done in ABPro Control Panel | Edit Files | Edit Language files, key: RS1_GAD_SCRN_RESOURCE_DROPDOWN="All (Day View)"