issue #937 fixed

parent 60f5c141
......@@ -59,6 +59,8 @@
"close_session": "Close session",
"collections": "Collections",
"confirmation": "Are you sure?",
"confirm_unlink_therapist": "Unlik {{ name }} from {{ student }} as therapist?",
"confirm_unlink_tutor": "Unlik {{ name }} from {{ student }} as tutor?",
"contact_person": "Contact person",
"contact_person": "Contact person",
"continue_session": "Resume_session",
......
......@@ -59,6 +59,8 @@
"close_session": "Cerrar sesion",
"collections": "Colecciones",
"confirmation": "¿Estás seguro?",
"confirm_unlink_therapist": "¿Desligar {{ name }} de {{ student }} como terapeuta?",
"confirm_unlink_tutor": "¿Desligar {{ name }} de {{ student }} como tutor?",
"contact_person": "Persona de contacto",
"contact_person": "Persona de contacto",
"continue_session": "Reanudar sesión",
......
......@@ -27,7 +27,7 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
$scope.supsForm = {};
$scope.section = 'account';
$scope.changeImg = function () {
$scope.progress = 0;
......@@ -218,27 +218,25 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
// Delete tutor
$scope.delete_sup = function (id_sup) {
var deleteSup = $window.confirm('Are you absolutely sure you want to delete?');
//Se recorre el array de objetos json para buscarlo
var i;
for (i = 0; i < $scope.studentSupervisors.length && id_sup !== $scope.studentSupervisors[i].id; i++);
var deleteSup = $window.confirm(
$translate.instant(
'confirm_unlink_therapist',
{name: $scope.studentSupervisors[i].name, student: $scope.studentData.name}
));
if (deleteSup) {
$http.delete(config.backend + '/stu/' + $scope.studentData.id + '/sup/' + id_sup)
.success(function () {
var i;
// Eliminar de la vista: Se recorre el array de objetos json para buscarlo
for (i = 0; i < $scope.studentSupervisors.length; i++) {
if (id_sup === $scope.studentSupervisors[i].id) {
$scope.studentSupervisors.splice(i, 1);
}
}
$translate('supervisor_deleted').then(function (translation) {
ngToast.success({ content: translation });
});
// Eliminar de la vista
$scope.studentSupervisors.splice(i, 1);;
ngToast.success({ content: $translate.instant('supervisor_deleted') });
})
.error(function () {
$translate('sup_not_deleted').then(function (translation) {
ngToast.error({ content: translation });
});
ngToast.danger({ content: $translate.instant('supervisor_not_deleted') });
});
}
};
......@@ -309,28 +307,25 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
// Delete tutor
$scope.delete_tutor = function (id_sup) {
var deleteTutor = $window.confirm('Are you absolutely sure you want to delete?');
//Se recorre el array de objetos json para buscarlo
var i;
for (i = 0; i < $scope.studentTutors.length && id_sup !== $scope.studentTutors[i].id; i++);
var deleteTutor = $window.confirm(
$translate.instant(
'confirm_unlink_tutor',
{name: $scope.studentTutors[i].name, student: $scope.studentData.name}
));
if (deleteTutor) {
$http.delete(config.backend + '/stu/' + $scope.studentData.id + '/sup/' + id_sup)
.success(function () {
var i;
// Eliminar de la vista: Se recorre el array de objetos json para buscarlo
for (i = 0; i < $scope.studentTutors.length; i++) {
if (id_sup === $scope.studentTutors[i].id) {
$scope.studentTutors.splice(i, 1);
}
}
$translate('tutor_deleted').then(function (translation) {
ngToast.success({ content: translation });
});
// Eliminar de la vista
$scope.studentTutors.splice(i, 1);
ngToast.success({ content: $translate.instant('tutor_deleted') });
})
.error(function () {
$translate('tutor_not_deleted').then(function (translation) {
ngToast.danger({ content: translation });
});
ngToast.danger({ content: $translate.instant('tutor_not_deleted') });
});
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment