Okay
  Public Ticket #2716225
dynamically load the booking form in fe
Closed

Comments

  • serhan buyukiscan started the conversation

    I need to dynamically load the booking form via javascript.

    First the user will have to choose a country and then I will auto assign the employee for that country in the background. After country selection the user should be shown directly the calendar.

    Can you guide me, is there any JS function that can trigger the booking form with given parameters. 

    I have examined the code and the parameters seem to be loaded on page load and I couldn't find a way to load it dynamically

  •  2,507
    Aleksandar replied

    Hello serhan

    Thank you for your purchase.

    Sorry but I don't quite understand what you want to do. My understanding is that you're looking to accomplish this on front-end, right? When someone chooses a country (is this outside Amelia?) the employee for that country is selected?

    What we have is a few JS hooks that is triggered depends on the view:

    window.beforeAddToCalendarLoaded()
    window.beforeBookingLoaded()
    window.beforeSearchLoaded()
    window.beforeSearchFiltered()
    window.afterSearchFiltered()
    window.beforeConfirmedBooking()
    window.beforeCatalogLoaded()
    window.afterSelectCatalogCategory(object_category)
    window.beforeCatalogCategoryLoaded(object_category)
    window.beforeCatalogServiceLoaded(object_category, object_service)
    window.afterSearchActivateService(object_appointment, object_serviceActive)
    window.afterSearchGoToSecondStep(object_appointment, object_serviceActive)
    window.afterBookingSelectDateAndTime(object_appointment, object_serviceId, object_providerId, object_locationId)
    window.afterBookingSelectService(object_appointment, object_serviceId, object_providerId, object_locationId)
    window.beforeConfirmBookingLoaded(object_appointment, object_service, object_provider, object_location)
    window.afterConfirmBooking(object_appointment, object_service, object_provider, object_location)

    JS files are modified (minimized) in public version of plugin (in our development environment is accessible), but unfortunately I can not send you our source code because that is the policy of our company.

    All those files that have extension .vue are compressed and minimized in JS files that is very hard and not recommended modifying. So in order to add some other features you can unminify the js and customize it.

    You can dynamically change the employee's ID with the help of some plugin which has the possibility to use PHP Snippets, and add shortcodes on the page in that way. For example:

    1. There's the page (where you want the booking form to be), and when you're creating links that lead to that page, in URL you need to place the ID for the employee (http://somesite/booking?employee=17)

    2. On that page (where you want the booking form to be), instead of our shortcode, you'd need to add the shortcode of that plugin which uses PHP Snippet which will generate our shortcode (https://wordpress.org/plugins/insert-php-code-snippet/).

    7658442828.png

    3. The snippet would look something like this:

    <?php
    $employee = $_GET['employee'];
    echo do_shortcode( "[ameliabooking employee=$employee]" );
    ?>
    9700784098.png
    3573737381.png

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • serhan buyukiscan replied

    Thank you for the reply. I have managed my desired result by displaying multiple booking calendars in the page and showing / hiding them with JS

  •  2,507
    Aleksandar replied

    I'm glad to hear that, serhan

    If you have any further questions or issues, please feel free to open a new ticket, and we'll gladly help.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables