|
@@ -4,7 +4,7 @@ import * as Urls from '../constants/resourcePaths'
|
|
|
|
|
|
const state = {
|
|
|
currentMode: Modes.PURCHASE,
|
|
|
- currentState: States.NONE
|
|
|
+ currentState: States.NONE,
|
|
|
}
|
|
|
|
|
|
const getters = {
|
|
@@ -106,6 +106,31 @@ const actions = {
|
|
|
console.log(response)
|
|
|
}).catch(error => console.log(error))
|
|
|
},
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param {*} param0
|
|
|
+ */
|
|
|
+ checkSupplier({ getters, dispatch}) {
|
|
|
+ return !!getters.selectedSupplier || dispatch('notify', 'Necesitas seleccionar un proveedor para continuar')
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param {*} param0
|
|
|
+ */
|
|
|
+ checkCart({ getters, dispatch}) {
|
|
|
+ return !!getters.cartItems.length || dispatch('notify', 'Necesitar agregar producto al carrito para continuar')
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param {*} param0
|
|
|
+ */
|
|
|
+ checkAmountReceived({ getters, dispatch }) {
|
|
|
+ if (getters.paymentType == 'cash') {
|
|
|
+ return getters.initialPayment >= getters.cartTotal || dispatch('notify', 'El monto recibido no puede ser menor al monto a pagar')
|
|
|
+ } else {
|
|
|
+ return getters.initialPayment < getters.cartTotal || dispatch('notify', 'El monto recibido no puede ser igual o mayor al monto a pagar')
|
|
|
+ }
|
|
|
+ },
|
|
|
/**
|
|
|
*
|
|
|
* @param {*} param0
|