#6274 proxy workerTimeControl #14

Merged
jorgep merged 12 commits from 6274-loginWorkerTimeControl into test 2024-01-04 13:26:28 +00:00
4 changed files with 21 additions and 48 deletions
Showing only changes of commit 7b9d0c5310 - Show all commits

View File

@ -350,14 +350,6 @@ header {
font-size: 2.5em; font-size: 2.5em;
margin-bottom: 20px; margin-bottom: 20px;
} }
.btnconfirmar {
float: left;
font-size: 1.2em;
padding: 18px;
background: rgba(163,171,38,.90);
color: #fff;
margin: 15px;
}
@keyframes slideIn { @keyframes slideIn {
0% { 0% {

View File

@ -1,4 +1,4 @@
var userData = ""; let userData = "";
$(document).ready(function () { $(document).ready(function () {
userData = JSON.parse(localStorage.getItem("userData")); userData = JSON.parse(localStorage.getItem("userData"));
@ -99,19 +99,26 @@ function getInfo() {
} }
function printTimetable(timetable) { function printTimetable(timetable) {
console.log(timetable) const listWeekName = [
var listWeekName = weekDays(); 'Domingo',
var dated = new Date(); 'Lunes',
'Martes',
'Miércoles',
'Jueves',
'Viernes',
'Sábado'
];;
let dated = new Date();
dated.setDate(dated.getDate() - 6); dated.setDate(dated.getDate() - 6);
for (var i = 0; i < 6; i++) { for (let i = 0; i < 6; i++) {
jorgep marked this conversation as resolved
Review

porque es let y no const?

porque es let y no const?
Review

Tiene que ser let para poder modificar su valor, si no, no funciona

Tiene que ser let para poder modificar su valor, si no, no funciona
$(".listHorario").append('<label>' + listWeekName[dated.getDay()] +'</label>'); $(".listHorario").append('<label>' + listWeekName[dated.getDay()] +'</label>');
dated.setDate(dated.getDate() + 1); dated.setDate(dated.getDate() + 1);
} }
$(".listHorario").append('<label class="hoy">HOY</label>'); $(".listHorario").append('<label class="hoy">HOY</label>');
$(".listHorario").append('<li class="hrTop"></li>'); $(".listHorario").append('<li class="hrTop"></li>');
for (var i = 0; i < timetable.length; i++) { for (let i = 0; i < timetable.length; i++) {
$(".listHorario").append( $(".listHorario").append(
'<li>' + '<li>' +
@ -192,25 +199,9 @@ function printTotalHours(timetable) {
} }
function weekDays() {
var weekDays = [
'Domingo',
'Lunes',
'Martes',
'Miércoles',
'Jueves',
'Viernes',
'Sábado'
];
return weekDays;
}
function printErrores(errores) { function printErrores(errores) {
var error = ''; let error = '';
for (var i = 0; i < errores.length; i++) { for (let i = 0; i < errores.length; i++) {
if (errores[i].error) { if (errores[i].error) {
error += errores[i].error + "<br>"; error += errores[i].error + "<br>";
} }

View File

@ -1,6 +1,5 @@
var pin = ""; let pin = "";
var datoUsuario = ""; let pass = "";
var pass = "";
$(document).ready(function () { $(document).ready(function () {
FastClick.attach(document.body); FastClick.attach(document.body);
@ -10,6 +9,7 @@ $(document).ready(function () {
function setEvents() { function setEvents() {
const heartEl = document.querySelector('body > h1 > span'); const heartEl = document.querySelector('body > h1 > span');
heartEl.addEventListener('click', function() { heartEl.addEventListener('click', function() {
Swal.fire({ Swal.fire({
title: 'Iniciar sesión', title: 'Iniciar sesión',
@ -24,10 +24,6 @@ function setEvents() {
signIn(user,pass); signIn(user,pass);
} }
}); });
let token;
if (token === null) return
localStorage.setItem('token', token);
}); });
$(".btnnum").on("click", function () { $(".btnnum").on("click", function () {
@ -42,12 +38,6 @@ function setEvents() {
$(".btnOk").on("click", login); $(".btnOk").on("click", login);
$(".btnconfirmar").on("click", function () {
localStorage.setItem("userData", JSON.stringify(datoUsuario));
setTimeout(function () {
window.location = "clockIn.html";
}, 200);
});
} }
function login() { function login() {

View File

@ -1,4 +1,4 @@
var user = "timeControl"; const user = "timeControl";
function confirmReset() { function confirmReset() {
$(".confirm").removeClass('confirmKO'); $(".confirm").removeClass('confirmKO');
@ -31,8 +31,8 @@ function signIn(user, password) {
} }
$.ajaxPrefilter(function(xhr) { $.ajaxPrefilter(function(xhr) {
var orgErrorHandler = xhr.error; const orgErrorHandler = xhr.error;
var token = localStorage.getItem('token') const token = localStorage.getItem('token')
Object.assign(xhr, { Object.assign(xhr, {
url: `api/${xhr.urlPath}`, url: `api/${xhr.urlPath}`,