Sub actionopenchamado_Click (Params As Map)
If (UserCode <> "") Then
Log("open chamado : ")
Wait For( Manager.LGPI_InitSession) Complete (tmpSession As String)
Log("session = "&tmpSession)
If (tmpSession <> "") Then
Dim SelectedOption As String = ws.EvalWithResult($"return $('#tecnicosLista').find(":selected").val();"$, Null).Value
Dim tmpchamadoTitle As String = chamadot.GetVal.Value
Dim tmpchamadoData As String = chamadod.GetVal.Value
Log("SelectedOption = "&SelectedOption)
Wait For( Manager.LGPI_CreateTicket(tmpSession,tmpchamadoTitle,tmpchamadoData,UserId,SelectedOption,EntityId)) Complete (tmpTicket As String)
Dim tparser As JSONParser
tparser.Initialize(tmpTicket)
Dim root As Map = tparser.NextObject
Dim chamadoid As Int = root.Get("id")
Dim chamadomessage As String = root.Get("message")
Dim chamadoHtml As String = $"
<div class="card" id="card${chamadoid}">
<div class="card-body">
<h4 class="card-title">[${chamadoid}] ${tmpchamadoTitle}</h4>
<h6 id="statusChamado${chamadoid}" style="color: var(--green);">ABERTO</h6>
<p class="card-text">${tmpchamadoData}<br/><br/></p>
<button class="btn btn-primary disabled" Type="button">Abrir Chat</button>
<button id="closechamado:${chamadoid}" class="btn btn-danger" Type="button">Fechar Chamado</button>
</div>
</div>
"$
areachamados.SetHtml(chamadoHtml&areachamados.GetHtml.Value)
ws.Eval("$('#modalChamados').modal('hide');",Null)
ws.Eval($"Toastify({
text: "Chamado aberto, breve será atendido !",
duration: 3000,
destination: "",
newWindow: true,
close: true,
gravity: "bottom", // `top` or `bottom`
position: "right", // `left`, `center` or `right`
stopOnFocus: true, // Prevents dismissing of toast on hover
style: {
background: "linear-gradient(to right, #00b09b, #96c93d)",
},
onClick: function(){} // Callback after click
}).showToast();
"$,Null)
chamadot.SetVal("")
chamadod.SetVal("")
ws.Flush
Log("chegou aqui !")
Wait For( Manager.LGPI_KillSession(tmpSession) ) Complete (tmpKill As String)
Log("killed ? = "&tmpKill)
Wait For( Manager.ZapMsg("Chamado Criado [id] : "&chamadoid&".",SelectedOption) ) Complete (tmpzap As String)
Log("zap = "&tmpzap)
' LocalDB.CriarChamado(chamadoid,UserCode)
Else
ws.Eval("$('#modalChamados').modal('hide');",Null)
ws.Eval($"Toastify({
text: "Houve um erro ao abrir o chamado.",
duration: 3000,
destination: "",
newWindow: true,
close: true,
gravity: "bottom", // `top` or `bottom`
position: "right", // `left`, `center` or `right`
stopOnFocus: true, // Prevents dismissing of toast on hover
style: {
background: "linear-gradient(to right, #CC0000,#FF0000)",
},
onClick: function(){} // Callback after click
}).showToast();
"$,Null)
chamadot.SetVal("")
chamadod.SetVal("")
ws.Flush
End If
End If