simula que eres un expero en php,html, javascript deseo que revises esta paginay me comentes que es lo q hace :
table {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
table td, table th {
border: 1px solid #ddd;
padding: 8px;
}
table tr:nth-child(even){background-color: #f2f2f2;}
table tr:hover {background-color: #ddd;}
table th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #de222a;
color: white;
}
// Insertar el elemento de información de la estación después de la tabla de checkboxes
var tableElement = document.querySelector("table");
tableElement.parentNode.insertBefore(stationInfoElement, tableElement.nextSibling);
function markCheckbox(containerIndex, checkboxIndex) {
var containerId = ".checkbox-container" + containerIndex;
var container = document.querySelector(containerId);
if (container) {
var checkbox = container.querySelectorAll("input[type='checkbox']")[checkboxIndex];
if (checkbox && !checkbox.checked && !checkbox.disabled) {
checkbox.checked = true;
disableCheckbox(checkbox.id);
updateStationInfo(containerIndex);
return true;
}
}
return false;
}
function findNextAvailableCheckbox(startContainer) {
// Busca en la estación especificada primero
for (var j = 0; j < 6; j++) {
if (markCheckbox(startContainer, j)) {
return;
}
}
// Si no hay espacios disponibles en la estación especificada, busca en las siguientes
for (var i = startContainer + 1; i <= 6; i++) {
for (var j = 0; j < 6; j++) {
if (markCheckbox(i, j)) {
return;
}
}
}
// Si no se encontró ningún espacio disponible, busca desde la primera estación
for (var i = 1; i < startContainer; i++) {
for (var j = 0; j < 6; j++) {
if (markCheckbox(i, j)) {
return;
}
}
}
alert("No hay espacios disponibles en ninguna estación.");
}
function updateStationInfo(stationNumber) {
stationInfoElement.textContent = "Lugar de trabajo es en la estación número: " + stationNumber;
}
function disableCheckbox(checkboxId) {
var checkbox = document.getElementById(checkboxId);
checkbox.disabled = true;
localStorage.setItem(checkboxId, "checked," + Date.now());
setTimeout(function() {
checkbox.disabled = false;
checkbox.checked = false;
localStorage.removeItem(checkboxId);
}, 300000); // 1 minuto
}
// Restaurar estado de los checkboxes al cargar la página
function restoreCheckboxStates() {
checkboxes.forEach(function(checkbox) {
var checkboxId = checkbox.id;
var checkboxState = localStorage.getItem(checkboxId);
if (checkboxState) {
var [checked, timestamp] = checkboxState.split(',');
if (checked === "checked") {
checkbox.checked = true;
checkbox.disabled = true;
var timeLeft = 300000 - (Date.now() - parseInt(timestamp));
if (timeLeft > 0) {
setTimeout(function() {
checkbox.disabled = false;
checkbox.checked = false;
localStorage.removeItem(checkboxId);
}, timeLeft);
} else {
checkbox.disabled = false;
checkbox.checked = false;
localStorage.removeItem(checkboxId);
}
}
}
});
}
// Marcar checkbox automáticamente al cargar la página
function markCheckboxesOnLoad() {
var estacionValue = parseInt(estacionInput.value);
if (!isNaN(estacionValue) && estacionValue >= 1 && estacionValue <= 6) {
findNextAvailableCheckbox(estacionValue);
}
}
// Llamar a la función para marcar los checkboxes y restaurar el estado al cargar la página
restoreCheckboxStates();
markCheckboxesOnLoad();
});
<?php include 'menu.php'; ?>
<div class="u-form-group u-form-group-3">
<label for="name-e4d9" class="u-label" style="color: white; font-size: 15px;">Nombre</label>
<input type="text" id="name-e4d9" name="nombre" class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" value="<?php echo $_GET['nombre']; ?> <?php echo $_GET['apellido']; ?>" required="required" readonly>
</div>
<input type="hidden" name="cedula" value="<?php echo htmlspecialchars($_GET['cedula']); ?>">
<div class="u-form-group u-form-group-3">
<label for="name-e4d9" class="u-label" style="color: white; font-size: 15px;">Plan de Mensualidad</label>
<input type="text" id="text-495f" name="plan" class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" value="<?php echo $_GET['plan']; ?>" readonly>
</div>
<div class="u-form-group u-form-group-3">
<label for="name-e4d9" class="u-label" style="color: white; font-size: 15px;">Día de Corte</label>
<input type="text" id="text-495f" name="fecha_corte" class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" value="<?php
$fecha_corte = $_GET['fecha_corte'];
$partes_fecha = explode('/', $fecha_corte);
$dia = trim($partes_fecha[0]);
echo $dia;
?>" readonly>
</div>
<div class="u-form-group u-form-group-3">
<label for="name-e4d9" class="u-label" style="color: white; font-size: 15px;">ÚLTIMO HIT</label>
<input type="text" id="text-495f" name="estacion" class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" required="required" pattern="[1-6]{1}" title="Ingrese solo números del 1 al 6" value="<?php echo isset($_GET['estacion']) ? htmlspecialchars($_GET['estacion']) : ''; ?>">
</div>
<input type="submit" name="register" value="Cargar" class="u-btn u-btn-submit u-button-style" style="background: #de222a">
</form>
</div>