Commit inicial

This commit is contained in:
alexrg committed 2024-08-02 12:00:57 -06:00
commit 4489b65e04
246 files changed
+83097

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
/*!
* Bootstrap v4.1.3 (https://getbootstrap.com/)
* Copyright 2011-2018 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("jquery")):"function"==typeof define&&define.amd?define(["exports","jquery"],t):t(e.bootstrap={},e.jQuery)}(this,function(e,t){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function s(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function l(r){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},t=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),t.forEach(function(e){var t,n,i;t=r,i=o[n=e],n in t?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i})}return r}for(var r,n,o,a,c,u,f,h,d,p,m,g,_,v,y,E,b,w,C,T,S,D,A,I,O,N,k,x,P,L,j,H,M,F,W,R,U,B,q,K,Q,Y,V,z,G,J,Z,X,$,ee,te,ne,ie,re,oe,se,ae,le,ce,ue,fe,he,de,pe,me,ge,_e,ve,ye,Ee,be,we=function(i){var t="transitionend";function e(e){var t=this,n=!1;return i(this).one(l.TRANSITION_END,function(){n=!0}),setTimeout(function(){n||l.triggerTransitionEnd(t)},e),this}var l={TRANSITION_END:"bsTransitionEnd",getUID:function(e){for(;e+=~~(1e6*Math.random()),document.getElementById(e););return e},getSelectorFromElement:function(e){var t=e.getAttribute("data-target");t&&"#"!==t||(t=e.getAttribute("href")||"");try{return document.querySelector(t)?t:null}catch(e){return null}},getTransitionDurationFromElement:function(e){if(!e)return 0;var t=i(e).css("transition-duration");return parseFloat(t)?(t=t.split(",")[0],1e3*parseFloat(t)):0},reflow:function(e){return e.offsetHeight},triggerTransitionEnd:function(e){i(e).trigger(t)},supportsTransitionEnd:function(){return Boolean(t)},isElement:function(e){return(e[0]||e).nodeType},typeCheckConfig:function(e,t,n){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var r=n[i],o=t[i],s=o&&l.isElement(o)?"element":(a=o,{}.toString.call(a).match(/\s([a-z]+)/i)[1].toLowerCase());if(!new RegExp(r).test(s))throw new Error(e.toUpperCase()+': Option "'+i+'" provided type "'+s+'" but expected type "'+r+'".')}var a}};return i.fn.emulateTransitionEnd=e,i.event.special[l.TRANSITION_END]={bindType:t,delegateType:t,handle:function(e){if(i(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}},l}(t=t&&t.hasOwnProperty("default")?t.default:t),Ce=(n="alert",a="."+(o="bs.alert"),c=(r=t).fn[n],u={CLOSE:"close"+a,CLOSED:"closed"+a,CLICK_DATA_API:"click"+a+".data-api"},f="alert",h="fade",d="show",p=function(){function i(e){this._element=e}var e=i.prototype;return e.close=function(e){var t=this._element;e&&(t=this._getRootElement(e)),this._triggerCloseEvent(t).isDefaultPrevented()||this._removeElement(t)},e.dispose=function(){r.removeData(this._element,o),this._element=null},e._getRootElement=function(e){var t=we.getSelectorFromElement(e),n=!1;return t&&(n=document.querySelector(t)),n||(n=r(e).closest("."+f)[0]),n},e._triggerCloseEvent=function(e){var t=r.Event(u.CLOSE);return r(e).trigger(t),t},e._removeElement=function(t){var n=this;if(r(t).removeClass(d),r(t).hasClass(h)){var e=we.getTransitionDurationFromElement(t);r(t).one(we.TRANSITION_END,function(e){return n._destroyElement(t,e)}).emulateTransitionEnd(e)}else this._destroyElement(t)},e._destroyElement=function(e){r(e).detach().trigger(u.CLOSED).remove()},i._jQueryInterface=function(n){return this.each(function(){var e=r(this),t=e.data(o);t||(t=new i(this),e.data(o,t)),"close"===n&&t[n](this)})},i._handleDismiss=function(t){return function(e){e&&e.preventDefault(),t.close(this)}},s(i,null,[{key:"VERSION",get:function(){return"4.1.3"}}]),i}(),r(document).on(u.CLICK_DATA_API,'[data-dismiss="alert"]',p._handleDismiss(new p)),r.fn[n]=p._jQueryInterface,r.fn[n].Constructor=p,r.fn[n].noConflict=function(){return r.fn[n]=c,p._jQueryInterface},p),Te=(g="button",v="."+(_="bs.button"),y=".data-api",E=(m=t).fn[g],b="active",w="btn",T='[data-toggle^="button"]',S='[data-toggle="buttons"]',D="input",A=".active",I=".btn",O={CLICK_DATA_API:"click"+v+y,FOCUS_BLUR_DATA_API:(C="focus")+v+y+" blur"+v+y},N=function(){function n(e){this._element=e}var e=n.prototype;return e.toggle=function(){var e=!0,t=!0,n=m(this._element).closest(S)[0];if(n){var i=this._element.querySelector(D);if(i){if("radio"===i.type)if(i.checked&&this._element.classList.contains(b))e=!1;else{var r=n.querySelector(A);r&&m(r).removeClass(b)}if(e){if(i.hasAttribute("disabled")||n.hasAttribute("disabled")||i.classList.contains("disabled")||n.classList.contains("disabled"))return;i.checked=!this._element.classList.contains(b),m(i).trigger("change")}i.focus(),t=!1}}t&&this._element.setAttribute("aria-pressed",!this._element.classList.contains(b)),e&&m(this._element).toggleClass(b)},e.dispose=function(){m.removeData(this._element,_),this._element=null},n._jQueryInterface=function(t){return this.each(function(){var e=m(this).datLine truncated
//# sourceMappingURL=bootstrap.bundle.min.js.map
+7
View File
@@ -0,0 +1,7 @@
/*!
* Bootstrap v4.1.3 (https://getbootstrap.com/)
* Copyright 2011-2018 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jquery"),require("popper.js")):"function"==typeof define&&define.amd?define(["exports","jquery","popper.js"],e):e(t.bootstrap={},t.jQuery,t.Popper)}(this,function(t,e,h){"use strict";function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function s(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function l(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},e=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),e.forEach(function(t){var e,n,i;e=r,i=o[n=t],n in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i})}return r}e=e&&e.hasOwnProperty("default")?e.default:e,h=h&&h.hasOwnProperty("default")?h.default:h;var r,n,o,a,c,u,f,d,g,_,m,p,v,y,E,C,T,b,S,I,A,D,w,N,O,k,P,j,H,L,R,x,W,U,q,F,K,M,Q,B,V,Y,z,J,Z,G,$,X,tt,et,nt,it,rt,ot,st,at,lt,ct,ht,ut,ft,dt,gt,_t,mt,pt,vt,yt,Et,Ct,Tt,bt,St,It,At,Dt,wt,Nt,Ot,kt,Pt,jt,Ht,Lt,Rt,xt,Wt,Ut,qt,Ft,Kt,Mt,Qt,Bt,Vt,Yt,zt,Jt,Zt,Gt,$t,Xt,te,ee,ne,ie,re,oe,se,ae,le,ce,he,ue,fe,de,ge,_e,me,pe,ve,ye,Ee,Ce,Te,be,Se,Ie,Ae,De,we,Ne,Oe,ke,Pe,je,He,Le,Re,xe,We,Ue,qe,Fe,Ke,Me,Qe,Be,Ve,Ye,ze,Je,Ze,Ge,$e,Xe,tn,en,nn,rn,on,sn,an,ln,cn,hn,un,fn,dn,gn,_n,mn,pn,vn,yn,En,Cn,Tn,bn,Sn,In,An,Dn,wn,Nn,On,kn,Pn,jn,Hn,Ln,Rn,xn,Wn,Un,qn,Fn=function(i){var e="transitionend";function t(t){var e=this,n=!1;return i(this).one(l.TRANSITION_END,function(){n=!0}),setTimeout(function(){n||l.triggerTransitionEnd(e)},t),this}var l={TRANSITION_END:"bsTransitionEnd",getUID:function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},getSelectorFromElement:function(t){var e=t.getAttribute("data-target");e&&"#"!==e||(e=t.getAttribute("href")||"");try{return document.querySelector(e)?e:null}catch(t){return null}},getTransitionDurationFromElement:function(t){if(!t)return 0;var e=i(t).css("transition-duration");return parseFloat(e)?(e=e.split(",")[0],1e3*parseFloat(e)):0},reflow:function(t){return t.offsetHeight},triggerTransitionEnd:function(t){i(t).trigger(e)},supportsTransitionEnd:function(){return Boolean(e)},isElement:function(t){return(t[0]||t).nodeType},typeCheckConfig:function(t,e,n){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var r=n[i],o=e[i],s=o&&l.isElement(o)?"element":(a=o,{}.toString.call(a).match(/\s([a-z]+)/i)[1].toLowerCase());if(!new RegExp(r).test(s))throw new Error(t.toUpperCase()+': Option "'+i+'" provided type "'+s+'" but expected type "'+r+'".')}var a}};return i.fn.emulateTransitionEnd=t,i.event.special[l.TRANSITION_END]={bindType:e,delegateType:e,handle:function(t){if(i(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}},l}(e),Kn=(n="alert",a="."+(o="bs.alert"),c=(r=e).fn[n],u={CLOSE:"close"+a,CLOSED:"closed"+a,CLICK_DATA_API:"click"+a+".data-api"},f="alert",d="fade",g="show",_=function(){function i(t){this._element=t}var t=i.prototype;return t.close=function(t){var e=this._element;t&&(e=this._getRootElement(t)),this._triggerCloseEvent(e).isDefaultPrevented()||this._removeElement(e)},t.dispose=function(){r.removeData(this._element,o),this._element=null},t._getRootElement=function(t){var e=Fn.getSelectorFromElement(t),n=!1;return e&&(n=document.querySelector(e)),n||(n=r(t).closest("."+f)[0]),n},t._triggerCloseEvent=function(t){var e=r.Event(u.CLOSE);return r(t).trigger(e),e},t._removeElement=function(e){var n=this;if(r(e).removeClass(g),r(e).hasClass(d)){var t=Fn.getTransitionDurationFromElement(e);r(e).one(Fn.TRANSITION_END,function(t){return n._destroyElement(e,t)}).emulateTransitionEnd(t)}else this._destroyElement(e)},t._destroyElement=function(t){r(t).detach().trigger(u.CLOSED).remove()},i._jQueryInterface=function(n){return this.each(function(){var t=r(this),e=t.data(o);e||(e=new i(this),t.data(o,e)),"close"===n&&e[n](this)})},i._handleDismiss=function(e){return function(t){t&&t.preventDefault(),e.close(this)}},s(i,null,[{key:"VERSION",get:function(){return"4.1.3"}}]),i}(),r(document).on(u.CLICK_DATA_API,'[data-dismiss="alert"]',_._handleDismiss(new _)),r.fn[n]=_._jQueryInterface,r.fn[n].Constructor=_,r.fn[n].noConflict=function(){return r.fn[n]=c,_._jQueryInterface},_),Mn=(p="button",y="."+(v="bs.button"),E=".data-api",C=(m=e).fn[p],T="active",b="btn",I='[data-toggle^="button"]',A='[data-toggle="buttons"]',D="input",w=".active",N=".btn",O={CLICK_DATA_API:"click"+y+E,FOCUS_BLUR_DATA_API:(S="focus")+y+E+" blur"+y+E},k=function(){function n(t){this._element=t}var t=n.prototype;return t.toggle=function(){var t=!0,e=!0,n=m(this._element).closest(A)[0];if(n){var i=this._element.querySelector(D);if(i){if("radio"===i.type)if(i.checked&&this._element.classList.contains(T))t=!1;else{var r=n.querySelector(w);r&&m(r).removeClass(T)}if(t){if(i.hasAttribute("disLine truncated
//# sourceMappingURL=bootstrap.min.js.map
+5
View File
@@ -0,0 +1,5 @@
/*
Copyright (C) Federico Zivolo 2018
Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
*/(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.Popper=t()})(this,function(){'use strict';function e(e){return e&&'[object Function]'==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var o=e.ownerDocument.defaultView,n=o.getComputedStyle(e,null);return t?n[t]:n}function o(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function n(e){if(!e)return document.body;switch(e.nodeName){case'HTML':case'BODY':return e.ownerDocument.body;case'#document':return e.body;}var i=t(e),r=i.overflow,p=i.overflowX,s=i.overflowY;return /(auto|scroll|overlay)/.test(r+s+p)?e:n(o(e))}function r(e){return 11===e?re:10===e?pe:re||pe}function p(e){if(!e)return document.documentElement;for(var o=r(10)?document.body:null,n=e.offsetParent||null;n===o&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var i=n&&n.nodeName;return i&&'BODY'!==i&&'HTML'!==i?-1!==['TH','TD','TABLE'].indexOf(n.nodeName)&&'static'===t(n,'position')?p(n):n:e?e.ownerDocument.documentElement:document.documentElement}function s(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||p(e.firstElementChild)===e)}function d(e){return null===e.parentNode?e:d(e.parentNode)}function a(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var o=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,n=o?e:t,i=o?t:e,r=document.createRange();r.setStart(n,0),r.setEnd(i,0);var l=r.commonAncestorContainer;if(e!==l&&t!==l||n.contains(i))return s(l)?l:p(l);var f=d(e);return f.host?a(f.host,t):a(e,d(t).host)}function l(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:'top',o='top'===t?'scrollTop':'scrollLeft',n=e.nodeName;if('BODY'===n||'HTML'===n){var i=e.ownerDocument.documentElement,r=e.ownerDocument.scrollingElement||i;return r[o]}return e[o]}function f(e,t){var o=2<arguments.length&&void 0!==arguments[2]&&arguments[2],n=l(t,'top'),i=l(t,'left'),r=o?-1:1;return e.top+=n*r,e.bottom+=n*r,e.left+=i*r,e.right+=i*r,e}function m(e,t){var o='x'===t?'Left':'Top',n='Left'==o?'Right':'Bottom';return parseFloat(e['border'+o+'Width'],10)+parseFloat(e['border'+n+'Width'],10)}function h(e,t,o,n){return J(t['offset'+e],t['scroll'+e],o['client'+e],o['offset'+e],o['scroll'+e],r(10)?parseInt(o['offset'+e])+parseInt(n['margin'+('Height'===e?'Top':'Left')])+parseInt(n['margin'+('Height'===e?'Bottom':'Right')]):0)}function c(e){var t=e.body,o=e.documentElement,n=r(10)&&getComputedStyle(o);return{height:h('Height',t,o,n),width:h('Width',t,o,n)}}function g(e){return le({},e,{right:e.left+e.width,bottom:e.top+e.height})}function u(e){var o={};try{if(r(10)){o=e.getBoundingClientRect();var n=l(e,'top'),i=l(e,'left');o.top+=n,o.left+=i,o.bottom+=n,o.right+=i}else o=e.getBoundingClientRect()}catch(t){}var p={left:o.left,top:o.top,width:o.right-o.left,height:o.bottom-o.top},s='HTML'===e.nodeName?c(e.ownerDocument):{},d=s.width||e.clientWidth||p.right-p.left,a=s.height||e.clientHeight||p.bottom-p.top,f=e.offsetWidth-d,h=e.offsetHeight-a;if(f||h){var u=t(e);f-=m(u,'x'),h-=m(u,'y'),p.width-=f,p.height-=h}return g(p)}function b(e,o){var i=2<arguments.length&&void 0!==arguments[2]&&arguments[2],p=r(10),s='HTML'===o.nodeName,d=u(e),a=u(o),l=n(e),m=t(o),h=parseFloat(m.borderTopWidth,10),c=parseFloat(m.borderLeftWidth,10);i&&s&&(a.top=J(a.top,0),a.left=J(a.left,0));var b=g({top:d.top-a.top-h,left:d.left-a.left-c,width:d.width,height:d.height});if(b.marginTop=0,b.marginLeft=0,!p&&s){var y=parseFloat(m.marginTop,10),w=parseFloat(m.marginLeft,10);b.top-=h-y,b.bottom-=h-y,b.left-=c-w,b.right-=c-w,b.marginTop=y,b.marginLeft=w}return(p&&!i?o.contains(l):o===l&&'BODY'!==l.nodeName)&&(b=f(b,o)),b}function y(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=e.ownerDocument.documentElement,n=b(e,o),i=J(o.clientWidth,window.innerWidth||0),r=J(o.clientHeight,window.innerHeight||0),p=t?0:l(o),s=t?0:l(o,'left'),d={top:p-n.top+n.marginTop,left:s-n.left+n.marginLeft,width:i,height:r};return g(d)}function w(e){var n=e.nodeName;return'BODY'===n||'HTML'===n?!1:'fixed'===t(e,'position')||w(o(e))}function E(e){if(!e||!e.parentElement||r())return document.documentElement;for(var o=e.parentElement;o&&'none'===t(o,'transform');)o=o.parentElement;return o||document.documentElement}function v(e,t,i,r){var p=4<arguments.length&&void 0!==arguments[4]&&arguments[4],s={top:0,left:0},d=p?E(e):a(e,t);if('viewport'===r)s=y(d,p);else{var l;'scrollParent'===r?(l=n(o(t)),'BODY'===l.nodeName&&(l=e.ownerDocument.documentElement)):'window'===r?l=e.ownerDocument.documentElement:l=r;var f=b(l,d,p);if('HTML'===l.nodeName&&!w(d)){var m=c(e.ownerDocument),h=m.height,g=m.width;s.top+=f.top-f.marginTop,s.bottom=h+f.top,s.left+=f.left-f.marginLeft,s.right=g+f.left}else s=f}i=i||0;var u='number'==typeof i;return s.left+=u?i:i.left||0,s.top+=u?i:i.top||0,s.right-=u?i:i.right||0,s.bottom-=u?i:i.bottom||0,s}function x(e){var t=e.width,o=e.height;return t*o}function O(e,t,o,n,i){var r=5<arLine truncated
//# sourceMappingURL=popper.min.js.map
+628
View File
@@ -0,0 +1,628 @@
var msgTime = 0;
var modalVisible = false;
var ultimos = [];
var checkInterval = null;
function az(i) {
return `${i < 10 ? '0' : ''}${i}`;
}
function init() {
setInterval(function () {
var current_time = new Date().getTime();
var excecution_time = parseInt((current_time - started_at) / 1000);
var s = new Date((server_time + excecution_time) * 1000);
drawClock(az(s.getHours()), az(s.getMinutes()));
drawFecha(az(s.getDate()), s.getDay(), s.getMonth(), s.getFullYear());
}, 1000);
}
function drawClock(hora, min) {
$('#min').text(min);
$('#hr').text(hora);
}
function drawFecha(dd, dnum, mm, yyyy) {
var meses = ['Ene', 'Feb', 'Mzo', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'];
$('#fecha').text(' ' + meses[mm] + ' ' + dd);
$('#ano').text(yyyy);
}
function modalTimer() {
if (checkInterval === null) {//no es error de internet
setTimeout(function () {
$(".sub-bloque ").addClass("d-none");
$("#registro").removeClass("d-none");
$("#cve").focus();
}
, 7000 + msgTime);
}
}
//--Sin conexión de internet ---
function checadorAlive() {
if (checkInterval == null) {
checkInterval = setInterval(isAlive, 2500);
}
}
function isAlive() {
var alive = false;
try {
$.ajax({
url: 'checador_alive.php',
type: 'POST',
dataType: 'json',
async: false,
timeout: 500,/*ms*/
success: function (result) {
if (result["ok"] != "" && result["ok"] !== undefined) {
cambiaVista('.sub-bloque', '#registro');
$('#db-error').text(result.error);
$("#cve").focus();
alive = true;
clearInterval(checkInterval);
checkInterval = null;
}
},
error: function (jqXHR, textStatus, errorThrown) {
console.log("Sin internet");
}
});//ajax*/
} catch (e) {
console.log("error! ", e);
}
return alive;
}
//--Fin sin conexión de internet ---
function cambiaVista(objHide, objShow) {
$(objHide).addClass("d-none");
$(objShow).removeClass("d-none");
}
function showAviso(avisos) {
cambiaVista('#registro', '#avisos');
const lista = document.querySelector('#lista-avisos');
lista.innerHTML = '';
avisos.forEach(({ aviso_texto: texto }) => {
const li = document.createElement('li');
li.innerHTML = texto;
lista.appendChild(li);
});
}
/*
$('#formaChecador').on('submit', function (e) {
e.preventDefault();
var clave = $("#cve").val();
console.log("clave: ", clave);
$.ajax({
url: 'checador_action.php',
type: 'POST',
dataType: 'json',
data: { cve: $("#cve").val(), facultad: $("#facultad_id").val() },
timeout: 3500,
success: function (result) {
if ((result?.error ?? "") != "") {
console.log(result["error"]);
// avisos
// alert("here")
if (result.nombre != undefined && result.ok == undefined) {
showAviso(result.avisos);
return
cambiaVista('#registro', '#result_no');
$("#nombre-profesor").text(result["nombre"]);
$('#result_no .clave').text(clave);
$("#last-error").text(result["error"]);
}
else if(result.nombre == undefined) {
cambiaVista('#registro', '#not_in_db');
$('#clave-no-encontrada').html(clave);
} else
cambiaVista('#registro', '#internet');
return;
}
$("#list-result").find(".mat-desc").html("");
$("#list-result").find(".mat-fecha").html("");
$("#list-result").find(".mat-salon").html("");
$("#list-result").find(".mat-gpo").html("");
$("#nombre").html(result["nombre"]);
var rows = $("#list-result > li").length;//limpia tabla actual
var resultRows = 0;
//nuevas
if (result["result"] !== undefined && result["result"] != null) resultRows += result["result"].length;
//viejas
if (result["asistencias"] !== undefined && result["asistencias"] != null) resultRows += result["asistencias"].length;
if (rows > resultRows) {//sobran
//borrar renglones extra (rows - result.length) pero dejar al menos 1
while (rows > resultRows && rows > 1) {
$("#list-result li:last-child").remove();
rows--;
}
} else {//faltan, clonar
for (var i = rows; i < resultRows; i++) {
$("#list-result li:first-child").clone(true).appendTo("#list-result");
}
}
//----------
var retardo = false;
//hay elementos checado nuevo?
if (result["result"] !== undefined && result["result"] != null && result["result"].length != 0) {
cambiaVista('#registro', '#result_ok');
$("#list-result").children().each(function (index) {
if (index < result["result"].length) {//llenar info
if (result["result"][index]["grupo"] != "") {
if (result["result"][index]["retardo"]) {
retardo = true;
} else {
retardo = false;
}
$(this).find(".mat-gpo").html("<b>Grupo:</b> " + result["result"][index]["grupo"]);
}
$(this).find(".mat-desc").html(result["result"][index]["materia"]);
$(this).find(".mat-fecha").html("Inicia " + result["result"][index]["hora_inicio"]);
if (result["result"][index]["salon"] != "")
$(this).find(".mat-salon").html("<b>Salón:</b> " + result["result"][index]["salon"]);
//else $(this).find(".mat-salon").html("");
}
});
}
var texto = "";
//hay elementos checado anterior?
if (result["asistencias"] !== undefined && result["asistencias"] != null && result["asistencias"].length != 0) {
cambiaVista('#registro', '#result_ok');
$("#list-result").children().each(function (index) {
if (index < result["asistencias"].length) {//llenar info
if (result["asistencias"][index]["grupo"] != "") {
if (result["asistencias"][index]["retardo"]) {
retardo = true;
} else {
retardo = false;
}
$(this).find(".mat-gpo").html("<b>Grupo:</b> " + result["asistencias"][index]["grupo"]);
}
$(this).find(".mat-desc").html(result["asistencias"][index]["materia"]);
$(this).find(".mat-fecha").html("Inicia " + result["asistencias"][index]["hora_inicio"]);
texto = "<span style=font-size:50%>" +
"Ya estaba registrada" +
"</span>"
if (result["asistencias"][index]["salon"] !== undefined && result["asistencias"][index]["salon"] != "")
$(this).find(".mat-salon").html("<b>Salón:</b> " + result["asistencias"][index]["salon"]);
}
});
}
console.log(texto);
if (retardo) {
$("#estado").find("img").prop("src", "imagenes/retardo.svg");
$("#estado").find("h2").text("Retardo").removeClass("text-success text-blue").addClass("text-warning");
} else {
$("#estado").find("img").prop("src", "imagenes/asistencia.svg");
if (texto == "")
$("#estado").find("h2").text("Asistencia").removeClass("text-warning text-blue").addClass("text-success");
else
$("#estado").find("h2").html("Asistencia<br>" + texto).removeClass("text-warning text-success").addClass("text-blue");
}
if (result.nombre.replace(/ /g, '') == "") {
// if (false) {
console.log(clave)
cambiaVista('#registro', '#not_in_db');
$("#clave-no-encontrada").html(clave);
} else if (resultRows == 0) {
console.log(result)
//$("#nombre-profesor").text(result["nombre"]);
cambiaVista('#registro', '#result_no');
}
},
error: function (jqXHR, textStatus, errorThrown) {
cambiaVista('#registro', '#internet');
$('#db-error').text(textStatus);
checadorAlive();//Muestra mensaje sin internet y comienza a checar hasta que haya
},
complete: function (jqXHR, textStatus) {
$("#cve").val('');
modalTimer();
}
});
});
*/
document.querySelector('#formaChecador').addEventListener('submit', async (e) => {
e.preventDefault();
const clave = document.querySelector('#cve');
if (clave.value == '') {
clave.focus(); return;
}
const data = new FormData();
data.append('cve', clave.value);
const btn = document.querySelector('#btnChecar');
// remove btn
btn.classList.add('disabled');
// add spinner
btn.insertAdjacentHTML('afterbegin', '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>');
try {
const result = await fetch('action_checador.php', {
method: 'POST',
body: data
}).then(response => response.json());
if (!result.ok) {
function not_int_db(clave) {
cambiaVista('#registro', '#not_in_db');
document.querySelector('#clave-no-encontrada').innerHTML = clave;
}
function not_has_horario(nombre_profesor, from = '#registro') {
cambiaVista(from, '#result_no');
document.querySelector('#nombre-profesor').innerHTML = nombre_profesor;
}
switch (result.failure) {
case 'profesor':
not_int_db(clave.value);
break;
case 'horario':
let from;
if (result.avisos.length > 0) {
await show_avisos(result.avisos)
from = '#avisos';
}
else
from = '#registro';
not_has_horario(result.nombre, from);
break;
default:
alert('La clave no es válida');
location.reload();
}
setTimeout(() => {
location.reload();
}, 5000);
return;
}
function show_avisos(avisos) {
return new Promise(resolve => {
if (avisos.length == 0) {
resolve();
return;
}
const lista_avisos = document.querySelector('#lista-avisos');
avisos.forEach(aviso => lista_avisos.innerHTML += `<p>${aviso}</p><hr>`);
cambiaVista('#registro', '#avisos');
//$('#btn-aceptar-avisos').focus();
document.querySelector('#btn-aceptar-avisos').addEventListener('click', () => {
lista_avisos.innerHTML = '';
resolve();
});
});
}
function show_asistencia(nombre, horarios, from) {
cambiaVista(from, '#result_ok');
document.querySelector('#nombre').innerHTML = nombre;
const list_result = document.querySelector('#list-result');
const li_facultad_nombre = list_result.children[0];
const li_element = list_result.children[1];
list_result.innerHTML = '';
// foreach key is facultad (string), value
for (let facultad_nombre in horarios) {
let facultad = li_facultad_nombre.cloneNode(true);
facultad.innerHTML = facultad_nombre;
facultad = list_result.appendChild(facultad);
horarios[facultad_nombre].forEach(horario => {
console.log(horario);
let li = li_element.cloneNode(true);
li = list_result.appendChild(li);
li.querySelector(".mat-desc").innerHTML = horario.materia;
li.querySelector(".mat-fecha").innerHTML = `Inicia ${horario.horario_hora.slice(0, -3)}`;
li.querySelector(".salon").innerHTML = horario.salon;
li.querySelector(".mat-gpo").innerHTML = horario.horario_grupo;
})
}
const estado = document.querySelector('#estado');
//estado.querySelector('img').src = 'imagenes/asistencia.svg';
$('#icon_retardo').hide();
$('#icon_duplicada').hide();
$('#icon_asistencia').show();
const h2 = estado.querySelector('.text-big');
h2.innerHTML = `Asistencia registrada`;
h2.classList.remove('text-warning', 'text-success');
}
function show_duplicadas(nombre, horarios, from) {
show_asistencia(nombre, horarios, from);
texto = `<span style=font-size:50%>
Ya estaba registrada
</span>`
//document.querySelector('#estado').querySelector('img').src = 'imagenes/asistencia.svg';
$('#icon_retardo').hide();
$('#icon_asistencia').hide();
$('#icon_duplicada').show();
$("#estado").find(".text-big").html("Asistencia<br>" + texto).removeClass("text-warning text-success").addClass("text-blue");
const estado = document.querySelector('#estado');
const h2 = estado.querySelector('.text-big');
h2.innerHTML = `Asistencia<br>${texto}`;
h2.classList.remove('text-warning', 'text-success');
}
function show_retardos(nombre, horarios, from) {
show_asistencia(nombre, horarios, from);
texto = `Retardo`;
const estado = document.querySelector('#estado');
const h2 = estado.querySelector('.text-big');
h2.innerHTML = `Retardo`;
h2.classList.remove('text-success', 'text-blue');
h2.classList.add('text-warning');
//estado.querySelector('img').src = 'imagenes/retardo.svg';
$('#icon_asistencia').hide();
$('#icon_duplicada').hide();
$('#icon_retardo').show();
}
const { horarios, duplicadas, avisos } = result;
const { profesor_nombre } = result.profesor;
let retardos = {}, asistencia = {};
// if any horario has retardo = true horarios is an object with facultad as key
if (Object.values(horarios).some(horario => horario.some(h => h.registro_retardo)))
retardos = horarios;
// if any horario has duplicada = true horarios is an object with facultad as key
else
asistencia = horarios;
console.log(retardos, asistencia, avisos, duplicadas);
// Mostrar avisos
await show_avisos(avisos);
const from = avisos.length > 0 ? '#avisos' : '#registro';
// IF DUPLICADAS HAS ELEMENTS (JSON OBJECT)
if (Object.keys(duplicadas).length > 0)
show_duplicadas(profesor_nombre, duplicadas, from);
else if (Object.keys(retardos).length > 0)
show_retardos(profesor_nombre, retardos, from);
else
show_asistencia(profesor_nombre, asistencia, from);
// setTimeout(() => {
// location.reload();
// }, 5000);
} catch (error) {
console.log(error);
cambiaVista('.sub-bloque', '#internet');
checadorAlive(); //Muestra mensaje sin internet y comienza a checar hasta que haya
}
finally {
setTimeout(() => {
location.reload();
}, 5000);
}
});
async function test(type) {
let url;
switch (type) {
case 'retardo':
url = 'json/retardo.json';
break;
case 'duplicada':
url = 'json/duplicada.json';
break;
case 'asistencia':
url = 'json/asistencia.json';
break;
case 'sin_servicio':
url = 'json/no-internet.json';
break;
case 'error':
url = 'json/error.json';
break;
case 'internet':
url = 'json/internet.json';
break;
case 'sin_horario':
url = 'json/sin-horario.json';
break;
case 'clave':
url = 'json/clave-no-encontrada.json';
break;
case 'ok':
url = 'json/asistencia-aviso.json';
break;
case 'sin_horario_aviso':
url = 'json/sin-horario-aviso.json';
break;
}
try {
const result = await fetch(url).then(response => response.json());
if (!result.ok) {
const clave = { value: '123456' }
function not_int_db(clave) {
cambiaVista('#registro', '#not_in_db');
document.querySelector('#clave-no-encontrada').innerHTML = clave;
}
function not_has_horario(nombre_profesor, from = '#registro') {
cambiaVista(from, '#result_no');
document.querySelector('#nombre-profesor').innerHTML = nombre_profesor;
}
switch (result.failure) {
case 'profesor':
not_int_db(clave.value);
break;
case 'horario':
let from;
if (result.avisos.length > 0) {
await show_avisos(result.avisos)
from = '#avisos';
}
else
from = '#registro';
not_has_horario(result.nombre, from);
break;
case 'internet':
cambiaVista('#registro', '#internet');
break;
}
setTimeout(() => {
location.reload();
}, 5000);
return;
}
function show_avisos(avisos) {
return new Promise(resolve => {
if (avisos.length == 0) {
resolve();
return;
}
const lista_avisos = document.querySelector('#lista-avisos');
avisos.forEach(aviso => lista_avisos.innerHTML += `<p>${aviso}</p><hr>`);
cambiaVista('#registro', '#avisos');
//$('#btn-aceptar-avisos').focus();
document.querySelector('#btn-aceptar-avisos').addEventListener('click', () => {
lista_avisos.innerHTML = '';
resolve();
});
});
}
function show_asistencia(nombre, horarios, from) {
cambiaVista(from, '#result_ok');
document.querySelector('#nombre').innerHTML = nombre;
const list_result = document.querySelector('#list-result');
const li_facultad_nombre = list_result.children[0];
const li_element = list_result.children[1];
list_result.innerHTML = '';
// foreach key is facultad (string), value
for (let facultad_nombre in horarios) {
console.log(horarios[facultad_nombre]);
let facultad = li_facultad_nombre.cloneNode(true);
facultad.innerHTML = facultad_nombre;
facultad = list_result.appendChild(facultad);
horarios[facultad_nombre].forEach(horario => {
let li = li_element.cloneNode(true);
li = list_result.appendChild(li);
li.querySelector(".mat-desc").innerHTML = horario.materia;
li.querySelector(".mat-fecha").innerHTML = `Inicia ${horario.horario_hora.slice(0, -3)}`;
li.querySelector(".salon").innerHTML = horario.horario_salon;
li.querySelector(".mat-gpo").innerHTML = horario.horario_grupo;
})
}
const estado = document.querySelector('#estado');
//estado.querySelector('img').src = 'imagenes/asistencia.svg';
$('#icon_retardo').hide();
$('#icon_duplicada').hide();
$('#icon_asistencia').show();
const h2 = estado.querySelector('.text-big');
h2.innerHTML = `Asistencia registrada`;
h2.classList.remove('text-warning', 'text-success', 'txt-blue');
h2.classList.add('text-success');
}
function show_duplicadas(nombre, horarios, from) {
show_asistencia(nombre, horarios, from);
texto = `<span style=font-size:50%>
Ya estaba registrada
</span>`
//document.querySelector('#estado').querySelector('img').src = 'imagenes/duplicada.svg';
$('#icon_retardo').hide();
$('#icon_asistencia').hide();
$('#icon_duplicada').show();
$("#estado").find(".text-big").html("Asistencia<br>" + texto).removeClass("text-warning text-success").addClass("text-blue");
const estado = document.querySelector('#estado');
const h2 = estado.querySelector('.text-big');
h2.innerHTML = `Asistencia<br>${texto}`;
h2.classList.remove('text-warning', 'text-success');
}
function show_retardos(nombre, horarios, from) {
show_asistencia(nombre, horarios, from);
texto = `Retardo`;
const estado = document.querySelector('#estado');
const h2 = estado.querySelector('.text-big');
h2.innerHTML = `Retardo`;
h2.classList.remove('text-success', 'text-blue');
h2.classList.add('text-warning');
$('#icon_asistencia').hide();
$('#icon_duplicada').hide();
$('#icon_retardo').show();
//estado.querySelector('img').src = 'imagenes/retardo.svg';
}
const { horarios, duplicadas, avisos } = result;
const { nombre } = result.profesor;
let retardos = {}, asistencia = {};
// if any horario has retardo = true horarios is an object with facultad as key
if (Object.values(horarios).some(horario => horario.some(h => h.retardo)))
retardos = horarios;
// if any horario has duplicada = true horarios is an object with facultad as key
else
asistencia = horarios;
console.log(retardos, asistencia, avisos, duplicadas);
// Mostrar avisos
await show_avisos(avisos);
const from = avisos.length > 0 ? '#avisos' : '#registro';
// IF DUPLICADAS HAS ELEMENTS (JSON OBJECT)
if (Object.keys(duplicadas).length > 0)
show_duplicadas(nombre, duplicadas, from);
else if (Object.keys(retardos).length > 0)
show_retardos(nombre, retardos, from);
else
show_asistencia(nombre, asistencia, from);
// setTimeout(() => {
// location.reload();
// }, 5000);
} catch (error) {
console.log(error);
cambiaVista('.sub-bloque', '#error_bd');
checadorAlive(); //Muestra mensaje sin internet y comienza a checar hasta que haya
}
finally {
setTimeout(() => {
location.reload();
}, 5000);
}
}
+2
View File
@@ -0,0 +1,2 @@
/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)Line truncated