Okay
  Public Ticket #2195952
Displaying available RSVP spots
Closed

Comments

  • rtackabury started the conversation

    Is there a way to have an event display how many attendee spots are left available?

    Before a person RSVPs, I would like for them to be able to see how many people are currently registered/how many spots are available.

  •  787
    Zhivko replied

    I'll add this in my to-do list for the next update. At the moment only invited people can see how many places are left.


    Stachethemes Developer

  • rtackabury replied

    This would literally make Stachethemes perfect for my project, thank you very much. If there is an option for the available spots left could show up when hovering over events, even better! Thank you so much.

  •  787
    Zhivko replied

    We've added "Places left" text to the RSVP form today with update 2.7.8.

    As for the tooltip you can now add following filter in your theme functions.php file at the bottom:

    add_action('stec_after_html', function() {
        ?>
        <script type="text/javascript">
            (function ($) {
                $.stecExtend(function (m, data) {
                    if (parseInt(data.event.rsvp, 10) !== 1) {
                        return;
                    }
                    const __ = new window.StecHelper().lang;
                    var $tooltip = $(data.tooltip);
                    var event = data.event;
                    var repeatOffset = data.repeat_offset;
                    var repeatDate = window.moment.tz(event.start_date, event.timezone).add(repeatOffset, 'seconds').format('YYYY-MM-DD');
                    var placesLeft = 0;
                    placesLeft = m.helper.attendanceHasFreeSlots(event, repeatDate);
                    $('<span class="stec-tooltip-timespan"><i class="fa fa-user"></i>' + __('Places left') + ': ' + placesLeft + '</span>').insertAfter($tooltip.find('.stec-tooltip-timespan'));
                }, 'filterTooltipHtml');
            })(window.jQuery);
        </script>
        <?php
    });
    

    Stachethemes Developer