diff --git a/src/app.js b/src/app.js index 51df2be..2d9e7c5 100644 --- a/src/app.js +++ b/src/app.js @@ -15,6 +15,7 @@ const clientesRutas = require('./rutas/rt_clientes'); const productosRutas = require('./rutas/rt_items'); const generalesRutas = require('./rutas/rt_Generales'); const cloud_rutas = require('./rutas/rt_cloud'); +const app_restaurant = require('./rutas/rt_apps'); //configuraciones app.set('port',process.env.PORT||puerto); @@ -49,6 +50,7 @@ app.use('/', clientesRutas); app.use('/', productosRutas); app.use('/', generalesRutas); app.use('/', cloud_rutas); +app.use('/', app_restaurant); //prueba de json directa app.get('/pruebaJson',function(req,res){ diff --git a/src/config.js b/src/config.js index 1b7cea2..8ea87e0 100644 --- a/src/config.js +++ b/src/config.js @@ -5,6 +5,7 @@ const config = { user: 'admin', pswd: 'Dx.1706%', db_a: 'TELCOTRONICS', + //db_a: 'facturacion', debg: false, sock: '/' }, diff --git a/src/controladores/controlador_Apps.js b/src/controladores/controlador_Apps.js new file mode 100644 index 0000000..aab6308 --- /dev/null +++ b/src/controladores/controlador_Apps.js @@ -0,0 +1,27 @@ +const controlador = {}; + +controlador.app_restaurant = (req, res) => { + res.render('app_restaurant'); +}; +controlador.dashboard = (req, res) => { + res.render('modulos/dashboard'); + //let html = res.attachment([dash_board]); + //res.send({"data":html}); + //res.send('dash_board'); +}; +controlador.user = (req, res) => { + console.log(req.body); + req.getConnection((err, conn) => { + conn.query(`SELECT cod_usr,nombre,apellido,n_sesion,rol FROM usuarios where form_init = 'RESTAURANT' or ROL='admin'`, (err, rows) => { + if (err) { + res.json(err); + next(err); + } else { + var Origen = { usuarios: rows }; + res.json(Origen); + } + }); + }); +} + +module.exports = controlador; \ No newline at end of file diff --git a/src/controladores/controlador_General.js b/src/controladores/controlador_General.js index 3c04e56..2605d84 100644 --- a/src/controladores/controlador_General.js +++ b/src/controladores/controlador_General.js @@ -60,9 +60,7 @@ function stringTo_md5(data_string) { controlador.login_test = (req, res) => { res.render('login_test'); }; -controlador.dash = (req, res) => { - res.render('admin_dash'); -}; + //********* FORM APP-PEDIDOS-SIGMA ********// controlador.app_sigma = (req, res) => { res.render('app_pedidos'); @@ -73,7 +71,7 @@ controlador.app_PEDIDOS = (req, res) => { const consulta = req.query.origen; console.log("Consulta: " + req.query); req.getConnection((err, conn) => { - conn.query(`SELECT * FROM ver_pedidos WHERE PedUsoPrdct_origen like ?`, [consulta], (err, rows) => { + conn.query(`SELECT * FROM ver_pedidos WHERE PedUsoPrdct_origen like ? order by PedUsoPrdct_id desc`, [consulta], (err, rows) => { //conn.query(`SELECT * FROM ver_pedidos `,(err,rows)=>{ if (err) { res.json(err); @@ -125,7 +123,7 @@ controlador.recibe_pedidos = async (req, res) => { PedUsoPrdct_Num: "1", PedUsoPrdct_idClient: json.clienteId, PedUsoPrdct_reg: reg_DB(), - PedUsoPrdct_estado: json.plataforma, + PedUsoPrdct_estado: json.estado, PedUsoPrdct_plataforma: json.plataforma, PedUsoPrdct_usuario: json.user, PedUsoPrdct_valor: json.valor, @@ -206,4 +204,6 @@ function reg_DB() { return fecha; } + + module.exports = controlador; diff --git a/src/public/css/restaurant.css b/src/public/css/restaurant.css index 5dcea23..13b701f 100644 --- a/src/public/css/restaurant.css +++ b/src/public/css/restaurant.css @@ -162,6 +162,7 @@ body { position: absolute; left: 15px; top: 4px; + color: #999; } .user{ position: relative; @@ -358,6 +359,19 @@ body { } /**** MODO RESPONSIVO *****/ +@media(max-width:1400px){ + .detalles .card_table { + position: relative; + padding: 20px; + padding-top: 10px; + display: grid; + min-width: auto; + background: #1F497D; + } + .card_table{ + min-width: none; + } +} @media(max-width:992px){ .navigation{ left: -250px; diff --git a/src/public/css/restaurant_form.css b/src/public/css/restaurant_form.css new file mode 100644 index 0000000..61fcee4 --- /dev/null +++ b/src/public/css/restaurant_form.css @@ -0,0 +1,112 @@ +/********* TABLAS *********/ +.panel_header{ + display: flex; + justify-content: space-between; + align-items: flex-start; +} +.panel_header .h2{ + font-weight: 600; +} +.panel_header input{ + position: relative; + padding: 5px; + background: rgba(10, 10, 10, 0.45); + text-decoration: none; + border-radius: 6px; +} + +.panel_table table{ + width: 100%; + border-collapse: collapse; + margin-top: 10px; + overflow: auto; +} +.panel_table table thead td{ + font-weight: 600; + background:rgba(10, 10, 10, 0.2) +} +.panel_table table tr{ + border-bottom: 1px solid rgba(255, 255, 255, 0.3); +} + +.panel_table table tr:last-child{ + border-bottom: none; +} +.panel_table table tr:hover{ + background: rgba(76, 144, 247, 0.5); + color:rgba(10, 10, 10, 0.45); + cursor: pointer; +} +.panel_table table tr td{ + padding: 9px 5px; +} +.panel_table table tr td:nth-child(2),.panel_table table tr td:nth-child(2){ + text-align: center; + padding-right: 20px; +} +.panel_table table tr td:nth-child(3),.panel_table table tr td:nth-child(3){ + text-align: left; + padding-right: 20px; +} +.panel_table table tr td:nth-child(5),.panel_table table tr td:nth-child(5){ + text-align: right; + padding-right: 20px; +} +.panel_table table tr td:last-child,.panel_table table tr td:last-child{ + text-align: center; +} + +/********* ESTADOS *********/ +.estado { + position: relative; + padding: 2px 2px; + border-radius: 3px; + font-size: 14px; + font-weight: 300; + letter-spacing: 1px; +} +.ACTIVO{ + margin: auto; + background: #00A65A; + color: white; +} +.pendiente{ + margin: auto; + background: #F39C12; + color: white; +} +.PROCESANDO{ + margin: auto; + background: #F39C12; + color: white; +} +.FACTURADO{ + margin: auto; + background: #3C8DBC; + color: white; +} +.error{ + margin: auto; + background: #DF5645; + color: white; +} + +@media(max-width:768px){ + .panel_table table{ + width: 100%; + border-collapse: collapse; + margin-top: 10px; + overflow: auto; + font-size: 9px; + } + .estado{ + font-size: 10px; + padding: auto; + } + .panel_table table tr td { + padding: 4px 2px; + } + .panel_header .h2{ + font-size: 0.5em; + } +} \ No newline at end of file diff --git a/src/public/img/video_promoSigmaRestaurant.mp4 b/src/public/img/video_promoSigmaRestaurant.mp4 new file mode 100644 index 0000000..ddb0fdc Binary files /dev/null and b/src/public/img/video_promoSigmaRestaurant.mp4 differ diff --git a/src/public/js/app_restaurant.js b/src/public/js/app_restaurant.js new file mode 100644 index 0000000..16decdc --- /dev/null +++ b/src/public/js/app_restaurant.js @@ -0,0 +1,93 @@ +async function ver_usuarios(){ + let user = await get_json("/usuarios"); + console.log(user); +} + +async function mostrar_form(form_aRender){ + console.log(form_aRender); + switch(form_aRender){ + case 'clientes': + let cli = await get_html("/verClientesJsonApp"); + await console.log(cli); + break; + case 'pedidos': + let pedidos = await get_json("/consultaPedidos?origen=%"); + var thead = "IDNombreFechaOrigenValorEstado"; + let tabla = await generaTab_html(pedidos.ConsultaPedidos,thead); + await render(tabla); + //await console.log(pedidos.ConsultaPedidos); + break; + case 'usuarios': + let user = await get_json("/users"); + console.log(user); + break; + case 'dashboard': + let dash = await get_html("/dash_board"); + console.log(dash); + break; + } +} + +async function get_json(url) { + var data; + await fetch(url, { + method: 'GET', + headers: { + "Content-Type": "application/json", + }, + }) + .then(res => res.json()) + .then(res => { + data = res; + return res; + }) + .catch(err => console.log('Solicitud fallida', err)); // Capturar errores; + return data; +} +async function get_html(url) { + await fetch(url, { + method: 'GET', + headers: { + "Content-Type": "application/json", + }, + }) + .then(res => { + console.log(res); + render(res); + //return res; + }) + .catch( + err => console.log('Solicitud fallida', err) + ); // Capturar errores; +} + +async function render(dat_html) { + let contenedor = document.getElementById('contenido'); + contenedor.innerHTML = dat_html; +} + +async function generaTab_html(json,heder_tab){ + var tab = ` +
+
+

