const Dashboard = function () {
    const init = function () {
        setPageTitle("Welcome " + $('#PreferredName').val(), true);

        $('.grid').masonry({
            itemSelector: '.grid-item',
            gutter: 10,
            transitionDuration: 0,
            horizontalOrder: true
        });
    };

    return {
        init
    };
}

const redirectDashboardToPageUrl = function (pageUrl, pageName, pageId = null) {
    parent.openModalSpinner();
    var redirectNode = parent.$('#' + pageName + 'NavItemId')[0];
    parent.newCheckCanLeavePage(pageUrl, redirectNode);
    if (parent.changeUrl && pageId) {
        parent.changeUrl(pageId);    
    }
}

jQuery(document).ready(function () {
    parent.closeModalSpinner();

    const dashboard = new Dashboard();

    dashboard.init();
});         
