From 66247337562ca984244d54e2cc5a171a8490ba21 Mon Sep 17 00:00:00 2001 From: Shiro-Nek0 Date: Thu, 19 Mar 2026 22:58:34 -0300 Subject: [PATCH] refactor + macro fixes + theme system --- .vscode/launch.json | 11 ++++ .vscode/settings.json | 3 ++ .vscode/tasks.json | 15 ++++++ Dockerfile | 2 +- README.md | 55 ++++++++++++++++++++ app.py | 2 +- db/.gitignore | 2 + rendiciones.db | Bin 40960 -> 0 bytes requirements.txt | 2 +- static/cache/.gitignore | 2 + static/cookieStuff.js | 17 ++++++ static/favicon.png | Bin 0 -> 41758 bytes static/themeStuff.js | 39 ++++++++++++++ templates/admin_productos.html | 11 +++- templates/admin_rendicion_detail.html | 9 +++- templates/admin_rendiciones.html | 10 +++- templates/admin_structure.html | 10 +++- templates/admin_workers.html | 10 +++- templates/base.html | 19 ------- templates/edit_producto.html | 10 +++- templates/edit_worker.html | 11 +++- templates/login.html | 71 +++++++++++++++----------- templates/macros/base.html | 27 ++++++++++ templates/{ => macros}/navbar.html | 26 +++++++--- templates/worker_dashboard.html | 10 +++- 25 files changed, 308 insertions(+), 66 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json create mode 100644 db/.gitignore delete mode 100644 rendiciones.db create mode 100644 static/cache/.gitignore create mode 100644 static/cookieStuff.js create mode 100644 static/favicon.png create mode 100644 static/themeStuff.js delete mode 100644 templates/base.html create mode 100644 templates/macros/base.html rename templates/{ => macros}/navbar.html (59%) diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..d4c60e8 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Build rendiciones (F5)", + "type": "node", + "request": "launch", + "preLaunchTask": "build-rendiciones" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a456028 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python-envs.defaultEnvManager": "ms-python.python:pyenv" +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..e16d934 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,15 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build-rendiciones", + "type": "shell", + "command": "docker build -t rendiciones:latest .", + "group": "build", + "presentation": { + "reveal": "always", + "panel": "new" + } + } + ] +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index a9e8955..f1f31d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN pip install --no-cache-dir -r requirements.txt # Copy source code COPY app.py . COPY templates/ ./templates/ -#COPY static/ ./static/ +COPY static/ ./static/ #COPY .env . # Create the folder structure for the volume mounts diff --git a/README.md b/README.md index 0279c19..7d51a13 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,57 @@ # Rendiciones-App +## 馃惓 Docker Deployment (Server) + +Build and run the central inventory server: + +```bash +# Build the image +docker build -t rendiciones:latest . + +# Run the container (Map port 5000 and persist the database/cache) +docker run -d \ + -p 5000:5000 \ + -v $(pwd)/rendiciones/db:/app/db \ + -v $(pwd)/rendiciones/static/cache:/app/static/cache \ + --name rendiciones-server \ + --restart unless-stopped \ + rendiciones:latest +``` + +Or use this stack: +```yml +name: rendiciones +services: + rendiciones: + ports: + - 5000:5000 + volumes: + - YOUR_PATH/rendiciones/db:/app/db + - YOUR_PATH/serendicionesipos/static/cache:/app/static/cache + container_name: rendiciones-server + image: rendiciones:latest + restart: unless-stopped +``` + +# TODO general: +- separar productos para tiendas +- limpiar requirements.txt +- hacer prompts mas bonitos y estandar + +# TODO peppermint: +## formulario +- a帽adir total ventas (todos los medios de pago) +- total tarjetas + mp +- cantidad de boletas por metodod de pago +- a帽adir segunda persona a cargo +- verificar que todos los campos esten rellenos +- separar credito y debito +- permitir subir foto de total gastos (boleta/factura) +## otros +- bloquear turno para otra persona si ya fue subido por otra persona +- part time hora entrada y salida sin comisiones +- ocaciones especiales permiten comisiones (en panel admin) + +# TODO happy candy: +- total vendido +- comision 2% \ No newline at end of file diff --git a/app.py b/app.py index deac336..f0a0223 100644 --- a/app.py +++ b/app.py @@ -9,7 +9,7 @@ from datetime import date app = Flask(__name__) app.secret_key = "super_secret_dev_key" -DB_NAME = "rendiciones.db" +DB_NAME = "db/rendiciones.db" # --- Database & Helpers --- diff --git a/db/.gitignore b/db/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/db/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/rendiciones.db b/rendiciones.db deleted file mode 100644 index c2191dfd97f00de3bd27a5b1e578bbdabda330cc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 40960 zcmeI5U2Gd!6@cf*aqKkqttf0BqLSMtg+|##^Z(P`m2gwHb?Z8*<8)hIqB}Ep8n=m^ z`ls8Lr*sz(6+(yyUJwW#ctyJpJnRD!(yD47K=85>5+H$)5JjsMpp}3X51bi0v7K#` zP_0+_k;xw!`)>(_{!a+e4g)dMl2!aBy5qNE-BxDj> z0&K;;{FAbZFn90M8S)Pyom2(#D*1W#&zZlBes|=-Xf5?B6k$RFNB{{Sf&Ui*Z>7@1 zV>2`2SI@MVx5gX17F7Ley|x0Ek@e;dab&)n&sFlYk~>+<)18%cXF6UDXrWZepUIc$ zV!3c3SH42e=daM*a%G`V0$msKrOL}AJG;?-%{>jJg$gY#7mJVUu+gXoZNF7t>D%LO z?R{2jRRgwP4kE>aHbSvI^G93n5O0Y z>3lg~n$Iuw`0yq$o_-vW0Y!ay2J~!|$6BVpoJtLkO-_nmdwnnzcrOfiGyV7w;LT6E z@u}VaM!j*JH}>nxb#VRKzC9muf0fZwQ55gyzE-fd4 zKKpEEk^`RIE`El-y;HBT{hnC%>07uYa5y>Vio2dE{Q5dv5TYx>-fagCx9*4sd=Qm& z4wTI|67hlZW&)tvCbHB{3Z?bkBgom#a@{0INwZ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gqhpK$iAHaq2(^awx@+p^ zF4}9s+GUeBrnq9N7BlQX1J?slO%DwKs`(J8cA!9LSthe=&GGb5ahMuHm?*wy+G@xw z-?!DkH53y@tN9S~p~?V`9R!{Q_A!W2RSyI3mK~T*=qR>ss;281Oj9h+aKN@`{l5fx zAdr8O2jo}e(K9(1Q3(=20!RP}AOR$R1dsp{Kmter2_OL^@H_|{l#dPE_DVzr{dbP! zXdS@5J1N*$x{yX6Z9|-@_KY!4q8@ySk0bipYd+(k4 zq!@QTmV%TS=-hyg4O(e8YV~OTpCmsN$lu5x$ou3z`7sEXkN^@u0!RP}AOR$R1dsp{ zKmter2_S+0K7nj<7;XcIu<(E+MGy05hqmN|6fFvnO>D_>;sh)LFe(oVX)!HHL(#GV S87Y#Wcc<~F*sYYKrvC; +{% endblock %} + + {% block content %}