Ordenes Recientes

+ +
+ ${heder_tab}`; + for (let key in json) { + let valor = json[key].PedUsoPrdct_valor; + let fecha = json[key].PedUsoPrdct_reg; + let fila = ` + + + + + + + `; + tab = tab+fila; + } + tab = tab+"
${json[key].PedUsoPrdct_id}${json[key].client_nombre}${fecha.substr(0, 10)}${json[key].PedUsoPrdct_origen} ${valor.toFixed(2)}${json[key].PedUsoPrdct_estado}
"; + //console.log(json); + return tab; +} \ No newline at end of file diff --git a/src/rutas/rt_Generales.js b/src/rutas/rt_Generales.js index dde7c82..ecef1ca 100644 --- a/src/rutas/rt_Generales.js +++ b/src/rutas/rt_Generales.js @@ -15,6 +15,6 @@ rutas.get('/recepcionPedidos', controlador_init.recibe_pedidos);//receptar pedid rutas.get('/', controlador_init.app_login);//FORM LOGIN DE LA APP rutas.post('/login', controlador_init.auth);//Authenticacion de APP rutas.get('/login_test', controlador_init.login_test);//login testing css / dev -rutas.get('/admin_dash', controlador_init.dash);//login testing css / dev + module.exports = rutas; diff --git a/src/rutas/rt_apps b/src/rutas/rt_apps new file mode 100644 index 0000000..5a713ab --- /dev/null +++ b/src/rutas/rt_apps @@ -0,0 +1,9 @@ +const express = require('express'); +const rutas = express.Router(); + +const controlador_init = require('../controladores/controlador_Apps'); +rutas.get('/app_restaurant', controlador_init.app_restaurant);//login testing css / dev +//rutas.get('/usuarios', controlador_init.user);// +rutas.get('/dash_board', controlador_init.dashboard);// +rutas.get('/users', controlador_init.user);//devuelve usuaios con el el ROL meseros +module.exports = rutas; \ No newline at end of file diff --git a/src/views/admin_dash.ejs b/src/views/admin_dash.ejs deleted file mode 100644 index 9ee478f..0000000 --- a/src/views/admin_dash.ejs +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - - SIGMA Restaurante - - - - - - - - -
- -
-
-
- -
-
- -
-
- usr -
-
-
- - -
-
-
125.33
-
Pedidos
- -
-
- -
-
-
-
-
125.33
-
Compras Ingresadas
- -
-
- -
-
-
-
-
125.33
-
Ventas Emitidas
- -
-
- - -
-
-
-
-
125.33
-
Vistas Diarias
- -
-
- -
-
-
- -
-
-
-

Ordenes Recientes

- Ver Todas -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IDNombreValorMetodo PagoEstado
1Diego Farias150.66TranferenciaENVIADO
2Paul Fernando12.36EFECTIVORECIBIDO
3Pablo Xavier Farias2.36CONTRA ENTREGAPROCESANDO
3Pepito la Lora0.0CANCELADOERROR
-
-
-
-

Consumos Recientes

- Ver Todas -
- - - - - - - - - - - - - - - - - - - -
-
- item -
-

Hamburgesa
Doble

-
- item -
-

Pizza
Americana

-
- item -
-

Alitas BBQ
Salsas BBQ y Brandy

-
- item -
-

Pulpo
a la Parrilla

-
-
-
-
- - - - \ No newline at end of file diff --git a/src/views/app_restaurant.ejs b/src/views/app_restaurant.ejs new file mode 100644 index 0000000..0058a6d --- /dev/null +++ b/src/views/app_restaurant.ejs @@ -0,0 +1,132 @@ + + + + + + + + SIGMA Restaurante + + + + + + + + + +
+ +
+
+
+ +
+
+ +
+
+ usr +
+
+ +
+ <%- include("modulos/dashboard") %> +
+
+
+ + + + + \ No newline at end of file diff --git a/src/views/modulos/dashboard.ejs b/src/views/modulos/dashboard.ejs new file mode 100644 index 0000000..929c096 --- /dev/null +++ b/src/views/modulos/dashboard.ejs @@ -0,0 +1,143 @@ +
+
+
+
125.33
+
Pedidos
+ +
+
+ +
+
+
+
+
125.33
+
Compras Ingresadas
+ +
+
+ +
+
+
+
+
125.33
+
Ventas Emitidas
+ +
+
+ + +
+
+
+
+
125.33
+
Vistas Diarias
+ +
+
+ +
+
+
+ +
+
+
+

Ordenes Recientes

+ Ver Todas +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IDNombreValorMetodo PagoEstado
1Diego Farias150.66TranferenciaENVIADO
2Paul Fernando12.36EFECTIVORECIBIDO
3Pablo Xavier Farias2.36CONTRA ENTREGAPROCESANDO
3Pepito la Lora0.0CANCELADOERROR
+
+
+
+

Consumos Recientes

+ Ver Todas +
+ + + + + + + + + + + + + + + + + + + +
+
+ item +
+
+

Hamburgesa
Doble

+
+
+ item +
+
+

Pizza
Americana

+
+
+ item +
+
+

Alitas BBQ
Salsas BBQ y Brandy

+
+
+ item +
+
+

Pulpo
a la Parrilla

+
+
+
\ No newline at end of file