var todasInformacoes = [];
let deepLink;
function randomTaskId(boardId){
var id = Math.floor(Math.random() * 1000000);
var task = id.toString();
task += boardId
return task;
}
function createDeepLinkEmMassa(taskId, idboard, pavimento, ambiente, nomeCondominio, torreSelecionada, plano) {
}
function processarListaPavimentos(ambientesSelecionados, nomeCondominio, torreSelecionada) {
}
function createDeepLink(taskId, plano) {
}
function submitForm(event) {
}
function readFirebase(idCondominio, plano) {
}
document.addEventListener("DOMContentLoaded", function () {
var menuIcon = document.getElementById("menuIcon");
var sideMenu = document.getElementById("sideMenu");
// Adicionando um evento de clique ao ícone do menu
if (menuIcon) {
menuIcon.addEventListener("click", function () {
if (sideMenu.style.width === "250px") {
// Se a aba lateral estiver aberta, fecha a aba lateral
sideMenu.style.width = "0";
// Muda o ícone de volta para o ícone de menu
menuIcon.classList.remove("fa-times");
menuIcon.classList.add("fa-bars");
} else {
// Se a aba lateral estiver fechada, abre a aba lateral
sideMenu.style.width = "250px";
// Muda o ícone para o ícone de fechar (X)
menuIcon.classList.remove("fa-bars");
menuIcon.classList.add("fa-times");
}
});
}
var boardIdButton = document.getElementById("boardIdButton");
if (boardIdButton) {
boardIdButton.addEventListener("click", function () {
var boardId = document.getElementById("boardIdInput").value;
var planoSelecionado = document.getElementById("planoDropdown").value;
readFirebase(boardId, planoSelecionado)
.then(function (resposta) {
if (resposta == undefined || resposta.length == 0) {
var mensagemTabela = document.getElementById("mensagemTabela");
mensagemTabela.style.display = "block";
mensagemTabela.textContent = "❌ Nenhum dado foi encontrado!";
return;
}
console.log(resposta);
var nomeCondominio = resposta[0].nomeCondominio;
var torre = resposta[0].torreGrupo;
var dropdownTorres = document.getElementById("dropdownTorres");
if (dropdownTorres) {
dropdownTorres.innerHTML = "";
torre.forEach(function (torre) {
var option = document.createElement("option");
option.value = torre;
option.textContent = torre;
dropdownTorres.appendChild(option);
});
}else{
console.log("Elemento DropdownTorres não encontrado")
}
// Gera a tabela com os dados obtidos
var ambientes = resposta[0].ambiente;
var pavimentos = resposta[0].pavimento;
generateTable(ambientes, pavimentos, torre, nomeCondominio);
// Remover o texto "Nenhum dado foi encontrado" da tabela
var mensagemTabela = document.getElementById("mensagemTabela");
mensagemTabela.style.display = "none";
// Remove a classe 'hidden' da tabela para exibi-la
var tabelaGerada = document.getElementById("tabelaGerada");
var dropdownContainer = document.getElementById("dropdownContainer");
if (tabelaGerada) {
tabelaGerada.classList.remove("hidden");
dropdownContainer.classList.remove("invisible-content");
}
})
.catch(function (error) {
console.error("Erro ao ler dados do Firebase:", error);
});
});
}
});
var ambientesSelecionados = {};
function generateTable(ambientes, pavimentos, torreSelecionada, nomeCondominio) {
}
function adicionarAmbiente() {
}
function getAmbientes() {
}
function showDefaultValue() {
// Para cada campo com a classe "input-with-default"
var inputWithDefaults = document.getElementsByClassName('input-with-default');
for (var i = 0; i < inputWithDefaults.length; i++) {
var element = inputWithDefaults[i];
// Obtém o valor padrão dentro da div
var defaultValue = element.querySelector('.default-value').innerHTML;
// Obtém o valor atual do campo de entrada numérica
var value = element.querySelector('input[type="number"]').value;
// Se o valor atual do campo for igual ao valor padrão
if (value === defaultValue) {
// Oculta o valor padrão
element.querySelector('.default-value').style.display = 'inline';
} else {
// Caso contrário, exibe o valor padrão
element.querySelector('.default-value').style.display = 'none';
}
}
}