|
@@ -1,14 +1,30 @@
|
|
|
-import { INIT_PAYMENTS_PURCHASES_SUPPLIER } from '@/constants/actionTypes'
|
|
|
-import { SET_SUPPLIER, SET_LOADING_SUPPLIER }from '@/constants/mutationTypes'
|
|
|
+//Actions
|
|
|
+import {
|
|
|
+ INIT_PAYMENTS_PURCHASES_SUPPLIER,
|
|
|
+ FILTER_PAYMENTS_PURCHASES_SUPPLIER,
|
|
|
+ SELECT_PAYMENTS_PURCHASES_SUPPLIER
|
|
|
+
|
|
|
+} from '@/constants/actionTypes'
|
|
|
+// Mutations
|
|
|
+import {
|
|
|
+ SET_SUPPLIER,
|
|
|
+ SET_LOADING_SUPPLIER ,
|
|
|
+ SET_FILTER_PAYMENTS_PURCHASES_SUPPLIER,
|
|
|
+ SET_SELECTED_PAYMENTS_PURCHASES_SUPPLIER
|
|
|
+}from '@/constants/mutationTypes'
|
|
|
|
|
|
const initialState = {
|
|
|
supplier: [],
|
|
|
- loadingSupplier: false
|
|
|
+ filterSupplier:[],
|
|
|
+ loadingSupplier: false,
|
|
|
+ selectedSupplier: null
|
|
|
}
|
|
|
|
|
|
const state = {
|
|
|
supplier: initialState.supplier,
|
|
|
- loadingSupplier: initialState.loadingSupplier
|
|
|
+ loadingSupplier: initialState.loadingSupplier,
|
|
|
+ filterSupplier: initialState.filterSupplier,
|
|
|
+ selectedSupplier: initialState.selectedSupplier
|
|
|
}
|
|
|
|
|
|
const getters = {
|
|
@@ -26,7 +42,23 @@ const getters = {
|
|
|
* @return {[type]} [description]
|
|
|
*/
|
|
|
loadingSupplier ( state ) {
|
|
|
- return state.loadingSupplier
|
|
|
+ return !state.loadingSupplier
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * [selectedSupplier description]
|
|
|
+ * @param {[type]} state [description]
|
|
|
+ * @return {[type]} [description]
|
|
|
+ */
|
|
|
+ selectedSupplier ( state ) {
|
|
|
+ return state.selectedSupplier
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * [supplierVisible description]
|
|
|
+ * @param {[type]} state [description]
|
|
|
+ * @return {[type]} [description]
|
|
|
+ */
|
|
|
+ supplierVisible ( state ) {
|
|
|
+ return state.filterSupplier.length === 0 ? state.supplier : state.filterSupplier
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -44,6 +76,20 @@ const mutations = {
|
|
|
*/
|
|
|
[SET_LOADING_SUPPLIER] (state, paylod) {
|
|
|
state.loadingSupplier = paylod
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * [filterSupplier description]
|
|
|
+ * @type {[type]}
|
|
|
+ */
|
|
|
+ [SET_FILTER_PAYMENTS_PURCHASES_SUPPLIER] (state, paylod) {
|
|
|
+ state.filterSupplier = paylod
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * [selectedSupplier description]
|
|
|
+ * @type {[type]}
|
|
|
+ */
|
|
|
+ [SET_SELECTED_PAYMENTS_PURCHASES_SUPPLIER] ( state, paylod ) {
|
|
|
+ state.selectedSupplier = paylod
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -54,6 +100,18 @@ const actions = {
|
|
|
[INIT_PAYMENTS_PURCHASES_SUPPLIER] ({ commit },paylod) {
|
|
|
commit(SET_SUPPLIER, paylod)
|
|
|
commit(SET_LOADING_SUPPLIER, paylod)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * [ FILTER_PAYMENTS_PURCHASES_SUPPLIER ]
|
|
|
+ */
|
|
|
+ [FILTER_PAYMENTS_PURCHASES_SUPPLIER] ({ commit }, paylod) {
|
|
|
+ commit(SET_FILTER_PAYMENTS_PURCHASES_SUPPLIER, paylod)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * [SELECT_PAYMENTS_PURCHASES_SUPPLIER]
|
|
|
+ */
|
|
|
+ [SELECT_PAYMENTS_PURCHASES_SUPPLIER] ({ commit }, paylod) {
|
|
|
+ commit(SET_SELECTED_PAYMENTS_PURCHASES_SUPPLIER, paylod)
|
|
|
}
|
|
|
}
|
|
|
|