diff --git a/app/app.js b/app/app.js index 2ae0a7d..8b17043 100644 --- a/app/app.js +++ b/app/app.js @@ -31,6 +31,7 @@ .run(function ($rootScope) { $rootScope.domainUrl = 'Localhost:3000'; + $rootScope.professorId = '56f5fd3a20047f3c15b05f0e'; }); })(); diff --git a/app/css/demo-framework.css b/app/css/demo-framework.css deleted file mode 100644 index c6c0db2..0000000 --- a/app/css/demo-framework.css +++ /dev/null @@ -1,70 +0,0 @@ -body { - padding-top: 70px; - padding-bottom: 30px; -} - -.box { - margin-bottom: 20px; - background-color: #fff; - border: 1px solid transparent; - border-radius: 4px; - -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05); - box-shadow: 0 1px 2px rgba(0,0,0,.05); -} - -.box > h3 { - color: #333; - border-color: #ddd; - border-bottom: 1px solid transparent; - border-top-right-radius: 3px; - border-top-left-radius: 3px; - background-repeat: repeat-x; - display: block; - font-size: 16px; - padding: 10px 15px; - margin-top: 0; - margin-bottom: 0; -} - -.box-padding { - padding: 15px; -} - -.box-padding > h3 { - margin: -15px; - margin-bottom: 15px; -} - -.box-grey { - border-color: #ddd; -} - -.box-grey > h3 { - background-color: #f5f5f5; - background-image: -webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%); - background-image: linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%); -} - -.box-blue { - border-color: #bce8f1; -} - -.box-blue > h3 { - color: #31708f; - background-color: #d9edf7; - border-color: #bce8f1; - background-image: -webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%); - background-image: linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%); -} - -.box-yellow { - border-color: #faebcc; -} - -.box-yellow > h3 { - //color: #8a6d3b; - //background-color: #fcf8e3; - //border-color: #faebcc; - //background-image: -webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%); - //background-image: linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%); -} \ No newline at end of file diff --git a/app/css/nested.css b/app/css/nested.css deleted file mode 100644 index e57c969..0000000 --- a/app/css/nested.css +++ /dev/null @@ -1,149 +0,0 @@ -/***************************** Required styles *****************************/ - -/** - * For the correct positioning of the placeholder element, the dnd-list and - * it's children must have position: relative - */ -.nestedDemo ul[dnd-list], -.nestedDemo ul[dnd-list] > li { - position: relative; -} - -/***************************** Dropzone Styling *****************************/ - -/** - * The dnd-list should always have a min-height, - * otherwise you can't drop to it once it's empty - */ -.nestedDemo .dropzone ul[dnd-list] { - min-height: 42px; - margin: 0px; - padding-left: 0px; -} - -/** - * The dnd-lists's child elements currently MUST have - * position: relative. Otherwise we can not determine - * whether the mouse pointer is in the upper or lower - * half of the element we are dragging over. In other - * browsers we can use event.offsetY for this. - */ -.nestedDemo .dropzone li { - background-color: #fff; - border: 1px solid #ddd; - display: block; - padding: 0px; -} - -/** - * Reduce opacity of elements during the drag operation. This allows the user - * to see where he is dropping his element, even if the element is huge. The - * .dndDragging class is automatically set during the drag operation. - */ -.nestedDemo .dropzone .dndDragging { - opacity: 0.7; -} - -/** - * The dndDraggingSource class will be applied to the source element of a drag - * operation. It makes sense to hide it to give the user the feeling that he's - * actually moving it. Note that the source element has also .dndDragging class. - */ -.nestedDemo .dropzone .dndDraggingSource { - display: none; -} - -/** - * An element with .dndPlaceholder class will be added as child of the dnd-list - * while the user is dragging over it. - */ -.nestedDemo .dropzone .dndPlaceholder { - background-color: #ddd; - min-height: 42px; - display: block; - position: relative; -} - -/***************************** Element Selection *****************************/ - -.nestedDemo .dropzone .selected .item { - color: #3c763d; - background-color: #dff0d8; -} - -.nestedDemo .dropzone .selected .box { - border-color: #d6e9c6; -} - -.nestedDemo .dropzone .selected .box > h3 { - color: #3c763d; - background-color: #dff0d8; - background-image: linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%); - border-color: #d6e9c6; -} - -/***************************** Element type specific styles *****************************/ - -.nestedDemo .dropzone .item { - padding: 10px 15px; -} - -.nestedDemo .dropzone .container-element { - margin: 10px; -} - -.nestedDemo .dropzone .container-element .column { - float: left; - width: 16.666%; -} - -.nestedDemo .dropzone .container-element .columnQuestions { - float: left; - width: 100%; -} -/***************************** Toolbox *****************************/ - -.nestedDemo .toolbox ul { - list-style: none; - padding-left: 0px; - cursor: move; -} - -.nestedDemo .toolbox button { - margin: 5px; - //width: 123px; - opacity: 1.0; -} - -.nestedDemo .toolbox .dndDragging { - opacity: 0.5; -} - -.nestedDemo .toolbox .dndDraggingSource { - opacity: 1.0; -} - -/***************************** Trashcan *****************************/ - -.nestedDemo .trashcan ul { - list-style: none; - padding-left: 0px; -} - -.nestedDemo .trashcan img { - width: 100%; - -webkit-filter: grayscale(100%); - -moz-filter: grayscale(100%); - filter: grayscale(100%); -} - -.nestedDemo .trashcan .dndDragover img { - width: 100%; - -webkit-filter: none; - -moz-filter: none; - filter: none; -} - -.nestedDemo .trashcan .dndPlaceholder { - display: none; -} diff --git a/app/css/search-box-example.css b/app/css/search-box-example.css deleted file mode 100644 index ab7b29c..0000000 --- a/app/css/search-box-example.css +++ /dev/null @@ -1,59 +0,0 @@ -html, body { - height: 100%; - margin: 0px; - padding: 0px -} - -.pac-controls { - margin-top: 16px; - border: 1px solid transparent; - border-radius: 2px 0 0 2px; - box-sizing: border-box; - -moz-box-sizing: border-box; - height: 32px !important; - outline: none; - box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); -} - -#pac-input { - background-color: #fff; - padding: 0 11px 0 13px; - width: 400px; - font-family: 'Open Sans', sans-serif; - font-size: 15px; - font-weight: 300; - text-overflow: ellipsis; -} - -#pac-input:focus { - border-color: #4d90fe; - margin-left: -1px; - padding-left: 14px; /* Regular padding-left + 1. */ - width: 401px; -} - -.pac-container { - font-family: 'Open Sans', sans-serif; -} - -#type-selector { - color: #fff; - background-color: #4d90fe; - padding: 5px 11px 0px 11px; -} - -#type-selector label { - font-family: 'Open Sans', sans-serif; - font-size: 13px; - font-weight: 300; -} - -.angular-google-map-container { - width: 100%; - height: 600px; -} - -/* fix for Twitter Bootstrap handling of responsive images */ -.angular-google-map img { - max-width: inherit; -} diff --git a/app/index.html b/app/index.html index 6cd6bba..1081c96 100644 --- a/app/index.html +++ b/app/index.html @@ -5,23 +5,14 @@ - - Modulo de Administración de Asistencia - + - - - - - - - - + @@ -63,9 +54,11 @@ + - + + @@ -73,21 +66,29 @@ - + + + - + + + + + + + - + + + - - - + diff --git a/app/partials/course/course.controllers.js b/app/partials/course/course.controllers.js deleted file mode 100644 index 99d3666..0000000 --- a/app/partials/course/course.controllers.js +++ /dev/null @@ -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; - }; -})(); \ No newline at end of file diff --git a/app/partials/course/course.module.js b/app/partials/course/course.module.js index a5a8b87..e4899f4 100644 --- a/app/partials/course/course.module.js +++ b/app/partials/course/course.module.js @@ -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" } } }) diff --git a/app/partials/course/course_create.controller.js b/app/partials/course/course_create.controller.js new file mode 100644 index 0000000..c976968 --- /dev/null +++ b/app/partials/course/course_create.controller.js @@ -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; + }; +})(); \ No newline at end of file diff --git a/app/partials/course/create_course.html b/app/partials/course/course_create.html similarity index 100% rename from app/partials/course/create_course.html rename to app/partials/course/course_create.html diff --git a/app/partials/course/course_list.controller.js b/app/partials/course/course_list.controller.js new file mode 100644 index 0000000..c6d5b3e --- /dev/null +++ b/app/partials/course/course_list.controller.js @@ -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; + }; +})(); \ No newline at end of file diff --git a/app/partials/course/list_course.html b/app/partials/course/course_list.html similarity index 100% rename from app/partials/course/list_course.html rename to app/partials/course/course_list.html diff --git a/app/partials/course/update_course.html b/app/partials/course/update_course.html deleted file mode 100644 index 9cc2308..0000000 --- a/app/partials/course/update_course.html +++ /dev/null @@ -1,59 +0,0 @@ -
-
-
-

Datos de la Materia

-
-
-
-
- - -
-
- - -
- - El Nombre de la Materia es Obligatorio. - -
-
-
-


-
-
- - -
- - La Cantidad de Creditos es Obligatoria. - -
-
-
-


-
-
-
-
-
- -

- - - -

-
-
-
-
-
\ No newline at end of file diff --git a/app/partials/login/login.controllers.js b/app/partials/login/login.controllers.js index f5fe6ff..42df954 100644 --- a/app/partials/login/login.controllers.js +++ b/app/partials/login/login.controllers.js @@ -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; */ + }; }; - })(); diff --git a/app/partials/login/login.html b/app/partials/login/login.html index e66f8c0..8e8ce67 100644 --- a/app/partials/login/login.html +++ b/app/partials/login/login.html @@ -7,7 +7,7 @@
- +
{{'TAG_NICK_NAME_ERROR'}} @@ -21,7 +21,7 @@
- +
{{ vm.password = vm.user.Password }}
diff --git a/app/partials/professor/professor.controllers.js b/app/partials/professor/professor.controllers.js deleted file mode 100644 index 26f9ee2..0000000 --- a/app/partials/professor/professor.controllers.js +++ /dev/null @@ -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; - }; - -})(); \ No newline at end of file diff --git a/app/partials/professor/professor.module.js b/app/partials/professor/professor.module.js index 2e8ae2a..123b6d1 100644 --- a/app/partials/professor/professor.module.js +++ b/app/partials/professor/professor.module.js @@ -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' + } + } }) }; })(); diff --git a/app/partials/professor/professor.services.js b/app/partials/professor/professor.services.js index d03ee0f..55a7b79 100644 --- a/app/partials/professor/professor.services.js +++ b/app/partials/professor/professor.services.js @@ -6,6 +6,7 @@ .factory('professors', professors) .value('selectedCourse',{}) .value('selectedSection',{}) + .value('selectedStudent',{}) .value('profesorSeleccionado',{}); professors.$inject = ['$resource','$rootScope']; diff --git a/app/partials/professor/professor_create.controller.js b/app/partials/professor/professor_create.controller.js new file mode 100644 index 0000000..113367b --- /dev/null +++ b/app/partials/professor/professor_create.controller.js @@ -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; + }; +})(); \ No newline at end of file diff --git a/app/partials/professor/create_professor.html b/app/partials/professor/professor_create.html similarity index 100% rename from app/partials/professor/create_professor.html rename to app/partials/professor/professor_create.html diff --git a/app/partials/professor/professor_list.controller.js b/app/partials/professor/professor_list.controller.js new file mode 100644 index 0000000..7dd9889 --- /dev/null +++ b/app/partials/professor/professor_list.controller.js @@ -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; + }; +})(); \ No newline at end of file diff --git a/app/partials/professor/list_professor.html b/app/partials/professor/professor_list.html similarity index 100% rename from app/partials/professor/list_professor.html rename to app/partials/professor/professor_list.html diff --git a/app/partials/professor/professor_update.controller.js b/app/partials/professor/professor_update.controller.js new file mode 100644 index 0000000..bb843ac --- /dev/null +++ b/app/partials/professor/professor_update.controller.js @@ -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; + }; +})(); \ No newline at end of file diff --git a/app/partials/professor/update_professor.html b/app/partials/professor/professor_update.html similarity index 100% rename from app/partials/professor/update_professor.html rename to app/partials/professor/professor_update.html diff --git a/app/partials/report/course_assist.controller.js b/app/partials/report/course_assist.controller.js new file mode 100644 index 0000000..7a86b92 --- /dev/null +++ b/app/partials/report/course_assist.controller.js @@ -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'); + }; + }; +})(); \ No newline at end of file diff --git a/app/partials/report/course_assist.html b/app/partials/report/course_assist.html new file mode 100644 index 0000000..5f94d49 --- /dev/null +++ b/app/partials/report/course_assist.html @@ -0,0 +1,16 @@ +
+

