Various fixes

This commit is contained in:
Reynaldo Reyes
2016-05-20 23:00:34 -04:00
parent b220f21065
commit 48e8b73111
55 changed files with 714 additions and 690 deletions

View File

@@ -2,11 +2,15 @@
<h3 class="modal-title">Crear Sección</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>
<button class="btn btn-warning" ng-show="botonCancelar" 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="vm.botonCancelar"
type="button"
ng-click="cancel()">Cancelar</button>
</div>

View File

@@ -2,13 +2,19 @@
<h3 class="modal-title">Eliminar Sección</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="vm.eliminarMatricula(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>
<button class="btn btn-primary" ng-show="otroBotonOk" type="button"
<button class="btn btn-primary"
ng-show="vm.otroBotonOk"
type="button"
ng-click="ok(urlLo)">Aceptar</button>
</div>

View File

@@ -2,13 +2,19 @@
<h3 class="modal-title">Liberar BT</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="vm.freeBTAddress(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>
<button class="btn btn-primary" ng-show="otroBotonOk" type="button"
ng-click="ok(urlLo)">Aceptar</button>
<button class="btn btn-primary"
ng-show="vm.otroBotonOk"
type="button"
ng-click="ok()">Aceptar</button>
</div>

View File

@@ -2,13 +2,19 @@
<h3 class="modal-title">Retirar 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="vm.retirarEstudiante(index)">OK</button>
<button class="btn btn-primary" ng-show="otroBotonOk" type="button"
<button class="btn btn-primary"
ng-show="vm.otroBotonOk"
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>

View File

@@ -17,54 +17,33 @@
$urlRouterProvider.otherwise('/SectionList');
$stateProvider
.state('SectionList', {
parent: 'index',
url: '/SectionList',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
'content@': {
templateUrl: 'partials/section/section_list.html',
controller: 'SectionListCtrl',
controllerAs: 'vm'
}
}
})
.state('SectionCreate', {
parent: 'index',
url: '/SectionCreate',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
'content@': {
templateUrl: 'partials/section/section_create.html',
controller: 'SectionCreateCtrl',
controllerAs: 'vm'
}
}
})
.state('SectionUpdate', {
.state('SectionUpdate', {
parent: 'index',
url: '/SectionUpdate',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
'content@': {
templateUrl: 'partials/section/section_update.html',
controller: 'SectionUpdateCtrl',
controllerAs: 'vm'

View File

@@ -6,16 +6,17 @@
.controller('SectionCreateCtrl', SectionCreateCtrl)
SectionCreateCtrl.$inject =
['$scope','$rootScope', '$state', 'professors', '$modal', 'selectedCourse'];
function SectionCreateCtrl($scope, $rootScope, $state, professors, $modal, selectedCourse){
var professorid = $rootScope.professorId;
['$scope', '$state', 'professors', '$modal', 'selectedCourse','authentication'];
function SectionCreateCtrl($scope, $state, professors, $modal, selectedCourse, authentication){
var user = authentication.currentUser();
var professorid = user._id;
var vm = this;
vm.course = {};
vm.itExists = false;
vm.selectedCourse = selectedCourse;
vm.submitted = false;
vm.semester, vm.section, vm.materias;
$rootScope.mensaje = "";
vm.mensaje = "";
vm.students = [];
professors.get({ id: professorid },
@@ -47,15 +48,9 @@
};
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: 'partials/section/modal/create_section_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return $rootScope.items;
}
}
size: 'sm'
});
@@ -72,19 +67,17 @@
vm.professor.courses[vm.index].sections.push(vm.package);
professors.update({ id: professorid }, vm.professor,
function(){
$rootScope.botonOk = true;
$rootScope.mensaje = "Sección " + vm.name + " creada";
vm.botonOk = true;
vm.mensaje = "Sección " + vm.name + " creada";
},
function(){
$rootScope.botonOk = true;
$rootScope.mensaje = "Error creando la seccion " + vm.name;
vm.botonOk = true;
vm.mensaje = "Error creando la seccion " + vm.name;
});
}else{
$rootScope.botonOk = true;
$rootScope.mensaje = "Sección Duplicada, " + vm.name + " existe en el semestre "+ vm.semester + ".";
vm.botonOk = true;
vm.mensaje = "Sección Duplicada, " + vm.name + " existe en el semestre "+ vm.semester + ".";
}
}else{
vm.submitted = true;
}
};

View File

@@ -5,10 +5,11 @@
.module('app.section')
.controller('SectionListCtrl', SectionListCtrl)
SectionListCtrl.$inject = [ '$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedCourse', 'selectedSection'];
function SectionListCtrl ( $scope, $rootScope, $state, professors, $modal, selectedCourse, selectedSection ){
SectionListCtrl.$inject = [ '$scope', '$state', 'professors', '$modal', 'selectedCourse', 'selectedSection', 'authentication'];
function SectionListCtrl ( $scope, $state, professors, $modal, selectedCourse, selectedSection, authentication ){
var vm = this;
var professorid = $rootScope.professorId;
var user = authentication.currentUser();
var professorid = user._id;
vm.section = [];
vm.professor = null;
@@ -27,60 +28,45 @@
function (){
console.log("Error al obtener los datos.");
});
/**************************Eliminar Matricula**************************/
/* En este proceso, primero se llama a un Modal el cual se cerciora que
el usuario se asegure de eliminar la matricula escogida, el usuario al
confirmar su decision llama automaticamente a la funcion que hara la
llamada a servicio que borrara la matricula de la base de datos.
*/
});
vm.createSection = function () {
$state.go('SectionCreate');
};
vm.eliminarMatriculaModal = function (index) {
$rootScope.index = index;
$rootScope.botonOk = true;
$rootScope.otroBotonOk = false;
$rootScope.botonCancelar = true;
$rootScope.rsplice = false;
$scope.index = index;
vm.botonOk = true;
vm.otroBotonOk = false;
vm.botonCancelar = true;
vm.rsplice = false;
var name = vm.section[index].name;
$rootScope.mensaje = "¿Seguro que desea eliminar la sección "+name+"?";
vm.mensaje = "¿Seguro que desea eliminar la sección "+name+"?";
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: '/partials/section/modal/delete_section_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return "";
}
}
size: 'sm'
});
};
vm.eliminarMatricula = function (index) {
$rootScope.botonOk = false;
$rootScope.otroBotonOk = true;
$rootScope.botonCancelar = false;
vm.botonOk = false;
vm.otroBotonOk = true;
vm.botonCancelar = false;
var name = vm.section[index].name;
vm.professor.courses[vm.index].sections.splice(index, 1);
professors.update({ id: professorid }, vm.professor,
function () {
$rootScope.rsplice = true;
$rootScope.mensaje = "Sección " + name + " eliminada";
vm.rsplice = true;
vm.mensaje = "Sección " + name + " eliminada";
},
function () {
$rootScope.mensaje = "Error eliminando la sección " + name;
vm.mensaje = "Error eliminando la sección " + name;
});
};
/*************************Fin de Eliminar Matricula*******************/
vm.modificarMatricula = function (index) {
selectedSection._id = vm.section[index]._id;
selectedCourse.index = vm.index;

View File

@@ -12,23 +12,15 @@
<tr>
<th width="20%">
Sección
<span ng-show="sortType == 'name' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'name' && sortReverse" class="fa fa-caret-up"></span>
</th>
<th width="20%">
Nombre de la Materia
<span ng-show="sortType == 'course' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'course' && sortReverse" class="fa fa-caret-up"></span>
</th>
<th width="20%">
Codigo de la Materia
<span ng-show="sortType == 'code' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'code' && sortReverse" class="fa fa-caret-up"></span>
</th>
<th width="20%">
Semestre
<span ng-show="sortType == 'semester' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'semester' && sortReverse" class="fa fa-caret-up"></span>
</th>
<th width="10%" style="text-align: center">
Matricula
@@ -45,14 +37,16 @@
<td style="vertical-align:middle">{{ section.code }}</td>
<td style="vertical-align:middle">{{ section.semester }}</td>
<td style="text-align: center">
<span title="Click aqui para Modificar la Matricula"
class="glyphicon glyphicon-edit" aria-hidden="true"
<span title="Haga click para modificar la matricula"
class="glyphicon glyphicon-edit"
aria-hidden="true"
ng-click="vm.modificarMatricula($index)"
style="cursor:pointer"></span>
</td>
<td style="text-align: center">
<span title="Click aqui para Eliminar la Matricula"
class="glyphicon glyphicon-remove" aria-hidden="true"
<span title="Haga click para eliminar la matricula"
class="glyphicon glyphicon-remove"
aria-hidden="true"
ng-click="vm.eliminarMatriculaModal($index)"
style="cursor:pointer"></span>
</td>

View File

@@ -5,9 +5,10 @@
.module('app.section')
.controller('SectionUpdateCtrl', SectionUpdateCtrl)
SectionUpdateCtrl.$inject = ['$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedSection', 'selectedCourse','data'];
function SectionUpdateCtrl($scope, $rootScope, $state, professors, $modal, selectedSection, selectedCourse, data){
var professorid = $rootScope.professorId;
SectionUpdateCtrl.$inject = ['$scope', '$state', 'professors', '$modal', 'selectedSection', 'selectedCourse','data', 'authentication'];
function SectionUpdateCtrl($scope, $state, professors, $modal, selectedSection, selectedCourse, data, authentication){
var user = authentication.currentUser();
var professorid = user._id;
var vm = this;
vm.section = {};
vm.students = [];
@@ -39,22 +40,15 @@
};
vm.freeBTAddressModal = function (index) {
$rootScope.index = index;
$rootScope.botonOk = true;
$rootScope.otroBotonOk = false;
$rootScope.botonCancelar = true;
$rootScope.eliminarLoading = false;
$rootScope.mensaje = "¿Desea liberar la dirección de BT del estudiante "+ vm.students[index].lastname +", "+ vm.students[index].name + "?";
$scope.index = index;
vm.botonOk = true;
vm.otroBotonOk = false;
vm.botonCancelar = true;
vm.mensaje = "¿Desea liberar la dirección de BT del estudiante "+ vm.students[index].lastname +", "+ vm.students[index].name + "?";
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: 'partials/section/modal/student_bt_removal_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return "";
}
}
size: 'sm'
});
};
@@ -66,36 +60,30 @@
professors.update({ id: professorid }, vm.professor,
function(){
$rootScope.botonOk = false;
$rootScope.otroBotonOk = true;
$rootScope.botonCancelar = false;
$rootScope.mensaje = "Dirección BT de " + vm.student.lastname + ", " + vm.student.name + " fue liberada";
vm.botonOk = false;
vm.otroBotonOk = true;
vm.botonCancelar = false;
vm.mensaje = "Dirección BT de " + vm.student.lastname + ", " + vm.student.name + " fue liberada";
},
function(){
$rootScope.botonOk = false;
$rootScope.otroBotonOk = true;
$rootScope.botonCancelar = false;
$rootScope.mensaje = "Error al liberar dirección de BT del estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre;
vm.botonOk = false;
vm.otroBotonOk = true;
vm.botonCancelar = false;
vm.mensaje = "Error al liberar dirección de BT del estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre;
});
};
vm.retirarEstudianteModal = function (index) {
$rootScope.index = index;
$rootScope.botonOk = true;
$rootScope.otroBotonOk = false;
$rootScope.botonCancelar = true;
$rootScope.eliminarLoading = false;
$rootScope.mensaje = "¿Desea retirar al estudiante "+ vm.students[index].lastname +", "+ vm.students[index].name + "?";
$scope.index = index;
vm.botonOk = true;
vm.otroBotonOk = false;
vm.botonCancelar = true;
vm.eliminarLoading = false;
vm.mensaje = "¿Desea retirar al estudiante "+ vm.students[index].lastname +", "+ vm.students[index].name + "?";
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: 'partials/section/modal/update_section_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return "";
}
}
size: 'sm'
});
};
@@ -104,16 +92,16 @@
professors.update({ id: professorid }, vm.professor,
function (){
$rootScope.botonOk = false;
$rootScope.otroBotonOk = true;
$rootScope.botonCancelar = false;
$rootScope.mensaje = "Sección "+ vm.section.name +" actualizada";
vm.botonOk = false;
vm.otroBotonOk = true;
vm.botonCancelar = false;
vm.mensaje = "Sección "+ vm.section.name +" actualizada";
},
function (){
$rootScope.botonOk = false;
$rootScope.otroBotonOk = true;
$rootScope.botonCancelar = false;
$rootScope.mensaje = "Error al actualizar la Sección "+ vm.section.name;
vm.botonOk = false;
vm.otroBotonOk = true;
vm.botonCancelar = false;
vm.mensaje = "Error al actualizar la Sección "+ vm.section.name;
});
};

