Create M.A.S.A Version 1.0
This commit is contained in:
@@ -1,170 +0,0 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.course')
|
||||
.controller('listarMateriaCtrl',listarMateriaCtrl)
|
||||
.controller('crearMateriaCtrl', crearMateriaCtrl)
|
||||
|
||||
|
||||
listarMateriaCtrl.$inject =
|
||||
['$scope', '$rootScope', '$location', 'professors', '$modal', 'profesorSeleccionado', 'selectedCourse'];
|
||||
function listarMateriaCtrl($scope, $rootScope, $location, professors, $modal, profesorSeleccionado, selectedCourse) {
|
||||
var vm = this;
|
||||
var professorid = '56f5fd3a20047f3c15b05f0e';
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
vm.course = vm.professor.courses;
|
||||
},
|
||||
function (){
|
||||
console.log("Error al obtener los datos.");
|
||||
|
||||
});
|
||||
vm.listarSecciones = function (index) {
|
||||
selectedCourse._id = vm.course[index]._id;
|
||||
$location.url('listarMatricula');
|
||||
};
|
||||
|
||||
vm.eliminarMateriaModal = function (index) {
|
||||
$rootScope.index = index;
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.otroBotonOk = false;
|
||||
$rootScope.botonCancelar = true;
|
||||
$rootScope.rsplice = false;
|
||||
$rootScope.mensaje = "¿Seguro que desea eliminar la materia?";
|
||||
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: '/partials/course/modal/delete_course_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
vm.eliminarMateria = function (index) {
|
||||
$rootScope.botonOk = false;
|
||||
$rootScope.otroBotonOk = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
$rootScope.urlLo = 'listarMateria';
|
||||
var name = vm.course[index].name;
|
||||
vm.professor.courses.splice(index, 1);
|
||||
|
||||
professors.update({ id: professorid }, vm.professor,
|
||||
function () {
|
||||
$rootScope.mensaje = "Materia " + name + " eliminada";
|
||||
},
|
||||
function () {
|
||||
$rootScope.mensaje = "Error eliminando la materia" + name;
|
||||
});
|
||||
};
|
||||
|
||||
/*vm.modificarMateria = function (index) {
|
||||
$location.url('modificarMateria');
|
||||
};*/
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$location.url(urlLo);
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
|
||||
crearMateriaCtrl.$inject =
|
||||
['$scope','$rootScope', '$modal', '$location', 'professors'];
|
||||
function crearMateriaCtrl($scope, $rootScope, $modal, $location, professors) {
|
||||
var vm = this;
|
||||
vm.submitted = false;
|
||||
vm.mayorque = false;
|
||||
$rootScope.mensaje = "";
|
||||
var professorid = '56f5fd3a20047f3c15b05f0e';
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
},
|
||||
function (){
|
||||
console.log("Error al obtener los datos.");
|
||||
|
||||
});
|
||||
|
||||
vm.submit = function() {
|
||||
|
||||
if (vm.data_input_form.$valid){
|
||||
vm.course = {
|
||||
"code": vm.course.code,
|
||||
"name": vm.course.name,
|
||||
"credits": vm.course.credits,
|
||||
"description" : vm.course.description,
|
||||
};
|
||||
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl:
|
||||
'/partials/course/modal/create_course_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return $rootScope.items;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
vm.professor.courses.push(vm.course);
|
||||
professors.update({ id: professorid }, vm.professor,
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'listarMateria';
|
||||
$rootScope.mensaje =
|
||||
"Materia " + vm.course.name + " creada";
|
||||
},
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'listarMateria';
|
||||
$rootScope.mensaje =
|
||||
"Error creando la materia " + vm.course.name;
|
||||
});
|
||||
}else{
|
||||
|
||||
vm.submitted = true;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$location.url(urlLo);
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
})();
|
||||
@@ -14,41 +14,41 @@
|
||||
|
||||
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
|
||||
function getRoutes($stateProvider, $urlRouterProvider){
|
||||
$urlRouterProvider.otherwise('/listarMaterias');
|
||||
$urlRouterProvider.otherwise('/CourseList');
|
||||
|
||||
$stateProvider
|
||||
.state('listarMateria', {
|
||||
url: '/listarMateria',
|
||||
.state('CourseList', {
|
||||
url: '/CourseList',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'SidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/course/list_course.html',
|
||||
controller: 'listarMateriaCtrl',
|
||||
controllerAs: "vm"
|
||||
templateUrl: 'partials/course/course_list.html',
|
||||
controller: 'CourseListCtrl',
|
||||
controllerAs: "vm"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.state('crearMateria', {
|
||||
url: '/crearMateria',
|
||||
.state('CourseCreate', {
|
||||
url: '/CourseCreate',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'SidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/course/create_course.html',
|
||||
controller: 'crearMateriaCtrl',
|
||||
controllerAs: "vm"
|
||||
templateUrl: 'partials/course/course_create.html',
|
||||
controller: 'CourseCreateCtrl',
|
||||
controllerAs: "vm"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
87
app/partials/course/course_create.controller.js
Normal file
87
app/partials/course/course_create.controller.js
Normal file
@@ -0,0 +1,87 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.course')
|
||||
.controller('CourseCreateCtrl', CourseCreateCtrl)
|
||||
|
||||
CourseCreateCtrl.$inject =
|
||||
['$scope','$rootScope', '$modal', '$location', 'professors'];
|
||||
function CourseCreateCtrl($scope, $rootScope, $modal, $location, professors) {
|
||||
var vm = this;
|
||||
vm.submitted = false;
|
||||
vm.mayorque = false;
|
||||
$rootScope.mensaje = "";
|
||||
var professorid = $rootScope.professorId;
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
},
|
||||
function (){
|
||||
console.log("Error al obtener los datos.");
|
||||
|
||||
});
|
||||
|
||||
vm.submit = function() {
|
||||
|
||||
if (vm.data_input_form.$valid){
|
||||
vm.course = {
|
||||
"code": vm.course.code,
|
||||
"name": vm.course.name,
|
||||
"credits": vm.course.credits,
|
||||
"description" : vm.course.description,
|
||||
};
|
||||
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl:
|
||||
'/partials/course/modal/create_course_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return $rootScope.items;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
vm.professor.courses.push(vm.course);
|
||||
professors.update({ id: professorid }, vm.professor,
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'listarMateria';
|
||||
$rootScope.mensaje =
|
||||
"Materia " + vm.course.name + " creada";
|
||||
},
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'listarMateria';
|
||||
$rootScope.mensaje =
|
||||
"Error creando la materia " + vm.course.name;
|
||||
});
|
||||
}else{
|
||||
|
||||
vm.submitted = true;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$location.url(urlLo);
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
})();
|
||||
81
app/partials/course/course_list.controller.js
Normal file
81
app/partials/course/course_list.controller.js
Normal file
@@ -0,0 +1,81 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.course')
|
||||
.controller('CourseListCtrl',CourseListCtrl)
|
||||
|
||||
CourseListCtrl.$inject =
|
||||
['$scope', '$rootScope', '$state', 'professors', '$modal', 'profesorSeleccionado', 'selectedCourse'];
|
||||
function CourseListCtrl($scope, $rootScope, $state, professors, $modal, profesorSeleccionado, selectedCourse) {
|
||||
var vm = this;
|
||||
var professorid = $rootScope.professorId;
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
vm.course = vm.professor.courses;
|
||||
},
|
||||
function (){
|
||||
console.log("Error al obtener los datos.");
|
||||
});
|
||||
vm.listarSecciones = function (index) {
|
||||
selectedCourse._id = vm.course[index]._id;
|
||||
$state.go('SectionList');
|
||||
};
|
||||
|
||||
vm.eliminarMateriaModal = function (index) {
|
||||
$rootScope.index = index;
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.otroBotonOk = false;
|
||||
$rootScope.botonCancelar = true;
|
||||
$rootScope.rsplice = false;
|
||||
$rootScope.mensaje = "¿Seguro que desea eliminar la materia?";
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: '/partials/course/modal/delete_course_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
vm.eliminarMateria = function (index) {
|
||||
$rootScope.botonOk = false;
|
||||
$rootScope.otroBotonOk = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
var name = vm.course[index].name;
|
||||
vm.professor.courses.splice(index, 1);
|
||||
|
||||
professors.update({ id: professorid }, vm.professor,
|
||||
function () {
|
||||
$rootScope.mensaje = "Materia " + name + " eliminada";
|
||||
},
|
||||
function () {
|
||||
$rootScope.mensaje = "Error eliminando la materia" + name;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$state.go('CourseList');
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
})();
|
||||
@@ -1,59 +0,0 @@
|
||||
<div>
|
||||
<form name="vm.data_input_form" role="form" novalidate
|
||||
ng-submit="vm.submit()">
|
||||
<div class="row clearfix">
|
||||
<h4>Datos de la Materia</h4>
|
||||
<br>
|
||||
<div class="col-md-12 column well">
|
||||
<div class="row">
|
||||
<div class="col-md-6 column">
|
||||
<label for="code">Código de la Materia</label>
|
||||
<input type="numeric" class="form-control"
|
||||
name="code" ng-model="vm.course.code"
|
||||
readonly="readonly"/>
|
||||
</div>
|
||||
<div class="col-md-6 column">
|
||||
<label for="name">Nombre de la Materia</label>
|
||||
<input type="text" class="form-control"
|
||||
name="name" ng-model="vm.course.name" required/>
|
||||
<div class="error" ng-show="vm.submitted &&
|
||||
vm.data_input_form.name.$invalid">
|
||||
<small class="error"
|
||||
ng-show="vm.data_input_form.name.$error.required">
|
||||
El Nombre de la Materia es Obligatorio.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row clearfix"><div class="col-md-12 column"><br><br></div></div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 column">
|
||||
<label for="credits">Cantidad de Creditos</label>
|
||||
<input type="numeric" class="form-control"
|
||||
name="credits" ng-model="vm.course.credits" maxlength="1" placeholder="5" required/>
|
||||
<div class="error" ng-show="vm.submitted &&
|
||||
vm.data_input_form.credits.$invalid">
|
||||
<small class="error"
|
||||
ng-show="vm.data_input_form.credits.$error.required">
|
||||
La Cantidad de Creditos es Obligatoria.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row clearfix"><div class="col-md-12 column"><br><br></div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row clearfix">
|
||||
<div class="col-md-2 column">
|
||||
<div class="form-group">
|
||||
<label> </label>
|
||||
<p class="input-group">
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" class="btn-primary btn">Modificar Materia</button>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -5,22 +5,19 @@
|
||||
.module('app.login')
|
||||
.controller('loginCtrl', loginCtrl)
|
||||
|
||||
loginCtrl.$inject = ['$rootScope', '$scope', '$location'];
|
||||
function loginCtrl($rootScope, $scope, $location){
|
||||
/*var vm = this;
|
||||
vm.user = user;
|
||||
vm.submitted = false;
|
||||
vm.mayorque = false;
|
||||
$rootScope.items = "";
|
||||
$rootScope.mensaje = "";
|
||||
loginCtrl.$inject = ['$rootScope', '$scope', '$state'];
|
||||
function loginCtrl($rootScope, $scope, $state){
|
||||
var vm = this;
|
||||
vm.user;
|
||||
|
||||
vm.submit = function() {
|
||||
if (vm.data_input_form.$valid){
|
||||
vm.pkg = {
|
||||
"Nickname": vm.user.Nickname,
|
||||
"Password": $rootScope.password
|
||||
"Nickname": vm.user.nickname,
|
||||
"Password": vm.user.password
|
||||
};
|
||||
|
||||
$rootScope.mensaje = "";
|
||||
/*$rootScope.mensaje = "";
|
||||
$rootScope.bcancel = false;
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
@@ -28,12 +25,12 @@
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return $rootScope.items;
|
||||
}
|
||||
items: function () {
|
||||
return $rootScope.items;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Login.save(vm.pkg,
|
||||
function(data){
|
||||
if(data.Data._value != null){
|
||||
@@ -58,18 +55,16 @@
|
||||
},
|
||||
function(){
|
||||
|
||||
});
|
||||
|
||||
}else{
|
||||
vm.submitted = true;
|
||||
});*/
|
||||
$state.go('CourseList');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
/*$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
};*/
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$location.url(urlLo);
|
||||
@@ -78,9 +73,6 @@
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
return vm; */
|
||||
};
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</div>
|
||||
<div class="col-md-4 column">
|
||||
<label for="nickname">Cedula de Identidad del Profesor</label>
|
||||
<input type="text" class="form-control" id="nickname" name="nickname" ng-model="vm.user.Nickname" required/>
|
||||
<input type="text" class="form-control" id="nickname" name="nickname" ng-model="vm.user.nickname" required/>
|
||||
<div class="error" ng-show="vm.submitted && vm.data_input_form.nickname.$invalid">
|
||||
<small class="error" ng-show="vm.data_input_form.nickname.$error.required">
|
||||
{{'TAG_NICK_NAME_ERROR'}}
|
||||
@@ -21,7 +21,7 @@
|
||||
</div>
|
||||
<div class="col-md-4 column">
|
||||
<label for="password">Contraseña</label>
|
||||
<input type="password" class="form-control" id="password" name="password" ng-model="vm.user.Password" maxlength="8" required/>
|
||||
<input type="password" class="form-control" id="password" name="password" ng-model="vm.user.password" maxlength="8" required/>
|
||||
<div ng-show=false> {{ vm.password = vm.user.Password }}</div>
|
||||
<div class="error" ng-show="vm.submitted && vm.data_input_form.password.$invalid">
|
||||
<small class="error" ng-show="vm.data_input_form.password.$error.required">
|
||||
|
||||
@@ -1,259 +0,0 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.professor')
|
||||
.controller('listarProfesorCtrl', listarProfesorCtrl)
|
||||
.controller('crearProfesorCtrl', crearProfesorCtrl)
|
||||
.controller('actualizarProfesorCtrl', actualizarProfesorCtrl)
|
||||
|
||||
listarProfesorCtrl.$inject =
|
||||
[ '$scope', '$rootScope', '$location', 'professors', '$modal', 'profesorSeleccionado' ];
|
||||
function listarProfesorCtrl( $scope, $rootScope, $location, professors, $modal, profesorSeleccionado ){
|
||||
|
||||
var vm = this;
|
||||
vm.lista = true;
|
||||
$rootScope.actOk = false;
|
||||
$rootScope.loading = true;
|
||||
$rootScope.table = false;
|
||||
|
||||
var profesorArray = [];
|
||||
professors.query(
|
||||
function (successResult){
|
||||
vm.profesor = successResult;
|
||||
angular.forEach(vm.profesor, function (value){
|
||||
profesorArray.push({
|
||||
Cedula:value.id,
|
||||
Nombre:value.name,
|
||||
Apellido:value.lastname,
|
||||
Telefono:value.number,
|
||||
Correo: value.email
|
||||
});
|
||||
});
|
||||
$rootScope.loading = false;
|
||||
$rootScope.table = true;
|
||||
vm.listaProfesor = profesorArray;
|
||||
|
||||
},
|
||||
function(){
|
||||
console.log("Error al obtener los datos.");
|
||||
});
|
||||
|
||||
vm.eliminarProfesorModal = function (index) {
|
||||
$rootScope.index = index;
|
||||
$rootScope.botonOK = true;
|
||||
$rootScope.botonCancelar = true;
|
||||
$rootScope.acceptButton = false;
|
||||
|
||||
$rootScope.rsplice = false;
|
||||
$rootScope.mensaje = "¿Seguro que desea eliminar el Profesor?";
|
||||
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: 'partials/professor/modal/list_professor_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
vm.eliminarProfesor = function (index) {
|
||||
|
||||
$rootScope.botonOK = false;
|
||||
$rootScope.acceptButton = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
$rootScope.urlLo = 'listarProfesor';
|
||||
|
||||
professors.delete({id: vm.profesor[index]._id},
|
||||
function () {
|
||||
$rootScope.rsplice = true;
|
||||
$rootScope.mensaje =
|
||||
"Profesor " + vm.profesor[index].name + " eliminado";
|
||||
},
|
||||
function () {
|
||||
$rootScope.listarProfesorsLoading = false;
|
||||
$rootScope.mensaje =
|
||||
"Error eliminando al Profesor " + vm.profesor[index].name;
|
||||
});
|
||||
};
|
||||
|
||||
vm.removeProfesorSplice = function(index, rsplice) {
|
||||
if(rsplice){
|
||||
vm.listaProfesor.splice(index, 1);
|
||||
$rootScope.rsplice = false;
|
||||
}
|
||||
};
|
||||
|
||||
vm.modificarProfesor = function (index) {
|
||||
profesorSeleccionado._id = vm.profesor[index]._id;
|
||||
profesorSeleccionado.Cedula = vm.profesor[index].id;
|
||||
profesorSeleccionado.Nombre = vm.profesor[index].name;
|
||||
profesorSeleccionado.Apellido= vm.profesor[index].lastname;
|
||||
profesorSeleccionado.Telefono = vm.profesor[index].number;
|
||||
profesorSeleccionado.Correo= vm.profesor[index].email;
|
||||
$location.url('actualizarProfesor');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$location.url(urlLo);
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
|
||||
crearProfesorCtrl.$inject =
|
||||
['$scope','$rootScope', '$location', 'professors', '$modal'];
|
||||
function crearProfesorCtrl($scope, $rootScope, $location, professors, $modal){
|
||||
|
||||
var vm = this;
|
||||
$rootScope.mensaje = "";
|
||||
|
||||
vm.submit = function() {
|
||||
|
||||
if (vm.data_input_form.$valid){
|
||||
var professor = {
|
||||
"id": vm.profesor.Cedula,
|
||||
"name": vm.profesor.Nombre,
|
||||
"lastname": vm.profesor.Apellido,
|
||||
"email": vm.profesor.Correo,
|
||||
"number": vm.profesor.Telefono,
|
||||
"role": "professor",
|
||||
"password": vm.profesor.Password
|
||||
};
|
||||
|
||||
$rootScope.botonOk = false;
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: 'partials/professor/modal/create_professor_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return $rootScope.items;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
professors.save(professor,
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'listarProfesor';
|
||||
$rootScope.mensaje =
|
||||
"Profesor " + vm.profesor.Apellido + ", " + vm.profesor.Nombre + " agregado";
|
||||
},
|
||||
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'listarProfesor';
|
||||
$rootScope.mensaje =
|
||||
"Error al agregar al profesor " + vm.profesor.Apellido + ", " + vm.profesor.Nombre;
|
||||
});
|
||||
}else{
|
||||
|
||||
vm.submitted = true;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$location.url(urlLo);
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
|
||||
actualizarProfesorCtrl.$inject =
|
||||
['$scope','$rootScope', '$location', 'professors', '$modal', 'profesorSeleccionado' ];
|
||||
function actualizarProfesorCtrl ( $scope, $rootScope, $location, professors, $modal, profesorSeleccionado ){
|
||||
|
||||
var vm = this;
|
||||
vm.profesor = profesorSeleccionado;
|
||||
$rootScope.mensaje = "";
|
||||
$rootScope.actOk = false;
|
||||
|
||||
vm.submit = function() {
|
||||
|
||||
var professor = {
|
||||
"id": vm.profesor.Cedula,
|
||||
"name": vm.profesor.Nombre,
|
||||
"lastname": vm.profesor.Apellido,
|
||||
"email": vm.profesor.Correo,
|
||||
"number": vm.profesor.Telefono,
|
||||
"role": "professor",
|
||||
"password": vm.profesor.Password
|
||||
};
|
||||
|
||||
$rootScope.botonOk = false;
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: 'partials/professor/modal/update_professor_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return $rootScope.items;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
professors.update({ id: vm.profesor._id}, professor,
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
$rootScope.urlLo = 'listarProfesor';
|
||||
$rootScope.mensaje =
|
||||
"Profesor " + vm.profesor.Apellido + ", " + vm.profesor.Nombre + " actualizado";
|
||||
},
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
$rootScope.urlLo = 'listarProfesor';
|
||||
$rootScope.mensaje =
|
||||
"Error al modificar al profesor " + vm.profesor.Apellido + ", " + vm.profesor.Nombre;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$location.url(urlLo);
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -14,62 +14,62 @@
|
||||
|
||||
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
|
||||
function getRoutes($stateProvider, $urlRouterProvider){
|
||||
$urlRouterProvider.otherwise('/listarProfesor');
|
||||
$urlRouterProvider.otherwise('/ProfessorList');
|
||||
|
||||
$stateProvider
|
||||
.state('listarProfesor', {
|
||||
url: '/listarProfesor',
|
||||
.state('ProfessorList', {
|
||||
url: '/ProfessorList',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'SidebarCtrl'
|
||||
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/professor/list_professor.html',
|
||||
controller: 'listarProfesorCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
templateUrl: 'partials/professor/professor_list.html',
|
||||
controller: 'ProfessorListCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.state('crearProfesor', {
|
||||
url: '/crearProfesor',
|
||||
.state('ProfessorCreate', {
|
||||
url: '/ProfessorCreate',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'SidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/professor/create_professor.html',
|
||||
controller: 'crearProfesorCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
templateUrl: 'partials/professor/professor_create.html',
|
||||
controller: 'ProfessorCreateCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.state('actualizarProfesor', {
|
||||
url: '/actualizarProfesor',
|
||||
.state('ProfessorUpdate', {
|
||||
url: '/ProfessorUpdate',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
controller: 'SidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/professor/update_professor.html',
|
||||
controller: 'actualizarProfesorCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
templateUrl: 'partials/professor/professor_update.html',
|
||||
controller: 'ProfessorUpdateCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
.factory('professors', professors)
|
||||
.value('selectedCourse',{})
|
||||
.value('selectedSection',{})
|
||||
.value('selectedStudent',{})
|
||||
.value('profesorSeleccionado',{});
|
||||
|
||||
professors.$inject = ['$resource','$rootScope'];
|
||||
|
||||
76
app/partials/professor/professor_create.controller.js
Normal file
76
app/partials/professor/professor_create.controller.js
Normal file
@@ -0,0 +1,76 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.professor')
|
||||
.controller('ProfessorCreateCtrl', ProfessorCreateCtrl)
|
||||
|
||||
ProfessorCreateCtrl.$inject =
|
||||
['$scope','$rootScope', '$state', 'professors', '$modal'];
|
||||
function ProfessorCreateCtrl($scope, $rootScope, $state, professors, $modal){
|
||||
|
||||
var vm = this;
|
||||
$rootScope.mensaje = "";
|
||||
vm.submit = function() {
|
||||
|
||||
if (vm.data_input_form.$valid){
|
||||
var professor = {
|
||||
"id": vm.profesor.Cedula,
|
||||
"name": vm.profesor.Nombre,
|
||||
"lastname": vm.profesor.Apellido,
|
||||
"email": vm.profesor.Correo,
|
||||
"number": vm.profesor.Telefono,
|
||||
"role": "professor",
|
||||
"password": vm.profesor.Password
|
||||
};
|
||||
|
||||
$rootScope.botonOk = false;
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: 'partials/professor/modal/create_professor_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return $rootScope.items;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
professors.save(professor,
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.mensaje =
|
||||
"Profesor " + vm.profesor.Apellido + ", " + vm.profesor.Nombre + " agregado";
|
||||
},
|
||||
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'listarProfesor';
|
||||
$rootScope.mensaje =
|
||||
"Error al agregar al profesor " + vm.profesor.Apellido + ", " + vm.profesor.Nombre;
|
||||
});
|
||||
}else{
|
||||
|
||||
vm.submitted = true;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$state.go('ProfessorList');
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
})();
|
||||
115
app/partials/professor/professor_list.controller.js
Normal file
115
app/partials/professor/professor_list.controller.js
Normal file
@@ -0,0 +1,115 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.professor')
|
||||
.controller('ProfessorListCtrl', ProfessorListCtrl)
|
||||
|
||||
ProfessorListCtrl.$inject =
|
||||
[ '$scope', '$rootScope', '$state', 'professors', '$modal', 'profesorSeleccionado' ];
|
||||
function ProfessorListCtrl( $scope, $rootScope, $state, professors, $modal, profesorSeleccionado ){
|
||||
|
||||
var vm = this;
|
||||
vm.lista = true;
|
||||
$rootScope.actOk = false;
|
||||
$rootScope.loading = true;
|
||||
$rootScope.table = false;
|
||||
|
||||
var profesorArray = [];
|
||||
professors.query(
|
||||
function (successResult){
|
||||
vm.profesor = successResult;
|
||||
angular.forEach(vm.profesor, function (value){
|
||||
profesorArray.push({
|
||||
Cedula:value.id,
|
||||
Nombre:value.name,
|
||||
Apellido:value.lastname,
|
||||
Telefono:value.number,
|
||||
Correo: value.email
|
||||
});
|
||||
});
|
||||
$rootScope.loading = false;
|
||||
$rootScope.table = true;
|
||||
vm.listaProfesor = profesorArray;
|
||||
|
||||
},
|
||||
function(){
|
||||
console.log("Error al obtener los datos.");
|
||||
});
|
||||
|
||||
vm.eliminarProfesorModal = function (index) {
|
||||
$rootScope.index = index;
|
||||
$rootScope.botonOK = true;
|
||||
$rootScope.botonCancelar = true;
|
||||
$rootScope.acceptButton = false;
|
||||
|
||||
$rootScope.rsplice = false;
|
||||
$rootScope.mensaje = "¿Seguro que desea eliminar el Profesor?";
|
||||
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: 'partials/professor/modal/list_professor_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
vm.eliminarProfesor = function (index) {
|
||||
|
||||
$rootScope.botonOK = false;
|
||||
$rootScope.acceptButton = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
|
||||
professors.delete({id: vm.profesor[index]._id},
|
||||
function () {
|
||||
$rootScope.rsplice = true;
|
||||
$rootScope.mensaje =
|
||||
"Profesor " + vm.profesor[index].name + " eliminado";
|
||||
},
|
||||
function () {
|
||||
$rootScope.listarProfesorsLoading = false;
|
||||
$rootScope.mensaje =
|
||||
"Error eliminando al Profesor " + vm.profesor[index].name;
|
||||
});
|
||||
};
|
||||
|
||||
vm.removeProfesorSplice = function(index, rsplice) {
|
||||
if(rsplice){
|
||||
vm.listaProfesor.splice(index, 1);
|
||||
$rootScope.rsplice = false;
|
||||
}
|
||||
};
|
||||
|
||||
vm.modificarProfesor = function (index) {
|
||||
profesorSeleccionado._id = vm.profesor[index]._id;
|
||||
profesorSeleccionado.Cedula = vm.profesor[index].id;
|
||||
profesorSeleccionado.Nombre = vm.profesor[index].name;
|
||||
profesorSeleccionado.Apellido = vm.profesor[index].lastname;
|
||||
profesorSeleccionado.Telefono = vm.profesor[index].number;
|
||||
profesorSeleccionado.Correo = vm.profesor[index].email;
|
||||
$state.go('ProfessorUpdate');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$state.go('ProfessorList');
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
})();
|
||||
73
app/partials/professor/professor_update.controller.js
Normal file
73
app/partials/professor/professor_update.controller.js
Normal file
@@ -0,0 +1,73 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.professor')
|
||||
.controller('ProfessorUpdateCtrl', ProfessorUpdateCtrl)
|
||||
|
||||
ProfessorUpdateCtrl.$inject =
|
||||
['$scope','$rootScope', '$state', 'professors', '$modal', 'profesorSeleccionado' ];
|
||||
function ProfessorUpdateCtrl ( $scope, $rootScope, $state, professors, $modal, profesorSeleccionado ){
|
||||
|
||||
var vm = this;
|
||||
vm.profesor = profesorSeleccionado;
|
||||
$rootScope.mensaje = "";
|
||||
$rootScope.actOk = false;
|
||||
|
||||
vm.submit = function() {
|
||||
|
||||
var professor = {
|
||||
"id": vm.profesor.Cedula,
|
||||
"name": vm.profesor.Nombre,
|
||||
"lastname": vm.profesor.Apellido,
|
||||
"email": vm.profesor.Correo,
|
||||
"number": vm.profesor.Telefono,
|
||||
"role": "professor",
|
||||
"password": vm.profesor.Password
|
||||
};
|
||||
|
||||
$rootScope.botonOk = false;
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: 'partials/professor/modal/update_professor_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return $rootScope.items;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
professors.update({ id: vm.profesor._id}, professor,
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
$rootScope.mensaje =
|
||||
"Profesor " + vm.profesor.Apellido + ", " + vm.profesor.Nombre + " actualizado";
|
||||
},
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
$rootScope.mensaje =
|
||||
"Error al modificar al profesor " + vm.profesor.Apellido + ", " + vm.profesor.Nombre;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$state.go('ProfessorList');
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
return vm;
|
||||
};
|
||||
})();
|
||||
57
app/partials/report/course_assist.controller.js
Normal file
57
app/partials/report/course_assist.controller.js
Normal file
@@ -0,0 +1,57 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.reports')
|
||||
.controller('CourseAssistCtrl', CourseAssistCtrl)
|
||||
|
||||
CourseAssistCtrl.$inject =
|
||||
['$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedCourse'];
|
||||
function CourseAssistCtrl($scope, $rootScope, $state, professors, $modal, selectedCourse) {
|
||||
var vm = this;
|
||||
var professorid = $rootScope.professorId;
|
||||
vm.course = null;
|
||||
vm.lectures = 0;
|
||||
vm.percentage = 0;
|
||||
vm.positive = 0;
|
||||
vm.professor = null;
|
||||
vm.negative = 0;
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
angular.forEach (vm.professor.courses,
|
||||
function (value, key){
|
||||
if (value._id == selectedCourse._id ) {
|
||||
selectedCourse.index = key;
|
||||
vm.course = value;
|
||||
}
|
||||
});
|
||||
|
||||
angular.forEach (vm.course.sections,
|
||||
function (value){
|
||||
angular.forEach (value.students,
|
||||
function (valued){
|
||||
vm.lectures = valued.assistance;
|
||||
angular.forEach (valued.assistanceTotal,
|
||||
function (valueda){
|
||||
if (valueda.assistance) {
|
||||
vm.positive++;
|
||||
} else {
|
||||
vm.negative++;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
vm.total = vm.positive + vm.negative;
|
||||
vm.percentage = ((vm.positive/vm.total)/vm.lectures)*100;
|
||||
},
|
||||
function (){
|
||||
console.log("Error al obtener los datos.");
|
||||
});
|
||||
|
||||
vm.back = function (index) {
|
||||
$state.go('courseReport');
|
||||
};
|
||||
};
|
||||
})();
|
||||
16
app/partials/report/course_assist.html
Normal file
16
app/partials/report/course_assist.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<div class="row clearfix col-md-12">
|
||||
<h4>Asistencia de Materia {{vm.course.name}}</h4>
|
||||
<br>
|
||||
</br>
|
||||
<div class= "row clearfix col-md-12">
|
||||
<div> Estadisticas </div>
|
||||
<div> Porcentaje de Asistencia: {{vm.percentage}} % </div>
|
||||
<div> Total de Dias de Clase: {{vm.lectures}} </div>
|
||||
</div>
|
||||
<button class = "btn-warning btn"
|
||||
type = "button"
|
||||
style = "margin: 10px"
|
||||
ng-click = "vm.back()">
|
||||
Regresar
|
||||
</button>
|
||||
</div>
|
||||
43
app/partials/report/course_report.controller.js
Normal file
43
app/partials/report/course_report.controller.js
Normal file
@@ -0,0 +1,43 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.reports')
|
||||
.controller('CourseReportCtrl', CourseReportCtrl)
|
||||
|
||||
CourseReportCtrl.$inject =
|
||||
['$scope', '$rootScope', '$state', 'professors', '$modal', 'profesorSeleccionado', 'selectedCourse'];
|
||||
function CourseReportCtrl($scope, $rootScope, $state, professors, $modal, profesorSeleccionado, selectedCourse) {
|
||||
var vm = this;
|
||||
var professorid = $rootScope.professorId;
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
vm.course = vm.professor.courses;
|
||||
},
|
||||
function (){
|
||||
console.log("Error al obtener los datos.");
|
||||
});
|
||||
|
||||
vm.courseReports = function (index) {
|
||||
selectedCourse._id = vm.course[index]._id;
|
||||
$state.go('courseAssist');
|
||||
};
|
||||
|
||||
vm.listSections = function (index) {
|
||||
selectedCourse._id = vm.course[index]._id;
|
||||
$state.go('sectionReport');
|
||||
};
|
||||
|
||||
$scope.ok = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
})();
|
||||
53
app/partials/report/course_report.html
Normal file
53
app/partials/report/course_report.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<div class="row clearfix">
|
||||
<h4>Reportes de Materias</h4>
|
||||
<br>
|
||||
</br>
|
||||
<div>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="10%" style="text-align: center">
|
||||
Código
|
||||
</th>
|
||||
<th width="20%" style="text-align: center">
|
||||
Nombre
|
||||
</th>
|
||||
<th width="5%" style="text-align: center">
|
||||
Creditos
|
||||
</th>
|
||||
<th width="40%" style="text-align: center">
|
||||
Descripción
|
||||
</th>
|
||||
<th width="15%" style="text-align: center">
|
||||
Reportes de Materia
|
||||
</th>
|
||||
<th width="10%" style="text-align: center">
|
||||
Secciones
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="course in vm.course">
|
||||
<td style="vertical-align:middle">{{ course.code }}</td>
|
||||
<td style="vertical-align:middle">{{ course.name }}</td>
|
||||
<td style="vertical-align:middle">{{ course.credits }}</td>
|
||||
<td style="vertical-align:middle">{{ course.description }}</td>
|
||||
<td style="text-align: center">
|
||||
<span
|
||||
class="glyphicon glyphicon-list-alt"
|
||||
aria-hidden="true"
|
||||
ng-click="vm.courseReports($index)"
|
||||
style="cursor:pointer"></span>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<span
|
||||
class="glyphicon glyphicon-list"
|
||||
aria-hidden="true"
|
||||
ng-click="vm.listSections($index)"
|
||||
style="cursor:pointer"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,105 +0,0 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.reports')
|
||||
.controller('poblacionNacimientoCtrl', poblacionNacimientoCtrl)
|
||||
.controller('poblacionActivaCtrl', poblacionActivaCtrl)
|
||||
.controller('hombresEdadCtrl', hombresEdadCtrl)
|
||||
.controller('mujeresEdadCtrl', mujeresEdadCtrl)
|
||||
.controller('comidasDiaCtrl', comidasDiaCtrl)
|
||||
.controller('nivelEducacionCtrl', nivelEducacionCtrl)
|
||||
.controller('serviciosHogaresCtrl', serviciosHogaresCtrl)
|
||||
.controller('ingresosAnualesCtrl', ingresosAnualesCtrl)
|
||||
|
||||
poblacionNacimientoCtrl.$inject = ['$rootScope', 'ReportJson'];
|
||||
function poblacionNacimientoCtrl($rootScope, ReportJson){
|
||||
|
||||
$rootScope.labelPoblacionNacimiento = ['Extranjeros', 'Residentes'];
|
||||
ReportJson.get({id:$rootScope.elementId}, function(data) {
|
||||
|
||||
$rootScope.dataPoblacionNacimiento = data.Data[0].dataPoblacionNacimiento;
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
poblacionActivaCtrl.$inject = ['$rootScope', 'ReportJson'];
|
||||
function poblacionActivaCtrl($rootScope, ReportJson){
|
||||
|
||||
$rootScope.labelsPoblacionActiva = ['Hombres', 'Mujeres'];
|
||||
$rootScope.seriesPoblacionActiva = ['Economicamente Pasivos', 'Economicamente Activos'];
|
||||
$rootScope.dataPoblacionActiva = [];
|
||||
|
||||
ReportJson.get({id:$rootScope.elementId},function(data) {
|
||||
|
||||
$rootScope.dataPoblacionActiva = data.Data[0].dataPoblacionActiva;
|
||||
});
|
||||
};
|
||||
|
||||
hombresEdadCtrl.$inject = ['$rootScope', 'ReportJson'];
|
||||
function hombresEdadCtrl($rootScope, ReportJson){
|
||||
$rootScope.labelsHombresEdad = ['0-6', '7-12','13-18', '19-25','26-44', '45-60','61-99', '80-84', '90+'];
|
||||
$rootScope.seriesHombresEdad = ['Hombres por Generacion'];
|
||||
$rootScope.dataHombresEdad = [];
|
||||
|
||||
ReportJson.get({id:$rootScope.elementId},function(data) {
|
||||
|
||||
$rootScope.dataHombresEdad = data.Data[0].dataHombresEdad;
|
||||
});
|
||||
};
|
||||
|
||||
mujeresEdadCtrl.$inject = ['$rootScope', 'ReportJson'];
|
||||
function mujeresEdadCtrl($rootScope, ReportJson){
|
||||
$rootScope.labelsMujeresEdad = ['0-6', '7-12','13-18', '19-25','26-44', '45-60','61-99', '80-84', '90+'];
|
||||
$rootScope.seriesMujeresEdad = ['Mujeres por Generacion'];
|
||||
$rootScope.dataMujeresEdad = [];
|
||||
|
||||
ReportJson.get({id:$rootScope.elementId},function(data) {
|
||||
|
||||
$rootScope.dataMujeresEdad = data.Data[0].dataMujeresEdad;
|
||||
});
|
||||
};
|
||||
|
||||
comidasDiaCtrl.$inject = ['$rootScope', 'ReportJson'];
|
||||
function comidasDiaCtrl($rootScope, ReportJson){
|
||||
$rootScope.labelsComidasDia = ['Desayuno', 'Almuerzo', 'Cena'];
|
||||
$rootScope.dataComidasDia = [];
|
||||
|
||||
ReportJson.get({id:$rootScope.elementId},function(data) {
|
||||
|
||||
$rootScope.dataComidasDia = [data.Data[0].dataComidasDia];
|
||||
});
|
||||
};
|
||||
|
||||
nivelEducacionCtrl.$inject = ['$rootScope', 'ReportJson'];
|
||||
function nivelEducacionCtrl($rootScope, ReportJson){
|
||||
$rootScope.labelsNivelEducacion = ['Nivel de Educacion Superior', 'Nivel de Educacion Media'];
|
||||
|
||||
ReportJson.get({id:$rootScope.elementId},function(data) {
|
||||
|
||||
$rootScope.dataNivelEducacion = data.Data[0].dataNivelEducacion;
|
||||
});
|
||||
};
|
||||
|
||||
serviciosHogaresCtrl.$inject = ['$rootScope', 'ReportJson'];
|
||||
function serviciosHogaresCtrl($rootScope, ReportJson){
|
||||
$rootScope.labelsServiciosHogares = ['Agua', 'Gas', 'Electricidad' , 'Linea Telefonica'];
|
||||
$rootScope.dataServiciosHogares = [];
|
||||
|
||||
ReportJson.get({id:$rootScope.elementId},function(data) {
|
||||
|
||||
$rootScope.dataServiciosHogares = [data.Data[0].dataServiciosHogares];
|
||||
});
|
||||
};
|
||||
|
||||
ingresosAnualesCtrl.$inject = ['$rootScope', 'ReportJson'];
|
||||
function ingresosAnualesCtrl($rootScope, ReportJson){
|
||||
$rootScope.labelsIngresosAnuales = ['Menos de 10.000', 'De 11.000 a 20.000', 'De 21.000 a 35.000' , 'De 35.000 a 50.000'];
|
||||
|
||||
ReportJson.get({id:$rootScope.elementId},function(data) {
|
||||
|
||||
$rootScope.dataIngresosAnuales = data.Data[0].dataIngresosAnuales;
|
||||
});
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -1,116 +0,0 @@
|
||||
<section>
|
||||
<div class="page-header">
|
||||
<h1>Reportes</h1>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-sm-12 ng-scope"
|
||||
ng-controller="poblacionNacimientoCtrl">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Reporte Alumno
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="chart-container">
|
||||
<canvas class="chart chart-pie"
|
||||
chart-data="dataPoblacionNacimiento"
|
||||
chart-labels="labelPoblacionNacimiento"></canvas>
|
||||
<chart-legend>
|
||||
<ul class="line-legend">
|
||||
<li><span style="background-color:rgba(151,187,205,1)"></span>{{'TAG_FOREIGN' }} </li>
|
||||
<li><span style="background-color:rgba(220,220,220,1)"></span>{{'TAG_RESIDENT' }} </li>
|
||||
</ul>
|
||||
</chart-legend>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-sm-12 code">
|
||||
<div class="ng-isolate-scope">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-sm-12 code">
|
||||
<div class="ng-isolate-scope">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-sm-12 ng-scope"
|
||||
ng-controller="poblacionActivaCtrl">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Reporte por Clase
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="chart-container">
|
||||
<canvas class="chart chart-bar"
|
||||
chart-data="dataPoblacionActiva"
|
||||
chart-labels="labelsPoblacionActiva"
|
||||
chart-series="seriesPoblacionActiva"></canvas>
|
||||
<chart-legend>
|
||||
<ul class="line-legend">
|
||||
<li><span style="background-color:rgba(151,187,205,1)"></span>{{'TAG_ECONOMIC_PASSIVE' }} </li>
|
||||
<li><span style="background-color:rgba(220,220,220,1)"></span>{{'TAG_ECONOMIC_ACTIVE' }} </li>
|
||||
</ul>
|
||||
</chart-legend>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-sm-12 code">
|
||||
<div class="ng-isolate-scope">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-sm-12 ng-scope"
|
||||
ng-controller="hombresEdadCtrl">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Reporte por Sección
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="chart-container">
|
||||
<canvas class="chart chart-bar"
|
||||
chart-data="dataHombresEdad"
|
||||
chart-labels="labelsHombresEdad"
|
||||
chart-series="seriesHombresEdad"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-sm-12 code">
|
||||
<div class="ng-isolate-scope">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-sm-12 ng-scope"
|
||||
ng-controller="mujeresEdadCtrl">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Reporte por Materia
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="chart-container">
|
||||
<canvas class="chart chart-bar"
|
||||
chart-data="dataMujeresEdad"
|
||||
chart-labels="labelsMujeresEdad"
|
||||
chart-series="seriesMujeresEdad"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-sm-12 code">
|
||||
<div class="ng-isolate-scope">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -14,68 +14,110 @@
|
||||
|
||||
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
|
||||
function getRoutes($stateProvider, $urlRouterProvider){
|
||||
$urlRouterProvider.otherwise('/reportes');
|
||||
$urlRouterProvider.otherwise('/reportesPorMateria');
|
||||
|
||||
$stateProvider
|
||||
|
||||
.state('poblacionNacimiento', {
|
||||
url: '/reportes',
|
||||
.state('courseReport', {
|
||||
url: '/reportesPorMateria',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'SidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/reportes/reportes.html',
|
||||
controller: 'poblacionNacimientoCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
templateUrl: 'partials/report/course_report.html',
|
||||
controller: 'CourseReportCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('poblacionActiva', {
|
||||
url: '/poblacionActivaCtrl',
|
||||
templateUrl: 'partials/reportes/reportes.html',
|
||||
controller: 'poblacionActivaCtrl',
|
||||
controllerAs: 'vm'
|
||||
.state('sectionReport', {
|
||||
url: '/reportesPorSeccion',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'SidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/report/section_report.html',
|
||||
controller: 'SectionReportCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('hombresEdad', {
|
||||
url: '/hombresEdad',
|
||||
templateUrl: 'partials/reportes/reportes.html',
|
||||
controller: 'hombresEdadCtrl',
|
||||
controllerAs: 'vm'
|
||||
.state('studentReport', {
|
||||
url: '/reportesPorEstudiante',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'SidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/report/student_report.html',
|
||||
controller: 'StudentReportCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('mujeresEdad', {
|
||||
url: '/mujeresEdad',
|
||||
templateUrl: 'partials/reportes/reportes.html',
|
||||
controller: 'mujeresEdadCtrl',
|
||||
controllerAs: 'vm'
|
||||
.state('studentAssist', {
|
||||
url: '/asistenciaPorEstudiante',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'SidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/report/student_assist.html',
|
||||
controller: 'StudentAssistCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('comidasDia', {
|
||||
url: '/comidasDia',
|
||||
templateUrl: 'partials/reportes/reportes.html',
|
||||
controller: 'comidasDiaCtrl',
|
||||
controllerAs: 'vm'
|
||||
.state('sectionAssist', {
|
||||
url: '/asistenciaPorSeccion',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'SidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/report/section_assist.html',
|
||||
controller: 'SectionAssistCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('nivelEducacion', {
|
||||
url: '/nivelEducacion',
|
||||
templateUrl: 'partials/reportes/reportes.html',
|
||||
controller: 'nivelEducacionCtrl',
|
||||
controllerAs: 'vm'
|
||||
})
|
||||
.state('serviciosHogares', {
|
||||
url: '/serviciosHogares',
|
||||
templateUrl: 'partials/reportes/reportes.html',
|
||||
controller: 'serviciosHogaresCtrl',
|
||||
controllerAs: 'vm'
|
||||
})
|
||||
.state('ingresosAnuales', {
|
||||
url: '/ingresosAnuales',
|
||||
templateUrl: 'partials/reportes/reportes.html',
|
||||
controller: 'ingresosAnualesCtrl',
|
||||
controllerAs: 'vm'
|
||||
.state('courseAssist', {
|
||||
url: '/asistenciaPorMateria',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'SidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/report/course_assist.html',
|
||||
controller: 'CourseAssistCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
|
||||
angular
|
||||
.module('app.reports')
|
||||
.factory('ReportJson', ReportJson)
|
||||
//.factory('ReportJson', ReportJson)
|
||||
.value('id',{})
|
||||
|
||||
ReportJson.$inject = ['$resource','$rootScope'];
|
||||
/*ReportJson.$inject = ['$resource','$rootScope'];
|
||||
function ReportJson($resource, $rootScope){
|
||||
return $resource('http://'+$rootScope.domainUrl+'/api/reports/:id');
|
||||
//var json="data/data.json";
|
||||
//return $resource(json);
|
||||
};
|
||||
//return $resource('http://'+$rootScope.domainUrl+'/api/reports/:id');
|
||||
var json="data/data.json";
|
||||
return $resource(json);
|
||||
};*/
|
||||
|
||||
})();
|
||||
54
app/partials/report/section_assist.controller.js
Normal file
54
app/partials/report/section_assist.controller.js
Normal file
@@ -0,0 +1,54 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.reports')
|
||||
.controller('SectionAssistCtrl', SectionAssistCtrl)
|
||||
|
||||
SectionAssistCtrl.$inject =
|
||||
['$scope', '$rootScope','$state', 'professors', '$modal', 'selectedCourse', 'selectedSection', 'selectedStudent'];
|
||||
function SectionAssistCtrl($scope, $rootScope, $state, professors, $modal, selectedCourse, selectedSection, selectedStudent) {
|
||||
var vm = this;
|
||||
var professorid = $rootScope.professorId;
|
||||
vm.section = [];
|
||||
vm.lectures = 0;
|
||||
vm.percentage = 0;
|
||||
vm.positive = 0;
|
||||
vm.professor = null;
|
||||
vm.negative = 0;
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
angular.forEach (vm.professor.courses[selectedCourse.index].sections,
|
||||
function (value, key){
|
||||
if (value._id == selectedSection._id ) {
|
||||
selectedSection.index = key;
|
||||
vm.section = value;
|
||||
}
|
||||
});
|
||||
|
||||
angular.forEach (vm.section.students,
|
||||
function (value){
|
||||
vm.lectures = value.assistance;
|
||||
angular.forEach (value.assistanceTotal,
|
||||
function (valued){
|
||||
if (valued.assistance) {
|
||||
vm.positive++;
|
||||
} else {
|
||||
vm.negative++;
|
||||
}
|
||||
});
|
||||
});
|
||||
vm.total = vm.positive + vm.negative;
|
||||
vm.percentage = ((vm.positive/vm.total)/vm.lectures)*100;
|
||||
},
|
||||
function (){
|
||||
console.log("Error al obtener los datos.");
|
||||
});
|
||||
|
||||
vm.back = function (index) {
|
||||
$state.go('sectionReport');
|
||||
};
|
||||
};
|
||||
})();
|
||||
16
app/partials/report/section_assist.html
Normal file
16
app/partials/report/section_assist.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<div class="row clearfix col-md-12">
|
||||
<h4>Asistencia de Sección {{vm.section.name}}</h4>
|
||||
<br>
|
||||
</br>
|
||||
<div class= "row clearfix col-md-12">
|
||||
<div> Estadisticas </div>
|
||||
<div> Porcentaje de Asistencia: {{vm.percentage}} % </div>
|
||||
<div> Total de Dias de Clase: {{vm.lectures}} </div>
|
||||
</div>
|
||||
<button class = "btn-warning btn"
|
||||
type = "button"
|
||||
style = "margin: 10px"
|
||||
ng-click = "vm.back()">
|
||||
Regresar
|
||||
</button>
|
||||
</div>
|
||||
56
app/partials/report/section_report.controller.js
Normal file
56
app/partials/report/section_report.controller.js
Normal file
@@ -0,0 +1,56 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.reports')
|
||||
.controller('SectionReportCtrl', SectionReportCtrl)
|
||||
|
||||
SectionReportCtrl.$inject =
|
||||
['$scope', '$rootScope', '$state', 'professors', '$modal', 'profesorSeleccionado', 'selectedCourse', 'selectedSection'];
|
||||
function SectionReportCtrl($scope, $rootScope, $state, professors, $modal, profesorSeleccionado, selectedCourse, selectedSection) {
|
||||
var vm = this;
|
||||
var professorid = $rootScope.professorId;
|
||||
vm.section = [];
|
||||
vm.professor = null;
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
angular.forEach (vm.professor.courses,
|
||||
function (value, key){
|
||||
if (value._id == selectedCourse._id ) {
|
||||
vm.index = key;
|
||||
vm.section = value.sections;
|
||||
}
|
||||
});
|
||||
},
|
||||
function (){
|
||||
console.log("Error al obtener los datos.");
|
||||
});
|
||||
|
||||
vm.back = function (index) {
|
||||
$state.go('courseReport');
|
||||
};
|
||||
|
||||
vm.sectionReport = function (index) {
|
||||
selectedSection._id = vm.section[index]._id;
|
||||
selectedCourse.index = vm.index;
|
||||
$state.go('sectionAssist');
|
||||
};
|
||||
|
||||
vm.listStudents = function (index) {
|
||||
selectedSection._id = vm.section[index]._id;
|
||||
selectedCourse.index = vm.index;
|
||||
$state.go('studentReport');
|
||||
};
|
||||
|
||||
$scope.ok = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
};
|
||||
|
||||
})();
|
||||
57
app/partials/report/section_report.html
Normal file
57
app/partials/report/section_report.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<div class="row clearfix">
|
||||
<h4>Reportes de Secciones</h4>
|
||||
<br>
|
||||
</br>
|
||||
<div>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%" style="text-align: center">
|
||||
Sección
|
||||
</th>
|
||||
<th width="20%" style="text-align: center">
|
||||
Nombre de la Materia
|
||||
</th>
|
||||
<th width="20%" style="text-align: center">
|
||||
Codigo de la Materia
|
||||
</th>
|
||||
<th width="10%" style="text-align: center">
|
||||
Semestre
|
||||
</th>
|
||||
<th width="20%" style="text-align: center">
|
||||
Reportes por Sección
|
||||
</th>
|
||||
<th width="10%" style="text-align: center">
|
||||
Estudiantes
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat = "section in vm.section">
|
||||
<td style="vertical-align:middle">{{ section.name }}</td>
|
||||
<td style="vertical-align:middle">{{ section.course }}</td>
|
||||
<td style="vertical-align:middle">{{ section.code }}</td>
|
||||
<td style="vertical-align:middle">{{ section.semester }}</td>
|
||||
<td style="text-align: center">
|
||||
<span class="glyphicon glyphicon-list-alt"
|
||||
aria-hidden="true"
|
||||
ng-click="vm.sectionReport($index)"
|
||||
style="cursor:pointer"></span>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<span class="glyphicon glyphicon-list"
|
||||
aria-hidden="true"
|
||||
ng-click="vm.listStudents($index)"
|
||||
style="cursor:pointer"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<button class = "btn-warning btn"
|
||||
type = "button"
|
||||
style = "margin: 10px"
|
||||
ng-click = "vm.back()">
|
||||
Regresar
|
||||
</button>
|
||||
</div>
|
||||
52
app/partials/report/student_assist.controller.js
Normal file
52
app/partials/report/student_assist.controller.js
Normal file
@@ -0,0 +1,52 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.reports')
|
||||
.controller('StudentAssistCtrl', StudentAssistCtrl)
|
||||
|
||||
StudentAssistCtrl.$inject =
|
||||
['$scope', '$rootScope','$state', 'professors', '$modal', 'selectedCourse', 'selectedSection', 'selectedStudent'];
|
||||
function StudentAssistCtrl($scope, $rootScope, $state, professors, $modal, selectedCourse, selectedSection, selectedStudent) {
|
||||
var vm = this;
|
||||
var professorid = $rootScope.professorId;
|
||||
vm.section = [];
|
||||
vm.lectures = 0;
|
||||
vm.percentage = 0;
|
||||
vm.positive = 0;
|
||||
vm.professor = null;
|
||||
vm.negative = 0;
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
angular.forEach (vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students,
|
||||
function (value, key){
|
||||
if (value._id == selectedStudent._id ) {
|
||||
selectedStudent.index = key;
|
||||
vm.assistances = value.assistanceTotal;
|
||||
vm.student = value;
|
||||
vm.lectures = value.assistance;
|
||||
}
|
||||
});
|
||||
|
||||
angular.forEach (vm.assistances,
|
||||
function (value){
|
||||
if (value.assistance) {
|
||||
vm.positive++;
|
||||
} else {
|
||||
vm.negative++;
|
||||
}
|
||||
});
|
||||
vm.total = vm.positive + vm.negative;
|
||||
vm.percentage = ((vm.positive/vm.total)/vm.lectures)*100;
|
||||
},
|
||||
function (){
|
||||
console.log("Error al obtener los datos.");
|
||||
});
|
||||
|
||||
vm.back = function (index) {
|
||||
$state.go('studentReport');
|
||||
};
|
||||
};
|
||||
})();
|
||||
42
app/partials/report/student_assist.html
Normal file
42
app/partials/report/student_assist.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<div class="row clearfix col-md-6">
|
||||
<h4>Asistencia - {{vm.student.lastname}}, {{vm.student.name}}</h4>
|
||||
<br>
|
||||
</br>
|
||||
<div class= "row clearfix col-md-6">
|
||||
<div> Estadisticas </div>
|
||||
<div ng-style="vm.percentage < 75 && {'color': 'red'} || vm.percentage >76 && {'color': 'green'}"> Porcentaje de Asistencia: {{vm.percentage}} % </div>
|
||||
<div> Total de Dias de Clase: {{vm.lectures}} </div>
|
||||
<div> Total de Asistencias: {{vm.positive}} </div>
|
||||
<div> Total de Inasistencias: {{vm.negative}} </div>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%" style="text-align: center">
|
||||
Dia
|
||||
</th>
|
||||
<th width="20%" style="text-align: center">
|
||||
Asistencia
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="assistance in vm.assistances">
|
||||
<td style="vertical-align:middle">{{ assistance.day }}</td>
|
||||
<td ng-style="assistance.assistance === false && {'color': 'red'} || assistance.assistance === true && {'color': 'green'}"
|
||||
style="vertical-align:middle">{{ assistance.assistance }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<button class = "btn-warning btn"
|
||||
type = "button"
|
||||
style = "margin: 10px"
|
||||
ng-click = "vm.back()">
|
||||
Regresar
|
||||
</button>
|
||||
</div>
|
||||
49
app/partials/report/student_report.controller.js
Normal file
49
app/partials/report/student_report.controller.js
Normal file
@@ -0,0 +1,49 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.reports')
|
||||
.controller('StudentReportCtrl', StudentReportCtrl)
|
||||
|
||||
StudentReportCtrl.$inject =
|
||||
['$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedCourse', 'selectedSection', 'selectedStudent'];
|
||||
function StudentReportCtrl($scope, $rootScope, $state, professors, $modal, selectedCourse, selectedSection, selectedStudent) {
|
||||
var vm = this;
|
||||
var professorid = $rootScope.professorId;
|
||||
vm.section = [];
|
||||
vm.professor = null;
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
angular.forEach (vm.professor.courses[selectedCourse.index].sections,
|
||||
function (value, key){
|
||||
if (value._id == selectedSection._id ) {
|
||||
selectedSection.index = key;
|
||||
vm.students = value.students;
|
||||
vm.section = value;
|
||||
}
|
||||
});
|
||||
},
|
||||
function (){
|
||||
console.log("Error al obtener los datos.");
|
||||
});
|
||||
|
||||
vm.studentReports = function (index) {
|
||||
selectedStudent._id = vm.students[index]._id;
|
||||
$state.go('studentAssist');
|
||||
};
|
||||
|
||||
vm.back = function (index) {
|
||||
$state.go('sectionReport');
|
||||
};
|
||||
|
||||
$scope.ok = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
};
|
||||
})();
|
||||
44
app/partials/report/student_report.html
Normal file
44
app/partials/report/student_report.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<div class="row clearfix">
|
||||
<h4>Reportes de Estudiantes</h4>
|
||||
<br>
|
||||
</br>
|
||||
<div>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%" style="text-align: center">
|
||||
Cedula
|
||||
</th>
|
||||
<th width="20%" style="text-align: center">
|
||||
Nombre
|
||||
</th>
|
||||
<th width="20%" style="text-align: center">
|
||||
Apellido
|
||||
</th>
|
||||
<th width="20%" style="text-align: center">
|
||||
Reportes por Estudiante
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="student in vm.students">
|
||||
<td style="vertical-align:middle">{{ student.id }}</td>
|
||||
<td style="vertical-align:middle">{{ student.name }}</td>
|
||||
<td style="vertical-align:middle">{{ student.lastname }}</td>
|
||||
<td style="text-align: center">
|
||||
<span class="glyphicon glyphicon-list-alt"
|
||||
aria-hidden="true"
|
||||
ng-click="vm.studentReports($index)"
|
||||
style="cursor:pointer"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<button class = "btn-warning btn"
|
||||
type = "button"
|
||||
style = "margin: 10px"
|
||||
ng-click = "vm.back()">
|
||||
Regresar
|
||||
</button>
|
||||
</div>
|
||||
@@ -1,328 +0,0 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.section')
|
||||
.controller('listarMatriculaCtrl', listarMatriculaCtrl)
|
||||
.controller('crearMatriculaCtrl', crearMatriculaCtrl)
|
||||
.controller('actualizarMatriculaCtrl', actualizarMatriculaCtrl)
|
||||
|
||||
listarMatriculaCtrl.$inject = [ '$scope', '$rootScope', '$location', 'professors', '$modal', 'selectedCourse', 'selectedSection'];
|
||||
function listarMatriculaCtrl ( $scope, $rootScope, $location, professors, $modal, selectedCourse, selectedSection ){
|
||||
var vm = this;
|
||||
var professorid = '56f5fd3a20047f3c15b05f0e';
|
||||
vm.section = [];
|
||||
vm.professor = null;
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
angular.forEach (vm.professor.courses,
|
||||
function (value, key){
|
||||
if (value._id == selectedCourse._id ) {
|
||||
vm.index = key;
|
||||
vm.section = value.sections;
|
||||
}
|
||||
});
|
||||
},
|
||||
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 () {
|
||||
$location.url('crearMatricula');
|
||||
};
|
||||
|
||||
|
||||
vm.eliminarMatriculaModal = function (index) {
|
||||
$rootScope.index = index;
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.otroBotonOk = false;
|
||||
$rootScope.botonCancelar = true;
|
||||
$rootScope.rsplice = false;
|
||||
$rootScope.mensaje = "¿Seguro que desea eliminar la sección?";
|
||||
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: '/partials/section/modal/delete_section_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
vm.eliminarMatricula = function (index) {
|
||||
$rootScope.botonOk = false;
|
||||
$rootScope.otroBotonOk = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
$rootScope.urlLo = 'listarMatricula';
|
||||
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";
|
||||
},
|
||||
function () {
|
||||
$rootScope.mensaje = "Error eliminando la sección " + name;
|
||||
});
|
||||
};
|
||||
|
||||
vm.eliminarMatriculaSplice = function (index, rsplice) {
|
||||
if(rsplice){
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/*************************Fin de Eliminar Matricula*******************/
|
||||
|
||||
vm.modificarMatricula = function (index) {
|
||||
selectedSection._id = vm.section[index]._id;
|
||||
selectedCourse.index = vm.index;
|
||||
$location.url('actualizarMatricula');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$location.url(urlLo);
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
|
||||
crearMatriculaCtrl.$inject =
|
||||
['$scope','$rootScope', '$location', 'professors', '$modal', 'selectedCourse'];
|
||||
function crearMatriculaCtrl($scope, $rootScope, $location, professors, $modal, selectedCourse){
|
||||
var professorid = '56f5fd3a20047f3c15b05f0e';
|
||||
var vm = this;
|
||||
vm.course = {};
|
||||
vm.selectedCourse = selectedCourse;
|
||||
vm.submitted = false;
|
||||
vm.semester, vm.section, vm.materias;
|
||||
$rootScope.mensaje = "";
|
||||
vm.students = [];
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
angular.forEach (vm.professor.courses,
|
||||
function (value, key){
|
||||
if (value._id == vm.selectedCourse._id ) {
|
||||
vm.index = key;
|
||||
vm.section = value.sections;
|
||||
vm.course.code = value.code;
|
||||
vm.course.name = value.name;
|
||||
}
|
||||
});
|
||||
},
|
||||
function (){
|
||||
console.log("Error al obtener los datos.");
|
||||
|
||||
});
|
||||
|
||||
|
||||
vm.submit = function () {
|
||||
|
||||
if (vm.data_input_form.$valid){
|
||||
vm.package = {
|
||||
"name": vm.name,
|
||||
"code": vm.course.code,
|
||||
"course": vm.course.name,
|
||||
"semester": vm.semester,
|
||||
"students": vm.students
|
||||
};
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
vm.professor.courses[vm.index].sections.push(vm.package);
|
||||
professors.update({ id: professorid }, vm.professor,
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'listarMatricula';
|
||||
$rootScope.mensaje = "Sección " + vm.name + " creada";
|
||||
},
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'listarMatricula';
|
||||
$rootScope.mensaje = "Error creando la seccion " + vm.name;
|
||||
});
|
||||
}else{
|
||||
vm.submitted = true;
|
||||
}
|
||||
};
|
||||
|
||||
var xlf = document.getElementById('xlf');
|
||||
function handleFile(e) {
|
||||
var files = e.target.files;
|
||||
var i,f,z;
|
||||
var student = {};
|
||||
for (i = 0, f = files[i]; i != files.length; ++i) {
|
||||
var reader = new FileReader();
|
||||
var name = f.name;
|
||||
reader.onload = function(e) {
|
||||
var data = e.target.result;
|
||||
var workbook = XLSX.read(data, {type: 'binary'});
|
||||
var sheet = workbook.SheetNames[0];
|
||||
var worksheet = workbook.Sheets[sheet];
|
||||
|
||||
/* Find desired cell containing semester and section */
|
||||
vm.semester = worksheet['B5'].v;
|
||||
vm.name = worksheet['B9'].v;
|
||||
//$scope.$apply();
|
||||
|
||||
for (z in worksheet) {
|
||||
/* all keys that do not begin with "!" correspond to cell addresses */
|
||||
if (z[0] === '!') continue;
|
||||
if ((z[0] >'B') && (z[1] > 0) && (z[2] > 1)) {
|
||||
/* Cells that start in the C column represent the sttudent id in the worksheet, the same applies to name and lastname being in D and E columns*/
|
||||
if (z[0] =='C') student.id = worksheet[z].v;
|
||||
if (z[0] =='D') student.name = worksheet[z].v;
|
||||
if (z[0] =='E') student.lastname = worksheet[z].v;
|
||||
if (z[0] =='F') {
|
||||
student.email = worksheet[z].v;
|
||||
/*Since we are only going to use these 3 attributes from the students then we push only this data to the students array*/
|
||||
vm.students.push(student);
|
||||
student = {};
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
$scope.$apply();
|
||||
};
|
||||
reader.readAsBinaryString(f);
|
||||
}
|
||||
}
|
||||
if(xlf.addEventListener) xlf.addEventListener('change', handleFile, false);
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$location.url(urlLo);
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
|
||||
actualizarMatriculaCtrl.$inject = ['$scope', '$rootScope', '$location', 'professors', '$modal', 'selectedSection', 'selectedCourse'];
|
||||
function actualizarMatriculaCtrl($scope, $rootScope, $location, professors, $modal, selectedSection, selectedCourse){
|
||||
var professorid = '56f5fd3a20047f3c15b05f0e';
|
||||
var vm = this;
|
||||
vm.section = {};
|
||||
vm.students = [];
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
angular.forEach (vm.professor.courses[selectedCourse.index].sections,
|
||||
function (value, key){
|
||||
if (value._id == selectedSection._id ) {
|
||||
selectedSection.index = key;
|
||||
vm.students = value.students;
|
||||
vm.section = value;
|
||||
}
|
||||
});
|
||||
},
|
||||
function (){
|
||||
console.log("Error al obtener los datos.");
|
||||
});
|
||||
|
||||
vm.addStudent = function (index) {
|
||||
$location.url('crearEstudiante');
|
||||
};
|
||||
|
||||
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.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: 'partials/section/modal/update_section_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
vm.retirarEstudiante = function (index) {
|
||||
vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students.splice(index, 1);
|
||||
|
||||
professors.update({ id: professorid }, vm.professor,
|
||||
function (){
|
||||
$rootScope.botonOk = false;
|
||||
$rootScope.otroBotonOk = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
$rootScope.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;
|
||||
});
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
$scope.ok = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -14,59 +14,59 @@
|
||||
|
||||
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
|
||||
function getRoutes($stateProvider, $urlRouterProvider){
|
||||
$urlRouterProvider.otherwise('/listarMatricula');
|
||||
$urlRouterProvider.otherwise('/SectionList');
|
||||
|
||||
$stateProvider
|
||||
|
||||
.state('listarMatricula', {
|
||||
url: '/listarMatricula',
|
||||
.state('SectionList', {
|
||||
url: '/SectionList',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
controller: 'SidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/section/list_section.html',
|
||||
controller: 'listarMatriculaCtrl',
|
||||
templateUrl: 'partials/section/section_list.html',
|
||||
controller: 'SectionListCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.state('crearMatricula', {
|
||||
url: '/crearMatricula',
|
||||
.state('SectionCreate', {
|
||||
url: '/SectionCreate',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
controller: 'SidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/section/create_section.html',
|
||||
controller: 'crearMatriculaCtrl',
|
||||
templateUrl: 'partials/section/section_create.html',
|
||||
controller: 'SectionCreateCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.state('actualizarMatricula', {
|
||||
url: '/actualizarMatricula',
|
||||
.state('SectionUpdate', {
|
||||
url: '/SectionUpdate',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
controller: 'SidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/section/update_section.html',
|
||||
controller: 'actualizarMatriculaCtrl',
|
||||
templateUrl: 'partials/section/section_update.html',
|
||||
controller: 'SectionUpdateCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
|
||||
134
app/partials/section/section_create.controller.js
Normal file
134
app/partials/section/section_create.controller.js
Normal file
@@ -0,0 +1,134 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.section')
|
||||
.controller('SectionCreateCtrl', SectionCreateCtrl)
|
||||
|
||||
SectionCreateCtrl.$inject =
|
||||
['$scope','$rootScope', '$state', 'professors', '$modal', 'selectedCourse'];
|
||||
function SectionCreateCtrl($scope, $rootScope, $state, professors, $modal, selectedCourse){
|
||||
var professorid = $rootScope.professorId;
|
||||
var vm = this;
|
||||
vm.course = {};
|
||||
vm.selectedCourse = selectedCourse;
|
||||
vm.submitted = false;
|
||||
vm.semester, vm.section, vm.materias;
|
||||
$rootScope.mensaje = "";
|
||||
vm.students = [];
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
angular.forEach (vm.professor.courses,
|
||||
function (value, key){
|
||||
if (value._id == vm.selectedCourse._id ) {
|
||||
vm.index = key;
|
||||
vm.section = value.sections;
|
||||
vm.course.code = value.code;
|
||||
vm.course.name = value.name;
|
||||
}
|
||||
});
|
||||
},
|
||||
function (){
|
||||
console.log("Error al obtener los datos.");
|
||||
|
||||
});
|
||||
|
||||
|
||||
vm.submit = function () {
|
||||
|
||||
if (vm.data_input_form.$valid){
|
||||
vm.package = {
|
||||
"name": vm.name,
|
||||
"code": vm.course.code,
|
||||
"course": vm.course.name,
|
||||
"semester": vm.semester,
|
||||
"students": vm.students
|
||||
};
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
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";
|
||||
},
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.mensaje = "Error creando la seccion " + vm.name;
|
||||
});
|
||||
}else{
|
||||
vm.submitted = true;
|
||||
}
|
||||
};
|
||||
|
||||
var xlf = document.getElementById('xlf');
|
||||
function handleFile(e) {
|
||||
var files = e.target.files;
|
||||
var i,f,z;
|
||||
var student = {};
|
||||
for (i = 0, f = files[i]; i != files.length; ++i) {
|
||||
var reader = new FileReader();
|
||||
var name = f.name;
|
||||
reader.onload = function(e) {
|
||||
var data = e.target.result;
|
||||
var workbook = XLSX.read(data, {type: 'binary'});
|
||||
var sheet = workbook.SheetNames[0];
|
||||
var worksheet = workbook.Sheets[sheet];
|
||||
|
||||
/* Find desired cell containing semester and section */
|
||||
vm.semester = worksheet['B5'].v;
|
||||
vm.name = worksheet['B9'].v;
|
||||
//$scope.$apply();
|
||||
|
||||
for (z in worksheet) {
|
||||
/* all keys that do not begin with "!" correspond to cell addresses */
|
||||
if (z[0] === '!') continue;
|
||||
if ((z[0] >'B') && (z[1] > 0) && (z[2] > 1)) {
|
||||
/* Cells that start in the C column represent the sttudent id in the worksheet, the same applies to name and lastname being in D and E columns*/
|
||||
if (z[0] =='C') student.id = worksheet[z].v;
|
||||
if (z[0] =='D') student.name = worksheet[z].v;
|
||||
if (z[0] =='E') student.lastname = worksheet[z].v;
|
||||
if (z[0] =='F') {
|
||||
student.email = worksheet[z].v;
|
||||
/*Since we are only going to use these 3 attributes from the students then we push only this data to the students array*/
|
||||
vm.students.push(student);
|
||||
student = {};
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
$scope.$apply();
|
||||
};
|
||||
reader.readAsBinaryString(f);
|
||||
}
|
||||
}
|
||||
if(xlf.addEventListener) xlf.addEventListener('change', handleFile, false);
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$state.go('SectionList');
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
})();
|
||||
115
app/partials/section/section_list.controller.js
Normal file
115
app/partials/section/section_list.controller.js
Normal file
@@ -0,0 +1,115 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.section')
|
||||
.controller('SectionListCtrl', SectionListCtrl)
|
||||
|
||||
SectionListCtrl.$inject = [ '$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedCourse', 'selectedSection'];
|
||||
function SectionListCtrl ( $scope, $rootScope, $state, professors, $modal, selectedCourse, selectedSection ){
|
||||
var vm = this;
|
||||
var professorid = $rootScope.professorId;
|
||||
vm.section = [];
|
||||
vm.professor = null;
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
angular.forEach (vm.professor.courses,
|
||||
function (value, key){
|
||||
if (value._id == selectedCourse._id ) {
|
||||
vm.index = key;
|
||||
vm.section = value.sections;
|
||||
}
|
||||
});
|
||||
},
|
||||
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;
|
||||
$rootScope.mensaje = "¿Seguro que desea eliminar la sección?";
|
||||
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: '/partials/section/modal/delete_section_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
vm.eliminarMatricula = function (index) {
|
||||
$rootScope.botonOk = false;
|
||||
$rootScope.otroBotonOk = true;
|
||||
$rootScope.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";
|
||||
},
|
||||
function () {
|
||||
$rootScope.mensaje = "Error eliminando la sección " + name;
|
||||
});
|
||||
};
|
||||
|
||||
vm.eliminarMatriculaSplice = function (index, rsplice) {
|
||||
if(rsplice){
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/*************************Fin de Eliminar Matricula*******************/
|
||||
|
||||
vm.modificarMatricula = function (index) {
|
||||
selectedSection._id = vm.section[index]._id;
|
||||
selectedCourse.index = vm.index;
|
||||
$state.go('SectionUpdate');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$state.go('SectionList');
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
vm.back = function () {
|
||||
$state.go('CourseList');
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
})();
|
||||
@@ -57,5 +57,5 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<a href="#listarMateria" class="btn-warning btn" style=" margin: 10px">Regresar</a>
|
||||
<a class="btn-warning btn" style="margin: 10px" ng-click="vm.back()">Regresar</a>
|
||||
</div>
|
||||
95
app/partials/section/section_update.controller.js
Normal file
95
app/partials/section/section_update.controller.js
Normal file
@@ -0,0 +1,95 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.section')
|
||||
.controller('SectionUpdateCtrl', SectionUpdateCtrl)
|
||||
|
||||
SectionUpdateCtrl.$inject = ['$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedSection', 'selectedCourse'];
|
||||
function SectionUpdateCtrl($scope, $rootScope, $state, professors, $modal, selectedSection, selectedCourse){
|
||||
var professorid = $rootScope.professorId;
|
||||
var vm = this;
|
||||
vm.section = {};
|
||||
vm.students = [];
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
angular.forEach (vm.professor.courses[selectedCourse.index].sections,
|
||||
function (value, key){
|
||||
if (value._id == selectedSection._id ) {
|
||||
selectedSection.index = key;
|
||||
vm.students = value.students;
|
||||
vm.section = value;
|
||||
}
|
||||
});
|
||||
},
|
||||
function (){
|
||||
console.log("Error al obtener los datos.");
|
||||
});
|
||||
|
||||
vm.addStudent = function (index) {
|
||||
$state.go('StudentCreate');
|
||||
};
|
||||
|
||||
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.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: 'partials/section/modal/update_section_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
vm.retirarEstudiante = function (index) {
|
||||
vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students.splice(index, 1);
|
||||
|
||||
professors.update({ id: professorid }, vm.professor,
|
||||
function (){
|
||||
$rootScope.botonOk = false;
|
||||
$rootScope.otroBotonOk = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
$rootScope.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;
|
||||
});
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
$scope.ok = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
vm.back = function () {
|
||||
$state.go('SectionList');
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -48,6 +48,6 @@
|
||||
</table>
|
||||
</div>
|
||||
<div class="container-fluid ">
|
||||
<a href="#listarMatricula" class="btn-warning btn" style=" margin: 10px">Regresar</a>
|
||||
<a class="btn-warning btn" style="margin: 10px" ng-click="vm.back()">Regresar</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -7,9 +7,9 @@
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="#/listarMateria"><img alt="ucv" src="img/logo_ucv.jpg" class="img-circle" width="60" height="60"></a>
|
||||
<a class="navbar-brand" href="#/listarMateria"><img alt="ciencias" src="img/logo_ciencias.jpg" class="img-rounded" width="60" height="60"></a>
|
||||
<a class="navbar-brand" href="#/listarMateria"><img alt="computacion" src="img/logo_computacion.jpg" lass="img-thumbnail" width="270" height="60"></a>
|
||||
<a class="navbar-brand" href="#/listarMateria"><img alt="ucv" src="static/img/logo_ucv.jpg" class="img-circle" width="60" height="60"></a>
|
||||
<a class="navbar-brand" href="#/listarMateria"><img alt="ciencias" src="static/img/logo_ciencias.jpg" class="img-rounded" width="60" height="60"></a>
|
||||
<a class="navbar-brand" href="#/listarMateria"><img alt="computacion" src="static/img/logo_computacion.jpg" lass="img-thumbnail" width="270" height="60"></a>
|
||||
</div>
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
|
||||
@@ -3,11 +3,10 @@
|
||||
|
||||
angular
|
||||
.module('app')
|
||||
.controller('sidebarCtrl', sidebarCtrl)
|
||||
.controller('SidebarCtrl', SidebarCtrl)
|
||||
|
||||
sidebarCtrl.$inject = ['$scope'];
|
||||
function sidebarCtrl($scope) {
|
||||
|
||||
SidebarCtrl.$inject = ['$scope'];
|
||||
function SidebarCtrl($scope) {
|
||||
var that = this;
|
||||
$scope.showChilds = function(item){
|
||||
item.active = !item.active;
|
||||
@@ -15,53 +14,38 @@
|
||||
|
||||
$scope.items = [
|
||||
{
|
||||
|
||||
text: 'Modulo de Administración',
|
||||
text: 'Modulo de Administración',
|
||||
subItems: [
|
||||
{
|
||||
state: 'listarProfesor',
|
||||
state: 'ProfessorList',
|
||||
text: 'Listar Profesores'
|
||||
},
|
||||
{
|
||||
state: 'crearProfesor',
|
||||
state: 'ProfessorCreate',
|
||||
text: 'Agregar Profesores'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
text: 'Modulo de Materias',
|
||||
text: 'Modulo de Materias',
|
||||
subItems: [
|
||||
{
|
||||
state: 'listarMateria',
|
||||
state: 'CourseList',
|
||||
text: 'Listar Materias'
|
||||
},
|
||||
{
|
||||
state: 'crearMateria',
|
||||
state: 'CourseCreate',
|
||||
text: 'Agregar Materia'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
text: 'Modulo de Reportes',
|
||||
text: 'Modulo de Reportes',
|
||||
subItems: [
|
||||
{
|
||||
state: 'reportesAlumno',
|
||||
text: 'Reportes por Alumno'
|
||||
},
|
||||
{
|
||||
state: 'reportesClase',
|
||||
text: 'Reportes por Clase'
|
||||
},
|
||||
{
|
||||
state: 'reportesSeccion',
|
||||
text: 'Reportes por Seccion'
|
||||
},
|
||||
{
|
||||
state: 'reportesMateria',
|
||||
text: 'Reportes por Materia'
|
||||
}
|
||||
state: 'courseReport',
|
||||
text: 'Reportes'
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<ul class="nav nav-sidebar">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-3 col-md-2 sidebar" data-ng-controller="sidebarCtrl as vm">
|
||||
<div class="col-sm-3 col-md-2 sidebar" data-ng-controller="SidebarCtrl as vm">
|
||||
<ul class="nav nav-sidebar">
|
||||
<li ng-repeat="item in items" ng-click="showChilds(item)">
|
||||
<a>{{item.text}}</a>
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
<div class="row clearfix">
|
||||
<h4>Listado de Estudiantes</h4>
|
||||
<br>
|
||||
<div>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%">
|
||||
<a href="" ng-click="sortType = 'Cedula';
|
||||
sortReverse = !sortReverse">
|
||||
Cedula
|
||||
<span ng-show="sortType == 'Cedula' &&
|
||||
!sortReverse" class="fa fa-caret-down"></span>
|
||||
<span ng-show="sortType == 'Cedula' &&
|
||||
sortReverse" class="fa fa-caret-up"></span>
|
||||
</a>
|
||||
</th>
|
||||
<th width="20%">
|
||||
<a href="" ng-click="sortType = 'Nombre';
|
||||
sortReverse = !sortReverse">
|
||||
Nombre
|
||||
<span ng-show="sortType == 'Nombre' &&
|
||||
!sortReverse" class="fa fa-caret-down"></span>
|
||||
<span ng-show="sortType == 'Nombre' &&
|
||||
sortReverse" class="fa fa-caret-up"></span>
|
||||
</a>
|
||||
</th>
|
||||
<th width="20%">
|
||||
<a href="" ng-click="sortType = 'Apellido';
|
||||
sortReverse = !sortReverse">
|
||||
Apellido
|
||||
<span ng-show="sortType == 'Apellido' &&
|
||||
!sortReverse" class="fa fa-caret-down"></span>
|
||||
<span ng-show="sortType == 'Apellido' &&
|
||||
sortReverse" class="fa fa-caret-up"></span>
|
||||
</a>
|
||||
</th>
|
||||
<th width="20%" style="text-align: center">
|
||||
<a>Modificar</a>
|
||||
</th>
|
||||
<th width="20%" style="text-align: center">
|
||||
<a>Borrar</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="estudiante in vm.listaEstudiantes">
|
||||
<td style="vertical-align:middle">{{ estudiante.Cedula }}</td>
|
||||
<td style="vertical-align:middle">{{ estudiante.Nombre }}</td>
|
||||
<td style="vertical-align:middle">{{ estudiante.Apellido }}</td>
|
||||
<td style="text-align: center">
|
||||
<span title="Click aqui para Modificar un Estudiante" class="glyphicon glyphicon-edit" aria-hidden="true"
|
||||
ng-click="vm.modificarEstudiante($index)"
|
||||
style="cursor:pointer"></span>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<span title="Click aqui para Eliminar un Estudiante"
|
||||
class="glyphicon glyphicon-remove" aria-hidden="true"
|
||||
ng-click="vm.eliminarEstudianteModal($index)"
|
||||
style="cursor:pointer"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div ng-show=false > {{vm.removeEstudianteSplice(index, rsplice)}}</div>
|
||||
</div>
|
||||
@@ -1,281 +0,0 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.student')
|
||||
.controller('listarEstudianteCtrl', listarEstudianteCtrl)
|
||||
.controller('crearEstudianteCtrl', crearEstudianteCtrl)
|
||||
.controller('actualizarEstudianteCtrl', actualizarEstudianteCtrl)
|
||||
|
||||
listarEstudianteCtrl.$inject = [ '$scope', '$rootScope', '$location', 'students', '$modal', 'estudianteSeleccionado' ];
|
||||
function listarEstudianteCtrl( $scope, $rootScope, $location, students, $modal, estudianteSeleccionado ){
|
||||
|
||||
var vm = this;
|
||||
vm.lista = true;
|
||||
$rootScope.actOk = false;
|
||||
$rootScope.loading = true;
|
||||
$rootScope.table = false;
|
||||
|
||||
var estudiantesArray = [];
|
||||
students.query(
|
||||
function(data){
|
||||
vm.estudiantes = data;
|
||||
angular.forEach(vm.estudiantes, function (value){
|
||||
estudiantesArray.push({
|
||||
Cedula:value.id,
|
||||
Nombre:value.name,
|
||||
Apellido:value.lastname,
|
||||
Telefono:value.number,
|
||||
Correo: value.email
|
||||
});
|
||||
});
|
||||
$rootScope.loading = false;
|
||||
$rootScope.table = true;
|
||||
vm.listaEstudiantes = estudiantesArray;
|
||||
|
||||
},
|
||||
function(){
|
||||
console.log("Error al obtener los datos.");
|
||||
});
|
||||
|
||||
vm.eliminarEstudianteModal = function (index) {
|
||||
$rootScope.index = index;
|
||||
$rootScope.botonOK = true;
|
||||
$rootScope.botonCancelar = true;
|
||||
$rootScope.acceptButton = false;
|
||||
|
||||
$rootScope.rsplice = false;
|
||||
$rootScope.listarEstudiantesLoading = true;
|
||||
$rootScope.mensaje = "¿Seguro que desea eliminar el Estudiante?";
|
||||
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: 'partials/students/modal/list_students_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
vm.eliminarEstudiante = function (index) {
|
||||
|
||||
$rootScope.botonOK = false;
|
||||
$rootScope.acceptButton = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
$rootScope.urlLo = 'listarEstudiante';
|
||||
$rootScope.listarEstudiantesLoading = true;
|
||||
|
||||
students.delete({id: vm.estudiantes[index]._id},
|
||||
function (successResult) {
|
||||
$rootScope.listarEstudiantesLoading = false;
|
||||
$rootScope.rsplice = true;
|
||||
$rootScope.mensaje = "Usuario " + vm.estudiantes[index].name + " eliminado";
|
||||
},
|
||||
function (errorResult) {
|
||||
$rootScope.listarEstudiantesLoading = false;
|
||||
$rootScope.mensaje = "Error eliminando al Usuario " + vm.estudiantes[index].name;
|
||||
});
|
||||
};
|
||||
|
||||
vm.removeEstudianteSplice = function(index, rsplice) {
|
||||
if(rsplice){
|
||||
vm.listaEstudiantes.splice(index, 1);
|
||||
$rootScope.rsplice = false;
|
||||
}
|
||||
};
|
||||
|
||||
vm.modificarEstudiante = function (index) {
|
||||
estudianteSeleccionado._id = vm.estudiantes[index]._id;
|
||||
estudianteSeleccionado.Cedula = vm.estudiantes[index].id;
|
||||
estudianteSeleccionado.Nombre = vm.estudiantes[index].name;
|
||||
estudianteSeleccionado.Apellido= vm.estudiantes[index].lastname;
|
||||
estudianteSeleccionado.Telefono = vm.estudiantes[index].number;
|
||||
estudianteSeleccionado.Correo= vm.estudiantes[index].email;
|
||||
$location.url('actualizarEstudiante');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$location.url(urlLo);
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
|
||||
crearEstudianteCtrl.$inject = ['$scope', '$rootScope', '$location', 'professors', '$modal', 'selectedSection', 'selectedCourse'];
|
||||
function crearEstudianteCtrl($scope, $rootScope, $location, professors, $modal, selectedSection, selectedCourse){
|
||||
|
||||
var vm = this;
|
||||
var duplicated = false;
|
||||
var professorid = '56f5fd3a20047f3c15b05f0e';
|
||||
vm.professor = {};
|
||||
$rootScope.mensaje = "";
|
||||
$rootScope.actOk = false;
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
},
|
||||
function (){
|
||||
console.log("Error al obtener los datos.");
|
||||
|
||||
});
|
||||
|
||||
vm.submit = function() {
|
||||
|
||||
if (vm.data_input_form.$valid){
|
||||
var person = {
|
||||
"id": vm.estudiante.Cedula,
|
||||
"name": vm.estudiante.Nombre,
|
||||
"lastname": vm.estudiante.Apellido,
|
||||
"email": vm.estudiante.Correo
|
||||
};
|
||||
|
||||
$rootScope.crearEstudianteLoading = true;
|
||||
$rootScope.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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
angular.forEach (vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students,
|
||||
function (value){
|
||||
if(value.id == vm.estudiante.Cedula) duplicated = true;
|
||||
});
|
||||
if (!duplicated){
|
||||
vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students.push(person);
|
||||
|
||||
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;
|
||||
},
|
||||
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'actualizarMatricula';
|
||||
$rootScope.mensaje = "Error al agregar al estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre;
|
||||
$rootScope.crearEstudianteLoading = false;
|
||||
});
|
||||
} else {
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'actualizarMatricula';
|
||||
$rootScope.mensaje = "Estudiante con cedula " + vm.estudiante.Cedula + " ya esta en la lista.";
|
||||
$rootScope.crearEstudianteLoading = false;
|
||||
}
|
||||
}else{
|
||||
vm.submitted = true;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$location.url(urlLo);
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
|
||||
actualizarEstudianteCtrl.$inject = [ '$scope','$rootScope', '$location', 'students', '$modal', 'estudianteSeleccionado' ];
|
||||
function actualizarEstudianteCtrl ( $scope, $rootScope, $location, students, $modal, estudianteSeleccionado ){
|
||||
|
||||
var vm = this;
|
||||
vm.estudiante = estudianteSeleccionado;
|
||||
$rootScope.mensaje = "";
|
||||
$rootScope.actOk = false;
|
||||
|
||||
vm.submit = function() {
|
||||
|
||||
var student = {
|
||||
"_id": vm.estudiante._id,
|
||||
"id": vm.estudiante.Cedula,
|
||||
"name": vm.estudiante.Nombre,
|
||||
"lastname": vm.estudiante.Apellido,
|
||||
"email": vm.estudiante.Correo,
|
||||
"number": vm.estudiante.Telefono,
|
||||
};
|
||||
|
||||
$rootScope.botonOk = false;
|
||||
$rootScope.modificarEstudianteLoading = true;
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
students.update(student,
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
$rootScope.urlLo = 'listarEstudiante';
|
||||
$rootScope.mensaje = "Estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre + " actualizado";
|
||||
},
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
$rootScope.urlLo = 'listarEstudiante';
|
||||
$rootScope.mensaje = "Error al modificar al estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$location.url(urlLo);
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -14,62 +14,25 @@
|
||||
|
||||
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
|
||||
function getRoutes($stateProvider, $urlRouterProvider){
|
||||
$urlRouterProvider.otherwise('/listarEstudiante');
|
||||
$urlRouterProvider.otherwise('/StudentCreate');
|
||||
|
||||
$stateProvider
|
||||
.state('listarEstudiante', {
|
||||
url: '/listarEstudiante',
|
||||
.state('StudentCreate', {
|
||||
url: '/StudentCreate',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'SidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/students/list_students.html',
|
||||
controller: 'listarEstudianteCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.state('crearEstudiante', {
|
||||
url: '/crearEstudiante',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/students/create_students.html',
|
||||
controller: 'crearEstudianteCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.state('actualizarEstudiante', {
|
||||
url: '/actualizarEstudiante',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/sidebar/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/students/update_students.html',
|
||||
controller: 'actualizarEstudianteCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
templateUrl: 'partials/students/student_create.html',
|
||||
controller: 'StudentCreateCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
})();
|
||||
|
||||
103
app/partials/students/student_create.controller.js
Normal file
103
app/partials/students/student_create.controller.js
Normal file
@@ -0,0 +1,103 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.student')
|
||||
.controller('StudentCreateCtrl', StudentCreateCtrl)
|
||||
|
||||
StudentCreateCtrl.$inject = ['$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedSection', 'selectedCourse'];
|
||||
function StudentCreateCtrl($scope, $rootScope, $state, professors, $modal, selectedSection, selectedCourse){
|
||||
|
||||
var vm = this;
|
||||
var duplicated = false;
|
||||
var professorid = $rootScope.professorId;
|
||||
vm.professor = {};
|
||||
$rootScope.mensaje = "";
|
||||
$rootScope.actOk = false;
|
||||
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
},
|
||||
function (){
|
||||
console.log("Error al obtener los datos.");
|
||||
|
||||
});
|
||||
|
||||
vm.submit = function() {
|
||||
|
||||
if (vm.data_input_form.$valid){
|
||||
var person = {
|
||||
"id": vm.estudiante.Cedula,
|
||||
"name": vm.estudiante.Nombre,
|
||||
"lastname": vm.estudiante.Apellido,
|
||||
"email": vm.estudiante.Correo
|
||||
};
|
||||
|
||||
$rootScope.crearEstudianteLoading = true;
|
||||
$rootScope.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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
angular.forEach (vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students,
|
||||
function (value){
|
||||
if(value.id == vm.estudiante.Cedula) duplicated = true;
|
||||
});
|
||||
if (!duplicated){
|
||||
vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students.push(person);
|
||||
|
||||
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;
|
||||
},
|
||||
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.mensaje = "Error al agregar al estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre;
|
||||
$rootScope.crearEstudianteLoading = false;
|
||||
});
|
||||
} else {
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.mensaje = "Estudiante con cedula " + vm.estudiante.Cedula + " ya esta en la lista.";
|
||||
$rootScope.crearEstudianteLoading = false;
|
||||
}
|
||||
}else{
|
||||
vm.submitted = true;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.ok = function (urlLo) {
|
||||
$state.go('SectionUpdate');
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
vm.back = function () {
|
||||
$state.go('SectionUpdate');
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
})();
|
||||
@@ -79,5 +79,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<a href="#actualizarMatricula" class="btn-warning btn" style=" margin: 10px">Regresar</a>
|
||||
<a class="btn-warning btn" style="margin: 10px" ng-click="vm.back()">Regresar</a>
|
||||
</div>
|
||||
Reference in New Issue
Block a user