uawdijnntqw1x1x1
IP : 18.116.241.205
Hostname : axolotl
Kernel : Linux axolotl 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
OS : Linux
PATH:
/
var
/
www
/
axolotl
/
data
/
www
/
axolotl.ru
/
www
/
bitrix
/
js
/
timeman
/
timemanager
/
core_timeman.min.js
/
/
(function(){var t=window.BX;if(t.timeman)return;var e="/bitrix/tools/timeman.php",s={OPENED:6e4,CLOSED:3e4,EXPIRED:3e4,START:3e4},a=0,o="",r=t.message("SITE_ID"),p=null,n=null,h=1e3,m=null,d=null;t.timeman=function(e,i,s){r=s;new t.CTimeMan(e,i)};t.timeman.TASK_SUFFIXES={"-1":"overdue","-2":"new",1:"new",2:"accepted",3:"in-progress",4:"waiting",5:"completed",6:"delayed",7:"declined"};t.timeman_query=function(i,a,o,p){if(t.type.isFunction(a)){o=a;a={}}a["device"]="browser";var n={method:"POST",dataType:"json",url:e+"?action="+i+"&site_id="+r+"&sessid="+t.bitrix_sessid(),data:t.ajax.prepareData(a),onsuccess:function(e){t.timeman.closeWait();o(e,i)},onfailure:function(e,i){t.timeman.closeWait();if(i&&i.type=="json_failure"){new t.PopupWindow("timeman_failure_"+Math.random(),null,{content:t.create("DIV",{style:{width:"300px"},html:t.message("JS_CORE_TM_ERROR")+"<br /><br /><small>"+t.util.strip_tags(i.data)+"</small>"}),buttons:[new t.PopupWindowButton({text:t.message("JS_CORE_WINDOW_CLOSE"),className:"popup-window-button-decline",events:{click:function(){this.popupWindow.close()}}})]}).show()}}};if(i=="update"){n.lsId="tm-update";n.lsTimeout=s.START/1e3-1;n.lsForce=!!p}else if(i=="report"){n.lsId="tm-report";n.lsTimeout=29;n.lsForce=!!p}return t.ajax(n)};t.timeman.formatTime=function(e,i,s){if(typeof e=="object"&&e.constructor==Date)return t.timeman.formatTimeOb(e,i);var a="";if(t.isAmPmMode()&&!s){if(parseInt(e/3600)>12){e=parseInt(e)-12*3600;a=" pm"}else if(parseInt(e/3600)==12){a=" pm"}else if(parseInt(e/3600)==0){e=parseInt(e)+12*3600;a=" am"}else a=" am";if(!!i)return parseInt(e/3600)+":"+t.util.str_pad(parseInt(e%3600/60),2,"0","left")+":"+t.util.str_pad(e%60,2,"0","left")+a;else return parseInt(e/3600)+":"+t.util.str_pad(parseInt(e%3600/60),2,"0","left")+a}else{if(!!i)return t.util.str_pad(parseInt(e/3600),2,"0","left")+":"+t.util.str_pad(parseInt(e%3600/60),2,"0","left")+":"+t.util.str_pad(e%60,2,"0","left")+a;else return t.util.str_pad(parseInt(e/3600),2,"0","left")+":"+t.util.str_pad(parseInt(e%3600/60),2,"0","left")+a}};t.timeman.formatDate=function(e,i){var s=new Date(e*1e3)||new Date;var a=!!i?i:t.message("FORMAT_DATE");return a.replace(/YYYY/gi,s.getFullYear()).replace(/MMMM/gi,t.util.str_pad_left((s.getMonth()+1).toString(),2,"0")).replace(/MM/gi,t.util.str_pad_left((s.getMonth()+1).toString(),2,"0")).replace(/M/gi,t.util.str_pad_left((s.getMonth()+1).toString(),2,"0")).replace(/DD/gi,t.util.str_pad_left(s.getDate().toString(),2,"0")).replace(/HH/gi,t.util.str_pad_left(s.getHours().toString(),2,"0")).replace(/MI/gi,t.util.str_pad_left(s.getMinutes().toString(),2,"0")).replace(/SS/gi,t.util.str_pad_left(s.getSeconds().toString(),2,"0"))};t.timeman.formatTimeOb=function(e,i){if(!!i)return t.util.str_pad(e.getHours(),2,"0","left")+":"+t.util.str_pad(e.getMinutes(),2,"0","left")+":"+t.util.str_pad(e.getSeconds(),2,"0","left");else return t.util.str_pad(e.getHours(),2,"0","left")+":"+t.util.str_pad(e.getMinutes(),2,"0","left")};t.timeman.unFormatTime=function(t){var e=t.split(/[\s:]+/);if(e.length==3){var i=e[2];if(i=="pm"&&e[0]<12)e[0]=parseInt(e[0],10)+12;if(i=="am"&&e[0]==12)e[0]=0}return parseInt(e[0],10)*3600+parseInt(e[1],10)*60};t.timeman.formatWorkTime=function(e,i){if(!!i)return parseInt(e/3600)+t.message("JS_CORE_H")+" "+parseInt(e%3600/60)+t.message("JS_CORE_M")+" "+e%60+t.message("JS_CORE_S");else return parseInt(e/3600)+t.message("JS_CORE_H")+" "+parseInt(e%3600/60)+t.message("JS_CORE_M")};t.timeman.formatWorkTimeView=function(e,i){if(!i)return t.timeman.formatWorkTime(e);if(t.type.isString(i)){i=t.timer.getHandler(i)}return i(parseInt(e/3600),parseInt(e%3600/60),e%60)};t.timeman.showWait=function(e,i){n=n||e;e=t(e||n)||document.body;if(d)t.timeman.closeWait();if(i!==0){return d=setTimeout((function(){t.timeman.showWait(e,0)}),i||h)}if(!m){m=new t.PopupWindow("timeman_wait",e,{autoHide:true,lightShadow:true,content:t.create("DIV",{props:{className:"tm_wait"}})})}else{m.setBindElement(e)}var s=e.offsetHeight,a=e.offsetWidth;if(s>0&&a>0){m.setOffset({offsetTop:-parseInt(s/2+15),offsetLeft:parseInt(a/2-15)});m.show()}return m};t.timeman.closeWait=function(){if(d){clearTimeout(d);d=null}if(m){m.close()}};function T(){t.removeClass(this,"bx-tm-popup-report-error");this.onkeypress=null}function c(e){t.addClass(e,"bx-tm-popup-report-error");e.focus();e.onkeypress=T}t.timeman.editTime=function(e){if(!this.BXTIMEINPUT)return true;var i=function(t){if(t.keyCode==13)p(t)};inputH=t.create("INPUT",{props:{className:"tm-time-edit-input"},attrs:{maxLength:2},events:{keypress:i}}),inputM=t.create("INPUT",{props:{className:"tm-time-edit-input"},attrs:{maxLength:2},events:{keypress:i}});var s=t.create("DIV",{children:[inputH,t.create("SPAN",{html:" "+t.message("JS_CORE_H")+" "}),inputM,t.create("SPAN",{html:" "+t.message("JS_CORE_M")})]}),a=this,o=this.BXTIMEINPUT,r=this.BXCHECKINPUT,p=function(e){var i=parseInt(inputH.value),s=parseInt(inputM.value);if(isNaN(i))i=0;if(isNaN(s))s=0;if(s<0||s>59){c(inputM);return t.PreventDefault(e)}n.close();o.value=i*3600+s*60;a.innerHTML=t.timeman.formatWorkTime(o.value);r.checked=o.value>0;return t.PreventDefault(e)},n=t.PopupWindowManager.create("time_edit"+parseInt(Math.random()*1e5),this,{autoHide:true,lightShadow:true,content:s,buttons:[new t.PopupWindowButton({text:"OK",className:"popup-window-button-accept",events:{click:p}}),new t.PopupWindowButtonLink({text:t.message("JS_CORE_TM_B_CLOSE"),className:"popup-window-button-link-cancel",events:{click:function(){n.close()}}})]});inputH.value=parseInt(o.value/3600);inputM.value=parseInt(o.value%3600/60);n.show();inputH.focus();return t.PreventDefault(e)};t.CTimeMan=function(e,i){window.BXTIMEMAN=this;this.bInited=false;this.DIV=e||"bx_tm";this.INTERVAL=null;this.INTERVAL_TIMEOUT=s.START;this.PARTS={};this.DATA=i;this.EVENTS=(i?i.EVENTS:null)||[];this.TASKS=(i?i.TASKS:null)||[];this.WND=new t.CTimeManWindow(this,{node:this.DIV,type:["right","top"]});this.WND.ACTIONS={OPEN:t.delegate(this.OpenDay,this),CLOSE:t.proxy(this.CloseDayShowForm,this),REOPEN:t.delegate(this.ReOpenDay,this),PAUSE:t.delegate(this.PauseDay,this)};this.ERROR=false;this.DENY_QUERY=false;this.FREE_MODE=false;t.ready(t.delegate(this.Init,this));t.addCustomEvent(window,"onLocalStorageChange",t.delegate((function(e){if(e.key=="ajax-tm-update"&&e.value!="BXAJAXWAIT"){var i=e.value;if(t.type.isString(i))i=t.parseJSON(i);if(i){this._Update(i,"update")}}}),this))};t.CTimeMan.prototype.Init=function(){this.DIV=t(this.DIV);t.unbindAll(this.DIV);t.bind(this.DIV,"click",t.proxy(BXTIMEMAN.Open,BXTIMEMAN));this.bInited=true;if(!!this.DATA){this.setData(this.DATA);t.ajax.replaceLocalStorageValue("tm-update",this.DATA,s.START/1e3-1)}t.onCustomEvent(window,"onTimemanInit")};t.CTimeMan.prototype.setBindOptions=function(t){this.WND.bindOptions=t};t.CTimeMan.prototype.setData=function(e){if(!e)return;if(!e.INFO)this.firstTime=true;this.DATA=e;this.FREE_MODE=!!this.DATA.TM_FREE;this.INTERVAL_TIMEOUT=s[this.DATA.STATE]||s.START;if(this.firstTime&&this.DATA.INFO){t.onCustomEvent(this,"onTimeManNeedRebuild",[this.DATA]);this.firstTime=false}else{t.onCustomEvent(this,"onTimeManDataRecieved",[this.DATA])}};t.CTimeMan.prototype.Update=function(e){if(!!e)this._unsetError();this.Query("update",t.proxy(this._Update,this),e)};t.CTimeMan.prototype._Update=function(e,i){if(this._checkQueryError(e)){if(this.WND.CLOCKWND&&!this.WND.CLOCKWND.SHOW){this.WND.CLOCKWND.Clear()}this.setData(e);if(i!="update"){t.ajax.replaceLocalStorageValue("tm-update",e,s.START/1e3-1);this.WND.clearTempData()}if(!!e.CLOSE_TIMESTAMP){this.close_day_form_ts=e.CLOSE_TIMESTAMP;this.close_day_form_ts_report=e.CLOSE_TIMESTAMP_REPORT;this.CloseDayShowForm()}}};t.CTimeMan.prototype.Query=function(e,i,s,a){if(this.DENY_QUERY)return;if(t.type.isFunction(i)){a=!!s;s=i;i={}}if(this.WND&&this.WND.SHOW){i.full="Y";t.timeman.showWait(this.WND.DIV||this.DIV)}t.timeman_query(e,i,s,a)};t.CTimeMan.prototype._setFatalError=function(e){this.ERROR=true;if(this.INTERVAL)clearTimeout(this.INTERVAL);this.DIV.innerHTML=e;t.addClass(this.DIV,"bx-tm-error")};t.CTimeMan.prototype._setDenyError=function(e){this.DENY_QUERY=true;if(this.INTERVAL)clearTimeout(this.INTERVAL);t.addClass(this.DIV,"bx-tm-error")};t.CTimeMan.prototype._setRestrictionError=function(e){this.DENY_QUERY=true;var i=t.create("DIV");t.html(i,e.data).then((function(){new t.PopupWindow("timeman_failure_"+Math.random(),null,{content:i,titleBar:t.message("JS_CORE_TM_RESTRICTION_TITLE"),closeIcon:true,autoHide:true,closeByEsc:true}).show()}));t.addClass(this.DIV,"bx-tm-error")};t.CTimeMan.prototype._unsetError=function(){t.addClass(this.DIV,"bx-tm-error");if(this.ERROR){this.ERROR=false}this.DENY_QUERY=false;t.removeClass(this.DIV,"bx-tm-error")};t.CTimeMan.prototype._checkQueryError=function(e){if(e&&e.error){if(e.type){switch(e.type){case"fatal":this._setFatalError(e.error);break;case"deny_query":this._setDenyError(e.error);break}}else if(e.error_id=="REPORT_NEEDED"){this._showReportField(e.error)}else if(e.error_id=="ALERT_WARNING"){alert(e.error)}else if(e.error_id=="CHOOSE_CALENDAR"){this._showCalendarField(e.error)}else if(e.error_id=="WD_EXPIRED"){setTimeout(t.proxy((function(){this.Update(true)}),this),10)}else if(e.error_id=="USER_RESTRICTION"){this._setRestrictionError(e.error)}return false}this._unsetError();return true};t.CTimeMan.prototype._showReportField=function(t){this.WND.showReportField(t)};t.CTimeMan.prototype._showCalendarField=function(e){new t.CTimeManCalendarSelector(this,{node:this.WND.EVENTS,data:e}).Show()};t.CTimeMan.prototype.Open=function(){if(this.WND.Show()){this.Update(true)}};t.CTimeMan.prototype.setTimestamp=function(t){a=parseInt(t);if(isNaN(a))a=0};t.CTimeMan.prototype.setReport=function(t){o=t};t.CTimeMan.prototype.CloseDayShowForm=function(e){if(this.CLOSE_DAY_FORM){this.CLOSE_DAY_FORM.popup.close();this.CLOSE_DAY_FORM=null}if(this.DATA.REPORT_REQ=="A"||this.FREE_MODE){if(this.DATA.STATE=="EXPIRED"&&!this.WND.TIMESTAMP)this.WND.ShowClock();else this.CloseDay(e)}else{this.CLOSE_DAY_FORM=new t.CTimeManReportForm(this,{node:this.DIV,bind:this.DIV,mode:"edit",external_finish_ts:this.close_day_form_ts,external_finish_ts_report:this.close_day_form_ts_report});this.CLOSE_DAY_FORM.Show()}if(e||window.event)return t.PreventDefault(e);return false};t.CTimeMan.prototype.CheckNeedToReportImm=function(){this.CheckNeedToReport(true)};t.CTimeMan.prototype.CheckNeedToReport=function(e){if(!this.WEEKLY_FORM){e=e?"Y":"N";t.timeman_query("check_report",{force:e},t.proxy(this.ShowFormWeekly,this))}else this.WEEKLY_FORM.popup.show();return false};t.CTimeMan.prototype.ShowFormWeekly=function(e){this.ShowCallReport=false;report_info=e.REPORT_INFO;report_data=e.REPORT_DATA;this.REPORT_FULL_MODE=report_info.MODE;if(report_info.IS_REPORT_DAY=="Y"){this.ShowCallReport=true;t.addCustomEvent("OnWorkReportSend",(function(){if(t("work_report_call_link"))t.hide(t("work_report_call_link"))}))}if(report_data.INFO){if(!this.WEEKLY_FORM||this.WEEKLY_FORM==null){this.WEEKLY_FORM=new t.CTimeManReportFormWeekly(this,{node:this.DIV,bind:this.DIV,mode:"edit"});this.WEEKLY_FORM.data=report_data;this.WEEKLY_FORM.Show()}else this.WEEKLY_FORM.popup.show();window.WEEKLY_FORM=this.WEEKLY_FORM}return false};t.CTimeMan.prototype.CloseDay=function(e){var i={timestamp:a,report:o};if(this.WND&&this.WND.CLOCKWND&&this.WND.CLOCKWND.customUserDate!==undefined){i.customUserDate=this.WND.CLOCKWND.customUserDate}if(this.DATA.RECORD_ID!==undefined){i.recordId=this.DATA.RECORD_ID}this.Query("close",i,t.proxy(this._Update,this));this.setTimestamp(0);this.setReport("");return t.PreventDefault(e)};t.CTimeMan.prototype.OpenDay=function(e){var i={timestamp:a,report:o};if(this.WND&&this.WND.CLOCKWND&&this.WND.CLOCKWND.customUserDate!==undefined){i.customUserDate=this.WND.CLOCKWND.customUserDate}this.Query("open",i,t.proxy(this._Update,this));this.setTimestamp(0);this.setReport("");return t.PreventDefault(e)};t.CTimeMan.prototype.ReOpenDay=function(e){var i="reopen";if(this.DATA&&this.DATA.INFO&&this.DATA.INFO.PAUSED){i="continue"}this.setTimestamp(0);this.setReport("");this.Query("reopen",{newActionName:i},t.proxy(this._Update,this));return t.PreventDefault(e)};t.CTimeMan.prototype.PauseDay=function(e){this.setTimestamp(0);this.setReport("");this.Query("pause",{},t.proxy(this._Update,this));return t.PreventDefault(e)};t.CTimeMan.prototype.calendarEntryAdd=function(e,i){p=e;this.Query("calendar_add",e,i||t.proxy(this._Update,this))};t.CTimeMan.prototype.taskPost=function(e,i){if(typeof e=="object"){this.TASK_CHANGES[e.action].push(e.id);if(this.TASK_CHANGE_TIMEOUT)clearTimeout(this.TASK_CHANGE_TIMEOUT);if(e.action=="add")this.taskPost();else{this.DENY_QUERY=true;this.TASK_CHANGE_TIMEOUT=setTimeout(t.proxy(this.taskPost,this),1e3)}}else{this.DENY_QUERY=false;this.TASKS=[];this.Query("task",this.TASK_CHANGES,t.proxy(this._Update,this));this.TASK_CHANGES={add:[],remove:[]}}};t.CTimeMan.prototype.taskEntryAdd=function(e,i){this.TASKS=[];this.Query("task",e,i||t.proxy(this._Update,this))};t.CTimeManWindow=function(e,i){this.PARENT=e;this.DIV=null;this.POPUP=null;this.LAYOUT=null;this.bindOptions=i;this.DATA={};this.ACTIONS={};this.SHOW=false;this.CREATE=false;this.TIMESTAMP=false;this.ERROR_REPORT="";this.MAIN_BTN_HANDLER=null;this.REPORT=null;this.DASHBOARD=null;this.TASKWND={};this.EVENTWND={};this.isPwtAlertDisplayed=false;t.addCustomEvent(this.PARENT,"onTimeManDataRecieved",t.delegate(this.onTimeManChangeState,this));t.addCustomEvent(this.PARENT,"onTimeManNeedRebuild",t.delegate(this.onTimeManNeedRebuild,this));t.addCustomEvent("onTopPanelCollapse",t.proxy(this.Align,this));t.bind(window,"resize",t.proxy(this.Align,this))};t.CTimeManWindow.prototype.onTimeManChangeState=function(t){if(!this.CREATE)return;this.DATA=t;if(this.SHOW)this.Align()};t.CTimeManWindow.prototype.onTimeManNeedRebuild=function(t){this.CREATE=true;this.Create(t);if(this.SHOW)this.Align()};t.CTimeManWindow.prototype.Create=function(e){if(!this.CREATE)return;if(this.NOTICE_TIMER){t.timer.stop(this.NOTICE_TIMER);this.NOTICE_TIMER=null}if(this.bindOptions.mode=="popup"){if(!this.POPUP){var i=this.bindOptions.popupOptions||{autoHide:true,lightShadow:true,bindOptions:{forceBindPosition:true,forceTop:true},angle:{position:"top",offset:50}};i.lightShadow=true;this.POPUP=new t.PopupWindow("timeman_main",this.bindOptions.node,i)}this.POPUP.setContent(this.CreateLayoutTable(e))}else{if(this.DIV){t.cleanNode(this.DIV);this.DIV=null}if(null==this.DIV){this.DIV=document.body.appendChild(t.create("DIV",{props:{id:"tm-popup"},events:{click:t.eventCancelBubble},style:{position:"absolute",display:this.SHOW?"block":"none"}}));this.DIV.appendChild(this.CreateLayoutTable())}t.cleanNode(this.LAYOUT);this.LAYOUT.appendChild(this.CreateDashboard(e));this.LAYOUT.appendChild(E())}this.LAYOUT.appendChild(this.CreateNoticeRow(e));this.LAYOUT.appendChild(this.CreateMainRow(e));if(e.INFO){if(e.PLANNER){this.PLANNER=new t.CPlanner(e.PLANNER);this.PLANNER.WND=this;this.LAYOUT.appendChild(this.PLANNER.drawAdditional())}this.TABCONTROL=new t.CTimeManTabControl(this.LAYOUT.appendChild(t.create("DIV")));if(e.PLANNER){this.TABCONTROL.addTab({id:"plans",title:t.message("JS_CORE_TM_PLAN"),content:[this.PLANNER.draw()]})}this.TABCONTROL.addTab({id:"report",title:t.message("JS_CORE_TM_REPORT"),content:this.CreateReport()});if(this.PARENT.REPORT_FULL_MODE){this.call_report=t.create("SPAN",{attrs:{id:"work_report_call_link"},props:{className:"wr-call-lable"},html:t.message("JS_CORE_TMR_REPORT_FULL_"+this.PARENT.REPORT_FULL_MODE),events:{click:t.proxy(BXTIMEMAN.CheckNeedToReportImm,BXTIMEMAN)}});if(BXTIMEMAN.ShowCallReport==true){this.call_report.style.display="inline-block"}else{this.call_report.style.display="none"}this.TABCONTROL.HEAD.appendChild(this.call_report)}t.addCustomEvent(this.PARENT,"onTimeManDataRecieved",t.delegate(this.CreateDashboard,this));t.addCustomEvent("onPlannerQueryResult",t.delegate((function(t){this.DATA.PLANNER=t;this.CreateDashboard(this.DATA)}),this));t.addCustomEvent(this.PARENT,"onTimeManDataRecieved",t.delegate(this.CreateNoticeRow,this));t.addCustomEvent(this.PARENT,"onTimeManDataRecieved",t.delegate(this.CreateMainRow,this));t.addCustomEvent(this.PARENT,"onTimeManDataRecieved",t.delegate((function(t){if(!!t.PLANNER)this.update(t.PLANNER)}),this.PLANNER))}t.onCustomEvent(this,"onTimeManWindowBuild",[this,this.LAYOUT,e]);if(!this.isPwtAlertDisplayed){this.addPwt();this.isPwtAlertDisplayed=true}this.Align()};t.CTimeManWindow.prototype.CreateDashboard=function(e){var i,s,a,o;if(null==this.DASHBOARD){this.DASHBOARD=t.create("SPAN",{props:{className:"tm-popup-dashboard"},events:{click:t.proxy(this.Hide,this)},children:[t.create("SPAN",{props:{className:"tm-dashboard-arrow"}}),t.create("SPAN",{props:{className:"tm-dashboard-title"},html:t.message("JS_CORE_TM_POPUP_HIDE")}),i=t.create("SPAN",{children:[t.create("SPAN",{props:{className:"tm-dashboard-bell"}}),t.create("SPAN",{props:{className:"tm-dashboard-text"}})]}),t.create("SPAN",{props:{className:"tm-dashboard-clock"}}),t.create("SPAN",{props:{className:"tm-dashboard-text"},children:[s=t.create("SPAN",{props:{id:"bx_tm_clock"}}),a=t.create("SPAN",{props:{className:"tm-dashboard-subtext",id:"bx_tm_state"}})]}),o=t.create("SPAN",{children:[t.create("SPAN",{props:{className:"tm-dashboard-flag"}}),t.create("SPAN",{props:{className:"tm-dashboard-text"}})]})]});new t.CHint({parent:i,hint:t.message("JS_CORE_HINT_EVENTS")});new t.CHint({parent:a.parentNode,hint:t.message("JS_CORE_HINT_STATE")});new t.CHint({parent:o,hint:t.message("JS_CORE_HINT_TASKS")})}else{i=this.DASHBOARD.firstChild.nextSibling.nextSibling;s=i.nextSibling.nextSibling.firstChild;a=s.nextSibling;o=this.DASHBOARD.lastChild}if(e.PLANNER.TASKS_ENABLED&&e.PLANNER.TASKS_COUNT>0){o.lastChild.innerHTML=e.PLANNER.TASKS_COUNT;t.show(o)}else{t.hide(o)}if(!!e.PLANNER.EVENT_TIME){i.lastChild.innerHTML=e.PLANNER.EVENT_TIME;t.show(i)}else{t.hide(i)}if(!s.TIMER)s.TIMER=t.timer.clock(s);if(e.STATE=="OPENED"){if(a.TIMER){a.TIMER.setFrom(new Date(e.INFO.DATE_START*1e3));a.TIMER.dt=-e.INFO.TIME_LEAKS*1e3}else{a.TIMER=t.timer(a,{from:new Date(e.INFO.DATE_START*1e3),dt:-e.INFO.TIME_LEAKS*1e3,display:"worktime_timeman"})}}else{if(a.TIMER){t.timer.stop(a.TIMER);a.TIMER=null;t.cleanNode(a)}if(e.STATE=="PAUSED"||e.STATE=="CLOSED"&&e.CAN_OPEN!="OPEN"){var r=e.INFO.DATE_FINISH-e.INFO.DATE_START-e.INFO.TIME_LEAKS;a.innerHTML=t.timeman.formatWorkTimeView(r,"worktime_timeman")}}return this.DASHBOARD};t.CTimeManWindow.prototype.CreateLayoutTable=function(){if(this.bindOptions.mode=="popup"){this.LAYOUT=t.create("DIV",{props:{className:"tm-popup-content"}});return this.LAYOUT}else{var e=t.create("TABLE",{attrs:{cellSpacing:"0"},props:{className:"tm-popup-layout"},children:[t.create("TBODY")]});var i=e.tBodies[0].insertRow(-1);var s=i.insertCell(-1);s.className="tm-popup-layout-left";s.appendChild(t.create("DIV",{props:{className:"tm-popup-layout-left-spacer"}}));var a=i.insertCell(-1);a.className="tm-popup-layout-center";var o=i.insertCell(-1);o.className="tm-popup-layout-right";o.appendChild(t.create("DIV",{props:{className:"tm-popup-layout-right-spacer"}}));i=e.tBodies[0].insertRow(-1);i.insertCell(-1).className="tm-popup-layout-left-corner";i.insertCell(-1).className="tm-popup-layout-center-corner";i.insertCell(-1).className="tm-popup-layout-right-corner";this.LAYOUT=a.appendChild(t.create("DIV",{props:{className:"tm-popup-content"}}));return e}};t.CTimeManWindow.prototype.CreateNoticeRow=function(e){var i,s,a;if(null==this.NOTICE){this.NOTICE=t.create("DIV",{props:{className:"tm-popup-notice"},children:[t.create("SPAN",{props:{className:"tm-popup-notice-left"}}),i=t.create("SPAN",{props:{className:"tm-popup-notice-text"}}),s=t.create("SPAN",{props:{className:"tm-popup-notice-time"}}),a=t.create("SPAN",{props:{className:"tm-popup-notice-pencil"},events:{click:t.proxy(this.ShowEdit,this)}}),t.create("SPAN",{props:{className:"tm-popup-notice-right"}})]});this.NOTICE_STATE=u(e,["STATE","CAN_OPEN","CAN_EDIT"])+"/"+u(e.INFO,["DATE_START","DATE_FINISH","TIME_LEAKS"])}else{var o=u(e,["STATE","CAN_OPEN","CAN_EDIT"])+"/"+u(e.INFO,["DATE_START","DATE_FINISH","TIME_LEAKS"]);if(o==this.NOTICE_STATE)return null;this.NOTICE_STATE=o;if(this.NOTICE_TIMER){t.timer.stop(this.NOTICE_TIMER);this.NOTICE_TIMER=null}i=this.NOTICE.firstChild.nextSibling;s=i.nextSibling;a=s.nextSibling}if(!e.ID||e.CAN_EDIT!=="Y"||e.STATE=="EXPIRED"&&e.REPORT_REQ!="A")t.hide(a);else t.show(a);if(e.STATE!="EXPIRED"){t.adjust(i,{text:t.message("JS_CORE_TM_WD_OPENED")+" "});t.show(s);if(e.STATE=="OPENED"){this.NOTICE_TIMER=t.timer(s,{from:e.INFO.DATE_START*1e3,accuracy:1,dt:-1e3*e.INFO.TIME_LEAKS,display:"worktime_notice_timeman"})}else if(e.CAN_OPEN=="OPEN"){s.innerHTML=t.timeman.formatWorkTimeView(0,"worktime_notice_timeman")}else{var r=e.INFO.DATE_FINISH-e.INFO.DATE_START-e.INFO.TIME_LEAKS;s.innerHTML=t.timeman.formatWorkTimeView(r,"worktime_notice_timeman")}}else{t.hide(s);t.adjust(i,{text:t.message("JS_CORE_TM_WD_EXPIRED")})}return this.NOTICE};t.CTimeManWindow.prototype.isMonitorAvailable=function(){return t.ajax.runAction("bitrix:timeman.api.monitor.isAvailable").then((function(t){if(t.data){return true}else{return false}})).catch((function(){return false}))};t.CTimeManWindow.prototype.enableMonitorForCurrentUser=function(){return t.ajax.runAction("bitrix:timeman.api.monitor.enableForCurrentUser").then((function(t){if(t.data){return true}else{return false}})).catch((function(){return false}))};t.CTimeManWindow.prototype.isMonitorEnabled=function(){return t.ajax.runAction("bitrix:timeman.api.monitor.isEnableForCurrentUser").then((function(t){if(t.data){return true}else{return false}})).catch((function(){return false}))};t.CTimeManWindow.prototype.addPwt=function(){if(t.MessengerCommon.isDesktop()){return}this.isMonitorAvailable().then(function(e){if(!e){return}if(BXIM.desktopVersion<55){t("timeman_main").appendChild(t.create("div",{props:{id:"timeman-pwt-container"},style:{textAlign:"center",maxWidth:"450px",marginLeft:"12px",marginRight:"12px"},children:[new t.UI.Alert({icon:t.UI.Alert.Icon.INFO,color:t.UI.Alert.Color.SUCCESS,text:t.message("JS_CORE_TM_MONITOR_UPDATE_DESKTOP")}).getContainer(),t.create("button",{props:{className:"ui-btn ui-btn-success ui-btn-icon-download",id:"timeman-pwt-get-desktop"},text:t.message("JS_CORE_TM_MONITOR_GET_DESKTOP_BUTTON"),style:{marginBottom:"8px"},events:{click:function(){window.open("https://www.bitrix24.ru/features/desktop.php","_blank")}}})]}));t.PULL.subscribe({type:t.PullClient.SubscriptionType.Server,moduleId:"im",command:"desktopOnline",callback:function(t,e,i){this.setPwtStateReadyToEnable()}.bind(this)});return}this.isMonitorEnabled().then(function(e){t("timeman_main").appendChild(t.create("div",{props:{id:"timeman-pwt-container"},style:{textAlign:"center",marginLeft:"12px",marginRight:"12px"}}));if(e){this.addPwtAlert();return}if(BXIM==="undefined"||BXIM.desktopVersion<55){return}this.setPwtStateReadyToEnable()}.bind(this))}.bind(this))};t.CTimeManWindow.prototype.setPwtStateReadyToEnable=function(){var e=t("timeman-pwt-container");if(!e){return}e.innerHTML="";e.appendChild(t.create("button",{props:{className:"ui-btn ui-btn-success ui-btn-icon-start",id:"timeman-pwt-enable"},text:t.message("JS_CORE_TM_MONITOR_ENABLE_BUTTON"),style:{marginBottom:"8px",width:"100%"},events:{click:function(){this.enableMonitorForCurrentUser().then(function(e){if(!e){return}t.remove(t("timeman-pwt-enable"));this.addPwtAlert()}.bind(this))}.bind(this)}}))};t.CTimeManWindow.prototype.addPwtAlert=function(){t("timeman-pwt-container").appendChild(new t.UI.Alert({icon:t.UI.Alert.Icon.INFO,color:t.UI.Alert.Color.SUCCESS,text:t.message("JS_CORE_TM_MONITOR_ENABLED"),customClass:"ui-alert-text-center"}).getContainer())};t.CTimeManWindow.prototype.openMonitorReport=function(){var e=typeof BXDesktopSystem!=="undefined"&&BXDesktopSystem.GetProperty("versionParts")[3]<55;if(BXIM.desktopVersion<55||e){BXIM.openConfirm({title:t.message("JS_CORE_TM_MONITOR"),message:t.message("JS_CORE_TM_MONITOR_OPEN_ERROR")});return false}t.desktopUtils.runningCheck((function(){t.desktopUtils.goToBx("bx://timemanpwt")}),(function(){BXIM.openConfirm({title:t.message("JS_CORE_TM_MONITOR"),message:t.message("JS_CORE_TM_MONITOR_DESKTOP_CLOSED_ERROR")});return false}))};t.CTimeManWindow.prototype.CreateMainRow=function(e){var i;if(null==this.MAIN_ROW){this.MAIN_ROW=t.create("DIV",{props:{className:"tm-popup-timeman"}});i=this.MAIN_ROW.appendChild(t.create("DIV",{props:{className:"tm-popup-timeman-pause"},children:[t.create("SPAN",{props:{className:"tm-popup-timeman-pause-timer-caption"},text:t.message("JS_CORE_TM_WD_PAUSED")}),t.create("SPAN",{props:{className:"tm-popup-timeman-pause-time"}})]}));var s=this.MAIN_ROW.appendChild(t.create("TABLE",{attrs:{cellSpacing:"0"},props:{className:"tm-popup-timeman-layout"},children:[t.create("TBODY")]})),a=s.tBodies[0].insertRow(-1);this.MAIN_ROW_CELL_TIMER=a.insertCell(-1);this.MAIN_ROW_CELL_TIMER.className="tm-popup-timeman-layout-time";this.MAIN_ROW_CELL_BTN=a.insertCell(-1);this.MAIN_ROW_CELL_BTN.className="tm-popup-timeman-layout-button";this.MAIN_ROW_CELL_TIMER.appendChild(this.CreateMainPauseControl(e));this.MAIN_ROW_STATE=u(e,["STATE","CAN_OPEN","CAN_EDIT"])+"/"+u(e.INFO,["DATE_START","DATE_FINISH","TIME_LEAKS"])}else{var o=u(e,["STATE","CAN_OPEN","CAN_EDIT"])+"/"+u(e.INFO,["DATE_START","DATE_FINISH","TIME_LEAKS"]);if(o==this.MAIN_ROW_STATE)return null;this.MAIN_ROW_STATE=o;this.MAIN_ROW.className="tm-popup-timeman";t.cleanNode(this.MAIN_ROW_CELL_BTN);i=this.MAIN_ROW.firstChild;if(!!this.CLOCKWND){this.CLOCKWND.Clear();this.CLOCKWND=null}}if(this.PAUSE_TIMER){t.timer.stop(this.PAUSE_TIMER);this.PAUSE_TIMER=null}if(e.STATE!="PAUSED"){this.MAIN_ROW_CELL_TIMER.firstChild.className="ui-btn ui-btn-icon-pause tm-btn-pause";t.hide(i)}else{this.MAIN_ROW_CELL_TIMER.firstChild.className="ui-btn ui-btn-icon-start tm-btn-start";t.show(i);this.PAUSE_TIMER=t.timer(i.lastChild,{from:e.INFO.DATE_FINISH*1e3,accuracy:1,dt:1e3*e.INFO.TIME_LEAKS,display:"worktime_notice_timeman"})}var r="OPEN";if(e.STATE=="EXPIRED"||e.STATE=="OPENED"||e.STATE=="PAUSED")r="CLOSE";else if(e.STATE=="CLOSED"&&e.CAN_OPEN=="REOPEN")r="REOPEN";this.MAIN_BTN_HANDLER=this.ACTIONS[r];if(e.STATE!="CLOSED"||e.CAN_OPEN){this.MAIN_BUTTON=this.MAIN_ROW_CELL_BTN.appendChild(t.create("DIV",{props:{className:"tm-popup-button-handler"},children:[t.create("button",{props:{className:"ui-btn "+(e.STATE!="CLOSED"?"ui-btn-danger ui-btn-icon-stop":"ui-btn-success ui-btn-icon-start")},text:t.message("JS_CORE_TM_"+r),events:{click:t.proxy(this.MainButtonClick,this)}})]}));if(e.CAN_OPEN_AND_RELAUNCH){this.MAIN_ROW_CELL_BTN.appendChild(t.create("span",{props:{className:"tm-webform-small-button tm-popup-relaunch-btn",id:"tm_popup_relaunch_new"},events:{click:t.proxy((function(){this.ACTIONS.REOPEN()}),this)},text:t.message("JS_CORE_TM_UNPAUSE")}))}if(e.CAN_EDIT&&e.STATE!="PAUSED"){this.MAIN_ROW_CELL_BTN.appendChild(t.create("SPAN",{props:{className:"tm-popup-change-time-link"},events:{click:t.proxy(this.ShowClock,this)},text:t.message("JS_CORE_TM_CHTIME_"+e.STATE)}))}}else{this.MAIN_ROW_CELL_BTN.innerHTML=t.message("JS_CORE_TM_CLOSED")}var p="tm-popup-timeman";if(e.STATE=="PAUSED"){p+=" tm-popup-timeman-paused-mode"}if(e.STATE=="CLOSED"&&e.CAN_OPEN!="REOPEN"){p+=" tm-popup-timeman-button-mode tm-popup-timeman-change-time-mode"}else if(e.STATE=="CLOSED"||e.STATE=="EXPIRED"){p+=" tm-popup-timeman-button-mode"}else{p+=" tm-popup-timeman-buttons-mode"+(!e.TM_FREE&&e.REPORT_REQ!="A"?"":" tm-popup-timeman-change-time-mode")}this.MAIN_ROW.className=p;return this.MAIN_ROW};t.CTimeManWindow.prototype.CreateMainPauseControl=function(e){var i=t.create("button",{events:{click:t.proxy(this.PauseButtonClick,this)},children:[t.create("span",{props:{className:"text-pause"},text:t.message("JS_CORE_TM_UNPAUSE")}),t.create("span",{props:{className:"text-start"},text:t.message("JS_CORE_TM_PAUSE")})]});return i};t.CTimeManWindow.prototype.CreateReport=function(){if(!this.REPORT)this.REPORT=new t.CTimeManReport(this);return this.REPORT.Create()};t.CTimeManWindow.prototype.CreateEvent=function(e,i,s){i=i||{};i.className="tm-popup-event-name";s=s||false;if(!!e.DATE_FROM)e.DATE_FROM=e.DATE_FROM.split(" ")[0];if(!!e.DATE_TO)e.DATE_TO=e.DATE_TO.split(" ")[0];if(!!e.DATE_FROM&&e.DATE_FROM==parseInt(e.DATE_FROM))e.DATE_FROM=t.timeman.formatDate(e.DATE_FROM,false);if(!!e.DATE_TO&&e.DATE_TO==parseInt(e.DATE_TO))e.DATE_TO=t.timeman.formatDate(e.DATE_TO,false);if(!!e.TIME_FROM&&e.TIME_FROM==parseInt(e.TIME_FROM))e.TIME_FROM=t.timeman.formatTime(e.TIME_FROM,false);if(!!e.TIME_TO&&e.TIME_TO==parseInt(e.TIME_TO))e.TIME_TO=t.timeman.formatTime(e.TIME_TO,false);return t.create("DIV",{props:{className:"tm-popup-event",bx_event_id:e.ID},children:[t.create("DIV",{props:{className:"tm-popup-event-datetime"},html:'<span class="tm-popup-event-time-start'+(e.DATE_FROM_TODAY?"":" tm-popup-event-time-passed")+'">'+(s?e.DATE_FROM+" ":"")+e.TIME_FROM+'</span><span class="tm-popup-event-separator">-</span><span class="tm-popup-event-time-end'+(e.DATE_TO_TODAY?"":" tm-popup-event-time-passed")+'">'+(s?e.DATE_TO+" ":"")+e.TIME_TO+"</span>"}),t.create("DIV",{props:i,events:e.ID?{click:t.proxy(this.showEvent,this)}:null,html:'<span class="tm-popup-event-text">'+t.util.htmlspecialchars(e.NAME)+"</span>"})]})};t.CTimeManWindow.prototype.EVENTWND={};t.CTimeManWindow.prototype.showEvent=function(e){var i=t.proxy_context.parentNode.bx_event_id;if(this.EVENTWND[i]&&this.EVENTWND[i].node!=t.proxy_context){this.EVENTWND[i].Clear();this.EVENTWND[i]=null}if(!this.EVENTWND[i]){this.EVENTWND[i]=new t.CTimeManEventPopup(this,{node:t.proxy_context,bind:t.proxy_context.BXPOPUPBIND||this.EVENTS.firstChild,id:i,angle_offset:t.proxy_context.BXPOPUPANGLEOFFSET})}t.onCustomEvent(this,"onEventWndShow",[this.EVENTWND[i]]);this.EVENTWND[i].Show();return t.PreventDefault(e)};t.CTimeManWindow.prototype.CreateEventsForm=function(e){var i=t.isAmPmMode()?"_am_pm":"";var s=t.delegate((function(i,s){p.value=t.util.trim(p.value);if(p.value&&p.value!=t.message("JS_CORE_TM_EVENTS_ADD")){e({from:o.value,to:r.value,name:p.value,absence:l.checked?"Y":"N"});t.timer.start(o.bxtimer);t.timer.start(r.bxtimer);if(!s){t.addClass(p.parentNode,"tm-popup-event-form-disabled");p.value=t.message("JS_CORE_TM_EVENTS_ADD")}else{p.value=""}}return i||window.event?t.PreventDefault(i):null}),this),a=function(){t.removeClass(this.parentNode,"tm-popup-event-form-disabled");if(this.value==t.message("JS_CORE_TM_EVENTS_ADD"))this.value=""};var o=t.create("INPUT",{props:{type:"text",className:"tm-popup-event-start-time-textbox"+i}});o.onclick=t.delegate((function(){var e=t.delegate((function(e){this.CLOCK.closeWnd();var i=t.timeman.unFormatTime(o.value),s=t.timeman.unFormatTime(r.value);var a=3600;if(i&&s)a=s-i;t.timer.stop(o.bxtimer);t.timer.stop(r.bxtimer);o.value=e;r.value=t.timeman.formatTime(t.timeman.unFormatTime(e)+a);r.focus();r.onclick()}),this);if(!this.CLOCK){this.CLOCK=new t.CTimeManClock(this,{start_time:t.timeman.unFormatTime(o.value),node:o,callback:e})}else{this.CLOCK.setNode(o);this.CLOCK.setTime(t.timeman.unFormatTime(o.value));this.CLOCK.setCallback(e)}o.blur();this.CLOCK.Show()}),this);o.bxtimer=t.timer(o,{dt:36e5,accuracy:3600});var r=t.create("INPUT",{props:{type:"text",className:"tm-popup-event-end-time-textbox"+i}});r.onclick=t.delegate((function(){var e=t.delegate((function(e){this.CLOCK.closeWnd();r.value=e;t.timer.stop(o.bxtimer);t.timer.stop(r.bxtimer);p.focus();a.apply(p)}),this);if(!this.CLOCK){this.CLOCK=new t.CTimeManClock(this,{start_time:t.timeman.unFormatTime(r.value),node:r,callback:e})}else{this.CLOCK.setNode(r);this.CLOCK.setTime(t.timeman.unFormatTime(r.value));this.CLOCK.setCallback(e)}r.blur();this.CLOCK.Show()}),this);r.bxtimer=t.timer(r,{dt:72e5,accuracy:3600});var p=t.create("INPUT",{props:{type:"text",className:"tm-popup-event-form-textbox"+i,value:t.message("JS_CORE_TM_EVENTS_ADD")},events:{keypress:function(t){return t.keyCode==13?s(t,true):true},blur:function(){if(this.value==""){t.addClass(this.parentNode,"tm-popup-event-form-disabled");this.value=t.message("JS_CORE_TM_EVENTS_ADD")}},focus:a}});var n="bx_tm_absence_"+Math.random();var l=t.create("INPUT",{props:{type:"checkbox",className:"checkbox",id:n}});this.EVENTS_FORM=t.create("DIV",{props:{className:"tm-popup-event-form tm-popup-event-form-disabled"},children:[o,r,p,t.create("SPAN",{props:{className:"tm-popup-event-form-submit"},events:{click:s}}),t.create("DIV",{props:{className:"tm-popup-event-form-options"},children:[l,t.create("LABEL",{props:{htmlFor:n},text:t.message("JS_CORE_TM_EVENT_ABSENT")})]})]});return this.EVENTS_FORM};t.CTimeManWindow.prototype.CreateTaskCallback=function(e){this.PARENT.taskEntryAdd({name:e.name});this.TASKS_LIST.appendChild(t.create("LI",{props:{className:"tm-popup-task"},text:e.name}))};t.CTimeManWindow.prototype.CreateTasks=function(e){if(!e.TASKS_ENABLED||this.PARENT.TASK_CHANGES.add.length>0||this.PARENT.TASK_CHANGES.remove.length>0)return null;if(e.FULL===false&&!!this.TASKS)return this.TASKS;if(null==this.TASKS){this.TASKS=t.create("DIV");this.TASKS.appendChild(t.create("DIV",{props:{className:"tm-popup-section tm-popup-section-tasks"},children:[t.create("SPAN",{props:{className:"tm-popup-section-left"}}),t.create("SPAN",{props:{className:"tm-popup-section-text"},text:t.message("JS_CORE_TM_TASKS")}),this.TASKS_LINK=t.create("span",{props:{className:"tm-popup-section-right-link"},events:{click:t.proxy(this.ShowTasks,this)},text:t.message("JS_CORE_TM_TASKS_CHOOSE")}),t.create("SPAN",{props:{className:"tm-popup-section-right"}})]}));this.TASKS.appendChild(t.create("DIV",{props:{className:"tm-popup-tasks"},children:[this.TASKS_LIST=t.create("OL",{props:{className:"tm-popup-task-list"}}),this.CreateTasksForm(t.proxy(this.CreateTaskCallback,this))]}))}else{t.cleanNode(this.TASKS_LIST)}if(e.TASKS&&e.TASKS.length>0){var i=null;t.removeClass(this.TASKS,"tm-popup-tasks-empty");for(var s=0,a=e.TASKS.length;s<a;s++){var o=this.TASKS_LIST.appendChild(t.create("LI",{props:{className:"tm-popup-task tm-popup-task-status-"+t.timeman.TASK_SUFFIXES[e.TASKS[s].STATUS],bx_task_id:e.TASKS[s].ID},children:[t.create("SPAN",{props:{className:"tm-popup-task-icon"}}),t.create("SPAN",{props:{className:"tm-popup-task-name",BXPOPUPBIND:this.TASKS.firstChild},text:e.TASKS[s].TITLE,events:{click:t.proxy(this.showTask,this)}}),t.create("SPAN",{props:{className:"tm-popup-task-delete"},events:{click:t.proxy(this.removeTask,this)}})]}));if(e.TASK_LAST_ID&&e.TASKS[s].ID==e.TASK_LAST_ID){i=o}}if(i){setTimeout(t.delegate((function(){if(i.offsetTop<this.TASKS_LIST.scrollTop||i.offsetTop+i.offsetHeight>this.TASKS_LIST.scrollTop+this.TASKS_LIST.offsetHeight){this.TASKS_LIST.scrollTop=i.offsetTop-parseInt(this.TASKS_LIST.offsetHeight/2)}}),this),10)}}else{t.addClass(this.TASKS,"tm-popup-tasks-empty")}return this.TASKS};t.CTimeManWindow.prototype.CreateTasksForm=function(e){var i=t.delegate((function(i,a){s.value=t.util.trim(s.value);if(s.value&&s.value!=t.message("JS_CORE_TM_TASKS_ADD")){e({name:s.value});if(!a){t.addClass(s.parentNode,"tm-popup-task-form-disabled");s.value=t.message("JS_CORE_TM_TASKS_ADD")}else{s.value=""}}return t.PreventDefault(i)}),this);var s=t.create("INPUT",{props:{type:"text",className:"tm-popup-task-form-textbox",value:t.message("JS_CORE_TM_TASKS_ADD")},events:{keypress:function(t){return t.keyCode==13?i(t,true):true},blur:function(){if(this.value==""){t.addClass(this.parentNode,"tm-popup-task-form-disabled");this.value=t.message("JS_CORE_TM_TASKS_ADD")}},focus:function(){t.removeClass(this.parentNode,"tm-popup-task-form-disabled");if(this.value==t.message("JS_CORE_TM_TASKS_ADD"))this.value=""}}});t.focusEvents(s);return t.create("DIV",{props:{className:"tm-popup-task-form tm-popup-task-form-disabled"},children:[s,t.create("SPAN",{props:{className:"tm-popup-task-form-submit"},events:{click:i}})]})};t.CTimeManWindow.prototype.ShowTasks=function(){if(null==this.TASKSWND){this.TASKSWND=new t.CTimeManTasksSelector(this,{node:t.proxy_context,onselect:t.proxy(this.addTask,this)})}else{this.TASKSWND.setNode(t.proxy_context)}this.TASKSWND.Show()};t.CTimeManWindow.prototype.addTask=function(e){this.TASKS_LIST.appendChild(t.create("LI",{props:{className:"tm-popup-task"},text:e.name}));this.PARENT.taskPost({action:"add",id:e.id})};t.CTimeManWindow.prototype.removeTask=function(e){this.PARENT.taskPost({action:"remove",id:t.proxy_context.parentNode.bx_task_id});t.cleanNode(t.proxy_context.parentNode,true);return t.PreventDefault(e)};t.CTimeManWindow.prototype.showTask=function(e){var i=t.proxy_context.parentNode.bx_task_id;var s=this.data&&this.data.INFO?this.data.INFO.TASKS:this.DATA.TASKS,a=[];if(s.length>0){for(var o=0;o<s.length;o++)a.push(s[o].ID);taskIFramePopup.tasksList=a;taskIFramePopup.view(i)}return false};t.CTimeManWindow.prototype.ShowClock=function(e,i){if(!t.type.isString(e))e=null;if(null==this.CLOCKWND){this.CLOCKWND=new t.CTimeManTimeSelector(this,{node:this.MAIN_BUTTON,error:e,start_time:i||(this.DATA.STATE=="EXPIRED"&&this.DATA.EXPIRED_DATE?this.DATA.EXPIRED_DATE:null),free_mode:this.PARENT.FREE_MODE})}else{this.CLOCKWND.setError(e);this.CLOCKWND.setNode(this.MAIN_BUTTON);if(this.DATA.STATE=="EXPIRED"&&this.DATA.EXPIRED_DATE)this.CLOCKWND.setTime(this.DATA.EXPIRED_DATE)}this.CLOCKWND.Show()};t.CTimeManWindow.prototype.ShowEdit=function(){if(null==this.EDITWND){this.EDITWND=new t.CTimeManEditPopup(this,{node:this.NOTICE,bind:this.NOTICE,entry:this.PARENT.DATA,free_mode:this.PARENT.FREE_MODE})}else{this.EDITWND.setNode(this.NOTICE);this.EDITWND.setData(this.PARENT.DATA)}this.EDITWND.Show()};t.CTimeManWindow.prototype.PauseButtonClick=function(t){var e=this.PARENT.DATA.INFO.PAUSED?this.ACTIONS.REOPEN:this.ACTIONS.PAUSE;return e(t)};t.CTimeManWindow.prototype.MainButtonClick=function(e){this.PARENT.setTimestamp(this.TIMESTAMP);this.PARENT.setReport(this.ERROR_REPORT);if(this.MAIN_BTN_HANDLER==this.ACTIONS.OPEN&&this.REPORT){this.REPORT.Reset()}if(this.MAIN_BTN_HANDLER==this.ACTIONS.CLOSE){this.isMonitorEnabled().then(function(e){if(!e){return}t.desktopUtils.runningCheck(function(){var e=t.UI.Notification.Center.notify({content:t.message("JS_CORE_TM_MONITOR_REPORT_NOTIFICATION"),autoHideDelay:5e3,actions:[{title:t.message("JS_CORE_TM_MONITOR_REPORT_OPEN"),events:{click:function(){this.openMonitorReport();e.close()}.bind(this)}}]})}.bind(this),function(){t.UI.Notification.Center.notify({content:t.message("JS_CORE_TM_MONITOR_REPORT_NOTIFICATION_DESKTOP_DISABLED"),autoHideDelay:5e3})}.bind(this))}.bind(this))}return this.MAIN_BTN_HANDLER(e)};t.CTimeManWindow.prototype.clearTempData=function(){this.TIMESTAMP=0;this.ERROR_REPORT=""};t.CTimeManWindow.prototype.showReportField=function(t){this.ShowClock(t)};t.CTimeManWindow.prototype.Align=function(){if(!this.SHOW)return;if(this.bindOptions.mode!="popup"){var e=t.GetWindowInnerSize();this.bindOptions.node=t(this.bindOptions.node);if(this.bindOptions.node){var i=t.pos(this.bindOptions.node),s=0,a=0;a=this.bindOptions.type[0]=="right"||this.bindOptions.type[1]=="right"?i.right-460:i.left;s=this.bindOptions.type[0]=="top"||this.bindOptions.type[1]=="top"?i.top:i.bottom;if(this.bindOptions.offsetLeft)a+=this.bindOptions.offsetLeft;if(this.bindOptions.offsetTop)s+=this.bindOptions.offsetTop}if(a<=0)a=i.left;this.DIV.style.left=a+"px";this.DIV.style.top=s+"px"}};t.CTimeManWindow.prototype.isShown=function(){if(this.bindOptions.mode=="popup"){return!!this.POPUP&&this.POPUP.isShown()}else{return!!this.SHOW}};t.CTimeManWindow.prototype.Show=function(){if(!this.PARENT.DATA||!this.PARENT.DATA.STATE)return false;this.CREATE=true;if(null==this.DIV&&null==this.POPUP)this.Create(this.PARENT.DATA);this.DATA=this.PARENT.DATA;if(this.bindOptions.mode=="popup"){if(this.POPUP.isShown()){this.Hide();return false}else{this.POPUP.show()}}else{if(this.DIV.style.display=="block"){this.Hide();return false}else{this.SHOW=true;this.Align();this.DIV.style.display="block";setTimeout(t.proxy(this.onAfterShow,this),10)}}t.onCustomEvent("onTimeManWindowOpen",[this]);return true};t.CTimeManWindow.prototype.onAfterShow=function(){t.bind(document,"click",t.proxy(this.HideClick,this))};t.CTimeManWindow.prototype.HideClick=function(t){if(t.button==2)return true;this.Hide()};t.CTimeManWindow.prototype.Hide=function(){if(this.bindOptions.mode=="popup"){this.POPUP.close()}else{t.unbind(document,"click",t.proxy(this.HideClick,this));this.DIV.style.display="none";this.SHOW=false}t.onCustomEvent("onTimeManWindowClose",[this])};t.CTimeManClock=function(e,i){this.parent=e;this.params=i;this.params.popup_buttons=this.params.popup_buttons||[new t.PopupWindowButton({text:t.message("JS_CORE_TM_EVENT_SET"),className:"popup-window-button-create",events:{click:t.proxy(this.setValue,this)}})];this.isReady=false;var s=this.params.popup_config||{offsetLeft:-45,offsetTop:-135,autoHide:true,closeIcon:true,closeByEsc:true};s.lightShadow=true;this.WND=new t.PopupWindow(this.params.popup_id||"timeman_clock_popup",this.params.node,s);this.SHOW=false;t.addCustomEvent(this.WND,"onPopupClose",t.delegate(this.onPopupClose,this));this.obClocks={};this.CLOCK_ID=this.params.clock_id||"timeman_clock"};t.CTimeManClock.prototype.Show=function(){if(!this.isReady){t.timeman.showWait(this.parent.DIV);t.addCustomEvent("onTMClockRegister",t.proxy(this.onTMClockRegister,this));return t.ajax.get(e,{action:"clock",start_time:this.params.start_time,clock_id:this.CLOCK_ID,sessid:t.bitrix_sessid()},t.delegate(this.Ready,this))}this.WND.setButtons(this.params.popup_buttons);this.WND.show();this.SHOW=true;if(window["bxClock_"+this.obClocks[this.CLOCK_ID]]){setTimeout("window['bxClock_"+this.obClocks[this.CLOCK_ID]+"'].CalculateCoordinates()",40)}return true};t.CTimeManClock.prototype.onTMClockRegister=function(e){if(e[this.CLOCK_ID]){this.obClocks[this.CLOCK_ID]=e[this.CLOCK_ID];t.removeCustomEvent("onTMClockRegister",t.proxy(this.onTMClockRegister,this))}};t.CTimeManClock.prototype.Ready=function(e){this.content=this.CreateContent(e);this.WND.setContent(this.content);if(window.BXTIMEMAN&&window.BXTIMEMAN.WND&&window.BXTIMEMAN.WND.onSelectDateLinkClick){var i=this.content.querySelectorAll('[data-role="date-picker"]');for(var s=0;s<i.length;s++){t.bind(i[s],"click",t.proxy(window.BXTIMEMAN.WND.onSelectDateLinkClick,this))}}this.isReady=true;t.timeman.closeWait();setTimeout(t.proxy(this.Show,this),30)};t.CTimeManClock.prototype.CreateContent=function(e){return t.create("DIV",{events:{click:t.PreventDefault},html:'<div class="bx-tm-popup-clock-wnd-title">'+t.message("JS_CORE_CL")+"</div>"+E(true)+'<div class="bx-tm-popup-clock">'+e+"</div>"})};t.CTimeManClock.prototype.setValue=function(e){if(this.params.callback){var i=t.findChild(this.content,{tagName:"INPUT"},true);this.params.callback.apply(this.params.node,[i.value])}return t.PreventDefault(e)};t.CTimeManClock.prototype.closeWnd=function(e){this.WND.close();return e||window.event?t.PreventDefault(e):true};t.CTimeManClock.prototype.setNode=function(t){this.WND.setBindElement(t)};t.CTimeManClock.prototype.setTime=function(t){this.params.start_time=t;if(window["bxClock_"+this.obClocks[this.CLOCK_ID]]){window["bxClock_"+this.obClocks[this.CLOCK_ID]].SetTime(parseInt(t/3600),parseInt(t%3600/60))}};t.CTimeManClock.prototype.setCallback=function(t){this.params.callback=t};t.CTimeManClock.prototype.onPopupClose=function(){this.SHOW=false};t.CTimeManTimeSelector=function(e,i){i=i||{};i.popup_id="timeman_time_selector_popup"+Math.random();i.popup_config={offsetLeft:-50,offsetTop:-30,autoHide:true,closeIcon:true,closeByEsc:true};this.free_mode=!!i.free_mode;i.popup_buttons=[new t.PopupWindowButton({text:e.MAIN_BUTTON.textContent||e.MAIN_BUTTON.innerText,className:e.DATA.STATE=="CLOSED"?"popup-window-button-accept":"popup-window-button-decline",events:{click:t.proxy(this.setValue,this)}}),new t.PopupWindowButtonLink({text:t.message("JS_CORE_TM_B_CLOSE"),className:"popup-window-button-link-cancel",events:{click:t.proxy(this.closeWnd,this)}})];t.CTimeManTimeSelector.superclass.constructor.apply(this,[e,i]);this.CLOCK_ID="timeman_report_clock"};t.extend(t.CTimeManTimeSelector,t.CTimeManClock);t.CTimeManWindow.prototype.onSelectDateLinkClick=function(e){var i=new Date;if(this.parent&&this.parent.DATA&&this.parent.DATA.INFO&&this.parent.DATA.INFO.DATE_START&&this.parent.DATA.INFO.CURRENT_STATUS&&this.parent.DATA.INFO.CURRENT_STATUS!=="CLOSED"){if(this.parent.DATA.INFO.RECOMMENDED_CLOSE_TIMESTAMP&&this.parent.DATA.INFO.RECOMMENDED_CLOSE_TIMESTAMP>0){i=new Date(this.parent.DATA.INFO.RECOMMENDED_CLOSE_TIMESTAMP*1e3)}else{i=new Date(this.parent.DATA.INFO.DATE_START*1e3)}}var s=t.date.format(t.date.convertBitrixFormat(t.message("FORMAT_DATE")),i);var a=t.create("INPUT",{props:{type:"text",className:"bx-tm-popup-clock-wnd-custom-date-picker",value:s},events:{click:function(e){t.calendar({node:e.currentTarget,field:e.currentTarget,bTime:false})},change:t.delegate((function(t){if(window.BXTIMEMAN&&window.BXTIMEMAN.WND){if(t.currentTarget.dataset.type==="start"){window.BXTIMEMAN.WND.startUserDate=t.currentTarget.value}else if(t.currentTarget.dataset.type==="end"){window.BXTIMEMAN.WND.endUserDate=t.currentTarget.value}else if(window.BXTIMEMAN.WND.CLOCKWND&&t.currentTarget.dataset.type==="single"){window.BXTIMEMAN.WND.CLOCKWND.customUserDate=t.currentTarget.value}}}),this)}});if(window.BXTIMEMAN&&window.BXTIMEMAN.WND){if(e.currentTarget.dataset.type==="start"){window.BXTIMEMAN.WND.startUserDate=e.currentTarget.value;this.bChanged=true;if(this.SetSaveButton){this.SetSaveButton({className:"popup-window-button-create"})}}else if(e.currentTarget.dataset.type==="end"){window.BXTIMEMAN.WND.endUserDate=e.currentTarget.value;this.bChanged=true;if(this.SetSaveButton){this.SetSaveButton({className:"popup-window-button-create"})}}else if(window.BXTIMEMAN.WND.CLOCKWND&&e.currentTarget.dataset.type==="single"){window.BXTIMEMAN.WND.CLOCKWND.customUserDate=e.currentTarget.value}}a.dataset.role=e.currentTarget.dataset.role;a.dataset.type=e.currentTarget.dataset.type;e.currentTarget.parentNode.appendChild(a);a.style.width=a.value.length.toString()+"px!important";e.currentTarget.classList.add("timeman-hide");t.calendar({node:a,field:a,bTime:false})};t.CTimeManTimeSelector.prototype.buildCustomDatePicker=function(){return t.create("SPAN",{text:t.message("JS_CORE_TM_WD_CLOCK_SET_CUSTOM_DATE"),props:{className:"bx-tm-popup-clock-wnd-custom-date-link"},dataset:{role:"date-picker",type:"single"}})};t.CTimeManTimeSelector.prototype.CreateContent=function(e){if(!this.content){var i=t.create("TABLE"),s=i.appendChild(t.create("TBODY")).insertRow(-1);var a=s.insertCell(-1);a.innerHTML='<div class="bx-tm-popup-clock-wnd-clock">'+e+"</div>";var o=[i];if(!this.free_mode){a=s.insertCell(-1);a.appendChild(t.create("DIV",{props:{className:"bx-tm-popup-clock-wnd-report"},children:[this.content_subtitle=t.create("DIV",{props:{className:"bx-tm-popup-clock-wnd-subtitle"},html:t.message("JS_CORE_TM_CHTIME_CAUSE")}),this.REPORT=t.create("TEXTAREA",{props:{className:"bx-tm-popup-clock-wnd-reason"}}),t.create("DIV",{props:{className:"bx-tm-popup-clock-wnd-custom-date-block"},children:[this.buildCustomDatePicker.bind(this)()]})]}))}else{i.setAttribute("align","center");o.push(t.create("DIV",{props:{className:"bx-tm-popup-clock-wnd-custom-date-link-wrapper"},children:[this.buildCustomDatePicker.bind(this)()]}))}this.content=t.create("DIV",{props:{className:"bx-tm-popup-clock-wnd bx-tm-popup-time-selector-wnd bx-tm-popup-date-selector-wnd"},children:[this.content_title=t.create("DIV",{props:{className:"bx-tm-popup-clock-wnd-title bx-tm-popup-clock-wnd-title-sm"},html:t.message("JS_CORE_TM_CHTIME_"+this.parent.DATA.STATE)}),E(),t.create("DIV",{props:{className:this.free_mode?"bx-tm-popup-clock-free-mode":""},children:o})]})}else{this.content_title.innerHTML=t.message("JS_CORE_TM_CHTIME_"+this.parent.DATA.STATE);this.content_subtitle.innerHTML=this.parent.DATA.STATE!="EXPIRED"?t.message("JS_CORE_TM_CHTIME_CAUSE"):" "}return this.content};t.CTimeManTimeSelector.prototype.setValue=function(e){var i=this.REPORT?t.util.trim(this.REPORT.value):"";if(this.free_mode||i.length>0){var s=t.findChild(this.content,{tagName:"INPUT"},true);this.parent.TIMESTAMP=t.timeman.unFormatTime(s.value);this.parent.ERROR_REPORT=this.free_mode?"":i;this.parent.MainButtonClick(e);this.SHOW=false}else{this.REPORT.className="bx-tm-popup-clock-wnd-report-error";this.REPORT.focus();this.REPORT.onkeypress=function(){this.className="";this.onkeypress=null}}};t.CTimeManTimeSelector.prototype.setError=function(t){if(t){if(confirm(t)){this.setValue();this.WND.close()}}};t.CTimeManTimeSelector.prototype.setNode=function(e){t.CTimeManTimeSelector.superclass.setNode.apply(this,arguments);this.params.popup_buttons[0].setName(e.textContent||e.innerText)};t.CTimeManTimeSelector.prototype.Clear=function(){this.closeWnd()};t.CTimeManEditPopup=function(e,i){i=i||{};this.mode=i.mode=i.mode||"edit";this.free_mode=!!i.free_mode;i.popup_id="timeman_edit_popup_"+Math.random()*1e5;i.popup_config={offsetLeft:-50,offsetTop:-30,autoHide:true,closeIcon:true,closeByEsc:true};this.bChanged=false;i.popup_buttons=[this.SAVEBUTTON=new t.PopupWindowButton({text:t.message("JS_CORE_TM_B_SAVE"),className:"popup-window-button",events:{click:t.proxy(this.setValue,this)}}),new t.PopupWindowButtonLink({text:t.message("JS_CORE_TM_B_CLOSE"),className:"popup-window-button-link-cancel",events:{click:t.proxy(this.closeWnd,this)}})];t.CTimeManEditPopup.superclass.constructor.apply(this,[e,i]);this.checkEntry();this.CLOCK_ID="timeman_edit_from";this.CLOCK_ID_1="timeman_edit_to";this.obClocks={};this.arInputs={};this.arPause=[];t.addCustomEvent(this.parent.PARENT,"onTimeManDataRecieved",t.proxy(this.setData,this))};t.extend(t.CTimeManEditPopup,t.CTimeManClock);t.CTimeManEditPopup.prototype.setData=function(t){this.params.entry=t;if(this.isReady){this.CreateContent()}};t.CTimeManEditPopup.prototype.checkEntry=function(){this.params.entry.INFO.TIME_START=parseInt(this.params.entry.INFO.TIME_START);this.params.entry.INFO.TIME_FINISH=parseInt(this.params.entry.INFO.TIME_FINISH);this.params.entry.INFO.DURATION=parseInt(this.params.entry.INFO.DURATION);this.date_start=new Date(this.params.entry.INFO.DATE_START*1e3);this.date_finish=this.params.entry.INFO.DATE_FINISH?new Date(this.params.entry.INFO.DATE_FINISH*1e3):new Date;this.timezone_diff=(this.date_start.getHours()-Math.floor(this.params.entry.INFO.TIME_START/3600))*36e5;this.today=new Date((new Date).valueOf()-this.timezone_diff);this.bFinished=this.params.entry.STATE=="CLOSED";this.bExpired=this.params.entry.STATE=="EXPIRED";if(this.bExpired){this.bChanged=true;this.params.entry.EXPIRED_DATE=parseInt(this.params.entry.EXPIRED_DATE);this.SetSaveButton({caption:t.message("JS_CORE_TM_CLOSE"),className:"popup-window-button-decline"})}};t.CTimeManEditPopup.prototype.SetSaveButton=function(e){if(!e)e={caption:t.message("JS_CORE_TM_B_SAVE"),className:""};if(e.className||e.className==="")this.SAVEBUTTON.setClassName("popup-window-button "+e.className);if(e.caption)this.SAVEBUTTON.setName(e.caption)};t.CTimeManEditPopup.prototype.Show=function(){if(!this.isReady){t.addCustomEvent("onTMClockRegister",t.proxy(this.onTMClockRegister,this));t.timeman.showWait(this.parent.DIV);return t.ajax.get(e,{action:"clock",clock_id:this.CLOCK_ID,clock_id_1:this.CLOCK_ID_1,start_time:this.params.entry.INFO.TIME_START,start_time_1:this.params.entry.INFO.TIME_FINISH||this.params.entry.EXPIRED_DATE||"",sessid:t.bitrix_sessid()},t.delegate(this.Ready,this))}t.CTimeManEditPopup.superclass.Show.apply(this,arguments);if(!this.bOnChangeSet)setTimeout(t.proxy(this.SetClockOnChange,this),20);return true};t.CTimeManEditPopup.prototype.onTMClockRegister=function(e){if(e[this.CLOCK_ID]){this.obClocks[this.CLOCK_ID]=e[this.CLOCK_ID];this.obClocks[this.CLOCK_ID_1]=e[this.CLOCK_ID_1];t.removeCustomEvent("onTMClockRegister",t.proxy(this.onTMClockRegister,this))}};t.CTimeManEditPopup.prototype.SetClockOnChange=function(){if(this.bOnChangeSet)return;var e=t.findChildren(this.CLOCKS_CONTAINER,{tagName:"INPUT",property:{type:"hidden"}},true);for(var i=0;i<e.length;i++){this.arInputs[e[i].name]=e[i];this.arInputs[e[i].name].BXORIGINALVALUE="";this.arInputs[e[i].name].onchange=t.proxy(this._input_onchange,this)}this.bOnChangeSet=true};t.CTimeManEditPopup.prototype._input_onchange=function(){var e=t.proxy_context,i=this.arInputs.timeman_edit_from.value.split(":"),s=this.arInputs.timeman_edit_to.value.split(":");if(e.BXORIGINALVALUE===""){e.BXORIGINALVALUE=this.bExpired&&e.name=="timeman_edit_to"?0:e.value}else if(e.value!=e.BXORIGINALVALUE){if(e.name=="timeman_edit_to"&&!this.bFinished&&!this.bExpired){this.SetSaveButton({className:"popup-window-button-decline",caption:t.message("JS_CORE_TM_CLOSE")})}else if(this.SAVEBUTTON.text!=t.message("JS_CORE_TM_CLOSE")){this.SetSaveButton({className:"popup-window-button-create"})}this.bChanged=true}i[0]=parseInt(i[0],10);s[0]=parseInt(s[0],10);if(t.isAmPmMode()&&i[0]<12&&/pm/i.test(i[1]))i[0]+=12;if(t.isAmPmMode()&&s[0]<12&&/pm/i.test(s[1]))s[0]+=12;i[1]=parseInt(i[1],10);s[1]=parseInt(s[1],10)};t.CTimeManEditPopup.prototype.CreateContent=function(e){if(!this.content){var i=[this.content_title=t.create("DIV",{props:{className:"bx-tm-popup-clock-wnd-title"},html:t.message("JS_CORE_TM_CHTIME_DAY")}),E(),t.create("DIV",{props:{className:"bx-tm-popup-edit-clock-wnd-clock"},html:'<span class="bx-tm-clock-caption">'+t.message("JS_CORE_TM_ARR")+'</span><span class="bx-tm-clock-caption">'+t.message("JS_CORE_TM_DEP")+"</span>"}),this.CLOCKS_CONTAINER=t.create("DIV",{props:{className:"bx-tm-popup-edit-clock-wnd-clock"},html:e})];if(this.mode=="edit"&&!this.free_mode){i.push(E());i.push(t.create("DIV",{props:{className:"bx-tm-popup-clock-wnd-report"},children:[t.create("DIV",{props:{className:"bx-tm-popup-clock-wnd-subtitle"},html:t.message("JS_CORE_TM_CHTIME_CAUSE")}),this.REPORT=t.create("TEXTAREA")]}))}i.push(t.create("DIV",{style:{height:"1px",clear:"both"}}));this.content=t.create("DIV",{props:{className:"bx-tm-popup-clock-wnd bx-tm-popup-edit-clock-wnd bx-tm-popup-edit-time-date-wnd"},children:i});this.WNDSTATE=u(this.params.entry,["STATE","CAN_EDIT"])+"/"+u(this.params.entry.INFO,["DATE_START","DATE_FINISH","TIME_LEAKS"]);if(window.BXTIMEMAN&&window.BXTIMEMAN.WND&&window.BXTIMEMAN.WND.onSelectDateLinkClick){var s=this.content.querySelectorAll('[data-role="date-picker"]');for(var a=0;a<s.length;a++){t.bind(s[a],"click",t.proxy(window.BXTIMEMAN.WND.onSelectDateLinkClick,this))}}}else{var o=u(this.params.entry,["STATE","CAN_EDIT"])+"/"+u(this.params.entry.INFO,["DATE_START","DATE_FINISH","TIME_LEAKS"]);if(o==this.WNDSTATE)return true;this.WNDSTATE=o;this.restoreButtons();if(this.CONT_PAUSEEDITOR){if(this.HINT_PAUSEEDITOR){this.HINT_PAUSEEDITOR.Destroy();this.HINT_PAUSEEDITOR=null}this.CONT_PAUSEEDITOR.parentNode.removeChild(this.CONT_PAUSEEDITOR);this.CONT_PAUSEEDITOR=null}if(this.CONT_DURATION){this.CONT_DURATION.parentNode.removeChild(this.CONT_DURATION);this.CONT_DURATION=null}}if(this.params.entry.CAN_EDIT||this.params.entry.INFO.CAN_EDIT=="Y"){this.INPUT_TIME_LEAKS=t.create("INPUT",{props:{type:"text",className:"bx-tm-report-edit",value:t.timeman.formatTime(this.params.entry.INFO.TIME_LEAKS||0,false,true)},style:{width:"40px"},events:{change:t.proxy(this._input_onchange,this)}})}else{this.INPUT_TIME_LEAKS=t.create("INPUT",{props:{disabled:true,type:"text",className:"bx-tm-report-edit",value:t.timeman.formatTime(this.params.entry.INFO.TIME_LEAKS||0,false,true)},style:{width:"40px"}})}this.CONT_PAUSEEDITOR=this.content.insertBefore(t.create("DIV",{props:{className:"bx-tm-popup-clock-wnd-report"},children:[t.create("DIV",{props:{className:"bx-tm-popup-clock-wnd-subtitle"},html:t.message("JS_CORE_TM_WD_PAUSED_1")}),t.create("DIV",{props:{className:"bx-tm-edit-section"},children:[this.INPUT_TIME_LEAKS]})]}),this.CLOCKS_CONTAINER.nextSibling);this.INPUT_TIME_LEAKS.BXORIGINALVALUE=this.INPUT_TIME_LEAKS.value;if(!!this.PAUSE_TIMER)t.timer.stop(this.PAUSE_TIMER);this.content.insertBefore(E(),this.CLOCKS_CONTAINER.nextSibling);var r=this.params.entry.INFO.DURATION>0?this.params.entry.INFO.DURATION:!!this.params.entry.INFO.TIME_FINISH&&!isNaN(this.params.entry.INFO.TIME_FINISH)?this.params.entry.INFO.TIME_FINISH-this.params.entry.INFO.TIME_START-this.params.entry.INFO.TIME_LEAKS:this.bExpired?this.params.entry.EXPIRED_DATE-this.params.entry.INFO.TIME_START-this.params.entry.INFO.TIME_LEAKS:parseInt((new Date).valueOf()/1e3)-parseInt(this.params.entry.INFO.DATE_START)-parseInt(this.params.entry.INFO.TIME_LEAKS);this.CONT_DURATION=this.content.insertBefore(t.create("DIV",{props:{className:"bx-tm-field"},children:[t.create("SPAN",{props:{className:"bx-tm-report-caption"},text:t.message("JS_CORE_TM_WD_OPENED")+" "}),t.create("SPAN",{props:{className:"bx-tm-report-field",bx_tm_tag:"DURATION"},html:t.timeman.formatWorkTime(r)})]}),this.CLOCKS_CONTAINER.nextSibling);return this.content};t.CTimeManEditPopup.prototype.setValue=function(e){if(!this.bChanged)return;var i,s=this.free_mode?"":this.mode=="edit"?t.util.trim(this.REPORT.value):"modified by admin";if(this.free_mode||s.length>0){var a={};if(this.arInputs[this.CLOCK_ID].value!=this.arInputs[this.CLOCK_ID].BXORIGINALVALUE){a[this.CLOCK_ID]=t.timeman.unFormatTime(this.arInputs[this.CLOCK_ID].value)}if(this.arInputs[this.CLOCK_ID_1].value!=this.arInputs[this.CLOCK_ID_1].BXORIGINALVALUE){a[this.CLOCK_ID_1]=t.timeman.unFormatTime(this.arInputs[this.CLOCK_ID_1].value)}if(this.INPUT_TIME_LEAKS.value!=this.INPUT_TIME_LEAKS.BXORIGINALVALUE){a.TIME_LEAKS=t.timeman.unFormatTime(this.INPUT_TIME_LEAKS.value)}a.report=s;if(window.BXTIMEMAN&&window.BXTIMEMAN.WND&&window.BXTIMEMAN.WND.startUserDate!==undefined){a.startUserDate=window.BXTIMEMAN.WND.startUserDate}if(window.BXTIMEMAN&&window.BXTIMEMAN.WND&&window.BXTIMEMAN.WND.endUserDate!==undefined){a.endUserDate=window.BXTIMEMAN.WND.endUserDate}this.parent.PARENT.Query("save",a,t.proxy(this.parent.PARENT._Update,this.parent.PARENT));this.bChanged=false;this.restoreButtons();this.SHOW=false;if(this.REPORT)this.REPORT.value="";this.arInputs[this.CLOCK_ID].value=this.arInputs[this.CLOCK_ID].BXORIGINALVALUE;this.arInputs[this.CLOCK_ID_1].value=this.arInputs[this.CLOCK_ID_1].BXORIGINALVALUE;this.arPause=[];this.WND.close()}else{this.REPORT.className="bx-tm-popup-clock-wnd-report-error";this.REPORT.focus();this.REPORT.onkeypress=function(){this.className="";this.onkeypress=null}}};t.CTimeManEditPopup.prototype.Clear=function(){window.bxClock_timeman_edit_from=null;window.bxClock_timeman_edit_to=null;if(this.WND){this.WND.close();this.WND.destroy();this.WND=null}};t.CTimeManEditPopup.prototype.restoreButtons=function(){this.SetSaveButton();this.checkEntry()};t.CTimeManTasksSelector=function(e,i){this.parent=e;this.params=i;this.isReady=false;this.WND=t.PopupWindowManager.create("timeman_tasks_selector_"+parseInt(Math.random()*1e4),this.params.node,{autoHide:true,content:this.content=t.create("DIV"),buttons:[new t.PopupWindowButtonLink({text:t.message("JS_CORE_TM_B_CLOSE"),className:"popup-window-button-link-cancel",events:{click:function(e){this.popupWindow.close();return t.PreventDefault(e)}}})]})};t.CTimeManTasksSelector.prototype.Show=function(){if(!this.isReady){var i=parseInt(Math.random()*1e4);window["TIMEMAN_ADD_TASK_"+i]=t.proxy(this.setValue,this);t.timeman.showWait();return t.ajax.get(e,{action:"tasks",suffix:i,sessid:t.bitrix_sessid()},t.delegate(this.Ready,this))}return this.WND.show()};t.CTimeManTasksSelector.prototype.Hide=function(){this.WND.close()};t.CTimeManTasksSelector.prototype.Ready=function(e){this.content.innerHTML=e;this.isReady=true;this.Show();t.timeman.closeWait()};t.CTimeManTasksSelector.prototype.setValue=function(t){this.params.onselect(t);this.WND.close()};t.CTimeManTasksSelector.prototype.setNode=function(t){this.WND.setBindElement(t)};t.CTimeManPopup=function(e,i,s,a){this.node=e;this.popup_id=s;a=a||{};var o=false; /*@cc_on @if (@_jscript_version <= 5.7) ie7 = true; /*@end @*/this.popup=t.PopupWindowManager.create(this.popup_id,i,{closeIcon:{right:"12px",top:"10px"},offsetLeft:o||document.documentMode&&document.documentMode<=7?-347:-340,autoHide:true,bindOptions:{forceBindPosition:true,forceTop:true},angle:{position:"right",offset:a.angle_offset||27}})};t.CTimeManPopup.prototype.Show=function(){this.popup.setTitleBar({content:this.GetTitle()});this.popup.setContent(this.GetContent());this.popup.setButtons(this.GetButtons());var t=0;if(this.node&&this.node.parentNode&&this.node.parentNode.parentNode)t=this.node.parentNode.offsetTop-this.node.parentNode.parentNode.scrollTop;this.popup.setOffset({offsetTop:this.params.offsetTop||t-20});this.popup.adjustPosition();this.popup.show()};t.CTimeManPopup.prototype.setNode=function(t){this.node=t;this.popup.setBindElement(t)};t.CTimeManPopup.prototype.Clear=function(){if(this.popup){this.popup.close();this.popup.destroy();this.popup=null}this.node=null};t.CTimeManPopup.prototype.GetTitle=function(){return""};t.CTimeManPopup.prototype.GetContent=function(){return""};t.CTimeManPopup.prototype.GetButtons=function(){return[]};t.CTimeManEventPopup=function(e,i){this.parent=e;this.params=i;t.CTimeManEventPopup.superclass.constructor.apply(this,[this.params.node,this.params.bind,"event_"+this.params.id,this.params]);t.addCustomEvent(this.parent,"onTaskWndShow",t.delegate(this.onEventWndShow,this));t.addCustomEvent(this.parent,"onEventWndShow",t.delegate(this.onEventWndShow,this));this.bSkipShow=false;this.isReady=false};t.extend(t.CTimeManEventPopup,t.CTimeManPopup);t.CTimeManEventPopup.prototype.onEventWndShow=function(t){if(t!=this){if(this.popup)this.popup.close();else this.bSkipShow=true}};t.CTimeManEventPopup.prototype.Show=function(e){e=e||this.data;if(e&&e.error)return;if(!e){t.timeman.showWait();return t.timeman_query("calendar_show",{id:this.params.id},t.proxy(this.Show,this))}else if(t.type.isArray(e)&&e.length==0){if(this.popup)this.popup.close();if(this.parent.PARENT)this.parent.PARENT.Update();return false}this.data=e;if(this.bSkipShow)this.bSkipShow=true;else t.CTimeManEventPopup.superclass.Show.apply(this);return true};t.CTimeManEventPopup.prototype.GetContent=function(){var e='<div class="tm-event-popup">';e+='<div class="tm-popup-title"><a class="tm-popup-title-link" href="'+this.data.URL+'">'+t.util.htmlspecialchars(this.data.NAME)+"</a></div>";if(this.data.DESCRIPTION){e+=E(true);e+='<div class="tm-event-popup-description">'+this.data.DESCRIPTION+"</div>"}e+=E(true);e+='<div class="tm-event-popup-time"><div class="tm-event-popup-time-interval">'+this.data.DATE_F+"</div>";if(this.data.DATE_F_TO)e+='<div class="tm-event-popup-time-hint">('+this.data.DATE_F_TO+")</div></div>";if(this.data.GUESTS){e+=E(true);e+='<div class="tm-event-popup-participants">';if(this.data.HOST){e+='<div class="tm-event-popup-participant"><div class="tm-event-popup-participant-status tm-event-popup-participant-status-accept"></div><div class="tm-event-popup-participant-name"><a class="tm-event-popup-participant-link" href="'+this.data.HOST.url+'">'+t.util.htmlspecialchars(this.data.HOST.name)+'</a><span class="tm-event-popup-participant-hint">'+t.message("JS_CORE_HOST")+"</span></div></div>"}if(this.data.GUESTS.length>0){e+='<table cellspacing="0" class="tm-event-popup-participants-grid"><tbody><tr>';var i=Math.ceil(this.data.GUESTS.length/2),s=["",""];for(var a=0;a<this.data.GUESTS.length;a++){var o="";if(this.data.GUESTS[a].status=="Y")o="tm-event-popup-participant-status-accept";else if(this.data.GUESTS[a].status=="N")o="tm-event-popup-participant-status-decline";s[a<i?0:1]+='<div class="tm-event-popup-participant"><div class="tm-event-popup-participant-status '+o+'"></div><div class="tm-event-popup-participant-name"><a class="tm-event-popup-participant-link" href="'+this.data.GUESTS[a].url+'">'+t.util.htmlspecialchars(this.data.GUESTS[a].name)+"</a></div></div>"}e+='<td class="tm-event-popup-participants-grid-left">'+s[0]+'</td><td class="tm-event-popup-participants-grid-right">'+s[1]+"</td>";e+="</tr></tbody></table>"}e+="</div>"}e+="</div>";return e};t.CTimeManEventPopup.prototype.Query=function(e){t.ajax({method:"GET",url:this.data.URL+"&"+e,processData:false,onsuccess:t.proxy(this._Query,this)})};t.CTimeManEventPopup.prototype._Query=function(){this.data=null;this.Show()};t.CTimeManEventPopup.prototype.GetButtons=function(){var e=[],i=t.proxy(this.Query,this);if(this.data.STATUS==="Q"){e.push(new t.PopupWindowButton({text:t.message("JS_CORE_TM_CONFIRM"),className:"popup-window-button-create",events:{click:function(){i("CONFIRM=Y")}}}));e.push(new t.PopupWindowButton({text:t.message("JS_CORE_TM_REJECT"),className:"popup-window-button-cancel",events:{click:function(){i("CONFIRM=N")}}}))}else{e.push(new t.PopupWindowButtonLink({text:t.message("JS_CORE_TM_B_CLOSE"),className:"popup-window-button-link-cancel",events:{click:function(e){this.popupWindow.close();return t.PreventDefault(e)}}}))}return e};t.CTimeManCalendarSelector=function(e,i){this.parent=e;this.params=i;this.WND=t.PopupWindowManager.create("timeman_calendar_selector",this.params.node,{autoHide:true,content:this.content=t.create("DIV")});this.current_calendar=null;this.current_row=null;this.bRemember=false};t.CTimeManCalendarSelector.prototype.Show=function(){this.content.appendChild(t.create("B",{text:this.params.data.TEXT}));var e=this.content.appendChild(t.create("DIV",{props:{className:"bx-tm-calendars-list"}}));for(var i=0,s=this.params.data.CALENDARS.length;i<s;i++){var a=this.params.data.CALENDARS[i];e.appendChild(t.create("DIV",{props:{bx_calendar_id:a.ID},style:{backgroundColor:a.COLOR,cursor:"pointer"},events:{click:t.proxy(this.Click,this)},html:a.NAME}))}var o="tm_calendar_remember_"+Math.random();this.content.appendChild(t.create("DIV",{children:[t.create("INPUT",{props:{type:"checkbox",id:o},events:{click:t.delegate((function(){this.bRemember=t.proxy_context.checked}),this)}}),t.create("LABEL",{props:{htmlFor:o},text:t.message("JS_CORE_TM_REM")})]}));this.WND.setButtons([new t.PopupWindowButton({text:t.message("JS_CORE_TM_B_ADD"),className:"popup-window-button-create",events:{click:t.proxy(this.setValue,this)}}),new t.PopupWindowButtonLink({text:t.message("JS_CORE_TM_B_CLOSE"),className:"popup-window-button-link-cancel",events:{click:t.proxy(this.closeWnd,this)}})]);this.WND.show()};t.CTimeManCalendarSelector.prototype.Click=function(e){if(this.current_row)t.removeClass(this.current_row,"bx-tm-calendar-current");this.current_row=t.proxy_context;this.current_calendar=this.current_row.bx_calendar_id;t.addClass(this.current_row,"bx-tm-calendar-current");return t.PreventDefault(e)};t.CTimeManCalendarSelector.prototype.closeWnd=function(e){this.WND.close();this.WND.destroy();this.parent.Update();return t.PreventDefault(e)};t.CTimeManCalendarSelector.prototype.setValue=function(e){if(this.current_calendar){p.cal=this.current_calendar;if(this.bRemember)p.cal_set_default="Y";this.parent.calendarEntryAdd(p);return this.closeWnd(e)}return t.PreventDefault(e)};t.CTimeManReport=function(e){this.parent=e;this.REPORT_CONTAINER=null;this.REPORT_BTN=null;this.REPORT=null;this.REPORT_TEXT="";this.REPORT_SAVE_TIME=0;this.REPORT_CLIENT_SAVE_TIME=0;this.bChanged=false;this.bCanSave=false;this.ENTRY_ID=this.parent.PARENT.DATA.ID;t.addCustomEvent(this.parent.PARENT,"onTimeManDataRecieved",t.delegate((function(t){if(t.FULL!==false){this.ENTRY_ID=t.ID;if(typeof this.parent.DATA.REPORT!="undefined"){this.REPORT_TEXT=this.REPORT.value=this.parent.DATA.REPORT;if(this.parent.DATA.REPORT_TS>0)this.REPORT_SAVE_TIME=new Date(this.parent.DATA.REPORT_TS*1e3)}this.REPORT.disabled=t.STATE=="CLOSED"&&t.REPORT_REQ!="A"}}),this));this.save_timer=null};t.CTimeManReport.prototype.Create=function(){if(this.REPORT_CONTAINER){if(this.REPORT_CONTAINER.parentNode)this.REPORT_CONTAINER.parentNode.removeChild(this.REPORT_CONTAINER);this.Reset();return this.REPORT_CONTAINER}this.REPORT=t.create("TEXTAREA",{props:{className:"tm-popup-report-textarea",placeholder:t.message("JS_CORE_TM_REPORT_PH"),value:this.REPORT_TEXT||"",disabled:this.parent.DATA.STATE=="CLOSED"&&this.parent.DATA.REPORT_REQ!="A"},events:{blur:t.delegate(this._reportBlur,this),keyup:t.delegate(this._reportKeyPress,this),paste:t.delegate(this._reportKeyPress,this)}});t.focusEvents(this.REPORT);this.REPORT_CONTAINER=t.create("DIV",{props:{className:"tm-popup-report"},children:[t.create("DIV",{props:{className:"tm-popup-report-text"},children:[this.REPORT]}),t.create("DIV",{props:{className:"tm-popup-report-buttons"},children:[this.REPORT_BTN=t.create("SPAN",{props:{className:"ui-btn ui-btn-success ui-btn-disabled"},events:{click:t.proxy(this._btnClick,this)},html:t.message("JS_CORE_TM_B_SAVE")})]})]});t.addCustomEvent(window,"onTimeManReportChange",t.delegate((function(t,e){this.SaveFinished({REPORT:t,REPORT_TS:e})}),this));t.addCustomEvent(window,"onTimeManReportChangeText",t.delegate((function(t){this.REPORT.value=t}),this));return this.REPORT_CONTAINER};t.CTimeManReport.prototype.setEditMode=function(e){this.bCanSave=!!e;if(this.bCanSave){t.addClass(this.REPORT_CONTAINER,"tm-popup-report-editmode");t.removeClass(this.REPORT_BTN,"ui-btn-disabled");t.adjust(this.REPORT_BTN,{props:{disabled:false}})}else{t.removeClass(this.REPORT_CONTAINER,"tm-popup-report-editmode");t.addClass(this.REPORT_BTN,"ui-btn-disabled");t.adjust(this.REPORT_BTN,{props:{disabled:true}})}};t.CTimeManReport.prototype._reportKeyPress=function(t){this.bChanged=true;this.setEditMode(true)};t.CTimeManReport.prototype._reportBlur=function(e){t.onGlobalCustomEvent("onTimeManReportChangeText",[this.REPORT.value],true);if(this.bChanged)this.Save()};t.CTimeManReport.prototype._btnClick=function(t){if(this.bCanSave)this.Save()};t.CTimeManReport.prototype.Save=function(){if(this.bChanged&&!!this.saveXhr){if(this.save_timer)clearTimeout(this.save_timer);this.save_timer=setTimeout(t.proxy(this.Save,this),1e3);return}this.setEditMode(false);this.REPORT_BTN.innerHTML=t.message("JS_CORE_TM_B_SAVING");this.REPORT_TEXT=this.REPORT.value;t.timeman.showWait();this.saveXhr=t.timeman_query("report",{entry_id:this.ENTRY_ID,report:this.REPORT_TEXT,report_ts:this.REPORT_SAVE_TIME?parseInt(this.REPORT_SAVE_TIME.valueOf()/1e3):0},t.proxy(this.SaveFinished,this),this.bChanged);if(!this.save_timer)this.bChanged=false};t.CTimeManReport.prototype.SaveFinished=function(e){if(!e){this.saveXhr=null;return}if(!this.REPORT_SAVE_TIME){this.REPORT_TEXT=this.REPORT.value=this.parent.DATA.REPORT=e.REPORT||"";this.setEditMode(false)}else{this.REPORT_TEXT=this.parent.DATA.REPORT=e.REPORT;if(!this.bChanged){this.REPORT.value=this.REPORT_TEXT||"";this.setEditMode(false)}else{this.setEditMode(true)}}this.parent.DATA.REPORT_TS=e.REPORT_TS;this.REPORT_SAVE_TIME=new Date(e.REPORT_TS*1e3);this.REPORT_CLIENT_SAVE_TIME=new Date;this.REPORT_BTN.innerHTML=t.message("JS_CORE_TM_B_SAVE");if(this.saveXhr)t.onGlobalCustomEvent("onTimeManReportChange",[this.REPORT_TEXT,parseInt(this.REPORT_SAVE_TIME.valueOf()/1e3)],true);this.saveXhr=null};t.CTimeManReport.prototype.ForceReload=function(){if(!this.bChanged){this.Reset();setTimeout(t.proxy(this.Save,this),10)}};t.CTimeManReport.prototype.Reset=function(){this.REPORT_TEXT=this.REPORT.value=this.parent.DATA.REPORT;if(this.parent.DATA.REPORT_TS>0)this.REPORT_SAVE_TIME=new Date(this.parent.DATA.REPORT_TS*1e3)};t.CTimeManTabControl=function(e){this.DIV=e;this.DIV.className="tm-tabs-box";this.HEAD=this.DIV.appendChild(t.create("DIV",{props:{className:"tm-tabs"}}));this.DIV.appendChild(E(false,"tm-tabs-hr"));this.TABS=this.DIV.appendChild(t.create("DIV",{props:{className:"tm-tabs-content"}}));this.arTabs=null;this.selectedTab=t.localStorage.get("tm_tab")};t.CTimeManTabControl.prototype.addTab=function(t){if(!this.arTabs){t.first=true;this.arTabs={};if(!this.selectedTab){this.selectedTab=t.id}}else{t.first=false}this.arTabs[t.id]={title:t.title,content:t.content,first:t.first};this.createTab(t.id)};t.CTimeManTabControl.prototype.createTab=function(e){this.arTabs[e].tab=this.HEAD.appendChild(t.create("SPAN",{props:{BXTABID:e,className:"tm-tab"+(e==this.selectedTab?" tm-tab-selected":"")},events:{click:t.delegate((function(){this.selectTab(e)}),this)},html:this.arTabs[e].title}));this.arTabs[e].tab_content=this.TABS.appendChild(t.create("DIV",{props:{className:"tm-tab-content"+(e==this.selectedTab?" tm-tab-content-selected":"")},children:t.type.isArray(this.arTabs[e].content)?this.arTabs[e].content:t.type.isDomNode(this.arTabs[e].content)?[this.arTabs[e].content]:null}));if(t.type.isNotEmptyString(this.arTabs[e].content)){this.arTabs[e].tab_content.innerHTML=this.arTabs[e].content}};t.CTimeManTabControl.prototype.selectTab=function(e){t.removeClass(this.arTabs[this.selectedTab].tab,"tm-tab-selected");t.removeClass(this.arTabs[this.selectedTab].tab_content,"tm-tab-content-selected");this.selectedTab=e;t.addClass(this.arTabs[this.selectedTab].tab,"tm-tab-selected");t.addClass(this.arTabs[this.selectedTab].tab_content,"tm-tab-content-selected");if(!!t.PopupMenu.currentItem){t.PopupMenu.currentItem.popupWindow.close()}this.saveTab()};t.CTimeManTabControl.prototype.saveTab=function(){t.localStorage.set("tm_tab",this.selectedTab,86400*30)};t.CTimeManTabEditorControl=function(e){this.div=e.div||t.create("DIV");this.tabs={};this.mode="view";this.isLHEinit=false;if(e.uselocalstorage&&e.localstorage_key){this.uselocalstorage=true;this.localstorage_key=e.localstorage_key;t.addCustomEvent(window,"onLocalStorageSet",t.proxy((function(t){if(t.key==this.localstorage_key&&t.value){for(i in this.tabs){if(t.value[i])this.SetTabContent(i,t.value[i])}}}),this))}else this.uselocalstorage=false;this.first_tab=false;this.parent=e.parent||false;this.current_tab_id=false;this.lhename=e.lhename||"obTimemanEditor";this.TABCONTROL=new t.CTimeManTabControl(this.div);this.TABCONTROL.saveTab=t.DoNothing;this.TABCONTROL.selectedTab=null;this.TABCONTROL._selectTab=this.TABCONTROL.selectTab;this.TABCONTROL.selectTab=t.proxy((function(t){if(!this.isLHEinit&&this.mode=="edit")return false;this.TABCONTROL._selectTab(t)}),this)};t.CTimeManTabEditorControl.prototype.addTab=function(e){var i={};i.PARAMS=e;i.ID=i.PARAMS.ID;i.TITLE=i.PARAMS.TITLE;i.CONTENT=i.PARAMS.CONTENT;if(this.first_tab==false){this.current_tab_id=i.ID;this.first_tab=true}this.TABCONTROL.addTab({id:i.PARAMS.ID,title:i.PARAMS.TITLE,content:[i.LHEDIV=t.create("DIV",{attrs:{id:i.ID+"_editor"},style:{border:"1px solid #D9D9D9",height:"200px",display:"none"}}),i.VIEWDIV=t.create("DIV",{style:{border:"none",maxHeight:"200px",padding:"5px",overflow:"auto"},html:i.PARAMS.CONTENT})]});i.CONTROL=this.TABCONTROL.arTabs[i.ID];this.tabs[i.ID]=i;t.bind(this.TABCONTROL.arTabs[i.ID].tab,"click",t.proxy((function(){var e=this.current_tab_id;this.current_tab_id=i.ID;if(this.mode=="view")return;else if(!this.isLHEinit&&this.mode=="edit"||e==this.current_tab_id){this.current_tab_id=e;return}this.tabs[e].CONTENT=this.editor.GetEditorContent();var s=t("bxlhe_frame_"+this.editor.id);this.tabs[i.ID].LHEDIV.appendChild(s);if(t.browser.IsIE()){var a=this;s.style.visibility="hidden";setTimeout((function(){a.editor.ReInit(a.tabs[i.ID].CONTENT);s.style.visibility="visible";t.bind(a.editor.pEditorDocument,"keyup",t.proxy(a.SaveToLocalStorage,a))}),100)}else{this.editor.ReInit(this.tabs[i.ID].CONTENT);t.bind(this.editor.pEditorDocument,"keyup",t.proxy(this.SaveToLocalStorage,this))}}),this))};t.CTimeManTabEditorControl.prototype.InitLHE=function(){if(this.tabs==0)return;var e=Math.round(Math.random()*1e5);var i=this.tabs[this.current_tab_id];t.ajax.get("/bitrix/tools/timeman.php?action=editor&obname="+this.lhename+"_"+e+"&sessid="+t.bitrix_sessid(),(function(t){i.LHEDIV.innerHTML=t}));t.addCustomEvent(window,"LHE_OnInit",t.proxy((function(i){if(i.id==this.lhename+"_"+e){if(!t.CDialog){arScripts=["/bitrix/js/main/core/core_window.js"];arCss=["/bitrix/js/main/core/css/core_window.css"];t.loadCSS(arCss);t.loadScript(arScripts)}var s=this.tabs[this.current_tab_id].CONTENT||"";if(/^<i[^>]+data-placeholder/.test(s)){s=""}this.editor=i;this.editor.SetContent(s);this.editor.SetEditorContent(s);t.bind(this.editor.pEditorDocument,"keyup",t.proxy(this.SaveToLocalStorage,this));this.isLHEinit=true;this.TABCONTROL.selectTab(this.current_tab_id)}}),this))};t.CTimeManTabEditorControl.prototype.SwitchEdit=function(){if(this.tabs.length==0||this.mode=="edit")return;for(i in this.tabs){this.tabs[i].VIEWDIV.style.display="none";this.tabs[i].LHEDIV.style.display="block";this.tabs[i].LHEDIV.innerHTML=""}this.mode="edit";this.InitLHE()};t.CTimeManTabEditorControl.prototype.SwitchView=function(){if(this.tabs==0||this.mode=="view")return;for(i in this.tabs){if(i==this.current_tab_id){this.tabs[i].VIEWDIV.innerHTML=this.editor.GetEditorContent();this.tabs[i].CONTENT=this.editor.GetEditorContent()}else this.tabs[i].VIEWDIV.innerHTML=this.tabs[i].CONTENT;this.tabs[i].VIEWDIV.style.display="block";this.tabs[i].LHEDIV.style.display="none"}this.mode="view"};t.CTimeManTabEditorControl.prototype.GetTabContent=function(t){var t=t||false;var e="";if(this.tabs==0||t==false||!this.tabs[t])return;if(this.current_tab_id==t&&this.mode=="edit")e=this.editor.GetEditorContent();else e=this.tabs[t].CONTENT;return e};t.CTimeManTabEditorControl.prototype.SetTabContent=function(e,s){var e=e||false;var a="";if(this.tabs==0||e==false||!this.tabs[e])return false;if(this.current_tab_id==e&&this.mode=="edit")this.editor.SetEditorContent(s);else this.tabs[i].CONTENT=s;t.bind(this.editor.pEditorDocument,"keyup",t.proxy(this.SaveToLocalStorage,this));return true};t.CTimeManTabEditorControl.prototype.SaveToLocalStorage=function(){if(this.timerID)clearTimeout(this.timerID);if(this.uselocalstorage!=true)return;var e={};for(i in this.tabs)e[i]=this.GetTabContent(i);this.timerID=setTimeout(t.proxy((function(){t.localStorage.set(this.localstorage_key,e)}),this),1e3)};t.CTimeManUploadForm=function(e){this.id="TimemanUpload"+(!e.id?"0":e.id);this.report_id=e.id||0;this.user_id=e.user_id;this.files=e.files_list||[];window[this.id]=this;this.DIV=e.div?e.div:t.create("DIV",{props:{className:"ui-form-row"}});this.mode=e.mode||"view"};t.CTimeManUploadForm.prototype.UploadFile=function(){var e=[];if(this.fileinput.files!=undefined){if(this.fileinput.files.length>0){for(var i=0;i<this.fileinput.files.length;i++){var s=this.fileinput.files[i].name||this.fileinput.files[i].fileName;if(!!s){e.push({fileName:s})}}}}else{var a=this.fileinput.value;var o=a.replace(/.*\\(.*)/,"$1");o=o.replace(/.*\/(.*)/,"$1");e=[{fileName:o}]}var r;do{r=Math.floor(Math.random()*99999)}while(t("iframe_"+r));var p=t("webform-upload-"+this.report_id);var n=[];for(var i=0;i<e.length;i++){var l=t.create("li",{props:{className:"uploading",id:"file-"+e[i].fileName+"-"+r},children:[t.create("a",{props:{href:"",target:"_blank",className:"upload-file-name"},text:e[i].fileName,events:{click:function(e){t.PreventDefault(e)}}}),t.create("i",{}),t.create("a",{props:{href:"",className:"delete-file"},events:{click:function(e){t.PreventDefault(e)}}})]});p.appendChild(l);n.push(l)}var h="iframe-"+r;var m=t.create("iframe",{props:{name:h,id:h},style:{display:"none"}});document.body.appendChild(m);var d=this.fileinput.parentNode;var T=t.create("form",{props:{method:"post",action:"/bitrix/tools/timeman.php",enctype:"multipart/form-data",encoding:"multipart/form-data",target:h},style:{display:"none"},children:[this.fileinput,t.create("input",{props:{type:"hidden",name:"sessid",value:t.bitrix_sessid()}}),t.create("input",{props:{type:"hidden",name:"uniqueID",value:r}}),t.create("input",{props:{type:"hidden",name:"mode",value:"upload"}}),t.create("input",{props:{type:"hidden",name:"action",value:"upload_attachment"}}),t.create("input",{props:{type:"hidden",name:"report_id",value:this.report_id}}),t.create("input",{props:{type:"hidden",name:"user_id",value:this.user_id}}),t.create("input",{props:{type:"hidden",name:"form_id",value:this.id}})]});document.body.appendChild(T);T.appendChild(this.fileinput);t.submit(T,null,null,t.delegate((function(){d.appendChild(this.fileinput);t.cleanNode(T,true)}),this))};t.CTimeManUploadForm.prototype.DeleteFile=function(e){_this=t.proxy_context;if(confirm(t.message("JS_CORE_TM_CONFIRM_TO_DELETE"))){if(!t.hasClass(_this.parentNode,"saved")){var s={fileID:_this.nextSibling.value,sessid:t.bitrix_sessid(),mode:"delete",action:"upload_attachment",report_id:this.report_id,user_id:this.user_id};var a="/bitrix/tools/timeman.php";t.ajax.post(a,s)}t.remove(_this.parentNode);for(i=0;i<this.files.length;i++){if(_this.nextSibling.value==this.files[i].fileID){this.files.splice(i,1);break}}}t.onCustomEvent(this,"OnUploadFormRefresh",[]);t.PreventDefault(e)};t.CTimeManUploadForm.prototype.GetUploadForm=function(){var e=t.create("OL",{props:{className:"report-webform-field-upload-list"},attrs:{id:"webform-upload-"+this.report_id}});if(this.files&&this.files.length>0){var s=this.files;for(i=0;i<s.length;i++){e.appendChild(t.create("li",{props:{id:"file-"+s[i].name+"-"+s[i].uniqueID},children:[t.create("a",{props:{href:"/bitrix/tools/timeman.php?action=get_attachment&fid="+s[i].fileID+"&report_id="+this.report_id+"&user_id="+this.user_id+"&sessid="+t.bitrix_sessid(),target:"_blank",className:"upload-file-name"},text:s[i].name}),this.mode=="edit"?t.create("a",{props:{className:"delete-file"},events:{click:t.proxy(this.DeleteFile,this)}}):null,t.create("INPUT",{attrs:{type:"hidden",name:"FILES[]",value:s[i].fileID}})]}))}}this.uploadform=t.create("DIV",{props:{className:"task-attachments-row"},children:[t.create("DIV",{props:{className:"ui-form-content"},children:[t.create("DIV",{props:{className:"tm-popup-section-title"},children:[t.create("DIV",{props:{className:"tm-popup-section-title-text"},html:t.message("JS_CORE_TM_FILES")}),t.create("DIV",{props:{className:"tm-popup-section-title-line"}})]}),e,this.mode=="edit"?t.create("DIV",{props:{className:"report-webform-field-upload"},children:[t.create("SPAN",{props:{className:"tm-webform-small-button report-webform-button-upload"},children:[t.message("JS_CORE_TM_UPLOAD_FILES")]}),this.fileinput=t.create("INPUT",{attrs:{type:"file",name:"report-attachments[]",size:"1",multiple:"multiple",id:"report-upload"}})]}):null]})]});if(this.mode=="edit")this.fileinput.onchange=t.proxy(this.UploadFile,this);this.DIV.appendChild(this.uploadform);return this.DIV};t.CTimeManUploadForm.prototype.RefreshUpload=function(e,s){for(i=0;i<e.length;i++){var a=t("file-"+e[i].name+"-"+s);if(e[i].fileID){t.removeClass(a,"uploading");t.adjust(a.firstChild,{props:{href:"/bitrix/tools/timeman.php?action=get_attachment&fid="+e[i].fileID+"&report_id="+this.report_id+"&user_id="+this.user_id+"&sessid="+t.bitrix_sessid()}});t.unbindAll(a.firstChild);t.unbindAll(a.lastChild);t.bind(a.lastChild,"click",t.proxy(this.DeleteFile,this));a.appendChild(t.create("input",{props:{type:"hidden",name:"FILES[]",value:e[i].fileID}}));e[i].uniqueID=s;this.files.push(e[i])}else{t.cleanNode(a,true)}}if(t("iframe-"+s))t.cleanNode(t("iframe-"+s),true);t.onCustomEvent(this,"OnUploadFormRefresh",[])};t.CTimeManReportFormWeekly=function(e,i){this.parent=e;this.params=i;this.files=new Array;this.post=false;this.node=this.params.node;this.mode=this.params.mode||"edit";this.data=i.data;this.popup_id="timeman_weekly_report_popup_"+parseInt(Math.random()*1e5);this.bLoaded=!!this.data;this.bTimeEdited=false;this.params.offsetTop=5;this.params.offsetLeft=-50;this.ACTIVE="Y";this.ie7=false; /*@cc_on @if (@_jscript_version <= 5.7) this.ie7 = true; /*@end @*/this.table=t.create("TABLE",{props:{className:"report-popup-main-table"},children:[t.create("TBODY",{children:[t.create("TR",{children:[this.prev=t.create("TD",{props:{className:"report-popup-prev-slide-wrap"}}),this.popup_place=t.create("TD",{attrs:{valign:"top"},style:{paddingTop:"20px"},props:{className:"report-popup-main-block-wrap"}}),this.next=t.create("TD",{props:{className:"report-popup-next-slide-wrap"},children:[this.closeLink=t.create("A",{attrs:{href:"javascript: void(0)"},events:{click:t.proxy(this.PopupClose,this)},props:{className:"report-popup-close"},children:[t.create("SPAN",{props:{className:"report-popup-close"}})]})]})]})]})]});this.overlay=t.create("DIV",{props:{className:"report-fixed-overlay"},children:[this.coreoverlay=t.create("DIV",{props:{className:"bx-tm-dialog-overlay"}}),this.table]});document.body.appendChild(this.overlay);this.popup=new t.PopupWindow(this.popup_id,null,{closeIcon:{right:"12px",top:"10px"},autoHide:false,draggable:false,closeByEsc:true,titleBar:true,toFrontOnShow:false});t.ZIndexManager.register(this.overlay);t.addCustomEvent(this.popup,"onPopupClose",t.proxy((function(){this.overlay.style.display="none"}),this));t.addCustomEvent(this.popup,"onAfterPopupShow",t.proxy((function(){this.overlay.style.display="block";t.ZIndexManager.bringToFront(this.overlay);setTimeout(t.proxy(this.FixOverlay,this),10)}),this));this.popup_place.appendChild(t.create("DIV",{style:{display:"inline-block"},children:[this.popup.popupContainer]}));this.FixOverlay();t.bind(window.top,"resize",t.proxy(this.FixOverlay,this));this.ACTIONS={delay:t.proxy(this.ActionDelay,this),edit:t.proxy(this.ActionEdit,this),save:t.proxy(this.ActionSave,this),send:t.proxy(this.ActionSend,this)}};t.extend(t.CTimeManReportFormWeekly,t.CTimeManPopup);t.CTimeManReportFormWeekly.prototype.FixOverlay=function(){this.popup.popupContainer.style.position="relative";this.popup.popupContainer.style.left="0px";var e=t.GetWindowInnerSize();this.overlay.style.height=e.innerHeight+"px";this.overlay.style.width=e.innerWidth+"px";var i=t.GetWindowScrollPos();this.overlay.firstChild.style.height=Math.max(this.popup.popupContainer.offsetHeight+50,this.overlay.clientHeight)+"px";this.overlay.firstChild.style.width=Math.max(1024,this.overlay.clientWidth)+"px";this.popup.popupContainer.style.top="0px";this.closeLink.style.width=this.closeLink.parentNode.clientWidth+"px"};t.CTimeManReportFormWeekly.prototype.PopupClose=function(){this.popup.close()};t.CTimeManReportFormWeekly.prototype.Show=function(e){if(!e&&!this.data){t.timeman.showWait();if(this.mode=="edit")t.timeman_query("check_report",{},t.proxy(this.Show,this));return}if(window.BXTIMEMANREPORTFORMWEEKLY&&window.BXTIMEMANREPORTFORMWEEKLY!=this)window.BXTIMEMANREPORTFORMWEEKLY.popup.close();window.BXTIMEMANREPORTFORMWEEKLY=this;t.timeman.closeWait();if(!this.data)this.data=e.REPORT_DATA;if(!this.data.INFO)return;t.addCustomEvent(window,"onLocalStorageSet",t.proxy((function(e){var i=this.data.REPORT_DATE_FROM+"#"+this.data.REPORT_DATE_TO+"_ACTION";if(e.key==i&&e.value.LAST_ACTION=="SEND_REPORT"){this.parent.ShowCallReport=false;t.onCustomEvent(this,"OnWorkReportSend",[]);this.popup.close()}}),this));this.popup.setContent(this.GetContent());this.popup.setButtons(this.GetButtons());this.popup.setTitleBar({content:this.GetTitle()});try{t.addCustomEvent(taskIFramePopup,"onBeforeShow",t.proxy((function(){this.popup.setClosingByEsc(false)}),this));t.addCustomEvent(taskIFramePopup,"onBeforeHide",t.proxy((function(){this.popup.setClosingByEsc(true)}),this))}catch(t){}this.popup.show();this.popup.setOffset({offsetTop:1});return true};t.CTimeManReportFormWeekly.prototype.GetContentPeopleRow=function(){return t.create("DIV",{props:{className:"tm-report-popup-people"},html:'<div class="tm-report-popup-r1"></div><div class="tm-report-popup-r0"></div><div class="tm-report-popup-people-inner">\t<div class="tm-report-popup-user tm-report-popup-employee">\t\t<span class="tm-report-popup-user-label">'+t.message("JS_CORE_TMR_FROM")+':</span><a href="'+this.data.FROM.URL+'" class="tm-report-popup-user-avatar"'+(this.data.FROM.PHOTO?" style=\"background: url('"+this.data.FROM.PHOTO+"') no-repeat scroll center center transparent; background-size: cover;\"":"")+'></a><span class="tm-report-popup-user-info"><a href="'+this.data.FROM.URL+'" class="tm-report-popup-user-name">'+this.data.FROM.NAME+'</a><span class="tm-report-popup-user-position">'+(this.data.FROM.WORK_POSITION||" ")+'</span></span>\t</div>\t<div class="tm-report-popup-user tm-report-popup-director">\t\t<span class="tm-report-popup-user-label">'+t.message("JS_CORE_TMR_TO")+':</span><a href="'+this.data.TO[0].URL+'" class="tm-report-popup-user-avatar"'+(this.data.TO[0].PHOTO?" style=\"background: url('"+this.data.TO[0].PHOTO+"') no-repeat scroll center center transparent; background-size: cover;\"":"")+'></a><span class="tm-report-popup-user-info"><a href="'+this.data.TO[0].URL+'" class="tm-report-popup-user-name">'+this.data.TO[0].NAME+'</a><span class="tm-report-popup-user-position">'+(this.data.TO[0].WORK_POSITION||" ")+'</span></span>\t</div></div><div class="tm-report-popup-r0"></div><div class="tm-report-popup-r1"></div>'})};t.CTimeManReportFormWeekly.prototype.GetContentReportRow=function(e){this.TABCONTROL=new t.CTimeManTabEditorControl({lhename:"obReportWeekly",parent:this,uselocalstorage:true,localstorage_key:this.data.INFO.REPORT_DATE_FROM+"#"+this.data.INFO.REPORT_DATE_TO});this.TABCONTROL.addTab({ID:"report_text",TITLE:t.message("JS_CORE_TMR_REPORT"),CONTENT:this.data.REPORT});this.TABCONTROL.addTab({ID:"plan_text",TITLE:t.message("JS_CORE_TMR_PLAN"),CONTENT:this.data.PLANS});this.TABCONTROL.SwitchEdit();return t.create("DIV",{props:{className:"tm-report-popup-desc"},children:[t.create("DIV",{props:{className:"tm-report-popup-desc-text"},children:[this.TABCONTROL.div]})]})};t.CTimeManReportFormWeekly.prototype._addTask=function(e){if(this.data.INFO.TASKS&&this.data.INFO.TASKS.length>0)for(i=0;i<this.data.INFO.TASKS.length;i++){if(this.data.INFO.TASKS[i].ID==e.id)return}t.timeman_query("get_task",{task_id:e.id},t.proxy(this.addTask,this))};t.CTimeManReportFormWeekly.prototype.addTask=function(e){var i,s;if(typeof e.TIME=="undefined")e.TIME=0;var a=0;this.listTasks.appendChild(t.create("LI",{props:{className:"tm-popup-task tm-popup-task-status-"+t.timeman.TASK_SUFFIXES[e.STATUS],bx_task_id:e.ID},children:[i=this.mode=="admin"?null:t.create("INPUT",{props:{className:"tm-report-popup-include-checkbox",value:e.ID,checked:typeof tasks_unchecked=="undefined"?a>0:false,defaultChecked:true},attrs:{type:"checkbox"}}),t.create("SPAN",{props:{className:"tm-popup-task-name",BXPOPUPBIND:this.tdTasks.firstChild,BXPOPUPPARENT:this.listTasks,BXPOPUPANGLEOFFSET:44},text:e.TITLE,events:{click:t.proxy(this.parent.WND.showTask,this)}}),s=this.mode=="admin"?null:t.create("INPUT",{props:{value:a},attrs:{type:"hidden"}}),t.create("SPAN",{props:{className:"tm-popup-task-time"+(this.mode=="admin"?"-admin":""),BXTIMEINPUT:this.mode=="admin"?null:s,BXCHECKINPUT:this.mode=="admin"?null:i},events:this.mode=="admin"?null:{click:t.timeman.editTime},text:t.timeman.formatWorkTime(a)})]}));if(i){this.listInputTasks.push(i);this.listInputTasksTime.push(s)}this.incLabel.style.display="block";this.data.INFO.TASKS[this.data.INFO.TASKS.length]=e};t.CTimeManReportFormWeekly.prototype.GetContentTasks=function(e,i,s){this.tdTasks=e;e.className="tm-report-popup-tasks";this.selectorLink=t.create("DIV",{props:{className:"tm-popup-section-title-link tm-popup-section-title-link-weekly"},html:t.message("JS_CORE_TM_TASKS_CHOOSE")});if(this.TASKSWND==null){this.TASKSWND=new t.CTimeManTasksSelector(this,{node:this.selectorLink,onselect:t.proxy(this._addTask,this)})}else this.TASKSWND.setNode(this.selectorLink);this.selectorLink.onclick=t.proxy(this.TASKSWND.Show,this.TASKSWND);e.appendChild(t.create("DIV",{props:{className:"tm-popup-section-title"},children:[t.create("DIV",{props:{className:"tm-popup-section-title-text"},html:t.message("JS_CORE_TM_TASKS")}),this.selectorLink,t.create("DIV",{props:{className:"tm-popup-section-title-line"}})]}));this.listTasks=null;e.appendChild(t.create("DIV",{props:{className:"tm-popup-tasks"},children:[this.mode=="admin"?null:this.incLabel=t.create("DIV",{props:{className:"tm-report-popup-inlude-tasks"},style:{display:"none"},html:'<span class="tm-report-popup-inlude-arrow"></span><span class="tm-report-popup-inlude-hint">'+t.message("JS_CORE_TMR_REPORT_INC")+"</span>"}),this.listTasks=t.create("OL",{props:{className:"tm-popup-task-list"}})]}));this.listInputTasks=[];this.listInputTasksTime=[];if(this.data.INFO.TASKS&&this.data.INFO.TASKS.length>0){this.incLabel.style.display="block";for(var a=0;a<this.data.INFO.TASKS.length;a++){var o,r;if(typeof this.data.INFO.TASKS[a].TIME=="undefined"){this.data.INFO.TASKS[a].TIME=0;if(typeof this.data.INFO.TASKS[a].TIME_SPENT_IN_LOGS!="undefined"){this.data.INFO.TASKS[a].TIME+=parseInt(this.data.INFO.TASKS[a].TIME_SPENT_IN_LOGS)||0}}var p=typeof s[a]=="undefined"?this.data.INFO.TASKS[a].TIME:s[a];this.listTasks.appendChild(t.create("LI",{props:{className:"tm-popup-task tm-popup-task-status-"+t.timeman.TASK_SUFFIXES[this.data.INFO.TASKS[a].STATUS],bx_task_id:this.data.INFO.TASKS[a].ID},children:[o=this.mode=="admin"?null:t.create("INPUT",{props:{className:"tm-report-popup-include-checkbox",value:this.data.INFO.TASKS[a].ID,checked:typeof i[a]=="undefined"?p>0:false,defaultChecked:true},attrs:{type:"checkbox"}}),t.create("SPAN",{props:{className:"tm-popup-task-name",BXPOPUPBIND:e.firstChild,BXPOPUPPARENT:this.listTasks,BXPOPUPANGLEOFFSET:44},text:this.data.INFO.TASKS[a].TITLE,events:{click:t.proxy(this.parent.WND.showTask,this)}}),r=this.mode=="admin"?null:t.create("INPUT",{props:{value:p},attrs:{type:"hidden"}}),t.create("SPAN",{props:{className:"tm-popup-task-time"+(this.mode=="admin"?"-admin":""),BXTIMEINPUT:this.mode=="admin"?null:r,BXCHECKINPUT:this.mode=="admin"?null:o},events:this.mode=="admin"?null:{click:t.timeman.editTime},text:t.timeman.formatWorkTime(p)})]}));if(o){this.listInputTasks.push(o);this.listInputTasksTime.push(r)}}}else this.data.INFO.TASKS=[]};t.CTimeManReportFormWeekly.prototype.GetContentEvents=function(e){if(this.data.INFO.EVENTS&&this.data.INFO.EVENTS.length>0){e.className="tm-report-popup-events"+(t.isAmPmMode()?" tm-popup-events-ampm":"");e.appendChild(t.create("DIV",{props:{className:"tm-popup-section-title"},html:'<div class="tm-popup-section-title-text">'+t.message("JS_CORE_TM_EVENTS")+'</div><div class="tm-popup-section-title-line"></div>'}));this.listEvents=null;e.appendChild(t.create("DIV",{props:{className:"tm-popup-events"},children:[this.listEvents=t.create("DIV",{props:{className:"tm-popup-event-list"}})]}));for(var i=0;i<this.data.INFO.EVENTS.length;i++){this.listEvents.appendChild(this.parent.WND.CreateEvent(this.data.INFO.EVENTS[i],{BXPOPUPBIND:e.firstChild,BXPOPUPANGLEOFFSET:44},true))}}};t.CTimeManReportFormWeekly.prototype.taskEntryAdd=function(e){this.parent.taskEntryAdd(e,t.delegate((function(t){this.parent._Update(t);this.data=null;this.Show()}),this))};t.CTimeManReportFormWeekly.prototype.calendarEntryAdd=function(e){this.parent.calendarEntryAdd(e,t.delegate((function(e){if(e&&e.error&&e.error_id=="CHOOSE_CALENDAR"){this.Update=t.proxy(this.parent.Update,this.parent);new t.CTimeManCalendarSelector(this,{node:this.eventsForm,data:e.error}).Show()}else{this.parent._Update(e);this.data=null;this.Show()}}),this))};t.CTimeManReportFormWeekly.prototype.GetContent=function(){var e="",s={},a={};if(this.DIV){e=this.data.REPORT?this.data.REPORT:"";if(this.listInputTasks){for(i=0,l=this.listInputTasks.length;i<l;i++){if(!this.listInputTasks[i].checked){s[i]=true}a[i]=this.listInputTasksTime[i].value}}t.cleanNode(this.DIV);this.DIV=null}this.DIV=t.create("DIV",{props:{className:"tm-report-popup ui-form"+(this.mode=="edit"?"":" tm-report-popup-read-mode")+(this.ie7?" tm-report-popup-ie7":"")},children:[this.GetContentPeopleRow(),this.GetContentReportRow(e)]});this.fileForm=new t.CTimeManUploadForm({id:this.data.REPORT_ID,user_id:this.data.FROM.ID,files_list:this.data.INFO.FILES,mode:"edit",div:this.DIV});this.fileForm.GetUploadForm();t.addCustomEvent(this.fileForm,"OnUploadFormRefresh",t.proxy((function(){this.FixOverlay()}),this));if(this.mode=="edit"||this.data.INFO.TASKS&&this.data.INFO.TASKS.length>0||this.data.INFO.EVENTS&&this.data.INFO.EVENTS.length>0){var o=this.DIV.appendChild(t.create("TABLE",{props:{className:"tm-report-popup-items"},attrs:{cellSpacing:"0"},children:[t.create("TBODY")]})).tBodies[0].insertRow(-1);if(this.data.INFO.TASKS_ENABLED&&(this.mode=="edit"||this.data.INFO.TASKS&&this.data.INFO.TASKS.length>0))this.GetContentTasks(o.insertCell(-1),s,a);if(this.data.INFO.CALENDAR_ENABLED&&this.data.INFO.EVENTS&&this.data.INFO.EVENTS.length>0)this.GetContentEvents(o.insertCell(-1))}return this.DIV};t.CTimeManReportFormWeekly.prototype.GetTitle=function(){var e=t.create("DIV",{props:{className:"tm-report-popup-titlebar"},children:[t.create("DIV",{props:{className:"tm-report-popup-title"},text:t.message("JS_CORE_TMR_REPORT_WEEKLY")}),t.create("SPAN",{props:{className:"tm-report-popup-title-date"},text:this.data.INFO.DATE_TEXT})]});if(false&&this.mode=="admin"){e.insertBefore(t.create("SPAN",{props:{className:"tm-report-popup-title-left"},events:{click:t.proxy(this.ClickPrevious,this)}}),e.lastChild);e.appendChild(t.create("SPAN",{props:{className:"tm-report-popup-title-right"},events:{click:t.proxy(this.ClickNext,this)}}))}return e};t.CTimeManReportFormWeekly.prototype.GetButtons=function(){var e=[];if(this.mode=="edit"){e.push(new t.PopupWindowButton({text:t.message("JS_CORE_TMR_SUBMIT_WEEKLY"),id:"tm-work-report-send",className:"popup-window-button-accept",events:{click:this.ACTIONS["send"]}}));e.push(new t.PopupWindowButton({text:t.message("JS_CORE_TM_B_SAVE"),id:"tm-work-report-save",className:"popup-window-button",events:{click:this.ACTIONS["save"]}}));e.push(new t.PopupWindowButton({text:t.message("JS_CORE_TMR_DELAY_WEEKLY"),id:"tm-work-report-delay",className:"popup-window-button",events:{click:this.ACTIONS["delay"]}}))}return e};t.CTimeManReportFormWeekly.prototype.ActionEdit=function(){t.timeman.showWait(this.popup.popupContainer,0);if(this.post==true){return}var e,i,s={REPORT_ID:this.data.REPORT_ID,DATE_FROM:this.data.INFO.REPORT_DATE_FROM,DATE_TO:this.data.INFO.REPORT_DATE_TO,TO_USER:this.data.TO[0].ID,FILES:this.fileForm.files,PLANS:this.TABCONTROL.GetTabContent("plan_text"),REPORT:this.TABCONTROL.GetTabContent("report_text"),TASKS:[],TASKS_TIME:[],EVENTS:[],ACTIVE:this.ACTIVE,DELAY:this.DELAY};if(this.data.INFO.EVENTS){for(e=0,i=this.data.INFO.EVENTS.length;e<i;e++){s.EVENTS.push(this.data.INFO.EVENTS[e])}}if(this.listInputTasks){for(e=0,i=this.listInputTasks.length;e<i;e++){if(this.listInputTasks[e].checked){s.TASKS.push(this.data.INFO.TASKS[e]);s.TASKS_TIME.push(this.listInputTasksTime[e].value)}}}if(s.EVENTS.length){s.EVENTS=JSON.stringify(s.EVENTS)}this.post=true;this.parent.Query("save_full_report",s,t.proxy(this._ActionEdit,this))};t.CTimeManReportFormWeekly.prototype.ActionSave=function(t){this.ACTIVE="N";this.DELAY="N";this.closeAfterPost=false;this.ActionEdit()};t.CTimeManReportFormWeekly.prototype.ActionSend=function(t){this.ACTIVE="Y";this.DELAY="Y";this.closeAfterPost=true;this.ActionEdit()};t.CTimeManReportFormWeekly.prototype.ActionDelay=function(t){this.ACTIVE="N";this.DELAY="Y";this.closeAfterPost=true;this.ActionEdit()};t.CTimeManReportFormWeekly.prototype._ActionEdit=function(e){this.post=false;if(this.ACTIVE=="Y"){t.localStorage.set(this.data.REPORT_DATE_FROM+"#"+this.data.REPORT_DATE_TO+"_ACTION",{LAST_ACTION:"SEND_REPORT"});t.localStorage.remove(this.data.REPORT_DATE_FROM+"#"+this.data.REPORT_DATE_TO+"_ACTION");this.parent.ShowCallReport=false;t.onCustomEvent(this,"OnWorkReportSend",[])}if(e)this.data.REPORT_ID=e;if(this.closeAfterPost==true)this.popup.close()};t.CTimeManReportFormWeekly.prototype.ActionAdmin=function(){var e={ID:this.data.INFO.INFO.ID};if(this.bTimeEdited){e.INFO={TIME_START:this.data.INFO.INFO.TIME_START,TIME_FINISH:this.data.INFO.INFO.TIME_FINISH}}this.parent.Query("admin_save",e,t.proxy(this._ActionAdmin,this))};t.CTimeManReportFormWeekly.prototype._ActionAdmin=function(e){this.data=e;var i=t.clone(this.data.INFO.INFO,true);i.ACTIVE=i.ACTIVE=="Y";i.PAUSED=i.PAUSED=="Y";i.ACTIVATED=i.ACTIVATED=="Y";i.CAN_EDIT=this.data.INFO.CAN_EDIT=="Y";this.params.parent_object.Reset(i)};t.CTimeManReportFormWeekly.prototype.TimeEdit=function(){if(this.POPUP_TIME){this.POPUP_TIME.Clear();this.POPUP_TIME=null}var e={ID:this.data.INFO.INFO.ID,CAN_EDIT:this.mode=="edit"||this.data.INFO.CAN_EDIT=="Y",INFO:{DATE_START:this.data.INFO.INFO.DATE_START,TIME_START:this.data.INFO.INFO.TIME_START,TIME_FINISH:this.data.INFO.INFO.TIME_FINISH||this.data.INFO.EXPIRED_DATE,TIME_LEAKS:this.data.INFO.INFO.TIME_LEAKS,DURATION:this.data.INFO.INFO.DURATION}};if(!e.INFO.TIME_FINISH){var i=new Date;e.INFO.TIME_FINISH=i.getHours()*3600+i.getMinutes()*60-(this.params.parent_object?this.params.parent_object.timezone_diff/1e3:0)}this.POPUP_TIME=new t.CTimeManEditPopup(this.parent,{node:this.TIME_EDIT_BUTTON||this.node,bind:this.TIME_EDIT_BUTTON||this.node,entry:e,mode:this.mode});this.POPUP_TIME.params.popup_buttons=[this.POPUP_TIME.SAVEBUTTON=new t.PopupWindowButton({text:t.message("JS_CORE_TM_B_SAVE"),className:"popup-window-button-create",events:{click:t.proxy(this.setEditValue,this)}}),new t.PopupWindowButtonLink({text:t.message("JS_CORE_TM_B_CLOSE"),className:"popup-window-button-link-cancel",events:{click:t.proxy(this.POPUP_TIME.closeWnd,this.POPUP_TIME)}})];this.POPUP_TIME.WND.setButtons(this.POPUP_TIME.params.popup_buttons);this.POPUP_TIME._SetSaveButton=this.POPUP_TIME.SetSaveButton;this.POPUP_TIME.SetSaveButton=t.DoNothing;this.POPUP_TIME.restoreButtons();this.POPUP_TIME.Show()};t.CTimeManReportFormWeekly.prototype.setEditValue=function(e){var i,s=this.mode=="edit"?t.util.trim(this.POPUP_TIME.REPORT.value):t.message("JS_CORE_TMR_ADMIN");if(s.length<=0){this.POPUP_TIME.REPORT.className="bx-tm-popup-clock-wnd-report-error";this.POPUP_TIME.REPORT.focus();this.POPUP_TIME.REPORT.onkeypress=function(){this.className="";this.onkeypress=null}}else{this.data.INFO.INFO.TIME_START=t.timeman.unFormatTime(this.POPUP_TIME.arInputs.timeman_edit_from.value);this.data.INFO.INFO.TIME_FINISH=t.timeman.unFormatTime(this.POPUP_TIME.arInputs.timeman_edit_to.value);this.data.INFO.INFO.DURATION=this.data.INFO.INFO.TIME_FINISH-this.data.INFO.INFO.TIME_FINISH-this.data.INFO.INFO.TIME_LEAKS;if(this.data.INFO.STATE=="EXPIRED")this.data.INFO.EXPIRED_DATE=this.data.INFO.INFO.TIME_FINISH;var a=new Date;if(!this.data.REPORTS.DURATION)this.data.REPORTS.DURATION=[];this.data.REPORTS.DURATION[0]={ACTIVE:true,REPORT:s,TIME:a.getHours()*3600+a.getMinutes()*60+a.getSeconds(),DATE_TIME:parseInt(a.valueOf()/1e3)};this.POPUP_TIME.WND.close();this.bTimeEdited=true;this.Show(this.data)}return t.PreventDefault(e)};t.CTimeManReportFormWeekly.prototype.ShowTpls=function(e){if(!this.TPLWND){var i=t.create("DIV",{props:{className:"bx-tm-report-tpl"}}),s;var a=this.REPORT_TEXT;var o=function(){a.value=this.BXTEXT;s.close()};for(var r=0;r<this.data.REPORT_TPL.length;r++){i.appendChild(t.create("SPAN",{props:{className:"bx-tm-report-tpl-item",BXTEXT:t.util.trim(this.data.REPORT_TPL[r])},events:{click:o},text:t.util.trim(this.data.REPORT_TPL[r])}))}s=this.TPLWND=t.PopupWindowManager.create("timeman_template_selector",t.proxy_context,{autoHide:true,content:i})}else{this.TPLWND.setBindElement(t.proxy_context)}this.TPLWND.show();return t.PreventDefault(e)};t.CTimeManReportFormWeekly.prototype.ClickPrevious=function(){alert("Previous!")};t.CTimeManReportFormWeekly.prototype.ClickNext=function(){alert("Next!")};t.CTimeManReportFormWeekly.prototype.Clear=function(){this.bCleared=true;if(this.POPUP_TIME){this.POPUP_TIME.WND.close();this.POPUP_TIME.WND.destroy();this.POPUP_TIME.Clear();this.POPUP_TIME=null}this.popup.close();this.popup.destroy()};t.CTimeManReportForm=function(e,i){this.parent=e;this.params=i;this.node=this.params.node;this.mode=this.params.mode||"edit";this.data=i.data;this.external_finish_ts=i.external_finish_ts;this.external_finish_ts_report=i.external_finish_ts_report;this.popup_id="timeman_daily_report_popup_"+parseInt(Math.random()*1e5);this.bLoaded=!!this.data;this.bTimeEdited=false;this.params.offsetTop=5;this.params.offsetLeft=-50;this.ie7=false; /*@cc_on @if (@_jscript_version <= 5.7) this.ie7 = true; /*@end @*/this.popup=new t.PopupWindow(this.popup_id,this.params.bind,{closeIcon:{right:"12px",top:"10px"},offsetLeft:this.params.offsetLeft||500,draggable:false,autoHide:false,closeByEsc:true,titleBar:true,bindOptions:{forceBindPosition:true,forceTop:false}});this.ACTIONS={edit:t.proxy(this.ActionEdit,this),admin:t.proxy(this.ActionAdmin,this)}};t.extend(t.CTimeManReportForm,t.CTimeManPopup);t.CTimeManReportForm.prototype.Show=function(e){if(!e&&!this.data){t.timeman.showWait();if(this.mode=="edit")t.timeman_query("close",{},t.proxy(this.Show,this));return}if(window.BXTIMEMANREPORTFORM&&window.BXTIMEMANREPORTFORM!=this)window.BXTIMEMANREPORTFORM.popup.close();window.BXTIMEMANREPORTFORM=this;t.timeman.closeWait();this.data=e||this.data;if(this.external_finish_ts){this.data.INFO.INFO.TIME_FINISH=this.external_finish_ts}if(this.mode=="edit"&&this.data.INFO.STATE==="EXPIRED"&&!this.bTimeEdited){this.TimeEdit();return}else{t.CTimeManReportForm.superclass.Show.apply(this);this.popup.setOffset({offsetTop:1});return true}};t.CTimeManReportForm.prototype.GetContentTimeRow=function(){var e=new Date,i=parseInt(this.data.INFO.INFO.TIME_OFFSET),s=parseInt(t.message("USER_TZ_OFFSET")),a=this.data.INFO.INFO.TIME_FINISH?this.data.INFO.INFO.TIME_FINISH:this.data.INFO.STATE=="EXPIRED"?this.data.INFO.EXPIRED_DATE:e.getHours()*3600+e.getMinutes()*60+e.getSeconds()-s+i,o=a-this.data.INFO.INFO.TIME_START-this.data.INFO.INFO.TIME_LEAKS;var r=t.create("DIV",{props:{className:"tm-report-popup-time-brief"}});r.appendChild(t.create("SPAN",{props:{className:"tm-report-popup-time-title"},text:t.message("JS_CORE_TMR_WORKTIME")}));var p=this.data.REPORTS&&(this.data.REPORTS.DURATION&&this.data.REPORTS.DURATION.length>0||this.data.REPORTS.TIME_START&&this.data.REPORTS.TIME_START.length>0||this.data.REPORTS.TIME_FINISH&&this.data.REPORTS.TIME_FINISH.length>0);if(!p){var n=[t.create("SPAN",{props:{className:"tm-report-popup-time-label"},html:t.message("JS_CORE_TM_ARR")+":"}),t.create("SPAN",{props:{className:"tm-report-popup-time-value"},html:t.timeman.formatTime(this.data.INFO.INFO.TIME_START,false)}),t.create("SPAN",{props:{className:"tm-report-popup-time-separator"}})];if(this.data.INFO.INFO.TIME_LEAKS>0){n=t.util.array_merge(n,[t.create("SPAN",{props:{className:"tm-report-popup-time-label"},html:t.message("JS_CORE_TMR_PAUSE")+":"}),t.create("SPAN",{props:{className:"tm-report-popup-time-value"},html:t.timeman.formatWorkTime(this.data.INFO.INFO.TIME_LEAKS,false)}),t.create("SPAN",{props:{className:"tm-report-popup-time-separator"}})])}n=t.util.array_merge(n,[t.create("SPAN",{props:{className:"tm-report-popup-time-label"},html:t.message("JS_CORE_TM_DEP")+":"}),t.create("SPAN",{props:{className:"tm-report-popup-time-value"},html:t.timeman.formatTime(a,false)}),t.create("SPAN",{props:{className:"tm-report-popup-time-separator"}}),t.create("SPAN",{props:{className:"tm-report-popup-time-label"},html:t.message("JS_CORE_TMR_DURATION")+":"}),t.create("SPAN",{props:{className:"tm-report-popup-time-value"},html:t.timeman.formatWorkTime(o,false)})]);t.adjust(r,{children:[t.create("SPAN",{props:{className:"tm-report-popup-time-data"},children:n})]})}if(this.data.INFO.CAN_EDIT=="Y"||this.data.CAN_EDIT=="Y"){this.TIME_EDIT_BUTTON=r.appendChild(t.create("SPAN",{props:{className:"tm-report-popup-time-edit"},events:{click:t.proxy(this.TimeEdit,this)}}))}r=[r];if(p){var l="",h=null;r[1]=t.create("DIV",{props:{className:"tm-report-popup-time-full"},children:[t.create("TABLE",{attrs:{cellSpacing:0},props:{className:"tm-report-popup-time-grid"+(this.data.INFO.INFO.TIME_LEAKS>0?"":" tm-report-popup-time-grid-minimal")},children:[h=t.create("TBODY")]})]});var m=h.insertRow(-1);var d=t.adjust(m.insertCell(-1),{props:{className:"tm-report-popup-time-start"+(!this.data.REPORTS.TIME_START?"":this.data.REPORTS.TIME_START[0].ACTIVE?" tm-report-popup-time-changed":" tm-report-popup-time-approved")},html:'<span class="tm-report-popup-time-label">'+t.message("JS_CORE_TM_ARR")+':</span><span class="tm-report-popup-time-value">'+t.timeman.formatTime(this.data.INFO.INFO.TIME_START,false)+"</span>"});if(this.data.REPORTS.TIME_START){l+='<tr><td class="tm-report-popup-time-extra-label">'+t.message("JS_CORE_TMR_REPORT_START")+':</td><td class="tm-report-popup-time-extra-text">'+this.data.REPORTS.TIME_START[0].REPORT+"</td></tr>";d.appendChild(t.create("SPAN",{props:{className:"tm-report-popup-time-real"},html:'(<span class="tm-report-popup-time-label">'+t.message("JS_CORE_TMR_REPORT_ORIG")+':</span><span class="tm-report-popup-time-value">'+t.timeman.formatTime(this.data.REPORTS.TIME_START[0].TIME%86400,false)+"</span>)"}));d.appendChild(t.create("SPAN",{props:{className:"tm-report-popup-time-fixed"},html:this.data.REPORTS.TIME_START[0].ACTIVE?t.message("JS_CORE_TMR_NA"):t.message("JS_CORE_TMR_A")+" "+this.data.REPORTS.TIME_START[0].DATE_TIME}))}if(this.data.INFO.INFO.TIME_LEAKS>0){var T;d=t.adjust(m.insertCell(-1),{props:{className:"tm-report-popup-time-break"},children:[t.create("SPAN",{props:{className:"tm-report-popup-time-label"},html:t.message("JS_CORE_TMR_PAUSE")+":"}),T=t.create("SPAN",{props:{className:"tm-report-popup-time-value"},html:t.timeman.formatWorkTime(this.data.INFO.INFO.TIME_LEAKS)})]});if(this.data.INFO.INFO.PAUSED==="Y"||this.data.INFO.INFO.PAUSED===true){t.timer(T,{from:this.data.INFO.INFO.DATE_FINISH*1e3||new Date,dt:1e3*this.data.INFO.INFO.TIME_LEAKS,display:"worktime"})}}var c,u;d=t.adjust(m.insertCell(-1),{props:{className:"tm-report-popup-time-end"+(!this.data.REPORTS.TIME_FINISH?"":this.data.REPORTS.TIME_FINISH[0].ACTIVE?" tm-report-popup-time-changed":" tm-report-popup-time-approved")},children:[t.create("SPAN",{props:{className:"tm-report-popup-time-label"},html:t.message("JS_CORE_TM_DEP")+":"}),c=t.create("SPAN",{props:{className:"tm-report-popup-time-value"+(this.data.INFO.STATE=="EXPIRED"?" tm-report-popup-time-expired":"")},html:t.timeman.formatTime(a,false)})]});if(a===0)t.timer.clock(c,this.params.parent_object.timezone_diff?this.params.parent_object.timezone_diff:0);if(this.data.REPORTS.TIME_FINISH){l+='<tr><td class="tm-report-popup-time-extra-label">'+t.message("JS_CORE_TMR_REPORT_FINISH")+':</td><td class="tm-report-popup-time-extra-text">'+this.data.REPORTS.TIME_FINISH[0].REPORT+"</td></tr>";d.appendChild(t.create("SPAN",{props:{className:"tm-report-popup-time-real"},html:'(<span class="tm-report-popup-time-label">'+t.message("JS_CORE_TMR_REPORT_ORIG")+':</span><span class="tm-report-popup-time-value">'+t.timeman.formatTime(this.data.REPORTS.TIME_FINISH[0].TIME%86400,false)+"</span>)"}));d.appendChild(t.create("SPAN",{props:{className:"tm-report-popup-time-fixed"},html:this.data.REPORTS.TIME_FINISH[0].ACTIVE?t.message("JS_CORE_TMR_NA"):t.message("JS_CORE_TMR_A")+" "+this.data.REPORTS.TIME_FINISH[0].DATE_TIME}))}d=t.adjust(m.insertCell(-1),{props:{className:"tm-report-popup-time-duration"+(!this.data.REPORTS.DURATION?"":this.data.REPORTS.DURATION[0].ACTIVE?" tm-report-popup-time-changed":" tm-report-popup-time-approved")},children:[t.create("SPAN",{props:{className:"tm-report-popup-time-label"},html:t.message("JS_CORE_TMR_DURATION")+":"}),u=t.create("SPAN",{props:{className:"tm-report-popup-time-value"+(this.data.INFO.STATE=="EXPIRED"?" tm-report-popup-time-expired":"")},html:t.timeman.formatWorkTime(o)})]});if(this.data.REPORTS.DURATION){l+='<tr><td class="tm-report-popup-time-extra-label">'+t.message("JS_CORE_TMR_REPORT_DURATION")+':</td><td class="tm-report-popup-time-extra-text">'+this.data.REPORTS.DURATION[0].REPORT+"</td></tr>";d.appendChild(t.create("SPAN",{props:{className:"tm-report-popup-time-real"},html:'(<span class="tm-report-popup-time-label">'+t.message("JS_CORE_TMR_REPORT_ORIG")+':</span><span class="tm-report-popup-time-value">'+t.timeman.formatTime(this.data.REPORTS.DURATION[0].TIME%86400,false)+"</span>)"}));d.appendChild(t.create("SPAN",{props:{className:"tm-report-popup-time-fixed"},html:this.data.REPORTS.DURATION[0].ACTIVE?t.message("JS_CORE_TMR_NA"):t.message("JS_CORE_TMR_A")+" "+this.data.REPORTS.DURATION[0].DATE_TIME}))}if(l){r[2]=t.create("DIV",{props:{className:"tm-report-popup-time-extra"},html:'<div class="tm-report-popup-time-extra-inner"><table class="tm-report-popup-time-extra-layout" cellspacing="0"><tbody>'+l+"</tbody></table></div>"})}}this.ROW_TIME=t.create("DIV",{props:{className:"tm-report-popup-time"},children:[t.create("DIV",{props:{className:"tm-report-popup-r1"}}),t.create("DIV",{props:{className:"tm-report-popup-r0"}}),t.create("DIV",{props:{className:"tm-report-popup-time-inner"},children:r}),t.create("DIV",{props:{className:"tm-report-popup-r0"}}),t.create("DIV",{props:{className:"tm-report-popup-r1"}})]});return this.ROW_TIME};t.CTimeManReportForm.prototype.GetContentPeopleRow=function(){return t.create("DIV",{props:{className:"tm-report-popup-people"},html:'<div class="tm-report-popup-r1"></div><div class="tm-report-popup-r0"></div><div class="tm-report-popup-people-inner">\t<div class="tm-report-popup-user tm-report-popup-employee">\t\t<span class="tm-report-popup-user-label">'+t.message("JS_CORE_TMR_FROM")+':</span><a href="'+this.data.FROM.URL+'" class="tm-report-popup-user-avatar"'+(this.data.FROM.PHOTO?" style=\"background: url('"+this.data.FROM.PHOTO+"') no-repeat scroll center center transparent; background-size: cover;\"":"")+'></a><span class="tm-report-popup-user-info"><a href="'+this.data.FROM.URL+'" class="tm-report-popup-user-name">'+this.data.FROM.NAME+'</a><span class="tm-report-popup-user-position">'+(this.data.FROM.WORK_POSITION||" ")+'</span></span>\t</div>\t<div class="tm-report-popup-user tm-report-popup-director">\t\t<span class="tm-report-popup-user-label">'+t.message("JS_CORE_TMR_TO")+':</span><a href="'+this.data.TO[0].URL+'" class="tm-report-popup-user-avatar"'+(this.data.TO[0].PHOTO?" style=\"background: url('"+this.data.TO[0].PHOTO+"') no-repeat scroll center center transparent; background-size: cover;\"":"")+'></a><span class="tm-report-popup-user-info"><a href="'+this.data.TO[0].URL+'" class="tm-report-popup-user-name">'+t.util.htmlspecialchars(this.data.TO[0].NAME)+'</a><span class="tm-report-popup-user-position">'+(t.util.htmlspecialchars(this.data.TO[0].WORK_POSITION||"")||" ")+'</span></span>\t</div></div><div class="tm-report-popup-r0"></div><div class="tm-report-popup-r1"></div>'})};t.CTimeManReportForm.prototype.GetContentReportRow=function(e){return this.mode=="edit"?t.create("DIV",{props:{className:"tm-report-popup-desc"},children:[t.create("DIV",{props:{className:"tm-report-popup-desc-title"},children:[t.create("DIV",{props:{className:"tm-report-popup-desc-label"},text:t.message("JS_CORE_TMR_REPORT")}),this.data.REPORT_TPL.length>0?t.create("DIV",{props:{className:"tm-report-popup-desc-templates"},events:{click:t.delegate(this.ShowTpls,this)},children:[t.create("SPAN",{props:{className:"tm-report-popup-desc-templates-label"},text:t.message("JS_CORE_TMR_REPORT_TPL")}),t.create("SPAN",{props:{className:"tm-report-popup-desc-templates-arrow"}})]}):null]}),t.create("DIV",{props:{className:"tm-report-popup-desc-text"},children:[this.REPORT_TEXT=t.create("TEXTAREA",{props:{className:"tm-report-popup-desc-textarea",value:e||this.data.REPORT},attrs:{rows:"5",cols:"65"}})]})]}):this.data.REPORT.length>0?t.create("DIV",{props:{className:"tm-report-popup-desc"},html:'<div class="tm-popup-section-title"><div class="tm-popup-section-title-text">'+t.message("JS_CORE_TMR_REPORT")+'</div><div class="tm-popup-section-title-line"></div></div><div class="tm-report-popup-desc-text">'+this.data.REPORT+"</div>"}):null};t.CTimeManReportForm.prototype.GetContentTasks=function(e,i,s){e.className="tm-report-popup-tasks";e.appendChild(t.create("DIV",{props:{className:"tm-popup-section-title"},html:'<div class="tm-popup-section-title-text">'+t.message("JS_CORE_TM_TASKS")+"</div>"+(false&&this.mode=="edit"?'<div class="tm-popup-section-title-link">'+t.message("JS_CORE_TM_TASKS_CHOOSE")+"</div>":"")+'<div class="tm-popup-section-title-line"></div>'}));if(this.data.INFO.TASKS&&this.data.INFO.TASKS.length>0){this.listTasks=null;e.appendChild(t.create("DIV",{props:{className:"tm-popup-tasks"+(this.data.INFO.TASKS.length>10?" tm-popup-tasks-tens":"")},children:[this.mode=="admin"?null:t.create("DIV",{props:{className:"tm-report-popup-inlude-tasks"},html:'<span class="tm-report-popup-inlude-arrow"></span><span class="tm-report-popup-inlude-hint">'+t.message("JS_CORE_TMR_REPORT_INC")+"</span>"}),this.listTasks=t.create("OL",{props:{className:"tm-popup-task-list"}})]}));this.listInputTasks=[];this.listInputTasksTime=[];for(var a=0;a<this.data.INFO.TASKS.length;a++){var o,r;if(typeof this.data.INFO.TASKS[a].TIME=="undefined")this.data.INFO.TASKS[a].TIME=0;var p=typeof s[a]=="undefined"?this.data.INFO.TASKS[a].TIME:s[a];this.listTasks.appendChild(t.create("LI",{props:{className:"tm-popup-task tm-popup-task-status-"+t.timeman.TASK_SUFFIXES[this.data.INFO.TASKS[a].STATUS],bx_task_id:this.data.INFO.TASKS[a].ID},children:[o=this.mode=="admin"?null:t.create("INPUT",{props:{className:"tm-report-popup-include-checkbox",value:this.data.INFO.TASKS[a].ID,checked:typeof i[a]=="undefined"?p>0:false,defaultChecked:true},attrs:{type:"checkbox"}}),t.create("SPAN",{props:{className:"tm-popup-task-name",BXPOPUPBIND:e.firstChild,BXPOPUPPARENT:this.listTasks,BXPOPUPANGLEOFFSET:44},text:this.data.INFO.TASKS[a].TITLE,events:{click:t.proxy(t.CTimeManWindow.prototype.showTask,this)}}),r=this.mode=="admin"?null:t.create("INPUT",{props:{value:p},attrs:{type:"hidden"}}),t.create("SPAN",{props:{className:"tm-popup-task-time"+(this.mode=="admin"?"-admin":""),BXTIMEINPUT:this.mode=="admin"?null:r,BXCHECKINPUT:this.mode=="admin"?null:o},events:this.mode=="admin"?null:{click:t.timeman.editTime},text:t.timeman.formatWorkTime(p)})]}));if(o){this.listInputTasks.push(o);this.listInputTasksTime.push(r)}}}if(this.mode=="edit"){this.tasksForm=e.appendChild(this.parent.WND.CreateTasksForm(t.proxy(this.taskEntryAdd,this)));if(!this.data.INFO.TASKS||this.data.INFO.TASKS.length<=0){this.tasksForm.style.marginLeft="0px"}}};t.CTimeManReportForm.prototype.taskEntryAdd=function(e){this.parent.taskEntryAdd(e,t.delegate((function(t){this.parent._Update(t);this.data=null;this.Show()}),this))};t.CTimeManReportForm.prototype.GetContentEvents=function(e){e.className="tm-report-popup-events"+(t.isAmPmMode()?" tm-popup-events-ampm":"");e.appendChild(t.create("DIV",{props:{className:"tm-popup-section-title"},html:'<div class="tm-popup-section-title-text">'+t.message("JS_CORE_TM_EVENTS")+'</div><div class="tm-popup-section-title-line"></div>'}));if(this.data.INFO.EVENTS&&this.data.INFO.EVENTS.length>0){this.listEvents=null;e.appendChild(t.create("DIV",{props:{className:"tm-popup-events"},children:[this.listEvents=t.create("DIV",{props:{className:"tm-popup-event-list"}})]}));for(var i=0;i<this.data.INFO.EVENTS.length;i++){this.listEvents.appendChild(t.CTimeManWindow.prototype.CreateEvent(this.data.INFO.EVENTS[i],{BXPOPUPBIND:e.firstChild,BXPOPUPANGLEOFFSET:44}))}}if(this.mode=="edit"){this.eventsForm=e.appendChild(this.parent.WND.CreateEventsForm(t.proxy(this.calendarEntryAdd,this)))}};t.CTimeManReportForm.prototype.calendarEntryAdd=function(e){this.parent.calendarEntryAdd(e,t.delegate((function(e){if(e&&e.error&&e.error_id=="CHOOSE_CALENDAR"){this.Update=t.proxy(this.parent.Update,this.parent);new t.CTimeManCalendarSelector(this,{node:this.eventsForm,data:e.error}).Show()}else{this.parent._Update(e);this.data=null;this.Show()}}),this))};t.CTimeManReportForm.prototype.GetContentComments=function(){var e,i,s,a=this.data.INFO.ID||this.data.INFO.INFO.ID,o=this.data.FROM.ID||this.data.INFO.INFO.USER_ID;var r=function(){if(s.value.length<=0)return;var r={comment_text:s.value,entry_id:a,owner_id:o};i.style.display="none";e.style.display="block";s.value="";t.timeman_query("add_comment_entry",r,t.proxy((function(t){if(t.COMMENTS)n.firstChild.innerHTML=t.COMMENTS;n.parentNode.scrollTop=n.offsetHeight}),this))};var p=function(t){if((t.keyCode==10||t.keyCode==13)&&t.ctrlKey==true)r.apply(this,[])};var n=t.create("DIV",{props:{className:"tm-comment-link-div"},children:[t.create("DIV",{html:this.data.COMMENTS}),e=t.create("SPAN",{props:{className:"tm-item-comments-add"},children:[t.create("A",{attrs:{href:"javascript:void(0)"},html:t.message("JS_CORE_TMR_ADD_COMMENT"),events:{click:t.delegate((function(){i.style.display="block";e.style.display="none";n.parentNode.scrollTop=n.offsetHeight}),this)}})]}),i=t.create("DIV",{style:{display:"none"},children:[s=t.create("TEXTAREA",{props:{className:"tm_comment_text"},attrs:{cols:35,rows:4},events:{keypress:t.proxy(p,this)}}),t.create("DIV",{children:[t.create("INPUT",{attrs:{type:"button",value:t.message("JS_CORE_TMR_SEND_COMMENT")},events:{click:t.proxy(r,this)}})]})]})]});return t.create("DIV",{style:{marginTop:"6px",overflow:"auto",maxHeight:"200px"},children:[n]})};t.CTimeManReportForm.prototype.GetContent=function(){var e="",s={},a={};if(this.DIV){e=this.REPORT_TEXT?this.REPORT_TEXT.value:"";if(this.listInputTasks){for(i=0,l=this.listInputTasks.length;i<l;i++){if(!this.listInputTasks[i].checked){s[i]=true}a[i]=this.listInputTasksTime[i].value}}t.cleanNode(this.DIV);this.DIV=null}this.DIV=t.create("DIV",{props:{className:"tm-report-popup ui-form"+(this.mode=="edit"?"":" tm-report-popup-read-mode")+(this.ie7?" tm-report-popup-ie7":"")},children:[this.GetContentPeopleRow(),this.GetContentTimeRow(),this.GetContentReportRow(e)]});if(this.mode=="edit"||this.data.INFO.TASKS&&this.data.INFO.TASKS.length>0||this.data.INFO.EVENTS&&this.data.INFO.EVENTS.length>0){var o=this.DIV.appendChild(t.create("TABLE",{props:{className:"tm-report-popup-items"},attrs:{cellSpacing:"0"},children:[t.create("TBODY")]})).tBodies[0].insertRow(-1);if(this.data.INFO.TASKS_ENABLED&&(this.mode=="edit"||this.data.INFO.TASKS&&this.data.INFO.TASKS.length>0))this.GetContentTasks(o.insertCell(-1),s,a);if(this.data.INFO.CALENDAR_ENABLED&&(this.mode=="edit"||this.data.INFO.EVENTS&&this.data.INFO.EVENTS.length>0))this.GetContentEvents(o.insertCell(-1))}this.DIV.appendChild(t.create("DIV",{props:{className:"tm-popup-section-title-line"}}));this.DIV.appendChild(this.GetContentComments());return this.DIV};t.CTimeManReportForm.prototype.GetTitle=function(){var e=t.create("DIV",{props:{className:"tm-report-popup-titlebar"},html:'<div class="tm-report-popup-title"><span>'+t.util.htmlspecialchars(t.message("JS_CORE_TMR_TITLE"))+'</span></div><span class="tm-report-popup-title-date">'+t.util.htmlspecialchars(this.data.INFO.DATE_TEXT)+"</span>"});if(this.mode!="edit"){var i=parseInt(this.data.INFO.INFO.TIME_OFFSET)+parseInt(t.message("SERVER_TZ_OFFSET")),s=parseInt(t.message("USER_TZ_OFFSET"))+parseInt(t.message("SERVER_TZ_OFFSET"));e.firstChild.appendChild(t.create("SPAN",{props:{className:"tm-report-popup-title-additional"},events:{mouseover:t.delegate((function(){t.hint(t.proxy_context,'<div class="tm-report-popup-titlebar-hint">'+t.message("JS_CORE_TMR_TITLE_HINT").replace("#IP_OPEN#",this.data.INFO.INFO.IP_OPEN).replace("#IP_CLOSE#",this.data.INFO.INFO.IP_CLOSE||"N/A").replace("#TIME_OFFSET#",(i>0?"+":"-")+t.timeman.formatTime(Math.abs(i),false,true)).replace("#TIME_OFFSET_SELF#",(s>0?"+":"-")+t.timeman.formatTime(Math.abs(s),false,true))+"</div>")}),this)}}))}return e};t.CTimeManReportForm.prototype.GetButtons=function(){var e=[];if(this.mode=="edit"){e.push(new t.PopupWindowButton({text:t.message("JS_CORE_TM_CLOSE"),className:"popup-window-button-decline",events:{click:this.ACTIONS[this.mode]}}))}else{if(this.data.INFO.CAN_EDIT=="Y"||this.data.CAN_EDIT=="Y"){this.SAVEBUTTON=new t.PopupWindowButton({text:this.data.INFO.INFO.ACTIVE=="Y"?t.message("JS_CORE_TM_B_SAVE"):t.message("JS_CORE_TM_CONFIRM"),className:this.data.INFO.INFO.ACTIVE=="Y"?"":"popup-window-button-accept",events:{click:this.ACTIONS[this.mode]}});e.push(this.SAVEBUTTON)}}e.push(new t.PopupWindowButtonLink({text:t.message("JS_CORE_TM_B_CLOSE"),className:"popup-window-button-link-cancel",events:{click:function(e){this.popupWindow.close();return t.PreventDefault(e)}}}));return e};t.CTimeManReportForm.prototype.CheckReport=function(){if(this.data.REPORT_REQ=="Y"){var t=this.REPORT_TEXT.value.replace(/\s/g,"");if(t.length<=0)return false;if(this.data.REPORT_TPL&&this.data.REPORT_TPL.length>0){for(var e=0;e<this.data.REPORT_TPL.length;e++){if(t==this.data.REPORT_TPL[e].replace(/\s/g,""))return false}}}return true};t.CTimeManReportForm.prototype.ActionEdit=function(e){if(this.data.INFO.STATE==="EXPIRED"&&!this.bTimeEdited){this.TimeEdit()}else if(!this.CheckReport()){t.addClass(this.REPORT_TEXT,"bx-tm-popup-report-error");this.REPORT_TEXT.focus();this.REPORT_TEXT.onkeypress=function(){t.removeClass(this,"bx-tm-popup-report-error");this.onkeypress=null}}else{var i,s,a={REPORT:t.util.trim(this.REPORT_TEXT.value),ready:"Y"};a.TASKS=[];a.TASKS_TIME=[];if(this.listInputTasks){for(i=0,s=this.listInputTasks.length;i<s;i++){if(this.listInputTasks[i].checked){a.TASKS.push(this.listInputTasks[i].value);a.TASKS_TIME.push(this.listInputTasksTime[i].value)}}}if(this.bTimeEdited){if(this.POPUP_TIME.arInputs[this.POPUP_TIME.CLOCK_ID].value!=this.POPUP_TIME.arInputs[this.POPUP_TIME.CLOCK_ID].BXORIGINALVALUE){a[this.POPUP_TIME.CLOCK_ID]=t.timeman.unFormatTime(this.POPUP_TIME.arInputs[this.POPUP_TIME.CLOCK_ID].value)}if(this.POPUP_TIME.arInputs[this.POPUP_TIME.CLOCK_ID_1].value!=this.POPUP_TIME.arInputs[this.POPUP_TIME.CLOCK_ID_1].BXORIGINALVALUE||this.data.INFO.STATE==="EXPIRED"){a[this.POPUP_TIME.CLOCK_ID_1]=t.timeman.unFormatTime(this.POPUP_TIME.arInputs[this.POPUP_TIME.CLOCK_ID_1].value)}if(this.POPUP_TIME.INPUT_TIME_LEAKS.value!=this.POPUP_TIME.INPUT_TIME_LEAKS.BXORIGINALVALUE){a["TIME_LEAKS"]=t.timeman.unFormatTime(this.POPUP_TIME.INPUT_TIME_LEAKS.value)}a.report=this.data.REPORTS.DURATION&&this.data.REPORTS.DURATION[0]?this.data.REPORTS.DURATION[0].REPORT:""}else if(this.external_finish_ts){a.timeman_edit_to=this.external_finish_ts;a.report=this.external_finish_ts_report}if(window.BXTIMEMAN&&window.BXTIMEMAN.WND&&window.BXTIMEMAN.WND.startUserDate!==undefined){a.startUserDate=window.BXTIMEMAN.WND.startUserDate}if(window.BXTIMEMAN&&window.BXTIMEMAN.WND&&window.BXTIMEMAN.WND.endUserDate!==undefined){a.endUserDate=window.BXTIMEMAN.WND.endUserDate}this.parent.Query("close",a,t.proxy(this._ActionEdit,this))}return t.PreventDefault(e)};t.CTimeManReportForm.prototype._ActionEdit=function(){this.popup.close();this.parent._Update.apply(this.parent,arguments)};t.CTimeManReportForm.prototype.ActionAdmin=function(){if(this.bTimeEdited||this.data.INFO.INFO.ACTIVE!="Y"){var e={ID:this.data.INFO.INFO.ID};if(this.bTimeEdited){e.INFO={TIME_START:this.data.INFO.INFO.TIME_START,TIME_FINISH:this.data.INFO.INFO.TIME_FINISH,TIME_LEAKS:this.data.INFO.INFO.TIME_LEAKS}}t.timeman_query("admin_save",e,t.proxy(this._ActionAdmin,this))}else{this.popup.close()}};t.CTimeManReportForm.prototype._ActionAdmin=function(e){this.data=e;var i=t.clone(this.data.INFO.INFO,true);i.ACTIVE=i.ACTIVE=="Y";i.PAUSED=i.PAUSED=="Y";i.ACTIVATED=i.ACTIVATED=="Y";i.CAN_EDIT=this.data.INFO.CAN_EDIT=="Y"||this.data.CAN_EDIT=="Y"?"Y":"N";t.onCustomEvent(this,"onEntryNeedReload",[i]);this.bTimeEdited=false};t.CTimeManReportForm.prototype.TimeEdit=function(){if(this.POPUP_TIME){this.POPUP_TIME.Clear();this.POPUP_TIME=null}var e={ID:this.data.INFO.INFO.ID,INFO:{CAN_EDIT:this.data.INFO.CAN_EDIT=="Y"||this.data.CAN_EDIT=="Y"?"Y":"N",DATE_START:this.data.INFO.INFO.DATE_START,TIME_START:this.data.INFO.INFO.TIME_START,TIME_FINISH:this.data.INFO.INFO.TIME_FINISH||this.data.INFO.EXPIRED_DATE,TIME_LEAKS:this.data.INFO.INFO.TIME_LEAKS,DURATION:this.data.INFO.INFO.DURATION}};if(!e.INFO.TIME_FINISH){var i=new Date;e.INFO.TIME_FINISH=i.getHours()*3600+i.getMinutes()*60-(this.params.parent_object?this.params.parent_object.timezone_diff/1e3:0)}this.POPUP_TIME=new t.CTimeManEditPopup(this.parent,{node:this.TIME_EDIT_BUTTON||this.node,bind:this.TIME_EDIT_BUTTON||this.node,entry:e,mode:this.mode});this.POPUP_TIME.params.popup_buttons=[this.POPUP_TIME.SAVEBUTTON=new t.PopupWindowButton({text:t.message("JS_CORE_TM_B_SAVE"),className:"popup-window-button-create",events:{click:t.proxy(this.setEditValue,this)}}),new t.PopupWindowButtonLink({text:t.message("JS_CORE_TM_B_CLOSE"),className:"popup-window-button-link-cancel",events:{click:t.proxy(this.POPUP_TIME.closeWnd,this.POPUP_TIME)}})];this.POPUP_TIME.WND.setButtons(this.POPUP_TIME.params.popup_buttons);this.POPUP_TIME._SetSaveButton=this.POPUP_TIME.SetSaveButton;this.POPUP_TIME.SetSaveButton=t.DoNothing;this.POPUP_TIME.restoreButtons();this.POPUP_TIME.Show()};t.CTimeManReportForm.prototype.setEditValue=function(e){var i,s=this.mode=="edit"?t.util.trim(this.POPUP_TIME.REPORT.value):t.message("JS_CORE_TMR_ADMIN");if(s.length<=0){this.POPUP_TIME.REPORT.className="bx-tm-popup-clock-wnd-report-error";this.POPUP_TIME.REPORT.focus();this.POPUP_TIME.REPORT.onkeypress=function(){this.className="";this.onkeypress=null}}else{if(this.data.INFO.CAN_EDIT=="Y"||this.data.CAN_EDIT=="Y"){this.data.INFO.INFO.TIME_START=t.timeman.unFormatTime(this.POPUP_TIME.arInputs.timeman_edit_from.value);this.data.INFO.INFO.TIME_LEAKS=t.timeman.unFormatTime(this.POPUP_TIME.INPUT_TIME_LEAKS.value)}if(this.data.INFO.CAN_EDIT=="Y"||this.data.CAN_EDIT=="Y"||this.data.INFO.STATE=="EXPIRED"){this.data.INFO.INFO.TIME_FINISH=t.timeman.unFormatTime(this.POPUP_TIME.arInputs.timeman_edit_to.value)}if(this.data.INFO.STATE=="EXPIRED"){this.data.INFO.EXPIRED_DATE=this.data.INFO.INFO.TIME_FINISH}this.data.INFO.INFO.DURATION=this.data.INFO.INFO.TIME_FINISH-this.data.INFO.INFO.TIME_FINISH-this.data.INFO.INFO.TIME_LEAKS;var a=new Date;if(!this.data.REPORTS.DURATION)this.data.REPORTS.DURATION=[];this.data.REPORTS.DURATION[0]={ACTIVE:true,REPORT:t.util.htmlspecialchars(s),TIME:a.getHours()*3600+a.getMinutes()*60+a.getSeconds(),DATE_TIME:parseInt(a.valueOf()/1e3)};this.POPUP_TIME.WND.close();this.bTimeEdited=true;this.Show(this.data);if(this.mode=="admin"){this.SAVEBUTTON.setClassName("popup-window-button-accept")}}return t.PreventDefault(e)};t.CTimeManReportForm.prototype.ShowTpls=function(e){if(!this.TPLWND){var i=t.create("DIV",{props:{className:"bx-tm-report-tpl"}}),s;var a=this.REPORT_TEXT;var o=function(){a.value=this.BXTEXT;s.close()};for(var r=0;r<this.data.REPORT_TPL.length;r++){var p=t.util.trim(this.data.REPORT_TPL[r]);i.appendChild(t.create("SPAN",{props:{className:"bx-tm-report-tpl-item",BXTEXT:p},events:{click:o},text:p||t.message("JS_CORE_EMPTYTPL")}))}s=this.TPLWND=t.PopupWindowManager.create("timeman_template_selector_"+Math.random(),t.proxy_context,{autoHide:true,content:i})}else{this.TPLWND.setBindElement(t.proxy_context)}this.TPLWND.show();return t.PreventDefault(e)};t.CTimeManReportForm.prototype.Clear=function(){this.bCleared=true;if(this.POPUP_TIME){this.POPUP_TIME.WND.close();this.POPUP_TIME.WND.destroy();this.POPUP_TIME.Clear();this.POPUP_TIME=null}this.popup.close();this.popup.destroy()};t.JSTimeManReportFullForm=function(e,i){this.popupform=null;this.slider=i;this.report_data=e;this.cell=false;this.data=null;this.empty_slider="Y";if(this.popupform==null){this.popupform=new t.PopupWindow("popup_report_"+Math.random(),null,{autoHide:false,closeIcon:{right:"12px",top:"10px"},draggable:false,titleBar:true,closeByEsc:true,bindOnResize:false,toFrontOnShow:false});try{t.addCustomEvent(taskIFramePopup,"onBeforeShow",t.proxy((function(){this.popupform.setClosingByEsc(false);if(this.slider){this.slider.nextReportLink.style.visibility="hidden";this.slider.prevReportLink.style.visibility="hidden";this.slider.closeLink.style.visibility="hidden"}}),this));t.addCustomEvent(taskIFramePopup,"onBeforeHide",t.proxy((function(){this.popupform.setClosingByEsc(true);if(this.slider){this.slider.nextReportLink.style.visibility="visible";this.slider.prevReportLink.style.visibility="visible";this.slider.closeLink.style.visibility="visible"}}),this))}catch(t){}}t.bind(this.cell,"click",t.proxy(this.Click,this))};t.JSTimeManReportFullForm.prototype.setData=function(t){this.data=t;if(this.data.REPORT_LIST.length>0&&this.empty_slider=="Y"){this.empty_slider="N";this.report_list=this.data.REPORT_LIST}this.GetContent();this.Show()};t.JSTimeManReportFullForm.prototype.Click=function(){t.timeman.showWait(this.popupform.popupContainer,0);t.timeman_query("admin_report_full",{report_id:this.report_data.ID,user_id:this.report_data.USER_ID,empty_slider:this.empty_slider},t.proxy(this.setData,this))};t.JSTimeManReportFullForm.prototype.Show=function(t){this.popupform.show()};t.JSTimeManReportFullForm.prototype.Clear=function(){this.bCleared=true;if(this.popupform){this.popupform.close();this.popupform.destroy()}};t.JSTimeManReportFullForm.prototype.EditMode=function(){this.TABCONTROL.SwitchEdit();this.EditLink.style.display="none";this.SaveLink.style.display="inline-block";this.EditLink.click=t.proxy(this.SaveReportText,this);this.slider.FixOverlay()};t.JSTimeManReportFullForm.prototype.SaveReportText=function(){var e={report_id:this.data.INFO.ID,user_id:this.data.INFO.USER_ID,report_text:this.TABCONTROL.GetTabContent("report_text_"+this.data.INFO.USER_ID),plan_text:this.TABCONTROL.GetTabContent("plan_text_"+this.data.INFO.USER_ID),edit_report:"Y"};t.timeman.showWait(this.popupform.popupContainer,0);t.timeman_query("user_report_edit",e,t.proxy(this.UpdateReportArea,this))};t.JSTimeManReportFullForm.prototype.UpdateReportArea=function(t){if(t.success==true){this.TABCONTROL.SwitchView();this.SaveLink.style.display="none";this.EditLink.style.display="inline-block"}this.slider.FixOverlay()};t.JSTimeManReportFullForm.prototype.GetContent=function(){var e="",i={},s={};if(!this.WND)this.WND=new t.CTimeManWindow(this.popupform);for(var a in this.WND.EVENTWND){var o=this.WND.EVENTWND[a];o.Clear()}var r=t.create("DIV",{props:{className:"tm-report-popup-titlebar"},children:[t.create("DIV",{props:{className:"tm-report-popup-title"},text:t.message("JS_CORE_TMR_REPORT_WEEKLY")}),t.create("SPAN",{props:{className:"tm-report-popup-title-date"},text:this.data.INFO.TEXT_TITLE})]});this.fileForm=false;if(this.data.INFO.CAN_EDIT_TEXT=="Y"||this.data.INFO.FILES&&this.data.INFO.FILES.length>0){this.fileForm=new t.CTimeManUploadForm({id:this.data.INFO.ID,user_id:this.data.INFO.USER_ID,files_list:this.data.INFO.FILES,mode:this.data.INFO.CAN_EDIT_TEXT=="Y"?"edit":"view"});t.addCustomEvent(this.fileForm,"OnUploadFormRefresh",t.proxy((function(){this.slider.FixOverlay()}),this))}var p=t.create("DIV",{props:{className:"tm-report-popup ui-form tm-report-popup-read-mode"+(this.ie7?" tm-report-popup-ie7":"")},children:[this.GetPeople(),this.GetReportRow(),this.fileForm?this.fileForm.GetUploadForm():null]});if(this.data.INFO.TASKS&&this.data.INFO.TASKS.length>0||this.data.INFO.EVENTS&&this.data.INFO.EVENTS.length>0){var n=p.appendChild(t.create("TABLE",{props:{className:"tm-report-popup-items"},attrs:{cellSpacing:"0"},children:[t.create("TBODY")]})).tBodies[0].insertRow(-1);if(this.data.INFO.TASKS_ENABLED&&(this.mode=="edit"||this.data.INFO.TASKS&&this.data.INFO.TASKS.length>0))this.GetTasks(n.insertCell(-1),i,s);if(this.data.INFO.CALENDAR_ENABLED&&(this.mode=="edit"||this.data.INFO.EVENTS&&this.data.INFO.EVENTS.length>0))this.GetEvents(n.insertCell(-1))}this.selectMark=this.data.INFO.MARK;t.onCustomEvent(this,"onWorkReportMarkChange",[this.data]);if(this.data.INFO.CAN_EDIT){this.mark_div=t.create("DIV",{props:{className:"tm-popup-estimate-popup-center"},children:[this.markg=t.create("DIV",{props:{className:"tm-popup-estimate-but tm-but-plus"+(this.selectMark=="G"?" tm-but-active":"")},html:'<span class="tm-popup-estimate-but-l"></span><span class="tm-popup-estimate-but-c"><span class="tm-popup-estimate-but-icon"></span><span class="tm-popup-estimate-but-text">'+t.message("JS_CORE_TMR_MARK_G_W")+'</span></span><span class="tm-popup-estimate-but-r"></span>',events:{click:t.proxy((function(){this.ChangeMark("G")}),this)}}),this.markb=t.create("DIV",{props:{className:"tm-popup-estimate-but tm-but-minus"+(this.selectMark=="B"?" tm-but-active":"")},html:'<span class="tm-popup-estimate-but-l"></span><span class="tm-popup-estimate-but-c"><span class="tm-popup-estimate-but-icon"></span><span class="tm-popup-estimate-but-text">'+t.message("JS_CORE_TMR_MARK_B_W")+'</span></span><span class="tm-popup-estimate-but-r"></span>',events:{click:t.proxy((function(){this.ChangeMark("B")}),this)}}),this.markn=t.create("DIV",{props:{className:"tm-popup-estimate-but tm-but-not-rated"+(this.selectMark=="N"?" tm-but-active":"")},html:'<span class="tm-popup-estimate-but-l"></span><span class="tm-popup-estimate-but-c"><span class="tm-popup-estimate-but-icon"></span><span class="tm-popup-estimate-but-text">'+t.message("JS_CORE_TMR_MARK_N_W")+'</span></span><span class="tm-popup-estimate-but-r"></span>',events:{click:t.proxy((function(){this.ChangeMark("N")}),this)}}),this.markx=t.create("DIV",{props:{className:"tm-popup-estimate-but tm-but-notconfirm"+(this.selectMark=="X"?" tm-but-active":"")},html:'<span class="tm-popup-estimate-but-l"></span><span class="tm-popup-estimate-but-c"><span class="tm-popup-estimate-but-icon"></span><span class="tm-popup-estimate-but-text">'+t.message("JS_CORE_TMR_MARK_X")+'</span></span><span class="tm-popup-estimate-but-r"></span>',events:{click:t.proxy((function(){this.ChangeMark("X")}),this)}})]})}else{this.mark_div=t.create("DIV",{props:{className:"tm-popup-estimate-popup-center"},children:[t.create("DIV",{props:{className:"mark-clean report-mark-"+this.selectMark+"-clean"},html:t.message("JS_CORE_TMR_MARK_"+this.selectMark)})]})}var l="";l='<div class="tm-not-approve">'+t.message("JS_CORE_TMR_NOT_ACCEPT")+"</div>";if(this.data.INFO.APPROVER<=0&&!this.data.INFO.CAN_EDIT){this.info=t.create("DIV",{props:{className:"tm-popup-estimate-right"},style:{width:"100%"},html:l});this.mark_area=t.create("DIV",{props:{className:"tm-popup-estimate-item"},children:['<div class="tm-popup-section-title-line"></div>',this.info]})}else{if(this.data.INFO.APPROVER>0){l="<span class='tm-popup-est-right-item tm-popup-item-name'>"+t.message("JS_CORE_TMR_REPORT_APPROVER")+":</span><span class='tm-popup-est-right-item'>"+'<a href="'+this.data.INFO.APPROVER_INFO.URL+'">'+this.data.INFO.APPROVER_INFO.NAME+"</a>"+"</span>";l+="<span class='tm-popup-est-right-item tm-popup-item-name'>"+t.message("JS_CORE_TMR_ACCEPT_DATE")+":</span><span class='tm-popup-est-right-item'>"+this.data.INFO.APPROVE_DATE+"</span>"}this.info=t.create("DIV",{props:{className:"tm-popup-estimate-right"},html:l});this.mark_area=t.create("DIV",{props:{className:"tm-popup-estimate-item"},children:['<div class="tm-popup-section-title-line"></div>',t.create("DIV",{props:{className:"tm-popup-estimate-popup-left"},children:['<div class="tm-popup-estimate-cont">'+(this.data.INFO.CAN_EDIT?t.message("JS_CORE_TMR_APPROVING_REPORT"):t.message("JS_CORE_TMR_MARK"))+"</div>"]}),this.mark_div,this.info]})}this.enterHandler=function(t){if((t.keyCode==10||t.keyCode==13)&&t.ctrlKey==true)this.AddComment()};this.comment_form=t.create("DIV",{props:{className:"tm-comment-link-div"},children:[this.comment_link_span=t.create("SPAN",{props:{className:"tm-item-comments-add"},children:[t.create("A",{attrs:{href:"javascript:void(0)"},html:t.message("JS_CORE_TMR_ADD_COMMENT"),events:{click:t.proxy((function(){this.comment_area_edit.style.display="block";this.comment_link_span.style.display="none";this.slider.FixOverlay()}),this)}})]}),this.comment_area_edit=t.create("DIV",{style:{display:"none"},children:[this.comment_text=t.create("TEXTAREA",{props:{className:"tm_comment_text"},attrs:{cols:35,rows:4},events:{keypress:t.proxy(this.enterHandler,this)}}),t.create("DIV",{children:[t.create("INPUT",{attrs:{type:"button",value:t.message("JS_CORE_TMR_SEND_COMMENT")},events:{click:t.proxy(this.AddComment,this)}})]})]})]});p.appendChild(t.create("DIV",{children:[this.mark_area?this.mark_area:null,t.create("DIV",{props:{className:"tm-popup-section-title-line"}}),this.comments_div=t.create("DIV",{style:{marginTop:"6px"},html:this.data.COMMENTS}),this.comment_form]}));this.popupform.setContent(p);this.popupform.setTitleBar({content:r});t.timeman.closeWait()};t.JSTimeManReportFullForm.prototype.GetEvents=function(e){e.className="tm-report-popup-events";e.appendChild(t.create("DIV",{props:{className:"tm-popup-section-title"},html:'<div class="tm-popup-section-title-text">'+t.message("JS_CORE_TM_EVENTS")+'</div>\t<div class="tm-popup-section-title-line"></div>'}));if(this.data.INFO.EVENTS&&this.data.INFO.EVENTS.length>0){this.listEvents=null;e.appendChild(t.create("DIV",{props:{className:"tm-popup-events"},children:[this.listEvents=t.create("DIV",{props:{className:"tm-popup-event-list"}})]}));for(var i=0;i<this.data.INFO.EVENTS.length;i++){this.listEvents.appendChild(this.WND.CreateEvent(this.data.INFO.EVENTS[i],{BXPOPUPBIND:e.firstChild,BXPOPUPANGLEOFFSET:44},true))}}};t.JSTimeManReportFullForm.prototype.GetPeople=function(){return t.create("DIV",{props:{className:"tm-report-popup-people"},html:'<div class="tm-report-popup-r1"></div><div class="tm-report-popup-r0"></div><div class="tm-report-popup-people-inner">\t<div class="tm-report-popup-user tm-report-popup-employee">\t\t<span class="tm-report-popup-user-label">'+t.message("JS_CORE_TMR_FROM")+':</span><a href="'+this.data.FROM.URL+'" class="tm-report-popup-user-avatar"'+(this.data.FROM.PHOTO?" style=\"background: url('"+this.data.FROM.PHOTO+"') no-repeat scroll center center transparent; background-size: cover;\"":"")+'></a><span class="tm-report-popup-user-info"><a href="'+this.data.FROM.URL+'" class="tm-report-popup-user-name">'+this.data.FROM.NAME+'</a><span class="tm-report-popup-user-position">'+(t.util.htmlspecialchars(this.data.FROM.WORK_POSITION||"")||" ")+'</span></span>\t</div>\t<div class="tm-report-popup-user tm-report-popup-director">\t\t<span class="tm-report-popup-user-label">'+t.message("JS_CORE_TMR_TO")+':</span><a href="'+this.data.TO[0].URL+'" class="tm-report-popup-user-avatar"'+(this.data.TO[0].PHOTO?" style=\"background: url('"+this.data.TO[0].PHOTO+"') no-repeat scroll center center transparent; background-size: cover;\"":"")+'></a><span class="tm-report-popup-user-info"><a href="'+this.data.TO[0].URL+'" class="tm-report-popup-user-name">'+this.data.TO[0].NAME+'</a><span class="tm-report-popup-user-position">'+(t.util.htmlspecialchars(this.data.TO[0].WORK_POSITION||"")||" ")+'</span></span>\t</div></div><div class="tm-report-popup-r0"></div><div class="tm-report-popup-r1"></div>'})};t.JSTimeManReportFullForm.prototype.GetReportRow=function(){this.TABCONTROL=new t.CTimeManTabEditorControl({lhename:"obReportForm"+this.data.INFO.USER_ID,parent:this});this.TABCONTROL.addTab({ID:"report_text_"+this.data.INFO.USER_ID,TITLE:t.message("JS_CORE_TMR_REPORT"),CONTENT:(this.data.INFO.REPORT_STRIP_TAGS.length>0?this.data.INFO.REPORT:'<i data-placeholder="1" style="color:#999">'+t.message("JS_CORE_TMR_REPORT_EMPTY"))+"</i>"});this.TABCONTROL.addTab({ID:"plan_text_"+this.data.INFO.USER_ID,TITLE:t.message("JS_CORE_TMR_PLAN"),CONTENT:(this.data.INFO.PLAN_STRIP_TAGS.length>0?this.data.INFO.PLANS:'<i data-placeholder="1" style="color:#999">'+t.message("JS_CORE_TMR_PLAN_EMPTY"))+"</i>"});return t.create("DIV",{props:{className:"tm-report-popup-desc"},children:[t.create("DIV",{props:{className:"tm-report-popup-desc-text-view"},children:[this.data.INFO.CAN_EDIT_TEXT=="Y"?t.create("SPAN",{props:{className:"tm-link-div"},children:[this.EditLink=t.create("A",{props:{className:"tm-edit-link"},text:t.message("JS_CORE_TMR_PARENT_EDIT"),events:{click:t.proxy(this.EditMode,this)}}),this.SaveLink=t.create("DIV",{props:{className:"tm-ag-buttons-save"},style:{display:"none"},children:[t.create("SPAN",{props:{className:"tm-ag-buttons-left"}}),t.create("SPAN",{props:{className:"tm-ag-buttons-cont"},children:[t.create("SPAN",{props:{className:"tm-ag-buttons-icon"}}),"<span>"+t.message("JS_CORE_TM_B_SAVE")+"</span>"]}),t.create("SPAN",{props:{className:"tm-ag-buttons-right"}})],events:{click:t.proxy(this.SaveReportText,this)}})]}):null,this.TABCONTROL.div]})]})};t.JSTimeManReportFullForm.prototype.GetTasks=function(e,i,s){e.className="tm-report-popup-tasks";e.appendChild(t.create("DIV",{props:{className:"tm-popup-section-title"},html:'<div class="tm-popup-section-title-text">'+t.message("JS_CORE_TM_TASKS")+"</div>"+(false&&this.mode=="edit"?'<div class="tm-popup-section-title-link">'+t.message("JS_CORE_TM_TASKS_CHOOSE")+"</div>":"")+'<div class="tm-popup-section-title-line"></div>'}));if(this.data.INFO.TASKS&&this.data.INFO.TASKS.length>0){this.listTasks=null;e.appendChild(t.create("DIV",{props:{className:"tm-popup-tasks"+(this.data.INFO.TASKS.length>10?" tm-popup-tasks-tens":"")},children:[this.listTasks=t.create("OL",{props:{className:"tm-popup-task-list"}})]}));this.listInputTasks=[];this.listInputTasksTime=[];for(var a=0;a<this.data.INFO.TASKS.length;a++){var o,r;if(typeof this.data.INFO.TASKS[a].TIME=="undefined")this.data.INFO.TASKS[a].TIME=0;var p=typeof s[a]=="undefined"?this.data.INFO.TASKS[a].TIME:s[a];this.listTasks.appendChild(t.create("LI",{props:{className:"tm-popup-task tm-popup-task-status-"+t.timeman.TASK_SUFFIXES[this.data.INFO.TASKS[a].STATUS],bx_task_id:this.data.INFO.TASKS[a].ID},children:[t.create("SPAN",{props:{className:"tm-popup-task-name"},text:this.data.INFO.TASKS[a].TITLE,events:{click:t.proxy(this.WND.showTask,this)}}),t.create("SPAN",{props:{className:"tm-popup-task-time-admin"},text:t.timeman.formatWorkTime(p)})]}));if(o){this.listInputTasks.push(o);this.listInputTasksTime.push(r)}}}};t.JSTimeManReportFullForm.prototype.Approve=function(){var e={mark:this.selectMark,approve:"Y",user_id:this.data.FROM.ID,report_id:this.data.INFO.ID};t.timeman.showWait(this.mark_div,0);t.timeman_query("admin_report_full",e,t.proxy((function(e){t.onCustomEvent(this,"onWorkReportMarkChange",[e]);this.setData(e)}),this))};t.JSTimeManReportFullForm.prototype.AddComment=function(){if(this.comment_text.value.length<=0)return;var e={comment_text:this.comment_text.value,report_owner:this.data.FROM.ID,report_id:this.data.INFO.ID,add_comment:"Y"};this.comments_div.style.minHeight="50px";t.timeman.showWait(this.comments_div,0);this.comment_area_edit.style.display="none";this.comment_link_span.style.display="block";this.comment_text.value="";t.timeman_query("add_comment_full_report",e,t.proxy(this.RefreshComments,this))};t.JSTimeManReportFullForm.prototype.RefreshComments=function(e){if(e.COMMENTS){this.comments_div.innerHTML=e.COMMENTS;if(t("report_comments_count_"+this.data.INFO.ID)&&e.COMMENTS_COUNT>0){var i=t("report_comments_count_"+this.data.INFO.ID);i.style.display="inline-block";i.innerHTML=e.COMMENTS_COUNT}this.slider.FixOverlay()}};t.bindFullReport=function(e,i){if(!window["report"+e])window["report"+e]=new t.JSTimeManReportFullForm({ID:e,USER_ID:i});window["report"+e].Click()};t.JSTimeManReportFullForm.prototype.ChangeMark=function(e){var i=e.toLowerCase();t.removeClass(this.markb,"tm-but-active");t.removeClass(this.markn,"tm-but-active");t.removeClass(this.markx,"tm-but-active");t.removeClass(this.markg,"tm-but-active");t.addClass(this["mark"+i],"tm-but-active");if(this.selectMark!=e){this.selectMark=e;this.Approve()}};t.StartSlider=function(e,i){t.timeman.showWait(document.body,0);if(!window["report"+e]){window["report"+e]=new t.ReportSlider(e,i)}window["report"+e].ShowReport(i)};t.ReportSlider=function(e,i){this.cur_report=i||false;this.reports={};this.user_id=e;this.popup=false;this.table=t.create("TABLE",{props:{className:"report-popup-main-table"},children:[t.create("TBODY",{children:[t.create("TR",{children:[this.prev=t.create("TD",{props:{className:"report-popup-prev-slide-wrap"},children:[this.prevReportLink=t.create("A",{props:{className:"report-popup-prev-slide"},attrs:{href:"javascript: void(0)"},children:[t.create("SPAN",{})],events:{click:t.proxy(this.PrevReport,this)}})]}),this.popup_place=t.create("TD",{attrs:{valign:"top"},style:{paddingTop:"20px"},props:{className:"report-popup-main-block-wrap"}}),this.next=t.create("TD",{props:{className:"report-popup-next-slide-wrap"},children:[this.closeLink=t.create("A",{attrs:{href:"javascript: void(0)"},events:{click:t.proxy(this.PopupClose,this)},props:{className:"report-popup-close"},children:[t.create("SPAN",{props:{className:"report-popup-close"}})]}),this.nextReportLink=t.create("A",{attrs:{href:"javascript: void(0)"},props:{className:"report-popup-next-slide"},children:[t.create("SPAN",{})],events:{click:t.proxy(this.NextReport,this)}})]})]})]})]});this.overlay=t.create("DIV",{props:{className:"report-fixed-overlay"},children:[this.coreoverlay=t.create("DIV",{props:{className:"bx-tm-dialog-overlay"}}),this.table]});document.body.appendChild(this.overlay);t.ZIndexManager.register(this.overlay);t.bind(window.top,"resize",t.proxy(this.FixOverlay,this))};t.ReportSlider.prototype.ShowReport=function(e){this.cur_report=e;if(!this.report_form){this.report_form=new t.JSTimeManReportFullForm({ID:this.cur_report,USER_ID:this.user_id},this);t.addCustomEvent(this.report_form.popupform,"onPopupClose",t.proxy((function(){this.overlay.style.display="none"}),this));t.addCustomEvent(this.report_form.popupform,"onPopupShow",t.proxy((function(){this.overlay.style.display="block";t.ZIndexManager.bringToFront(this.overlay)}),this));t.addCustomEvent(this.report_form.popupform,"onAfterPopupShow",t.proxy((function(){this.report_form.popupform.popupContainer.style.position="relative";this.report_form.popupform.popupContainer.style.left="0px";this.FixOverlay()}),this));this.popup_place.appendChild(t.create("DIV",{style:{display:"inline-block"},children:[t(this.report_form.popupform.uniquePopupId)]}))}this.report_form.report_data={ID:this.cur_report,USER_ID:this.user_id};this.report_form.Click()};t.ReportSlider.prototype.FixOverlay=function(){this.report_form.popupform.popupContainer.style.position="relative";this.report_form.popupform.popupContainer.style.left="0px";var e=t.GetWindowInnerSize();this.overlay.style.height=e.innerHeight+"px";this.overlay.style.width=e.innerWidth+"px";var i=t.GetWindowScrollPos();if(t.browser.IsIE()&&!t.browser.IsIE9()){this.table.style.width=e.innerWidth-20+"px"}this.overlay.firstChild.style.height=Math.max(this.report_form.popupform.popupContainer.offsetHeight+50,this.overlay.clientHeight)+"px";this.overlay.firstChild.style.width=Math.max(1024,this.overlay.clientWidth)+"px";this.report_form.popupform.popupContainer.style.top="0px";this.Recalc();this.__adjustControls()};t.ReportSlider.prototype.__adjustControls=function(){{if(!t.browser.IsDoctype()&&t.browser.IsIE()){this.nextReportLink.style.height=this.prevReportLink.style.height=document.documentElement.offsetHeight+"px";this.prevReportLink.style.width=this.prevReportLink.parentNode.clientWidth-1+"px";this.nextReportLink.style.width=this.nextReportLink.parentNode.clientWidth-1+"px"}else{this.nextReportLink.style.height=this.prevReportLink.style.height=document.documentElement.clientHeight+"px";this.prevReportLink.style.width=this.prevReportLink.parentNode.clientWidth+"px";this.nextReportLink.style.width=this.nextReportLink.parentNode.clientWidth+"px"}this.prevReportLink.firstChild.style.left=this.prevReportLink.parentNode.clientWidth*4/10+"px";this.nextReportLink.firstChild.style.right=this.nextReportLink.parentNode.clientWidth*4/10+"px"}this.closeLink.style.width=this.closeLink.parentNode.clientWidth+"px"};t.ReportSlider.prototype.Recalc=function(){if(!this.report_form||this.report_form.empty_slider!="N")return;var t=this.report_form.report_list.length;if(t==1){this.nextReportLink.style.display="none";this.prevReportLink.style.display="none"}else{for(i=0;i<t;i++){if(this.report_form.report_list[i]==this.cur_report){if(t==i+1){this.nextReportLink.style.display="none";this.prevReportLink.style.display="block"}else if(i==0){this.nextReportLink.style.display="block";this.prevReportLink.style.display="none"}else{this.nextReportLink.style.display="block";this.prevReportLink.style.display="block"}break}}}};t.ReportSlider.prototype.NextReport=function(){var t=this.cur_report;for(i=0;i<this.report_form.report_list.length;i++){if(this.report_form.report_list[i]==this.cur_report&&i+1!=this.report_form.report_list.length){t=this.report_form.report_list[i+1];break}}if(t!=this.cur_report)this.ShowReport(t);this.Recalc()};t.ReportSlider.prototype.PrevReport=function(){var t=this.cur_report;for(i=0;i<this.report_form.report_list.length;i++){if(this.report_form.report_list[i]==this.cur_report&&i!=0){t=this.report_form.report_list[i-1];break}}if(t!=this.cur_report)this.ShowReport(t);this.Recalc()};t.ReportSlider.prototype.PopupClose=function(){this.report_form.popupform.close()};t.StartNotifySlider=function(e,i,s){t.timeman.showWait(document.body,0);if(!window["timeman_notify_"+e]){window["timeman_notify_"+e]=new t.TimeManSlider(e,i,s)}else{window["timeman_notify_"+e].Load(i)}};t.TimeManSlider=function(e,i,s){this.WND=null;this.user=e;this.type=s;this.Load(i);t.addCustomEvent("onEntryNeedReload",t.proxy(this.Reset,this))};t.TimeManSlider.prototype.Load=function(e){t.timeman.closeWait();t.SidePanel.Instance.open("/timeman/worktime/records/"+e+"/report/",{width:800,cacheable:false})};t.TimeManSlider.prototype.Show=function(e){this.data=e;if(null==this.WND||!!this.WND.bCleared){this.WND=null;this.WND=new t.CTimeManReportForm(window.BXTIMEMAN||{},{node:document.body,mode:"admin",data:e,offsetLeft:-100,parent_object:this,type:this.type});this.ShowOverlay();t.addCustomEvent(this.WND.popup,"onPopupClose",t.proxy((function(){this.overlay.style.display="none"}),this));t.addCustomEvent(this.WND.popup,"onPopupShow",t.proxy((function(){this.overlay.style.display="block";t.ZIndexManager.bringToFront(this.overlay)}),this));this.WND.Show()}else{this.WND.Show(e);setTimeout(t.proxy(this.FixOverlay,this),100)}if(this.data.NEIGHBOURS.NEXT>0)t.show(this.nextLink);else t.hide(this.nextLink);if(this.data.NEIGHBOURS.PREV>0)t.show(this.prevLink);else t.hide(this.prevLink);setTimeout(t.proxy(this.FixOverlay,this),100)};t.TimeManSlider.prototype.Reset=function(t){this.Load(t.ID)};t.TimeManSlider.prototype.ShowOverlay=function(){this.prevLink=t.create("A",{props:{className:"timeman-popup-prev-slide"},attrs:{href:"javascript: void(0)"},children:[t.create("SPAN")],events:{click:t.proxy(this.Prev,this)}});this.nextLink=t.create("A",{props:{className:"timeman-popup-next-slide"},attrs:{href:"javascript: void(0)"},children:[t.create("SPAN")],events:{click:t.proxy(this.Next,this)}});this.overlay=t.create("DIV",{props:{className:"report-fixed-overlay"},children:[this.coreoverlay=t.create("DIV",{props:{className:"bx-tm-dialog-overlay"}}),this.nextLink,this.prevLink,this.closeLink=t.create("A",{attrs:{href:"javascript: void(0)"},events:{click:t.proxy(this.WND.popup.close,this.WND.popup)},props:{className:"timeman-popup-close"},children:[t.create("SPAN")]})]});document.body.appendChild(this.overlay);t.ZIndexManager.register(this.overlay);t.bind(top,"resize",t.proxy(this.FixOverlay,this))};t.TimeManSlider.prototype.Prev=function(){if(this.data.NEIGHBOURS&&this.data.NEIGHBOURS.PREV){this.Load(this.data.NEIGHBOURS.PREV)}t.proxy_context.blur()};t.TimeManSlider.prototype.Next=function(){if(this.data.NEIGHBOURS&&this.data.NEIGHBOURS.NEXT){this.Load(this.data.NEIGHBOURS.NEXT)}t.proxy_context.blur()};t.TimeManSlider.prototype.FixOverlay=function(){var e=t.GetWindowInnerSize();var i=t.pos(this.WND.popup.popupContainer);this.overlay.style.height=e.innerHeight+"px";this.overlay.style.width=e.innerWidth+"px";if(!!this.data.NEIGHBOURS){if(this.data.NEIGHBOURS.NEXT>0){this.nextLink.firstChild.style.right=parseInt((e.innerWidth-i.right)/2)+"px"}if(this.data.NEIGHBOURS.PREV>0){this.prevLink.firstChild.style.left=parseInt(i.left/2)+"px"}}};function u(t,e){var i="";if(t){for(var s=0,a=e.length;s<a;s++)i+=(s>0?"|":"")+e[s]+":"+(t[e[s]]?t[e[s]].valueOf():"null")}return i}function E(e,i){return e?'<div class="'+(i||"popup-window-hr")+'"><i></i></div>':t.create("DIV",{props:{className:i||"popup-window-hr"},html:"<i></i>"})}function _(e,i,s){var a=(e>0?e+t.message("JS_CORE_H")+" ":"")+(i>0?i+t.message("JS_CORE_M"):"")||s+t.message("JS_CORE_S");return"("+t.util.trim(a)+")"}function N(e,i,s){return'<span class="tm-popup-notice-time-hours"><span class="tm-popup-notice-time-number">'+e+'</span><span class="tm-popup-notice-time-unit">'+t.message("JS_CORE_H")+'</span></span><span class="tm-popup-notice-time-minutes"><span class="tm-popup-notice-time-number">'+i+'</span><span class="tm-popup-notice-time-unit">'+t.message("JS_CORE_M")+'</span></span><span class="tm-popup-notice-time-seconds"><span class="tm-popup-notice-time-number">'+s+'</span><span class="tm-popup-notice-time-unit">'+t.message("JS_CORE_S")+"</span></span>"}t.timer.registerFormat("worktime_timeman",_);t.timer.registerFormat("worktime_notice_timeman",N)})(); //# sourceMappingURL=core_timeman.map.js
/var/www/axolotl/data/www/axolotl.ru/www/bitrix/js/timeman/timemanager/core_timeman.min.js