├── favicon.ico
├── .firebaserc
├── client
├── assets
│ ├── 404.png
│ ├── home.png
│ ├── login.png
│ ├── LogoTelnovo.png
│ ├── background.png
│ ├── formulario.png
│ ├── homecliente.png
│ ├── sweetAlert.js
│ └── imagenPDF.js
├── store.js
├── models
│ ├── VentaProducto.js
│ ├── Usuario.js
│ ├── Compra.js
│ ├── Venta.js
│ ├── Reparacion.js
│ ├── PresupuestoProducto.js
│ ├── CompraProducto.js
│ ├── Arreglo.js
│ ├── Presupuesto.js
│ ├── Producto.js
│ ├── Proveedor.js
│ └── Cliente.js
├── firebase.js
├── components
│ ├── Administrar
│ │ ├── Home.vue
│ │ ├── error404.vue
│ │ └── Login.vue
│ ├── Cliente
│ │ ├── NuevoCliente.vue
│ │ └── Tabla.vue
│ ├── Compra
│ │ ├── Torta.vue
│ │ ├── Estadistica.vue
│ │ └── EditarCompra.vue
│ ├── Usuario
│ │ ├── HomeUsuario.vue
│ │ ├── NuevoUsuario.vue
│ │ └── EditarUsuario.vue
│ ├── Venta
│ │ └── EditarVenta.vue
│ ├── Reparacion
│ │ ├── EditarReparacion.vue
│ │ └── HomeReparacion.vue
│ ├── Presupuesto
│ │ ├── HomePresupuesto.vue
│ │ └── VerPresupuesto.vue
│ └── Arreglo
│ │ ├── NuevoArreglo.vue
│ │ └── HomeArreglo.vue
├── main.js
├── routes.js
└── App.vue
├── .babelrc
├── .gitignore
├── .editorconfig
├── server
├── routes
│ ├── mail.js
│ ├── ventaProducto.js
│ ├── compraProducto.js
│ ├── presupuestoProducto.js
│ ├── reparacion.js
│ ├── administrar.js
│ ├── cliente.js
│ ├── arreglo.js
│ ├── presupuesto.js
│ ├── producto.js
│ ├── compra.js
│ ├── venta.js
│ └── proveedor.js
├── database.js
├── controller
│ ├── mail.js
│ ├── ventaProducto.js
│ ├── compraProducto.js
│ ├── presupuestoProducto.js
│ ├── adminSDK.json
│ ├── reparacion.js
│ ├── proveedor.js
│ ├── arreglo.js
│ ├── admin.js
│ ├── presupuesto.js
│ ├── cliente.js
│ ├── compra.js
│ ├── venta.js
│ └── producto.js
├── bin
│ └── www
└── app.js
├── debug.log
├── .firebase
└── hosting.ZGlzdA.cache
├── index.html
├── README.md
├── webpack.config.js
└── package.json
/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bonato12/stack-PEVN/HEAD/favicon.ico
--------------------------------------------------------------------------------
/.firebaserc:
--------------------------------------------------------------------------------
1 | {
2 | "projects": {
3 | "default": "ionic-3e984"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/client/assets/404.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bonato12/stack-PEVN/HEAD/client/assets/404.png
--------------------------------------------------------------------------------
/client/assets/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bonato12/stack-PEVN/HEAD/client/assets/home.png
--------------------------------------------------------------------------------
/client/assets/login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bonato12/stack-PEVN/HEAD/client/assets/login.png
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", { "modules": false }],
4 | "stage-3"
5 | ]
6 | }
7 |
--------------------------------------------------------------------------------
/client/assets/LogoTelnovo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bonato12/stack-PEVN/HEAD/client/assets/LogoTelnovo.png
--------------------------------------------------------------------------------
/client/assets/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bonato12/stack-PEVN/HEAD/client/assets/background.png
--------------------------------------------------------------------------------
/client/assets/formulario.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bonato12/stack-PEVN/HEAD/client/assets/formulario.png
--------------------------------------------------------------------------------
/client/assets/homecliente.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bonato12/stack-PEVN/HEAD/client/assets/homecliente.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | dist/
4 | npm-debug.log
5 | yarn-error.log
6 |
7 | # Editor directories and files
8 | .idea
9 | *.suo
10 | *.ntvs*
11 | *.njsproj
12 | *.sln
13 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/client/store.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 |
4 | Vue.use(Vuex);
5 |
6 | export const store = new Vuex.Store ({
7 | state:{
8 | auth: false
9 | },
10 | mutations:{
11 | cambiar: (state) => state.auth = !state.auth,
12 | }
13 | });
14 |
--------------------------------------------------------------------------------
/client/models/VentaProducto.js:
--------------------------------------------------------------------------------
1 | export default class VentaProducto{
2 | constructor(id,venta,producto,cantidad,precio){
3 | this.id = -1,
4 | this.venta = venta,
5 | this.producto = producto,
6 | this.cantidad = cantidad,
7 | this.precio = precio
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/client/models/Usuario.js:
--------------------------------------------------------------------------------
1 | export default class Usuario {
2 | constructor(id_usuario,uid,mail,password,rol){
3 | this.id_usuario = id_usuario,
4 | this.uid = uid,
5 | this.mail = mail,
6 | this.password = password,
7 | this.rol = rol
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/client/models/Compra.js:
--------------------------------------------------------------------------------
1 | export default class Compra{
2 | constructor(id_compra,proveedor,fecha,total){
3 | this.id_compra = id_compra,
4 | this.proveedor = proveedor,
5 | this.fecha = new Date().getDate()+'/'+(new Date().getMonth()+1)+'/'+new Date().getFullYear(),
6 | this.total = total
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/client/models/Venta.js:
--------------------------------------------------------------------------------
1 | export default class Venta{
2 | constructor(id_venta,cliente,fecha,total){
3 | this.id_venta = id_venta,
4 | this.cliente = cliente,
5 | this.fecha = new Date().getDate()+'/'+(new Date().getMonth()+1)+'/'+new Date().getFullYear(),
6 | this.total = total
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/client/models/Reparacion.js:
--------------------------------------------------------------------------------
1 | export default class Reparacion {
2 | constructor(id_reparacion,fecha_ini,fecha_fin,id_presupuesto){
3 | this.id_reparacion = id_reparacion,
4 | this.fecha_ini = fecha_ini,
5 | this.fecha_fin = fecha_fin,
6 | this.id_presupuesto = id_presupuesto
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/client/models/PresupuestoProducto.js:
--------------------------------------------------------------------------------
1 | export default class PresupuestoProducto{
2 | constructor(id,presupuesto,producto,cantidad,precio){
3 | this.id = -1,
4 | this.presupuesto = presupuesto,
5 | this.producto = producto,
6 | this.cantidad = cantidad,
7 | this.precio = precio
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/server/routes/mail.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | const cors = require('cors');
5 | const mailController = require('../controller/mail');
6 |
7 | router.post('/email', mailController.enviarMail);
8 |
9 |
10 | app.use(cors());
11 |
12 |
13 | module.exports = router;
14 |
--------------------------------------------------------------------------------
/client/models/CompraProducto.js:
--------------------------------------------------------------------------------
1 | export default class CompraProducto{
2 | constructor(id,compra,producto,cantidad,precioUnitario,precioTotal){
3 | this.id = -1,
4 | this.compra = compra,
5 | this.producto = producto,
6 | this.cantidad = cantidad,
7 | this.precioUnitario = precioUnitario,
8 | this.precioTotal = precioTotal
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/client/models/Arreglo.js:
--------------------------------------------------------------------------------
1 | export default class Arreglo{
2 | constructor(id_arreglo,cliente,producto,fecha,observacion,condicion){
3 | this.id_arreglo = id_arreglo,
4 | this.cliente = cliente,
5 | this.producto = producto,
6 | this.fecha = fecha,
7 | this.observacion = observacion,
8 | this.condicion = condicion
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/debug.log:
--------------------------------------------------------------------------------
1 | [0921/110553.711:ERROR:process_info.cc(359)] UncheckedAllocate
2 | [0921/112622.882:ERROR:process_info.cc(359)] UncheckedAllocate
3 | [0922/084105.357:ERROR:process_info.cc(359)] UncheckedAllocate
4 | [0922/084113.097:ERROR:process_info.cc(359)] UncheckedAllocate
5 | [1002/032000.860:ERROR:process_info.cc(359)] UncheckedAllocate
6 | [1003/184626.988:ERROR:process_info.cc(359)] UncheckedAllocate
7 |
--------------------------------------------------------------------------------
/client/models/Presupuesto.js:
--------------------------------------------------------------------------------
1 | export default class Presupuesto{
2 | constructor(id_presupuesto,arreglo,observacion,estado,precioManoObra,precioTotal){
3 | this.id_presupuesto = id_presupuesto,
4 | this.arreglo = arreglo,
5 | this.observacion = observacion,
6 | this.estado = estado,
7 | this.precioManoObra = precioManoObra,
8 | this.precioTotal = precioTotal
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/client/firebase.js:
--------------------------------------------------------------------------------
1 | import Firebase from 'firebase'
2 |
3 | var config = {
4 | apiKey: "AIzaSyDgYzb7QqHY1VvHEGOnetz_DT7ejV2Mq_c",
5 | authDomain: "ionic-3e984.firebaseapp.com",
6 | databaseURL: "https://ionic-3e984.firebaseio.com",
7 | projectId: "ionic-3e984",
8 | storageBucket: "ionic-3e984.appspot.com",
9 | messagingSenderId: "199930820105"
10 | };
11 |
12 | export const firebase = Firebase.initializeApp(config);
13 |
--------------------------------------------------------------------------------
/server/routes/ventaProducto.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | const cors = require('cors');
5 | const ventaController = require('../controller/ventaProducto');
6 |
7 | router.get('/ventaProducto', ventaController.getVentaProducto);
8 | router.get('/ventaProducto/:id_venta',ventaController.getIdVentaProducto);
9 |
10 |
11 | app.use(cors());
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/client/models/Producto.js:
--------------------------------------------------------------------------------
1 | export default class Producto {
2 | constructor(id_producto,modelo,marca,descripcion,tipoProducto,stock,precio){
3 | this.id_producto = id_producto,
4 | this.modelo = modelo,
5 | this.marca = marca,
6 | this.descripcion = descripcion,
7 | this.tipoProducto = tipoProducto,
8 | this.stock = stock,
9 | this.precio = precio
10 |
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/server/routes/compraProducto.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | const cors = require('cors');
5 | const compraController = require('../controller/compraProducto');
6 |
7 | router.get('/compraProducto', compraController.getCompraProducto);
8 | router.get('/compraProducto/:id_compra',compraController.getIdCompraProducto);
9 |
10 |
11 | app.use(cors());
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/server/database.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var pg = require('pg');
4 |
5 |
6 | config= {
7 | user: 'postgres',
8 | host: '127.0.0.1',
9 | database: 'Telnovo',
10 | password: '1234',
11 | port: 5432,
12 | }
13 |
14 |
15 |
16 | var pool = new pg.Pool(config);
17 | pool.query('SELECT NOW()', (err, res) => {
18 | console.log("Conexion Exitosa")
19 | pool.end()
20 | })
21 |
22 |
23 | module.exports = config ;
24 |
--------------------------------------------------------------------------------
/client/models/Proveedor.js:
--------------------------------------------------------------------------------
1 | export default class Proveedor {
2 | constructor(id_proveedor,dni,nombre,apellido,direccion,telefono,mail,descripcion){
3 | this.id_proveedor = id_proveedor,
4 | this.dni = dni,
5 | this.nombre = nombre,
6 | this.apellido = apellido,
7 | this.direccion = direccion,
8 | this.telefono = telefono,
9 | this.mail = mail,
10 | this.descripcion = descripcion
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/server/routes/presupuestoProducto.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | const cors = require('cors');
5 | const presupuestoProductoController = require('../controller/presupuestoProducto');
6 |
7 | router.get('/presupuestoProducto', presupuestoProductoController.getPresupuestoProducto);
8 | router.get('/presupuestoProducto/:id_presupuesto',presupuestoProductoController.getIdPresupuestoProducto);
9 |
10 |
11 | app.use(cors());
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/server/routes/reparacion.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | const reparacionController = require('../controller/reparacion');
5 |
6 | router.get('/reparacion', reparacionController.getReparacion);
7 | router.get('/reparacion/:id_reparacion', reparacionController.getIdReparacion);
8 | router.put('/reparacion/:id_reparacion', reparacionController.updateReparacion);
9 |
10 |
11 | const cors = require('cors');
12 | app.use(cors());
13 |
14 | module.exports = router;
15 |
--------------------------------------------------------------------------------
/server/routes/administrar.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | const adminController = require('../controller/admin');
5 |
6 | router.get('/usuario', adminController.getUsuario);
7 | router.get('/usuario/:uuid', adminController.getIdUsuario);
8 | router.post('/usuario',adminController.postUsuario);
9 | router.get('/usuario/:uuid', adminController.deleteUsuario);
10 |
11 |
12 | const cors = require('cors');
13 | app.use(cors());
14 |
15 |
16 | module.exports = router;
17 |
--------------------------------------------------------------------------------
/client/models/Cliente.js:
--------------------------------------------------------------------------------
1 | export default class Cliente {
2 | constructor(id_cliente,dni,nombre,apellido,direccion,telefono,mail){
3 | this.id_cliente = id_cliente,
4 | this.dni = dni,
5 | this.nombre = nombre,
6 | this.apellido = apellido,
7 | this.direccion = direccion,
8 | this.telefono = telefono,
9 | this.mail = mail
10 | }
11 |
12 | getDni() {
13 | return this.dni;
14 | }
15 |
16 | setDni(dni) {
17 | this.dni = dni; // validation could be checked here such as only allowing non numerical values
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/.firebase/hosting.ZGlzdA.cache:
--------------------------------------------------------------------------------
1 | index.html,1549254042023,2e1154452b3effb9e6b7f49ade4d5521d63f078879a0ce29b5d1eafc2585dad6
2 | invalid.png,1549254141793,195fe7e021b4a8b26ba24de40bed4d113a1e465d3721522b9f94b6f9de0fa63e
3 | valid.png,1549254141793,30b0f88cee2e37fb1c9e3e563f622839362497ddc1b838a2da3dc6865e7715cb
4 | LogoTelnovo.png,1549254141793,887421be6ced6436dd92c7f2274157c3313771b4a602240dd70e94e782b40766
5 | background.jpg,1549254141793,0fc6c847cd810e998e076f2596b5bc0ffd733fb28e16931dc4cdd1847e819a59
6 | build.js,1549254141793,fc959ab6393b3312a0392f980af0e45a51e3280ce1c607a5af51d6efca1ef3b7
7 | build.js.map,1549254141809,c22aec4d10101c396bb6c9790a0352b9c585952df6cedd746292186bbc483041
8 |
--------------------------------------------------------------------------------
/server/routes/cliente.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | const {check, validationResult} = require('express-validator');
5 | const clienteController = require('../controller/cliente');
6 |
7 | router.get('/cliente', clienteController.getCliente);
8 | router.post('/cliente',clienteController.postCliente);
9 | router.get('/cliente/:id_cliente',clienteController.getIdCliente);
10 | router.delete('/cliente/:id_cliente',clienteController.deleteCliente);
11 | router.put('/cliente/:id_cliente', clienteController.updateCliente);
12 |
13 | const cors = require('cors');
14 | app.use(cors());
15 |
16 |
17 | module.exports = router;
18 |
--------------------------------------------------------------------------------
/server/routes/arreglo.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | const {check, validationResult} = require('express-validator');
5 | const arregloController = require('../controller/arreglo');
6 |
7 | router.get('/arreglo', arregloController.getArreglo);
8 | router.get('/arreglo/:id_arreglo',arregloController.getIdArreglo);
9 | router.get('/arregloP/:id_arreglo',arregloController.getArregloPresupuesto);
10 | router.post('/arreglo',arregloController.postArreglo);
11 | router.delete('/arreglo/:id_arreglo',arregloController.deleteArreglo);
12 |
13 |
14 | const cors = require('cors');
15 | app.use(cors());
16 |
17 |
18 | module.exports = router;
19 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Telnovo
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/server/routes/presupuesto.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | const presupuestoController = require('../controller/presupuesto');
5 |
6 | router.get('/presupuesto', presupuestoController.getPresupuesto);
7 | router.get('/presupuesto/:id_presupuesto', presupuestoController.getIdPresupuesto);
8 | router.delete('/presupuesto/:id_presupuesto', presupuestoController.deletePresupuesto);
9 | router.put('/presupuesto/:id_presupuesto', presupuestoController.updatePresupuesto);
10 | router.post('/presupuesto',presupuestoController.postPresupuesto);
11 | router.post('/presupuestoProducto',presupuestoController.postPresupuestoProducto);
12 |
13 |
14 | const cors = require('cors');
15 | app.use(cors());
16 |
17 | module.exports = router;
18 |
--------------------------------------------------------------------------------
/client/components/Administrar/Home.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
5 |
6 |
7 |
8 |
9 |
34 |
35 |
69 |
--------------------------------------------------------------------------------
/server/routes/producto.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | const {check, validationResult} = require('express-validator');
5 | const productoController = require('../controller/producto');
6 |
7 | router.get('/producto', productoController.getProducto);
8 | router.get('/productoRepuesto', productoController.getProductoRepuesto);
9 | router.get('/productoStock', productoController.getProductoStock);
10 | router.get('/productoReparacion', productoController.getProductoReparar);
11 | router.get('/productoCompra', productoController.getProductoCompra);
12 | router.get('/productoVenta', productoController.getProductoVenta);
13 | router.post('/producto',productoController.postProducto);
14 | router.get('/producto/:id_producto',productoController.getIdProducto);
15 | router.delete('/producto/:id_producto',productoController.deleteProducto);
16 | router.put('/producto/:id_producto',productoController.updateProducto);
17 |
18 | const cors = require('cors');
19 | app.use(cors());
20 |
21 | module.exports = router;
22 |
--------------------------------------------------------------------------------
/client/components/Administrar/error404.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |

7 |
8 |
9 |
10 |
11 |
36 |
37 |
72 |
--------------------------------------------------------------------------------
/client/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import VueSweetalert2 from 'vue-sweetalert2';
4 | import rutas from './routes.js';
5 | import axios from 'axios'
6 | import BootstrapVue from 'bootstrap-vue'
7 | import 'bootstrap/dist/css/bootstrap.css'
8 | import 'bootstrap-vue/dist/bootstrap-vue.css'
9 | import vSelect from 'vue-select'
10 | import VueGoodTablePlugin from 'vue-good-table';
11 | import 'vue-good-table/dist/vue-good-table.css'
12 | import {store} from './store.js';
13 | import Datepicker from 'vuejs-datepicker';
14 | import { firebase } from './firebase.js'
15 | import Vuelidate from 'vuelidate'
16 |
17 |
18 | Vue.use(Vuelidate);
19 | Vue.use(VueGoodTablePlugin);
20 | Vue.use(VueSweetalert2);
21 | Vue.use(BootstrapVue);
22 | Vue.component('v-select', vSelect);
23 | Vue.component('datepicker', Datepicker)
24 | Vue.component('modal', {
25 | template: '#modal-template'
26 | })
27 |
28 | firebase.auth().onAuthStateChanged((user)=>{
29 | new Vue({
30 | el: '#app',
31 | router: rutas,
32 | store,
33 | render: h => h(App)
34 | })
35 | });
36 |
--------------------------------------------------------------------------------
/server/controller/mail.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var app = express();
3 | var nodemailer = require('nodemailer');
4 |
5 | module.exports = {
6 | enviarMail(req,res){
7 | console.log(req);
8 | var transporter = nodemailer.createTransport({
9 | host: "smtp.gmail.com",
10 | port: 587,
11 | secure: false,
12 | auth: {
13 | user: 'XXXXXXXX',
14 | pass: 'XXXXXXXX'
15 | }
16 | })
17 | var mailOptions = {
18 | from: '"Sebastian Bonato sebabonato12@gmail.com>',
19 | to: req.body.destinatario,
20 | subject: 'Telnovo',
21 | text: req.body.mensaje
22 | };
23 | transporter.sendMail(mailOptions, function(error, info){
24 | if (error) {
25 | return console.log(error);
26 | }
27 | console.log('Message sent: %s', info.messageId);
28 | console.log('Preview URL: %s', nodemailer.getTestMessageUrl(info));
29 | });
30 |
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Aplicacion Final para la carrera de Analista de Sistemas.
2 | Tecnologia Utilizadas:
3 | Vue.js Para Frontend.
4 | Node.js y Express.js Para Backend.
5 | PostgreSQL Para la Base de Datos Relacional.
6 | Firebase Para la Autentificaciones.
7 |
8 | Link en Heroku: https://telnovo10.herokuapp.com/#/Home
9 |
10 |
11 | Capturas de Pantalla
12 |
13 | Login
14 | 
15 |
16 | Home
17 | 
18 |
19 | Home Cliente
20 | 
21 |
22 | Formulario
23 | 
24 |
25 |
26 |
27 |
28 | ## Build Setup
29 |
30 | ``` bash
31 |
32 |
33 |
34 | #install dependencies
35 | npm install
36 | #create database Telnovo in PostgreSQL and import database query
37 | ../server/Telnovo
38 | # serve with hot reload at localhost:8080
39 | npm run dev
40 | # build for production with minification
41 | npm run build
42 | ```
43 |
44 | For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader).
45 |
--------------------------------------------------------------------------------
/server/routes/compra.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | const {check} = require('express-validator');
5 | const compraController = require('../controller/compra');
6 |
7 | router.get('/compra', compraController.getCompra);
8 | router.post('/compra',[ check('carritoCompra.*.precioUnitario').isLength({ max: 9 }).withMessage('El Precio Unitario no puede tener mas de 9 digitos'),
9 | check('carritoCompra.*.precioUnitario').isInt().withMessage('El Precio Unitario debe ser un numero entero'),
10 | check('carritoCompra.*.precioTotal').isLength({ max: 9 }).withMessage('El Precio Total no puede tener mas de 9 digitos'),
11 | check('carritoCompra.*.precioTotal').isInt().withMessage('El Precio Total debe ser un numero entero'),
12 | check('carritoCompra.*.cantidad').isInt().withMessage('La Cantidad debe ser un numero entero'),
13 | check('carritoCompra.*.cantidad').not().isEmpty().withMessage('La Cantidad no puede ser vacio'),
14 | ],compraController.postCompra);
15 | router.delete('/compra/:id_compra',compraController.deleteCompra);
16 | router.get('/compra/:id_compra', compraController.getIdCompra);
17 | router.get('/compraFecha/:id_compra', compraController.getFechaCompra);
18 | router.put('/compra/:id_compra', compraController.updateCompra);
19 |
20 |
21 | const cors = require('cors');
22 | app.use(cors());
23 |
24 | module.exports = router;
25 |
--------------------------------------------------------------------------------
/server/routes/venta.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | const cors = require('cors');
5 | const {check, validationResult} = require('express-validator');
6 | const ventaController = require('../controller/venta');
7 |
8 | router.get('/venta', ventaController.getVenta);
9 | router.post('/venta',[ check('carritoVenta.*.precio').isLength({ max: 9 }).withMessage('El Precio no puede tener mas de 9 digitos'),
10 | check('carritoVenta.*.precio').isInt().withMessage('El Precio debe ser un numero entero'),
11 | check('carritoVenta.*.cantidad').isInt().withMessage('La Cantidad debe ser un numero entero'),
12 | check('carritoVenta.*.cantidad').not().isEmpty().withMessage('La Cantidad no puede ser vacio'),
13 | ],ventaController.postVenta);
14 | router.delete('/venta/:id_venta',ventaController.deleteVenta);
15 | router.get('/venta/:id_venta', ventaController.getIdVenta);
16 | router.get('/ventaFecha/:id_venta', ventaController.getFechaVenta);
17 | router.put('/venta/:id_venta', ventaController.updateVenta);
18 | /*
19 | [ check('venta.*.precio').isLength({ max: 9 }).withMessage('El Precio no puede tener mas de 9 digitos'),
20 | check('venta.*.precio').isInt().withMessage('El Precio debe ser un numero entero'),
21 | check('venta.*.cantidad').isInt().withMessage('La Cantidad debe ser un numero entero'),
22 | check('venta.*.cantidad').not().isEmpty().withMessage('La Cantidad no puede ser vacio'),
23 | ]
24 | */
25 |
26 | app.use(cors());
27 |
28 | module.exports = router;
29 |
30 |
31 |
--------------------------------------------------------------------------------
/server/controller/ventaProducto.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | var pg = require('pg');
5 | var config = require('../database');
6 |
7 |
8 | module.exports = {
9 |
10 | getVentaProducto(req,res){
11 | var pool = new pg.Pool(config)
12 | pool.connect(function(err, client, done) {
13 | client.query("SELECT * FROM venta_producto")
14 | .then(response => {
15 | pool.end()
16 | res.json(response.rows)
17 | })
18 | .catch(error => {
19 | pool.end()
20 | console.log(error.stack)
21 | })
22 | done()
23 | })
24 | },
25 | getIdVentaProducto(req,res){
26 | var pool = new pg.Pool(config)
27 | pool.connect(function(err, client, done) {
28 | client.query('SELECT V.fecha, VP.id_venta_producto, V.id_venta,PR.marca, PR.modelo,VP.cantidad, VP.precio FROM venta_producto VP, venta V, producto PR WHERE VP.id_venta = ($1) AND VP.id_venta = V.id_venta AND VP.id_producto = PR.id_producto', [req.params.id_venta])
29 | .then(response => {
30 | pool.end()
31 | res.json(response.rows)
32 | })
33 | .catch(error => {
34 | pool.end()
35 | console.log(error.stack)
36 | })
37 | done()
38 | })
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/server/controller/compraProducto.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | var pg = require('pg');
5 | var config = require('../database');
6 |
7 |
8 | module.exports = {
9 | getCompraProducto(req,res){
10 | var pool = new pg.Pool(config)
11 | pool.connect(function(err, client, done) {
12 | client.query("SELECT * FROM compra_producto")
13 | .then(response => {
14 | pool.end()
15 | res.json(response.rows)
16 | })
17 | .catch(error => {
18 | pool.end()
19 | console.log(error.stack)
20 | })
21 | done()
22 | })
23 | },
24 | getIdCompraProducto(req,res){
25 | var pool = new pg.Pool(config);
26 | pool.connect(function(err, client, done) {
27 | client.query('SELECT C.fecha, CP.id_compra_producto, C.id_compra, PR.marca, PR.modelo,CP.cantidad, CP.precio_unitario, CP.precio_total FROM compra_producto CP, compra C, producto PR WHERE CP.id_compra = ($1) AND CP.id_compra = C.id_compra AND CP.id_producto = PR.id_producto', [req.params.id_compra])
28 | .then(response => {
29 | pool.end();
30 | res.json(response.rows)
31 | })
32 | .catch(error => {
33 | pool.end();
34 | console.log(error)
35 | })
36 | done()
37 | })
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/client/assets/sweetAlert.js:
--------------------------------------------------------------------------------
1 | import Swal from 'sweetalert2'
2 |
3 | export function alertSuccess(){
4 | Swal.fire( 'Exito!','Guardado Correctamente!','success');
5 | }
6 |
7 | export function alertEditSuccess(){
8 | Swal.fire( 'Exito!','Editado Correctamente!','success');
9 | }
10 |
11 | export function alertError(){
12 | Swal.fire( 'Error!','No Se Pudo Guardar Correctamente!','error');
13 | }
14 |
15 | export function alertSucessProveedor(){
16 | Swal.fire( 'Exito!','Nuevo Proveedor Añadido!','success');
17 | }
18 |
19 |
20 | export function alertCompletarCampos(){
21 | Swal.fire( 'Error!','Completar los Campos Vacios!','error');
22 | }
23 |
24 | export function alertSucessDelete(){
25 | Swal.fire('Eliminado!','Ha sido elimando','success');
26 | }
27 |
28 | export function alertWarningLimite(){
29 | Swal.fire('','Limite de Productos Permitidos','warning');
30 | }
31 |
32 | export function alertWarningLimiteStock(){
33 | Swal.fire('','Limite de Stock Disponible','warning');
34 | }
35 |
36 | export function alertWarningFK(){
37 | Swal.fire('','No se puede eliminar ya que a realizado venta','warning');
38 | }
39 |
40 | export function alertWarningArregloFK(){
41 | Swal.fire('','No se puede eliminar ya que posee un presupuesto','warning');
42 | }
43 |
44 | export function alertWarningCompletarCampos(){
45 | Swal.fire('','Completar los Campos Correctamente','warning');
46 | }
47 |
48 | export function alertWarningLimiteOne(){
49 | Swal.fire('','La Cantidad debe ser al menos de 1','warning');
50 | }
51 |
52 | export function alertSucessMail(){
53 | Swal.fire('Exito!','Mail Enviado Correctamente','success');
54 | }
55 |
--------------------------------------------------------------------------------
/server/controller/presupuestoProducto.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | var pg = require('pg');
5 | var config = require('../database');
6 |
7 |
8 | module.exports = {
9 |
10 | getPresupuestoProducto(req,res){
11 | var pool = new pg.Pool(config)
12 | pool.connect(function(err, client, done) {
13 | client.query("SELECT PP.id_presupuesto_producto,PR.modelo FROM presupuesto_producto PP, producto PR WHERE PP.producto = PR.id_producto")
14 | .then(response => {
15 | pool.end()
16 | res.json(response.rows)
17 | })
18 | .catch(error => {
19 | pool.end()
20 | console.log(error.stack)
21 | })
22 | done()
23 | })
24 | },
25 | getIdPresupuestoProducto(req,res){
26 | var pool = new pg.Pool(config)
27 | pool.connect(function(err, client, done) {
28 | client.query('SELECT PP.id_presupuesto_producto,PR.modelo,PP.cantidad,PP.precio FROM presupuesto_producto PP, producto PR WHERE PP.producto = PR.id_producto AND PP.presupuesto =($1)', [req.params.id_presupuesto])
29 | .then(response => {
30 | pool.end();
31 | res.json(response.rows)
32 | })
33 | .catch(error => {
34 | pool.end();
35 | console.log(error.stack)
36 | })
37 | done()
38 | })
39 | },
40 | }
41 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | var path = require('path')
2 | var webpack = require('webpack')
3 |
4 | module.exports = {
5 | entry: './client/main.js',
6 | output: {
7 | path: path.resolve(__dirname, './dist'),
8 | publicPath: '/dist/',
9 | filename: 'build.js'
10 | },
11 | module: {
12 | rules: [
13 | {
14 | test: /\.css$/,
15 | use: [
16 | 'vue-style-loader',
17 | 'css-loader'
18 | ],
19 | }, {
20 | test: /\.vue$/,
21 | loader: 'vue-loader',
22 | options: {
23 | loaders: {
24 | }
25 | // other vue-loader options go here
26 | }
27 | },
28 | {
29 | test: /\.js$/,
30 | loader: 'babel-loader',
31 | exclude: /node_modules/
32 | },
33 | {
34 | test: /\.(png|jpg|gif|svg)$/,
35 | loader: 'file-loader',
36 | options: {
37 | name: '[name].[ext]?[hash]'
38 | }
39 | }
40 | ]
41 | },
42 | resolve: {
43 | alias: {
44 | 'vue$': 'vue/dist/vue.esm.js'
45 | },
46 | extensions: ['*', '.js', '.vue', '.json']
47 | },
48 | devServer: {
49 | historyApiFallback: true,
50 | noInfo: true,
51 | overlay: true,
52 | disableHostCheck: true
53 | },
54 | performance: {
55 | hints: false
56 | },
57 | devtool: '#eval-source-map'
58 | }
59 |
60 | if (process.env.NODE_ENV === 'production') {
61 | module.exports.devtool = '#source-map'
62 | // http://vue-loader.vuejs.org/en/workflow/production.html
63 | module.exports.plugins = (module.exports.plugins || []).concat([
64 | new webpack.DefinePlugin({
65 | 'process.env': {
66 | NODE_ENV: '"production"'
67 | }
68 | }),
69 | new webpack.optimize.UglifyJsPlugin({
70 | sourceMap: true,
71 | compress: {
72 | warnings: false
73 | }
74 | }),
75 | new webpack.LoaderOptionsPlugin({
76 | minimize: true
77 | })
78 | ])
79 | }
80 |
--------------------------------------------------------------------------------
/server/bin/www:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /**
4 | * Module dependencies.
5 | */
6 |
7 | var app = require('../app');
8 | var debug = require('debug')('telnovo:server');
9 | var http = require('http');
10 |
11 | /**
12 | * Get port from environment and store in Express.
13 | */
14 |
15 | var port = normalizePort(process.env.PORT || '3000');
16 | app.set('port', port);
17 |
18 | /**
19 | * Create HTTP server.
20 | */
21 |
22 | var server = http.createServer(app);
23 |
24 | /**
25 | * Listen on provided port, on all network interfaces.
26 | */
27 |
28 | server.listen(port);
29 | server.on('error', onError);
30 | server.on('listening', onListening);
31 |
32 | /**
33 | * Normalize a port into a number, string, or false.
34 | */
35 |
36 | function normalizePort(val) {
37 | var port = parseInt(val, 10);
38 |
39 | if (isNaN(port)) {
40 | // named pipe
41 | return val;
42 | }
43 |
44 | if (port >= 0) {
45 | // port number
46 | return port;
47 | }
48 |
49 | return false;
50 | }
51 |
52 | /**
53 | * Event listener for HTTP server "error" event.
54 | */
55 |
56 | function onError(error) {
57 | if (error.syscall !== 'listen') {
58 | throw error;
59 | }
60 |
61 | var bind = typeof port === 'string'
62 | ? 'Pipe ' + port
63 | : 'Port ' + port;
64 |
65 | // handle specific listen errors with friendly messages
66 | switch (error.code) {
67 | case 'EACCES':
68 | console.error(bind + ' requires elevated privileges');
69 | process.exit(1);
70 | break;
71 | case 'EADDRINUSE':
72 | console.error(bind + ' is already in use');
73 | process.exit(1);
74 | break;
75 | default:
76 | throw error;
77 | }
78 | }
79 |
80 | /**
81 | * Event listener for HTTP server "listening" event.
82 | */
83 |
84 | function onListening() {
85 | var addr = server.address();
86 | var bind = typeof addr === 'string'
87 | ? 'pipe ' + addr
88 | : 'port ' + addr.port;
89 | debug('Listening on ' + bind);
90 | }
91 |
--------------------------------------------------------------------------------
/server/routes/proveedor.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | var nodemailer = require('nodemailer');
5 | const {check, validationResult} = require('express-validator');
6 | const proveedorController = require('../controller/proveedor');
7 |
8 | router.get('/proveedor', proveedorController.getProveedor);
9 | router.post('/proveedor',[
10 | check('dni').not().isEmpty().withMessage('El Dni no puede ser vacio'),
11 | check('dni').isInt().withMessage('El Dni debe ser un numero entero'),
12 | check('dni').isLength({ max: 9 }).withMessage('El Dni no puede tener mas de 9 digitos'),
13 | check('nombre').not().isEmpty().withMessage('El Nombre no puede ser vacio'),
14 | check('apellido').not().isEmpty().withMessage('El Apellido no puede ser vacio'),
15 | check('direccion').not().isEmpty().withMessage('La Direccion no puede ser vacio'),
16 | check('descripcion').not().isEmpty().withMessage('La Descripcion no puede ser vacio'),
17 | check('telefono').not().isEmpty().withMessage('La Direccion no puede ser vacio'),
18 | check('mail').not().isEmpty().withMessage('El Mail no puede ser vacio'),
19 | ],
20 | proveedorController.postProveedor);
21 | router.get('/proveedor/:id_proveedor',proveedorController.getIdProveedor);
22 | router.delete('/proveedor/:id_proveedor',proveedorController.deleteProveedor);
23 | router.put('/proveedor/:id_proveedor',[
24 | check('dni').not().isEmpty().withMessage('El Dni no puede ser vacio'),
25 | check('dni').isInt().withMessage('El Dni debe ser un numero entero'),
26 | check('dni').isLength({ max: 9 }).withMessage('El Dni no puede tener mas de 9 digitos'),
27 | check('nombre').not().isEmpty().withMessage('El Nombre no puede ser vacio'),
28 | check('apellido').not().isEmpty().withMessage('El Apellido no puede ser vacio'),
29 | check('direccion').not().isEmpty().withMessage('La Direccion no puede ser vacio'),
30 | check('descripcion').not().isEmpty().withMessage('La Descripcion no puede ser vacio'),
31 | check('telefono').not().isEmpty().withMessage('La Direccion no puede ser vacio'),
32 | check('mail').not().isEmpty().withMessage('El Mail no puede ser vacio'),
33 | ],
34 | proveedorController.updateProveedor);
35 |
36 | const cors = require('cors');
37 | app.use(cors());
38 |
39 | module.exports = router;
40 |
--------------------------------------------------------------------------------
/server/app.js:
--------------------------------------------------------------------------------
1 | var createError = require('http-errors');
2 | var express = require('express');
3 | var path = require('path');
4 | var cookieParser = require('cookie-parser');
5 | var logger = require('morgan');
6 | var app = express();
7 |
8 |
9 |
10 | var clienteRouter = require('./routes/cliente');
11 | var productoRouter = require('./routes/producto');
12 | var ventaRouter = require('./routes/venta');
13 | var mailRouter = require('./routes/mail');
14 | var proveedorRouter = require('./routes/proveedor');
15 | var adminRouter = require('./routes/administrar');
16 | var ventaProductoRouter =require('./routes/ventaProducto');
17 | var compraRouter = require('./routes/compra');
18 | var compraProductoRouter = require('./routes/compraProducto');
19 | var arregloRouter = require('./routes/arreglo');
20 | var presupuestoRouter = require('./routes/presupuesto');
21 | var presupuestoProductoRouter = require('./routes/presupuestoProducto');
22 | var reparacionRouter = require('./routes/reparacion');
23 |
24 | const allowCrossDomain = function(req, res, next) {
25 | res.header('Access-Control-Allow-Origin', '*');
26 | res.header('Access-Control-Allow-Methods', '*');
27 | res.header('Access-Control-Allow-Headers', '*');
28 | next();
29 | }
30 | app.use(allowCrossDomain);
31 |
32 |
33 | app.use(logger('dev'));
34 | app.use(express.json());
35 | app.use(express.urlencoded({ extended: false }));
36 | app.use(cookieParser());
37 | app.use('/', clienteRouter);
38 | app.use('/', productoRouter);
39 | app.use('/', ventaRouter);
40 | app.use('/', mailRouter);
41 | app.use('/', proveedorRouter);
42 | app.use('/', adminRouter);
43 | app.use('/', ventaProductoRouter);
44 | app.use('/', compraProductoRouter);
45 | app.use('/', compraRouter);
46 | app.use('/', arregloRouter);
47 | app.use('/', presupuestoRouter);
48 | app.use('/', presupuestoProductoRouter);
49 | app.use('/', reparacionRouter);
50 |
51 |
52 | // error handler
53 | app.use(function(err, req, res, next) {
54 | // set locals, only providing error in development
55 | res.locals.message = err.message;
56 | res.locals.error = req.app.get('env') === 'development' ? err : {};
57 |
58 | // render the error page
59 | res.status(err.status || 500);
60 | res.render('error');
61 | });
62 |
63 | module.exports = app;
64 |
--------------------------------------------------------------------------------
/server/controller/adminSDK.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "service_account",
3 | "project_id": "ionic-3e984",
4 | "private_key_id": "a7e77339066c1f5f5bd5134eb932c8aafb8e8c29",
5 | "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCvoLaDvamCbNAi\nX7Krg77pbRw2GmeK5uV4kTqH5DPe533Lj7vvFvBJu9Cn4BcUDjnFkmmdUg9r2/Eo\n6u85UYxejCroUKT8pHM1lngJbtY/SMZyaIwBc0tlbyBQK8IzOlSTJarfBLUXz9Ke\niNEmpAlUKUxISijMPKeAueG36LIAWJd+y5NKfQVCuJPGs6Bgp6D5RVJj5u80Idf9\nRR0vn1Q2aHSchTKaCnq7lrpF6TteFEX7izAvIDi5dTlq0uskA+x+0wTTOh1qdvOg\n5H0aPtfVRMtByNHU2M6EU/RZtrHIR7/CxrhmkRonn645atEnRaqCsMH6ed2IDMPY\njyrxzooLAgMBAAECggEADbVqOatGvW736g71N80PTFIfdxulhGKUe84+Ntg5skb4\nezirbzSnqeG2njvwITkhCkps4wJCQOWIk+yOorc6UTD4smyFDFFbys2FbhsQLx1j\nnA+MChrxQigj6g4YWP5PFrNEfKb16bdnlcdRKAZ60e5tTWE4gQSlAHfB5iSMLFmc\nzNjhOlTt3ZTJ/F+ZV0kT2qt7ezk4guJII5pFiXN23KMVDc2P5Z0g40T+0zQkBUba\nTIfguNaArU/oq18/mZe4omCNGHWzL55xSqFJynSNJ/XZ1UrcU7iD81cwE4zBU8rE\noI8pbPn+QlQug8DXY6GVgOiRKMIcZDK9W1dwOBaZbQKBgQDcnXY4aMkd/qJUg3//\n32c5qJIdQ9nm6cr5cN6MxKpLe1JcBm060zNeDpinbQxC+vpiE3qbRsEfRbQPcNRN\nVdRbKjjvbjLvYOfvbDfad2P0elVF9IhVEwzcXAU4Fhz5Gps681xeEwwH4uDCJEGr\npMStyc/3rtu9jsTOTXtsTomp5wKBgQDLzA5DhooujZgCACNzuKeDIJdGgVOIWQM4\nO6i9hXSUn6o93/Pms/KJOewT/Pi7w1Eo+RiNEKVJDaKwJ8n4t+AJVL4kQdUUGT2z\nDklghA+UL186rdO8W91tf4CVV805CfNCj4UTu3cY6ISHWO1v2ftpvk3oYWxfqg4O\nNfzSTcDCPQKBgQCdXOgFxqCmd4oc1IvJ3PXJh/dpTouwjVVN5feo22NJYhbWM3NY\ngWvjjG/RBRS49kMBEDnlZmu8vcB5PxcAbteBi7V++9DzNOFbw4p3l6/BpD0NICba\n4DLNQAos/oD+Ir9VJl/dbqKnQWrmsGvzXh04hXqFhsGRDbROH7CJCeBiQwKBgQCH\n4q14FNM6Kys52kHJPUxkQGzdlAnQlhlxe0YN6FhNaRCoZRVJtJ55JWfmA/0NpTQO\nb9kQ5hJvXWomrsEa1+/ICPsnTcX3usTLCTGf6y5ADj4e8ByIMXC5PBTOf1bVO285\n6FxBRfQpZZBIduEKfXwHi96CncMXHlp020aSK0nluQKBgDO54ASBNL9kbdwzCnCF\nA0yoDnfscZkVg/al/bRcD2YcJ7P7krEcsd+0qQFNo0aecdOXeenjRJ4icurgt7vI\n6mWMW9JflNME4RaPBeKUMaUFmIq573PDf3FEEXZZ1MSYQKkorFQ0Mns8gbDqXZ+E\nErlCfjlZoIYUL1LCErMOR7hR\n-----END PRIVATE KEY-----\n",
6 | "client_email": "firebase-adminsdk-qfhcm@ionic-3e984.iam.gserviceaccount.com",
7 | "client_id": "105279302414321159682",
8 | "auth_uri": "https://accounts.google.com/o/oauth2/auth",
9 | "token_uri": "https://oauth2.googleapis.com/token",
10 | "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
11 | "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-qfhcm%40ionic-3e984.iam.gserviceaccount.com"
12 | }
13 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vuejs",
3 | "description": "A Vue.js project",
4 | "version": "1.0.0",
5 | "author": "",
6 | "license": "MIT",
7 | "private": true,
8 | "scripts": {
9 | "dev-client": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
10 | "build": "cross-env NODE_ENV=production webpack --progress --hide-modules",
11 | "start": "nodemon ./server/bin/www",
12 | "dev": "concurrently --kill-others \"npm run start\" \"npm run dev-client\""
13 | },
14 | "dependencies": {
15 | "@fortawesome/fontawesome-svg-core": "^1.2.19",
16 | "@fortawesome/free-brands-svg-icons": "^5.9.0",
17 | "@fortawesome/free-solid-svg-icons": "^5.9.0",
18 | "@fortawesome/vue-fontawesome": "^0.1.6",
19 | "axios": "^0.18.1",
20 | "bootstrap": "^4.3.1",
21 | "bootstrap-vue": "^2.0.0-rc.25",
22 | "chart.js": "^2.8.0",
23 | "cookie-parser": "^1.4.4",
24 | "cors": "^2.8.5",
25 | "debug": "~2.6.9",
26 | "express": "~4.16.0",
27 | "express-validator": "^6.1.1",
28 | "firebase": "^5.11.1",
29 | "firebase-admin": "^8.3.0",
30 | "firestone": "^0.1.1",
31 | "html-pdf": "^2.2.0",
32 | "http-errors": "~1.6.2",
33 | "jade": "~1.11.0",
34 | "moment": "^2.24.0",
35 | "morgan": "~1.9.0",
36 | "nodemailer": "^5.1.1",
37 | "pdfkit": "^0.9.1",
38 | "pg": "^6.4.2",
39 | "sweetalert2": "^8.13.0",
40 | "vue": "^2.6.10",
41 | "vue-chartjs": "^3.4.2",
42 | "vue-good-table": "^2.16.5",
43 | "vue-router": "^3.0.6",
44 | "vue-search-select": "^2.8.3",
45 | "vue-select": "^2.6.4",
46 | "vue-sweetalert2": "^1.6.4",
47 | "vuejs-datepicker": "^1.6.2",
48 | "vuelidate": "^0.7.4",
49 | "vuex": "^3.1.1",
50 | "xlsx": "^0.14.3"
51 | },
52 | "browserslist": [
53 | "> 1%",
54 | "last 2 versions",
55 | "not ie <= 8"
56 | ],
57 | "devDependencies": {
58 | "babel-core": "^6.26.0",
59 | "babel-loader": "^7.1.2",
60 | "babel-preset-env": "^1.6.0",
61 | "babel-preset-stage-3": "^6.24.1",
62 | "concurrently": "^4.1.1",
63 | "cross-env": "^5.0.5",
64 | "css-loader": "^0.28.7",
65 | "file-loader": "^1.1.4",
66 | "nodemon": "^1.18.9",
67 | "vue-loader": "^13.0.5",
68 | "vue-template-compiler": "^2.6.10",
69 | "webpack": "^3.6.0",
70 | "webpack-dev-server": "^2.11.5"
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/client/components/Cliente/NuevoCliente.vue:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
40 |
41 |
113 |
--------------------------------------------------------------------------------
/client/components/Compra/Torta.vue:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
53 |
54 |
128 |
--------------------------------------------------------------------------------
/client/components/Compra/Estadistica.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
IMPORTE POR VENTAS
5 |
6 |
7 |
8 |
9 |
10 |
59 |
60 |
134 |
--------------------------------------------------------------------------------
/server/controller/reparacion.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var app = express();
3 | var pg = require('pg');
4 | var config = require('../database');
5 |
6 |
7 | module.exports = {
8 | getReparacion(req,res){
9 | var pool = new pg.Pool(config)
10 | pool.connect(function(err, client, done) {
11 | client.query("SELECT id_reparacion, STRING_AGG ( producto.marca || ' ' || producto.modelo,',' ) as producto, producto.id_producto, arreglo.observacion,presupuesto.precio_total, cliente.dni, to_char( fecha_ini, 'DD-MM-YYYY') as fecha_ini,to_char( fecha_fin, 'DD-MM-YYYY') as fecha_fin FROM reparacion,producto, arreglo, presupuesto,cliente where (arreglo.id_arreglo=presupuesto.arreglo)and(presupuesto.id_presupuesto=reparacion.id_presupuesto)and(arreglo.cliente=cliente.id_cliente)and(arreglo.producto=producto.id_producto) GROUP BY id_reparacion,producto.id_producto,arreglo.observacion,presupuesto.precio_total, cliente.dni, fecha_ini, fecha_fin ")
12 | .then(response => {
13 | pool.end();
14 | res.json(response.rows);
15 | })
16 | .catch(error => {
17 | pool.end();
18 | console.log(error.stack);
19 | })
20 | done()
21 | })
22 | },
23 | getIdReparacion(req,res){
24 | var pool = new pg.Pool(config)
25 | pool.connect(function(err, client, done) {
26 | client.query("SELECT id_reparacion, producto.id_producto, producto.modelo , presupuesto.observacion,presupuesto.precio_total, cliente.dni,cliente.mail, fecha_ini, fecha_fin FROM reparacion,producto, arreglo, presupuesto,cliente where (arreglo.id_arreglo=presupuesto.arreglo)and(presupuesto.id_presupuesto=reparacion.id_presupuesto)and(arreglo.cliente=cliente.id_cliente)and(arreglo.producto=producto.id_producto) AND id_reparacion=($1)", [req.params.id_reparacion])
27 | .then(response => {
28 | pool.end();
29 | res.json(response.rows);
30 | })
31 | .catch(error => {
32 | pool.end();
33 | console.log(error.stack);
34 | })
35 | done()
36 | })
37 | },
38 | updateReparacion(req, res){
39 | var pool = new pg.Pool(config)
40 | pool.connect(function(err, client, done) {
41 | client.query("UPDATE reparacion SET fecha_ini = ($1), fecha_fin = ($2) WHERE id_reparacion = ($3)",[req.body.fecha_ini,req.body.fecha_fin,req.params.id_reparacion])
42 | .then(response => {
43 | pool.end();
44 | res.sendStatus(200);
45 | })
46 | .catch(error => {
47 | pool.end();
48 | res.send({msg:'ERROR NO SE PUDIERON GUARDAR LOS DATOS'})
49 | })
50 | done()
51 | })
52 | },
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/server/controller/proveedor.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var app = express();
3 | var pg = require('pg');
4 | var config = require('../database');
5 |
6 |
7 | module.exports = {
8 | getProveedor(req,res){
9 | var pool = new pg.Pool(config);
10 | pool.connect(function(err, client, done) {
11 | client.query("SELECT * FROM proveedor")
12 | .then(response => {
13 | pool.end();
14 | res.json(response.rows)
15 | })
16 | .catch(error => {
17 | pool.end();
18 | console.log(error.stack)
19 | })
20 | done()
21 | })
22 | },
23 | postProveedor(req, res){
24 | var client = new pg.Client(config)
25 | client.connect();
26 | client.query("INSERT INTO proveedor (dni,nombre,apellido,direccion,telefono,mail,descripcion) VALUES($1,$2,$3,$4,$5,$6,$7)",[req.body.dni,req.body.nombre,req.body.apellido,
27 | req.body.direccion,req.body.telefono,req.body.mail,req.body.descripcion]).then(response => {
28 | client.end();
29 | res.sendStatus(200);
30 | })
31 | .catch(error => {
32 | client.end();
33 | console.log(error)
34 | res.send({ msg: 'Error del Servidor No se pudieron guardar los datos!' });
35 | })
36 |
37 | },
38 | getIdProveedor(req,res){
39 | var pool = new pg.Pool(config)
40 | pool.connect(function(err, client, done) {
41 | client.query('SELECT * FROM proveedor WHERE id_proveedor=($1)', [req.params.id_proveedor])
42 | .then(response => {
43 | pool.end();
44 | res.json(response.rows);
45 | })
46 | .catch(error => {
47 | pool.end();
48 | console.log(error.stack);
49 | })
50 | done()
51 | })
52 | },
53 |
54 | deleteProveedor(req,res){
55 | var client = new pg.Client(config)
56 | client.connect();
57 | client.query("DELETE FROM proveedor WHERE id_proveedor=($1)",[req.params.id_proveedor])
58 | .then(response => {
59 | client.end();
60 | res.sendStatus(200);
61 | })
62 | .catch(error => {
63 | client.end();
64 | console.log(error);
65 | if (error.code == 23503){
66 | res.send({ msg:"No se puede eliminar ya que el cliente pose una venta o una compra"});
67 | }else{
68 | res.send({ msg: "Error de servidor no se pueden guardar los datos"});
69 | }
70 | })
71 |
72 | },
73 | updateProveedor(req,res){
74 | var pool = new pg.Pool(config)
75 | pool.connect(function(err, client, done) {
76 | client.query("UPDATE proveedor SET dni=($1), nombre=($2), apellido=($3), direccion=($4), telefono=($5), mail=($6), descripcion=($7) WHERE id_proveedor=($8)", [req.body.dni, req.body.nombre, req.body.apellido,req.body.direccion,req.body.telefono,req.body.mail,req.body.descripcion,req.params.id_proveedor])
77 | .then(response => {
78 | pool.end();
79 | res.sendStatus(200);
80 | })
81 | .catch(error => {
82 | pool.end();
83 | res.send({ msg: 'Error del Servidor No se pudieron guardar los datos!' });
84 | })
85 | done()
86 | })
87 | }
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/server/controller/arreglo.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var app = express();
3 | var pg = require('pg');
4 | var config = require('../database');
5 |
6 |
7 | module.exports = {
8 | getArreglo(req,res){
9 | var pool = new pg.Pool(config)
10 | pool.connect(function(err, client, done) {
11 | client.query("SELECT id_arreglo, cliente.dni as cliente , producto.modelo as producto, to_char( fecha, 'DD-MM-YYYY') as fecha, observacion, condicion FROM arreglo,cliente,producto WHERE arreglo.cliente = cliente.id_cliente AND arreglo.producto = producto.id_producto")
12 | .then(response => {
13 | pool.end()
14 | res.json(response.rows);
15 | })
16 | .catch(error => {
17 | pool.end();
18 | console.log(error.stack);
19 | })
20 | done();
21 | })
22 | },
23 |
24 | getIdArreglo(req,res){
25 | var pool = new pg.Pool(config)
26 | pool.connect(function(err, client, done) {
27 | client.query("SELECT p.id_presupuesto FROM presupuesto p WHERE p.arreglo=($1)", [req.params.id_arreglo])
28 | .then(response => {
29 | pool.end();
30 | res.json(response.rows);
31 | })
32 | .catch(error => {
33 | pool.end();
34 | console.log(error.stack);
35 | })
36 | done()
37 | })
38 | },
39 |
40 | getArregloPresupuesto(){
41 | pool.connect()
42 | .then(client => {
43 | return client.query('SELECT * FROM presupuesto p WHERE p.arreglo=($1)', [req.params.ida])
44 | .then(response => {
45 | client.release()
46 | res.json(response.rows)
47 | })
48 | .catch(error => {
49 | client.release()
50 | console.log(error.stack)
51 | })
52 | })
53 | },
54 |
55 | postArreglo(req, res){
56 | const arreglo = {
57 | cliente: req.body.arreglo.cliente,
58 | producto: req.body.arreglo.producto,
59 | fecha: new Date().getDate()+'/'+(new Date().getMonth()+1)+'/'+new Date().getFullYear(),
60 | observacion: req.body.arreglo.observacion,
61 | condicion: 'EN ESPERA DE PRESUPUESTO'
62 | }
63 | var pool = new pg.Pool(config);
64 | pool.connect(function(err, client, done) {
65 | client.query('INSERT INTO arreglo(cliente,producto,fecha,observacion,condicion) VALUES($1,$2,$3,$4,$5)',[arreglo.cliente,arreglo.producto,arreglo.fecha,arreglo.observacion,arreglo.condicion])
66 | .then(response => {
67 | pool.end()
68 | res.sendStatus(200);
69 | })
70 | .catch(error => {
71 | pool.end()
72 | console.log(error)
73 | res.send({ msg: 'Error del Servidor No se pudieron guardar los datos!' });
74 | })
75 | done()
76 | })
77 | },
78 |
79 | deleteArreglo(req,res){
80 | var pool = new pg.Pool(config)
81 | pool.connect(function(err, client, done) {
82 | client.query("DELETE FROM arreglo WHERE id_arreglo=($1)",[req.params.id_arreglo])
83 | .then(response => {
84 | pool.end();
85 | res.sendStatus(200);
86 | })
87 | .catch(error => {
88 | pool.end();
89 | console.log(error);
90 | res.json(error);
91 | })
92 | done()
93 | })
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/server/controller/admin.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | var pg = require('pg');
5 | var config = require('../database');
6 | var admin = require('firebase-admin');
7 | serviceAccount = require('./adminSDK.json')
8 |
9 |
10 | administrador = admin.initializeApp({
11 | credential: admin.credential.cert(serviceAccount),
12 | databaseURL: "https://ionic-3e984.firebaseio.com"
13 | })
14 |
15 | module.exports = {
16 |
17 | getUsuario(req,res){
18 | var client = new pg.Client(config);
19 | client.connect();
20 | client.query("SELECT US.id_usuario,US.uuid, US.mail, RO.perfil FROM usuario US, rol RO WHERE US.rol = RO.id_rol")
21 | .then(response => {
22 | client.end()
23 | res.json(response.rows)
24 | })
25 | .catch(error => {
26 | client.end();
27 | console.log(error.stack)
28 | })
29 |
30 | },
31 |
32 | getIdUsuario(req,res){
33 | var client = new pg.Client(config);
34 | client.connect();
35 | client.query("SELECT US.id_usuario,US.uuid, US.mail, RO.perfil FROM usuario US, rol RO WHERE US.rol = RO.id_rol AND US.uuid = ($1)",[req.params.uuid])
36 | .then(response => {
37 | client.end();
38 | console.log(response.rows);
39 | res.json(response.rows);
40 | })
41 | .catch(error => {
42 | client.end();
43 | console.log(error.stack)
44 | })
45 | },
46 | postUsuario(req, res){
47 | console.log("Peticion POST");
48 | console.log(req.body);
49 | administrador.auth().createUser({
50 | email: req.body.mail,
51 | emailVerified: false,
52 | password: req.body.password,
53 | displayName: 'null',
54 | photoURL: 'http://www.example.com/12345678/photo.png',
55 | disabled: false
56 | })
57 | .then(function(userRecord) {
58 | //console.log(userRecord);
59 | console.log(req.body);
60 | var client = new pg.Client(config)
61 | client.connect();
62 | client.query("INSERT INTO usuario(uuid,mail,contraseña,rol) VALUES($1,$2,$3,$4)",[userRecord.uid,req.body.mail,req.body.password,req.body.rol])
63 | .then(response => {
64 | client.end()
65 | res.sendStatus(200);
66 | })
67 | .catch(error => {
68 | client.end()
69 | console.log(error)
70 | res.send({ msg: 'Error del Servidor No se pudieron guardar los datos!' });
71 | })
72 |
73 | })
74 | .catch(function(error) {
75 | console.log('Error creating new user:', error);
76 | });
77 | },
78 |
79 | deleteUsuario(req,res){
80 | //var client = new pg.Client(config)
81 | console.log(req.body);
82 | /*
83 | administrador.auth().deleteUser(req.params.uuid)
84 | .then(function() {
85 | console.log('Successfully deleted user');
86 | })
87 | */
88 |
89 |
90 | administrador.auth().deleteUser(req.params.uuid)
91 | .then(function() {
92 | console.log('Successfully deleted user');
93 | })
94 | .catch(function(error) {
95 | console.log('Error deleting user:', error);
96 | });
97 |
98 | /*
99 | .then(
100 | client.connect(),
101 | client.query("DELETE FROM cliente WHERE uuid=($1)",[req.params.uuid])
102 | .then(response => {
103 | client.end()
104 | res.sendStatus(200);
105 | })
106 | .catch(error => {
107 | client.end();
108 | console.log(error);
109 | res.send({ msg: "Error de servidor no se pueden guardar los datos"});
110 | })
111 |
112 | .catch(function(error) {
113 | console.log('Error deleting user:', error);
114 | }));
115 | */
116 | }
117 |
118 | }
119 |
--------------------------------------------------------------------------------
/server/controller/presupuesto.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var app = express();
4 | var pg = require('pg');
5 | var config = require('../database');
6 |
7 |
8 | module.exports = {
9 | getPresupuesto(req,res){
10 | var pool = new pg.Pool(config)
11 | pool.connect(function(err, client, done) {
12 | client.query("SELECT cl.nombre, cl.apellido,to_char( vt.fecha, 'DD-MM-YYYY') as fecha, vt.total, vt.id_venta FROM cliente cl, venta vt WHERE cl.id_cliente = vt.id_cliente")
13 | .then(response => {
14 | pool.end()
15 | res.json(response.rows)
16 | })
17 | .catch(error => {
18 | pool.end()
19 | console.log(error.stack)
20 | })
21 | done()
22 | })
23 | },
24 |
25 | getIdPresupuesto(req,res){
26 | var pool = new pg.Pool(config)
27 | pool.connect(function(err, client, done) {
28 | client.query('SELECT * FROM presupuesto WHERE id_presupuesto=($1)', [req.params.id_presupuesto])
29 | .then(response => {
30 | pool.end();
31 | res.json(response.rows)
32 | })
33 | .catch(error => {
34 | pool.end();
35 | console.log(error.stack)
36 | })
37 | done()
38 | })
39 | },
40 |
41 | postPresupuesto(req, res){
42 | var pool = new pg.Pool(config)
43 | pool.query("INSERT INTO presupuesto(arreglo,observacion,estado,precio_mano_obra,precio_total) VALUES($1,$2,$3,$4,$5) RETURNING id_presupuesto",[req.body.presupuesto.arreglo,req.body.presupuesto.observacion,req.body.presupuesto.estado,req.body.presupuesto.precioManoObra,req.body.presupuesto.precioTotal]).then(response=> {
44 | pool.end();
45 | res.json(response.rows);
46 | }).catch((error) =>{
47 | pool.end();
48 | console.log(error);
49 | });
50 | },
51 |
52 | postPresupuestoProducto(req,res){
53 | console.log(req.body);
54 | for (var i=0 ; i < req.body.presupuesto.length ; i++) {
55 | var pool = new pg.Pool(config)
56 | pool.query("INSERT INTO presupuesto_producto(presupuesto,producto,cantidad,precio) VALUES($1,$2,$3,$4)",[req.body.id_presupuesto,req.body.presupuesto[i].producto.id_producto,req.body.presupuesto[i].cantidad,req.body.presupuesto[i].precio]).then(response=> {
57 | pool.end();
58 | res.sendStatus(200);
59 | }).catch((error) =>{
60 | pool.end();
61 | console.log(error);
62 | });
63 | }
64 | },
65 |
66 | deletePresupuesto(req,res){
67 | console.log("HOLA");
68 | var pool = new pg.Pool(config)
69 | pool.connect(function(err, client, done) {
70 | client.query("DELETE FROM presupuesto WHERE id_presupuesto=($1)",[req.params.id_presupuesto])
71 | .then(response => {
72 | pool.end();
73 | res.sendStatus(200);
74 | })
75 | .catch(error => {
76 | console.log(error);
77 | pool.end();
78 | res.json(error);
79 | })
80 | done()
81 | })
82 | },
83 | updatePresupuesto(req,res){
84 | var pool = new pg.Pool(config)
85 | pool.connect(function(err, client, done) {
86 | client.query("UPDATE presupuesto SET estado=($1) WHERE id_presupuesto=($2)", [req.body.estado,req.params.id_presupuesto])
87 | .then(response => {
88 | pool.end()
89 | res.sendStatus(200);
90 | })
91 | .catch(error => {
92 | pool.end();
93 | res.json(error);
94 | })
95 | done()
96 | })
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/server/controller/cliente.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var app = express();
3 | var pg = require('pg');
4 | var config = require('../database');
5 |
6 | module.exports = {
7 |
8 | getCliente(req,res){
9 | var pool = new pg.Pool(config)
10 | pool.connect(function(err, client, done) {
11 | client.query("SELECT * FROM cliente")
12 | .then(response => {
13 | pool.end()
14 | res.json(response.rows)
15 | })
16 | .catch(error => {
17 | pool.end()
18 | console.log(error.stack)
19 | })
20 | done()
21 | })
22 | },
23 |
24 | postCliente(req, res){
25 | const cliente = {
26 | dni: req.body.dni,
27 | nombre: req.body.nombre,
28 | apellido: req.body.apellido,
29 | direccion: req.body.direccion,
30 | telefono: req.body.telefono,
31 | mail: req.body.mail
32 | }
33 | var pool = new pg.Pool(config)
34 | pool.connect(function(err, client, done) {
35 | client.query("INSERT INTO cliente(dni,nombre,apellido,direccion,telefono,mail) VALUES($1,$2,$3,$4,$5,$6) RETURNING id_cliente",[cliente.dni,cliente.nombre,cliente.apellido,cliente.direccion,cliente.telefono,cliente.mail])
36 | .then(response => {
37 | pool.end();
38 | res.sendStatus(200);
39 | })
40 | .catch(error => {
41 | pool.end();
42 | console.log(error);
43 | res.send({ msg: 'Error del Servidor No se pudieron guardar los datos!' });
44 | })
45 | done()
46 | })
47 | },
48 |
49 | getIdCliente(req,res){
50 | var pool = new pg.Pool(config)
51 | pool.connect(function(err, client, done) {
52 | client.query('SELECT * FROM cliente WHERE id_cliente=($1)',[req.params.id_cliente])
53 | .then(response => {
54 | pool.end()
55 | res.json(response.rows)
56 | })
57 | .catch(error => {
58 | pool.end()
59 | console.log(error)
60 |
61 | })
62 | done()
63 | })
64 | },
65 |
66 | deleteCliente(req,res){
67 | var pool = new pg.Pool(config)
68 | pool.connect(function(err, client, done) {
69 | client.query("DELETE FROM cliente WHERE id_cliente=($1)",[req.params.id_cliente])
70 | .then(response => {
71 | pool.end()
72 | res.sendStatus(200);
73 | })
74 | .catch(error => {
75 | pool.end();
76 | console.log(error);
77 | if (error.code == 23503){
78 | res.send({ msg:"No se puede eliminar ya que el cliente pose una venta o una compra"});
79 | }else{
80 | res.send({ msg: "Error de servidor no se pueden guardar los datos"});
81 | }
82 | })
83 | done()
84 | })
85 | },
86 |
87 | updateCliente(req,res){
88 | const clienteAct = {
89 | dni: req.body.dni,
90 | nombre: req.body.nombre,
91 | apellido: req.body.apellido,
92 | direccion: req.body.direccion,
93 | telefono: req.body.telefono,
94 | mail: req.body.mail
95 | }
96 | var pool = new pg.Pool(config)
97 | pool.connect(function(err, client, done) {
98 | client.query("UPDATE cliente SET dni=($1), nombre=($2), apellido=($3), direccion=($4), telefono=($5), mail=($6) WHERE id_cliente=($7)", [clienteAct.dni,clienteAct.nombre,clienteAct.apellido,clienteAct.direccion,clienteAct.telefono,clienteAct.mail,req.params.id_cliente])
99 | .then(response => {
100 | pool.end();
101 | res.sendStatus(200);
102 | })
103 | .catch(error => {
104 | pool.end();
105 | console.log(error);
106 | res.send({ msg: 'Error del Servidor No se pudieron guardar los datos!' });
107 | })
108 | done();
109 | })
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/client/components/Administrar/Login.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
119 |
120 |
169 |
--------------------------------------------------------------------------------
/client/components/Usuario/HomeUsuario.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
13 |
14 |
15 |
38 |
39 |
40 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | Nuevo Usuario
51 |
52 |
53 |
54 |
55 |
120 |
121 |
215 |
--------------------------------------------------------------------------------
/server/controller/compra.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var app = express();
3 | var pg = require('pg');
4 | const {check, validationResult} = require('express-validator');
5 | var config = require('../database');
6 |
7 |
8 | module.exports = {
9 |
10 | getCompra(req,res){
11 | var pool = new pg.Pool(config)
12 | pool.connect(function(err, client, done) {
13 | client.query("SELECT pr.nombre, pr.apellido,to_char( c.fecha, 'DD-MM-YYYY') as fecha, c.total, c.id_compra FROM proveedor pr, compra c WHERE pr.id_proveedor = c.id_proveedor")
14 | .then(response => {
15 | pool.end();
16 | res.send(response.rows)
17 | })
18 | .catch(error => {
19 | pool.end();
20 | console.log(error.stack);
21 | })
22 | done()
23 | })
24 | },
25 |
26 |
27 | postCompra(req, res){
28 | const errors = validationResult(req);
29 | if (!errors.isEmpty()) {
30 | return res.json(errors.array());
31 | } else {
32 | const pool = new pg.Pool(config);
33 | pool.connect((err, client, done) => {
34 | const shouldAbort = err => {
35 | if (err) {
36 | res.sendStatus(500);
37 | console.error('ERROR EN LA TRANSACCION', err.stack)
38 | client.query('ROLLBACK', err => {
39 | if (err) {
40 | console.error('ERROR EN ROLLBACK', err.stack)
41 | }
42 | done()
43 | })
44 | }
45 | return !!err
46 | }
47 | client.query('BEGIN', err => {
48 | if (shouldAbort(err)) return
49 | client.query("INSERT INTO compra(id_proveedor,fecha,total) VALUES($1,$2,$3) RETURNING id_compra",[req.body.compra.proveedor.id_proveedor,req.body.compra.fecha,req.body.compra.total], (err, response) => {
50 | if (shouldAbort(err)) return
51 | for (var i=0 ; i < req.body.carritoCompra.length ; i++) {
52 | client.query("INSERT INTO compra_producto(id_compra,id_producto,cantidad,precio_unitario,precio_total) VALUES($1,$2,$3,$4,$5)",[response.rows[0].id_compra,req.body.carritoCompra[i].producto.id_producto,req.body.carritoCompra[i].cantidad,req.body.carritoCompra[i].precioUnitario,req.body.carritoCompra[i].precioTotal], (err, response) => {
53 | if (shouldAbort(err)) return
54 | client.query('COMMIT').then(response=>{
55 | res.sendStatus(200);
56 | }).catch(error=>{
57 | console.log(error);
58 | })
59 | done();
60 | })
61 | }
62 | })
63 | })
64 | })
65 | }
66 | },
67 |
68 |
69 | deleteCompra(req,res){
70 | var pool = new pg.Pool(config)
71 | pool.connect(function(err, client, done) {
72 | client.query("DELETE FROM compra WHERE id_compra=($1)",[req.params.id_compra])
73 | .then(response => {
74 | pool.end();
75 | res.sendStatus(200);
76 | })
77 | .catch(error => {
78 | pool.end();
79 | console.log(error)
80 | res.json(error);
81 | })
82 | done()
83 | })
84 | },
85 | getIdCompra(req,res){
86 | var pool = new pg.Pool(config)
87 | pool.connect(function(err, client, done) {
88 | client.query('SELECT V.id_compra,V.id_proveedor, V.fecha ,V.total FROM compra V WHERE V.id_compra=($1)', [req.params.id_compra])
89 | .then(response => {
90 | pool.end()
91 | res.json(response.rows)
92 | })
93 | .catch(error => {
94 | pool.end()
95 | console.log(error.stack)
96 | })
97 | done()
98 | })
99 |
100 | },
101 |
102 | getFechaCompra(req,res){
103 | var client = new pg.Client(config);
104 | client.connect();
105 | client.query('SELECT V.fecha FROM compra V WHERE V.id_compra=($1)', [req.params.id_compra])
106 | .then(response => {
107 | client.end()
108 | res.json(response.rows)
109 | })
110 | .catch(error => {
111 | client.end()
112 | console.log(error.stack)
113 | })
114 |
115 | },
116 |
117 | updateCompra(req, res){
118 | var pool = new pg.Pool(config)
119 | pool.connect(function(err, client, done) {
120 | client.query("UPDATE compra SET fecha = ($1) WHERE id_compra = ($2)",[req.body.fecha,req.params.id_compra])
121 | .then(response => {
122 | pool.end()
123 | })
124 | .catch(error => {
125 | pool.end()
126 | console.log(error.stack)
127 | })
128 | done()
129 | })
130 | },
131 |
132 |
133 | }
134 |
--------------------------------------------------------------------------------
/server/controller/venta.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var app = express();
3 | const {check, validationResult} = require('express-validator');
4 | var pg = require('pg');
5 | var config = require('../database');
6 |
7 |
8 | module.exports = {
9 | getVenta(req,res){
10 | var pool = new pg.Pool(config)
11 | pool.connect(function(err, client, done) {
12 | client.query("SELECT cl.nombre, cl.apellido,to_char( vt.fecha, 'DD-MM-YYYY') as fecha, vt.total, vt.id_venta FROM cliente cl, venta vt WHERE cl.id_cliente = vt.id_cliente")
13 | .then(response => {
14 | pool.end();
15 | res.json(response.rows)
16 | })
17 | .catch(error => {
18 | pool.end();
19 | console.log(error.stack)
20 | })
21 | done()
22 | })
23 | },
24 |
25 | postVenta(req, res){
26 | const errors = validationResult(req);
27 | if (!errors.isEmpty()) {
28 | return res.json(errors.array());
29 | } else {
30 | const pool = new pg.Pool(config)
31 | pool.connect((err, client, done) => {
32 | const shouldAbort = err => {
33 | if (err) {
34 | res.sendStatus(500);
35 | console.error('ERROR EN LA TRANSACCION', err.stack)
36 | client.query('ROLLBACK', err => {
37 | if (err) {
38 | console.error('ERROR EN ROLLBACK TRANSACCION', err.stack)
39 | }
40 | done()
41 | })
42 | }
43 | return !!err
44 | }
45 | client.query('BEGIN', err => {
46 | if (shouldAbort(err)) return
47 | client.query("INSERT INTO venta(id_cliente,fecha,total) VALUES($1,$2,$3) RETURNING id_venta",[req.body.venta.cliente,req.body.venta.fecha,req.body.venta.total], (err, response) => {
48 | if (shouldAbort(err)) return
49 | for (var i=0 ; i < req.body.carritoVenta.length ; i++) {
50 | client.query("INSERT INTO venta_producto(id_venta,id_producto,cantidad,precio) VALUES($1,$2,$3,$4)",[response.rows[0].id_venta,req.body.carritoVenta[i].producto.id_producto,req.body.carritoVenta[i].cantidad,req.body.carritoVenta[i].precio], (err, response) => {
51 | if (shouldAbort(err)) return
52 | client.query('COMMIT') .then(response=>{
53 | res.sendStatus(200);
54 | }).catch(error=>{
55 | console.log(error);
56 | })
57 | done();
58 | })
59 | }
60 | })
61 | })
62 | })
63 | }
64 | },
65 |
66 |
67 | deleteVenta(req,res){
68 | console.log("Peticion DELETE");
69 | var pool = new pg.Pool(config)
70 | pool.connect(function(err, client, done) {
71 | client.query("DELETE FROM venta WHERE id_venta=($1)",[req.params.id_venta])
72 | .then(response => {
73 | pool.end()
74 | res.sendStatus(200);
75 | })
76 | .catch(error => {
77 | pool.end();
78 | console.log(error);
79 | })
80 | done()
81 | })
82 | },
83 | getIdVenta(req,res){
84 | var pool = new pg.Pool(config)
85 | pool.connect(function(err, client, done) {
86 | client.query('SELECT V.id_venta,V.id_cliente, V.fecha ,V.total FROM venta V WHERE V.id_venta=($1)', [req.params.id_venta])
87 | .then(response => {
88 | pool.end()
89 | res.json(response.rows)
90 | })
91 | .catch(error => {
92 | pool.end()
93 | console.log(error.stack)
94 | })
95 | done()
96 | })
97 | },
98 |
99 | getFechaVenta(req,res){
100 | var client = new pg.Client(config);
101 | client.connect();
102 | client.query('SELECT V.fecha FROM venta V WHERE V.id_venta=($1)', [req.params.id_venta])
103 | .then(response => {
104 | client.end()
105 | res.json(response.rows)
106 | })
107 | .catch(error => {
108 | client.end()
109 | console.log(error.stack)
110 | })
111 |
112 | },
113 |
114 | updateVenta(req, res){
115 | var client = new pg.Client(config)
116 | client.connect();
117 | client.query("UPDATE venta SET fecha = ($1) WHERE id_venta = ($2)",[req.body.fecha,req.params.id_venta])
118 | .then(response => {
119 | client.end();
120 | res.sendStatus(200);
121 | })
122 | .catch(error => {
123 | client.end()
124 | console.log(error.stack)
125 | })
126 |
127 | },
128 |
129 |
130 | }
131 |
--------------------------------------------------------------------------------
/client/components/Compra/EditarCompra.vue:
--------------------------------------------------------------------------------
1 |
2 |
49 |
50 |
104 |
105 |
183 |
--------------------------------------------------------------------------------
/client/components/Venta/EditarVenta.vue:
--------------------------------------------------------------------------------
1 |
2 |
48 |
49 |
108 |
109 |
190 |
--------------------------------------------------------------------------------
/client/components/Cliente/Tabla.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
13 |
14 |
15 |
16 |
17 |
18 | Nuevo Cliente
19 |
20 |
21 |
22 |
26 |
27 |
28 |
32 |
33 |
34 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
115 |
116 |
214 |
215 |
216 |
--------------------------------------------------------------------------------
/server/controller/producto.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | const pg = require('pg')
3 | var config = require('../database');
4 |
5 | module.exports = {
6 |
7 | getProducto(req,res){
8 | var pool = new pg.Pool(config)
9 | pool.connect(function(err, client, done) {
10 | client.query("SELECT * FROM producto")
11 | .then(response => {
12 | pool.end()
13 | res.json(response.rows)
14 | })
15 | .catch(error => {
16 | pool.end()
17 | console.log(error.stack)
18 | })
19 | done()
20 | })
21 | },
22 |
23 | getProductoRepuesto(req,res){
24 | var pool = new pg.Pool(config)
25 | pool.connect(function(err, client, done) {
26 | client.query("SELECT * FROM producto WHERE tipo_producto = 'Repuesto' ")
27 | .then(response => {
28 | pool.end()
29 | res.json(response.rows)
30 | })
31 | .catch(error => {
32 | pool.end()
33 | console.log(error.stack)
34 | })
35 | done()
36 | })
37 | },
38 |
39 | getProductoStock(req,res){
40 | var pool = new pg.Pool(config)
41 | pool.connect()
42 | .then(client => {
43 | return client.query("SELECT * FROM producto WHERE stock >= 1 AND tipo_producto <>'Repuesto' ")
44 | .then(response => {
45 | pool.end();
46 | res.json(response.rows)
47 | })
48 | .catch(error => {
49 | pool.end();
50 | console.log(error.stack)
51 | })
52 | })
53 | },
54 |
55 | getProductoCompra(req,res){
56 | var pool = new pg.Pool(config)
57 | pool.connect()
58 | .then(client => {
59 | return client.query("SELECT * FROM producto WHERE tipo_producto <>'Para Reparacion' ")
60 | .then(response => {
61 | pool.end();
62 | res.json(response.rows)
63 | })
64 | .catch(error => {
65 | pool.end();
66 | console.log(error.stack)
67 | })
68 | })
69 | },
70 |
71 | getProductoVenta(req,res){
72 | var pool = new pg.Pool(config)
73 | pool.connect()
74 | .then(client => {
75 | return client.query("SELECT * FROM producto WHERE stock >= 1 AND tipo_producto <>'Para Reparacion' ")
76 | .then(response => {
77 | pool.end();
78 | res.json(response.rows)
79 | })
80 | .catch(error => {
81 | pool.end();
82 | console.log(error.stack)
83 | })
84 | })
85 | },
86 |
87 | getProductoReparar(req,res){
88 | var pool = new pg.Pool(config)
89 | pool.connect()
90 | .then(client => {
91 | return client.query("SELECT * FROM producto WHERE tipo_producto = 'Para Reparacion' ")
92 | .then(response => {
93 | pool.end();
94 | res.json(response.rows)
95 | })
96 | .catch(error => {
97 | pool.end();
98 | console.log(error.stack)
99 | })
100 | })
101 | },
102 |
103 | postProducto(req, res){
104 | const producto = {
105 | modelo:req.body.modelo,
106 | marca:req.body.marca,
107 | descripcion:req.body.descripcion,
108 | tipoProducto:req.body.tipoProducto,
109 | stock:req.body.stock,
110 | precio:req.body.precio
111 | }
112 | var pool = new pg.Pool(config)
113 | pool.connect(function(err, client, done) {
114 | client.query("INSERT INTO producto(modelo,marca,descripcion,tipo_producto,stock,precio) VALUES($1,$2,$3,$4,$5,$6) RETURNING id_producto",[producto.modelo,producto.marca,producto.descripcion,producto.tipoProducto,
115 | producto.stock,producto.precio])
116 | .then(response => {
117 | pool.end();
118 | res.sendStatus(200);
119 | })
120 | .catch(error => {
121 | pool.end();
122 | console.log(error)
123 | res.send({ msg: 'Error del Servidor No se pudieron guardar los datos!' });
124 | })
125 | done()
126 | })
127 | },
128 |
129 | getIdProducto(req,res){
130 | var pool = new pg.Pool(config)
131 | pool.connect()
132 | .then(client => {
133 | return client.query('SELECT * FROM producto WHERE id_producto=($1)', [req.params.id_producto])
134 | .then(response => {
135 | pool.end()
136 | res.json(response.rows)
137 | })
138 | .catch(error => {
139 | pool.end()
140 | console.log(error.stack)
141 | })
142 | })
143 | },
144 |
145 | deleteProducto(req,res){
146 | console.log("Hola");
147 | var pool = new pg.Pool(config)
148 | pool.connect()
149 | .then(client => {
150 | return client.query("DELETE FROM producto WHERE id_producto=($1)",[req.params.id_producto])
151 | .then(response => {
152 | pool.end();
153 | res.sendStatus(200);
154 | })
155 | .catch(error => {
156 | pool.end();
157 | console.log(error);
158 | if (error.code == 23503){
159 | res.send({ msg:"No se puede eliminar ya que el producto esta en una venta o una compra"});
160 | }else{
161 | res.send({ msg: "Error de servidor no se pueden actualizar los datos"});
162 | }
163 | })
164 | })
165 | },
166 |
167 | updateProducto(req,res){
168 | const productoAct = {
169 | modelo:req.body.modelo,
170 | marca:req.body.marca,
171 | descripcion:req.body.descripcion,
172 | tipoProducto:req.body.tipoProducto,
173 | stock:req.body.stock,
174 | precio:req.body.precio
175 | }
176 | var pool = new pg.Pool(config)
177 | pool.connect().then(client => {
178 | return client.query("UPDATE producto SET modelo=($1), marca=($2), descripcion=($3), tipo_producto=($4), stock=($5), precio=($6) WHERE id_producto=($7)",[productoAct.modelo,productoAct.marca,productoAct.descripcion,productoAct.tipoProducto,productoAct.stock,productoAct.precio, req.params.id_producto])
179 | .then(response => {
180 | pool.end();
181 | res.sendStatus(200);
182 | })
183 | .catch(error => {
184 | pool.end();
185 | console.log(error)
186 | res.send({ msg: 'Error del Servidor No se pudieron guardar los datos!' });
187 | })
188 | })
189 | }
190 | }
191 |
--------------------------------------------------------------------------------
/client/components/Usuario/NuevoUsuario.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
14 |
15 |
16 |
17 | -
18 | {{ error }}
19 |
20 |
21 |
22 |
23 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
135 |
136 |
222 |
--------------------------------------------------------------------------------
/client/components/Usuario/EditarUsuario.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
14 |
15 |
16 |
17 | -
18 | {{ error }}
19 |
20 |
21 |
22 |
23 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
117 |
118 |
269 |
--------------------------------------------------------------------------------
/client/routes.js:
--------------------------------------------------------------------------------
1 | import HomeCliente from './components/Cliente/HomeCliente.vue'
2 | import NuevoCliente from './components/Cliente/NuevoCliente.vue'
3 | import Login from './components/Administrar/Login.vue'
4 | import Home from './components/Administrar/Home.vue'
5 | import HomeProducto from './components/Producto/HomeProducto'
6 | import NuevoProducto from './components/Producto/NuevoProducto.vue'
7 | import HomeVenta from './components/Venta/HomeVenta.vue'
8 | import NuevaVenta from './components/Venta/NuevaVenta.vue'
9 | import EditarVenta from './components/Venta/EditarVenta.vue'
10 | import HomeProveedor from './components/Proveedor/HomeProveedor.vue'
11 | import NuevoProveedor from './components/Proveedor/NuevoProveedor.vue'
12 | import EditarProveedor from './components/Proveedor/EditarProveedor.vue'
13 | import NuevoArreglo from './components/Arreglo/NuevoArreglo.vue'
14 | import HomeArreglo from './components/Arreglo/HomeArreglo.vue'
15 | import HomeCompra from './components/Compra/HomeCompra.vue'
16 | import NuevaCompra from './components/Compra/NuevaCompra.vue'
17 | import EditarCompra from './components/Compra/EditarCompra.vue'
18 | import HomePresupuesto from './components/Presupuesto/HomePresupuesto.vue'
19 | import NuevoPresupuesto from './components/Presupuesto/NuevoPresupuesto.vue'
20 | import VerPresupuesto from './components/Presupuesto/VerPresupuesto.vue'
21 | import NotFound from './components/Administrar/error404.vue'
22 | import HomeReparacion from './components/Reparacion/HomeReparacion.vue'
23 | import EditarReparacion from './components/Reparacion/EditarReparacion.vue'
24 | import HomeUsuario from './components/Usuario/HomeUsuario.vue'
25 | import NuevoUsuario from './components/Usuario/NuevoUsuario.vue'
26 | import EditarUsuario from './components/Usuario/EditarUsuario.vue'
27 | import Vue from 'vue'
28 | import firebase from 'firebase'
29 | import VueRouter from 'vue-router'
30 | Vue.use(VueRouter);
31 | Vue.use(firebase);
32 | import axios from 'axios'
33 |
34 |
35 |
36 | const rutas = new VueRouter({
37 |
38 | routes: [
39 | {
40 | path:'/Home',
41 | name: 'Home',
42 | component:Home,
43 | },
44 | {
45 | path:'/HomeUsuario',
46 | name:'HomeUsuario',
47 | component: HomeUsuario,
48 | },
49 | {
50 | path:'/NuevoUsuario',
51 | name:'NuevoUsuario',
52 | component: NuevoUsuario,
53 | },
54 | {
55 | path:'/EditarUsuario/:id',
56 | name:'EditarUsuario',
57 | component: EditarUsuario
58 | },
59 | {
60 | path:'/HomeCliente',
61 | name:'HomeCliente',
62 | component: HomeCliente,
63 | },
64 | {
65 | path:'/NuevoCliente',
66 | name:'NuevoCliente',
67 | component:NuevoCliente
68 | },
69 | {
70 | path:'/NuevoCliente/:id',
71 | name:'NuevoCliente',
72 | component:NuevoCliente
73 | },
74 | {
75 | path:'/Login',
76 | component:Login
77 | },
78 | {
79 | path: '/HomeProducto',
80 | name:'HomeProducto',
81 | component: HomeProducto,
82 | },
83 | {
84 | path:'/NuevoProducto',
85 | name: 'NuevoProducto',
86 | component: NuevoProducto
87 | },
88 | {
89 | path:'/NuevoProducto/:id',
90 | name:'NuevoProducto',
91 | component:NuevoProducto
92 | },
93 | {
94 | path: '/HomeProveedor',
95 | name:'HomeProveedor',
96 | component: HomeProveedor,
97 | },
98 | {
99 | path: '/NuevoProveedor',
100 | name: 'NuevoProveedor',
101 | component: NuevoProveedor
102 | },
103 | {
104 | path: '/EditarProveedor/:id',
105 | name:'EditarProveedor',
106 | component: EditarProveedor
107 | },
108 | {
109 | path:'/HomeVenta',
110 | name:'HomeVenta',
111 | component: HomeVenta
112 | },
113 | {
114 | path:'/NuevaVenta',
115 | name: 'NuevaVenta',
116 | component: NuevaVenta
117 | },
118 | {
119 | path:'/EditarVenta/:id',
120 | name: 'EditarVenta',
121 | component: EditarVenta
122 | },
123 | {
124 | path:'/HomeCompra',
125 | name:'HomeCompra',
126 | component: HomeCompra
127 | },
128 | {
129 | path:'/NuevaCompra',
130 | name:'NuevaCompra',
131 | component: NuevaCompra
132 | },
133 | {
134 | path:'/EditarCompra/:id',
135 | name:'EditarCompra',
136 | component: EditarCompra
137 | },
138 | {
139 | path:'/HomeArreglo',
140 | name:'HomeArreglo',
141 | component: HomeArreglo
142 | },
143 | {
144 | path:'/NuevoArreglo',
145 | name:'NuevoArreglo',
146 | component: NuevoArreglo
147 | },
148 | {
149 | path:'/HomePresupuesto',
150 | component: HomePresupuesto
151 | },
152 | {
153 | path:'/NuevoPresupuesto/:id',
154 | name:'NuevoPresupuesto',
155 | component: NuevoPresupuesto
156 | },
157 | {
158 | path:'/VerPresupuesto/:id',
159 | name:'VerPresupuesto',
160 | component: VerPresupuesto
161 | },
162 | {
163 | path:'/HomeReparacion',
164 | component: HomeReparacion
165 | },
166 | {
167 | path:'/EditarReparacion/:id',
168 | name:'EditarReparacion',
169 | component: EditarReparacion
170 | },
171 | {
172 | path: '*',
173 | component: NotFound,
174 | }
175 | ]
176 | })
177 |
178 |
179 | rutas.beforeEach((to, from, next) => {
180 | let usuario = firebase.auth().currentUser;
181 | console.log(usuario);
182 | let autorizacion = to.matched.some(record => record.meta.autenticado);
183 | if(to.path != '/Login' && to.path != '/Registrar' && to.path != '*') {
184 | if (autorizacion && !usuario){
185 | next(false);
186 | }else if(!autorizacion && usuario){
187 | axios.get('http://localhost:3000/usuario/'+usuario.uid).then((response) =>{
188 | var perfil = response.data[0].perfil;
189 | if (perfil == 'ADMINISTRADOR'){
190 | next();
191 | }else if(perfil == 'REPARADOR') {
192 | if (to.path == '/HomeVenta' || to.path == '/HomeCompra' || to.path == '/NuevaCompra' || to.path == '/NuevaVenta' || to.path == '/HomeUsuario' || to.path == '/NuevoUsuario' ){
193 | next(false);
194 | }else {
195 | next();
196 | }
197 | }
198 | })
199 | }
200 | }else{
201 | next();
202 | }
203 |
204 | })
205 |
206 | export default rutas;
207 |
--------------------------------------------------------------------------------
/client/components/Reparacion/EditarReparacion.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
15 |
16 |
17 |
18 | -
19 | {{ error }}
20 |
21 |
22 |
23 |
24 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
149 |
150 |
236 |
--------------------------------------------------------------------------------
/client/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
64 |
65 |
66 |
67 |
68 |
139 |
211 |
--------------------------------------------------------------------------------
/client/assets/imagenPDF.js:
--------------------------------------------------------------------------------
1 | export let imgData = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATIAAACkCAIAAACb7DV4AAAACXBIWXMAAAsTAAALEwEAmpwYAAAYkElEQVR4nO3deVwTZ/4H8O9MQhIwkaPKHVCQVasIq1Z9aSu24lkXEKurZcXW2suiP1dctZat2Oqq1drqehVX15PWulZq1UrR18rLg+JRpYiAQFgOieLJTSDM8/sjlsZkEkIImUn4vl/+ITPPPM8zox9m5pmLIoRAh6lUqsLCwoqKitra2tra2paWlo7XiZBFUBQlFoulUqmLi0tAQIC3tzfXPWqb0Owl1Wp1enp6SkpKampqUVERwzAW7BZCnUQmkw0ZMiQiIiIqKqp3795cd8cA0k4Mw6SkpMTExLi6unLdd4Q6ZNCgQX//+98VCkV7U9DZ2hfLM2fODBkyhOuNiZAlOTg4LFiwoLKyspMyZgZTY3n9+vXx48dzvQER6iwymeyTTz6pra3t1LyZqO1YMgzz8ccfUxTF9XZDqNP5+fn98ssvVgiecW3Esra2Njo6mutthZD1ODk5HTlyxDrxM8RYLEtKSkJDQ7neSghZG0VRK1euZBjGajnUYTCWBQUFHh4eXG8fhDjzxhtvWDOK2thj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0TbsSSE3L59OywsjOvNhVDncnJySkxMVKvVnZ26NpkUS42TJ08GBwdzvekQsjyBQPDOO+9UVFR0XtLapR2xJIS0tLTs3bu3V69eXG9GhCyDpuno6GhuzyT1tS+WGgzDXLlyJSEhAXeeyEY5OjpGRkbu2bOnsrLS4qHqOIoQ0pHVUygUP/30061bt/Lz8ysqKmpqampra9VqtaU2H0IdRFGURCKRyWTOzs6BgYF9+/YdOnRoeHi4Zd9ablkdjSVCyOL+HyQgPzNJ/5zWAAAAAElFTkSuQmCC";
2 |
--------------------------------------------------------------------------------
/client/components/Reparacion/HomeReparacion.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
51 |
52 |
53 |
57 |
58 |
59 |
63 |
64 |
65 |
66 |
67 |
187 |
258 |
--------------------------------------------------------------------------------
/client/components/Presupuesto/HomePresupuesto.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
14 |
15 |
16 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
56 |
57 |
58 |
59 |
60 |
64 | | Marca |
65 | Modelo |
66 | Cantidad |
67 | Precio |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | Nuevo Arreglo
96 |
97 |
98 |
102 |
103 |
104 |
108 |
109 |
110 |
114 |
115 |
116 |
117 |
118 |
119 |
193 |
194 |
269 |
--------------------------------------------------------------------------------
/client/components/Arreglo/NuevoArreglo.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
15 |
16 |
17 |
18 |
19 | -
20 | {{ error }}
21 |
22 |
23 |
24 |
25 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
177 |
178 |
246 |
--------------------------------------------------------------------------------
/client/components/Presupuesto/VerPresupuesto.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
16 |
17 |
18 |
19 |
20 |
21 | Arreglo:
22 | {{presupuesto.arreglo}}
23 |
24 |
25 | Observacion:
26 | {{presupuesto.observacion}}
27 |
28 |
29 | Precio Total:
30 | {{presupuesto.precio_total}}$
31 |
32 |
33 | Mano de Obra:
34 | {{presupuesto.precio_mano_obra}}$$
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | Lista de Repuestos Utilizados:
46 |
47 |
48 |
49 |
50 |
51 |
52 | | Producto |
53 | Cantidad |
54 | Precio |
55 |
56 |
57 |
58 |
59 | | {{item.modelo}} |
60 | {{item.cantidad}} |
61 | {{item.precio}} |
62 |
63 |
64 | |
65 | |
66 | |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | Estado del Presupuesto:
78 |
79 |
101 |
102 |
103 |
104 |
105 |
106 |
203 |
204 |
325 |
--------------------------------------------------------------------------------
/client/components/Arreglo/HomeArreglo.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
13 |
14 |
15 |
40 |
41 |
42 |
45 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | Nuevo Arreglo
56 |
57 |
58 |
62 |
63 |
64 |
68 |
69 |
70 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
242 |
243 |
318 |
--------------------------------------------------------------------------------