Created
June 19, 2018 12:42
-
-
Save brunokunace/0fbb7346456777fcd578282c5ae57f33 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// traz todos os credores que fazem parte do grupo | |
async getCredorGrupo () { | |
try { | |
const response = await getCredorGrupo(this.groups.codigo) | |
var temporario = response.data.credores.reverse() | |
this.uneCredores(true, temporario) | |
this.getCredoresForaGrupo() | |
} catch (error) { | |
console.log(error) | |
} | |
}, | |
// traz todos os credores que nao fazem parte do grupo | |
async getCredoresForaGrupo () { | |
try { | |
const response = await getCredoresForaGrupo() | |
var temporario = response.data.credores.reverse() | |
this.uneCredores(false, temporario) | |
} catch (error) { | |
console.log(error) | |
} | |
}, | |
// insere e remove o credor do grupo de acordo com o checkbox | |
async addRemoveCredor (credor) { | |
if (!this.nogrupo) { | |
console.warn('aaaaaaaaaaaa') | |
this.addCredor.codigo = this.groups.codigo | |
this.addCredor.credores.unshift(credor) | |
setCredor(this.addCredor) | |
} else if (this.check) { | |
console.warn('ffffffff') | |
this.deletaCredor.codigoGrupo = this.groups.codigo | |
this.deletaCredor.codigoCredor = credor | |
deleteCredor(this.deletaCredor) | |
} | |
}, | |
// une e lista todos os credores do grupo com os credores que nao fazem parte dele | |
async uneCredores (check, tipoCredores) { | |
for (var i = 0; i < tipoCredores.length; i++) { | |
var meusCredores = { | |
nome: tipoCredores[i].nome, | |
codigo: tipoCredores[i].codigo, | |
nogrupo: check | |
} | |
this.todoscredores.unshift(meusCredores) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment