From 0b3440abba5441bab1975b134b7813a526de1343 Mon Sep 17 00:00:00 2001 From: Reynaldo Reyes Date: Wed, 27 Apr 2016 20:34:27 -0430 Subject: [PATCH] Update repo with several changes --- app/index.html | 1 + app/partials/course/course.services.js | 2 +- .../course/course_create.controller.js | 20 ++--- app/partials/course/course_create.html | 5 +- app/partials/course/course_list.controller.js | 24 +++--- app/partials/course/course_list.html | 2 +- app/partials/login/login.html | 14 +++- app/partials/professor/professor.services.js | 3 +- app/partials/report/course_report.html | 8 +- .../report/section_assist.controller.js | 7 +- .../report/section_report.controller.js | 1 + app/partials/report/section_report.html | 4 +- .../report/student_report.controller.js | 1 + app/partials/report/student_report.html | 6 +- .../modal/student_bt_removal_modal.html | 14 ++++ .../section/section_list.controller.js | 4 +- app/partials/section/section_list.html | 6 +- .../section/section_update.controller.js | 62 +++++++++++--- app/partials/section/section_update.html | 36 ++++++-- app/partials/sidebar/navbar.html | 2 +- app/partials/sidebar/sidebar.controllers.js | 12 +-- .../students/modal/update_students_modal.html | 4 +- app/partials/students/student.module.js | 17 ++++ .../students/student_update.controller.js | 82 +++++++++++++++++++ app/partials/students/student_update.html | 54 ++++++++++++ app/partials/students/update_students.html | 69 ---------------- bower.json | 2 +- 27 files changed, 316 insertions(+), 146 deletions(-) create mode 100644 app/partials/section/modal/student_bt_removal_modal.html create mode 100644 app/partials/students/student_update.controller.js create mode 100644 app/partials/students/student_update.html delete mode 100644 app/partials/students/update_students.html diff --git a/app/index.html b/app/index.html index 1081c96..7050d4a 100644 --- a/app/index.html +++ b/app/index.html @@ -89,6 +89,7 @@ + diff --git a/app/partials/course/course.services.js b/app/partials/course/course.services.js index a61a152..00a023a 100644 --- a/app/partials/course/course.services.js +++ b/app/partials/course/course.services.js @@ -7,6 +7,6 @@ courses.$inject = ['$resource','$rootScope']; function courses($resource, $rootScope){ - return $resource('http://'+$rootScope.domainUrl+'/courses/:id', null); + return $resource('http://'+$rootScope.domainUrl+'/professors/:id/courses', null); }; })(); diff --git a/app/partials/course/course_create.controller.js b/app/partials/course/course_create.controller.js index aa2d90b..b349aa4 100644 --- a/app/partials/course/course_create.controller.js +++ b/app/partials/course/course_create.controller.js @@ -6,12 +6,10 @@ .controller('CourseCreateCtrl', CourseCreateCtrl) CourseCreateCtrl.$inject = - ['$scope','$rootScope', '$modal', '$state', 'professors']; + ['$scope', '$rootScope', '$modal', '$state', 'professors']; function CourseCreateCtrl($scope, $rootScope, $modal, $state, professors) { var vm = this; - vm.submitted = false; - vm.mayorque = false; - $rootScope.mensaje = ""; + $scope.mensaje = ""; var professorid = $rootScope.professorId; professors.get({ id: professorid }, @@ -34,14 +32,12 @@ }; $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; } } }); @@ -49,13 +45,13 @@ vm.professor.courses.push(vm.course); professors.update({ id: professorid }, vm.professor, function(){ - $rootScope.botonOk = true; - $rootScope.mensaje = + $scope.botonOk = true; + $scope.mensaje = "Materia " + vm.course.name + " creada"; }, function(){ - $rootScope.botonOk = true; - $rootScope.mensaje = + $scope.botonOk = true; + $scope.mensaje = "Error creando la materia " + vm.course.name; }); }else{ @@ -72,5 +68,9 @@ $scope.cancel = function () { $scope.modalInstance.dismiss('cancel'); }; + + vm.back = function () { + $state.go('CourseList'); + }; }; })(); \ No newline at end of file diff --git a/app/partials/course/course_create.html b/app/partials/course/course_create.html index b7f0254..81a7baa 100644 --- a/app/partials/course/course_create.html +++ b/app/partials/course/course_create.html @@ -62,7 +62,6 @@ -


