diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue
index 4551b48..20f99ef 100644
--- a/src/components/NavBar.vue
+++ b/src/components/NavBar.vue
@@ -104,6 +104,7 @@
{ title: 'Cuadres de tarro', route: '/cuadres_de_tarro', icon: 'mdi-chart-bar'},
{ title: 'CSV Tryton', route: '/ventas_para_tryton', icon: 'mdi-file-table'},
{ title: 'Compra adm', route: '/compra_admin', icon: 'mdi-cart'},
+ { title: 'Gestión de Productos', route: '/admin/products', icon: 'mdi-package-variant'},
{ title: 'Actualizar Productos De Tryton', route: '/sincronizar_productos_tryton', icon: 'trytonIcon'},
{ title: 'Actualizar Clientes De Tryton', route: '/sincronizar_clientes_tryton', icon: 'trytonIcon'},
{ title: 'Actualizar Ventas Tryton', route: '/sincronizar_ventas_tryton', icon: 'trytonIcon'}
diff --git a/src/components/ProductsManagement.vue b/src/components/ProductsManagement.vue
new file mode 100644
index 0000000..f35b4c1
--- /dev/null
+++ b/src/components/ProductsManagement.vue
@@ -0,0 +1,262 @@
+
+
+
+
+
+ Gestión de Productos
+
+
+
+
+ Inactivos
+ Activos
+ Todos
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ selected.length }} producto(s) seleccionado(s)
+
+
+
+
+ Activar seleccionados
+
+
+
+
+ Desactivar seleccionados
+
+
+
+
+
+ Activar seleccionados
+
+
+ Desactivar seleccionados
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${{ Number(item.price).toLocaleString("es-CO") }}
+
+
+
+
+
+ {{ item.active ? "Activo" : "Inactivo" }}
+
+
+
+
+
+
+
+
+
+
+
+ No hay productos para mostrar
+
+
+
+
+
+
+
+
+
+ {{ snackbar.message }}
+
+ Cerrar
+
+
+
+
+
+
+
+
diff --git a/src/pages/admin/products.vue b/src/pages/admin/products.vue
new file mode 100644
index 0000000..984924d
--- /dev/null
+++ b/src/pages/admin/products.vue
@@ -0,0 +1,10 @@
+
+
+
+
+
diff --git a/src/router/index.js b/src/router/index.js
index ea1d1ed..7b1a181 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -19,6 +19,7 @@ const ADMIN_ROUTES = [
'/cuadres_de_tarro',
'/compra_admin',
'/cuadrar_tarro',
+ '/admin/products',
]
const router = createRouter({
diff --git a/src/services/api.js b/src/services/api.js
index 203c021..113f1ce 100644
--- a/src/services/api.js
+++ b/src/services/api.js
@@ -7,8 +7,12 @@ class Api {
return this.apiImplementation.getCustomers();
}
- getProducts() {
- return this.apiImplementation.getProducts();
+ getProducts(active = 'all') {
+ return this.apiImplementation.getProducts(active);
+ }
+
+ updateProduct(productId, data) {
+ return this.apiImplementation.updateProduct(productId, data);
}
getPaymentMethods() {
diff --git a/src/services/django-api.js b/src/services/django-api.js
index 3544e25..05a10f8 100644
--- a/src/services/django-api.js
+++ b/src/services/django-api.js
@@ -14,16 +14,31 @@ class DjangoApi {
return http.post(url, payload).then((r) => r.data);
}
+ patchRequest(url, payload) {
+ return http.patch(url, payload).then((r) => r.data);
+ }
+
getCustomers() {
const url = this.base + "/don_confiao/api/customers/";
return this.getRequest(url);
}
- getProducts() {
- const url = this.base + "/don_confiao/api/products/";
+ getProducts(active = 'all') {
+ let url = this.base + "/don_confiao/api/products/";
+
+ // Agregar query parameter según filtro
+ if (active !== 'all') {
+ url += `?active=${active}`;
+ }
+
return this.getRequest(url);
}
+ updateProduct(productId, data) {
+ const url = this.base + `/don_confiao/api/products/${productId}/`;
+ return this.patchRequest(url, data);
+ }
+
getPaymentMethods() {
const url =
this.base + "/don_confiao/payment_methods/all/select_format";