Asistencia de Materia {{vm.course.name}}

+
+
+
+
Estadisticas
+
Porcentaje de Asistencia: {{vm.percentage}} %
+
Total de Dias de Clase: {{vm.lectures}}
+
+ +
\ No newline at end of file diff --git a/app/partials/report/course_report.controller.js b/app/partials/report/course_report.controller.js new file mode 100644 index 0000000..a2d3497 --- /dev/null +++ b/app/partials/report/course_report.controller.js @@ -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'); + }; + + }; + +})(); diff --git a/app/partials/report/course_report.html b/app/partials/report/course_report.html new file mode 100644 index 0000000..7e901da --- /dev/null +++ b/app/partials/report/course_report.html @@ -0,0 +1,53 @@ +
+

Reportes de Materias

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Código + + Nombre + + Creditos + + Descripción + + Reportes de Materia + + Secciones +
{{ course.code }}{{ course.name }}{{ course.credits }}{{ course.description }} + + + +
+
+
\ No newline at end of file diff --git a/app/partials/report/report.controllers.js b/app/partials/report/report.controllers.js deleted file mode 100644 index bdfaf3d..0000000 --- a/app/partials/report/report.controllers.js +++ /dev/null @@ -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; - }); - }; - -})(); diff --git a/app/partials/report/report.html b/app/partials/report/report.html deleted file mode 100644 index 638a1f3..0000000 --- a/app/partials/report/report.html +++ /dev/null @@ -1,116 +0,0 @@ -
- -
-
-
-
Reporte Alumno -
-
-
- - -
    -
  • {{'TAG_FOREIGN' }}
  • -
  • {{'TAG_RESIDENT' }}
  • -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
