Various fixes
This commit is contained in:
@@ -2,8 +2,11 @@
|
||||
<h3 class="modal-title">Crear Estudiante</h3>
|
||||
</div>
|
||||
<div style="text-align: center" class="modal-body">
|
||||
{{ mensaje }}
|
||||
{{ vm.mensaje }}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-primary" ng-show="botonOk" type="button" ng-click="ok(urlLo)">Aceptar</button>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-primary"
|
||||
ng-show="vm.botonOk"
|
||||
type="button"
|
||||
ng-click="ok()">Aceptar</button>
|
||||
</div>
|
@@ -2,13 +2,19 @@
|
||||
<h3 class="modal-title">Eliminar Estudiante</h3>
|
||||
</div>
|
||||
<div style="text-align: center" class="modal-body">
|
||||
{{ mensaje }}
|
||||
{{ vm.mensaje }}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-primary" ng-show="acceptButton" type="button"
|
||||
ng-click="ok(urlLo)">Aceptar</button>
|
||||
<button class="btn btn-primary" ng-show="botonOK" type="button"
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-primary"
|
||||
ng-show="vm.acceptButton"
|
||||
type="button"
|
||||
ng-click="ok()">Aceptar</button>
|
||||
<button class="btn btn-primary"
|
||||
ng-show="vm.botonOK"
|
||||
type="button"
|
||||
ng-click="vm.eliminarEstudiante(index)">OK</button>
|
||||
<button class="btn btn-warning" ng-show="botonCancelar" type="button"
|
||||
<button class="btn btn-warning"
|
||||
ng-show="vm.botonCancelar"
|
||||
type="button"
|
||||
ng-click="cancel()">Cancelar</button>
|
||||
</div>
|
@@ -2,11 +2,15 @@
|
||||
<h3 class="modal-title">Actualizar Estudiante</h3>
|
||||
</div>
|
||||
<div style="text-align: center" class="modal-body">
|
||||
{{ mensaje }}
|
||||
{{ vm.mensaje }}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-primary" ng-show="botonOk" type="button"
|
||||
<button class="btn btn-primary"
|
||||
ng-show="vm.botonOk"
|
||||
type="button"
|
||||
ng-click="ok()">Aceptar</button>
|
||||
<button class="btn btn-warning" ng-show="botonCancelar" type="button"
|
||||
<button class="btn btn-warning"
|
||||
ng-show="vm.botonCancelar"
|
||||
type="button"
|
||||
ng-click="cancel()">Cancelar</button>
|
||||
</div>
|
@@ -18,16 +18,10 @@
|
||||
|
||||
$stateProvider
|
||||
.state('StudentCreate', {
|
||||
parent: 'index',
|
||||
url: '/StudentCreate',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'SidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
'content@': {
|
||||
templateUrl: 'partials/students/student_create.html',
|
||||
controller: 'StudentCreateCtrl',
|
||||
controllerAs: 'vm'
|
||||
@@ -35,16 +29,10 @@
|
||||
}
|
||||
})
|
||||
.state('StudentUpdate', {
|
||||
parent: 'index',
|
||||
url: '/StudentUpdate',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'SidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
'content@': {
|
||||
templateUrl: 'partials/students/student_update.html',
|
||||
controller: 'StudentUpdateCtrl',
|
||||
controllerAs: 'vm'
|
||||
|
@@ -5,15 +5,16 @@
|
||||
.module('app.student')
|
||||
.controller('StudentCreateCtrl', StudentCreateCtrl)
|
||||
|
||||
StudentCreateCtrl.$inject = ['$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedSection', 'selectedCourse'];
|
||||
function StudentCreateCtrl($scope, $rootScope, $state, professors, $modal, selectedSection, selectedCourse){
|
||||
StudentCreateCtrl.$inject = ['$scope', '$state', 'professors', '$modal', 'selectedSection', 'selectedCourse', 'authentication'];
|
||||
function StudentCreateCtrl($scope, $state, professors, $modal, selectedSection, selectedCourse, authentication){
|
||||
|
||||
var vm = this;
|
||||
var duplicated = false;
|
||||
var professorid = $rootScope.professorId;
|
||||
var user = authentication.currentUser();
|
||||
var professorid = user._id;
|
||||
vm.professor = {};
|
||||
$rootScope.mensaje = "";
|
||||
$rootScope.actOk = false;
|
||||
vm.mensaje = "";
|
||||
vm.actOk = false;
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
@@ -25,7 +26,6 @@
|
||||
});
|
||||
|
||||
vm.submit = function() {
|
||||
|
||||
if (vm.data_input_form.$valid){
|
||||
var person = {
|
||||
"id": vm.estudiante.Cedula,
|
||||
@@ -34,18 +34,11 @@
|
||||
"email": vm.estudiante.Correo
|
||||
};
|
||||
|
||||
$rootScope.crearEstudianteLoading = true;
|
||||
$rootScope.botonOk = false;
|
||||
vm.botonOk = false;
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: 'partials/students/modal/create_students_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return $rootScope.items;
|
||||
}
|
||||
}
|
||||
size: 'sm'
|
||||
});
|
||||
|
||||
angular.forEach (vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students,
|
||||
@@ -57,24 +50,18 @@
|
||||
|
||||
professors.update({ id: professorid }, vm.professor,
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'actualizarMatricula';
|
||||
$rootScope.mensaje = "Estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre + " agregado";
|
||||
$rootScope.crearEstudianteLoading = false;
|
||||
vm.botonOk = true;
|
||||
vm.mensaje = "Estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre + " agregado";
|
||||
},
|
||||
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.mensaje = "Error al agregar al estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre;
|
||||
$rootScope.crearEstudianteLoading = false;
|
||||
vm.botonOk = true;
|
||||
vm.mensaje = "Error al agregar al estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre;
|
||||
});
|
||||
} else {
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.mensaje = "Estudiante con cedula " + vm.estudiante.Cedula + " ya esta en la lista.";
|
||||
$rootScope.crearEstudianteLoading = false;
|
||||
vm.botonOk = true;
|
||||
vm.mensaje = "Estudiante con cedula " + vm.estudiante.Cedula + " ya esta en la lista.";
|
||||
}
|
||||
}else{
|
||||
vm.submitted = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,17 +74,8 @@
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
vm.back = function () {
|
||||
$state.go('SectionUpdate');
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
})();
|
@@ -5,14 +5,15 @@
|
||||
.module('app.student')
|
||||
.controller('StudentUpdateCtrl', StudentUpdateCtrl)
|
||||
|
||||
StudentUpdateCtrl.$inject = ['$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedSection', 'selectedCourse', 'data'];
|
||||
function StudentUpdateCtrl($scope, $rootScope, $state, professors, $modal, selectedSection, selectedCourse, data){
|
||||
StudentUpdateCtrl.$inject = ['$scope', '$state', 'professors', '$modal', 'selectedSection', 'selectedCourse', 'data', 'authentication'];
|
||||
function StudentUpdateCtrl($scope, $state, professors, $modal, selectedSection, selectedCourse, data, authentication){
|
||||
|
||||
var vm = this;
|
||||
var professorid = $rootScope.professorId;
|
||||
var user = authentication.currentUser();
|
||||
var professorid = user._id;
|
||||
vm.professor = {};
|
||||
$rootScope.mensaje = "";
|
||||
$rootScope.actOk = false;
|
||||
vm.mensaje = "";
|
||||
vm.actOk = false;
|
||||
vm.newMail = null;
|
||||
vm.student = data.Student
|
||||
|
||||
@@ -36,18 +37,11 @@
|
||||
|
||||
if (vm.data_input_form.$valid){
|
||||
vm.student.email = vm.newMail;
|
||||
$rootScope.crearEstudianteLoading = true;
|
||||
$rootScope.botonOk = false;
|
||||
vm.botonOk = false;
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: 'partials/students/modal/update_students_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return $rootScope.items;
|
||||
}
|
||||
}
|
||||
size: 'sm'
|
||||
});
|
||||
|
||||
vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students.splice(data.Index, 1);
|
||||
@@ -56,12 +50,12 @@
|
||||
|
||||
professors.update({ id: professorid }, vm.professor,
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.mensaje = "Estudiante " + vm.student.lastname + ", " + vm.student.name + " actualizado";
|
||||
vm.botonOk = true;
|
||||
vm.mensaje = "Estudiante " + vm.student.lastname + ", " + vm.student.name + " actualizado";
|
||||
},
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.mensaje = "Error al actualizar al estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre;
|
||||
vm.botonOk = true;
|
||||
vm.mensaje = "Error al actualizar al estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user