Fix syntax errors in perfis-catalog.js for Vite compatibility
This commit is contained in:
@@ -507,7 +507,10 @@ function getCantoneirasContent() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
`;
|
||||
|
||||
|
||||
// Auto-carregar dados das cantoneiras quando o conteúdo for renderizado
|
||||
(function() {
|
||||
console.log('🚀 Script inline de auto-carregamento executado');
|
||||
@@ -564,7 +567,7 @@ function getCantoneirasContent() {
|
||||
console.log('✅ Dados carregados:', dados.length, 'cantoneiras');
|
||||
|
||||
// Exibir na tabela
|
||||
tbody.innerHTML = dados.map(item => \`
|
||||
tbody.innerHTML = dados.map(item => `
|
||||
<tr>
|
||||
<td><strong>\${item.nome}</strong></td>
|
||||
<td>\${item.lado_mm}</td>
|
||||
@@ -576,13 +579,13 @@ function getCantoneirasContent() {
|
||||
<td><span class="badge">\${item.tipo}</span></td>
|
||||
<td><button class="btn btn-sm btn-primary">👁️ Ver</button></td>
|
||||
</tr>
|
||||
\`).join('');
|
||||
`).join('');
|
||||
|
||||
console.log('✅ Tabela preenchida com sucesso!');
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Erro no fallback:', error);
|
||||
tbody.innerHTML = \`
|
||||
tbody.innerHTML = `
|
||||
<tr>
|
||||
<td colspan="9" style="text-align: center; padding: 20px; color: #ef4444;">
|
||||
❌ Erro ao carregar dados: \${error.message}
|
||||
@@ -590,13 +593,14 @@ function getCantoneirasContent() {
|
||||
<button class="btn btn-primary" onclick="location.reload()">🔄 Recarregar Página</button>
|
||||
</td>
|
||||
</tr>
|
||||
\`;
|
||||
`;
|
||||
}
|
||||
}
|
||||
}, 500); // Aguardar 500ms
|
||||
})();
|
||||
</script>
|
||||
`;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Função para trocar tabs de perfis
|
||||
@@ -2483,7 +2487,10 @@ function getPerfisWContent() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
`;
|
||||
|
||||
|
||||
// Dados dos modelos (extraídos do guia técnico)
|
||||
const W_MODELOS = [
|
||||
// W150
|
||||
@@ -2511,7 +2518,7 @@ function getPerfisWContent() {
|
||||
function _renderWTabela(dados) {
|
||||
const tbody = document.getElementById('w-tbody');
|
||||
if (!tbody) return;
|
||||
tbody.innerHTML = dados.map(item => \`
|
||||
tbody.innerHTML = dados.map(item => `
|
||||
<tr>
|
||||
<td><strong>\${item.nome}</strong></td>
|
||||
<td>\${item.altura_mm}</td>
|
||||
@@ -2523,7 +2530,7 @@ function getPerfisWContent() {
|
||||
<td>R$ \${item.preco_12m.toFixed(0)}</td>
|
||||
<td><button class="btn btn-sm btn-primary" onclick="alert('Modelo: \${item.nome}\\nSérie: \${item.serie}\\nIx: \${item.ix_cm4} cm⁴\\nWx: \${item.wx_cm3} cm³')">👁️ Ver</button></td>
|
||||
</tr>
|
||||
\`).join('');
|
||||
`).join('');
|
||||
const totalEl = document.getElementById('w-total');
|
||||
if (totalEl) totalEl.textContent = String(dados.length);
|
||||
}
|
||||
@@ -2556,7 +2563,7 @@ function getPerfisWContent() {
|
||||
const precoKg = parseFloat(document.getElementById('w-calc-preco-kg').value);
|
||||
const pesoTotal = peso * comprimento * quantidade;
|
||||
const precoTotal = pesoTotal * precoKg;
|
||||
document.getElementById('w-calc-resultado').innerHTML = \`
|
||||
document.getElementById('w-calc-resultado').innerHTML = `
|
||||
<div class="card" style="background: var(--color-success); color: white;">
|
||||
<h3 style="margin: 0 0 12px 0;">💰 Resultado do Cálculo</h3>
|
||||
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px;">
|
||||
@@ -2574,13 +2581,14 @@ function getPerfisWContent() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
\`;
|
||||
`;
|
||||
};
|
||||
|
||||
// Inicializa tabela ao renderizar conteúdo
|
||||
setTimeout(() => _renderWTabela(W_MODELOS), 0);
|
||||
</script>
|
||||
`;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function getTubosRHSContent() {
|
||||
@@ -2727,7 +2735,10 @@ function getTubosRHSContent() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
`;
|
||||
|
||||
|
||||
// Atualiza diretamente da fonte CSV usando DataManager e repovoa todas as abas
|
||||
window.atualizarFonteTubos_rhs = async function() {
|
||||
try {
|
||||
@@ -2837,8 +2848,9 @@ function getTubosRHSContent() {
|
||||
alert('❌ Erro ao atualizar: ' + err.message);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
`;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// --- Perfis W: disponibilizar no escopo global para funcionamento dos filtros ---
|
||||
|
||||
Reference in New Issue
Block a user