diff --git a/app/partials/course/course_create.html b/app/partials/course/course_create.html index 81a7baa..9031e1d 100644 --- a/app/partials/course/course_create.html +++ b/app/partials/course/course_create.html @@ -7,10 +7,10 @@
- + + ng-pattern="/\d{4}/" placeholder="6201" maxlength="4" required/>
- + + name="name" ng-model="vm.course.name" placeholder="Algoritmos y Programación" required/>
- + + maxlength="1" placeholder="6" required/>
- +
@@ -62,7 +63,8 @@
-
+
+
diff --git a/app/partials/professor/professor_create.html b/app/partials/professor/professor_create.html index f80281b..88a5811 100644 --- a/app/partials/professor/professor_create.html +++ b/app/partials/professor/professor_create.html @@ -7,7 +7,7 @@
- + @@ -20,10 +20,10 @@
- + + name="nombre" ng-model="vm.profesor.Nombre" + placeholder="Andres Jesús" required/>
- + + name="apellido" ng-model="vm.profesor.Apellido" + placeholder="Perez Moreno" required/>


- - Dirección de Correo * + + placeholder="me@example.com" required/>
Número de Teléfono + ng-pattern="/\d{13}/" maxlength="13" + placeholder="04241239876"/> El Formato del Número de Teléfono es incorrecto.
- +
@@ -86,6 +87,7 @@
+
diff --git a/app/partials/section/section_create.controller.js b/app/partials/section/section_create.controller.js index 3fdbab0..a67d62d 100644 --- a/app/partials/section/section_create.controller.js +++ b/app/partials/section/section_create.controller.js @@ -11,6 +11,7 @@ var professorid = $rootScope.professorId; var vm = this; vm.course = {}; + vm.itExists = false; vm.selectedCourse = selectedCourse; vm.submitted = false; vm.semester, vm.section, vm.materias; @@ -32,10 +33,8 @@ }, function (){ console.log("Error al obtener los datos."); - }); - vm.submit = function () { if (vm.data_input_form.$valid){ @@ -59,16 +58,31 @@ } }); - 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; + + angular.forEach (vm.professor.courses[vm.index].sections, + function (value, key){ + if (value.name == vm.name) { + if(value.semester == vm.semester){ + vm.itExists = true; + } + } + }); + + if(!vm.itExists){ + 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{ + $rootScope.botonOk = true; + $rootScope.mensaje = "Sección Duplicada, " + vm.name + " existe en el semestre "+ vm.semester + "."; + } }else{ vm.submitted = true; } @@ -88,10 +102,9 @@ var sheet = workbook.SheetNames[0]; var worksheet = workbook.Sheets[sheet]; - /* Find desired cell containing semester and section */ + // 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 */ @@ -107,7 +120,6 @@ vm.students.push(student); student = {}; } - } }; $scope.$apply(); @@ -122,13 +134,6 @@ $scope.modalInstance.dismiss('cancel'); }; - $rootScope.open = function($event) { - $event.preventDefault(); - $event.stopPropagation(); - - $rootScope.opened = true; - }; - vm.back = function () { $state.go('SectionList'); }; diff --git a/app/partials/section/section_create.html b/app/partials/section/section_create.html index 248d0a6..531b513 100644 --- a/app/partials/section/section_create.html +++ b/app/partials/section/section_create.html @@ -43,7 +43,7 @@ vm.data_input_form.seccion.$invalid"> - La sección es obligatoria. + La Sección es obligatoria.
@@ -63,7 +63,7 @@

- +

diff --git a/app/partials/sidebar/sidebar.html b/app/partials/sidebar/sidebar.html index bb73e08..e2b9070 100644 --- a/app/partials/sidebar/sidebar.html +++ b/app/partials/sidebar/sidebar.html @@ -2,12 +2,12 @@