(function ($) {
    window.booklyStaffServices = function (Options) {
        let $container = $('.' + Options.form_id),
            options = {
                get_staff_services: {
                    action: 'bookly_staff_cabinet_get_services',
                    csrf_token: BooklySCServicesL10n.csrf_token,
                    attributes: Options.attributes,
                    staff_id: Options.staff_id,
                    staff_cabinet: 1
                },
                saving: function (alerts) {
                    $.each(alerts, function (type, messages) {
                        if (messages.length > 0) {
                            window.booklyNativeAlert(messages.join('\n'));
                        }
                    });
                },
                booklyAlert: function (alerts) {
                    options.saving(alerts);
                },
                validation: function () {},
                l10n: BooklySCServicesL10n
            };

        // Init Staff Services.
        new BooklyStaffServices($container, options);
    };
})(jQuery);