/**
 * (c) by aheadware.com
 */

var app = app || {};
app.state = app.state || {};

app.state.ConfigurationAccount = function()
{
    var state = app.core.StateManager.createState( 'configuration-account' );

    state.onEnter = function( p )
    {
        let $content = app.core.View.getContent();

        app.gui.PageLoader.show();

        app.core.Rpc.call(
            'Account',
            'getAccountRelatedData',
            null,
            function( res )
            {
                app.core.View.setContent(
                    app.core.View.getTemplate( 'configuration-account', res )
                );

                $content.find( '[data-id="btn-copy-ical-link"]' ).first().click( function()
                {
                    app.util.Helper.copyInputToClipboard( $content.find( '[data-id="input-ical"]' ).first() );
                    app.core.View.toastSuccess( _lc( 'CALENDER_LINK_COPIED' ) );
                });

                app.gui.PageLoader.hide();
            }
        );
    };

    return state;
};