|
@@ -43,6 +43,10 @@ const mutations = {
|
|
|
if (finded) return
|
|
|
|
|
|
state.movelineSelect =[payload.moveselect, ...state.movelineSelect]
|
|
|
+
|
|
|
+ state.movelineSelect.sort((a, b) => {
|
|
|
+ return a.date_maturity > b.date_maturity
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
calculateTotal(state) {
|
|
@@ -68,6 +72,10 @@ const mutations = {
|
|
|
if (finded) return
|
|
|
|
|
|
state.moveLines = [payload.moveLine, ...state.moveLines]
|
|
|
+
|
|
|
+ state.moveLines.sort((a, b) => {
|
|
|
+ return a.date_maturity > b.date_maturity
|
|
|
+ })
|
|
|
},
|
|
|
addMoveCard(state, payload) {
|
|
|
payload.moveLine.forEach(moveLine => {
|
|
@@ -75,6 +83,10 @@ const mutations = {
|
|
|
if (finded) return
|
|
|
|
|
|
state.moveLines = [moveLine, ...state.moveLines]
|
|
|
+
|
|
|
+ state.moveLines.sort((a, b) => {
|
|
|
+ return a.date_maturity > b.date_maturity
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
remoMovelineSelectALL(state,payload) {
|
|
@@ -87,7 +99,13 @@ const actions = {
|
|
|
commit('pushMovelines', payload)
|
|
|
},
|
|
|
|
|
|
- selectMoveline({ commit, dispatch}, payload) {
|
|
|
+ selectMoveline({ commit, dispatch, getters}, payload) {
|
|
|
+ let dateMin = moment(moment.min(getters.moveLines.map(item => { return moment(item.date_maturity)}))).valueOf()
|
|
|
+
|
|
|
+ if (dateMin < moment(payload.date_maturity).valueOf())
|
|
|
+ return dispatch('notify', 'Cuota no permitida')
|
|
|
+ // return dispatch('notify', 'Ops, no podes seleccionar esta cuota, debes seleccionar la cuota pendiente permitida')
|
|
|
+
|
|
|
commit('selectMoveline',{
|
|
|
moveline: payload
|
|
|
})
|
|
@@ -100,7 +118,14 @@ const actions = {
|
|
|
commit('calculateTotal')
|
|
|
},
|
|
|
|
|
|
- removeLine({ commit, dispatch}, payload) {
|
|
|
+ removeLine({ commit, dispatch, state}, payload) {
|
|
|
+
|
|
|
+ let dateMax = moment(moment.max(state.movelineSelect.map(item => { return moment(item.date_maturity)}))).valueOf()
|
|
|
+
|
|
|
+ if (dateMax > moment(payload.date_maturity).valueOf())
|
|
|
+ return dispatch('notify', 'No podes eliminar esta cuota')
|
|
|
+ // return dispatch('notify', 'Ops, no podes suprimir este registro, primero debes eliminar las cuota con fecha de vencimiento superior')
|
|
|
+
|
|
|
commit('removeLine',{
|
|
|
movedelet: payload
|
|
|
})
|