Akira-Kurusu commited on
Commit
15c658c
·
verified ·
1 Parent(s): 42fa7da

Update web/index.html

Browse files
Files changed (1) hide show
  1. web/index.html +123 -32
web/index.html CHANGED
@@ -3,8 +3,10 @@
3
  <head>
4
  <meta charset="utf-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
 
6
  <meta name="description" content="">
7
  <meta name="author" content="">
 
8
  <link rel="icon" href="favicon.ico">
9
  <title>Dashboard</title>
10
  <link rel="stylesheet" href="css/simplebar.css">
@@ -17,8 +19,19 @@
17
  <link rel="stylesheet" href="css/jquery.timepicker.css">
18
  <link rel="stylesheet" href="css/quill.snow.css">
19
  <link rel="stylesheet" href="css/daterangepicker.css">
20
- <link rel="stylesheet" href="css/app-light.css" id="lightTheme">
21
- <link rel="stylesheet" href="css/app-dark.css" id="darkTheme" disabled>
 
 
 
 
 
 
 
 
 
 
 
22
  </head>
23
  <body class="vertical light ">
24
  <div class="wrapper">
@@ -28,6 +41,12 @@
28
  </button>
29
 
30
  <ul class="nav">
 
 
 
 
 
 
31
 
32
 
33
  <li class="nav-item dropdown">
@@ -599,6 +618,11 @@
599
  </script>
600
  <script src="js/apps.js"></script>
601
  <script async src="https://www.googletagmanager.com/gtag/js?id=UA-56159088-1"></script>
 
 
 
 
 
602
  <script>
603
  window.dataLayer = window.dataLayer || [];
604
 
@@ -1034,22 +1058,8 @@
1034
 
1035
  chartElement.innerHTML = '';
1036
 
