270 lines
9.2 KiB
HTML
Raw Permalink Normal View History

2025-09-23 16:53:05 -06:00
<style>
.fake {
background-image: url(img/bg12.jpg);
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
.hr-style {
opacity: 1;
2025-09-25 13:03:23 -06:00
width: 80%;
2025-09-23 16:53:05 -06:00
}
.btn-respuesta {
2025-09-24 22:51:53 -06:00
max-width: 550px;
cursor: pointer;
}
.indicator-circle {
width: 40px;
height: 40px;
margin: 0px 8px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
font-size: 18px;
font-weight: bold;
2025-09-23 16:53:05 -06:00
}
</style>
<div class='page-sco py-2 py-md-0 h-100'>
<div class='container h-100'>
<div class='row justify-content-center align-items-center h-100'>
<div class='col-12'>
<div class='row justify-content-center'>
<div class="col-10 mb-2">
<h2 class="text-center fw-bold text-primary">Cuidados del sitio de salida y complicaciones</h2>
<hr class="border border-3 border-verde-oscuro hr-style mx-auto my-0">
</div>
2025-09-24 22:51:53 -06:00
<div class="col-10 px-0 mb-1 col-instrucciones">
2025-09-23 16:53:05 -06:00
<div class="card bg-lila-claro border-0 my-2 rounded-4 bg-custom px-3 py-2 text-center">
<div class="d-flex justify-content-center align-items-center flex-row">
<img src="img/12.3.png" class="img-fluid mx-3">
2025-09-25 13:03:23 -06:00
<p class="mb-0 text-white text-start">Lee lo que opinan dos doctores sobre los cuidados del sitio de salida y las complicaciones que pueden surgir si no se hacen correctamente. Analiza cuidadosamente sus argumentos y elige quién tiene la razón.</p>
2025-09-23 16:53:05 -06:00
</div>
</div>
</div>
2025-09-24 22:51:53 -06:00
<div class="col-12 col-actividad">
<div class="row justify-content-center">
<div class="col-12 mb-2">
<div class="d-flex justify-content-center align-items-center gap-2 flex-row indicadores-avance"></div>
</div>
<div class="col-12">
<div id="puzzle-versus" class="d-flex flex-row justify-content-center gap-2"></div>
</div>
</div>
2025-09-23 16:53:05 -06:00
</div>
</div>
</div>
</div>
</div>
</div>
<div class="d-none">
<div id="pop0">
<div class="container-fluid">
<div class=" w-100 text-center">
<img src="img/3.5.png" class="img-fluid">
</div>
<div class="row justify-content-center">
<div class="col-12 text-center mb-2">
<h3 class="text-secondary-dark fw-bold">¡Bien hecho!</h3>
</div>
<div class="col-12 text-center">
<p class="mb-0">Has concluido la actividad.</p>
</div>
</div>
</div>
</div>
</div>
<script>
$(function () {
"use strict";
$('.wrap-course-content').addClass('fake');
const feedbackcorrect = CourseNav.createSound('audio/feedback-correct.mpeg');
const feedbackincorrect = CourseNav.createSound('audio/feedback-incorrect.mpeg');
const imgPerso = ['img/12.0.png','img/12.1.png'];
2025-09-25 13:03:23 -06:00
const urlExcelFile = 'Actividades_Rotafolio_Vantive.xlsx';
2025-09-23 16:53:05 -06:00
let versusData;
let currentQuestionIndex = 0;
function readExcelFile(url, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'arraybuffer';
xhr.onload = function (e) {
var arrayBuffer = xhr.response;
var data = new Uint8Array(arrayBuffer);
var workbook = XLSX.read(data, { type: "array" });
var result = {};
workbook.SheetNames.forEach(sheetName => {
var sheet = workbook.Sheets[sheetName];
result[sheetName] = XLSX.utils.sheet_to_json(sheet);
});
callback(result);
};
xhr.send();
}
function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}
2025-09-25 13:03:23 -06:00
function procesarPreguntas(data) {
return data.map(fila => ({
pregunta: fila.pregunta ? String(fila.pregunta).trim() : '',
opcion: fila.opcion ? String(fila.opcion).trim() : '',
opcion_c: fila.opcion_c ? String(fila.opcion_c).trim() : ''
}));
}
2025-09-24 22:51:53 -06:00
function createIndicators(total) {
const container = $('.indicadores-avance');
container.empty();
for (let i = 0; i < total; i++) {
const circle = $('<div class="indicator-circle"></div>');
circle.css({
'background-color': i === 0 ? '#2196F3' : '#E0E0E0'
});
circle.attr('data-index', i);
container.append(circle);
}
}
function updateIndicators() {
$('.indicator-circle').each(function(index) {
const $this = $(this);
if (index < currentQuestionIndex) {
$this.empty();
const img = $('<img>').attr({
'src': 'img/11.check.png',
'style': 'width: 100%; height: 100%;'
});
$this.append(img);
} else if (index === currentQuestionIndex) {
$this.css('background-color', '#2196F3').empty();
} else {
$this.css('background-color', '#E0E0E0').empty();
}
});
}
2025-09-23 16:53:05 -06:00
function createVersusStructure() {
const container = $('#puzzle-versus');
if (!versusData || currentQuestionIndex >= versusData.length) {
console.log('No hay más datos disponibles');
return;
}
const data = versusData[currentQuestionIndex];
console.log('Pregunta actual:', data);
const shuffledImages = shuffleArray([...imgPerso]);
const responses = [data.opcion, data.opcion_c];
const randomOrder = Math.random() < 0.5;
const leftResponse = randomOrder ? responses[0] : responses[1];
const rightResponse = randomOrder ? responses[1] : responses[0];
2025-09-25 13:03:23 -06:00
const leftIsCorrect = randomOrder ? false : true; // opcion_c es la correcta
2025-09-23 16:53:05 -06:00
const structure = `
<div class="btn-respuesta" data-correct="${leftIsCorrect}">
<div class="d-flex flex-column justify-content-center align-items-center gap-0">
2025-09-25 13:03:23 -06:00
<img src="${shuffledImages[0]}" alt="personaje" style="z-index:1;">
<div class="card bg-verde-ceniza border-0 shadow rounded-15 pt-5 px-3 pb-3 text-center text-respuesta text-white" style="margin-top: -60px;">${leftResponse || ''}</div>
2025-09-23 16:53:05 -06:00
</div>
</div>
2025-09-24 22:51:53 -06:00
<img src="img/12.2.png" class="img-fluid mx-2">
2025-09-23 16:53:05 -06:00
<div class="btn-respuesta" data-correct="${!leftIsCorrect}">
<div class="d-flex flex-column justify-content-center align-items-center gap-0">
2025-09-25 13:03:23 -06:00
<img src="${shuffledImages[1]}" alt="personaje" style="z-index:1;">
<div class="card bg-verde-ceniza border-0 shadow rounded-15 pt-5 px-3 pb-3 text-center text-respuesta text-white" style="margin-top: -60px;">${rightResponse || ''}</div>
2025-09-23 16:53:05 -06:00
</div>
</div>
`;
container.html(structure);
2025-09-24 22:51:53 -06:00
container.addClass('animate__animated animate__zoomIn');
setTimeout(() => {
container.removeClass('animate__animated animate__zoomIn');
}, 1000);
2025-09-23 16:53:05 -06:00
$('.btn-respuesta').click(function() {
const isCorrect = $(this).data('correct');
if (isCorrect) {
feedbackcorrect.play();
currentQuestionIndex++;
2025-09-24 22:51:53 -06:00
updateIndicators();
container.addClass('animate__animated animate__zoomOut');
2025-09-23 16:53:05 -06:00
if (currentQuestionIndex >= versusData.length) {
2025-09-24 22:51:53 -06:00
setTimeout(() => showResults(), 700);
2025-09-23 16:53:05 -06:00
} else {
2025-09-24 22:51:53 -06:00
setTimeout(() => {
container.removeClass('animate__animated animate__zoomOut');
createVersusStructure();
}, 500);
2025-09-23 16:53:05 -06:00
}
} else {
feedbackincorrect.play();
}
});
}
2025-09-24 22:51:53 -06:00
function showResults() {
$('.col-actividad').hide();
$('.col-instrucciones').html('');
const resultHTML = `
<div class="text-center animate__animated animate__zoomIn">
<h3 class="text-primary fw-bold">¡Actividad completada!</h3>
<p class="text-secondary">¡Todas las respuestas fueron correctas!</p>
</div>
`;
$('.col-instrucciones').html(resultHTML);
setTimeout(() => checkAllCompleted(), 300);
}
2025-09-23 16:53:05 -06:00
function checkAllCompleted() {
setTimeout(() => {
const html = $("#pop0").html();
Swal.fire({
html: html,
2025-09-24 22:51:53 -06:00
target: document.getElementById('wrap-course-content'),
2025-09-23 16:53:05 -06:00
customClass: {
popup: 'pop_html_style border border-3 border-primary rounded-4',
confirmButton: 'btn text-white bg-primary amor fw-semibold animate__animated animate__pulse animate__infinite'
},
confirmButtonText: "Cerrar",
showConfirmButton: true,
allowOutsideClick: false,
allowEscapeKey: false,
backdrop: "rgba(65, 60, 60, .95)",
width: "35em",
didClose: () => {
CourseNav.setSlideVisited();
$(".card-container2").addClass('disabled');
}
});
}, 250);
}
// Cargar datos del Excel
readExcelFile(urlExcelFile, function(data) {
2025-09-25 13:03:23 -06:00
const hojaDatos = data["Diapositiva 14"];
versusData = procesarPreguntas(hojaDatos);
2025-09-23 16:53:05 -06:00
console.log('Datos cargados:', versusData);
2025-09-24 22:51:53 -06:00
createIndicators(versusData.length);
2025-09-23 16:53:05 -06:00
createVersusStructure();
});
});
</script>