<!DOCTYPE html>
<html lang="en" >
	<head>
		<meta charset="utf-8">
		<title>OpenRPA</title>
		<link rel="stylesheet" type="text/css" href="3rdParty/Semantic-UI-CSS-master/semantic.min.css">
		<script
		  src="3rdParty/jQuery/jquery-3.1.1.min.js"
		  crossorigin="anonymous"></script>
		<script src="3rdParty/Semantic-UI-CSS-master/semantic.min.js"></script>
		<script src="3rdParty/Handlebars/handlebars-v4.1.2.js"></script>
		  <script>
		  var mGlobal={}
		  $(document)
			.ready(function() {
			  // fix main menu to page on passing
			  $('.main.menu').visibility({
				type: 'fixed'
			  });
			  $('.overlay').visibility({
				type: 'fixed',
				offset: 80
			  });

			  // lazy load images
			  $('.image').visibility({
				type: 'image',
				transition: 'vertical flip in',
				duration: 500
			  });

			  // show dropdown on hover
			  $('.main.menu  .ui.dropdown').dropdown({
				on: 'hover'
			  });
			  
				function clone(obj) {
					var copy;

					// Handle the 3 simple types, and null or undefined
					if (null == obj || "object" != typeof obj) return obj;

					// Handle Date
					if (obj instanceof Date) {
						copy = new Date();
						copy.setTime(obj.getTime());
						return copy;
					}

					// Handle Array
					if (obj instanceof Array) {
						copy = [];
						for (var i = 0, len = obj.length; i < len; i++) {
							copy[i] = clone(obj[i]);
						}
						return copy;
					}

					// Handle Object
					if (obj instanceof Object) {
						copy = {};
						for (var attr in obj) {
							if (obj.hasOwnProperty(attr)) copy[attr] = clone(obj[attr]);
						}
						return copy;
					}
					throw new Error("Unable to copy obj! Its type isn't supported.");
				}
				//For data storage key
				mGlobal["DataStorage"] = {}
				
				String.prototype.replaceAll = function(search, replace){
					return this.split(search).join(replace);
				}
				mGlobal.GeneralGenerateHTMLCodeHandlebars=function(inInnerTemplateSelector,inData) {
					lHTMLTemplate=$(inInnerTemplateSelector)[0].innerHTML
					//console.log(lHTMLTemplate)
					//Компиляция
					var template = Handlebars.compile(lHTMLTemplate);
					//Вставка данных
					var lHTMLResult = template(inData);
					return lHTMLResult
				}
				mGlobal.GeneralGenerateHTMLCode=function(inTemplateHTMLSelector,inItemDictionary,inKeywordPrefix="::",inKeywordPostfix="::") {
					///Получить заготовку
					lTemplateHTMLCode=$(inTemplateHTMLSelector)[0].outerHTML
					///Определить ключь экранирования специальных ключевых слов
					///Выполнить циклические замены, если там есть пожходящие ключи
					lResultHTMLCode=lTemplateHTMLCode
					for(var lKey in inItemDictionary) { 
						lHTMLKey=inKeywordPrefix+lKey+inKeywordPostfix;
						lResultHTMLCode=lResultHTMLCode.replaceAll(lHTMLKey,inItemDictionary[lKey])
					}
					///Вернуть результат
					return lResultHTMLCode
				}
				//////////////////////////
				/////Info JS module
				//////////////////////////
				mGlobal.Info={};
				
				mGlobal.Info.TableActivityLogScheduleListRefresh=function() {

				}
				
				//////////////////////////
				/////Controller JS module
				//////////////////////////
				mGlobal.Controller={};
				mGlobal.Controller.CMDRunText=function(inCMDText) {
					///Подготовить конфигурацию
					lData = [
						{"Type":"CMDStart", "Command": inCMDText}
					]
					///Обнулить таблицу
					$.ajax({
						type: "POST",
						url: 'Utils/Processor',
						data: JSON.stringify(lData),
						success: 
						function(lData,l2,l3){},
						dataType: "text"
					});
				}
				mGlobal.Controller.CMDRun=function() {
					///Обнулить таблицу
					lCMDCode=$(".openrpa-controller-cmd-run-input")[0].value
					///Подготовить конфигурацию
					lData = [
						{"Type":"CMDStart", "Command": lCMDCode }
					]
					$.ajax({
						type: "POST",
						url: 'Utils/Processor',
						data: JSON.stringify(lData),
						success: 
						function(lData,l2,l3)
						{
							var lResponseJSON=JSON.parse(lData)
							///Отправить запрос на формирование таблицы
							//lHTMLCode=console.log("CMDRun result: "+lResponseJSON[0].result)
						},
						dataType: "text"
					});
				}
				mGlobal.Controller.CMDRunGUILogout=function() {
					///Обнулить таблицу
					lCMDCode="for /f \"skip=1 tokens=2\" %s in ('query user %USERNAME%') do (tscon  \\dest:console)"
					//lCMDCode = lCMDCode.replace(/\\n/g, "\\n")
                    //                  .replace(/\\'/g, "\\'")
                    //                  .replace(/\\"/g, '\\"')
                    //                  .replace(/\\&/g, "\\&")
                    //                  .replace(/\\r/g, "\\r")
                    //                  .replace(/\\t/g, "\\t")
                    //                  .replace(/\\b/g, "\\b")
                    //                  .replace(/\\f/g, "\\f")
					//				  .replace('"', "\\\"");
					///Подготовить конфигурацию
					lData = [
						{"Type":"CMDStart", "Command": lCMDCode }
					]
					$.ajax({
						type: "POST",
						url: 'Utils/Processor',
						data: JSON.stringify(lData),
						success: 
						function(lData,l2,l3)
						{
							var lResponseJSON=JSON.parse(lData)
							///Отправить запрос на формирование таблицы
							//lHTMLCode=console.log("CMDRun result: "+lResponseJSON[0].result)
						},
						dataType: "text"
					});
				}
				
				
				///Перезагрузить Orchestrator
				mGlobal.Controller.OrchestratorRestart=function() {
					///Подготовить конфигурацию
					lData = [
						{"Type":"OrchestratorRestart"}
					]
					$.ajax({
					  type: "POST",
					  url: 'Utils/Processor',
					  data: JSON.stringify(lData),
					  success: 
						function(lData,l2,l3)
						{
							var lResponseJSON=JSON.parse(lData)
						},
					  dataType: "text"
					});
				}
				
				//////////////////////////
				/////Monitor JS module
				//////////////////////////
				mGlobal.Monitor={};
				mGlobal.Monitor.ScreenshotModal={};
				mGlobal.Monitor.GenerateUniqueID=function(inPrefix="tempUID=") {
					return inPrefix+Math.round(Math.random()*1000)+"-"+Math.round(Math.random()*10000)+"-"+Math.round(Math.random()*1000)
				}
				//inHostURI: http://localhost:8081
				mGlobal.Monitor.ScreenshotModal.Show=function(inHostURI="	") {
					$('.ui.modal.daemon-screenshot').modal('show');
					
					//Функция обновления картинки
					lScreenshotUpdate=function() {
						lScreenshotSrc=inHostURI+"/GetScreenshot?"+mGlobal.Monitor.GenerateUniqueID()
						$(".daemon-screenshot img").attr('src', lScreenshotSrc);
					}
					
					mGlobal.Monitor.ScreenshotModal.timerId=setInterval(lScreenshotUpdate,1500)
				
				}
				mGlobal.Monitor.ScreenshotModal.Close=function() {
					clearInterval(mGlobal.Monitor.ScreenshotModal.timerId);
				}
				///Monitor
				mGlobal.Monitor.DaemonList={}
				mGlobal.Monitor.DaemonList.fRefreshTable=function() {
					///Загрузка данных
					$.ajax({
					  type: "GET",
					  url: 'Monitor/JSONDaemonListGet',
					  data: '',
					  success: 
						function(lData,l2,l3)
						{
							var lResponseJSON=JSON.parse(lData)
							///Сформировать HTML код новой таблицы
							lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-monitor-table-general",lResponseJSON)
							///Очистить дерево
							//mGlobal.ElementTree.fClear();
							///Прогрузить новую таблицу
							$(".openrpa-monitor").html(lHTMLCode)
						},
					  dataType: "text"
					});
				}
				////////////////////////////////
				///////Control panel
				///////////////////////////////
				///Refresh control panel
				mGlobal.Monitor.fControlPanelRefresh=function() {
					///Загрузка данных
					$.ajax({
					  type: "GET",
					  url: 'Monitor/ControlPanelDictGet',
					  data: '',
					  success: 
						function(lData,l2,l3)
						{
							var lResponseJSON=JSON.parse(lData)
							///Escape onclick
							/// RenderRobotList
							lResponseJSON["RenderRobotList"].forEach(
								function(lItem){
									if ('FooterButtonX2List' in lItem) {
										/// FooterButtonX2List
										lItem["FooterButtonX2List"].forEach(
											function(lItem2){
												if ('OnClick' in lItem) {
													lOnClickEscaped = lItem["OnClick"];
													lOnClickEscaped = lOnClickEscaped.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
													lItem["OnClick"] = lOnClickEscaped;
												}
											}
										);
										/// FooterButtonX1List
										lItem["FooterButtonX1List"].forEach(
											function(lItem2){
												if ('OnClick' in lItem) {
													lOnClickEscaped = lItem["OnClick"];
													lOnClickEscaped = lOnClickEscaped.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
													lItem["OnClick"] = lOnClickEscaped;
												}
											}
										);
									}
								}
							);
							///Сформировать HTML код новой таблицы
							lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-control-panel",lResponseJSON)
							//Присвоить ответ в mGlobal.Monitor.mResponseList
							mGlobal.Monitor.mResponseList = lResponseJSON
							///Set result in mGlobal.DataStorage
							lResponseJSON["RenderRobotList"].forEach(
								function(lItem){
									if ('DataStorageKey' in lItem) {
										mGlobal["DataStorage"][lItem['DataStorageKey']]=lItem
									}
								}
							)
							///Очистить дерево
							//mGlobal.ElementTree.fClear();
							///Прогрузить новую таблицу
							$(".openrpa-control-panel").html(lHTMLCode)
						},
					  dataType: "text"
					});
				}
				///
				mGlobal.Monitor.mControlPanelAutoUpdateSeconds=3;
				mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent=3;
				mGlobal.Monitor.fControlPanelAutoUpdateRun=function(inRefreshSeconds) {
					mGlobal.Monitor.mControlPanelAutoUpdateSeconds=inRefreshSeconds;
					//Функция обновления текста кнопки обновления
					lControlPanelUpdate=function() {
						mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent=mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent-1
						if (mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent==-1) {
							mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent=mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent=mGlobal.Monitor.mControlPanelAutoUpdateSeconds;
							mGlobal.Monitor.fControlPanelRefresh()
						}
						$(".openrpa-control-panel-general .openrpa-refresh-button").html("Refresh "+mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent);
					}
					mGlobal.Monitor.mControlPanelAutoUpdateTimerId=setInterval(lControlPanelUpdate,1000)
				}
				mGlobal.Monitor.fControlPanelRefresh()
				mGlobal.Monitor.fControlPanelAutoUpdateRun(3);
				////////////////////////////////
				/////// /Orchestrator/RobotRDPActive/ControlPanelDictGet
				///////////////////////////////
				mGlobal.RobotRDPActive = {}
				///Refresh control panel
				mGlobal.RobotRDPActive.fControlPanelRefresh=function() {
					///Загрузка данных
					$.ajax({
					  type: "GET",
					  url: 'Orchestrator/RobotRDPActive/ControlPanelDictGet',
					  data: '',
					  success:
						function(lData,l2,l3)
						{
							var lResponseJSON=JSON.parse(lData)
							///Сформировать HTML код новой таблицы
							lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-robotrdpactive-control-panel",lResponseJSON)
							//Присвоить ответ в mGlobal.RobotRDPActive.mResponseList
							mGlobal.RobotRDPActive.mResponseList = lResponseJSON
							///Прогрузить новую таблицу
							$(".openrpa-robotrdpactive-control-panel").html(lHTMLCode)
						},
					  dataType: "text"
					});
				}
				///
				mGlobal.RobotRDPActive.mControlPanelAutoUpdateSeconds=3;
				mGlobal.RobotRDPActive.mControlPanelAutoUpdateSecondsCurrent=3;
				mGlobal.RobotRDPActive.fControlPanelAutoUpdateRun=function(inRefreshSeconds) {
					mGlobal.RobotRDPActive.mControlPanelAutoUpdateSeconds=inRefreshSeconds;
					//Функция обновления текста кнопки обновления
					lControlPanelUpdate=function() {
						mGlobal.RobotRDPActive.mControlPanelAutoUpdateSecondsCurrent=mGlobal.RobotRDPActive.mControlPanelAutoUpdateSecondsCurrent-1
						if (mGlobal.RobotRDPActive.mControlPanelAutoUpdateSecondsCurrent==-1) {
							mGlobal.RobotRDPActive.mControlPanelAutoUpdateSecondsCurrent=mGlobal.RobotRDPActive.mControlPanelAutoUpdateSecondsCurrent=mGlobal.RobotRDPActive.mControlPanelAutoUpdateSeconds;
							mGlobal.RobotRDPActive.fControlPanelRefresh()
						}
						$(".openrpa-robotrdpactive-control-panel-general .openrpa-refresh-button").html("Refresh "+mGlobal.RobotRDPActive.mControlPanelAutoUpdateSecondsCurrent);
					}
					mGlobal.RobotRDPActive.mControlPanelAutoUpdateTimerId=setInterval(lControlPanelUpdate,1000)
				}
				mGlobal.RobotRDPActive.fControlPanelRefresh()
				mGlobal.RobotRDPActive.fControlPanelAutoUpdateRun(3);
				mGlobal.Test=function() {
					///Обнулить таблицу
					lData = [
						{ 
							"Type":"GlobalDictKeyListValueSet",
							"key_list":["Storage","Robot_R01"],
							"value":{
								"RunDateTimeString":"Test1",
								"StepCurrentName":"Test2",
								"StepCurrentDuration":"Test3"
							}
						}
					]
					$.ajax({
						type: "POST",
						url: 'Utils/Processor',
						data: JSON.stringify(lData),
						success: 
						function(lData,l2,l3)
						{
							//console.log(lData)
						},
						dataType: "text"
					});
				}
				
				///////////////////////////////
				///Scheduler functions
				///////////////////////////////
				
				mGlobal.Scheduler = {}
				mGlobal.Scheduler.ActivityTimeListShow = function() {
					lData = [
						{
							"Type":"GlobalDictKeyListValueGet",
							"KeyList":["Scheduler","ActivityTimeList"]
						}
					]
					$.ajax({
						type: "POST",
						url: 'Utils/Processor',
						data: JSON.stringify(lData),
						success: 
						function(lData,l2,l3)
						{
							var lResponseJSON=JSON.parse(lData)
							lResponseJSON[0]["Result"].forEach(function(lItem){lItem["processPathName"]=("processPath" in lItem ? lItem["processPath"] : lItem["processName"])})
							///Отправить запрос на формирование таблицы
							lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-info-table-planloglist",lResponseJSON[0]);
							///Установить HTML код
							$('.ui.modal.basic .content').html(lHTMLCode);
							$('.ui.modal.basic').modal('show');
						},
						dataType: "text"
					});
				}
				///////////////////////////////
				///Processor functions
				///////////////////////////////
				mGlobal.Processor = {}
				mGlobal.Processor.ServerValueAppend = function(inKeyList,inValue) {
					lData = [
						{
							"Type":"GlobalDictKeyListValueAppend",
							"KeyList": inKeyList,
							"Value": inValue
						}
					]
					///Обнулить таблицу
					$('.ui.modal.basic .content').html("");
					$.ajax({
						type: "POST",
						url: 'Utils/Processor',
						data: JSON.stringify(lData),
						success:
						function(lData,l2,l3)
						{
							var lResponseJSON=JSON.parse(lData)
							///TODO Show error if exist error
						},
						dataType: "text"
					});
				}
				mGlobal.Processor.ServerValueSet = function(inKeyList,inValue) {
					lData = [
						{
							"Type":"GlobalDictKeyListValueSet",
							"KeyList": inKeyList,
							"Value": inValue
						}
					]
					///Обнулить таблицу
					$('.ui.modal.basic .content').html("");
					$.ajax({
						type: "POST",
						url: 'Utils/Processor',
						data: JSON.stringify(lData),
						success: 
						function(lData,l2,l3)
						{
							var lResponseJSON=JSON.parse(lData)
							///TODO Show error if exist error
						},
						dataType: "text"
					});
				}
				mGlobal.Processor.ServerValueOperatorPlus = function(inKeyList,inValue) {
					lData = [
						{
							"Type":"GlobalDictKeyListValueOperator+",
							"KeyList": inKeyList,
							"Value": inValue
						}
					]
					///Обнулить таблицу
					$('.ui.modal.basic .content').html("");
					$.ajax({
						type: "POST",
						url: 'Utils/Processor',
						data: JSON.stringify(lData),
						success: 
						function(lData,l2,l3)
						{
							var lResponseJSON=JSON.parse(lData)
							///TODO Show error if exist error
						},
						dataType: "text"
					});
				}
				mGlobal.Processor.Send = function(inData) {
					lData = inData
					$.ajax({
						type: "POST",
						url: 'Utils/Processor',
						data: JSON.stringify(lData),
						success: 
						function(lData,l2,l3)
						{
							var lResponseJSON=JSON.parse(lData)
							///TODO Show error if exist error
						},
						dataType: "text"
					});
				}
				mGlobal.Processor.LogListShow = function() {
					lData = [
						{
							"Type":"GlobalDictKeyListValueGet",
							"KeyList":["Processor","LogList"]
						}
					]
					///Обнулить таблицу
					$('.ui.modal.basic .content').html("");
					$.ajax({
						type: "POST",
						url: 'Utils/Processor',
						data: JSON.stringify(lData),
						success: 
						function(lData,l2,l3)
						{
							var lResponseJSON=JSON.parse(lData)
							///Отправить запрос на формирование таблицы
							lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-info-table-activitylogschedulelist",lResponseJSON["actionListResult"][0]) 
							///Установить HTML код
							$('.ui.modal.basic .content').html(lHTMLCode);
							$('.ui.modal.basic').modal('show');
						},
						dataType: "text"
					});
				}
				mGlobal.Server= {}
				mGlobal.Server.JSONGet=function(inMethod, inURL, inDataJSON, inCallback)
				{
					$.ajax({
						type: inMethod,
						url: inURL,
						data: JSON.stringify(inDataJSON),
						success: 
						function(lData,l2,l3)
						{
							var lResponseJSON=JSON.parse(lData)
							inCallback(lResponseJSON)
						},
						dataType: "text"
					});
				}
				
				/////////////////
				///Modal
				///////////////////
				mGlobal.Modal={}
				/////////////////////////////////////////////////////
				mGlobal.Modal.TableFilter={}
				mGlobal.Modal.TableFilter.Show=function(inJSON) {
					//{
					//	"Title":"",	
					//	"Headers":["Header1","Header2"],
					//	"Rows": [["Cell1","Cell2"],["Cell2-1","Cell2-2"]],
					//	"FilterOnKeyUp": "<JS Code>" //Fill here in function
					//}
					//Set js handler to Search field
					inJSON["FilterOnKeyUp"]="mGlobal.Modal.TableFilter.FilterUpdate(this.value);"
					///Set value
					mGlobal.Modal.TableFilter.mDataJSON = inJSON
					//Render HTML
					lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-handlebar-template-table-filter",inJSON);
					///Установить HTML код
					$('.ui.modal.basic .content').html(lHTMLCode);
					$('.ui.modal.basic').modal('show');
					//DO widest modal for table with scroll x
					$("div.ui.basic.modal.transition.visible.active.scrolling")[0].style["width"]="1300px"
					$("div.ui.basic.modal.transition.visible.active.scrolling")[0].style["overflow"]="scroll"
				}
				//Service function
				mGlobal.Modal.TableFilter.FilterUpdate=function(inFilterValue) {
					//Get JSON, apply filter, clone data
					lDataJSON = clone(mGlobal.Modal.TableFilter.mDataJSON)
					delete lDataJSON["Rows"]
					lDataJSON["Rows"]=[]
					//Filter code [any occurence in the row is ok for push! ]
					mGlobal.Modal.TableFilter.mDataJSON["Rows"].forEach(
						function(inElement) {
							lFlagElementAppend = false
							inElement.forEach(
								function(inElement2) {
									if (String(inElement2).includes(inFilterValue)) {
										lFlagElementAppend = true
									}
								}
							)
							if (lFlagElementAppend) {
								lDataJSON["Rows"].push(inElement)
							}
						}
					)
					//Clear Filter Title property (fixed in html)
					delete lDataJSON["FilterOnKeyUp"]
					delete lDataJSON["Title"]
					//Search the table element [replace only table html]
					lElement = $('.ui.modals.active .content table.table')[0]
					lElementParentElement = lElement.parentNode
					lElement.parentNode.removeChild(lElement);
					//Render HTML
					lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-handlebar-template-table-filter",lDataJSON);
					///Установить HTML код
					lElementParentElement.insertAdjacentHTML("beforeend",lHTMLCode);
				}
				/////////////////////////////////////////////////////////////
				mGlobal.Modal.ListFilter={}
				mGlobal.Modal.ListFilter.Show=function(inJSON) {
					//{
					//	"Title":"",	
					//	"List":[{"Header":"","Description":""}],
					//	"FilterOnKeyUp": "<JS Code>" //Fill here in function
					//}
					//Set js handler to Search field
					inJSON["FilterOnKeyUp"]="mGlobal.Modal.ListFilter.FilterUpdate(this.value);"
					///Set value
					mGlobal.Modal.ListFilter.mDataJSON = inJSON
					//Render HTML
					lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-handlebar-template-list-filter",inJSON);
					///Установить HTML код
					$('.ui.modal.basic .content').html(lHTMLCode);
					$('.ui.modal.basic').modal('show');
				}
				//Service function
				mGlobal.Modal.ListFilter.FilterUpdate=function(inFilterValue) {
					//Get JSON, apply filter, clone data
					lDataJSON = clone(mGlobal.Modal.ListFilter.mDataJSON)
					delete lDataJSON["List"]
					lDataJSON["List"]=[]
					//Filter code [any occurence in the row is ok for push! ]
					mGlobal.Modal.ListFilter.mDataJSON["List"].forEach(
						function(inElement) {
							lFlagElementAppend = false
							if (String(inElement["Header"]).includes(inFilterValue)) {
								lFlagElementAppend = true
							}
							if (String(inElement["Description"]).includes(inFilterValue)) {
								lFlagElementAppend = true
							}
							if (lFlagElementAppend) {
								lDataJSON["List"].push(inElement)
							}
						}
					)
					//Clear Filter Title property (fixed in html)
					delete lDataJSON["FilterOnKeyUp"]
					delete lDataJSON["Title"]
					//Search the table element [replace only table html]
					lElement = $('.ui.modals.active .content div.ui.inverted.segment')[0]
					lElementParentElement = lElement.parentNode
					lElement.parentNode.removeChild(lElement);
					//Render HTML
					lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-handlebar-template-list-filter",lDataJSON);
					///Установить HTML код
					lElementParentElement.insertAdjacentHTML("beforeend",lHTMLCode);
				}
			})
		  ;
		  </script>

		  <style type="text/css">
		  body {
			background-color: #FFFFFF;
		  }
		  .main.container {
			margin-top: 2em;
		  }
		  .overlay {
			float: left;
			margin: 0em 3em 1em 0em;
		  }
		  .overlay .menu {
			position: relative;
			left: 0;
			transition: left 0.5s ease;
		  }
		  .main.menu.fixed {
			background-color: #FFFFFF;
			border: 1px solid #DDD;
			box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.2);
		  }
		  .overlay.fixed .menu {
			left: 800px;
		  }
		  .text.container .left.floated.image {
			margin: 2em 2em 2em -4em;
		  }
		  .text.container .right.floated.image {
			margin: 2em -4em 2em 2em;
		  }
		  .ui.footer.segment {
			margin: 5em 0em 0em;
			padding: 5em 0em;
		  }
		  </style>
	</head>
	<body>
		<div class="ui internally celled grid">
			<div class="row black">
				<div class="three wide column">
					<h1 class="ui header inverted">OpenRPA</h1>
				</div>
				<div class="eleven wide column">
					<h1 class="ui header inverted">Orchestrator Web GUI</h1>
				</div>
				<div class="two wide column">
					<h5>by Ivan Maslov</h5>
				</div>
				
			</div>
			<div class="row">
				<div class="sixteen wide column openrpa-control-panel-general" >
					<h4 class="ui horizontal divider header">
						<i class="clipboard list icon"></i>
						Dashboard (Robot control panel)
					</h4>
					<div class="ui info message">
						<button class="ui icon button labeled" onclick="mGlobal.Monitor.fControlPanelRefresh();">
							<i class="sync alternate icon"></i>
							<div class="openrpa-refresh-button">Refresh</div>
						</button>
					</div>
					<div class="openrpa-control-panel"></div>
					<script class="openrpa-hidden-control-panel" style="display:none" type="text/x-handlebars-template">
						<div class="ui cards">
							{{#RenderRobotList}}
							<div class="card">
								<div class="content">
									<div class="right floated mini ui ">
										{{{HeaderRightText}}}
									</div>
									<div class="header">
										{{{HeaderLeftText}}}
										
									</div>
									<div class="meta">
										{{{SubheaderText}}}
									</div>
									<div class="description">
										<ul style="padding-inline-start:16px;margin:0px">
											{{#BodyKeyValueList}}
											<li>{{{Key}}}: {{{Value}}}</li>
											{{/BodyKeyValueList}}
										</ul>
									</div>
								</div>
								<div class="extra content">
									{{{FooterText}}}
								</div>
								<div class="extra content">
									<div class="ui two buttons">
									{{#FooterButtonX2List}}
										<div class="ui basic {{Color}} button" onclick="{{OnClick}}">{{{Text}}}</div>
									{{/FooterButtonX2List}}
									</div>
									<div class="ui horizontal divider">Add. controls</div>
									<div class="ui one buttons">
									{{#FooterButtonX1List}}
										<div class="ui basic {{Color}} button" onclick="{{OnClick}}">{{{Text}}}</div>
									{{/FooterButtonX1List}}
									</div>
								</div>
							</div>
							{{/RenderRobotList}}
						</div>
					</script>
				</div>
			</div>
			<div class="row black">
				<div class="five wide column">
					<h2 class="ui header inverted">Controls</h2>
				</div>
				<div class="two wide column">
					<h2 class="ui header inverted">...</h2>
				</div>
				<div class="nine wide column">
					<h2 class="ui header inverted">Robot RDP active list</h2>
				</div>
				
			</div>
			<div class="row">
				<div class="five wide column">
					<button class="ui labeled icon button" onclick="mGlobal.Monitor.ScreenshotModal.Show();">
						<i class="desktop icon"></i>
						Look machine screenshot
					</button>
					<button class="ui labeled icon button red" onclick="mGlobal.Controller.OrchestratorRestart();">
						<i class="redo icon"></i>
						Restart Orchestrator
					</button>
					<button class="ui labeled icon button" onclick="mGlobal.Scheduler.ActivityTimeListShow();">
						<i class="info icon"></i>
						Scheduler activity time list
						<script class="openrpa-hidden-info-table-planloglist" style="display:none" type="text/x-handlebars-template">
									<table class="ui celled table">
										<thead>
											<tr>
												<th>#</th>
												<th>Activity type</th>
												<th>Time</th>
												<th>Process path/Process name</th>
											</tr>
										</thead>
										<tbody>
											{{#Result}}
											<tr>
												<td>{{@index}}</td>
												<td>{{TimeHH:MM}}{{TimeHH:MMStart}}</td>
												<td>{{TimeHH:MMStop}}</td>
												<td>{{Activity}}</td>
											</tr>
											{{/Result}}
										</tbody>
									</table>
								</script>
					</button>
					<button class="ui labeled icon button" onclick="mGlobal.Processor.LogListShow();">
						<i class="info icon"></i>
						Processor logs
						<script class="openrpa-hidden-info-table-activitylogschedulelist" style="display:none" type="text/x-handlebars-template">
							<table class="ui celled table">
								<thead>
									<tr>
										<th>#</th>
										<th>Activity type</th>
										<th>Process</th>
										<th>Activity DateTime plan</th>
										<th>Activity DateTime fact</th>
									</tr>
								</thead>
								<tbody>
									{{#result}}
									<tr>
										<td>{{@index}}</td>
										<td>{{activityType}}</td>
										<td>{{processPath}}</td>
										<td>{{activityDateTime}}</td>
										<td class="negative
										">{{activityStartDateTime}}</td>
									</tr>
									{{/result}}
								</tbody>
							</table>
						</script>
					</button>

					<script class="openrpa-hidden-monitor-table-general" style="display:none" type="text/x-handlebars-template">
						<table class="ui celled table">
							<thead>
								<tr>
									<th>Machine name</th>
									<th>Machihe host</th>
									<th>Status</th>
									<th>Actions,length: {{childs.length}}</th>
								</tr>
							</thead>
							<tbody>
								{{#ListenURLList}}
								<tr><td>{{Description}}</td><td>{{URL}}</td><td class="negative">None</td></tr>
								{{/ListenURLList}}
							</tbody>
						</table>
					</script>

					<script class="openrpa-handlebar-template-table-filter" style="display:none" type="text/x-handlebars-template">
						{{#if Title}}
						<h1>{{{Title}}}</h1>
						{{/if}}
						{{#if FilterOnKeyUp}}
						<div class="ui icon input search" style="width:500px;">
							<input type="text" onkeyup="{{#if FilterOnKeyUp}}{{{FilterOnKeyUp}}}{{/if}}" placeholder="Search...">
							<i class="inverted circular search link icon"></i>
						</div>
						{{/if}}
						<table class="ui celled table selectable inverted">
							<thead>
								<tr>
									{{#Columns}}
									<th>{{{this}}}</th>
									{{/Columns}}
								</tr>
							</thead>
							<tbody>
								{{#Rows}}
								<tr>
									{{#this}}
									<td>
										{{{this}}}
									</td>
									{{/this}}
								</tr>
								{{/Rows}}
							</tbody>
						</table>
					</script>
					<script class="openrpa-handlebar-template-list-filter" style="display:none" type="text/x-handlebars-template">
						{{#if Title}}
						<h1>{{{Title}}}</h1>
						{{/if}}
						{{#if FilterOnKeyUp}}
						<div class="ui icon input search" style="width:500px;">
							<input type="text" onkeyup="{{#if FilterOnKeyUp}}{{{FilterOnKeyUp}}}{{/if}}" placeholder="Search...">
							<i class="inverted circular search link icon"></i>
						</div>
						{{/if}}
						<div class="ui inverted segment">
							<div class="ui inverted relaxed divided list">
								{{#List}}
								<div class="item">
									<i class="map marker icon"></i>
									<div class="content">
										<a class="header">{{{Header}}}</a>
										<div class="description">{{{Description}}}</div>
									</div>
								</div>
								{{/List}}
							</div>
						</div>
					</script>
				</div>
				<div class="two wide column">
				</div>
				<div class="nine wide column openrpa-robotrdpactive-control-panel-general">
					<div class="ui info message">
						<button class="ui icon button labeled " onclick="mGlobal.RobotRDPActive.fControlPanelRefresh();">
							<i class="sync alternate icon"></i>
							<div class="openrpa-refresh-button">Refresh</div>
						</button>
					</div>
					<div class="openrpa-robotrdpactive-control-panel"></div>
					<script class="openrpa-hidden-robotrdpactive-control-panel" style="display:none" type="text/x-handlebars-template">
						<div class="ui inverted segment">
							<div class="ui inverted relaxed divided list">
								{{#DataList}}
								<div class="item">
									<div class="right floated content">
										<div class="ui button" onclick="mGlobal.Processor.ServerValueAppend(['RobotRDPActive','ActivityList'],{'DefNameStr': 'RDPSessionReconnect', 'ArgList': [], 'ArgDict': {'inRDPSessionKeyStr': '{{{SessionKeyStr}}}'} })" >Reconnect</div>
									</div>
									<div class="right floated content">
										{{#if IsIgnoredBool}}
										<div class="ui button red" onclick="mGlobal.Processor.ServerValueSet(['RobotRDPActive','RDPList','{{{SessionKeyStr}}}','SessionIsIgnoredBool'],false);">Ignore</div>
										{{else}}
										<div class="ui button" onclick="mGlobal.Processor.ServerValueSet(['RobotRDPActive','RDPList','{{{SessionKeyStr}}}','SessionIsIgnoredBool'],true);">Ignore</div>
										{{/if}}
									</div>
									<div class="right floated content">
										{{#if IsFullScreenBool}}
										<div class="ui button green" onclick="mGlobal.Processor.ServerValueSet(['RobotRDPActive','FullScreenRDPSessionKeyStr'],null);">Full screen</div>
										{{else}}
										<div class="ui button" onclick="mGlobal.Processor.ServerValueSet(['RobotRDPActive','FullScreenRDPSessionKeyStr'],'{{{SessionKeyStr}}}');">Full screen</div>
										{{/if}}
									</div>
									<div class="content">
										<div class="header">Session key: {{{SessionKeyStr}}}</div>
										{{{SessionHexStr}}}
									</div>
								</div>
								{{/DataList}}
							</div>
						</div>
					</script>
				</div>
			</div>


			<div class="row openrpa-monitor">

			</div>
			<div class="row black">
				


			</div>
		</div>
		<div class="ui inverted vertical footer segment">
			<div class="ui center aligned container">
			  <div class="ui stackable inverted divided grid">
				<div class="three wide column">
				  <h4 class="ui inverted header">Pywinauto</h4>
				  <div class="ui inverted link list">
					<a href="https://pywinauto.readthedocs.io/en/latest/code/pywinauto.findwindows.html" class="item" target="_blank">Specification manual</a>
					<a href="https://pywinauto.readthedocs.io/en/latest/code/code.html#main-user-modules" class="item" target="_blank">Classes manual</a>
					<a href="https://pywinauto.readthedocs.io/en/latest/code/code.html#main-user-modules" class="item" target="_blank">How to use manual</a>
					<a href="https://pywinauto.readthedocs.io/en/latest/code/pywinauto.base_wrapper.html" class="item" target="_blank">Base wrapper manual</a>
				  </div>
				</div>
				<div class="three wide column">
				  <h4 class="ui inverted header">Semantic UI</h4>
				  <div class="ui inverted link list">
					<a href="https://semantic-ui.com/usage/theming.html" class="item" target="_blank">Color manual</a>
					<a href="https://semantic-ui.com/elements/input.html" class="item" target="_blank">Input manual</a>
					<a href="https://semantic-ui.com/elements/icon.html" class="item" target="_blank">Icon list</a>
					<a href="https://semantic-ui.com/elements/button.html" class="item" target="_blank">Button manual</a>
				  </div>
				</div>
				<div class="three wide column">
				  <h4 class="ui inverted header">GitLab</h4>
				  <div class="ui inverted link list">
					<a href="https://gitlab.com/UnicodeLabs/OpenRPA" class="item" target="_blank">OpenRPA repository</a>
					<a href="https://gitlab.com/UnicodeLabs" class="item" target="_blank">UnicodeLabs</a>
					<a href="#" class="item">Link -</a>
					<a href="#" class="item">Link -</a>
				  </div>
				</div>
				<div class="seven wide column">
				  <h4 class="ui inverted header">OpenRPA</h4>
				  <p>Open source Robotic Process Automation software by the Unicode Labs (Created by Ivan Maslov). Under the MIT license.</p>
				</div>
			  </div>
			  <div class="ui inverted section divider"></div>
			  <div class="ui horizontal inverted small divided link list">
				<a class="item" href="#">Site Map</a>
				<a class="item" href="#">Contact Us</a>
				<a class="item" href="#">Terms and Conditions</a>
				<a class="item" href="#">Privacy Policy</a>
			  </div>
			</div>
		</div>
		<div class="ui basic modal">
			<div class="ui icon header">
			</div>
			<div class="content">
				<p>Here is the message text!</p>
			</div>
			<div class="actions">
				<div class="ui red basic cancel inverted button">
					<i class="remove icon"></i>
					No
				</div>
				<div class="ui green ok inverted button">
					<i class="checkmark icon"></i>
					Yes
				</div>
			</div>
		</div>
		<div class="ui daemon-screenshot modal">
			<div class="ui icon header">
			</div>
			<div class="content">
				<img src="GetScreenshot" class="ui fluid image">
				<div class="ui fluid action input">
					<input class="openrpa-controller-cmd-run-input" type="text" placeholder="CMD Code...">
					<div class="ui button" onclick="mGlobal.Controller.CMDRun();">Run!</div>
					<div class="ui button" onclick="mGlobal.Controller.CMDRunGUILogout();">GUI Logout</div>
				</div>
			</div>
			<div class="actions">
				<div class="ui green ok inverted button" onclick="mGlobal.Monitor.ScreenshotModal.Close()">
					<i class="checkmark icon"></i>
					Close
				</div>
				
			</div>
		</div>
		
		<div class="ui modal openrpa-code-list-gui-import-modal">
			<i class="close icon"></i>
			<div class="header">
			Code list import
			</div>
			<div class="content">
				<div class="description">
					<div class="ui header">Insert your JSON specification here.</div>
					<p><textarea style="width:100%" rows="6" cols="60"></textarea></p>
				</div>
			</div>
			<div class="actions">
				<div class="ui black deny button">
					Cancel
				</div>
				<div class="ui positive right labeled icon button" onclick="mGlobal.CodeList.fActionSpecificationImportFromJSON();">
					Parse
					<i class="checkmark icon"></i>
				</div>
			</div>
		</div>
	</body>
</html>