Reporte por Clase -
-
-
- - -
    -
  • {{'TAG_ECONOMIC_PASSIVE' }}
  • -
  • {{'TAG_ECONOMIC_ACTIVE' }}
  • -
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
Reporte por Sección -
-
-
- -
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
Reporte por Materia -
-
-
- -
-
-
-
-
-
-
-
-
-
-
- - - - - diff --git a/app/partials/report/report.module.js b/app/partials/report/report.module.js index 13e124d..4cb98c4 100644 --- a/app/partials/report/report.module.js +++ b/app/partials/report/report.module.js @@ -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' + } + } }) }; })(); diff --git a/app/partials/report/report.services.js b/app/partials/report/report.services.js index e483618..1069855 100644 --- a/app/partials/report/report.services.js +++ b/app/partials/report/report.services.js @@ -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); + };*/ })(); \ No newline at end of file diff --git a/app/partials/report/section_assist.controller.js b/app/partials/report/section_assist.controller.js new file mode 100644 index 0000000..807deff --- /dev/null +++ b/app/partials/report/section_assist.controller.js @@ -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'); + }; + }; +})(); \ No newline at end of file diff --git a/app/partials/report/section_assist.html b/app/partials/report/section_assist.html new file mode 100644 index 0000000..aea94e1 --- /dev/null +++ b/app/partials/report/section_assist.html @@ -0,0 +1,16 @@ +
+

