• Resolved chrismjteo

    (@chrismjteo)


    Hello,
    Thanks so much for this plugin, it has solved a lot of my problems.

    Will like to check if this function is available

    I have a service which has 5 capacity. Ok the booking page, will there be such an option where the number of remaining capacity is shown in the timeslot?

    Also, will like to clarify on what will makes a timeslot “Busy” status. Based on the same service of 5 capacity, it jumps from green (available) to grey (unavailable).

    Thanks for your help
    Chris

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Hakan Ozevin

    (@puckrobin)

    Hi Chris,

    Please check sample-custom-functions.php file under /sample/ directory. You will see a app_calendar_cell_fill function. Together with the filter hook, copy and paste it to Tools > Custom Functions tab. Now you should be seeing left capacity in the cells.
    You may want to change <span>.$result.</span> tag as you wish, e.g. <span class=”my-class”> to add your styling.

    With the next update, WP BASE will correctly distinguish if a slot is not available because there is nobody working at that slot (unavailable) or because all possible workforce is booked (busy).

    Cheers,
    Hakan

    Thread Starter chrismjteo

    (@chrismjteo)

    Dear Hakan,

    Apologies i’m not the best at going to code level. Do I have to access the sample-custom-functions.php file via FTP? Cause i don’t have access to that

    Chris

    Plugin Author Hakan Ozevin

    (@puckrobin)

    If something goes wrong, you may need FTP access. So use it at your own risk:
    Download the WP BASE zip file here on www.ads-software.com and find the file in the zip package.

    Thread Starter chrismjteo

    (@chrismjteo)

    Ok i am able to access it using another plugin.
    Suggested for other users reading this to access via the downloaded zip file instead

    Also able to display capacity as you suggested. Thanks very much!
    Considering to upgrade this after coronavirus to use the other functions too.
    Really good support from you

    Thanks and have a good week!

    • This reply was modified 4 years, 10 months ago by chrismjteo.
    Thread Starter chrismjteo

    (@chrismjteo)

    When i added the code,

    And go into the backend at “schedule” tab
    The cells turn white and i can’t “click to book” anymore

    I know this is not a core function for the app, so not expecting a response

    Wondering if there’s any quick fix
    otherwise it’s fine

    Cheers

    Plugin Author Hakan Ozevin

    (@puckrobin)

    It works fine for me. I don’t see why it does’t work as it is not even active on admin side.
    Check if you remove the codes you can use the schedules. Maybe there is another reason, for example working hour settings.

    Thread Starter chrismjteo

    (@chrismjteo)

    Hi Hakan

    This is a screenshot of the schedule on the backend
    https://drive.google.com/open?id=1t6707xOsgKep2vE4VzNhYfyMryrdNf5C

    It is fine when after removing the codes

    Plugin Author Hakan Ozevin

    (@puckrobin)

    Try adding this after return $arr;:


    if ( $slot->calendar->is_admin() ) {
    return $arr;
    }

    So result of the function becomes like this:


    function app_calendar_cell_fill( $arr, $slot ) {
    if ( $slot->reason || is_admin() && !(defined( 'WPB_AJAX' ) && WPB_AJAX ) )
    return $arr;

    if ( $slot->calendar->is_admin() ) {
    return $arr;
    }

    $start = $slot->get_start();
    $end = $slot->get_end();
    $busy = isset( $slot->stat[$start][$end]['count'] ) ? $slot->stat[$start][$end]['count'] : 0;

    if ( $slot->get_worker() )
    $avail = 1;
    else
    $avail = isset( $slot->stat[$start][$end]['available'] ) ? $slot->stat[$start][$end]['available'] : $slot->available_workforce( );

    $result = max( 0, $avail - $busy );
    $fill = !empty($arr['fill']) ? $arr['fill'].'<span>'.$result.'</span>' : $result;

    return array( 'class_name' => 'app-cell-centered', 'fill' => $fill );
    }

    Thread Starter chrismjteo

    (@chrismjteo)

    Works, thank you Hakan!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Show capacity in timeslot?’ is closed to new replies.