1037
- // Convertir "YYYY-MM-DD" a timestamp UTC mediodia para evitar
1038
- // desfases de zona horaria que desplazan el dia al anterior
1039
- function dateStrToTs(d) {
1040
- var parts = d.split('-').map(Number);
1041
- return Date.UTC(parts[0], parts[1] - 1, parts[2], 12, 0, 0);
1042
- }
1043
-
1044
- // Series con objetos {x: timestamp, y: valor}
1045
- // ApexCharts maneja las fechas nativamente con type:'datetime'
1046
- function toSeries(values) {
1047
- return dates.map(function(d, i) { return { x: dateStrToTs(d), y: values[i] }; });
1048
- }
1049
-
1050
  setTimeout(() => {
1051
  try {
1052
- var maxVal = Math.max.apply(null, totalConsultations) || 1;
1053
  const options = {
1054
  chart: {
1055
  type: 'area',
@@ -1075,11 +1085,22 @@
1075
  background: 'transparent'
1076
  },
1077
  colors: ['#2E93fA', '#FF9800', '#66DA26'],
1078
- series: [
1079
- { name: 'Total Consultas', data: toSeries(totalConsultations) },
1080
- { name: 'Con Retinopatía', data: toSeries(positiveCases) },
1081
- { name: 'Sin Retinopatía', data: toSeries(negativeCases) }
1082
- ],
 
 
 
 
 
 
 
 
 
 
 
1083
  xaxis: {
1084
  type: 'datetime',
1085
  labels: {
@@ -1112,7 +1133,7 @@
1112
  }
1113
  },
1114
  min: 0,
1115
- tickAmount: maxVal,
1116
  labels: {
1117
  formatter: function(val) { return Math.floor(val); },
1118
  style: {
@@ -1126,8 +1147,7 @@
1126
  intersect: false,
1127
  x: {
1128
  formatter: function(value) {
1129
- var d = new Date(value);
1130
- return d.toLocaleDateString('es-ES', {
1131
  weekday: 'long',
1132
  year: 'numeric',
1133
  month: 'long',
@@ -1868,7 +1888,6 @@
1868
  }
1869
 
1870
  window.addEventListener('load', centerWindow);
1871
- window.addEventListener('focus', centerWindow);
1872
  })();
1873
  </script>
1874
 
@@ -1956,16 +1975,88 @@
1956
  });
1957
  </script>
1958
  <script>
1959
- function _initFeather() {
1960
- if (typeof feather !== 'undefined') feather.replace({ 'stroke-width': 1.8 });
 
 
 
 
 
 
1961
  }
1962
- document.addEventListener('DOMContentLoaded', _initFeather);
1963
- var _fObserver = new MutationObserver(function(mutations) {
1964
- if (mutations.some(function(m){ return m.addedNodes.length > 0; })) _initFeather();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1965
  });
1966
- document.addEventListener('DOMContentLoaded', function() {
1967
- _fObserver.observe(document.body, { childList: true, subtree: true });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1968
  });
 
 
1969
  </script>
 
1970
  </body>
1971
  </html>
 
3
  <head>
4
  <meta charset="utf-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6
+
7
  <meta name="description" content="">
8
  <meta name="author" content="">
9
+
10
  <link rel="icon" href="favicon.ico">
11
  <title>Dashboard</title>
12
  <link rel="stylesheet" href="css/simplebar.css">
 
19
  <link rel="stylesheet" href="css/jquery.timepicker.css">
20
  <link rel="stylesheet" href="css/quill.snow.css">
21
  <link rel="stylesheet" href="css/daterangepicker.css">
22
+ <style id="themeBlock">html{visibility:hidden}</style>
23
+ <script>
24
+ (function(){
25
+ var dark = localStorage.getItem('theme') === 'dark';
26
+ document.write(
27
+ '<link rel="stylesheet" href="css/app-' + (dark?'dark':'light') + '.css" id="' + (dark?'dark':'light') + 'Theme">' +
28
+ '<link rel="stylesheet" href="css/app-' + (dark?'light':'dark') + '.css" id="' + (dark?'light':'dark') + 'Theme" disabled>'
29
+ );
30
+ if(dark) document.documentElement.style.backgroundColor = '#1a1a2e';
31
+ })();
32
+ </script>
33
+ <style>html{visibility:visible}</style>
34
+
35
  </head>
36
  <body class="vertical light ">
37
  <div class="wrapper">
 
41
  </button>
42
 
43
  <ul class="nav">
44
+ <li class="nav-item">
45
+ <a class="nav-link text-muted my-2" href="#" id="modeSwitcher" data-mode="light">
46
+ <i data-feather="sun"></i>
47
+ </a>
48
+ </li>
49
+
50
 
51
 
52
  <li class="nav-item dropdown">
 
618
  </script>
619
  <script src="js/apps.js"></script>
620
  <script async src="https://www.googletagmanager.com/gtag/js?id=UA-56159088-1"></script>
621
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/feather-icons/4.29.1/feather.min.js"></script>
622
+
623
+ <script>
624
+ feather.replace();
625
+ </script>
626
  <script>
627
  window.dataLayer = window.dataLayer || [];
628
 
 
1058
 
1059
  chartElement.innerHTML = '';
1060
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1061
  setTimeout(() => {
1062
  try {
 
1063
  const options = {
1064
  chart: {
1065
  type: 'area',
 
1085
  background: 'transparent'
1086
  },
1087
  colors: ['#2E93fA', '#FF9800', '#66DA26'],
1088
+ // Convertir "YYYY-MM-DD" a timestamp UTC mediodia para evitar
1089
+ // desfases de zona horaria que desplazan el dia al anterior
1090
+ series: (function() {
1091
+ function toTs(d) {
1092
+ var p = d.split('-').map(Number);
1093
+ return Date.UTC(p[0], p[1] - 1, p[2], 12, 0, 0);
1094
+ }
1095
+ function toSeries(vals) {
1096
+ return dates.map(function(d, i) { return { x: toTs(d), y: vals[i] }; });
1097
+ }
1098
+ return [
1099
+ { name: 'Total Consultas', data: toSeries(totalConsultations) },
1100
+ { name: 'Con Retinopatía', data: toSeries(positiveCases) },
1101
+ { name: 'Sin Retinopatía', data: toSeries(negativeCases) }
1102
+ ];
1103
+ })(),
1104
  xaxis: {
1105
  type: 'datetime',
1106
  labels: {
 
1133
  }
1134
  },
1135
  min: 0,
1136
+ tickAmount: Math.max.apply(null, totalConsultations) || 1,
1137
  labels: {
1138
  formatter: function(val) { return Math.floor(val); },
1139
  style: {
 
1147
  intersect: false,
1148
  x: {
1149
  formatter: function(value) {
1150
+ return new Date(value).toLocaleDateString('es-ES', {
 
1151
  weekday: 'long',
1152
  year: 'numeric',
1153
  month: 'long',
 
1888
  }
1889
 
1890
  window.addEventListener('load', centerWindow);
 
1891
  })();
1892
  </script>
1893
 
 
1975
  });
1976
  </script>
1977
  <script>
1978
+ (function () {
1979
+ // Feather: reemplazar SOLO íconos que aún son <i>, nunca tocar SVGs ya renderizados
1980
+ function _initFeather() {
1981
+ if (typeof feather === 'undefined') return;
1982
+ // Solo actuar si hay elementos <i data-feather> sin reemplazar todavía
1983
+ var pending = document.querySelectorAll('i[data-feather]');
1984
+ if (pending.length > 0) {
1985
+ feather.replace({ 'stroke-width': 1.8 });
1986
  }
1987
+ }
1988
+
1989
+ document.addEventListener('DOMContentLoaded', _initFeather);
1990
+
1991
+ var _fObserverActive = false;
1992
+ document.addEventListener('DOMContentLoaded', function () {
1993
+ var observer = new MutationObserver(function (mutations) {
1994
+ if (_fObserverActive) return; // evitar loops
1995
+ var hasPendingFeather = mutations.some(function (m) {
1996
+ return Array.from(m.addedNodes).some(function (n) {
1997
+ if (n.nodeType !== 1) return false;
1998
+ // Solo disparar si el nodo agregado tiene <i data-feather> dentro
1999
+ return n.matches('i[data-feather]') || n.querySelector('i[data-feather]');
2000
+ });
2001
+ });
2002
+ if (hasPendingFeather) {
2003
+ _fObserverActive = true;
2004
+ _initFeather();
2005
+ setTimeout(function () { _fObserverActive = false; }, 50);
2006
+ }
2007
  });
2008
+ observer.observe(document.body, { childList: true, subtree: true });
2009
+ });
2010
+ })();
2011
+ </script>
2012
+
2013
+ <script>
2014
+ (function () {
2015
+ function applyTheme(theme) {
2016
+ var lightTheme = document.getElementById('lightTheme');
2017
+ var darkTheme = document.getElementById('darkTheme');
2018
+ if (!lightTheme || !darkTheme) return;
2019
+ if (theme === 'dark') {
2020
+ lightTheme.disabled = true;
2021
+ darkTheme.disabled = false;
2022
+ document.documentElement.style.backgroundColor = '#1a1a2e';
2023
+ } else {
2024
+ lightTheme.disabled = false;
2025
+ darkTheme.disabled = true;
2026
+ document.documentElement.style.backgroundColor = '';
2027
+ }
2028
+ // ✅ NO tocar visibility aquí — solo el script del <head> debe hacerlo al cargar
2029
+ }
2030
+
2031
+ // Aplicar tema guardado (sin tocar visibility)
2032
+ applyTheme(localStorage.getItem('theme') || 'light');
2033
+
2034
+ // Sincronizar entre pestañas
2035
+ window.addEventListener('storage', function (e) {
2036
+ if (e.key === 'theme') applyTheme(e.newValue);
2037
+ });
2038
+
2039
+ function switchTheme() {
2040
+ var darkTheme = document.getElementById('darkTheme');
2041
+ if (!darkTheme) return;
2042
+ var newTheme = darkTheme.disabled ? 'dark' : 'light';
2043
+ applyTheme(newTheme);
2044
+ localStorage.setItem('theme', newTheme);
2045
+ }
2046
+
2047
+ document.addEventListener('DOMContentLoaded', function () {
2048
+ var btn = document.getElementById('modeSwitcher');
2049
+ if (!btn) return;
2050
+ var newBtn = btn.cloneNode(true);
2051
+ btn.parentNode.replaceChild(newBtn, btn);
2052
+ newBtn.addEventListener('click', function (e) {
2053
+ e.preventDefault();
2054
+ e.stopPropagation();
2055
+ switchTheme();
2056
  });
2057
+ });
2058
+ })();
2059
  </script>
2060
+
2061
  </body>
2062
  </html>