Browse Source

[ADD] notification on state change check

Gogs 7 years ago
parent
commit
8f2fcb0fda
2 changed files with 13 additions and 1 deletions
  1. 10 1
      src/App.vue
  2. 3 0
      src/store/actions.js

+ 10 - 1
src/App.vue

@@ -56,13 +56,22 @@
         }),
         methods: {
             checkCart() {
+                if (!this.cartIsEmpty) {
+                    this.notify('Necesitas agregar productos al carrito para continuar')
+                }
+
                 return this.cartIsEmpty
             },
             checkCustomer() {
+                if (!this.hasSelectedCustomer) {
+                    this.notify('Necesitas seleccionar un cliente para continuar')
+                }
+
                 return this.hasSelectedCustomer
             },
             ...mapActions([
-                'fetchData'
+                'fetchData',
+                'notify'
             ])
         },
         mounted() {

+ 3 - 0
src/store/actions.js

@@ -1,4 +1,7 @@
 const actions = {
+    notify({ commit }, payload) {
+        openerp.web.notification.do_warn('Atención', payload)
+    },
     fetchData({ dispatch }) {
         let promises = [
             dispatch('fetchCompany'),