Ext.define('TradePortal.view.home.View' , {
	extend: 'Ext.view.View',	
	alias : 'widget.homeview',
	store: 'HomeStatistic',
	loadMask: false,
	tpl: new Ext.XTemplate(
		    '<tpl for=".">',
	        '<div style="border: 0px solid black;" class="address-wrap">',
	         '<span>Welcome <b>{name_first} {name_last}</b>,</span><br/>',
	          '<span>Your last activity was at <b>{[this.secondsToTime(values.last_login_time)]}</b> on <b>{last_login_date}</b>.</span><br/>',
	          '<span>Your current account balance is <b>{current_balance:this.renderPrice}</b></span><br/>',
	          '<span>with an overdue amount of <b>{balance_overdue:this.renderPrice}</b>.</span>',
	        '</div>',
	    '</tpl>',{
		    	secondsToTime: function (secs){
				    var sec_num = parseInt(secs, 10);
				    var hours   = Math.floor(sec_num / 3600);
				    var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
				    var seconds = sec_num - (hours * 3600) - (minutes * 60);

				    if (hours   < 10) {hours   = "0"+hours;}
				    if (minutes < 10) {minutes = "0"+minutes;}
				    if (seconds < 10) {seconds = "0"+seconds;}
				    var time    = hours+':'+minutes+':'+seconds;
				    return time;
			},
				renderPrice: function (v) {
					return Ext.util.Format.currency(v);
				}
		    }
	),
	itemSelector: 'div.thumb',
	emptyText: 'No info available',
    initComponent: function () {

    		this.callParent(arguments);
    }  
}); 