33
| <![CDATA[<script type="text/javascript">
function showLoading() {
var loading = document.getElementById("loading");
if (loading) loading.style.display = "block";
}
function switchCard(currentCard, targetCard, direction) {
if (currentCard.classList.contains("d-none")) currentCard.classList.remove("d-none");
if (!currentCard.classList.contains("d-inline-flex")) currentCard.classList.add("d-inline-flex");
if (!currentCard.classList.contains("animated")) currentCard.classList.add("animated");
if (!currentCard.classList.contains("slideOut" + (direction ? "Left" : "Right"))) currentCard.classList.add("slideOut" + (direction ? "Left" : "Right"));
function handleAnimationEnd() {
currentCard.removeEventListener("animationend", handleAnimationEnd);
if (!currentCard.classList.contains("d-none")) currentCard.classList.add("d-none");
if (currentCard.classList.contains("d-inline-flex"))currentCard.classList.remove("d-inline-flex");
if (currentCard.classList.contains("animated")) currentCard.classList.remove("animated");
if (currentCard.classList.contains("slideOut" + (direction ? "Left" : "Right"))) currentCard.classList.remove("slideOut" + (direction ? "Left" : "Right"));
if (targetCard.classList.contains("d-none")) targetCard.classList.remove("d-none");
if (!targetCard.classList.contains("d-inline-flex")) targetCard.classList.add("d-inline-flex");
if (!targetCard.classList.contains("animated")) targetCard.classList.add("animated");
if (!targetCard.classList.contains("slideIn" + (direction ? "Right" : "Left"))) targetCard.classList.add("slideIn" + (direction ? "Right" : "Left"));
clearInvalidState();
}
currentCard.addEventListener("animationend", handleAnimationEnd);
}
function toggleAdminLogon(e) {
e.preventDefault();
var mainCard = document.getElementById("main-card");
var adminCard = document.getElementById("admin-card");
if (mainCard.classList.contains("d-inline-flex")) switchCard(mainCard, adminCard, true);
else switchCard(adminCard, mainCard, false);
}
function changeLanguage(locale) {
showLoading();
var form = document.getElementById("WFRSystem");
form.action = "admincore?action=indexChangeLanguage&locale=" + locale;
form.submit();
}
function toLink(event, same, link) {
event.preventDefault();
var syscode = document.getElementById("syscode");
var selectedSys = getSelectedSystem();
if (!selectedSys || selectedSys.length == 0) {
var syscodeFeedback = document.getElementById("syscode-feedback");
syscode.classList.add("is-invalid");
syscodeFeedback.innerHTML = 'Você deve especificar o código do sistema!';
} else {
showLoading();
window.location = link;
}
return false;
}
function clearInvalidState() {
var syscode = document.getElementById("syscode");
var syscodeFeedback = document.getElementById("syscode-feedback");
syscode.classList.remove("is-invalid");
syscodeFeedback.innerHTML = "";
document.querySelector('[autofocus]').focus(); //Focar componente de usuário após animação
}
function getSelectedSystem() {
var e = document.getElementById("syscode");
return e.selectedIndex >= 0 ? e.options[e.selectedIndex].value : null;
}
</script>]]>
|