diff --git a/APP/components/Formularios/Fingreso.vue b/APP/components/Formularios/Fingreso.vue new file mode 100644 index 0000000..91503bf --- /dev/null +++ b/APP/components/Formularios/Fingreso.vue @@ -0,0 +1,83 @@ + + + + + \ No newline at end of file diff --git a/APP/components/Formularios/Fpresupuesto.vue b/APP/components/Formularios/Fpresupuesto.vue new file mode 100644 index 0000000..c977975 --- /dev/null +++ b/APP/components/Formularios/Fpresupuesto.vue @@ -0,0 +1,70 @@ + + + + + \ No newline at end of file diff --git a/APP/components/Layout/DashboardNavbar.vue b/APP/components/Layout/DashboardNavbar.vue index 4a767d2..69e1e0d 100755 --- a/APP/components/Layout/DashboardNavbar.vue +++ b/APP/components/Layout/DashboardNavbar.vue @@ -16,11 +16,11 @@ - {{ routeName }} + diff --git a/APP/components/Navbar/BaseNav.vue b/APP/components/Navbar/BaseNav.vue index 1313685..65a16e6 100644 --- a/APP/components/Navbar/BaseNav.vue +++ b/APP/components/Navbar/BaseNav.vue @@ -120,6 +120,10 @@ export default { return this.$slots.default; } }, + mounted() { + this.$store.dispatch("getCategorias"); + this.$store.dispatch("getMetodos"); + }, methods: { toggleMenu() { this.$emit('change', !this.show); diff --git a/APP/nuxt.config.js b/APP/nuxt.config.js index a86a6b4..1a64bda 100644 --- a/APP/nuxt.config.js +++ b/APP/nuxt.config.js @@ -59,7 +59,8 @@ export default { // Axios module configuration (https://go.nuxtjs.dev/config-axios) axios: { - baseURL: "http://127.0.0.1:4000/api" + //baseURL: "http://192.168.1.111:4000/api" + baseURL:"http://localhost:4000/api" }, /* diff --git a/APP/pages/compras.vue b/APP/pages/compras.vue index 52be63d..4e909d7 100644 --- a/APP/pages/compras.vue +++ b/APP/pages/compras.vue @@ -34,6 +34,7 @@ prop="categoria" label="Categoria" sortable + >
@@ -107,14 +108,23 @@ export default { openForm: false, }; }, - mounted() { + mounted() { + + + + // this.$store.dispatch("getCategorias"); + //this.$store.dispatch("getMetodos"); this.newCompra.fecha = this.$store.state.fecha; - this.$store.dispatch("getCategorias"); - this.$store.dispatch("getMetodos"); this.categorias = this.$store.state.categorias; this.metodos_pago = this.$store.state.metodos_de_pago; + this.getCompras(); + + + + }, + methods: { cell(row, column, cellValue, index) { @@ -203,9 +213,10 @@ export default { this.newCompra.categoria = ""; this.isUpdate = false; }, - getIcon(name) { - const found = this.$store.state.categorias.find((ic) => ic.name === name); - console.log(found); + getIcon(row, column, cellValue, index) { + const found = this.$store.state.categorias.filter((ic) => ic.name === cellValue)[0]; + //console.log(found); + return `${cellValue}` }, formatMoneda(dato) { diff --git a/APP/pages/ingresos.vue b/APP/pages/ingresos.vue index 48882de..f71d235 100644 --- a/APP/pages/ingresos.vue +++ b/APP/pages/ingresos.vue @@ -1,17 +1,258 @@ diff --git a/APP/pages/presupuesto.vue b/APP/pages/presupuesto.vue index 6012f67..ecc099d 100644 --- a/APP/pages/presupuesto.vue +++ b/APP/pages/presupuesto.vue @@ -1,14 +1,177 @@ \ No newline at end of file diff --git a/APP/static/favicdon.ico b/APP/static/favicdon.ico new file mode 100644 index 0000000..3632d0c Binary files /dev/null and b/APP/static/favicdon.ico differ diff --git a/APP/static/favicon.ico b/APP/static/favicon.ico index 3632d0c..a5ad53d 100644 Binary files a/APP/static/favicon.ico and b/APP/static/favicon.ico differ diff --git a/APP/static/favicon.png b/APP/static/favicon.png index 7d8b7d0..986dd5d 100644 Binary files a/APP/static/favicon.png and b/APP/static/favicon.png differ diff --git a/APP/static/icon.png b/APP/static/icon.png deleted file mode 100644 index 7d8b7d0..0000000 Binary files a/APP/static/icon.png and /dev/null differ diff --git a/APP/static/img/apple-icon.png b/APP/static/img/apple-icon.png old mode 100755 new mode 100644 index 0577a33..986dd5d Binary files a/APP/static/img/apple-icon.png and b/APP/static/img/apple-icon.png differ diff --git a/APP/static/img/apple-icone.png b/APP/static/img/apple-icone.png new file mode 100755 index 0000000..0577a33 Binary files /dev/null and b/APP/static/img/apple-icone.png differ diff --git a/APP/store/index.js b/APP/store/index.js index 9bf7e20..f99843f 100644 --- a/APP/store/index.js +++ b/APP/store/index.js @@ -62,7 +62,6 @@ export const actions = { this.$axios.get("/categoria", axiosHeader) .then(res => { - this.commit("setCategorias", res.data.data); @@ -91,4 +90,5 @@ export const actions = { -} \ No newline at end of file +} + diff --git a/index.js b/index.js index 5e18514..ccb6a47 100644 --- a/index.js +++ b/index.js @@ -26,6 +26,7 @@ app.use(cors()); //Rutas app.use('/api',require('./routes/users')); app.use('/api',require('./routes/compras')) +app.use('/api',require('./routes/ingresos')) app.use('/api',require('./routes/categorias')) app.use('/api',require('./routes/metodos_pago')) app.disable('x-powered-by'); diff --git a/routes/ingresos.js b/routes/ingresos.js new file mode 100644 index 0000000..f828757 --- /dev/null +++ b/routes/ingresos.js @@ -0,0 +1,73 @@ +const router = require("express").Router(); +const Ingreso = require("../models/ingresos"); +const { checkAuth } = require("../middlewares/authentication"); + + +router.get("/ingreso", checkAuth, async (req, res) => { + var Ingresos; + Ingresos = await Ingreso.find({ user: req.userData._id }).sort({ + fecha: "desc", + }); + + return res.send( + { + status:"ok", + data:Ingresos + } + ) + }); + + router.post("/ingreso", checkAuth, async (req, res) => { + const { fecha, detalle, valor} = req.body; + const newIngreso = new Ingreso({ + fecha, + detalle, + valor + }); + + console.log(newIngreso) + newIngreso.user = req.userData._id; + await newIngreso.save(); + + res.json({ + status:"OK" + }) + + + }); + + + router.put("/ingreso", checkAuth, async (req, res) => { + const { _id, fecha, detalle, valor } = req.body; + const Ingreso_edit = await Ingreso.findOne({ _id: _id }); + await Ingreso_edit.updateOne({ fecha, detalle, valor}); + + + res.json({ + status:"OK" + }) + + + }); + + + + router.delete("/ingreso", checkAuth, async (req, res) => { + + try{ + const userId = req.userData._id; + const id = req.query.id; + + const resultado = await Ingreso.deleteOne({user:userId,_id:id}); + + return res.json({status:"ok",data: resultado}) + + } + catch(error){ + console.log(error); + return res.status(500).json({status:"fail",error:error}) + } + }); + + + module.exports = router; \ No newline at end of file