apps-redring / index.html
MyNameIsToby's picture
MEJORA LA APP CON LO SIGUIENTE:javascript // Mostrar mejor los rangos en los resultados document.getElementById('resultEmployees').textContent = ranges.length > 1 ? `${ranges.length} rangos de empleados` : `${ranges[0].querySelector('.min-employees').value} - ${ranges[0].querySelector('.max-employees').value}`; Agregar tooltips para explicaciones: html <div class="mb-6 relative"> <label class="block text-gray-700 font-medium mb-2"> ¿Usa layout de RR 2.0? <span class="tooltip ml-1 text-blue-500 cursor-pointer"> <i class="fas fa-info-circle"></i> <span class="tooltip-text hidden absolute z-10 w-64 bg-gray-800 text-white text-xs rounded p-2"> Marque esta opción si el cliente ya utiliza nuestro formato estándar para subir incidencias </span> </span> </label> <!-- Resto del elemento --> </div> <script> // Mostrar tooltips al hacer hover document.querySelectorAll('.tooltip').forEach(el => { el.addEventListener('mouseover', () => { el.querySelector('.tooltip-text').classList.remove('hidden'); }); el.addEventListener('mouseout', () => { el.querySelector('.tooltip-text').classList.add('hidden'); }); }); </script> - Follow Up Deployment
2d3e5ed verified
Raw History Blame Contribute Delete
40.9 kB
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cotizador REDRING</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.gradient-bg {
background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
}
.service-card {
transition: all 0.3s ease;
}
.service-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
.result-card {
animation: fadeIn 0.5s ease-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
input[type="range"] {
-webkit-appearance: none;
height: 8px;
background: #e2e8f0;
border-radius: 5px;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
height: 20px;
width: 20px;
border-radius: 50%;
background: #2563eb;
cursor: pointer;
box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
}
</style>
</head>
<body class="bg-gray-50 min-h-screen">
<div class="gradient-bg text-white py-8 shadow-lg">
<div class="container mx-auto px-4">
<div class="flex items-center justify-between">
<div>
<h1 class="text-3xl md:text-4xl font-bold">Cotizador REDRING</h1>
<p class="mt-2 text-blue-100">Herramienta interna para cotización de servicios</p>
</div>
<div class="hidden md:block">
<i class="fas fa-calculator text-4xl opacity-70"></i>
</div>
</div>
</div>
</div>
<div class="container mx-auto px-4 py-8">
<!-- Service Selection Tabs -->
<div class="bg-white rounded-lg shadow-md mb-8 overflow-hidden">
<div class="flex border-b">
<button class="tab-btn py-4 px-6 font-medium text-gray-700 hover:text-blue-600 focus:outline-none border-b-2 border-blue-600 text-blue-600" data-tab="maquila">
<i class="fas fa-users-cog mr-2"></i>Maquila de Nómina
</button>
<button class="tab-btn py-4 px-6 font-medium text-gray-700 hover:text-blue-600 focus:outline-none" data-tab="renta">
<i class="fas fa-laptop-code mr-2"></i>Renta de Software
</button>
</div>
<!-- Maquila de Nómina Tab -->
<div id="maquila" class="tab-content active p-6">
<h2 class="text-2xl font-bold text-gray-800 mb-6">Cotización de Maquila de Nómina</h2>
<div class="grid md:grid-cols-2 gap-8">
<!-- Input Form -->
<div class="bg-white p-6 rounded-lg shadow-sm border border-gray-200">
<h3 class="text-xl font-semibold text-gray-700 mb-4">Parámetros de cotización</h3>
<div id="employeeRanges">
<div class="mb-6 range-group">
<div class="flex justify-between items-center mb-2">
<label class="block text-gray-700 font-medium">Rango de empleados</label>
<button type="button" class="remove-range text-red-500 hover:text-red-700 text-sm">
<i class="fas fa-times mr-1"></i>Eliminar
</button>
</div>
<div class="grid grid-cols-2 gap-4 mb-2">
<div>
<label class="block text-gray-600 text-sm mb-1">Desde</label>
<input type="number" min="1" class="min-employees w-full px-3 py-2 border border-gray-300 rounded-md" value="1">
</div>
<div>
<label class="block text-gray-600 text-sm mb-1">Hasta</label>
<input type="number" min="1" class="max-employees w-full px-3 py-2 border border-gray-300 rounded-md" value="10">
</div>
</div>
<div class="mb-4">
<label class="block text-gray-700 font-medium mb-2">Tipo de periodo</label>
<select class="period-type w-full px-4 py-2 border border-gray-300 rounded-md">
<option value="mensual">Mensual</option>
<option value="quincenal">Quincenal/Catorcenal</option>
<option value="semanal">Semanal</option>
</select>
</div>
</div>
</div>
<button type="button" id="addRange" class="w-full bg-gray-200 hover:bg-gray-300 text-gray-800 py-2 px-4 rounded-md mb-6">
<i class="fas fa-plus mr-2"></i>Agregar otro rango
</button>
<div class="mb-6">
<label class="block text-gray-700 font-medium mb-2">Tipo de servicio</label>
<div class="space-y-2">
<label class="flex items-center">
<input type="radio" name="serviceType" value="hibrido" class="mr-2" checked>
<span>Híbrido (Cliente sube incidencias en RR 2.0)</span>
</label>
<label class="flex items-center">
<input type="radio" name="serviceType" value="total" class="mr-2">
<span>Gestión Total</span>
</label>
</div>
</div>
<div class="mb-6" id="periodTypeContainer">
<label class="block text-gray-700 font-medium mb-2">Tipo de periodo</label>
<select id="periodType" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="mensual">Mensual</option>
<option value="quincenal">Quincenal/Catorcenal</option>
<option value="semanal">Semanal</option>
</select>
</div>
<div class="mb-6 relative">
<label class="block text-gray-700 font-medium mb-2">
¿Usa layout de RR 2.0?
<span class="tooltip ml-1 text-blue-500 cursor-pointer">
<i class="fas fa-info-circle"></i>
<span class="tooltip-text hidden absolute z-10 w-64 bg-gray-800 text-white text-xs rounded p-2">
Marque esta opción si el cliente ya utiliza nuestro formato estándar para subir incidencias
</span>
</span>
</label>
<div class="flex items-center">
<input type="checkbox" id="useLayout" class="mr-2 h-5 w-5 text-blue-600">
<span>Sí, el cliente usa el layout de RR 2.0</span>
</div>
</div>
<button id="calculateMaquila" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-md transition duration-300">
<i class="fas fa-calculator mr-2"></i>Calcular Cotización
</button>
</div>
<!-- Results Placeholder -->
<div id="maquilaResults" class="result-card bg-white p-6 rounded-lg shadow-sm border border-gray-200 hidden">
<h3 class="text-xl font-semibold text-gray-700 mb-4">Resultados de cotización</h3>
<div class="space-y-4">
<div class="flex justify-between py-2 border-b border-gray-200">
<span class="text-gray-600">Número de empleados:</span>
<span id="resultEmployees" class="font-medium"></span>
</div>
<div class="flex justify-between py-2 border-b border-gray-200">
<span class="text-gray-600">Tipo de servicio:</span>
<span id="resultServiceType" class="font-medium"></span>
</div>
<div class="flex justify-between py-2 border-b border-gray-200">
<span class="text-gray-600">Tipo de periodo:</span>
<span id="resultPeriodType" class="font-medium"></span>
</div>
<div class="flex justify-between py-2 border-b border-gray-200">
<span class="text-gray-600">Usa layout RR 2.0:</span>
<span id="resultLayout" class="font-medium"></span>
</div>
<div id="resultDetails" class="space-y-3 mt-4"></div>
<div class="bg-blue-50 p-4 rounded-md mt-4">
<div class="flex justify-between items-center">
<span class="text-lg font-bold text-gray-700">Precio mensual:</span>
<span id="resultMonthlyPrice" class="text-2xl font-bold text-blue-600"></span>
</div>
<div class="flex justify-between mt-2">
<span class="text-gray-600">Facturación anual:</span>
<span id="resultAnnual" class="font-medium"></span>
</div>
</div>
<div class="bg-green-50 p-4 rounded-md">
<div class="flex justify-between items-center">
<span class="text-lg font-bold text-gray-700">Con descuento (25%):</span>
<span id="resultDiscountPrice" class="text-2xl font-bold text-green-600"></span>
</div>
<div class="flex justify-between mt-2">
<span class="text-gray-600">Facturación anual con descuento:</span>
<span id="resultAnnualDiscount" class="font-medium"></span>
</div>
</div>
</div>
<button id="newMaquilaQuote" class="w-full mt-6 bg-gray-200 hover:bg-gray-300 text-gray-800 font-bold py-2 px-4 rounded-md transition duration-300">
<i class="fas fa-redo mr-2"></i>Nueva cotización
</button>
</div>
</div>
<!-- Pricing Table -->
<div class="mt-12">
<h3 class="text-xl font-semibold text-gray-700 mb-4">Tabla de referencia de precios</h3>
<div class="overflow-x-auto">
<table class="min-w-full bg-white border border-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 border-b border-gray-200 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Rango</th>
<th class="px-6 py-3 border-b border-gray-200 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Empleados</th>
<th colspan="2" class="px-6 py-3 border-b border-gray-200 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">Híbrido</th>
<th colspan="3" class="px-6 py-3 border-b border-gray-200 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">Gestión Total</th>
<th colspan="2" class="px-6 py-3 border-b border-gray-200 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">Renta</th>
</tr>
<tr>
<th></th>
<th></th>
<th class="px-6 py-2 border-b border-gray-200 text-xs font-medium text-gray-500 uppercase tracking-wider">P. mensual</th>
<th class="px-6 py-2 border-b border-gray-200 text-xs font-medium text-gray-500 uppercase tracking-wider">Fact. anual</th>
<th class="px-6 py-2 border-b border-gray-200 text-xs font-medium text-gray-500 uppercase tracking-wider">Mensual</th>
<th class="px-6 py-2 border-b border-gray-200 text-xs font-medium text-gray-500 uppercase tracking-wider">Qnal/Cator.</th>
<th class="px-6 py-2 border-b border-gray-200 text-xs font-medium text-gray-500 uppercase tracking-wider">Semanal</th>
<th class="px-6 py-2 border-b border-gray-200 text-xs font-medium text-gray-500 uppercase tracking-wider">P. mensual</th>
<th class="px-6 py-2 border-b border-gray-200 text-xs font-medium text-gray-500 uppercase tracking-wider">Fact. anual</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
<!-- Rows will be populated by JavaScript -->
</tbody>
</table>
</div>
</div>
</div>
<!-- Renta de Software Tab -->
<div id="renta" class="tab-content p-6">
<h2 class="text-2xl font-bold text-gray-800 mb-6">Cotización de Renta de Software</h2>
<div class="grid md:grid-cols-2 gap-8">
<!-- Input Form -->
<div class="bg-white p-6 rounded-lg shadow-sm border border-gray-200">
<h3 class="text-xl font-semibold text-gray-700 mb-4">Parámetros de cotización</h3>
<div class="mb-6">
<label class="block text-gray-700 font-medium mb-2">Número de empleados</label>
<input type="range" id="employeeRangeRenta" min="1" max="5500" value="10" class="w-full mb-2">
<div class="flex justify-between">
<span>1</span>
<span id="employeeValueRenta" class="font-bold">10</span>
<span>5500+</span>
</div>
</div>
<div class="mb-6">
<label class="block text-gray-700 font-medium mb-2">Tipo de cotización</label>
<div class="space-y-2">
<label class="flex items-center">
<input type="radio" name="rentaType" value="unico" class="mr-2" checked>
<span>Un precio para todos los tipos de periodo</span>
</label>
<label class="flex items-center">
<input type="radio" name="rentaType" value="diferente" class="mr-2">
<span>Diferentes precios por tipo de periodo</span>
</label>
</div>
</div>
<div class="mb-6" id="periodTypeRentaContainer">
<label class="block text-gray-700 font-medium mb-2">Tipo de periodo</label>
<select id="periodTypeRenta" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="mensual">Mensual</option>
<option value="quincenal">Quincenal/Catorcenal</option>
<option value="semanal">Semanal</option>
</select>
</div>
<button id="calculateRenta" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-md transition duration-300">
<i class="fas fa-calculator mr-2"></i>Calcular Cotización
</button>
</div>
<!-- Results Placeholder -->
<div id="rentaResults" class="result-card bg-white p-6 rounded-lg shadow-sm border border-gray-200 hidden">
<h3 class="text-xl font-semibold text-gray-700 mb-4">Resultados de cotización</h3>
<div class="space-y-4">
<div class="flex justify-between py-2 border-b border-gray-200">
<span class="text-gray-600">Número de empleados:</span>
<span id="resultEmployeesRenta" class="font-medium"></span>
</div>
<div class="flex justify-between py-2 border-b border-gray-200">
<span class="text-gray-600">Tipo de cotización:</span>
<span id="resultRentaType" class="font-medium"></span>
</div>
<div class="flex justify-between py-2 border-b border-gray-200">
<span class="text-gray-600">Tipo de periodo:</span>
<span id="resultPeriodTypeRenta" class="font-medium"></span>
</div>
<div class="bg-blue-50 p-4 rounded-md mt-4">
<div class="flex justify-between items-center">
<span class="text-lg font-bold text-gray-700">Precio mensual:</span>
<span id="resultMonthlyPriceRenta" class="text-2xl font-bold text-blue-600"></span>
</div>
<div class="flex justify-between mt-2">
<span class="text-gray-600">Facturación anual:</span>
<span id="resultAnnualRenta" class="font-medium"></span>
</div>
</div>
</div>
<button id="newRentaQuote" class="w-full mt-6 bg-gray-200 hover:bg-gray-300 text-gray-800 font-bold py-2 px-4 rounded-md transition duration-300">
<i class="fas fa-redo mr-2"></i>Nueva cotización
</button>
</div>
</div>
</div>
</div>
</div>
<footer class="bg-gray-800 text-white py-6">
<div class="container mx-auto px-4 text-center">
<p>© 2023 REDRING - Herramienta interna de cotización</p>
<p class="text-gray-400 text-sm mt-2">Para rangos superiores a 5,500 empleados, consultar con Gerencias Comercial y Operaciones</p>
</div>
</footer>
<script>
// Pricing data
const pricingData = [
{ min: 1, max: 10, hibrido: 525, totalMensual: 700, totalQuincenal: 770, totalSemanal: 840, renta: 99 },
{ min: 11, max: 30, hibrido: 488, totalMensual: 650, totalQuincenal: 715, totalSemanal: 780, renta: 94 },
{ min: 31, max: 70, hibrido: 450, totalMensual: 600, totalQuincenal: 660, totalSemanal: 720, renta: 89 },
{ min: 71, max: 150, hibrido: 413, totalMensual: 550, totalQuincenal: 605, totalSemanal: 660, renta: 84 },
{ min: 151, max: 300, hibrido: 375, totalMensual: 500, totalQuincenal: 550, totalSemanal: 600, renta: 79 },
{ min: 301, max: 600, hibrido: 338, totalMensual: 450, totalQuincenal: 495, totalSemanal: 540, renta: 74 },
{ min: 601, max: 1200, hibrido: 300, totalMensual: 400, totalQuincenal: 440, totalSemanal: 480, renta: 69 },
{ min: 1201, max: 2200, hibrido: 263, totalMensual: 350, totalQuincenal: 385, totalSemanal: 420, renta: 64 },
{ min: 2201, max: 3300, hibrido: 225, totalMensual: 300, totalQuincenal: 330, totalSemanal: 360, renta: 59 },
{ min: 3301, max: 4400, hibrido: 188, totalMensual: 250, totalQuincenal: 275, totalSemanal: 300, renta: 54 },
{ min: 4401, max: 5500, hibrido: 150, totalMensual: 200, totalQuincenal: 220, totalSemanal: 240, renta: 49 },
{ min: 5501, max: null, hibrido: null, totalMensual: null, totalQuincenal: null, totalSemanal: null, renta: null }
];
// Tab functionality
document.querySelectorAll('.tab-btn').forEach(btn => {
btn.addEventListener('click', () => {
// Remove active class from all tabs and buttons
document.querySelectorAll('.tab-btn').forEach(tb => {
tb.classList.remove('border-blue-600', 'text-blue-600');
tb.classList.add('text-gray-700');
});
document.querySelectorAll('.tab-content').forEach(content => {
content.classList.remove('active');
});
// Add active class to clicked tab
btn.classList.add('border-blue-600', 'text-blue-600');
btn.classList.remove('text-gray-700');
const tabId = btn.getAttribute('data-tab');
document.getElementById(tabId).classList.add('active');
});
});
// Employee range input for Maquila
const employeeRange = document.getElementById('employeeRange');
const employeeValue = document.getElementById('employeeValue');
employeeRange.addEventListener('input', () => {
employeeValue.textContent = employeeRange.value;
});
// Employee range input for Renta
const employeeRangeRenta = document.getElementById('employeeRangeRenta');
const employeeValueRenta = document.getElementById('employeeValueRenta');
employeeRangeRenta.addEventListener('input', () => {
employeeValueRenta.textContent = employeeRangeRenta.value;
});
// Show/hide period type based on service type for Maquila
document.querySelectorAll('input[name="serviceType"]').forEach(radio => {
radio.addEventListener('change', () => {
const useLayout = document.getElementById('useLayout').checked;
const serviceType = document.querySelector('input[name="serviceType"]:checked').value;
if (serviceType === 'total' && !useLayout) {
document.getElementById('periodTypeContainer').classList.remove('hidden');
} else {
document.getElementById('periodTypeContainer').classList.add('hidden');
}
});
});
document.getElementById('useLayout').addEventListener('change', function() {
const serviceType = document.querySelector('input[name="serviceType"]:checked').value;
if (serviceType === 'total' && !this.checked) {
document.getElementById('periodTypeContainer').classList.remove('hidden');
} else {
document.getElementById('periodTypeContainer').classList.add('hidden');
}
});
// Show/hide period type based on renta type
document.querySelectorAll('input[name="rentaType"]').forEach(radio => {
radio.addEventListener('change', () => {
const rentaType = document.querySelector('input[name="rentaType"]:checked').value;
if (rentaType === 'diferente') {
document.getElementById('periodTypeRentaContainer').classList.remove('hidden');
} else {
document.getElementById('periodTypeRentaContainer').classList.add('hidden');
}
});
});
// Add new range
document.getElementById('addRange').addEventListener('click', () => {
const rangeGroup = document.querySelector('.range-group').cloneNode(true);
rangeGroup.querySelector('.min-employees').value = '';
rangeGroup.querySelector('.max-employees').value = '';
document.getElementById('employeeRanges').appendChild(rangeGroup);
addRemoveListeners();
});
// Remove range
function addRemoveListeners() {
document.querySelectorAll('.remove-range').forEach(btn => {
btn.addEventListener('click', function() {
if (document.querySelectorAll('.range-group').length > 1) {
this.closest('.range-group').remove();
} else {
alert('Debe haber al menos un rango de empleados');
}
});
});
}
// Calculate Maquila with multiple ranges
document.getElementById('calculateMaquila').addEventListener('click', () => {
const serviceType = document.querySelector('input[name="serviceType"]:checked').value;
const useLayout = document.getElementById('useLayout').checked;
const ranges = document.querySelectorAll('.range-group');
let totalPrice = 0;
let totalAnnual = 0;
let resultsHTML = '';
ranges.forEach(range => {
const minEmployees = parseInt(range.querySelector('.min-employees').value) || 0;
const maxEmployees = parseInt(range.querySelector('.max-employees').value) || 0;
const periodType = range.querySelector('.period-type').value;
if (minEmployees === 0 || maxEmployees === 0 || minEmployees > maxEmployees) {
alert('Por favor ingrese rangos válidos');
return;
}
const avgEmployees = Math.floor((minEmployees + maxEmployees) / 2);
// Find the pricing tier
let tier = pricingData.find(t =>
(t.max === null && avgEmployees >= t.min) ||
(avgEmployees >= t.min && avgEmployees <= t.max)
);
if (!tier) {
alert(`Para más de 5,500 empleados, consultar con Gerencias Comercial y Operaciones`);
return;
}
// Calculate price
let price;
let annual;
let description;
if (serviceType === 'hibrido') {
price = tier.hibrido * avgEmployees;
annual = price * 10;
description = "Híbrido";
} else { // total
if (useLayout) {
price = tier.totalMensual * avgEmployees;
description = "Gestión Total (con layout RR 2.0)";
} else {
if (periodType === 'mensual') {
price = tier.totalMensual * avgEmployees;
} else if (periodType === 'quincenal') {
price = tier.totalQuincenal * avgEmployees;
} else { // semanal
price = tier.totalSemanal * avgEmployees;
}
description = `Gestión Total (${periodType})`;
}
annual = price * (periodType === 'mensual' ? 10 : (periodType === 'quincenal' ? 24 : 52));
}
totalPrice += price;
totalAnnual += annual;
// Add to results details
resultsHTML += `
<div class="mb-4 p-3 bg-gray-50 rounded-md">
<div class="flex justify-between py-1">
<span class="text-gray-600">Empleados:</span>
<span class="font-medium">${minEmployees} - ${maxEmployees}</span>
</div>
<div class="flex justify-between py-1">
<span class="text-gray-600">Tipo de periodo:</span>
<span class="font-medium">${periodType.charAt(0).toUpperCase() + periodType.slice(1)}</span>
</div>
<div class="flex justify-between py-1">
<span class="text-gray-600">Precio mensual:</span>
<span class="font-medium">${price.toLocaleString()}</span>
</div>
<div class="flex justify-between py-1">
<span class="text-gray-600">Facturación anual:</span>
<span class="font-medium">${annual.toLocaleString()}</span>
</div>
</div>
`;
});
// Calculate discount
const discountPrice = totalPrice * 0.75;
const annualDiscount = totalAnnual * 0.75;
// Display results
document.getElementById('resultEmployees').textContent = ranges.length > 1 ? `${ranges.length} rangos de empleados` : `${ranges[0].querySelector('.min-employees').value} - ${ranges[0].querySelector('.max-employees').value}`;
document.getElementById('resultServiceType').textContent = serviceType === 'hibrido' ? 'Híbrido' : 'Gestión Total';
document.getElementById('resultPeriodType').textContent = ranges.length > 1 ? 'Múltiples periodos' : ranges[0].querySelector('.period-type').value.charAt(0).toUpperCase() + ranges[0].querySelector('.period-type').value.slice(1);
document.getElementById('resultLayout').textContent = useLayout ? "Sí" : "No";
// Add details to results
document.getElementById('resultDetails').innerHTML = resultsHTML;
// Show totals
document.getElementById('resultMonthlyPrice').textContent = `${totalPrice.toLocaleString()}`;
document.getElementById('resultAnnual').textContent = `${totalAnnual.toLocaleString()}`;
document.getElementById('resultDiscountPrice').textContent = `${discountPrice.toLocaleString()}`;
document.getElementById('resultAnnualDiscount').textContent = `${annualDiscount.toLocaleString()}`;
// Show results
document.getElementById('maquilaResults').classList.remove('hidden');
});
// Calculate Renta
document.getElementById('calculateRenta').addEventListener('click', () => {
const employees = parseInt(employeeRangeRenta.value);
const rentaType = document.querySelector('input[name="rentaType"]:checked').value;
const periodType = document.getElementById('periodTypeRenta').value;
// Find the pricing tier
let tier = pricingData.find(t =>
(t.max === null && employees >= t.min) ||
(employees >= t.min && employees <= t.max)
);
if (!tier) {
alert("Para más de 5,500 empleados, consultar con Gerencias Comercial y Operaciones");
return;
}
// Calculate price
let price;
let annual;
let description;
if (rentaType === 'unico') {
price = tier.renta * employees;
description = "Precio único para todos los periodos";
} else { // diferente
price = tier.renta * employees;
description = `Precio para periodo ${periodType}`;
}
annual = price * (periodType === 'mensual' ? 10 : (periodType === 'quincenal' ? 24 : 52));
// Display results
document.getElementById('resultEmployeesRenta').textContent = employees;
document.getElementById('resultRentaType').textContent = description;
document.getElementById('resultPeriodTypeRenta').textContent = periodType.charAt(0).toUpperCase() + periodType.slice(1);
document.getElementById('resultMonthlyPriceRenta').textContent = `$${price.toLocaleString()}`;
document.getElementById('resultAnnualRenta').textContent = `$${annual.toLocaleString()}`;
// Show results
document.getElementById('rentaResults').classList.remove('hidden');
});
// New quote buttons
document.getElementById('newMaquilaQuote').addEventListener('click', () => {
document.getElementById('maquilaResults').classList.add('hidden');
});
document.getElementById('newRentaQuote').addEventListener('click', () => {
document.getElementById('rentaResults').classList.add('hidden');
});
// Populate pricing table
function populatePricingTable() {
const tbody = document.querySelector('tbody');
tbody.innerHTML = '';
pricingData.forEach((tier, index) => {
const row = document.createElement('tr');
row.className = index % 2 === 0 ? 'bg-white' : 'bg-gray-50';
// Rango
const rangeCell = document.createElement('td');
rangeCell.className = 'px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900';
rangeCell.textContent = index + 1;
row.appendChild(rangeCell);
// Empleados
const employeesCell = document.createElement('td');
employeesCell.className = 'px-6 py-4 whitespace-nowrap text-sm text-gray-500';
if (tier.max === null) {
employeesCell.textContent = `>${tier.min}`;
} else {
employeesCell.textContent = `${tier.min} - ${tier.max}`;
}
row.appendChild(employeesCell);
// Híbrido
const hibridoPriceCell = document.createElement('td');
hibridoPriceCell.className = 'px-6 py-4 whitespace-nowrap text-sm text-gray-500';
hibridoPriceCell.textContent = tier.hibrido ? `$${tier.hibrido}` : 'Consultar';
row.appendChild(hibridoPriceCell);
const hibridoAnnualCell = document.createElement('td');
hibridoAnnualCell.className = 'px-6 py-4 whitespace-nowrap text-sm text-gray-500';
if (tier.hibrido) {
const avgEmployees = tier.max ? Math.floor((tier.min + tier.max) / 2) : tier.min;
hibridoAnnualCell.textContent = `$${(tier.hibrido * avgEmployees * 10).toLocaleString()}`;
} else {
hibridoAnnualCell.textContent = 'Consultar';
}
row.appendChild(hibridoAnnualCell);
// Gestión Total
const totalMensualCell = document.createElement('td');
totalMensualCell.className = 'px-6 py-4 whitespace-nowrap text-sm text-gray-500';
totalMensualCell.textContent = tier.totalMensual ? `$${tier.totalMensual}` : 'Consultar';
row.appendChild(totalMensualCell);
const totalQuincenalCell = document.createElement('td');
totalQuincenalCell.className = 'px-6 py-4 whitespace-nowrap text-sm text-gray-500';
totalQuincenalCell.textContent = tier.totalQuincenal ? `$${tier.totalQuincenal}` : 'Consultar';
row.appendChild(totalQuincenalCell);
const totalSemanalCell = document.createElement('td');
totalSemanalCell.className = 'px-6 py-4 whitespace-nowrap text-sm text-gray-500';
totalSemanalCell.textContent = tier.totalSemanal ? `$${tier.totalSemanal}` : 'Consultar';
row.appendChild(totalSemanalCell);
// Renta
const rentaPriceCell = document.createElement('td');
rentaPriceCell.className = 'px-6 py-4 whitespace-nowrap text-sm text-gray-500';
rentaPriceCell.textContent = tier.renta ? `$${tier.renta}` : 'Consultar';
row.appendChild(rentaPriceCell);
const rentaAnnualCell = document.createElement('td');
rentaAnnualCell.className = 'px-6 py-4 whitespace-nowrap text-sm text-gray-500';
if (tier.renta) {
const avgEmployees = tier.max ? Math.floor((tier.min + tier.max) / 2) : tier.min;
rentaAnnualCell.textContent = `$${(tier.renta * avgEmployees * 10).toLocaleString()}`;
} else {
rentaAnnualCell.textContent = 'Consultar';
}
row.appendChild(rentaAnnualCell);
tbody.appendChild(row);
});
}
// Tooltip functionality
document.querySelectorAll('.tooltip').forEach(el => {
el.addEventListener('mouseover', () => {
el.querySelector('.tooltip-text').classList.remove('hidden');
});
el.addEventListener('mouseout', () => {
el.querySelector('.tooltip-text').classList.add('hidden');
});
});
// Initialize
document.addEventListener('DOMContentLoaded', () => {
populatePricingTable();
addRemoveListeners();
// Hide period type initially for Maquila
document.getElementById('periodTypeContainer').classList.add('hidden');
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=MyNameIsToby/apps-redring" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>