(function ($) {
    window.booklyStaffDetails = function (Options) {
        var $container = $('.' + Options.form_id);
        var options = {
            get_details : {
                action    : 'bookly_staff_cabinet_get_details',
                csrf_token: BooklySCDetailsL10n.csrf_token,
                attributes: Options.attributes
            },
            intlTelInput: BooklySCDetailsL10n.intlTelInput,
            l10n        : BooklySCDetailsL10n,
            saving: function (alerts) {
                $.each(alerts, function (type, messages) {
                    if(messages.length > 0){
                        window.booklyNativeAlert(messages.join('\n'));
                    }
                });
            }
        };

        // Init Staff Details.
        new BooklyStaffDetails($container, options);
    };
})(jQuery);