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 c2191df..0000000 Binary files a/rendiciones.db and /dev/null differ diff --git a/requirements.txt b/requirements.txt index 382316f..4aac71c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,4 @@ Flask-Login==0.6.3 Flask-SocketIO==5.6.1 requests==2.32.5 eventlet==0.36.1 -python-dotenv==1.2.2 \ No newline at end of file +python-dotenv==1.2.2 diff --git a/static/cache/.gitignore b/static/cache/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/static/cache/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/static/cookieStuff.js b/static/cookieStuff.js new file mode 100644 index 0000000..fba1cb0 --- /dev/null +++ b/static/cookieStuff.js @@ -0,0 +1,17 @@ +function setCookie(name, value, days = 365) { + const d = new Date(); + d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000)); + let expires = "expires=" + d.toUTCString(); + document.cookie = name + "=" + value + ";" + expires + ";path=/;SameSite=Lax"; +} + +function getCookie(name) { + let nameEQ = name + "="; + let ca = document.cookie.split(';'); + for (let i = 0; i < ca.length; i++) { + let c = ca[i]; + while (c.charAt(0) == ' ') c = c.substring(1, c.length); + if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); + } + return null; +} \ No newline at end of file diff --git a/static/favicon.png b/static/favicon.png new file mode 100644 index 0000000..9db2d74 Binary files /dev/null and b/static/favicon.png differ diff --git a/static/themeStuff.js b/static/themeStuff.js new file mode 100644 index 0000000..3c408b7 --- /dev/null +++ b/static/themeStuff.js @@ -0,0 +1,39 @@ +function applyTheme(t) { + document.documentElement.setAttribute('data-bs-theme', t); + localStorage.setItem('theme', t); + + const isDark = (t === 'dark'); + const themeIcon = document.getElementById('theme-icon'); + const themeLabel = document.getElementById('theme-label'); + + if (themeIcon) { + themeIcon.className = isDark ? 'bi bi-sun me-2' : 'bi bi-moon-stars me-2'; + } + if (themeLabel) { + themeLabel.innerText = isDark ? 'Modo Claro' : 'Modo Oscuro'; + } +} + +function toggleTheme() { + const current = document.documentElement.getAttribute('data-bs-theme'); + applyTheme(current === 'dark' ? 'light' : 'dark'); +} + +function initTheme() { + const savedTheme = localStorage.getItem('theme'); + if (savedTheme) { + applyTheme(savedTheme); + } else { + const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches; + applyTheme(prefersDark ? 'dark' : 'light'); + } +} + +// Listen for system theme changes only if the user hasn't set a manual override +window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + if (!localStorage.getItem('theme')) { + applyTheme(e.matches ? 'dark' : 'light'); + } +}); + +initTheme(); \ No newline at end of file diff --git a/templates/admin_productos.html b/templates/admin_productos.html index 0a82f6b..4eaadfb 100644 --- a/templates/admin_productos.html +++ b/templates/admin_productos.html @@ -1,4 +1,13 @@ -{% extends "base.html" %} +{% extends "macros/base.html" %} + + +{% block title %}Cat谩logo de Productos{% endblock %} + +{% block head %} + +{% endblock %} + + {% block content %}