Asistencia de Sección {{vm.section.name}}

+
+
+
+
Estadisticas
+
Porcentaje de Asistencia: {{vm.percentage}} %
+
Total de Dias de Clase: {{vm.lectures}}
+
+ +
\ No newline at end of file diff --git a/app/partials/report/section_report.controller.js b/app/partials/report/section_report.controller.js new file mode 100644 index 0000000..7b2ed6f --- /dev/null +++ b/app/partials/report/section_report.controller.js @@ -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'); + }; + }; + +})(); diff --git a/app/partials/report/section_report.html b/app/partials/report/section_report.html new file mode 100644 index 0000000..daa4e11 --- /dev/null +++ b/app/partials/report/section_report.html @@ -0,0 +1,57 @@ +
+

Reportes de Secciones

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Sección + + Nombre de la Materia + + Codigo de la Materia + + Semestre + + Reportes por Sección + + Estudiantes +
{{ section.name }}{{ section.course }}{{ section.code }}{{ section.semester }} + + + +
+
+ +
\ No newline at end of file diff --git a/app/partials/report/student_assist.controller.js b/app/partials/report/student_assist.controller.js new file mode 100644 index 0000000..5f97f8d --- /dev/null +++ b/app/partials/report/student_assist.controller.js @@ -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'); + }; + }; +})(); \ No newline at end of file diff --git a/app/partials/report/student_assist.html b/app/partials/report/student_assist.html new file mode 100644 index 0000000..c7fe063 --- /dev/null +++ b/app/partials/report/student_assist.html @@ -0,0 +1,42 @@ +
+