@@ -71,8 +70,8 @@

- + +

diff --git a/app/partials/course/course_list.controller.js b/app/partials/course/course_list.controller.js index 0a6627a..1da9d73 100644 --- a/app/partials/course/course_list.controller.js +++ b/app/partials/course/course_list.controller.js @@ -25,20 +25,18 @@ }; 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.index = index; + $scope.botonOk = true; + $scope.otroBotonOk = false; + $scope.botonCancelar = true; + var name = vm.course[index].name; + $scope.mensaje = "¿Seguro que desea eliminar la Materia "+name+"?"; $scope.modalInstance = $modal.open({ - animation: $rootScope.animationsEnabled, templateUrl: '/partials/course/modal/delete_course_modal.html', scope: $scope, size: 'sm', resolve: { items: function () { - return ""; } } }); @@ -46,18 +44,18 @@ }; vm.eliminarMateria = function (index) { - $rootScope.botonOk = false; - $rootScope.otroBotonOk = true; - $rootScope.botonCancelar = false; + $scope.botonOk = false; + $scope.otroBotonOk = true; + $scope.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"; + $scope.mensaje = "Materia " + name + " eliminada"; }, function () { - $rootScope.mensaje = "Error eliminando la materia" + name; + $scope.mensaje = "Error eliminando la materia" + name; }); }; diff --git a/app/partials/course/course_list.html b/app/partials/course/course_list.html index 9843517..0bb1a28 100644 --- a/app/partials/course/course_list.html +++ b/app/partials/course/course_list.html @@ -1,5 +1,5 @@
-

Lista de Materias

+

Listado de Materias



diff --git a/app/partials/login/login.html b/app/partials/login/login.html index 8e8ce67..5a60f35 100644 --- a/app/partials/login/login.html +++ b/app/partials/login/login.html @@ -6,11 +6,11 @@
- +
- {{'TAG_NICK_NAME_ERROR'}} + La Cédula del profesor es Obligatoria.
@@ -25,7 +25,7 @@
{{ vm.password = vm.user.Password }}
- {{'TAG_PASSWORD_ERROR'}} + La Contraseña es Obligatoria.
{{getHash(vm.password)}}
@@ -40,7 +40,13 @@

- +

diff --git a/app/partials/professor/professor.services.js b/app/partials/professor/professor.services.js index 55a7b79..d2ac5d6 100644 --- a/app/partials/professor/professor.services.js +++ b/app/partials/professor/professor.services.js @@ -7,7 +7,8 @@ .value('selectedCourse',{}) .value('selectedSection',{}) .value('selectedStudent',{}) - .value('profesorSeleccionado',{}); + .value('profesorSeleccionado',{}) + .value('data',{}); professors.$inject = ['$resource','$rootScope']; function professors($resource, $rootScope){ diff --git a/app/partials/report/course_report.html b/app/partials/report/course_report.html index 7e901da..381c4aa 100644 --- a/app/partials/report/course_report.html +++ b/app/partials/report/course_report.html @@ -1,5 +1,5 @@
-

Reportes de Materias

+

Reportes por Materia



@@ -15,11 +15,11 @@ Creditos - + Descripción - - Reportes de Materia + + Estadisticas de la Materia Secciones diff --git a/app/partials/report/section_assist.controller.js b/app/partials/report/section_assist.controller.js index d808226..81b5cf1 100644 --- a/app/partials/report/section_assist.controller.js +++ b/app/partials/report/section_assist.controller.js @@ -47,11 +47,12 @@ } vm.subTotal = vm.positive + vm.negative; }); - if(((vm.positive/vm.subTotal)*100)<75){ + if(((vm.positive/vm.subTotal)*100)>75){ + vm.studentsPassed.push(value); + }else{ vm.students.push(value); vm.flag = true; - }else{ - vm.studentsPassed.push(value); + } vm.positiveTotal = vm.positiveTotal + vm.positive; vm.negativeTotal = vm.negativeTotal + vm.negative; diff --git a/app/partials/report/section_report.controller.js b/app/partials/report/section_report.controller.js index 7b2ed6f..e62f06a 100644 --- a/app/partials/report/section_report.controller.js +++ b/app/partials/report/section_report.controller.js @@ -19,6 +19,7 @@ angular.forEach (vm.professor.courses, function (value, key){ if (value._id == selectedCourse._id ) { + vm.course = value.name; vm.index = key; vm.section = value.sections; } diff --git a/app/partials/report/section_report.html b/app/partials/report/section_report.html index 899e7d6..ea2b6fa 100644 --- a/app/partials/report/section_report.html +++ b/app/partials/report/section_report.html @@ -1,5 +1,5 @@
-

Reportes de Secciones

+

Reportes por Sección en {{vm.course}}


+ + +
\ No newline at end of file diff --git a/app/partials/section/section_list.controller.js b/app/partials/section/section_list.controller.js index 47e6c6d..64d2899 100644 --- a/app/partials/section/section_list.controller.js +++ b/app/partials/section/section_list.controller.js @@ -20,6 +20,7 @@ if (value._id == selectedCourse._id ) { vm.index = key; vm.section = value.sections; + vm.course = value.name; } }); }, @@ -45,7 +46,8 @@ $rootScope.otroBotonOk = false; $rootScope.botonCancelar = true; $rootScope.rsplice = false; - $rootScope.mensaje = "¿Seguro que desea eliminar la sección?"; + var name = vm.section[index].name; + $rootScope.mensaje = "¿Seguro que desea eliminar la sección "+name+"?"; $scope.modalInstance = $modal.open({ animation: $rootScope.animationsEnabled, diff --git a/app/partials/section/section_list.html b/app/partials/section/section_list.html index 7fa6d0f..9f28675 100644 --- a/app/partials/section/section_list.html +++ b/app/partials/section/section_list.html @@ -1,5 +1,5 @@
-

Listado de Secciones


+

Listado de Secciones en {{vm.course}}


@@ -31,10 +31,10 @@ - Modificar + Matricula - Borrar + Eliminar diff --git a/app/partials/section/section_update.controller.js b/app/partials/section/section_update.controller.js index f546fdf..b8df037 100644 --- a/app/partials/section/section_update.controller.js +++ b/app/partials/section/section_update.controller.js @@ -5,8 +5,8 @@ .module('app.section') .controller('SectionUpdateCtrl', SectionUpdateCtrl) - SectionUpdateCtrl.$inject = ['$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedSection', 'selectedCourse']; - function SectionUpdateCtrl($scope, $rootScope, $state, professors, $modal, selectedSection, selectedCourse){ + SectionUpdateCtrl.$inject = ['$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedSection', 'selectedCourse','data']; + function SectionUpdateCtrl($scope, $rootScope, $state, professors, $modal, selectedSection, selectedCourse, data){ var professorid = $rootScope.professorId; var vm = this; vm.section = {}; @@ -28,10 +28,57 @@ console.log("Error al obtener los datos."); }); - vm.addStudent = function (index) { + vm.addStudent = function () { $state.go('StudentCreate'); }; + vm.mailUpdate = function (index) { + data.Student = vm.students[index]; + data.Index = index; + $state.go('StudentUpdate'); + }; + + vm.freeBTAddressModal = function (index) { + $rootScope.index = index; + $rootScope.botonOk = true; + $rootScope.otroBotonOk = false; + $rootScope.botonCancelar = true; + $rootScope.eliminarLoading = false; + $rootScope.mensaje = "¿Desea liberar la dirección de BT del estudiante "+ vm.students[index].lastname +", "+ vm.students[index].name + "?"; + $scope.modalInstance = $modal.open({ + animation: $rootScope.animationsEnabled, + templateUrl: 'partials/section/modal/student_bt_removal_modal.html', + scope: $scope, + size: 'sm', + resolve: { + items: function () { + return ""; + } + } + }); + }; + + vm.freeBTAddress = function (index) { + vm.student = vm.students[index]; + vm.student.btaddress = null; + + vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students.push(vm.student); + + professors.update({ id: professorid }, vm.professor, + function(){ + $rootScope.botonOk = false; + $rootScope.otroBotonOk = true; + $rootScope.botonCancelar = false; + $rootScope.mensaje = "Dirección BT de " + vm.student.lastname + ", " + vm.student.name + " fue liberada"; + }, + function(){ + $rootScope.botonOk = false; + $rootScope.otroBotonOk = true; + $rootScope.botonCancelar = false; + $rootScope.mensaje = "Error al liberar dirección de BT del estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre; + }); + }; + vm.retirarEstudianteModal = function (index) { $rootScope.index = index; $rootScope.botonOk = true; @@ -39,7 +86,6 @@ $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', @@ -71,12 +117,6 @@ }); }; - $rootScope.open = function($event) { - $event.preventDefault(); - $event.stopPropagation(); - $rootScope.opened = true; - }; - $scope.ok = function () { $scope.modalInstance.dismiss('cancel'); }; @@ -88,8 +128,6 @@ vm.back = function () { $state.go('SectionList'); }; - - return vm; }; })(); \ No newline at end of file diff --git a/app/partials/section/section_update.html b/app/partials/section/section_update.html index b0e9eec..ef23b60 100644 --- a/app/partials/section/section_update.html +++ b/app/partials/section/section_update.html @@ -10,26 +10,37 @@ - - - - + + + @@ -42,8 +53,21 @@ + + + diff --git a/app/partials/sidebar/navbar.html b/app/partials/sidebar/navbar.html index 4c75ae9..b81ddda 100644 --- a/app/partials/sidebar/navbar.html +++ b/app/partials/sidebar/navbar.html @@ -15,7 +15,7 @@ diff --git a/app/partials/sidebar/sidebar.controllers.js b/app/partials/sidebar/sidebar.controllers.js index 0cb3d94..1dbef02 100644 --- a/app/partials/sidebar/sidebar.controllers.js +++ b/app/partials/sidebar/sidebar.controllers.js @@ -18,11 +18,11 @@ subItems: [ { state: 'ProfessorList', - text: 'Listar Profesores' + text: 'Listado de Profesores' }, { state: 'ProfessorCreate', - text: 'Agregar Profesores' + text: 'Nuevo Profesor' } ] }, @@ -31,11 +31,11 @@ subItems: [ { state: 'CourseList', - text: 'Listar Materias' + text: 'Listado de Materias' }, { state: 'CourseCreate', - text: 'Agregar Materia' + text: 'Nueva Materia' } ] }, @@ -44,9 +44,9 @@ subItems: [ { state: 'courseReport', - text: 'Reportes' + text: 'Reportes por Materia' } - ] + ] } ]; }; diff --git a/app/partials/students/modal/update_students_modal.html b/app/partials/students/modal/update_students_modal.html index 716f17d..93e1c2f 100644 --- a/app/partials/students/modal/update_students_modal.html +++ b/app/partials/students/modal/update_students_modal.html @@ -1,12 +1,12 @@ \ No newline at end of file diff --git a/app/partials/students/student.module.js b/app/partials/students/student.module.js index d682ae2..a0cb563 100644 --- a/app/partials/students/student.module.js +++ b/app/partials/students/student.module.js @@ -34,5 +34,22 @@ } } }) + .state('StudentUpdate', { + url: '/StudentUpdate', + views: { + sidebar: { + templateUrl: 'partials/sidebar/sidebar.html', + controller: 'SidebarCtrl' + }, + navbar: { + templateUrl: 'partials/sidebar/navbar.html' + }, + content: { + templateUrl: 'partials/students/student_update.html', + controller: 'StudentUpdateCtrl', + controllerAs: 'vm' + } + } + }) }; })(); diff --git a/app/partials/students/student_update.controller.js b/app/partials/students/student_update.controller.js new file mode 100644 index 0000000..97d7e95 --- /dev/null +++ b/app/partials/students/student_update.controller.js @@ -0,0 +1,82 @@ +(function(){ + 'use strict'; + + angular + .module('app.student') + .controller('StudentUpdateCtrl', StudentUpdateCtrl) + + StudentUpdateCtrl.$inject = ['$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedSection', 'selectedCourse', 'data']; + function StudentUpdateCtrl($scope, $rootScope, $state, professors, $modal, selectedSection, selectedCourse, data){ + + var vm = this; + var professorid = $rootScope.professorId; + vm.professor = {}; + $rootScope.mensaje = ""; + $rootScope.actOk = false; + vm.newMail = null; + vm.student = data.Student + + 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.submit = function() { + + if (vm.data_input_form.$valid){ + vm.student.email = vm.newMail; + $rootScope.crearEstudianteLoading = true; + $rootScope.botonOk = false; + $scope.modalInstance = $modal.open({ + animation: $rootScope.animationsEnabled, + templateUrl: 'partials/students/modal/update_students_modal.html', + scope: $scope, + size: 'sm', + resolve: { + items: function () { + return $rootScope.items; + } + } + }); + + vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students.splice(data.Index, 1); + + vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students.push(vm.student); + + professors.update({ id: professorid }, vm.professor, + function(){ + $rootScope.botonOk = true; + $rootScope.mensaje = "Estudiante " + vm.student.lastname + ", " + vm.student.name + " actualizado"; + }, + function(){ + $rootScope.botonOk = true; + $rootScope.mensaje = "Error al actualizar al estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre; + }); + } + }; + + $scope.ok = function (urlLo) { + $state.go('SectionUpdate'); + $scope.modalInstance.dismiss('cancel'); + }; + + $scope.cancel = function () { + $scope.modalInstance.dismiss('cancel'); + }; + + vm.back = function () { + $state.go('SectionUpdate'); + }; + }; +})(); \ No newline at end of file diff --git a/app/partials/students/student_update.html b/app/partials/students/student_update.html new file mode 100644 index 0000000..e65acd4 --- /dev/null +++ b/app/partials/students/student_update.html @@ -0,0 +1,54 @@ +
+
+
+

