(function(){var e;page.using={schema:["T4"],texts:["search_text"],types:["Administration"]};page.commandBindings={"SystemTracking/Refresh":function(){t()},"SystemTracking/LockSystem":l,"SystemTracking/UnlockSystem":g,"SystemTracking/NewPlannedLock":f,"SystemTracking/NewAdHocSystemLock":v,Delete:"Crud/Delete"};page.onLoad=function(){this.bind("Unload",d);o();s();t()};function t(){u8.request("SystemTrackingChannel.GetTrackingData",{},function(t,s){var c=s.response;if(!c){return}e=a(c.activeSystemLocks);i(c.activeUsers);n(c.activeProcesses);r(c.activeSystemLocks)})}function s(){var e=$el("header");var t=new u8.Base.Widgets.Header(e,{headerGroupName:"Special",headerName:"Administration",parent:page})}function a(e){if(!e){return}var t=e.rows,s=t.length;for(var a=0;a<s;a++){var i=t[a][1][0];if(!i){return t[a][0][0]}}}function i(e){e=e||{};var t=$widget("activeUsers");if(!t){var s=e.columns&&e.columns.map(function(e,t){return{label:e,dataKey:t}})||[];if(s.length>3){s[3].type="CheckBox"}var a=new u8.Base.Widgets.GridModel({data:e.items,columns:s,pageSize:u8.session.webConfigValues.get("Search.MaxResults"),rowDefaults:{fn:function(e,t){return e[t].values}}});a.setData(e.items,{createRows:true});$("#activeUsers").widget("Grid",{parent:page,model:a,emptyGridText:$t("TXT_search_text_7"),header:{headerGroupName:"Special",headerName:"ActiveUsers"}})}else{a=t.model;a.setData(e.items,{createRows:true});a.update()}}function n(e){var t=new u8.Crm.ResultSet(e);var s=$widget("activeProcesses");if(!s){$("#activeProcesses").widget("ResultSetGrid",{parent:page,resultSet:t,pageSiz:u8.session.webConfigValues["Search.MaxResults"],grid:{empyGridText:$t("TXT_search_text_7")},showMenu:false,header:{headerGroupName:"Special",headerName:"ActiveProcesses"}})}else{s.resultSet.merge(t)}}function r(e){var t=new u8.Crm.ResultSet(e);var s=$widget("activeSystemLocks");if(!s){$("#activeSystemLocks").widget("ResultSetGrid",{parent:page,resultSet:t,pageSiz:u8.session.webConfigValues["Search.MaxResults"],grid:{empyGridText:$t("TXT_search_text_7")},menu:{model:{menuName:"M_SystemLocks"},onActionExecute:c},header:{headerGroupName:"Special",headerName:"SystemLock"}})}else{s.resultSet.merge(t)}}function c(e,t){if(t.name=="A_RemoveLock"){t.cancel=true;u(t.arguments.uid)}}function u(e){u8.services.administration.unlockSystem(e,function(e,s){if(!s.error){t()}})}function o(){u8.services.events.bind("u8.services.crud.onCreate",m,page.id).bind("u8.services.crud.onUpdate",m,page.id).bind("u8.services.crud.onDelete",m,page.id)}function d(){u8.services.events.unbind("u8.services.crud.onCreate",page.id).unbind("u8.services.crud.onUpdate",page.id).unbind("u8.services.crud.onDelete",page.id)}function m(e,s){if(s.uid&&s.uid.infoAreaId=="T4"){t()}}function l(){u8.services.administration.lockSystem(null,function(e,s){if(!s.error){t()}})}function g(){u(e)}function v(){var e=u8.session.environment.stationNumber;var t={infoAreaId:"T4",expandName:"T4.Adhoc",defaultFields:"0,8,2,50",defaultValues:[e,u8.session.localeSettings.booleanTrue,e,5],scripts:"crm/pages/systemlocks.js"};u8.services.navigation.navigateToPage("ExpandNew",t)}function f(){var e=u8.session.environment.stationNumber;var t={infoAreaId:"T4",defaultFields:"0,2",defaultValues:e+","+e,scripts:"crm/pages/systemlocks.js"};u8.services.navigation.navigateToPage("ExpandNew",t)}})();