Browse Source

[FIX] variables names in cards view

Gogs 7 years ago
parent
commit
29679ecd0b

+ 10 - 5
src/components/CustomerCard.vue

@@ -1,19 +1,24 @@
 <template lang="pug">
-    .customer-card
-        h2.customer-name {{ data.name }}
-        img.customer-photo(:src="this.data.image_medium ? 'data:image/png;base64,' + this.data.image_medium : '/base/static/src/img/avatar.png'")
+    .customer-card(@click="selectCustomer(item)")
+        h2.customer-name {{ item.name }}
+        img.customer-photo(:src="this.item.image_medium ? 'data:image/png;base64,' + this.item.image_medium : '/base/static/src/img/avatar.png'")
 </template>
 
 <script>
+    import { mapActions } from 'vuex'
+
     export default {
         props: {
-            data: {
+            item: {
                 type: Object,
                 default: () => {
                     return {}
                 }
             }
-        }
+        },
+        methods: mapActions([
+            'selectCustomer'
+        ])
     }
 </script>
 

+ 1 - 1
src/components/CustomersGrid.vue

@@ -1,6 +1,6 @@
 <template lang="pug">
     .customers-grid
-        customer-card(v-for="customer in customers" :key="customer" :data="customer")
+        customer-card(v-for="customer in customers" :key="customer" :item="customer")
 </template>
 
 <script>

+ 1 - 1
src/components/ProductCard.vue

@@ -36,7 +36,7 @@
             // FIXME
             productImage() {
                 let img = new Image()
-                img.src = this.data.image_medium ? 'data:image/png;base64,' + this.data.image_medium : '/web/static/src/img/placeholder.png'
+                img.src = this.item.image_medium ? 'data:image/png;base64,' + this.item.image_medium : '/web/static/src/img/placeholder.png'
                 return img.src
             }
         },

+ 2 - 1
src/store/modules/customers.js

@@ -46,7 +46,8 @@ const actions = {
         })
     },
     selectCustomer({ commit }, payload) {
-        commit('selectCustomer', payload)
+        // commit('selectCustomer', payload)
+        console.log(payload)
     },
     filterCustomers({ commit }, payload) {
         commit('applyCustomersFilter', payload)