Correo Electronico del Alumno {{vm.student.lastname}}, {{vm.student.name}}

+
+
+

+
+
+
+
+ + +
+
+
+
+ + +
+ + El Correo del Alumno es obligatorio. + + + El formato del Correo del Alumno es incorrecto. + +
+
+
+
+
+
+
+ +

+ + + + +

+
+
+
+ +
\ No newline at end of file diff --git a/app/partials/students/update_students.html b/app/partials/students/update_students.html deleted file mode 100644 index 67947f8..0000000 --- a/app/partials/students/update_students.html +++ /dev/null @@ -1,69 +0,0 @@ -
-
-
-
- -
-

Modificar Estudiante

-
-
-
-
- - -
-
- - -
-
- - -
-
-


-
-
-
- - - - El formato del Correo del Alumno es incorrecto. - -
-
- - - - El formato del Teléfono debe ser: 0212-789-5551. - -
-
-
-
-
-
-
- -

- - - -

-
-
-
- \ No newline at end of file diff --git a/bower.json b/bower.json index 1f0b654..3fd06c7 100644 --- a/bower.json +++ b/bower.json @@ -2,7 +2,7 @@ "name": "M.A.S.A App", "description": "M.A.S.A Project", "version": "1.0.0", - "homepage": "https://github.com/angular/angular-seed", + "homepage": "https://bitbucket.org/rey_reyes/masa", "license": "MIT", "private": true, "dependencies": {
+ Cedula + Nombre + Apellido + Correo + Actualizar Correo + + Dirección BT + + + + Liberar Dirección BT + Retirar {{ student.lastname }} {{ student.email }} - + {{ student.btaddress }} + + +