/**
* Created by markop on 9/29/15.
*/
(function(){
var jqBtnChangePass = $("#change_pass_profile"),
jqBtnGoBack = $("#btnProfileGoBack");
codeq.profile = {
};
codeq.globalStateMachine.register('profile',{
'enter': function(){
jqBtnChangePass.on('click',function(){
codeq.globalStateMachine.transition('changePassword');
});
jqBtnGoBack.on('click',function(){
history.back();//forces a transition to the previous state
});
if(codeq.samlLogin) $('#loggedInViaSamlSpan').css("display","");//show the span if we actually logged in with SAML
$("#screen_profile").css('display', '');
$('#disabled').css('display', 'none');
codeq.comms.getUserStat()
.then(function (data) {
if (data.code !== 0) throw new Error('GetUserStat failed, code: ' + data.code + ', message: ' + data.message);
data = data.stat;
var columns = ['language', 'problem_group', 'problems_count', 'done', 'in_progress'],
items='',
tr_gui = codeq.tr.getDictionary('gui');
$.each(columns, function( key, val ) {
items+=' ';
$.each( data, function( object, row ) {
items+=''+tr_gui[val][codeq.settings['gui_lang']]+' ';
});
items+='