Asistencia - {{vm.student.lastname}}, {{vm.student.name}}

+
+
+
+
Estadisticas
+
Porcentaje de Asistencia: {{vm.percentage}} %
+
Total de Dias de Clase: {{vm.lectures}}
+
Total de Asistencias: {{vm.positive}}
+
Total de Inasistencias: {{vm.negative}}
+
+
+ +
+ + + + + + + + + + + + + +
+ Dia + + Asistencia +
{{ assistance.day }}{{ assistance.assistance }} +
+
+ +
\ No newline at end of file diff --git a/app/partials/report/student_report.controller.js b/app/partials/report/student_report.controller.js new file mode 100644 index 0000000..0f358f8 --- /dev/null +++ b/app/partials/report/student_report.controller.js @@ -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'); + }; + }; +})(); diff --git a/app/partials/report/student_report.html b/app/partials/report/student_report.html new file mode 100644 index 0000000..de5ea98 --- /dev/null +++ b/app/partials/report/student_report.html @@ -0,0 +1,44 @@ +
+

Reportes de Estudiantes

+
+
+
+ + + + + + + + + + + + + + + + + +
+ Cedula + + Nombre + + Apellido + + Reportes por Estudiante +
{{ student.id }}{{ student.name }}{{ student.lastname }} + +
+
+ +
\ No newline at end of file diff --git a/app/partials/section/section.controllers.js b/app/partials/section/section.controllers.js deleted file mode 100644 index 4020977..0000000 --- a/app/partials/section/section.controllers.js +++ /dev/null @@ -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; - }; - -})(); \ No newline at end of file diff --git a/app/partials/section/section.module.js b/app/partials/section/section.module.js index d8afa7e..40b26ce 100644 --- a/app/partials/section/section.module.js +++ b/app/partials/section/section.module.js @@ -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' } } diff --git a/app/partials/section/section_create.controller.js b/app/partials/section/section_create.controller.js new file mode 100644 index 0000000..4b8b7a3 --- /dev/null +++ b/app/partials/section/section_create.controller.js @@ -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; + }; +})(); \ No newline at end of file diff --git a/app/partials/section/create_section.html b/app/partials/section/section_create.html similarity index 100% rename from app/partials/section/create_section.html rename to app/partials/section/section_create.html diff --git a/app/partials/section/section_list.controller.js b/app/partials/section/section_list.controller.js new file mode 100644 index 0000000..580e735 --- /dev/null +++ b/app/partials/section/section_list.controller.js @@ -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; + }; +})(); \ No newline at end of file diff --git a/app/partials/section/list_section.html b/app/partials/section/section_list.html similarity index 97% rename from app/partials/section/list_section.html rename to app/partials/section/section_list.html index 8714f71..93d5e56 100644 --- a/app/partials/section/list_section.html +++ b/app/partials/section/section_list.html @@ -57,5 +57,5 @@
- Regresar + Regresar
\ No newline at end of file diff --git a/app/partials/section/section_update.controller.js b/app/partials/section/section_update.controller.js new file mode 100644 index 0000000..f546fdf --- /dev/null +++ b/app/partials/section/section_update.controller.js @@ -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; + }; + +})(); \ No newline at end of file diff --git a/app/partials/section/update_section.html b/app/partials/section/section_update.html similarity index 96% rename from app/partials/section/update_section.html rename to app/partials/section/section_update.html index 06d0093..0139078 100644 --- a/app/partials/section/update_section.html +++ b/app/partials/section/section_update.html @@ -48,6 +48,6 @@
\ No newline at end of file diff --git a/app/partials/sidebar/navbar.html b/app/partials/sidebar/navbar.html index 22280f6..606ac97 100644 --- a/app/partials/sidebar/navbar.html +++ b/app/partials/sidebar/navbar.html @@ -7,9 +7,9 @@ - ucv - ciencias - computacion + ucv + ciencias + computacion