$MWGUI.RegisterLanguageString("STEInboundCallPopup", {"en":"Inboun Call from line", "it":"Chiamata in ingresso dalla linea"}); $MWGUI.RegisterLanguageString("AcceptCall", {"en":"Accept", "it":"Rispondi"}); $MWGUI.RegisterLanguageString("RejectCall", {"en":"Reject", "it":"Rifiuta"}); $MWGUI.RegisterLanguageString("NamePhoneNumber", {"en":"Name", "it":"Nominativo"}); $MWGUI.RegisterLanguageString("PhoneNumber", {"en":"Phone Number", "it":"Numero di telefono"}); $MWGUI.RegisterLanguageString("STECallerInfo", {"en":"Info", "it":"Informazioni"}); $MWGUI.RegisterLanguageString("STECallerName", {"en":"Name", "it":"Nome"}); $MWGUI.RegisterLanguageString("STECallerLastName", {"en":"LastName", "it":"Cognome"}); $MWGUI.RegisterLanguageString("ConfirmButton", {"en":"Confirm", "it":"Conferma"}); $MWGUI.RegisterLanguageString("STECallerMessage", {"en":"Enter the name and surname of the caller", "it":"Inserisci nome e cognome del chiamante"}); $MWGUI.RegisterLanguageString("STESearchSiteInfo", {"en":"Search Site", "it":"Cerca Sito"}); $MWGUI.RegisterLanguageString("InfoSTE", {"en":"Info STE", "it":"Info STE"}); $MWGUI.RegisterLanguageString("DashBoardSTE", {"en":"Dashboard STE", "it":"Dashboard STE"}); $MWGUI.RegisterLanguageString("STETitleInfo", {"en":"STE Detail", "it":"Dettagli STE"}); $MWGUI.RegisterLanguageString("DisplayName", {"en":"Name: ", "it":"Nome: "}); $MWGUI.RegisterLanguageString("StatusLabel", {"en":"Status: ", "it":"Stato: "}); $MWGUI.RegisterLanguageString("CategoryAgent", {"en":"Agent", "it":"Operatore"}); $MWGUI.RegisterLanguageString("ButtonGroup", {"en":"Operations", "it":"Funzionalita'"}); $MWGUI.RegisterLanguageString("ButtonPause", {"en":"Pause", "it":"Pausa"}); $MWGUI.RegisterLanguageString("ButtonOffline", {"en":"Offline", "it":"Disconetti"}); $MWGUI.RegisterLanguageString("StatusTime", {"en":"Status Time", "it":"Durata Stato"}); $MWGUI.RegisterLanguageString("ButtonRestore", {"en":"Return Available", "it":"Ritorna Disponibile"}); $MWGUI.RegisterLanguageString("STEInstanceLabel", {"en":"Instance STE", "it":"Centralino STE"}); $MWGUI.RegisterLanguageString("SearchSiteConfirm", {"en":"Confirm", "it":"Conferma"}); $MWGUI.RegisterLanguageString("InstanceName", {"en":"Line from", "it":"Linea ingresso"}); $MWGUI.RegisterLanguageString("ErrorMsgTitle",{"en":"Error","it":"Errore"}); $MWGUI.RegisterLanguageString("ErrorMsgBody",{"en":"There is an error on the function","it":"C'è un errore nella funzione"}); $MWGUI.RegisterLanguageString("ErrorMsgBodyUpdateStatus",{"en":"There is an error on the function status","it":"C'è un errore nella funzione"}); $MWGUI.RegisterLanguageString("ErrorMsgBodyProcessFlow",{"en":"There is an error on the process flow load","it":"C'è un errore nella funzione"}); $MWGUI.RegisterLanguageString("ErrorMsgBodygetUserData",{"en":"There is an error on the function user","it":"C'è un errore nella funzione"}); $MWGUI.RegisterLanguageString("ErrorMsgBodygetAgentList",{"en":"There is an error on the function agent list","it":"C'è un errore nella funzione"}); $MWGUI.RegisterLanguageString("ErrorMsgStartSTE",{"en":"Error in connect credential","it":"C'è un errore nelle credenziali di accesso al centralino"}); $MWGUI.RegisterLanguageString("MessageButtonOK",{"en":"Ok","it":"Ok"}); $MWGUI.RegisterLanguageString("STEConnectCredential",{"en":"Insert Active Directory credential","it":"Inserisci Credenziali Active Directory"}); $MWGUI.RegisterLanguageString("Username",{"en":"Username","it":"Username"}); $MWGUI.RegisterLanguageString("Password",{"en":"Password","it":"Password"}); $MWGUI.RegisterLanguageString("ADInsert",{"en":"Insert","it":"Inserisci"}); $MWGUI.RegisterLanguageString("STEMissedSplash",{"en":"Missed Call from ","it":"Chiamata Persa da "}); $MWGUI.RegisterLanguageString("UnknowStatus",{"en":"Unknow status","it":"Stato sconosciuto"}); $MWGUI.RegisterLanguageString("Available",{"en":"Available","it":"Disponibile"}); $MWGUI.RegisterLanguageString("Offline",{"en":"Offline","it":"Disconnesso"}); $MWGUI.RegisterLanguageString("Busy",{"en":"Busy","it":"Occupato"}); $MWGUI.RegisterLanguageString("AfterCallWork",{"en":"AfterCallWork","it":"Fine chiamata"}); $MWGUI.RegisterLanguageString("CallingCustomer",{"en":"CallingCustomer","it":"Chiamo il cliente"}); $MWGUI.RegisterLanguageString("Dialing",{"en":"Dialing","it":"Compongo il numero"}); $MWGUI.RegisterLanguageString("Init",{"en":"Init","it":"Avvio"}); $MWGUI.RegisterLanguageString("Joining",{"en":"Joining","it":"Collegamento"}); $MWGUI.RegisterLanguageString("PendingAvailable",{"en":"PendingAvailable","it":"In attesa disponibile"}); $MWGUI.RegisterLanguageString("PendingBusy",{"en":"PendingBusy","it":"in attesa occupato"}); $MWGUI.RegisterLanguageString("Missed",{"en":"Missed Call","it":"Chiamata Persa"}); $MWGUI.RegisterLanguageString("error",{"en":"Error","it":"Errore"}); $MWGUI.RegisterLanguageString("STE-Info",{"en":"Info","it":"Generale"}); $MWGUI.RegisterLanguageString("STE-LogBook",{"en":"LogBook","it":"Giornale"}); $MWGUI.RegisterLanguageString("STE-Outbound",{"en":"Outbound","it":"Telefona"}); $MWGUI.RegisterLanguageString("EmptyReadBook",{"en":"There are no activities today","it":"Non ci sono attività oggi"}); $MWGUI.RegisterLanguageString("STE_LogBookTable_Instance",{"en":"Instance","it":"Istanza"}); $MWGUI.RegisterLanguageString("STE_LogBookTable_TypeCall",{"en":"Type","it":"Tipo"}); $MWGUI.RegisterLanguageString("STE_LogBookTable_PhoneNumber",{"en":"Phone","it":"Telefono"}); $MWGUI.RegisterLanguageString("STE_LogBookTable_Business",{"en":"Business Name","it":"Ragione Sociale"}); $MWGUI.RegisterLanguageString("STE_LogBookTable_Address",{"en":"Address","it":"Indirizzo"}); $MWGUI.RegisterLanguageString("STE_LogBookTable_Office",{"en":"Office","it":"Sede Legale"}); $MWGUI.RegisterLanguageString("STE_LogBookTable_Start",{"en":"Start","it":"Inizio"}); $MWGUI.RegisterLanguageString("STE_LogBookTable_End",{"en":"End","it":"Fine"}); $MWGUI.RegisterLanguageString("STE_LogBookTable_Duration",{"en":"Duration","it":"Durata"}); $MWGUI.RegisterLanguageString("STE_LogBookTable_Caller",{"en":"Caller","it":"Chiamante"}); $MWGUI.RegisterLanguageString("STE_LogBookTable_Audio",{"en":"Audio","it":"Audio"}); $MWGUI.RegisterLanguageString("STE_OKCall",{"en":"OK","it":"OK"}); $MWGUI.RegisterLanguageString("STE_ErrorCall",{"en":"Error","it":"Errore"}); $MWGUI.RegisterLanguageString("STE_MissedCall",{"en":"Missed","it":"Persa"}); $MWGUI.RegisterLanguageString("STE_RefuseACall",{"en":"Refuse Agent","it":"Rifiuto Operatore"}); $MWGUI.RegisterLanguageString("STE_RefuseCCall",{"en":"Refuse Customer","it":"Rifiuto Cliente"}); $MWGUI.RegisterLanguageString("STE_ListenRecording",{"en":"Listen audio call","it":"Ascolta audio telefonata"}); $MWGUI.RegisterLanguageString("MediaDeviceGroup",{"en":"Config Media Device","it":"Configura dispositivi multimediali"}); $MWGUI.RegisterLanguageString("LabelCfgMicrophone",{"en":"Microphone","it":"Microfono"}); $MWGUI.RegisterLanguageString("LabelCfgSpeaker",{"en":"Speaker","it":"Altoparlanti"}); $MWGUI.RegisterLanguageString("LabelCfgRinger",{"en":"Ringer","it":"Suoneria"}); $MWGUI.RegisterLanguageString("STEAssociateInfo",{"en":"Associate phone number","it":"Associa numero di telefono"}); $MWGUI.RegisterLanguageString("CustomerButtonAssociate",{"en":"Customer","it":"Cliente"}); $MWGUI.RegisterLanguageString("CatButtonAssociate",{"en":"T.A.C","it":"C.A.T"}); $MWGUI.RegisterLanguageString("OtherButtonAssociate",{"en":"Other","it":"Altro"}); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.InstanceListSTE { align-items: center; justify-content: flex-start; background-color: var(--group-row-background); min-width: 100%; width: 100%; max-width: 100%; min-height: var(--resgui-1row); height: var(--resgui-1row); max-height: var(--resgui-1row); box-sizing: border-box; -moz-box-sizing: border-box, -webkit-box-sizing: border-box; border-bottom: 1px solid var(--main-gb-color); cursor:pointer;}'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.InstanceListSTE:hover{ background: var(--group-header-background-hover); transition: background-color 0.3s linear; }'; document.getElementsByTagName('head')[0].appendChild(style); function MWSTE() { this.LambdaFunctionDictionary = { "UpdateAgentStatus" : { "SMARTGRID" : "ServerLessSTE-UpdateAgentStatus-FcVXQ4GHwsom" }, "getUserData" : { "SMARTGRID" : "ServerLessSTE-getUserData-Fd9onW2ox7sg" }, "getAgentsList" : { "SMARTGRID" : "ServerLessSTE-getAgentsList-BA5Q9DBnCjAY" } }; this.ConnectInstances=[]; this.ResponseCustomBox ; this.DisplayCustomBox ; this.SelectInstance = null; this.RotateInterval; this.EndPoints = ["SMARTGRID"]; this.EndPointsWS = [{"EndPoint":"SMARTGRID", "EndPointWS": "MOSAICOWORLD"}]; this.STEAwsConfig = [{"Instance":"SG365", "BucketS3Recording": "mwstesg365", "EndpointRegion":"eu-central-1"}]; this.ListAgents = {}; this.LogBook = []; this.DeviceList = {}; this.DeviceList.AudioIn = []; this.DeviceList.AudioOut = []; var Me = this; var TimeoutLogin ; var DBInstances = []; var receiveMessage = function(event) { console.log(event); ObjResult = JSON.parse(event.data); if(ObjResult.contex == "InfoLogin") console.log(ObjResult.Message); if(ObjResult.contex == "LoginSTE") if(ObjResult.status == "Fail") { console.log(ObjResult.Message); Me.RemoveCCP("LoginSaml-" + ObjResult.ID); } } window.addEventListener("message", receiveMessage, true); this.GetDateISOFormat = function(DateToWork, format) { // UTC let MonthUTC; if(DateToWork.getUTCMonth() + 1 <= 9) MonthUTC = "0" + (DateToWork.getUTCMonth() + 1); else MonthUTC = DateToWork.getUTCMonth() + 1; let DayUTC; if(DateToWork.getUTCDate() <= 9) DayUTC = "0" + DateToWork.getUTCDate(); else DayUTC = DateToWork.getUTCDate(); let HoursUTC; if(DateToWork.getUTCHours() <= 9) HoursUTC = "0" + DateToWork.getUTCHours(); else HoursUTC = DateToWork.getUTCHours(); let MinutesUTC; if(DateToWork.getUTCMinutes() <= 9) MinutesUTC = "0" + DateToWork.getUTCMinutes(); else MinutesUTC = DateToWork.getUTCMinutes(); let SecondsUTC; if(DateToWork.getUTCSeconds() <= 9) SecondsUTC = "0" + DateToWork.getUTCSeconds(); else SecondsUTC = DateToWork.getUTCSeconds(); // LOCAL let Month; if(DateToWork.getMonth() + 1 <= 9) Month = "0" + (DateToWork.getMonth() + 1); else Month = DateToWork.getMonth() + 1; let Day; if(DateToWork.getDate() <= 9) Day = "0" + DateToWork.getDate(); else Day = DateToWork.getDate(); let Hours; if(DateToWork.getHours() <= 9) Hours = "0" + DateToWork.getHours(); else Hours = DateToWork.getHours(); let Minutes; if(DateToWork.getMinutes() <= 9) Minutes = "0" + DateToWork.getMinutes(); else Minutes = DateToWork.getMinutes(); let Seconds; if(DateToWork.getSeconds() <= 9) Seconds = "0" + DateToWork.getSeconds(); else Seconds = DateToWork.getSeconds(); let stringDate = DateToWork.toString(); stringDate = stringDate.slice(stringDate.indexOf('GMT')); let ResultDate ; switch(format) { case "TimeSpanUTC" : { ResultDate = DateToWork.getFullYear() + "-" + MonthUTC + "-" + DayUTC + "T" + HoursUTC + ":" + MinutesUTC + ":" + SecondsUTC; break; } case "TimeSpanLocal" : { ResultDate = DateToWork.getFullYear() + "-" + Month + "-" + Day + "T" + Hours + ":" + Minutes + ":" + Seconds; break; } case "LocalFuse": { ResultDate = stringDate; break; } case "Print-it": { ResultDate = Day+ "-" + Month + "-" + DateToWork.getFullYear() + " " + Hours + ":" + Minutes + ":" + Seconds; break; } case "Print-en": { ResultDate = DateToWork.getFullYear() + "-" + Month + "-" + Day + " " + Hours + ":" + Minutes + ":" + Seconds; break; } } return ResultDate; } this.GetDuration = function(dateStart,DateEnd) { let difference = DateEnd.getTime() - dateStart.getTime(); let days = Math.floor(difference/1000/60/60/24); difference -= days*1000*60*60*24 let hours = Math.floor(difference/1000/60/60); difference -= hours*1000*60*60 let minutes = Math.floor(difference/1000/60); difference -= minutes*1000*60 var seconds = Math.floor(difference/1000); hours = (hours < 10) ? "0" + hours : hours; minutes = (minutes < 10) ? "0" + minutes : minutes; seconds = (seconds < 10) ? "0" + seconds : seconds; return hours + ":" + minutes + ":" + seconds ; } function Agent() { var MeAgent = this; this.StatusInterval ; this.getCCPInstance = function(id) { SearchInstance = Me.ConnectInstances.findIndex(x => x.CCP_MW.InstanceID == id); if(SearchInstance > -1) return Me.ConnectInstances[SearchInstance]; else return null } this.onInit = function(cn) { /* if(cn) if(cn.CCP_MW) if(cn.CCP_MW.CurrentState) if(cn.CCP_MW.CurrentState == "Busy") Me.CCPContact.EndCall(cn); else MeAgent.setAgentAvailable(cn);*/ MeAgent.setAgentAvailable(cn); MeAgent.getUserData(cn); MeAgent.ReadLogBook(cn, 0, 20); Me.MWUserDisplay.Start(); //Me.CreateCallerForm(); } this.onStateChange = function(id,state) { var instance = MeAgent.getCCPInstance(id); if(instance != null) { instance.CCP_MW.CurrentState = state.newState; if(state.newState=="FailedConnectAgent") instance.CCP_MW.ContactInfo.RefuseAgent = true; if(state.newState=="FailedConnectCustomer") instance.CCP_MW.ContactInfo.RefuseCustomer = true; MeAgent.RefreshInfo(); MeAgent.UpdateAgentStatus(instance); } } this.RefreshInfo = function() { if(Me.DisplayCustomBox) if(Me.DisplayCustomBox.IsActive) { var TranslateStatus = $MWGUI.GetLanguageString(Me.SelectInstance.CCP_MW.CurrentState); if(TranslateStatus==null) TranslateStatus = Me.SelectInstance.CCP_MW.CurrentState; Me.DisplayCustomBox.InfoSTE.Rows[1].ElementHTML.innerHTML = TranslateStatus; switch(Me.SelectInstance.CCP_MW.CurrentState) { case "Offline": { Me.DisplayCustomBox.InfoSTE.CLearRows(); Me.DisplayCustomBox.InfoSTE.CreateRestoreButtons(); break; } case "Pause": { Me.DisplayCustomBox.InfoSTE.CLearRows(); Me.DisplayCustomBox.InfoSTE.CreateRestoreButtons(); break; } case "Available": { Me.DisplayCustomBox.InfoSTE.CLearRows(); Me.DisplayCustomBox.InfoSTE.CreateInitButtons(); break; } default : { Me.DisplayCustomBox.InfoSTE.CLearRows(); Me.DisplayCustomBox.InfoSTE.CreateRestoreButtons(); } } Me.DisplayCustomBox.InfoSTE.Rows[1].colorHTML.style.backgroundColor = Me.SelectInstance.CCP_MW.StatusColor; Me.SelectInstance.StatusColor.style.backgroundColor = Me.SelectInstance.CCP_MW.StatusColor;; } } this.getStatusTime = function(active) { if(active) { MeAgent.StatusInterval = setInterval(function() { console.log("Aggiorno Time"); var time = Me.SelectInstance.StatusTime(); Me.DisplayCustomBox.InfoSTE.Rows[2].ElementHTML.innerHTML = time; },10000); } else { clearInterval(MeAgent.StatusInterval); } } this.UpdateAgentStatus = function(InstanceConnect) { console.log("Start Update Agent Status"); /*var Params = { "Username": InstanceConnect.CCP_MW.Username, "Status": InstanceConnect.CCP_MW.CurrentState, "TimeZone": new Date().getTimezoneOffset(), "DB": InstanceConnect.CCP_MW.InstanceID }; $MW.ExeLambda(Me.LambdaFunctionDictionary["UpdateAgentStatus"][InstanceConnect.CCP_MW.ClusterInstance], Params, function(Answer,OriginalMessage) { console.log("State Agent Update"); if(Answer != null) { console.log(Answer); } }, function(Error,ErrorStack) { $MWGUI.MessageBoxShow($MWGUI.GetLanguageString("ErrorMsgTitle"),$MWGUI.GetLanguageString("ErrorMsgBodyUpdateStatus"),"error",[{"text":$MWGUI.GetLanguageString("MessageButtonOK"),"Callback":function(){}}]); } , "STE",true); */ if($MWSTE) { if($MWSTE.EndPoints) { for(var Index in $MWSTE.EndPoints) { var IndexToGetWS = $MWSTE.EndPointsWS.findIndex(x => x.EndPoint == $MWSTE.EndPoints[Index]); if(IndexToGetWS > -1) { var FindIndex = $MW.WebSockets.findIndex(x => x.EndPoint == $MWSTE.EndPointsWS[IndexToGetWS].EndPointWS); if(FindIndex > -1) { console.log("UPDATE STATUS"); var Data = {}; Data.UserName = $MW.User.UserName; Data.AgentStatus = InstanceConnect.CCP_MW.CurrentState; Data.Instance = InstanceConnect.CCP_MW.InstanceName ; $MW.WebSockets[FindIndex].SendMessageToWS("STE", "STEUpdateStatus", Data); } } } } } } this.getUserData = function(instance) { console.log("Get Agent Data"); var Params = { "DB": instance.CCP_MW.InstanceID, "Username": instance.CCP_MW.Username, }; $MW.ExeLambda(Me.LambdaFunctionDictionary["getUserData"][instance.CCP_MW.ClusterInstance], Params, function(Answer,OriginalMessage) { if(Answer != null) { instance.CCP_MW.AgentData = Answer; } }, function(Error,ErrorStack) { $MWGUI.MessageBoxShow($MWGUI.GetLanguageString("ErrorMsgTitle"),$MWGUI.GetLanguageString("ErrorMsgBodygetUserData"),"error",[{"text":$MWGUI.GetLanguageString("MessageButtonOK"),"Callback":function(){}}]); } , "STE",true); } this.getAgentsList = function(instance) { console.log("Get Agent Data"); /* var Params = { "DB": instance.CCP_MW.InstanceID }; $MW.ExeLambda(Me.LambdaFunctionDictionary["getAgentsList"][instance.CCP_MW.ClusterInstance], Params, function(Answer,OriginalMessage) { if(Answer != null) { instance.CCP_MW.ListAgents = Answer; } }, function(Error,ErrorStack) { $MWGUI.MessageBoxShow($MWGUI.GetLanguageString("ErrorMsgTitle"),$MWGUI.GetLanguageString("ErrorMsgBodygetAgentList"),"error",[{"text":$MWGUI.GetLanguageString("MessageButtonOK"),"Callback":function(){}}]); } , "STE",true); */ if($MWSTE) { if($MWSTE.EndPoints) { for(var Index in $MWSTE.EndPoints) { var IndexToGetWS = $MWSTE.EndPointsWS.findIndex(x => x.EndPoint == $MWSTE.EndPoints[Index]); if(IndexToGetWS > -1) { var FindIndex = $MW.WebSockets.findIndex(x => x.EndPoint == $MWSTE.EndPointsWS[IndexToGetWS].EndPointWS); if(FindIndex > -1) { console.log("STE GET AGENT LIST"); var Data = {}; Data.User = $MW.User; Data.Instance = instance.CCP_MW.InstanceName ; $MW.WebSockets[FindIndex].SendMessageToWS("STE", "STEGetAgentList", Data); } } } } } } this.setAgentAvailable = function(instance) { if(instance.CCP_MW.ContactInfo) instance.CCP_MW.ContactInfo.IsEnd = false; var states = new instance.Agent().getAgentStates(); //console.log(states); var OnlineState = states.filter(state => state.name === "Available")[0]; new instance.Agent().setState(OnlineState, { success: function() { console.log("Set Available"); }, failure: function() { console.log("Errore set available"); } }); } this.setAgentOfflineMissed = function(instance) { var states = new instance.Agent().getAgentStates(); //console.log(states); var OfflineState = states.filter(state => state.name === "Offline")[0]; new instance.Agent().setState(OfflineState, { success: function() { console.log("Set Offline Missed"); Me.SelectInstance.CCP_MW.ContactInfo.Contact.clear( { success: function() { console.debug("Contact missed removed..."); console.log("Telefonata Terminata"); }, failure: function(err) { console.debug("Error on contact missed removed..."); console.log(err); } }); }, failure: function() { console.log("Errore set offline"); } }); } this.ReadLogBook = function(instance, skip, limit) { let DateToSearch = Me.GetDateISOFormat(new Date(), "TimeSpanUTC").split("T"); var Param= { "database" : "STE_Instance_" + instance.CCP_MW.InstanceID, "Assembly" : "STE_DataProvider", "ClassReference" : "TSTEContactLogBook", "Skip" : skip, "Limit" : limit, "TQueryParameter" : {"Collection":"TSTEContactLogBook","JsonQuery":"{'UserName':'" + instance.CCP_MW.Username + "','Date':RegExp('" + DateToSearch[0] + "')}"}, "Sorts" : [ {"PropertyName": "Date", "Direction":"Descending"} ] }; $MW.ExeLambda(LambdaFunctionsDictionary["GetInstances"]["STE"][instance.CCP_MW.ClusterInstance],Param, function(Answer,OriginalMessage) { if(Answer != null) { if(Answer.Instances.length > 0) { console.log("READ LOG",Answer.Instances); Me.LogBook = Answer.Instances; } } }, function(Error,ErrorStack) { $MWGUI.MessageBoxShow($MWGUI.GetLanguageString("ErrorMsgTitle"),$MWGUI.GetLanguageString("ErrorMsgBody"),"error",[{"text":$MWGUI.GetLanguageString("MessageButtonOK"),"Callback":function(){}}]); } , "STE",true); } this.ListenAudioRecording = function(source, MWInstance) { var IndexAWSConfig = $MWSTE.STEAwsConfig.findIndex(x => x.Instance == MWInstance); var url = null; if(IndexAWSConfig > -1) { var params = {Bucket: $MWSTE.STEAwsConfig[IndexAWSConfig].BucketS3Recording, Key: source, Expires: 60}; let OldRegionConfig = AWS.config.region; AWS.config.region = $MWSTE.STEAwsConfig[IndexAWSConfig].EndpointRegion; var s3 = new AWS.S3(); url = s3.getSignedUrl('getObject', params); //console.log('The URL is', url); AWS.config.region = OldRegionConfig; } return url; } } function Contact() { var MeContact = this; this.getCCPInstance = function(id) { SearchInstance = Me.ConnectInstances.findIndex(x => x.CCP_MW.InstanceID == id); if(SearchInstance > -1) return Me.ConnectInstances[SearchInstance]; else return null } this.setCCPInstance = function(id) { SearchInstance = Me.ConnectInstances.findIndex(x => x.CCP_MW.InstanceID == id); if(SearchInstance > -1) { Me.SelectInstance = Me.ConnectInstances[SearchInstance]; return true; } else return null } this.onConnecting = function(id) { if(MeContact.setCCPInstance(id)) { if(Me.SelectInstance.CCP_MW.ContactInfo.TypeConnection == "inbound") Me.CreateInboundCallPopup(); else Me.CreateOutboundCallPopup(); } } this.onEnd = function(type) { if(!Me.SelectInstance.CCP_MW.ContactInfo.IsEnd) { Me.SelectInstance.CCP_MW.ContactInfo.IsEnd = true; Me.SelectInstance.CCP_MW.EndCall = Me.SelectInstance.CCP_MW.ContactInfo.Contact.getStatus(); //Me.SelectInstance.CCP_MW.ContactInfo.ContactSnap = Me.SelectInstance.CCP_MW.ContactInfo.Contact.toSnapshot(); //Me.SelectInstance.CCP_MW.DurationCall = Me.SelectInstance.CCP_MW.ContactInfo.Contact.getStatusDuration(); switch(type) { case 0: { Me.SelectInstance.CCP_MW.ContactInfo.Missed = true; } case 1: { Me.SelectInstance.CCP_MW.ContactInfo.Error = true; } } MeContact.SaveLog(); MeContact.CloseAllCustombox(); if(Me.SelectInstance.CCP_MW.ContactInfo.Missed) { if(Me.SelectInstance.CCP_MW.ContactInfo.Contact) { Me.CCPAgent.setAgentOfflineMissed(Me.SelectInstance); MeContact.MissedSplashScreen(Me.SelectInstance); } } } } this.RefreshSoftphone = function(instance,splash) { setTimeout(function() { instance.CCP_MW.ContactInfo = {}; Me.CCPAgent.setAgentAvailable(instance); if(splash != null) splash.Close(); },5000); } this.SaveLog = function() { if(Me.SelectInstance.CCP_MW.ContactInfo.IsEnd) { let LogBook = {} LogBook.AgentName = Me.SelectInstance.CCP_MW.AgentName; LogBook.InstanceName = Me.SelectInstance.CCP_MW.InstanceName; LogBook.UserName = Me.SelectInstance.CCP_MW.Username; LogBook.ContactInfo = Me.SelectInstance.CCP_MW.ContactInfo; LogBook.StartCall = Me.SelectInstance.CCP_MW.StartCall; LogBook.EndCall = Me.SelectInstance.CCP_MW.EndCall; //LogBook.DurationCall = Me.SelectInstance.CCP_MW.DurationCall; LogBook.Date = Me.GetDateISOFormat(new Date(),"TimeSpanUTC"); console.log("Salvataggio Log",LogBook); var Params = [{ "database" : "STE_Instance_" + Me.SelectInstance.CCP_MW.InstanceID, "Assembly" : "STE_DataProvider", "ClassReference" : "TSTEContactLogBook", "Items": [LogBook] }]; $MW.ExeLambda(LambdaFunctionsDictionary["StoreProcedure"]["STE"][Me.SelectInstance.CCP_MW.ClusterInstance], Params, function(Answer,OriginalMessage) { if(Answer != null) { if(Answer.length == 1) { console.log("Telefonata Terminata"); Me.LogBook.unshift(LogBook); } } }, function(Error,ErrorStack) { $MWGUI.MessageBoxShow($MWGUI.GetLanguageString("ErrorMsgTitle"),$MWGUI.GetLanguageString("ErrorMsgBody"),"error",[{"text":$MWGUI.GetLanguageString("MessageButtonOK"),"Callback":function(){}}]); } , "STE"); MeContact.RefreshSoftphone(Me.SelectInstance,null); } } this.CloseAllCustombox = function(instance) { try { if(Me.SelectInstance.CCP_MW.CustomBoxes.length > 0) { console.log(Me.SelectInstance.CCP_MW.CustomBoxes); for(Index in Me.SelectInstance.CCP_MW.CustomBoxes) { Me.SelectInstance.CCP_MW.CustomBoxes[Index].Close(); if(Me.SelectInstance.CCP_MW.CustomBoxes[Index].IsActive) Me.SelectInstance.CCP_MW.CustomBoxes[Index].isActive = false; } } $MWProcessDesigner.Execution.StopExecutionFlow(); Me.SelectInstance.CCP_MW.CustomBoxes = []; //MeContact.MissedSplashScreen(instance); }catch(err) { console.log(err); } } this.MissedSplashScreen = function(instance) { this.CreateRow = function(img,label,value) { var Row = document.createElement("div"); Row.className = "row-direction overflow-hidden relative-full-width relative-full-height justify-content-flex-start align-items-center"; var DisplayImgDiv = document.createElement("div"); DisplayImgDiv.className = "row-direction overflow-hidden resgui-3column resgui-1row justify-content-center align-items-center"; var DisplayValueDiv = document.createElement("div"); DisplayValueDiv.className = "row-direction overflow-hidden resgui-9column resgui-1row justify-content-flex-start align-items-center"; DisplayValueDiv.style.marginLeft = "var(--resgui-halfcolumn)"; var DisplayImgSpan = document.createElement("img"); DisplayImgSpan.src = img; DisplayImgSpan.className = "simple-image-h"; DisplayImgDiv.appendChild(DisplayImgSpan); var DisplayValueSpan = document.createElement("span"); DisplayValueSpan.innerHTML = label; DisplayValueSpan.color = "var(--red)"; DisplayValueDiv.appendChild(DisplayValueSpan); var DisplaylabelSpan = document.createElement("span"); DisplaylabelSpan.innerHTML = value; DisplaylabelSpan.color = "var(--red)"; DisplaylabelSpan.style.marginLeft = "var(--resgui-halfcolumn)"; DisplayValueDiv.appendChild(DisplaylabelSpan); Row.appendChild(DisplayImgDiv); Row.appendChild(DisplayValueDiv); Row.ElementHTML = DisplayValueSpan ; return Row; } var CustomBox = new TMWGUICustomBox(4, 12); Me.ResponseCustomBox = CustomBox; var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("STEMissedSplash") + " " + Me.SelectInstance.CCP_MW.InstanceName; CustomBox.Title.className += " justify-content-flex-start"; CustomBox.Title.appendChild(spanTitle); var InboundContent = document.createElement("div"); InboundContent.className = "column-direction overflow-hidden relative-full-width relative-full-height justify-content-flex-start align-items-flex-start"; InboundContent.id = "MissedCall-Content"; var MissedCallRow = this.CreateRow("../../../../../../../../../../images/icons/msgboxerror.png",$MWGUI.GetLanguageString("STEMissedSplash"),instance.CCP_MW.ContactInfo.InPhoneNumber); InboundContent.appendChild(MissedCallRow); CustomBox.Body.appendChild(InboundContent); CustomBox.Open(); MeContact.RefreshSoftphone(instance,CustomBox); } } function DisplayUserInfo() { var UserDisplay = this; this.OriginalDisplay = []; this.isActive = false; this.InfoLoad = -1; this.parentNode ; this.TimeRefresh = 5000; this.Start = function() { if(!UserDisplay.isActive) { UserDisplay.isActive = true; UserDisplay.parentNode = $MWGUI.SpanHeaderUserNickName.parentNode; Me.RotateInterval = setInterval(UserDisplay.RotateDisplay,UserDisplay.TimeRefresh); } } this.RotateDisplay = function() { console.log("-------------ROTATE DISPLAY-----------------") if(UserDisplay.InfoLoad == -1) { UserDisplay.RestoreOriginal(); if(Me.ConnectInstances.length > 0) { UserDisplay.InfoLoad = 0; } } else { UserDisplay.ShowInstance(); } } this.ShowInstance = function() { if(UserDisplay.InfoLoad > Me.ConnectInstances.length - 1) { UserDisplay.InfoLoad = -1; UserDisplay.RotateDisplay(); } else { UserDisplay.clear(); var DisplayDiv = document.createElement("div"); DisplayDiv.className = "resgui-1row relative-full-width justify-content-flex-start align-items-center decor-solid-border-bottom-dark row-direction"; var DisplayValueColor = document.createElement("div"); DisplayValueColor.className = "overflow-hidden resgui-eighthcolumn resgui-1row justify-content-flex-start align-items-center"; DisplayValueColor.style.marginRight = "var(--resgui-1column)"; DisplayValueColor.style.backgroundColor = Me.ConnectInstances[UserDisplay.InfoLoad].CCP_MW.StatusColor; var DisplayValueName = document.createElement("div"); DisplayValueName.className = "justify-content-center align-items-center"; var STEInstanceSpan = document.createElement("span"); STEInstanceSpan.className = "resgui-font-height-s"; STEInstanceSpan.innerHTML = Me.ConnectInstances[UserDisplay.InfoLoad].CCP_MW.InstanceName; DisplayValueName.appendChild(STEInstanceSpan); var DisplayValueStatus = document.createElement("div"); DisplayValueStatus.className = "justify-content-center align-items-center"; DisplayValueStatus.style.marginLeft = "var(--resgui-1column)"; var DisplayValueStatusSpan = document.createElement("span"); DisplayValueStatusSpan.className = "resgui-font-height-s"; var TranslateStatus = $MWGUI.GetLanguageString(Me.ConnectInstances[UserDisplay.InfoLoad].CCP_MW.CurrentState); if(TranslateStatus==null) TranslateStatus = Me.ConnectInstances[UserDisplay.InfoLoad].CCP_MW.CurrentState; DisplayValueStatusSpan.innerHTML = TranslateStatus; DisplayValueStatus.appendChild(DisplayValueStatusSpan); DisplayDiv.appendChild(DisplayValueColor); DisplayDiv.appendChild(DisplayValueName); DisplayDiv.appendChild(DisplayValueStatus); UserDisplay.parentNode.appendChild(DisplayDiv); UserDisplay.InfoLoad = UserDisplay.InfoLoad + 1; } } this.clear = function() { if(UserDisplay.parentNode.children.length > 0) { for(var index = UserDisplay.parentNode.children.length - 1; index >= 0 ; index--) { if(UserDisplay.parentNode.children[index].nodeName) UserDisplay.parentNode.removeChild(UserDisplay.parentNode.children[index]); } } } this.RestoreOriginal = function() { UserDisplay.clear(); var UserDiv = document.createElement("div"); UserDiv.className = "resgui-1row relative-full-width justify-content-center align-items-center decor-solid-border-bottom-dark"; var spanNickName = document.createElement("SPAN"); spanNickName.className = "resgui-font-height-s"; spanNickName.innerHTML = $MW.User.NickName; spanNickName.id = "Header-User.NickName"; var spanSpace = document.createElement("SPAN"); spanSpace.className = "resgui-font-height-s"; spanSpace.style.marginLeft = "var(--resgui-eighthcolumn)"; spanSpace.style.marginRight = "var(--resgui-eighthcolumn)"; spanSpace.innerHTML = "-"; var spanUserPool = document.createElement("SPAN"); spanUserPool.className = "resgui-font-height-s"; spanUserPool.innerHTML = $MW.User.UserPool.Description; spanUserPool.id = "Header-UserPool.Description"; UserDiv.appendChild(spanNickName); UserDiv.appendChild(spanSpace); UserDiv.appendChild(spanUserPool); UserDisplay.parentNode.appendChild(UserDiv); UserDisplay.InfoLoad = UserDisplay.InfoLoad + 1; } } this.CCPAgent = new Agent(); this.MWUserDisplay = new DisplayUserInfo(); this.CCPContact = new Contact(); this.ErrorCCPStart = function(ID) { $MWGUI.MessageBoxShow($MWGUI.GetLanguageString("ErrorMsgTitle"),$MWGUI.GetLanguageString("ErrorMsgStartSTE"),"error",[{"text":$MWGUI.GetLanguageString("MessageButtonOK"),"Callback":function(){}}]); //Me.RemoveCCP("LoginSaml-" + ID); } this.InsertConnectCredential = function(instance) { var AddCredential = this; this.CreateRow = function(label,type) { var Row = document.createElement("div"); Row.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center"; var DisplayLabelDiv = document.createElement("div"); DisplayLabelDiv.className = "row-direction overflow-hidden resgui-3column resgui-1row justify-content-flex-start align-items-center"; var DisplayValueDiv = document.createElement("div"); DisplayValueDiv.className = "row-direction overflow-hidden resgui-9column resgui-1row justify-content-flex-start align-items-center"; DisplayValueDiv.style.marginLeft = "var(--resgui-halfcolumn)"; var DisplayLabelSpan = document.createElement("span"); DisplayLabelSpan.innerHTML = label; DisplayLabelSpan.style.marginLeft = "var(--resgui-halfcolumn)"; DisplayLabelDiv.appendChild(DisplayLabelSpan); var DisplayValueSpan = document.createElement("Input"); DisplayValueSpan.type = type; DisplayValueDiv.appendChild(DisplayValueSpan); AddCredential.CustomBox.RowValue.push(DisplayValueSpan); Row.appendChild(DisplayLabelDiv); Row.appendChild(DisplayValueDiv); Row.ElementHTML = DisplayValueSpan ; return Row; } this.InsertCredential = function(customBox) { var UserObj = {}; UserObj.MWUserID = $MW.User.ID; UserObj.IsActive = true; UserObj.UsernameAD = customBox.RowValue[0].value.trim(); $MW.MW_Encrypt(customBox.RowValue[1].value.trim(),function(data){ console.log(data); /*var result = ""; for (var i = 0; i < data.CiphertextBlob.length; i++) { result += String.fromCharCode(data.CiphertextBlob[i]); }*/ UserObj.PasswordAD = btoa(JSON.stringify(data)); var Params = [{ "database" : "STE_Instance_" + instance.InstanceID, "Assembly" : "STE_DataProvider", "ClassReference" : "TSTEInstanceUser", "Items": [UserObj] }]; $MW.ExeLambda(LambdaFunctionsDictionary["StoreProcedure"]["STE"][instance.ClusterInstance], Params, function(Answer,OriginalMessage) { if(Answer != null) { if(Answer.length == 1) { customBox.Close(); instance.Username = Answer[0].UsernameAD; instance.Password = Answer[0].PasswordAD; Me.CreateCCPSamlLogin(instance,instance.InstanceID); } } }, function(Error,ErrorStack) { $MWGUI.MessageBoxShow($MWGUI.GetLanguageString("ErrorMsgTitle"),$MWGUI.GetLanguageString("ErrorMsgBody"),"error",[{"text":$MWGUI.GetLanguageString("MessageButtonOK"),"Callback":function(){}}]); } , "STE"); }); //UserObj.PasswordAD = $MW.Base64Encode(customBox.RowValue[1].value.trim()); } var CustomBox = new TMWGUICustomBox(5, 12); CustomBox.RowValue = []; AddCredential.CustomBox = CustomBox; var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("STEConnectCredential"); CustomBox.Title.className += " justify-content-flex-start"; CustomBox.Title.appendChild(spanTitle); var CredentialContent = document.createElement("div"); CredentialContent.className = "column-direction overflow-hidden relative-full-width relative-full-height justify-content-flex-start align-items-flex-start"; CredentialContent.id = "Credential-Content"; var DisplayCredential = document.createElement("div"); DisplayCredential.className = "column-direction overflow-hidden relative-full-width resgui-3row justify-content-center align-items-center"; var Username = this.CreateRow($MWGUI.GetLanguageString("Username"),"text"); var Password = this.CreateRow($MWGUI.GetLanguageString("Password"),"password"); DisplayCredential.appendChild(Username); DisplayCredential.appendChild(Password); var Toolbar = document.createElement("div"); Toolbar.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-space-around align-items-center"; Toolbar.style.backgroundColor = "var(--secondary-toolbar-background)"; Toolbar.id = "Insert-Toolbar"; var Insert = document.createElement("div"); Insert.className = "button-application "; Insert.CustomBox = CustomBox; Insert.addEventListener("click",function(ev){ var Target = ev.target; if(Target.nodeName!="DIV") Target = Target.parentNode; var ctrl = false; if(Target.CustomBox.RowValue[0].value.trim() == "") { Target.CustomBox.RowValue[0].className = Target.CustomBox.RowValue[0].className + " ErrorMark"; ctrl = true; }else Target.CustomBox.RowValue[0].className = Target.CustomBox.RowValue[0].className.replace(" ErrorMark",""); if(Target.CustomBox.RowValue[1].value.trim() == "") { Target.CustomBox.RowValue[1].className = Target.CustomBox.RowValue[1].className + " ErrorMark"; ctrl = true; }else Target.CustomBox.RowValue[1].className = Target.CustomBox.RowValue[1].className.replace(" ErrorMark",""); if(!ctrl) { AddCredential.InsertCredential(Target.CustomBox); } }); var InsertSpan = document.createElement("span"); InsertSpan.innerHTML = $MWGUI.GetLanguageString("ADInsert"); Insert.appendChild(InsertSpan); Toolbar.appendChild(Insert); CredentialContent.appendChild(DisplayCredential); CredentialContent.appendChild(Toolbar); CustomBox.Body.appendChild(CredentialContent); CustomBox.Open(); } this.getUserSTEInfo = function(instance) { var Param= { "database" : "STE_Instance_" + instance.InstanceID, "Assembly" : "STE_DataProvider", "ClassReference" : "TSTEInstanceUser", "Skip" : 0, "Limit" : 1, "TQueryParameter" : {"Collection":"TSTEInstanceUser","JsonQuery":"{'MWUserID':'" + $MW.User.ID + "','IsActive':true}"} }; $MW.ExeLambda(LambdaFunctionsDictionary["GetInstances"]["STE"][instance.ClusterInstance],Param, function(Answer,OriginalMessage) { if(Answer != null) { if(Answer.Instances.length == 1) { console.log(Answer.Instances); if(!instance.IsAdConnectionType) { } else { // var linkInstance = DBInstances[Index].ActiveDirectoryLink + "?instance=" + $MW.Base64Encode(JSON.stringify(DBInstances[Index])) + "&UserName=stephan.pi@mosaicogroup.com&Password=U3RlMTMwMzIwMjE=&ByPassLogin=true"; instance.Username = Answer.Instances[0].UsernameAD; instance.Password = Answer.Instances[0].PasswordAD; Me.CreateCCPSamlLogin(instance,instance.InstanceID); } } else { console.log("Crea Popup"); Me.InsertConnectCredential(instance); } } }, function(Error,ErrorStack) { $MWGUI.MessageBoxShow($MWGUI.GetLanguageString("ErrorMsgTitle"),$MWGUI.GetLanguageString("ErrorMsgBody"),"error",[{"text":$MWGUI.GetLanguageString("MessageButtonOK"),"Callback":function(){}}]); } , "STE",true); } this.CreateCCP = function(instance,ID) { setTimeout(function(){ var elm = document.getElementById("LoginSaml-" + ID); elm.parentNode.removeChild(elm); },2000); var CCPParam = {}; CCPParam.UserName = instance.Username; CCPParam.Password = instance.Password; CCPParam.ByPassLogin = true; var linkParam = $MW.Base64Encode(JSON.stringify(CCPParam)); var iframe = document.createElement('iframe'); iframe.src = "https://testmosaicoworld.com/STE/Site/CCPLoad.html?instance=" + $MW.Base64Encode(JSON.stringify(instance)) + "&CCP_Param=" + linkParam; iframe.id = ID; iframe.style.zIndex = "-100"; iframe.allow = "camera='false';microphone='true'" ; document.body.appendChild(iframe); } this.CreateCCPSamlLogin = function(instance,ID) { var iframe = document.createElement('iframe'); iframe.src = "https://srvadfs.mosaicogroup.com/MWLoginSAML.html"; iframe.referrerPolicy = "unsafe-url"; iframe.id = "LoginSaml-" + ID; iframe.style.zIndex = "-100"; iframe.addEventListener("load",function() { $MW.MW_Decrypt(instance.Password,function(data){ iframe.contentWindow.postMessage("{\"Username\":\"" + instance.Username + "\",\"Password\":\"" + String.fromCharCode.apply(null, data.Plaintext) + "\",\"ID\":\"" + ID + "\"}","https://srvadfs.mosaicogroup.com"); }); }); document.body.appendChild(iframe); TimeoutLogin = setTimeout(function(){ Me.ErrorCCPStart(instance.InstanceID); },30000); } this.LoginSuccessed = function() { console.log("Chiudo Controllo Login"); clearInterval(TimeoutLogin); if(Me.ServiceMW) if( Me.ServiceMW.callback) Me.ServiceMW.callback(Me.ServiceMW.ContainerSTE,true); } this.STEWSPresenatation = function(instance) { if($MWSTE) { if($MWSTE.EndPoints) { for(var Index in $MWSTE.EndPoints) { var IndexToGetWS = $MWSTE.EndPointsWS.findIndex(x => x.EndPoint == $MWSTE.EndPoints[Index]); if(IndexToGetWS > -1) { var FindIndex = $MW.WebSockets.findIndex(x => x.EndPoint == $MWSTE.EndPointsWS[IndexToGetWS].EndPointWS); if(FindIndex > -1) { console.log("STE PRESENTATION"); var Data = {}; Data.User = $MW.User; Data.AgentUsername = instance.Username; Data.AgentName = instance.AgentName; Data.AgentStatus = instance.CurrentState; Data.Instance = instance.InstanceName ; $MW.WebSockets[FindIndex].SendMessageToWS("STE", "STEPresentation", Data); } } } } } } this.RemoveCCP = function(ID) { var node = document.getElementById(ID); document.body.removeChild(node); } this.InitSTE = function(ContainerSTE,callback) { if(ContainerSTE && callback) { Me.ServiceMW = {}; Me.ServiceMW.ContainerSTE = ContainerSTE; Me.ServiceMW.callback = callback; } if($MW.User.UserPool.SteLink) { if($MW.User.UserPool.SteLink.length > 0) { DBInstances = $MW.User.UserPool.SteLink; if(DBInstances.length > 0) { for(Index in DBInstances) { Me.getUserSTEInfo(DBInstances[Index]); } } } else { if(Me.ServiceMW) if( Me.ServiceMW.callback) Me.ServiceMW.callback(Me.ServiceMW.ContainerSTE,false); } } } this.InitializeDetailSTE = function() { Me.InitSTE(true); } this.InitDashSTE = function() { var DashBoardBox = new TMWGUICustomBox(19, 32); Me.DisplayCustomBox = DashBoardBox; DashBoardBox.IsActive = false; var DashME = this; DashBoardBox.OnLoadFunction = function() { parent.parent.$MWTab.Initialize(); if(this.InfoSTE) { var InfoSTE = this.InfoSTE; this.InfoSTE.CreateRow = function(label,value) { var Row = document.createElement("div"); Row.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center decor-solid-border-bottom-dark"; var DisplayLabelDiv = document.createElement("div"); DisplayLabelDiv.className = "overflow-hidden resgui-4column resgui-1row justify-content-flex-start align-items-center"; var DisplayValueDiv = document.createElement("div"); DisplayValueDiv.className = "overflow-hidden resgui-15column resgui-1row justify-content-flex-start align-items-center"; var DisplayLabelSpan = document.createElement("span"); DisplayLabelSpan.innerHTML = label; DisplayLabelSpan.style.marginLeft = "var(--resgui-halfcolumn)"; DisplayLabelSpan.className = "resgui-font-height-s"; if(label==$MWGUI.GetLanguageString("StatusLabel")) { DisplayLabelSpan.style.marginLeft = "0"; var DisplayValueColor = document.createElement("div"); DisplayValueColor.className = "overflow-hidden resgui-eighthcolumn resgui-1row justify-content-flex-start align-items-center"; DisplayValueColor.style.marginRight = "calc(var(--resgui-quartercolumn) + var(--resgui-eighthcolumn))"; DisplayValueColor.style.backgroundColor = "#808080"; var DisplayValueSpan = document.createElement("span"); DisplayValueSpan.innerHTML = value; DisplayLabelDiv.appendChild(DisplayValueColor); DisplayLabelDiv.appendChild(DisplayLabelSpan); DisplayValueDiv.appendChild(DisplayValueSpan); Row.colorHTML = DisplayValueColor ; }else { DisplayLabelDiv.appendChild(DisplayLabelSpan); var DisplayValueSpan = document.createElement("span"); DisplayValueSpan.innerHTML = value; DisplayValueDiv.appendChild(DisplayValueSpan); } Row.appendChild(DisplayLabelDiv); Row.appendChild(DisplayValueDiv); Row.ElementHTML = DisplayValueSpan ; this.Rows.push(Row); return Row; } this.InfoSTE.CreateButton = function(label,type,callFunction) { var Button = document.createElement("div"); Button.className = "button-application"; Button.style.marginLeft = "var(--resgui-halfcolumn)"; Button.addEventListener(type,callFunction); var ButtonSpan = document.createElement("span"); ButtonSpan.innerHTML = label; Button.appendChild(ButtonSpan) return Button; } this.InfoSTE.CLearRows = function() { for (Index in InfoSTE.ButtonRows) { InfoSTE.BottomInfo.removeChild(InfoSTE.ButtonRows[Index]); } InfoSTE.ButtonRows = []; } this.InfoSTE.CreateInitButtons = function() { var ButtonGroupDiv = document.createElement("div"); ButtonGroupDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-center align-items-center"; var States = new Me.SelectInstance.Agent().getConfiguration(); for(Index in States.agentStates) { if(States.agentStates[Index].name != "Available") { var Button = InfoSTE.CreateButton($MWGUI.GetLanguageString("Button" + States.agentStates[Index].name),"click",function() { Me.SelectInstance.ChangeRequest = "Manual"; Me.SelectInstance.ChangeStatus(States.agentStates[Index].name); }); ButtonGroupDiv.appendChild(Button); } } InfoSTE.ButtonRows.push(ButtonGroupDiv); InfoSTE.BottomInfo.appendChild(ButtonGroupDiv); } this.InfoSTE.CreateMediaRow = function(type,label) { var MediaDeviceDiv = null; if($MWSTE) if($MWSTE.DeviceList) switch(type) { case "Mic" : { if($MWSTE.DeviceList.AudioIn) { //if($MWSTE.DeviceList.AudioIn.length > 1) if($MWSTE.DeviceList.AudioIn.length == -1) { MediaDeviceDiv = document.createElement("div"); MediaDeviceDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center"; var MediaDeviceAudioSelectDiv = document.createElement("div"); MediaDeviceAudioSelectDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center decor-solid-border-bottom-dark"; var MediaDeviceAudioSpanDiv = document.createElement("div"); MediaDeviceAudioSpanDiv.className = "row-direction overflow-hidden resgui-4column resgui-1row justify-content-flex-start align-items-center "; var DeviceAudioSelectDiv = document.createElement("div"); DeviceAudioSelectDiv.className = "row-direction overflow-hidden resgui-15column resgui-1row justify-content-flex-start align-items-center"; var MediaDeviceAudioSelect = document.createElement("select"); MediaDeviceAudioSelect.style.marginLeft = 0; MediaDeviceAudioSelect.addEventListener("change",function() { $MWSTE.SelectInstance.CCP_MW.MyAgent.setMicrophoneDevice(this.value); }); DeviceAudioSelectDiv.appendChild(MediaDeviceAudioSelect); var MediaDeviceAudioSpan = document.createElement("span"); MediaDeviceAudioSpan.innerHTML = $MWGUI.GetLanguageString(label); MediaDeviceAudioSpan.style.marginLeft = "var(--resgui-halfcolumn)"; MediaDeviceAudioSpan.className = "resgui-font-height-s"; MediaDeviceAudioSpanDiv.appendChild(MediaDeviceAudioSpan); for(Index in $MWSTE.DeviceList.AudioIn) { var DeviceOption = document.createElement("option"); DeviceOption.setAttribute("value", $MWSTE.DeviceList.AudioIn[Index].Id); var DescriptionDevice = document.createTextNode($MWSTE.DeviceList.AudioIn[Index].Name); if($MWSTE.DeviceList.AudioIn[Index].Id == "default") DeviceOption.setAttribute("selected", "selected"); DeviceOption.appendChild(DescriptionDevice); MediaDeviceAudioSelect.appendChild(DeviceOption); } MediaDeviceAudioSelectDiv.appendChild(MediaDeviceAudioSpanDiv); MediaDeviceAudioSelectDiv.appendChild(DeviceAudioSelectDiv); MediaDeviceDiv.appendChild(MediaDeviceAudioSelectDiv); } //if($MWSTE.DeviceList.AudioIn.length == 1) if($MWSTE.DeviceList.AudioIn.length > 0) { MediaDeviceDiv = document.createElement("div"); MediaDeviceDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center"; var MediaDeviceAudioSelectDiv = document.createElement("div"); MediaDeviceAudioSelectDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center decor-solid-border-bottom-dark"; var MediaDeviceAudioSpanDiv = document.createElement("div"); MediaDeviceAudioSpanDiv.className = "row-direction overflow-hidden resgui-4column resgui-1row justify-content-flex-start align-items-center "; var DeviceAudioSelectDiv = document.createElement("div"); DeviceAudioSelectDiv.className = "row-direction overflow-hidden resgui-15column resgui-1row justify-content-flex-start align-items-center"; var MediaDeviceAudioSelect = document.createElement("span"); MediaDeviceAudioSelect.innerHTML = "Default local audio setting"; var MediaDeviceAudioSpan = document.createElement("span"); MediaDeviceAudioSpan.innerHTML = $MWGUI.GetLanguageString(label); MediaDeviceAudioSpan.style.marginLeft = "var(--resgui-halfcolumn)"; MediaDeviceAudioSpan.className = "resgui-font-height-s"; MediaDeviceAudioSpanDiv.appendChild(MediaDeviceAudioSpan); DeviceAudioSelectDiv.appendChild(MediaDeviceAudioSelect); MediaDeviceAudioSelectDiv.appendChild(MediaDeviceAudioSpanDiv); MediaDeviceAudioSelectDiv.appendChild(DeviceAudioSelectDiv); MediaDeviceDiv.appendChild(MediaDeviceAudioSelectDiv) } } break; } case "Speak" : { if($MWSTE.DeviceList.AudioOut) { //if($MWSTE.DeviceList.AudioOut.length > 1) if($MWSTE.DeviceList.AudioOut.length == -1) { MediaDeviceDiv = document.createElement("div"); MediaDeviceDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center"; var MediaDeviceAudioSelectDiv = document.createElement("div"); MediaDeviceAudioSelectDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center decor-solid-border-bottom-dark"; var MediaDeviceAudioSpanDiv = document.createElement("div"); MediaDeviceAudioSpanDiv.className = "row-direction overflow-hidden resgui-4column resgui-1row justify-content-flex-start align-items-center "; var DeviceAudioSelectDiv = document.createElement("div"); DeviceAudioSelectDiv.className = "row-direction overflow-hidden resgui-15column resgui-1row justify-content-flex-start align-items-center"; var MediaDeviceAudioSelect = document.createElement("select"); MediaDeviceAudioSelect.style.marginLeft = 0; MediaDeviceAudioSelect.addEventListener("change",function() { $MWSTE.SelectInstance.CCP_MW.MyAgent.setSpeakerDevice(this.value); }); DeviceAudioSelectDiv.appendChild(MediaDeviceAudioSelect); var MediaDeviceAudioSpan = document.createElement("span"); MediaDeviceAudioSpan.innerHTML = $MWGUI.GetLanguageString(label); MediaDeviceAudioSpan.style.marginLeft = "var(--resgui-halfcolumn)"; MediaDeviceAudioSpan.className = "resgui-font-height-s"; MediaDeviceAudioSpanDiv.appendChild(MediaDeviceAudioSpan); for(Index in $MWSTE.DeviceList.AudioOut) { var DeviceOption = document.createElement("option"); DeviceOption.setAttribute("value", $MWSTE.DeviceList.AudioOut[Index].Id); var DescriptionDevice = document.createTextNode($MWSTE.DeviceList.AudioOut[Index].Name); if($MWSTE.DeviceList.AudioOut[Index].Id == "default") DeviceOption.setAttribute("selected", "selected"); DeviceOption.appendChild(DescriptionDevice); MediaDeviceAudioSelect.appendChild(DeviceOption); } MediaDeviceAudioSelectDiv.appendChild(MediaDeviceAudioSpanDiv); MediaDeviceAudioSelectDiv.appendChild(DeviceAudioSelectDiv); MediaDeviceDiv.appendChild(MediaDeviceAudioSelectDiv); } //if($MWSTE.DeviceList.AudioOut.length == 1) if($MWSTE.DeviceList.AudioOut.length > 0) { MediaDeviceDiv = document.createElement("div"); MediaDeviceDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center"; var MediaDeviceAudioSelectDiv = document.createElement("div"); MediaDeviceAudioSelectDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center decor-solid-border-bottom-dark"; var MediaDeviceAudioSpanDiv = document.createElement("div"); MediaDeviceAudioSpanDiv.className = "row-direction overflow-hidden resgui-4column resgui-1row justify-content-flex-start align-items-center "; var DeviceAudioSelectDiv = document.createElement("div"); DeviceAudioSelectDiv.className = "row-direction overflow-hidden resgui-15column resgui-1row justify-content-flex-start align-items-center"; var MediaDeviceAudioSelect = document.createElement("span"); MediaDeviceAudioSelect.innerHTML = "Default local audio setting"; var MediaDeviceAudioSpan = document.createElement("span"); MediaDeviceAudioSpan.innerHTML = $MWGUI.GetLanguageString(label); MediaDeviceAudioSpan.style.marginLeft = "var(--resgui-halfcolumn)"; MediaDeviceAudioSpan.className = "resgui-font-height-s"; MediaDeviceAudioSpanDiv.appendChild(MediaDeviceAudioSpan); DeviceAudioSelectDiv.appendChild(MediaDeviceAudioSelect); MediaDeviceAudioSelectDiv.appendChild(MediaDeviceAudioSpanDiv); MediaDeviceAudioSelectDiv.appendChild(DeviceAudioSelectDiv); MediaDeviceDiv.appendChild(MediaDeviceAudioSelectDiv) } } break; } case "Ring" : { if($MWSTE.DeviceList.AudioOut) { //if($MWSTE.DeviceList.AudioOut.length > 1) if($MWSTE.DeviceList.AudioOut.length == -1) { MediaDeviceDiv = document.createElement("div"); MediaDeviceDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center"; var MediaDeviceAudioSelectDiv = document.createElement("div"); MediaDeviceAudioSelectDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center decor-solid-border-bottom-dark"; var MediaDeviceAudioSpanDiv = document.createElement("div"); MediaDeviceAudioSpanDiv.className = "row-direction overflow-hidden resgui-4column resgui-1row justify-content-flex-start align-items-center "; var DeviceAudioSelectDiv = document.createElement("div"); DeviceAudioSelectDiv.className = "row-direction overflow-hidden resgui-15column resgui-1row justify-content-flex-start align-items-center"; var MediaDeviceAudioSelect = document.createElement("select"); MediaDeviceAudioSelect.style.marginLeft = 0; MediaDeviceAudioSelect.addEventListener("change",function() { console.log("AAAAAAAAAAAAA",this.value); $MWSTE.SelectInstance.CCP_MW.MyAgent.setRingerDevice(this.value); }); DeviceAudioSelectDiv.appendChild(MediaDeviceAudioSelect); var MediaDeviceAudioSpan = document.createElement("span"); MediaDeviceAudioSpan.innerHTML = $MWGUI.GetLanguageString(label); MediaDeviceAudioSpan.style.marginLeft = "var(--resgui-halfcolumn)"; MediaDeviceAudioSpan.className = "resgui-font-height-s"; MediaDeviceAudioSpanDiv.appendChild(MediaDeviceAudioSpan); for(Index in $MWSTE.DeviceList.AudioOut) { var DeviceOption = document.createElement("option"); DeviceOption.setAttribute("value", $MWSTE.DeviceList.AudioOut[Index].Id); var DescriptionDevice = document.createTextNode($MWSTE.DeviceList.AudioOut[Index].Name); if($MWSTE.DeviceList.AudioOut[Index].Id == "default") DeviceOption.setAttribute("selected", "selected"); DeviceOption.appendChild(DescriptionDevice); MediaDeviceAudioSelect.appendChild(DeviceOption); } MediaDeviceAudioSelectDiv.appendChild(MediaDeviceAudioSpanDiv); MediaDeviceAudioSelectDiv.appendChild(DeviceAudioSelectDiv); MediaDeviceDiv.appendChild(MediaDeviceAudioSelectDiv); } //if($MWSTE.DeviceList.AudioOut.length == 1) if($MWSTE.DeviceList.AudioOut.length > 0) { MediaDeviceDiv = document.createElement("div"); MediaDeviceDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center"; var MediaDeviceAudioSelectDiv = document.createElement("div"); MediaDeviceAudioSelectDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center decor-solid-border-bottom-dark"; var MediaDeviceAudioSpanDiv = document.createElement("div"); MediaDeviceAudioSpanDiv.className = "row-direction overflow-hidden resgui-4column resgui-1row justify-content-flex-start align-items-center "; var DeviceAudioSelectDiv = document.createElement("div"); DeviceAudioSelectDiv.className = "row-direction overflow-hidden resgui-15column resgui-1row justify-content-flex-start align-items-center"; var MediaDeviceAudioSelect = document.createElement("span"); MediaDeviceAudioSelect.innerHTML = "Default local audio setting"; var MediaDeviceAudioSpan = document.createElement("span"); MediaDeviceAudioSpan.innerHTML = $MWGUI.GetLanguageString(label); MediaDeviceAudioSpan.style.marginLeft = "var(--resgui-halfcolumn)"; MediaDeviceAudioSpan.className = "resgui-font-height-s"; MediaDeviceAudioSpanDiv.appendChild(MediaDeviceAudioSpan); DeviceAudioSelectDiv.appendChild(MediaDeviceAudioSelect); MediaDeviceAudioSelectDiv.appendChild(MediaDeviceAudioSpanDiv); MediaDeviceAudioSelectDiv.appendChild(DeviceAudioSelectDiv); MediaDeviceDiv.appendChild(MediaDeviceAudioSelectDiv) } } break; } } return MediaDeviceDiv; } this.InfoSTE.CreateConfigMediaDevice = function() { let RowMediaInput = Me.DisplayCustomBox.InfoSTE.CreateMediaRow("Mic","LabelCfgMicrophone"); let RowMediaOutput = Me.DisplayCustomBox.InfoSTE.CreateMediaRow("Speak","LabelCfgSpeaker"); let RowMediaRinger = Me.DisplayCustomBox.InfoSTE.CreateMediaRow("Ring","LabelCfgRinger"); if(RowMediaInput != null) InfoSTE.ContentInfo.appendChild(RowMediaInput); if(RowMediaOutput != null) InfoSTE.ContentInfo.appendChild(RowMediaOutput); if(RowMediaRinger != null) InfoSTE.ContentInfo.appendChild(RowMediaRinger); } this.InfoSTE.CreateRestoreButtons = function() { var ButtonGroupDiv = document.createElement("div"); ButtonGroupDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center"; var RestoreButton = InfoSTE.CreateButton($MWGUI.GetLanguageString("ButtonRestore"),"click",function() { Me.SelectInstance.ChangeRequest = "Manual"; Me.SelectInstance.ChangeStatus("Available"); }); ButtonGroupDiv.appendChild(RestoreButton); InfoSTE.ButtonRows.push(ButtonGroupDiv); InfoSTE.BottomInfo.appendChild(ButtonGroupDiv); } this.InfoSTE.CreateAgentRow = function(value,status,username) { var AgentDataDiv = document.createElement("div"); AgentDataDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center decor-solid-border-bottom-dark "; var AgentNameSpan = document.createElement("span"); AgentNameSpan.innerHTML = value; AgentNameSpan.style.width = "var(--resgui-3column)"; var AgentStatusDiv = document.createElement("div"); AgentStatusDiv.className = "row-direction justify-content-flex-start align-items-center"; var AgentStatusDivCircle = document.createElement("div"); AgentStatusDivCircle.className = "row-direction justify-content-flex-start align-items-center"; //AgentStatusDivCircle.style.marginLeft = "var(--quarter-row)"; var AgentStatusDivImg = document.createElement("div"); AgentStatusDivImg.className = "row-direction justify-content-flex-start align-items-center"; var AgentStatusImg = document.createElement("img"); AgentStatusImg.src = "../../../../../../../../../../../../images/icons/CallCenterAgent.png"; AgentStatusImg.className = "icon-image"; AgentStatusImg.style.width = "var(--resgui-three-quarter-column)"; AgentStatusImg.style.height = "var(--resgui-three-quarter-row)"; AgentStatusDivImg.appendChild(AgentStatusImg); var AgentStatusCircle = document.createElement("div"); //AgentStatusCircle.className = "AgentStatusCircle"; AgentStatusCircle.className = "resgui-eighthcolumn resgui-1row justify-content-flex-start align-items-center"; AgentStatusCircle.style.backgroundColor = Me.SelectInstance.getStatusColor(status); AgentStatusDivCircle.appendChild(AgentStatusCircle); AgentStatusDiv.appendChild(AgentStatusDivCircle); AgentStatusDiv.appendChild(AgentStatusDivImg); AgentDataDiv.appendChild(AgentStatusDiv); AgentDataDiv.appendChild(AgentNameSpan); AgentDataDiv.UserName = username; this.AgentsRows.push(AgentDataDiv); return AgentDataDiv; } var MainContent = document.createElement("div"); MainContent.className = "row-direction overflow-hidden relative-full-width relative-full-height justify-content-flex-start align-items-center"; MainContent.id = "MainContainer"; var CenterMenuNav = document.createElement("div"); CenterMenuNav.className = "column-direction overflow-hidden resgui-21column relative-full-height justify-content-flex-start align-items-center decor-solid-border-right-light"; CenterMenuNav.id = "CenterMenu"; var LeftMenuNav = document.createElement("div"); LeftMenuNav.className = "column-direction overflow-hidden resgui-5column relative-full-height justify-content-flex-start align-items-center decor-solid-border-right-light"; LeftMenuNav.id = "LeftMenu"; var RightMenuNav = document.createElement("div"); RightMenuNav.className = "column-direction overflow-hidden resgui-6column relative-full-height justify-content-flex-start align-items-center decor-solid-border-right-light"; RightMenuNav.id = "RightMenu"; this.InfoSTE.LeftMenuNav = LeftMenuNav; this.InfoSTE.RightMenuNav = RightMenuNav; this.InfoSTE.CenterMenuNav = CenterMenuNav; if(Me.ConnectInstances.length > 0) { for(Index in Me.ConnectInstances) { Me.ConnectInstances[Index].IsDashBoxSelected = false; var STEInstance = document.createElement("div"); STEInstance.className = "InstanceListSTE"; STEInstance.Instance = Me.ConnectInstances[Index]; STEInstance.InfoSTE = this.InfoSTE; STEInstance.addEventListener("click",function(ev) { var Target = ev.target; if(Target.nodeName == "SPAN") Target = Target.parentNode; if(!Target.Instance.IsDashBoxSelected) { Me.SelectInstance = Target.Instance; Target.Instance.IsDashBoxSelected = true; if(CenterMenuNav.children.length>1) CenterMenuNav.removeChild(CenterMenuNav.children[1]); var Content= document.createElement("div"); Content.className = "column-direction overflow-hidden resgui-21column relative-full-height justify-content-flex-start align-items-center"; Content.id = "ContentInfo"; var ContentInfo = document.createElement("div"); ContentInfo.className = "column-direction overflow-hidden resgui-21column justify-content-flex-start align-items-center"; ContentInfo.style.height = "calc(var(--resgui-halfrow) + var(--resgui-16row))"; ContentInfo.id = "ContentInfo"; var BottomInfo = document.createElement("div"); BottomInfo.className = "column-direction overflow-hidden resgui-21column justify-content-flex-start align-items-center"; BottomInfo.style.height = "calc(var(--resgui-halfrow) + var(--resgui-2row))"; BottomInfo.id = "ContentInfo"; Content.appendChild(ContentInfo); Content.appendChild(BottomInfo); this.InfoSTE.ContentInfo = ContentInfo; this.InfoSTE.BottomInfo = BottomInfo var CategoryTitle = document.createElement("div"); CategoryTitle.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center"; CategoryTitle.style.backgroundColor = "var(--group-header-background)"; var CategorySpan = document.createElement("span"); CategorySpan.innerHTML = $MWGUI.GetLanguageString("CategoryAgent"); CategorySpan.style.marginLeft = "var(--resgui-halfcolumn)"; CategoryTitle.appendChild(CategorySpan); Target.InfoSTE.Rows = []; Target.InfoSTE.AgentsRows = []; Target.InfoSTE.ButtonRows = []; var DisplayName = Target.InfoSTE.CreateRow($MWGUI.GetLanguageString("DisplayName"),Target.Instance.CCP_MW.AgentName); var StatusTex ; if(Target.Instance) StatusTex = Target.Instance.CCP_MW.CurrentState; else StatusTex = "Init"; var TranslateStatus = $MWGUI.GetLanguageString(StatusTex); if(TranslateStatus==null) TranslateStatus = StatusTex; var StatusAgent = Target.InfoSTE.CreateRow($MWGUI.GetLanguageString("StatusLabel"),TranslateStatus); var StatusTime = this.InfoSTE.CreateRow($MWGUI.GetLanguageString("StatusTime"),Me.SelectInstance.StatusTime()); Me.CCPAgent.getStatusTime(true); var ButtonGroupTitle = document.createElement("div"); ButtonGroupTitle.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center"; ButtonGroupTitle.style.backgroundColor = "var(--group-header-background)"; var ButtonGroupSpan = document.createElement("span"); ButtonGroupSpan.innerHTML = $MWGUI.GetLanguageString("ButtonGroup"); ButtonGroupSpan.style.marginLeft = "var(--resgui-halfcolumn)"; ButtonGroupTitle.appendChild(ButtonGroupSpan); var ConfigMediaDeviceGroupTitle = document.createElement("div"); ConfigMediaDeviceGroupTitle.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center"; ConfigMediaDeviceGroupTitle.style.backgroundColor = "var(--group-header-background)"; var ConfigMediaDeviceGroupSpan = document.createElement("span"); ConfigMediaDeviceGroupSpan.innerHTML = $MWGUI.GetLanguageString("MediaDeviceGroup"); ConfigMediaDeviceGroupSpan.style.marginLeft = "var(--resgui-halfcolumn)"; ConfigMediaDeviceGroupTitle.appendChild(ConfigMediaDeviceGroupSpan); ContentInfo.appendChild(CategoryTitle); ContentInfo.appendChild(DisplayName); ContentInfo.appendChild(StatusAgent); ContentInfo.appendChild(StatusTime); ContentInfo.appendChild(ConfigMediaDeviceGroupTitle); this.InfoSTE.CreateConfigMediaDevice(); BottomInfo.appendChild(ButtonGroupTitle); Me.CCPAgent.RefreshInfo(); CenterMenuNav.appendChild(Content); var ListAgentsDiv = document.createElement("div"); ListAgentsDiv.className = "column-direction overflow-hidden resgui-6column relative-full-height justify-content-flex-start align-items-center"; ListAgentsDiv.id = "STEListAgents"; this.InfoSTE.ListAgents = ListAgentsDiv; if($MWSTE) { if($MWSTE.ListAgents) { let IndexInstance = $MWSTE.SelectInstance.CCP_MW.InstanceName; if($MWSTE.ListAgents[IndexInstance]) { if($MWSTE.ListAgents[IndexInstance].length > 0) { for(agent in $MWSTE.ListAgents[IndexInstance]) { let keyName = Object.keys($MWSTE.ListAgents[IndexInstance][agent])[0]; var AgentNewRow = InfoSTE.CreateAgentRow($MWSTE.ListAgents[IndexInstance][agent][keyName].AgentName,$MWSTE.ListAgents[IndexInstance][agent][keyName].AgentStatus,keyName); ListAgentsDiv.appendChild(AgentNewRow); } } } } } RightMenuNav.appendChild(ListAgentsDiv); } }); var DisplayValueColor = document.createElement("div"); DisplayValueColor.className = "overflow-hidden resgui-eighthcolumn resgui-1row justify-content-flex-start align-items-center"; DisplayValueColor.style.marginRight = "calc(var(--resgui-quartercolumn) + var(--resgui-eighthcolumn))"; DisplayValueColor.style.backgroundColor = Me.ConnectInstances[Index].CCP_MW.StatusColor; var STEInstanceSpan = document.createElement("span"); STEInstanceSpan.innerHTML = Me.ConnectInstances[Index].CCP_MW.InstanceName; Me.ConnectInstances[Index].StatusColor = DisplayValueColor; STEInstance.appendChild(DisplayValueColor); STEInstance.appendChild(STEInstanceSpan); LeftMenuNav.appendChild(STEInstance); } } MainContent.appendChild(LeftMenuNav); MainContent.appendChild(CenterMenuNav); MainContent.appendChild(RightMenuNav); this.InfoSTE.appendChild(MainContent); } if(this.LogBookSTE) { var BookLog = this; this.LogBookSTE.Rows = []; var MainContentLog = document.createElement("div"); MainContentLog.className = "column-direction overflow-hidden relative-full-width relative-full-height justify-content-flex-start align-items-center"; MainContentLog.id = "MainContainerLogBook"; this.LogBookSTE.CreateRow = function(label,value) { var Row = document.createElement("div"); Row.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center"; var DisplayLabelDiv = document.createElement("div"); DisplayLabelDiv.className = "overflow-hidden resgui-4column resgui-1row justify-content-flex-start align-items-center"; var DisplayValueDiv = document.createElement("div"); DisplayValueDiv.className = "overflow-hidden resgui-15column resgui-1row justify-content-flex-start align-items-center"; var DisplayLabelSpan = document.createElement("span"); DisplayLabelSpan.innerHTML = label; DisplayLabelSpan.style.marginLeft = "var(--resgui-halfcolumn)"; DisplayLabelDiv.appendChild(DisplayLabelSpan); var DisplayValueSpan = document.createElement("span"); DisplayValueSpan.innerHTML = value; DisplayValueDiv.appendChild(DisplayValueSpan); Row.appendChild(DisplayLabelDiv); Row.appendChild(DisplayValueDiv); Row.ElementHTML = DisplayValueSpan ; this.Rows.push(Row); return Row; } this.LogBookSTE.CreateTableHeader = function() { var LogBookTable = $MWGUI.NewTable(); LogBookTable.id = "STE_LogBookTable"; LogBookTable.children[2].children[1].style.overflowX = "hidden"; LogBookTable.children[2].children[1].style.overflowY = "auto"; var InstanceHeader = LogBookTable.AddColumn("Instance", 2); InstanceHeader.Header.className += " justify-content-center"; var spanDescName = document.createElement("span"); spanDescName.innerHTML = $MWGUI.GetLanguageString("STE_LogBookTable_Instance"); spanDescName.style.textTransform = "uppercase"; spanDescName.style.fontSize = "var(--resgui-font-height-s)"; InstanceHeader.Header.appendChild(spanDescName); var TypeHeader = LogBookTable.AddColumn("TypeCall", 2); TypeHeader.Header.className += " justify-content-center"; var spanTypeName = document.createElement("span"); spanTypeName.innerHTML = $MWGUI.GetLanguageString("STE_LogBookTable_TypeCall"); spanTypeName.style.textTransform = "uppercase"; spanTypeName.style.fontSize = "var(--resgui-font-height-s)"; TypeHeader.Header.appendChild(spanTypeName); var PhoneHeader = LogBookTable.AddColumn("PhoneNumber", 3); PhoneHeader.Header.className += " justify-content-center"; var spanPhoneName = document.createElement("span"); spanPhoneName.innerHTML = $MWGUI.GetLanguageString("STE_LogBookTable_PhoneNumber"); spanPhoneName.style.textTransform = "uppercase"; spanPhoneName.style.fontSize = "var(--resgui-font-height-s)"; PhoneHeader.Header.appendChild(spanPhoneName); var BusinessHeader = LogBookTable.AddColumn("Business", 5); BusinessHeader.Header.className += " justify-content-center"; var spanBusinessName = document.createElement("span"); spanBusinessName.innerHTML = $MWGUI.GetLanguageString("STE_LogBookTable_Business"); spanBusinessName.style.textTransform = "uppercase"; spanBusinessName.style.fontSize = "var(--resgui-font-height-s)"; BusinessHeader.Header.appendChild(spanBusinessName); var AddressHeader = LogBookTable.AddColumn("Address", 5); AddressHeader.Header.className += " justify-content-center"; var spanAddressName = document.createElement("span"); spanAddressName.innerHTML = $MWGUI.GetLanguageString("STE_LogBookTable_Address"); spanAddressName.style.textTransform = "uppercase"; spanAddressName.style.fontSize = "var(--resgui-font-height-s)"; AddressHeader.Header.appendChild(spanAddressName); var OfficeHeader = LogBookTable.AddColumn("Office", 3); OfficeHeader.Header.className += " justify-content-center"; var spanOfficeName = document.createElement("span"); spanOfficeName.innerHTML = $MWGUI.GetLanguageString("STE_LogBookTable_Office"); spanOfficeName.style.textTransform = "uppercase"; spanOfficeName.style.fontSize = "var(--resgui-font-height-s)"; OfficeHeader.Header.appendChild(spanOfficeName); var StartHeader = LogBookTable.AddColumn("Start", 2); StartHeader.Header.className += " justify-content-center"; var spanStartName = document.createElement("span"); spanStartName.innerHTML = $MWGUI.GetLanguageString("STE_LogBookTable_Start"); spanStartName.style.textTransform = "uppercase"; spanStartName.style.fontSize = "var(--resgui-font-height-s)"; StartHeader.Header.appendChild(spanStartName); var EndHeader = LogBookTable.AddColumn("End", 2); EndHeader.Header.className += " justify-content-center"; var spanEndName = document.createElement("span"); spanEndName.innerHTML = $MWGUI.GetLanguageString("STE_LogBookTable_End"); spanEndName.style.textTransform = "uppercase"; spanEndName.style.fontSize = "var(--resgui-font-height-s)"; EndHeader.Header.appendChild(spanEndName); var DurationHeader = LogBookTable.AddColumn("Duration", 2); DurationHeader.Header.className += " justify-content-center"; var spanDurationName = document.createElement("span"); spanDurationName.innerHTML = $MWGUI.GetLanguageString("STE_LogBookTable_Duration"); spanDurationName.style.textTransform = "uppercase"; spanDurationName.style.fontSize = "var(--resgui-font-height-s)"; DurationHeader.Header.appendChild(spanDurationName); var CallerHeader = LogBookTable.AddColumn("Caller", 3); CallerHeader.Header.className += " justify-content-center"; var spanCallerName = document.createElement("span"); spanCallerName.innerHTML = $MWGUI.GetLanguageString("STE_LogBookTable_Caller"); spanCallerName.style.textTransform = "uppercase"; spanCallerName.style.fontSize = "var(--resgui-font-height-s)"; CallerHeader.Header.appendChild(spanCallerName); var AudioHeader = LogBookTable.AddColumn("Audio", 2); AudioHeader.Header.className += " justify-content-center"; var spanAudioName = document.createElement("span"); spanAudioName.innerHTML = $MWGUI.GetLanguageString("STE_LogBookTable_Audio"); spanAudioName.style.textTransform = "uppercase"; spanAudioName.style.fontSize = "var(--resgui-font-height-s)"; AudioHeader.Header.appendChild(spanAudioName); return LogBookTable; } this.LogBookSTE.GetImgIcons = function(connectionType) { let imgType ; switch(connectionType) { case "inbound" : { imgType = "inboundCall.png"; break; } case "outbound" : { imgType = "outboundCall.png"; break; } } return imgType; } this.LogBookSTE.GetCallResult = function(contactInfo) { let resultCall = {}; if(contactInfo.IsEnd) { if(contactInfo.RefuseAgent || contactInfo.RefuseCustomer) { if(contactInfo.RefuseAgent) { resultCall.image = "refuseACall.png"; resultCall.title = $MWGUI.GetLanguageString("STE_RefuseACall"); } if(contactInfo.RefuseCustomer) { resultCall.image = "refuseCCall.png" resultCall.title = $MWGUI.GetLanguageString("STE_RefuseCCall"); } } else { if(contactInfo.Missed && contactInfo.Error) { resultCall.image = "missedCall.png"; resultCall.title = $MWGUI.GetLanguageString("STE_MissedCall"); } if(contactInfo.Error && !contactInfo.Missed) { resultCall.image = "errorCall.png"; resultCall.title = $MWGUI.GetLanguageString("STE_ErrorCall"); } } } if(Object.entries(resultCall).length == 0) { resultCall.image = "OKCall.png"; resultCall.title = $MWGUI.GetLanguageString("STE_OKCall");; } return resultCall; } this.LogBookSTE.PlayAudioFile = function(file) { var ListenRecording = new TMWGUICustomBox(3, 5); var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("STE_ListenRecording"); var spanClose = document.createElement("span"); spanClose.innerHTML = "×"; spanClose.style.fontSize = "var(--resgui-font-height-xl)"; spanClose.style.cursor = "pointer"; spanClose.style.marginRight = "var(--resgui-quartercolumn)"; spanClose.CustomBox = ListenRecording; spanClose.onclick = function (ev) { var Target = ev.target; Target.CustomBox.Close(); }; ListenRecording.Title.className += " justify-content-space-between"; ListenRecording.Title.appendChild(spanTitle); ListenRecording.Title.appendChild(spanClose); var Content = document.createElement("div"); Content.className = "column-direction overflow-hidden relative-full-width relative-full-height justify-content-center align-items-center"; Content.id = "ListenCallRecording"; var AudioDiv = document.createElement("div"); AudioDiv.className = "justify-content-center align-items-center"; var AudioPlayer = document.createElement("AUDIO"); AudioPlayer.src = file; AudioPlayer.controls = true; AudioPlayer.type = "audio/wav"; AudioDiv.appendChild(AudioPlayer); Content.appendChild(AudioDiv); ListenRecording.Body.appendChild(Content); ListenRecording.Open(); } if($MWSTE) { if($MWSTE.LogBook) { if($MWSTE.LogBook) { if($MWSTE.LogBook.length > 0) { let LogTableHeader = this.LogBookSTE.CreateTableHeader(); for(Index in $MWSTE.LogBook) { var Row = LogTableHeader.AddRow(); if($MWSTE.LogBook[Index].InstanceName) { Row.Cells[0].className += " align-items-center justify-content-center"; var RowFieldInstance = document.createElement("span"); RowFieldInstance.innerHTML = $MWSTE.LogBook[Index].InstanceName; RowFieldInstance.title = $MWSTE.LogBook[Index].InstanceName; RowFieldInstance.style.fontSize = "var(--resgui-font-height-s)"; Row.Cells[0].appendChild(RowFieldInstance); } if($MWSTE.LogBook[Index].ContactInfo) if($MWSTE.LogBook[Index].ContactInfo.TypeConnection) { Row.Cells[1].className += " align-items-center justify-content-center"; var RowFieldType = document.createElement("img"); RowFieldType.src = "../../../../../../../../../../../../images/icons/" + this.LogBookSTE.GetImgIcons($MWSTE.LogBook[Index].ContactInfo.TypeConnection); RowFieldType.className = "icon-image"; RowFieldType.title = $MWSTE.LogBook[Index].ContactInfo.TypeConnection; RowFieldType.style.marginLeft = "var(--resgui-sixteenthcolumn)"; RowFieldType.style.marginRight = "var(--resgui-sixteenthcolumn)"; Row.Cells[1].appendChild(RowFieldType); } if($MWSTE.LogBook[Index].ContactInfo) { var RowFieldType2 = document.createElement("img"); let resultCall = this.LogBookSTE.GetCallResult($MWSTE.LogBook[Index].ContactInfo); RowFieldType2.src = "../../../../../../../../../../../../images/icons/" + resultCall.image; RowFieldType2.className = "icon-image"; RowFieldType2.title = resultCall.title; RowFieldType2.style.marginLeft = "var(--resgui-sixteenthcolumn)"; RowFieldType2.style.marginRight = "var(--resgui-sixteenthcolumn)"; //RowFieldType.innerHTML = $MWSTE.LogBook[Index].ContactInfo.TypeConnection; //RowFieldType.style.fontSize = "var(--resgui-font-height-s)"; Row.Cells[1].appendChild(RowFieldType2); } if($MWSTE.LogBook[Index].ContactInfo.InPhoneNumber) { Row.Cells[2].className += " align-items-center justify-content-center"; var RowFieldPhone = document.createElement("span"); RowFieldPhone.innerHTML = $MWSTE.LogBook[Index].ContactInfo.InPhoneNumber; RowFieldPhone.title = $MWSTE.LogBook[Index].ContactInfo.InPhoneNumber; RowFieldPhone.style.marginLeft = "var(--resgui-sixteenthcolumn)"; RowFieldPhone.style.marginRight = "var(--resgui-sixteenthcolumn)"; RowFieldPhone.style.fontSize = "var(--resgui-font-height-s)"; Row.Cells[2].appendChild(RowFieldPhone); } if($MWSTE.LogBook[Index].ContactInfo) if($MWSTE.LogBook[Index].ContactInfo.Site) { Row.Cells[3].className += " align-items-center justify-content-center"; var RowFieldBusiness = document.createElement("span"); RowFieldBusiness.innerHTML = $MWSTE.LogBook[Index].ContactInfo.Site.Name; RowFieldBusiness.title = $MWSTE.LogBook[Index].ContactInfo.Site.Name; RowFieldBusiness.style.fontSize = "var(--resgui-font-height-s)"; RowFieldBusiness.style.marginLeft = "var(--resgui-sixteenthcolumn)"; RowFieldBusiness.style.marginRight = "var(--resgui-sixteenthcolumn)"; Row.Cells[3].appendChild(RowFieldBusiness); } if($MWSTE.LogBook[Index].ContactInfo) if($MWSTE.LogBook[Index].ContactInfo.Site) { Row.Cells[4].className += " align-items-center justify-content-center"; var RowFieldAddress = document.createElement("span"); RowFieldAddress.innerHTML = $MWSTE.LogBook[Index].ContactInfo.Site.Address; RowFieldAddress.title = $MWSTE.LogBook[Index].ContactInfo.Site.Address; RowFieldAddress.style.fontSize = "var(--resgui-font-height-s)"; RowFieldAddress.style.marginLeft = "var(--resgui-sixteenthcolumn)"; RowFieldAddress.style.marginRight = "var(--resgui-sixteenthcolumn)"; Row.Cells[4].appendChild(RowFieldAddress); } if($MWSTE.LogBook[Index].ContactInfo) if($MWSTE.LogBook[Index].ContactInfo.Site) { Row.Cells[5].className += " align-items-center justify-content-center"; var RowFieldOffice = document.createElement("span"); RowFieldOffice.innerHTML = $MWSTE.LogBook[Index].ContactInfo.Site.City; RowFieldOffice.title = $MWSTE.LogBook[Index].ContactInfo.Site.City; RowFieldOffice.style.fontSize = "var(--resgui-font-height-s)"; RowFieldOffice.style.marginLeft = "var(--resgui-sixteenthcolumn)"; RowFieldOffice.style.marginRight = "var(--resgui-sixteenthcolumn)"; Row.Cells[5].appendChild(RowFieldOffice); } if($MWSTE.LogBook[Index].StartCall) { Row.Cells[6].className += " align-items-center justify-content-center"; var RowFieldStart = document.createElement("span"); RowFieldStart.innerHTML = Me.GetDateISOFormat(new Date($MWSTE.LogBook[Index].StartCall.timestamp),"Print-it").split(" ")[1]; RowFieldStart.title = Me.GetDateISOFormat(new Date($MWSTE.LogBook[Index].StartCall.timestamp),"Print-it").split(" ")[1]; RowFieldStart.style.marginLeft = "var(--resgui-sixteenthcolumn)"; RowFieldStart.style.marginRight = "var(--resgui-sixteenthcolumn)"; RowFieldStart.style.fontSize = "var(--resgui-font-height-s)"; Row.Cells[6].appendChild(RowFieldStart); } if($MWSTE.LogBook[Index].EndCall) { Row.Cells[7].className += " align-items-center justify-content-center"; var RowFieldEnd = document.createElement("span"); RowFieldEnd.innerHTML = Me.GetDateISOFormat(new Date($MWSTE.LogBook[Index].EndCall.timestamp),"Print-it").split(" ")[1]; RowFieldEnd.title = Me.GetDateISOFormat(new Date($MWSTE.LogBook[Index].EndCall.timestamp),"Print-it").split(" ")[1]; RowFieldEnd.style.marginLeft = "var(--resgui-sixteenthcolumn)"; RowFieldEnd.style.marginRight = "var(--resgui-sixteenthcolumn)"; RowFieldEnd.style.fontSize = "var(--resgui-font-height-s)"; Row.Cells[7].appendChild(RowFieldEnd); } Row.Cells[8].className += " align-items-center justify-content-center"; var RowFieldDuration = document.createElement("span"); if($MWSTE.LogBook[Index].StartCall && $MWSTE.LogBook[Index].EndCall) { RowFieldDuration.innerHTML = Me.GetDuration(new Date($MWSTE.LogBook[Index].StartCall.timestamp),new Date($MWSTE.LogBook[Index].EndCall.timestamp)); RowFieldDuration.title = Me.GetDuration(new Date($MWSTE.LogBook[Index].StartCall.timestamp),new Date($MWSTE.LogBook[Index].EndCall.timestamp)); } else { RowFieldDuration.innerHTML = "00:00:00"; RowFieldDuration.title = "00:00:00"; } RowFieldDuration.style.marginLeft = "var(--resgui-sixteenthcolumn)"; RowFieldDuration.style.marginRight = "var(--resgui-sixteenthcolumn)"; RowFieldDuration.style.fontSize = "var(--resgui-font-height-s)"; Row.Cells[8].appendChild(RowFieldDuration); if($MWSTE.LogBook[Index].ContactInfo) if($MWSTE.LogBook[Index].ContactInfo.TCustomerSTE) { Row.Cells[9].className += " align-items-center justify-content-center"; var RowFieldCaller = document.createElement("span"); RowFieldCaller.innerHTML = $MWSTE.LogBook[Index].ContactInfo.TCustomerSTE.Name + " " + $MWSTE.LogBook[Index].ContactInfo.TCustomerSTE.Surname; RowFieldCaller.title = $MWSTE.LogBook[Index].ContactInfo.TCustomerSTE.Name + " " + $MWSTE.LogBook[Index].ContactInfo.TCustomerSTE.Surname; RowFieldCaller.style.fontSize = "var(--resgui-font-height-s)"; RowFieldCaller.style.marginLeft = "var(--resgui-sixteenthcolumn)"; RowFieldCaller.style.marginRight = "var(--resgui-sixteenthcolumn)"; Row.Cells[9].appendChild(RowFieldCaller); } if($MWSTE.LogBook[Index].ContactInfo.RecordingLink) { let UrlRecording = Me.CCPAgent.ListenAudioRecording($MWSTE.LogBook[Index].ContactInfo.RecordingLink, $MWSTE.LogBook[Index].InstanceName); if(UrlRecording != null) { Row.Cells[10].className += " align-items-center justify-content-center"; var RowFieldAudio = document.createElement("img"); RowFieldAudio.src = "../../../../../../../../../../../../images/icons/recordingAudio.png"; RowFieldAudio.className = "icon-image"; RowFieldAudio.style.marginLeft = "var(--resgui-sixteenthcolumn)"; RowFieldAudio.style.marginRight = "var(--resgui-sixteenthcolumn)"; RowFieldAudio.addEventListener("click",function() { BookLog.LogBookSTE.PlayAudioFile(UrlRecording); }) ; Row.Cells[10].appendChild(RowFieldAudio); } } } MainContentLog.appendChild(LogTableHeader); } else { var NoElement = this.LogBookSTE.CreateRow("",$MWGUI.GetLanguageString("EmptyReadBook")); MainContentLog.appendChild(NoElement); } } } } this.LogBookSTE.appendChild(MainContentLog); } } var spanClose = document.createElement("span"); spanClose.innerHTML = "×"; spanClose.style.fontSize = "var(--resgui-font-height-xl)"; spanClose.style.cursor = "pointer"; spanClose.style.marginRight = "var(--resgui-quartercolumn)"; spanClose.CustomBox = DashBoardBox; spanClose.onclick = function (ev) { var Target = ev.target; Me.CCPAgent.getStatusTime(false); Target.CustomBox.IsActive = false; Target.CustomBox.Close(); delete $MWSTE.DashBoardBox; }; var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("STETitleInfo"); DashBoardBox.Title.className += " justify-content-space-between"; DashBoardBox.Title.appendChild(spanTitle); DashBoardBox.Title.appendChild(spanClose); var Content = document.createElement("div"); Content.className = "column-direction overflow-hidden relative-full-width relative-full-height justify-content-flex-start align-items-flex-start"; Content.id = "SearchSite"; var DivMainContainer = document.createElement("div"); DivMainContainer.id = "MainContainer"; DivMainContainer.className = "relative-full-width relative-full-height column-direction"; var DivHeader = document.createElement("div"); DivHeader.className = "MWTabClass"; DivHeader.setAttribute("data-MWTab", '{"IsHeader":true}'); DivMainContainer.appendChild(DivHeader); var InfoSTE = document.createElement("div"); InfoSTE.className = "MWTabClass"; DashBoardBox.InfoSTE = InfoSTE ; InfoSTE.setAttribute("data-MWTab", '{"Title":"STE-Info","Icon":"../../../../../../../../../../../../../../../../../../images/icons/argoIcon.png","Show":true}'); DivMainContainer.appendChild(InfoSTE); var LogBookSTE = document.createElement("div"); LogBookSTE.className = "MWTabClass"; DashBoardBox.LogBookSTE = LogBookSTE ; LogBookSTE.setAttribute("data-MWTab", '{"Title":"STE-LogBook","Icon":"../../../../../../../../../../../../../../../../../../images/icons/argoIcon.png"}'); DivMainContainer.appendChild(LogBookSTE); var TabOutboundSTE = document.createElement("div"); TabOutboundSTE.className = "MWTabClass"; DashBoardBox.TabOutboundSTE = TabOutboundSTE ; TabOutboundSTE.setAttribute("data-MWTab",'{"Title":"STE-Outbound","Icon":"../../../../../../../../../../../../../../../../../../images/icons/argoIcon.png"}' ); DivMainContainer.appendChild(TabOutboundSTE); Content.appendChild(DivMainContainer); DashBoardBox.Body.appendChild(Content); DashBoardBox.Open(); DashBoardBox.IsActive = true; DashBoardBox.OnLoadFunction(); } this.SearchSite = function() { var SiteBox = this; var SearchBox = new TMWGUICustomBox(19, 32); var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("STESearchSiteInfo"); SearchBox.Title.className += " justify-content-space-between"; SearchBox.Title.appendChild(spanTitle); var Content = document.createElement("div"); Content.className = "column-direction overflow-hidden relative-full-width relative-full-height justify-content-flex-start align-items-flex-start"; Content.id = "SearchSite"; var options = {}; options.DisableCache = true; options.IsChild = true; options.CheckOnlyOneCheckBox = true; options.InstancesReadOnly = true; //options.Query = {"Field":"_id", "Type":"Eq", "Value":"CARREFOUR@CHIVASSO_ITALY"}; options.DisableAddButton = true; options.DisableSearchButton = true; options.DisableDelete = true; options.Buttons = [{"Description":$MWGUI.GetLanguageString("SearchSiteConfirm"),"SourceIcon":"../../../../../../../../../../images/icons/confirmIcon.png","Tag":"Confirm"}] SiteBox.ExecuteFlow = function(Elements, IdFlow, CustomBox) { if(Elements.length > 0) { //console.log(Elements[0].Object); if(Elements[0].SubOption) { if(Elements[0].SubOption.EndPoint) { //console.log(Elements[0].SubOption.EndPoint); var Param= { "database" : "MWProcessDesigner", "Assembly" : "Flows", "ClassReference" : "Flows", "Skip" : 0, "Limit" : 1, "TQueryParameter" : {"Type":"Eq", "Field":"_id","Value": IdFlow}, }; $MW.ExeLambda(LambdaFunctionsDictionary["GetInstances"]["Argo"][Elements[0].SubOption.EndPoint],Param, function(Answer,OriginalMessage) { if(Answer) { console.log(CustomBox.SelectType); CustomBox.Close(); var Index = Me.SelectInstance.CCP_MW.CustomBoxes.indexOf(SearchBox); if(Index > -1) Me.SelectInstance.CCP_MW.CustomBoxes.splice(Index, 1); Me.SelectInstance.CCP_MW.ContactInfo.Site = Elements[0].Object; $MWArgo.Navigation.GetLinks({EndPoint:"SMARTGRID"}, Elements[0].Object["_id"], "753", function(LinkUrls) { $MWProcessDesigner.Execution.ExecuteFlow({"Service":"STE", "ServiceType":"Inbound","STARTSTE":{"TSite":Elements[0].Object,"TCustomerSTE":Me.SelectInstance.CCP_MW.ContactInfo.TCustomerSTE,"InboundNumber":Me.SelectInstance.CCP_MW.ContactInfo.InPhoneNumber,"TAgent":$MW.User.Name, "TSource":{"LinkUrls":LinkUrls}}},Answer.Instances[0].Flow,null,{}); }) console.log(Answer); } }, function(Error,ErrorStack) { $MWGUI.MessageBoxShow($MWGUI.GetLanguageString("ErrorMsgTitle"),$MWGUI.GetLanguageString("ErrorMsgBodyProcessFlow"),"error",[{"text":$MWGUI.GetLanguageString("MessageButtonOK"),"Callback":function(){}}]); } , "Argo",true); } } } } SiteBox.CreateAssociatePhoneNumberBox = function(Elements) { var AssociateBox = new TMWGUICustomBox(19, 32); AssociateBox.SelectType = ""; var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("STEAssociateInfo"); AssociateBox.Title.className += " justify-content-space-between"; AssociateBox.Title.appendChild(spanTitle); var Content = document.createElement("div"); Content.className = "column-direction overflow-hidden relative-full-width relative-full-height justify-content-center align-items-center"; Content.id = "AssociatePhoneNumber"; var ContentCustomerDiv = document.createElement("div"); ContentCustomerDiv.className = "row-direction overflow-hidden relative-full-width resgui-4row justify-content-center align-items-center"; var ContentCatDiv = document.createElement("div"); ContentCatDiv.className = "row-direction overflow-hidden relative-full-width resgui-4row justify-content-center align-items-center"; var ContentOtherDiv = document.createElement("div"); ContentOtherDiv.className = "row-direction overflow-hidden relative-full-width resgui-4row justify-content-center align-items-center"; var CustomerButton = document.createElement("div"); CustomerButton.className = "button-application resgui-8column resgui-2row"; CustomerButton.CustomBox = AssociateBox; CustomerButton.addEventListener("click",function(ev){ var Target = ev.target; if(Target.nodeName != "DIV") Target = Target.parentNode; Target.CustomBox.SelectType = "CUSTOMER"; SiteBox.ExecuteFlow(Elements, "dnI5iEFOa3MaWE3KaT2qLzJG8PZaqi1YO4hKffAw0Uc=",AssociateBox); }); var CustomerButtonSpan = document.createElement("span"); CustomerButtonSpan.innerHTML = $MWGUI.GetLanguageString("CustomerButtonAssociate"); CustomerButtonSpan.textTransform = "uppercase"; CustomerButton.appendChild(CustomerButtonSpan); var CatButton = document.createElement("div"); CatButton.className = "button-application resgui-8column resgui-2row"; CatButton.CustomBox = AssociateBox; CatButton.addEventListener("click",function(ev){ var Target = ev.target; if(Target.nodeName != "DIV") Target = Target.parentNode; Target.CustomBox.SelectType = "CAT"; SiteBox.ExecuteFlow(Elements, "dnI5iEFOa3MaWE3KaT2qLzJG8PZaqi1YO4hKffAw0Uc=",AssociateBox); }); var CatButtonSpan = document.createElement("span"); CatButtonSpan.innerHTML = $MWGUI.GetLanguageString("CatButtonAssociate"); CatButtonSpan.textTransform = "uppercase"; var OtherButton = document.createElement("div"); OtherButton.className = "button-application resgui-8column resgui-2row"; OtherButton.CustomBox = AssociateBox; OtherButton.addEventListener("click",function(ev){ var Target = ev.target; if(Target.nodeName != "DIV") Target = Target.parentNode; Target.CustomBox.SelectType = "OTHER"; SiteBox.ExecuteFlow(Elements, "dnI5iEFOa3MaWE3KaT2qLzJG8PZaqi1YO4hKffAw0Uc=",AssociateBox); }); var OtherButtonSpan = document.createElement("span"); OtherButtonSpan.innerHTML = $MWGUI.GetLanguageString("OtherButtonAssociate"); OtherButtonSpan.textTransform = "uppercase"; CustomerButton.appendChild(CustomerButtonSpan); CatButton.appendChild(CatButtonSpan); OtherButton.appendChild(OtherButtonSpan); ContentCustomerDiv.appendChild(CustomerButton); ContentCatDiv.appendChild(CatButton); ContentOtherDiv.appendChild(OtherButton); Content.appendChild(ContentCustomerDiv); Content.appendChild(ContentCatDiv); Content.appendChild(ContentOtherDiv); AssociateBox.Body.appendChild(Content); AssociateBox.Open(); } var iframe = document.createElement('iframe'); iframe.src = "../../../../../Argo/Site/SiteList.html?" + $MW.Base64Encode(JSON.stringify(options)); iframe.style.height = "calc(var(--resgui-18row) - 0.3vh)"; iframe.style.maxHeight = "calc(var(--resgui-18row) - 0.3vh)"; iframe.style.minHeight = "calc(var(--resgui-18row) - 0.3vh)"; iframe.style.width = "calc(var(--resgui-31column) - 3px)"; iframe.style.maxWidth = "calc(var(--resgui-31column) - 3px)"; iframe.style.minWidth = "calc(var(--resgui-31column) - 3px)"; iframe.addEventListener("load", function(ev){ ev.target.contentWindow.ActionCallback = function(Event, Elements, ButtonTag) { switch(ButtonTag) { case("Confirm"): { SearchBox.Close(); SiteBox.CreateAssociatePhoneNumberBox(Elements); break; } } } }); Content.appendChild(iframe); SearchBox.Body.appendChild(Content); SearchBox.Open(); Me.SelectInstance.CCP_MW.CustomBoxes.push(SearchBox); } this.CreateCallerForm = function() { var CustomBox = new TMWGUICustomBox(6, 13); var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("STECallerInfo"); CustomBox.Title.className += " justify-content-space-between"; CustomBox.Title.appendChild(spanTitle); CustomBox.ValidateCallerForm = function(name,lastname) { var Resultobj = {}; var patt = new RegExp(/^([a-zA-Z ])+$/gi); var checkName = patt.test(name.value); var patt2 = new RegExp(/^([a-zA-Z ])+$/gi); var checkLastName = patt2.test(lastname.value); if(checkName) name.className = name.className.replace(" ErrorMark",""); else name.className = name.className + " ErrorMark"; if(checkLastName) lastname.className = lastname.className.replace(" ErrorMark",""); else lastname.className = lastname.className + " ErrorMark"; if(checkName && checkLastName) { Resultobj.Name = name.value; Resultobj.Surname = lastname.value; } return Resultobj; } var Content = document.createElement("div"); Content.className = "column-direction overflow-hidden relative-full-width relative-full-height justify-content-flex-start align-items-flex-start"; Content.id = "Caller-Info"; var MessageDiv = document.createElement("div"); MessageDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-center align-items-center"; var LabelMessageSpan = document.createElement("span"); LabelMessageSpan.innerHTML = $MWGUI.GetLanguageString("STECallerMessage"); LabelMessageSpan.style.marginLeft = "var(--resgui-halfcolumn)"; MessageDiv.appendChild(LabelMessageSpan); var NameDiv = document.createElement("div"); NameDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-center align-items-center"; //NameDiv.style.marginTop = "var(--resgui-1row)"; var LabelNameDiv = document.createElement("div"); LabelNameDiv.className = "row-direction overflow-hidden resgui-3column resgui-1row justify-content-flex-end align-items-center"; var LabelNameSpan = document.createElement("span"); LabelNameSpan.innerHTML = $MWGUI.GetLanguageString("STECallerName"); LabelNameSpan.style.marginLeft = "var(--resgui-halfcolumn)"; var InputNameDiv = document.createElement("div"); InputNameDiv.className = "row-direction overflow-hidden resgui-10column resgui-1row justify-content-flex-start align-items-center"; var InputName = document.createElement("input"); InputName.type = "text"; LabelNameDiv.appendChild(LabelNameSpan); NameDiv.appendChild(LabelNameDiv); InputNameDiv.appendChild(InputName); NameDiv.appendChild(InputNameDiv); var LastNameDiv = document.createElement("div"); LastNameDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-center align-items-center"; //LastNameDiv.style.marginTop = "var(--resgui-1row)"; var LabelLastNameDiv = document.createElement("div"); LabelLastNameDiv.className = "row-direction overflow-hidden resgui-3column resgui-1row justify-content-flex-end align-items-center"; var LabelLastNameSpan = document.createElement("span"); LabelLastNameSpan.innerHTML = $MWGUI.GetLanguageString("STECallerLastName"); LabelLastNameSpan.style.marginLeft = "var(--resgui-halfcolumn)"; var InputLastNameDiv = document.createElement("div"); InputLastNameDiv.className = "row-direction overflow-hidden resgui-10column resgui-1row justify-content-flex-start align-items-center"; var InputLastName = document.createElement("input"); InputLastName.type = "text"; LabelLastNameDiv.appendChild(LabelLastNameSpan); LastNameDiv.appendChild(LabelLastNameDiv); InputLastNameDiv.appendChild(InputLastName); LastNameDiv.appendChild(InputLastNameDiv); var ButtonConfirmDiv = document.createElement("div"); ButtonConfirmDiv.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-center align-items-center"; ButtonConfirmDiv.style.marginTop = "var(--resgui-1row)"; var Confirm = document.createElement("div"); Confirm.className = "button-application"; Confirm.CustomBox = CustomBox; Confirm.InputName = InputName; Confirm.InputLastName = InputLastName; Confirm.addEventListener("click",function(ev){ var Target = ev.target; if(Target.nodeName != "DIV") Target = Target.parentNode; var Result = Target.CustomBox.ValidateCallerForm(Target.InputName,Target.InputLastName); Me.SelectInstance.CCP_MW.ContactInfo.TCustomerSTE = {}; Me.SelectInstance.CCP_MW.ContactInfo.TCustomerSTE.Name = Result.Name; Me.SelectInstance.CCP_MW.ContactInfo.TCustomerSTE.Surname = Result.Surname; if(Result != {}) { Target.CustomBox.Close(); Me.SearchSite(); } }); var ConfirmSpan = document.createElement("span"); ConfirmSpan.innerHTML = $MWGUI.GetLanguageString("ConfirmButton"); Confirm.appendChild(ConfirmSpan); ButtonConfirmDiv.appendChild(Confirm); Content.appendChild(MessageDiv); Content.appendChild(NameDiv); Content.appendChild(LastNameDiv); Content.appendChild(ButtonConfirmDiv); CustomBox.Body.appendChild(Content); CustomBox.Open(); Me.SelectInstance.CCP_MW.CustomBoxes.push(CustomBox); } this.CreateInboundCallPopup = function() { var InboundPopup = this; this.CreateRow = function(label,value) { var Row = document.createElement("div"); Row.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center"; var DisplayLabelDiv = document.createElement("div"); DisplayLabelDiv.className = "row-direction overflow-hidden resgui-5column resgui-1row justify-content-flex-start align-items-center"; var DisplayValueDiv = document.createElement("div"); DisplayValueDiv.className = "row-direction overflow-hidden resgui-7column resgui-1row justify-content-flex-start align-items-center"; DisplayValueDiv.style.marginLeft = "var(--resgui-halfcolumn)"; var DisplayLabelSpan = document.createElement("span"); DisplayLabelSpan.innerHTML = label; DisplayLabelSpan.style.marginLeft = "var(--resgui-halfcolumn)"; DisplayLabelDiv.appendChild(DisplayLabelSpan); var DisplayValueSpan = document.createElement("span"); DisplayValueSpan.innerHTML = value; DisplayValueDiv.appendChild(DisplayValueSpan); Row.appendChild(DisplayLabelDiv); Row.appendChild(DisplayValueDiv); Row.ElementHTML = DisplayValueSpan ; return Row; } var CustomBox = new TMWGUICustomBox(8, 12); Me.ResponseCustomBox = CustomBox; var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("STEInboundCallPopup") + " " + Me.SelectInstance.CCP_MW.InstanceName; CustomBox.Title.className += " justify-content-flex-start"; CustomBox.Title.appendChild(spanTitle); var InboundContent = document.createElement("div"); InboundContent.className = "column-direction overflow-hidden relative-full-width relative-full-height justify-content-flex-start align-items-flex-start"; InboundContent.id = "AnswerCall-Content"; var DisplayAnswerCall = document.createElement("div"); DisplayAnswerCall.className = "column-direction overflow-hidden relative-full-width resgui-3row justify-content-center align-items-center"; DisplayAnswerCall.style.marginTop = "var(--resgui-1row)"; DisplayAnswerCall.style.marginBottom = "var(--resgui-1row)"; var DisplayPhoneNumber = this.CreateRow($MWGUI.GetLanguageString("PhoneNumber"),Me.SelectInstance.CCP_MW.ContactInfo.InPhoneNumber); var DisplayPhoneName = this.CreateRow($MWGUI.GetLanguageString("NamePhoneNumber"), Me.SelectInstance.CCP_MW.ContactInfo.Caller); var DisplayInstanceName = this.CreateRow($MWGUI.GetLanguageString("InstanceName"), Me.SelectInstance.CCP_MW.InstanceName); DisplayAnswerCall.appendChild(DisplayInstanceName); DisplayAnswerCall.appendChild(DisplayPhoneNumber); DisplayAnswerCall.appendChild(DisplayPhoneName); var ToolbarAnswerCall = document.createElement("div"); ToolbarAnswerCall.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-space-around align-items-center"; ToolbarAnswerCall.style.backgroundColor = "var(--secondary-toolbar-background)"; ToolbarAnswerCall.style.marginTop = "var(--resgui-1row)"; ToolbarAnswerCall.id = "AnswerCall-Toolbar"; var AcceptCall = document.createElement("div"); AcceptCall.className = "button-application "; AcceptCall.CustomBox = CustomBox; AcceptCall.style.backgroundColor = "var(--green-mediumdark)"; AcceptCall.addEventListener("click",function(ev){ var Target = ev.target; if(Target.nodeName!="DIV") Target = Target.parentNode; Me.SelectInstance.CCP_MW.ContactInfo.Contact.accept({ success: function() { console.log("Telefonata Accettata"); //Me.CreateCallerForm(); }, failure: function(err) { console.log("Errore Telefonata Accettata"); console.log(err); } }); Target.CustomBox.Close(); var Index = Me.SelectInstance.CCP_MW.CustomBoxes.indexOf(Target.CustomBox); if(Index > -1) Me.SelectInstance.CCP_MW.CustomBoxes.splice(Index, 1); }); var ImgAccept = document.createElement("img"); ImgAccept.src = "../../../../../../../../../../images/icons/PhoneIcon.png"; ImgAccept.className = "icon-image"; ImgAccept.style.marginRight = "var(--resgui-quartercolumn)"; AcceptCall.appendChild(ImgAccept); var AcceptCallSpan = document.createElement("span"); AcceptCallSpan.innerHTML = $MWGUI.GetLanguageString("AcceptCall"); AcceptCall.appendChild(AcceptCallSpan); var RejectCall = document.createElement("div"); RejectCall.className = "button-application"; RejectCall.style.backgroundColor = "var(--red)"; RejectCall.CustomBox = CustomBox; //RejectCall.style.marginLeft = "var(--resgui-2column)"; RejectCall.addEventListener("click",function(ev){ var Target = ev.target; if(Target.nodeName != "DIV") Target = Target.parentNode; Me.SelectInstance.CCP_MW.ContactInfo.Contact.reject( { success: function() { console.log("Telefonata Rifiutata"); }, failure: function(err) { console.log("Errore Telefonata Rifiutata"); console.log(err); } }); var Index = Me.SelectInstance.CCP_MW.CustomBoxes.indexOf(Target.CustomBox); if(Index > -1) Me.SelectInstance.CCP_MW.CustomBoxes.splice(Index, 1); Target.CustomBox.Close(); }); var ImgReject = document.createElement("img"); ImgReject.src = "../../../../../../images/icons/closeIcon.png"; ImgReject.className = "icon-image"; ImgReject.style.marginRight = "var(--resgui-quartercolumn)"; RejectCall.appendChild(ImgReject); var RejectCallSpan = document.createElement("span"); RejectCallSpan.innerHTML = $MWGUI.GetLanguageString("RejectCall"); RejectCall.appendChild(RejectCallSpan); ToolbarAnswerCall.appendChild(AcceptCall); ToolbarAnswerCall.appendChild(RejectCall); InboundContent.appendChild(DisplayAnswerCall); InboundContent.appendChild(ToolbarAnswerCall); CustomBox.Body.appendChild(InboundContent); CustomBox.Open(); Me.SelectInstance.CCP_MW.CustomBoxes.push(CustomBox); } this.CreateOutboundCallPopup = function() { this.CreateRow = function(label,value) { var Row = document.createElement("div"); Row.className = "row-direction overflow-hidden relative-full-width resgui-1row justify-content-flex-start align-items-center"; var DisplayLabelDiv = document.createElement("div"); DisplayLabelDiv.className = "row-direction overflow-hidden resgui-5column resgui-1row justify-content-flex-start align-items-center"; var DisplayValueDiv = document.createElement("div"); DisplayValueDiv.className = "row-direction overflow-hidden resgui-7column resgui-1row justify-content-flex-start align-items-center"; DisplayValueDiv.style.marginLeft = "var(--resgui-halfcolumn)"; var DisplayLabelSpan = document.createElement("span"); DisplayLabelSpan.innerHTML = label; DisplayLabelSpan.style.marginLeft = "var(--resgui-halfcolumn)"; DisplayLabelDiv.appendChild(DisplayLabelSpan); var DisplayValueSpan = document.createElement("span"); DisplayValueSpan.innerHTML = value; DisplayValueDiv.appendChild(DisplayValueSpan); Row.appendChild(DisplayLabelDiv); Row.appendChild(DisplayValueDiv); Row.ElementHTML = DisplayValueSpan ; return Row; } var CustomBox = new TMWGUICustomBox(8, 12); Me.ResponseCustomBox = CustomBox; var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = "Outbound Call"; CustomBox.Title.className += " justify-content-flex-start"; CustomBox.Title.appendChild(spanTitle); var OutboundContent = document.createElement("div"); OutboundContent.className = "column-direction overflow-hidden relative-full-width relative-full-height justify-content-flex-start align-items-flex-start"; OutboundContent.id = "AnswerCall-Content"; var DisplayOutboundCall = document.createElement("div"); DisplayOutboundCall.className = "column-direction overflow-hidden relative-full-width resgui-3row justify-content-center align-items-center"; DisplayOutboundCall.style.marginTop = "var(--resgui-1row)"; DisplayOutboundCall.style.marginBottom = "var(--resgui-1row)"; var endpoint = Me.SelectInstance.CCP_MW.ContactInfo.Connection.getEndpoint(); console.log(endpoint); var DisplayPhoneNumber = this.CreateRow("Chiamo il numero ...",endpoint.phoneNumber); DisplayOutboundCall.appendChild(DisplayPhoneNumber); OutboundContent.appendChild(DisplayOutboundCall); CustomBox.Body.appendChild(OutboundContent); CustomBox.Open(); Me.SelectInstance.CCP_MW.CustomBoxes.push(CustomBox); } this.UpdateAgentList = function() { if($MWSTE) { if($MWSTE.ListAgents) { if($MWSTE.SelectInstance) { let IndexInstance = $MWSTE.SelectInstance.CCP_MW.InstanceName; if($MWSTE.ListAgents[IndexInstance]) { if($MWSTE.ListAgents[IndexInstance].length > 0) { if($MWSTE.DisplayCustomBox) { if($MWSTE.DisplayCustomBox.IsActive) { if($MWSTE.DisplayCustomBox.InfoSTE.AgentsRows) { if($MWSTE.DisplayCustomBox.InfoSTE.AgentsRows.length > 0 ) { for(agent in $MWSTE.ListAgents[IndexInstance]) { let user = Object.keys($MWSTE.ListAgents[IndexInstance][agent])[0]; var FindIndex = $MWSTE.DisplayCustomBox.InfoSTE.AgentsRows.findIndex(x => x.UserName == user); if(FindIndex > -1) { $MWSTE.DisplayCustomBox.InfoSTE.AgentsRows[FindIndex].children[0].title = $MWSTE.ListAgents[IndexInstance][agent][user].AgentStatus; $MWSTE.DisplayCustomBox.InfoSTE.AgentsRows[FindIndex].children[0].children[0].children[0].style.backgroundColor = Me.SelectInstance.getStatusColor($MWSTE.ListAgents[IndexInstance][agent][user].AgentStatus); } else { var AgentNewRow = $MWSTE.DisplayCustomBox.InfoSTE.CreateAgentRow($MWSTE.ListAgents[IndexInstance][agent][user].AgentName,$MWSTE.ListAgents[IndexInstance][agent][user].AgentStatus,user); document.getElementById("STEListAgents").appendChild(AgentNewRow); } } } } } } } } } } } } } var $MWSTE = new MWSTE();