mirror of
https://github.com/cheveguerra/Colaborando.git
synced 2026-08-19 00:46:37 +00:00
feat(resumen/tablero): persistencia de acciones, grafica mixta de progresion y habilitacion de penalizar
This commit is contained in:
@@ -3350,6 +3350,37 @@ function continuamos() {
|
||||
$('#nombreSesion').text('Sesión: ' + arregloGeneral.nombreSesion)
|
||||
}
|
||||
|
||||
// Restablecer el estado de los botones de acción (bAccion1 y bAccion2)
|
||||
if (typeof arregloGeneral !== 'undefined') {
|
||||
if (parseInt(arregloGeneral.bAccion1) === 1) {
|
||||
$('#bAccion1').css({ 'background-color': '#068bc3', 'color': 'white' })
|
||||
if (document.getElementById('bAccion1')) {
|
||||
document.getElementById('bAccion1').style.backgroundColor = '#068bc3'
|
||||
document.getElementById('bAccion1').style.color = 'white'
|
||||
}
|
||||
} else {
|
||||
$('#bAccion1').css({ 'background-color': '', 'color': 'black' })
|
||||
if (document.getElementById('bAccion1')) {
|
||||
document.getElementById('bAccion1').style.backgroundColor = ''
|
||||
document.getElementById('bAccion1').style.color = 'black'
|
||||
}
|
||||
}
|
||||
|
||||
if (parseInt(arregloGeneral.bAccion2) === 1) {
|
||||
$('#bAccion2').css({ 'background-color': '#068bc3', 'color': 'white' })
|
||||
if (document.getElementById('bAccion2')) {
|
||||
document.getElementById('bAccion2').style.backgroundColor = '#068bc3'
|
||||
document.getElementById('bAccion2').style.color = 'white'
|
||||
}
|
||||
} else {
|
||||
$('#bAccion2').css({ 'background-color': '', 'color': 'black' })
|
||||
if (document.getElementById('bAccion2')) {
|
||||
document.getElementById('bAccion2').style.backgroundColor = ''
|
||||
document.getElementById('bAccion2').style.color = 'black'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
asignarHabilidades('RecursosHumanos')
|
||||
asignarHabilidades('MarketingYVentas')
|
||||
asignarHabilidades('Finanzas')
|
||||
@@ -3425,21 +3456,28 @@ function continuamos() {
|
||||
const quincenaCargada = parseInt(arregloGeneral.quincena) || 1
|
||||
const trimestreActual = Math.floor((quincenaCargada - 1) / 6) + 1
|
||||
|
||||
// 1. Usar el ID del proyecto grande que se guardó en la sesión, si no está completado.
|
||||
// 1. Usar el ID del proyecto grande que se guardó en la sesión, únicamente si sigue 'En proceso'.
|
||||
let proyectoGde = null
|
||||
console.log('ID de proyecto grande guardado:', proyectoGdeActual)
|
||||
if (
|
||||
proyectoGdeActual !== undefined &&
|
||||
proyectoGdeActual !== null &&
|
||||
proyectoGdeActual !== '' &&
|
||||
proyectos[proyectoGdeActual].estatus !== 'Completado'
|
||||
proyectos[proyectoGdeActual] &&
|
||||
proyectos[proyectoGdeActual].estatus === 'En proceso'
|
||||
) {
|
||||
proyectoGde = proyectos[proyectoGdeActual]
|
||||
} else {
|
||||
// Fallback por si no se encuentra un ID guardado o si estaba completado.
|
||||
proyectoGde = proyectos.find(
|
||||
(p) => p.estatus === 'En proceso' || p.estatus === 'En siguientes'
|
||||
)
|
||||
// Fallback por si no se encuentra un ID guardado o si estaba completado o descartado.
|
||||
proyectoGde = proyectos.find((p) => p.estatus === 'En proceso')
|
||||
if (!proyectoGde) {
|
||||
proyectoGde = proyectos.find((p) => p.estatus === 'En siguientes')
|
||||
}
|
||||
if (proyectoGde) {
|
||||
proyectoGdeActual = proyectos.findIndex((p) => p.id === proyectoGde.id)
|
||||
} else {
|
||||
proyectoGdeActual = ''
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Limpiar los slots de proyectos chicos primero.
|
||||
@@ -3497,14 +3535,17 @@ function continuamos() {
|
||||
}
|
||||
sincronizarColaSiguientes()
|
||||
|
||||
// 5. Llenar el proyecto grande.
|
||||
if (proyectoGde) {
|
||||
// 5. Llenar o limpiar el proyecto grande.
|
||||
if (proyectoGde && (proyectoGde.estatus === 'En proceso' || proyectoGde.estatus === 'En siguientes')) {
|
||||
llenaProyectoGde(proyectoGde.id)
|
||||
} else if (siguientesProyectos.length > 0) {
|
||||
// Si no había ningún proyecto en el tablero, tomar el primero de la cola.
|
||||
llenaProyectoGde(siguientesProyectos[0].id)
|
||||
siguientesProyectos.splice(0, 1)
|
||||
sincronizarColaSiguientes()
|
||||
} else {
|
||||
limpiarProyectoGde()
|
||||
proyectoGdeActual = ''
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3658,11 +3699,25 @@ function relojUpdateTime() {
|
||||
|
||||
function relojPlaySound() {
|
||||
const audio = new Audio('Microwave_bell.wav')
|
||||
if ($('#bAccion2').css('background-color') === 'rgb(6, 139, 195)') {
|
||||
$('#bAccion1').css('background-color', '')
|
||||
$('#bAccion1').css('color', 'black')
|
||||
$('#bAccion2').css('background-color', '')
|
||||
$('#bAccion2').css('color', 'black')
|
||||
const bg2 = $('#bAccion2').css('background-color')
|
||||
if (bg2 === 'rgb(6, 139, 195)' || bg2 === '#068bc3') {
|
||||
$('#bAccion1').css({ 'background-color': '', 'color': 'black' })
|
||||
$('#bAccion2').css({ 'background-color': '', 'color': 'black' })
|
||||
if (document.getElementById('bAccion1')) {
|
||||
document.getElementById('bAccion1').style.backgroundColor = ''
|
||||
document.getElementById('bAccion1').style.color = 'black'
|
||||
}
|
||||
if (document.getElementById('bAccion2')) {
|
||||
document.getElementById('bAccion2').style.backgroundColor = ''
|
||||
document.getElementById('bAccion2').style.color = 'black'
|
||||
}
|
||||
if (typeof arregloGeneral !== 'undefined') {
|
||||
arregloGeneral.bAccion1 = 0
|
||||
arregloGeneral.bAccion2 = 0
|
||||
if (typeof guardaSesion === 'function') {
|
||||
guardaSesion()
|
||||
}
|
||||
}
|
||||
}
|
||||
audio.play()
|
||||
}
|
||||
@@ -3684,13 +3739,29 @@ function relojResumeTimer() {
|
||||
}
|
||||
|
||||
function toggleColor(button) {
|
||||
console.log(button.style.backgroundColor)
|
||||
if (button.style.backgroundColor === 'rgb(6, 139, 195)') {
|
||||
button.style.backgroundColor = '' // Restablecer al color original
|
||||
button.style.color = 'black' // Cambiar el texto a negro
|
||||
const $btn = $(button)
|
||||
const id = $btn.attr('id')
|
||||
const bg = $btn.css('background-color')
|
||||
const isSelected = (bg === 'rgb(6, 139, 195)' || bg === '#068bc3' || button.style.backgroundColor === 'rgb(6, 139, 195)' || button.style.backgroundColor === '#068bc3')
|
||||
|
||||
if (isSelected) {
|
||||
$btn.css({ 'background-color': '', 'color': 'black' })
|
||||
button.style.backgroundColor = ''
|
||||
button.style.color = 'black'
|
||||
if (id && typeof arregloGeneral !== 'undefined') {
|
||||
arregloGeneral[id] = 0
|
||||
}
|
||||
} else {
|
||||
button.style.backgroundColor = '#068bc3' // Cambiar a azul
|
||||
button.style.color = 'white' // Cambiar el texto a blanco
|
||||
$btn.css({ 'background-color': '#068bc3', 'color': 'white' })
|
||||
button.style.backgroundColor = '#068bc3'
|
||||
button.style.color = 'white'
|
||||
if (id && typeof arregloGeneral !== 'undefined') {
|
||||
arregloGeneral[id] = 1
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof guardaSesion === 'function') {
|
||||
guardaSesion()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user