Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/LADOSSIFPB/nutrif
Browse files Browse the repository at this point in the history
  • Loading branch information
rhavymaia committed May 31, 2016
2 parents 29a4f4d + 4ca9f0d commit b647658
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
30 changes: 30 additions & 0 deletions nutrif-web-refactor/js/controllers/editarAlunoCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,36 @@ angular.module('NutrifApp').controller('editarAlunoCtrl', function ($scope, alun
.error(onErrorCallback);
}

$scope.apagarAlunos = function (selected) {
if (selected.length === 0) {
$mdToast.show(
$mdToast.simple()
.textContent('Antes de apagar, selecione alguma refeição')
.position('top right')
.action('OK')
.hideDelay(6000)
);
} else {
var _length = selected.length;
for (var i = 0; i < _length; i++) {
diaRefeicaoService.removerRefeicao(selected[i])
.success(function functionName() {
$scope.refeicoes.splice($scope.refeicoes.indexOf(selected[i]));
})
.error(function (data, status) {

$mdToast.show(
$mdToast.simple()
.textContent('Erro ao apagar uma refeição')
.position('top right')
.action('OK')
.hideDelay(6000)
);
});
}
}
}

function carregamentoInicial() {
var _matricula = $stateParams.matricula;

Expand Down
2 changes: 1 addition & 1 deletion nutrif-web-refactor/js/controllers/listarAlunosCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ angular.module('NutrifApp').controller('listarAlunosCtrl', function ($scope, $md
var _message = '';

if (!data) {
_message = 'Ocorreu um erro na comunicação com o servidor, favor chamar o suporte.'
_message = 'Não foram encontrados alunos com esses dados'
} else {
_message = data.mensagem
}
Expand Down
3 changes: 3 additions & 0 deletions nutrif-web-refactor/js/services/api/diaRefeicaoService.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ angular.module("NutrifApp").factory("diaRefeicaoService", function($http, config
};

var _removerRefeicao = function (refeicao) {
delete refeicao.refeicao.horaFinal;
delete refeicao.refeicao.horaInicio;
delete refeicao.refeicao.horaPretensao;
return $http.post(_path + "/remover", refeicao)
};

Expand Down
2 changes: 1 addition & 1 deletion nutrif-web-refactor/view/manager/admin/editar-aluno.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<md-card-actions layout="row">
<md-card-icon-actions>

<md-button class="md-icon-button" aria-label="Apagar refeições">
<md-button class="md-icon-button" aria-label="Apagar refeições" ng-click="apagarAlunos(selected)">
<md-tooltip md-direction="bottom">Apagar refeições</md-tooltip>
<md-icon md-svg-icon="img/icon/rubbish-bin-delete-button.svg"></md-icon>
</md-button>
Expand Down

0 comments on commit b647658

Please sign in to comment.