Cat谩logo de Productos por Zona

diff --git a/templates/admin_rendicion_detail.html b/templates/admin_rendicion_detail.html index 0e2b010..b7dbe4d 100644 --- a/templates/admin_rendicion_detail.html +++ b/templates/admin_rendicion_detail.html @@ -1,4 +1,11 @@ -{% extends "base.html" %} +{% extends "macros/base.html" %} + + +{% block title %}Detalle de Rendici贸n{% endblock %} + +{% block head %} + +{% endblock %} {% block content %}
diff --git a/templates/admin_rendiciones.html b/templates/admin_rendiciones.html index b39f122..8fe7155 100644 --- a/templates/admin_rendiciones.html +++ b/templates/admin_rendiciones.html @@ -1,4 +1,12 @@ -{% extends "base.html" %} +{% extends "macros/base.html" %} + + +{% block title %}Historial de Rendiciones{% endblock %} + +{% block head %} + +{% endblock %} + {% block content %}

Historial de Rendiciones

diff --git a/templates/admin_structure.html b/templates/admin_structure.html index 58413c1..77c518a 100644 --- a/templates/admin_structure.html +++ b/templates/admin_structure.html @@ -1,4 +1,12 @@ -{% extends "base.html" %} +{% extends "macros/base.html" %} + + +{% block title %}Estructura Operativa{% endblock %} + +{% block head %} + +{% endblock %} + {% block content %}

Estructura Operativa

diff --git a/templates/admin_workers.html b/templates/admin_workers.html index 2e51745..c3465ba 100644 --- a/templates/admin_workers.html +++ b/templates/admin_workers.html @@ -1,4 +1,12 @@ -{% extends "base.html" %} +{% extends "macros/base.html" %} + + +{% block title %}Gesti贸n de Trabajadores{% endblock %} + +{% block head %} + +{% endblock %} + {% block content %}

Gesti贸n de Trabajadores

diff --git a/templates/base.html b/templates/base.html deleted file mode 100644 index 654e9bc..0000000 --- a/templates/base.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - Sistema de Rendiciones - - - - - {% include 'navbar.html' %} - -
- {% block content %}{% endblock %} -
- - - - \ No newline at end of file diff --git a/templates/edit_producto.html b/templates/edit_producto.html index 68c8eae..7f72cd9 100644 --- a/templates/edit_producto.html +++ b/templates/edit_producto.html @@ -1,4 +1,12 @@ -{% extends "base.html" %} +{% extends "macros/base.html" %} + + +{% block title %}Editar Producto{% endblock %} + +{% block head %} + +{% endblock %} + {% block content %}
diff --git a/templates/edit_worker.html b/templates/edit_worker.html index 9160f64..f557844 100644 --- a/templates/edit_worker.html +++ b/templates/edit_worker.html @@ -1,4 +1,13 @@ -{% extends "base.html" %} +{% extends "macros/base.html" %} + + +{% block title %}Editar Trabajador{% endblock %} + +{% block head %} + +{% endblock %} + + {% block content %}
diff --git a/templates/login.html b/templates/login.html index 2998012..8309304 100644 --- a/templates/login.html +++ b/templates/login.html @@ -1,37 +1,48 @@ -{% extends "base.html" %} -{% block content %} -
-
-
-
-

Iniciar Sesi贸n

-
-
- {% with messages = get_flashed_messages(with_categories=true) %} - {% if messages %} - {% for category, message in messages %} -
{{ message|safe }}
- {% endfor %} - {% endif %} - {% endwith %} +{% extends "macros/base.html" %} -
-
- - -
-
- - -
- -
+{% block title %}Inicio de sesi贸n{% endblock %} + +{% block content %} +
+
+
+
+

Iniciar Sesi贸n

+
+
+ {% with messages = get_flashed_messages(with_categories=true) %} + {% if messages %} + {% for category, message in messages %} +
{{ message|safe }}
+ {% endfor %} + {% endif %} + {% endwith %} + +
+
+ + +
+
+ + +
+ +
+
-
+{% endblock %} - + {% endblock %} \ No newline at end of file diff --git a/templates/macros/base.html b/templates/macros/base.html new file mode 100644 index 0000000..9a2a42c --- /dev/null +++ b/templates/macros/base.html @@ -0,0 +1,27 @@ + + + + + + Sistema de Rendiciones - {% block title %}{% endblock %} + + + + + + + {% if session.get('user_id') %} + {% include 'macros/navbar.html' %} + {% endif %} + +
+ {% block content %}{% endblock %} +
+ + + + + + {% block scripts %}{% endblock %} + + \ No newline at end of file diff --git a/templates/navbar.html b/templates/macros/navbar.html similarity index 59% rename from templates/navbar.html rename to templates/macros/navbar.html index d057089..f649b7a 100644 --- a/templates/navbar.html +++ b/templates/macros/navbar.html @@ -1,4 +1,4 @@ -