refs #6274 refactor
gitea/worker-time-control/pipeline/head This commit looks good Details

This commit is contained in:
Jorge Penadés 2023-11-30 09:25:32 +01:00
parent 57df79806a
commit 7b9d0c5310
4 changed files with 21 additions and 48 deletions

View File

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

View File

@ -1,4 +1,4 @@
var userData = "";
let userData = "";
$(document).ready(function () {
userData = JSON.parse(localStorage.getItem("userData"));
@ -99,19 +99,26 @@ function getInfo() {
}
function printTimetable(timetable) {
console.log(timetable)
var listWeekName = weekDays();
var dated = new Date();
const listWeekName = [
'Domingo',
'Lunes',
'Martes',
'Miércoles',
'Jueves',
'Viernes',
'Sábado'
];;
let dated = new Date();
dated.setDate(dated.getDate() - 6);
for (var i = 0; i < 6; i++) {
for (let i = 0; i < 6; i++) {
$(".listHorario").append('<label>' + listWeekName[dated.getDay()] +'</label>');
dated.setDate(dated.getDate() + 1);
}
$(".listHorario").append('<label class="hoy">HOY</label>');
$(".listHorario").append('<li class="hrTop"></li>');
for (var i = 0; i < timetable.length; i++) {
for (let i = 0; i < timetable.length; i++) {
$(".listHorario").append(
'<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) {
var error = '';
for (var i = 0; i < errores.length; i++) {
let error = '';
for (let i = 0; i < errores.length; i++) {
if (errores[i].error) {
error += errores[i].error + "<br>";
}

View File

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

View File

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