View File

@@ -12,31 +12,21 @@
<tr>
<th width="10%" style="text-align: center">
Cedula
<span ng-show="sortType == 'id' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'id' && sortReverse" class="fa fa-caret-up"></span>
</th>
<th width="20%" style="text-align: center">
Nombre
<span ng-show="sortType == 'name' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'name' && sortReverse" class="fa fa-caret-up"></span>
</th>
<th width="20%" style="text-align: center">
Apellido
<span ng-show="sortType == 'lastname' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'lastname' && sortReverse" class="fa fa-caret-up"></span>
</th>
<th width="20%" style="text-align: center">
Correo
<span ng-show="sortType == 'email' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'email' && sortReverse" class="fa fa-caret-up"></span>
</th>
<th width="10%" style="text-align: center">
Actualizar Correo
</th>
<th width="10%" style="text-align: center">
Dirección BT
<span ng-show="sortType == 'email' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'email' && sortReverse" class="fa fa-caret-up"></span>
</th>
<th width="10%" style="text-align: center">
Liberar Dirección BT
@@ -53,20 +43,23 @@
<td style="vertical-align:middle">{{ student.lastname }}</td>
<td style="vertical-align:middle">{{ student.email }}</td>
<td style="text-align: center">
<span class="glyphicon glyphicon-envelope"
<span title="Haga click para actualizar dirección de correo del estudiante"
class="glyphicon glyphicon-envelope"
aria-hidden="true"
ng-click="vm.mailUpdate($index)"
style="cursor:pointer;"></span>
</td>
<td style="vertical-align:middle">{{ student.btaddress }}</td>
<td style="text-align: center">
<span class="glyphicon glyphicon-signal"
<span title="Haga click para liberar la dirección MAC del telefono del estudiante"
class="glyphicon glyphicon-signal"
aria-hidden="true"
ng-click="vm.freeBTAddressModal($index)"
style="cursor:pointer;"></span>
</td>
<td style="text-align: center">
<span class="glyphicon glyphicon-remove"
<span title="Haga click para retirar al estudiante de la sección"
class="glyphicon glyphicon-remove"
aria-hidden="true"
ng-click="vm.retirarEstudianteModal($index)"
style="cursor:pointer;"></span>