diff --git a/app.py b/app.py index 5098328..1e2001b 100644 --- a/app.py +++ b/app.py @@ -7,8 +7,20 @@ load_dotenv() ip = os.getenv("IPSERVER") puerto = os.getenv("PORT") +modo = os.getenv("mode", "1") monitor1 = os.getenv("MONITOR_ID_1") monitor2 = os.getenv("MONITOR_ID_2") +tema = os.getenv("THEME", "csm") +tema_styles = { + "csm": { + "bg1":"#114b94", + "bg2":"#0a6eb2" + }, + "imq": { + "bg1":"#CC0C00", + "bg2":"#e6392d" + } +} app = Flask(__name__) @@ -33,7 +45,11 @@ def obtener_pie(mon_id1, mon_id2): return [] try: cursor = conn.cursor() - cursor.execute("SELECT MENSAJE FROM CSMK_MONITOR_PIE WHERE MONITOR_ID IN (:monitor, :monitor2) AND INACTIVO = 0 ORDER BY MONITOR_ID, MONITOR_PIE_ID ASC",{'monitor':mon_id1, 'monitor2':mon_id2}) + if modo == "2": + cursor.execute("SELECT MENSAJE FROM CSMK_MONITOR_PIE WHERE MONITOR_ID IN (:monitor, :monitor2) AND INACTIVO = 0 ORDER BY MONITOR_ID, MONITOR_PIE_ID ASC",{'monitor':mon_id1, 'monitor2':mon_id2}) + else: + cursor.execute("SELECT MENSAJE FROM CSMK_MONITOR_PIE WHERE MONITOR_ID IN (:monitor) AND INACTIVO = 0 ORDER BY MONITOR_ID, MONITOR_PIE_ID ASC",{'monitor':mon_id1}) + mensajes = [fila[0] for fila in cursor.fetchall()] mensaje_final = "       ".join(mensajes) cursor.close() @@ -45,7 +61,8 @@ def obtener_pie(mon_id1, mon_id2): @app.route('/') def index(): - return render_template("index.html") + tema_colores = tema_styles.get(tema, tema_styles["csm"]) + return render_template("index.html", mode=modo, theme=tema, theme_colors=tema_colores) @app.route('/api/datos1') def api_datos1(): diff --git a/example.env b/example.env index b9eda7a..8da8439 100644 --- a/example.env +++ b/example.env @@ -1,10 +1,12 @@ +IPSERVER = 192.168.82.156 +PORT=5000 +ORA_DIRECTORY="C:/oracle/product/11.2.0.4" DB_USER=CSMKIOSCOS DB_PASSWORD=CSMKIOSCOS DB_HOST=192.168.1.76 DB_PORT=1521 DB_SID=REALRAC1 -PORT=5000 +MODE="1" +THEME="csm" MONITOR_ID_1=1 -MONITOR_ID_2=2 -ORA_DIRECTORY="C:/oracle/product/11.2.0.4" -IPSERVER = 192.168.82.156 \ No newline at end of file +MONITOR_ID_2=2 \ No newline at end of file diff --git a/static/js/scripts.js b/static/js/scripts.js index 222fab9..f0c7a51 100644 --- a/static/js/scripts.js +++ b/static/js/scripts.js @@ -24,7 +24,8 @@ function cargarTabla(endpoint, tablaId) { const td1 = document.createElement("td"); td1.textContent = fila[0]; - td1.className = `border bg-[#114b94] align-middle ${sizeClass}`; + td1.className = `border align-middle ${sizeClass}`; + td1.style.backgroundColor = window.themeColors.bg1; tr.appendChild(td1); const td2 = document.createElement("td"); @@ -40,7 +41,8 @@ function cargarTabla(endpoint, tablaId) { if (estadoTurno == 1) { td2.className = `border blink-yellow align-middle ${sizeClass}`; } else { - td2.className = `border bg-[#0a6eb2] align-middle ${sizeClass}`; + td2.className = `border align-middle ${sizeClass}`; + td2.style.backgroundColor = window.themeColors.bg2; } } else { td2.textContent = fila[2]; @@ -77,7 +79,9 @@ function cargarFooter() { function actualizarTablas(){ cargarTabla("/api/datos1","turnos1"); - cargarTabla("/api/datos2","turnos2"); + if (document.getElementById("turnos2")){ + cargarTabla("/api/datos2","turnos2"); + } } cargarFooter(); diff --git a/static/media/CSM-HD.mp4 b/static/media/csm.mp4 similarity index 100% rename from static/media/CSM-HD.mp4 rename to static/media/csm.mp4 diff --git a/static/media/imq.mp4 b/static/media/imq.mp4 new file mode 100644 index 0000000..b45b660 Binary files /dev/null and b/static/media/imq.mp4 differ diff --git a/static/media/imq.svg b/static/media/imq.svg new file mode 100644 index 0000000..340f994 --- /dev/null +++ b/static/media/imq.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/index.html b/templates/index.html index 7a99c41..0d88845 100644 --- a/templates/index.html +++ b/templates/index.html @@ -2,6 +2,9 @@ + @@ -9,46 +12,61 @@
- -
- - - - - - - - - -
CONSULTATURNO
-
-
- - - - - - - - - -
CONSULTATURNO
-
+ {% if mode == '2' %} +
+ + + + + + + + + +
CONSULTATURNO
+
+
+ + + + + + + + + +
CONSULTATURNO
+
+ {% else %} +
+ +
+
+ + + + + + + + + +
CONSULTATURNO
+
+ {% endif %}
-