Browse Source

[FIX] customer creation

Gogs 7 years ago
parent
commit
0b4b5b3846

+ 1 - 1
src/App.vue

@@ -93,7 +93,7 @@
                         .pos-step
                             width: 100%
                             height: 100%
-                            background: #fff
+                            background: $app-bg-color
             .wizard-card-footer
                 width: 100%
                 height: 50px

+ 6 - 3
src/components/forms/CustomerForm.vue

@@ -15,11 +15,11 @@
                 input.form-input(:class="'form-input-' + type" :value="customer.ruc || ''" v-model='customer.ruc' :readonly="mode === 'details'")
             .form-item(:class="'form-item-' + type")
                 label.form-label(:class="'form-label-' + type") Celular
-                input.form-input(:class="'form-input-' + type" :value="customer.phone || ''" v-model='customer.phone' :readonly="mode === 'details'")
+                input.form-input(:class="'form-input-' + type" :value="customer.mobile || ''" v-model='customer.mobile' :readonly="mode === 'details'")
             div(v-if="mode === 'details'")
                 .form-item(:class="'form-item-' + type")
                     label.form-label(:class="'form-label-' + type") Teléfono
-                    input.form-input(:class="'form-input-' + type" :value="customer.mobile || ''" readonly)
+                    input.form-input(:class="'form-input-' + type" :value="customer.phone || ''" readonly)
                 .form-item(:class="'form-item-' + type")
                     label.form-label(:class="'form-label-' + type") Email
                     input.form-input(:class="'form-input-' + type" :value="customer.email || ''" readonly)
@@ -30,7 +30,7 @@
                     label.form-label(:class="'form-label-' + type") Créditos
                     input.form-input(:class="'form-input-' + type" :value="customer.credit || 0" readonly)
             .form-actions(v-if="mode === 'form'")
-                button.form-action(@click='onAccept') Aceptar
+                button.form-action(@click='onAccept' :disabled='isValid() === false') Aceptar
                 button.form-action(@click='onCancel') Cancelar
 </template>
 
@@ -70,6 +70,9 @@
             }
         },
         methods: {
+            isValid() {
+                return !!this.customer.name && !!this.customer.ruc && !!this.customer.mobile
+            },
             onAccept() {
                 this.$emit('onAccept', this.customer)
             },

+ 3 - 2
src/components/forms/ProductForm.vue

@@ -14,7 +14,7 @@
                 label.form-label Código de barras
                 input.form-input(v-model='product.ean13')
             .form-actions
-                button.form-action(@click='onAccept') Aceptar
+                button.form-action(@click='onAccept' disabled='!isValid') Aceptar
                 button.form-action(@click='onCancel') Cancelar
 </template>
 
@@ -30,7 +30,8 @@
                     name: '',
                     price: 0,
                     ean13: ''
-                }
+                },
+                isValid: false
             }
         },
         methods: {

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

@@ -16,7 +16,8 @@ import {
     CREATE_CUSTOMER, 
     RECEIVE_CUSTOMER, 
     SELECT_CUSTOMER, 
-    RESET_CUSTOMER
+    RESET_CUSTOMER,
+    NOTIFY
 } from '@/constants/actionTypes'
 
 const initialState = {