Update repo with several changes

This commit is contained in:
Reynaldo Reyes
2016-04-27 20:34:27 -04:30
parent 38aaff259a
commit 0b3440abba
27 changed files with 316 additions and 146 deletions

View File

@@ -89,6 +89,7 @@
<script src="partials/students/student.module.js"></script> <script src="partials/students/student.module.js"></script>
<script src="partials/students/student_create.controller.js"></script> <script src="partials/students/student_create.controller.js"></script>
<script src="partials/students/student_update.controller.js"></script>
<script src="partials/students/student.services.js"></script> <script src="partials/students/student.services.js"></script>
<!-- Angular ui.bootstrap's Javascript instead of Bootstrap Javascript --> <!-- Angular ui.bootstrap's Javascript instead of Bootstrap Javascript -->

View File

@@ -7,6 +7,6 @@
courses.$inject = ['$resource','$rootScope']; courses.$inject = ['$resource','$rootScope'];
function courses($resource, $rootScope){ function courses($resource, $rootScope){
return $resource('http://'+$rootScope.domainUrl+'/courses/:id', null); return $resource('http://'+$rootScope.domainUrl+'/professors/:id/courses', null);
}; };
})(); })();

View File

@@ -9,9 +9,7 @@
['$scope', '$rootScope', '$modal', '$state', 'professors']; ['$scope', '$rootScope', '$modal', '$state', 'professors'];
function CourseCreateCtrl($scope, $rootScope, $modal, $state, professors) { function CourseCreateCtrl($scope, $rootScope, $modal, $state, professors) {
var vm = this; var vm = this;
vm.submitted = false; $scope.mensaje = "";
vm.mayorque = false;
$rootScope.mensaje = "";
var professorid = $rootScope.professorId; var professorid = $rootScope.professorId;
professors.get({ id: professorid }, professors.get({ id: professorid },
@@ -34,14 +32,12 @@
}; };
$scope.modalInstance = $modal.open({ $scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: templateUrl:
'/partials/course/modal/create_course_modal.html', '/partials/course/modal/create_course_modal.html',
scope: $scope, scope: $scope,
size: 'sm', size: 'sm',
resolve: { resolve: {
items: function () { items: function () {
return $rootScope.items;
} }
} }
}); });
@@ -49,13 +45,13 @@
vm.professor.courses.push(vm.course); vm.professor.courses.push(vm.course);
professors.update({ id: professorid }, vm.professor, professors.update({ id: professorid }, vm.professor,
function(){ function(){
$rootScope.botonOk = true; $scope.botonOk = true;
$rootScope.mensaje = $scope.mensaje =
"Materia " + vm.course.name + " creada"; "Materia " + vm.course.name + " creada";
}, },
function(){ function(){
$rootScope.botonOk = true; $scope.botonOk = true;
$rootScope.mensaje = $scope.mensaje =
"Error creando la materia " + vm.course.name; "Error creando la materia " + vm.course.name;
}); });
}else{ }else{
@@ -72,5 +68,9 @@
$scope.cancel = function () { $scope.cancel = function () {
$scope.modalInstance.dismiss('cancel'); $scope.modalInstance.dismiss('cancel');
}; };
vm.back = function () {
$state.go('CourseList');
};
}; };
})(); })();

View File

@@ -62,7 +62,6 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row clearfix"><div class="col-md-12 column"><br><br></div></div>
</div> </div>
</div> </div>
<div class="row clearfix"> <div class="row clearfix">
@@ -71,8 +70,8 @@
<label>&nbsp;</label> <label>&nbsp;</label>
<p class="input-group"> <p class="input-group">
<span class="input-group-btn"> <span class="input-group-btn">
<button type="submit" class="btn-primary btn"> <button type="submit" class="btn-success btn">Crear Materia</button>
Crear Materia</button> <button type="button" class="btn-warning btn" style="margin: 10px" ng-click="vm.back()">Regresar</button>
</span> </span>
</p> </p>
</div> </div>

View File

@@ -25,20 +25,18 @@
}; };
vm.eliminarMateriaModal = function (index) { vm.eliminarMateriaModal = function (index) {
$rootScope.index = index; $scope.index = index;
$rootScope.botonOk = true; $scope.botonOk = true;
$rootScope.otroBotonOk = false; $scope.otroBotonOk = false;
$rootScope.botonCancelar = true; $scope.botonCancelar = true;
$rootScope.rsplice = false; var name = vm.course[index].name;
$rootScope.mensaje = "¿Seguro que desea eliminar la materia?"; $scope.mensaje = "¿Seguro que desea eliminar la Materia "+name+"?";
$scope.modalInstance = $modal.open({ $scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: '/partials/course/modal/delete_course_modal.html', templateUrl: '/partials/course/modal/delete_course_modal.html',
scope: $scope, scope: $scope,
size: 'sm', size: 'sm',
resolve: { resolve: {
items: function () { items: function () {
return "";
} }
} }
}); });
@@ -46,18 +44,18 @@
}; };
vm.eliminarMateria = function (index) { vm.eliminarMateria = function (index) {
$rootScope.botonOk = false; $scope.botonOk = false;
$rootScope.otroBotonOk = true; $scope.otroBotonOk = true;
$rootScope.botonCancelar = false; $scope.botonCancelar = false;
var name = vm.course[index].name; var name = vm.course[index].name;
vm.professor.courses.splice(index, 1); vm.professor.courses.splice(index, 1);
professors.update({ id: professorid }, vm.professor, professors.update({ id: professorid }, vm.professor,
function () { function () {
$rootScope.mensaje = "Materia " + name + " eliminada"; $scope.mensaje = "Materia " + name + " eliminada";
}, },
function () { function () {
$rootScope.mensaje = "Error eliminando la materia" + name; $scope.mensaje = "Error eliminando la materia" + name;
}); });
}; };

View File

@@ -1,5 +1,5 @@
<div class="row clearfix"> <div class="row clearfix">
<h4>Lista de Materias</h4> <h4>Listado de Materias</h4>
<div class="row clearfix"><div class="col-md-12 column"><br><br></div> <div class="row clearfix"><div class="col-md-12 column"><br><br></div>
</div> </div>
<div> <div>

View File

@@ -6,11 +6,11 @@
<div class="col-md-4 column"> <div class="col-md-4 column">
</div> </div>
<div class="col-md-4 column"> <div class="col-md-4 column">
<label for="nickname">Cedula de Identidad del Profesor</label> <label>Cédula de Identidad del Profesor</label>
<input type="text" class="form-control" id="nickname" name="nickname" ng-model="vm.user.nickname" required/> <input type="text" class="form-control" id="nickname" name="nickname" ng-model="vm.user.nickname" required/>
<div class="error" ng-show="vm.submitted && vm.data_input_form.nickname.$invalid"> <div class="error" ng-show="vm.submitted && vm.data_input_form.nickname.$invalid">
<small class="error" ng-show="vm.data_input_form.nickname.$error.required"> <small class="error" ng-show="vm.data_input_form.nickname.$error.required">
{{'TAG_NICK_NAME_ERROR'}} La Cédula del profesor es Obligatoria.
</small> </small>
</div> </div>
</div> </div>
@@ -25,7 +25,7 @@
<div ng-show=false> {{ vm.password = vm.user.Password }}</div> <div ng-show=false> {{ vm.password = vm.user.Password }}</div>
<div class="error" ng-show="vm.submitted && vm.data_input_form.password.$invalid"> <div class="error" ng-show="vm.submitted && vm.data_input_form.password.$invalid">
<small class="error" ng-show="vm.data_input_form.password.$error.required"> <small class="error" ng-show="vm.data_input_form.password.$error.required">
{{'TAG_PASSWORD_ERROR'}} La Contraseña es Obligatoria.
</small> </small>
</div> </div>
<div ng-show=false>{{getHash(vm.password)}}</div> <div ng-show=false>{{getHash(vm.password)}}</div>
@@ -40,7 +40,13 @@
<label>&nbsp;</label> <label>&nbsp;</label>
<p class="input-group"> <p class="input-group">
<span class="input-group-btn"> <span class="input-group-btn">
<button type="submit" id="submit" class="btn-primary btn" >Ingresar</button> <button
type="submit"
id="submit"
class="btn-primary btn">
<span class="glyphicon glyphicon-log-in"
aria-hidden="true"></span> Ingresar
</button>
</span> </span>
</p> </p>

View File

@@ -7,7 +7,8 @@
.value('selectedCourse',{}) .value('selectedCourse',{})
.value('selectedSection',{}) .value('selectedSection',{})
.value('selectedStudent',{}) .value('selectedStudent',{})
.value('profesorSeleccionado',{}); .value('profesorSeleccionado',{})
.value('data',{});
professors.$inject = ['$resource','$rootScope']; professors.$inject = ['$resource','$rootScope'];
function professors($resource, $rootScope){ function professors($resource, $rootScope){

View File

@@ -1,5 +1,5 @@
<div class="row clearfix"> <div class="row clearfix">
<h4>Reportes de Materias</h4> <h4>Reportes por Materia</h4>
<br> <br>
</br> </br>
<div> <div>
@@ -15,11 +15,11 @@
<th width="5%" style="text-align: center"> <th width="5%" style="text-align: center">
Creditos Creditos
</th> </th>
<th width="40%" style="text-align: center"> <th width="35%" style="text-align: center">
Descripción Descripción
</th> </th>
<th width="15%" style="text-align: center"> <th width="20%" style="text-align: center">
Reportes de Materia Estadisticas de la Materia
</th> </th>
<th width="10%" style="text-align: center"> <th width="10%" style="text-align: center">
Secciones Secciones

View File

@@ -47,11 +47,12 @@
} }
vm.subTotal = vm.positive + vm.negative; 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.students.push(value);
vm.flag = true; vm.flag = true;
}else{
vm.studentsPassed.push(value);
} }
vm.positiveTotal = vm.positiveTotal + vm.positive; vm.positiveTotal = vm.positiveTotal + vm.positive;
vm.negativeTotal = vm.negativeTotal + vm.negative; vm.negativeTotal = vm.negativeTotal + vm.negative;

View File

@@ -19,6 +19,7 @@
angular.forEach (vm.professor.courses, angular.forEach (vm.professor.courses,
function (value, key){ function (value, key){
if (value._id == selectedCourse._id ) { if (value._id == selectedCourse._id ) {
vm.course = value.name;
vm.index = key; vm.index = key;
vm.section = value.sections; vm.section = value.sections;
} }

View File

@@ -1,5 +1,5 @@
<div class="row clearfix"> <div class="row clearfix">
<h4>Reportes de Secciones</h4> <h4>Reportes por Sección en {{vm.course}}</h4>
<br> <br>
<button class = "btn-warning btn" <button class = "btn-warning btn"
type = "button" type = "button"
@@ -25,7 +25,7 @@
Semestre Semestre
</th> </th>
<th width="20%" style="text-align: center"> <th width="20%" style="text-align: center">
Reportes por Sección Estadisticas de la Sección
</th> </th>
<th width="10%" style="text-align: center"> <th width="10%" style="text-align: center">
Estudiantes Estudiantes

View File

@@ -16,6 +16,7 @@
professors.get({ id: professorid }, professors.get({ id: professorid },
function (successResult){ function (successResult){
vm.professor = successResult; vm.professor = successResult;
vm.course = vm.professor.courses[selectedCourse.index].name;
angular.forEach (vm.professor.courses[selectedCourse.index].sections, angular.forEach (vm.professor.courses[selectedCourse.index].sections,
function (value, key){ function (value, key){
if (value._id == selectedSection._id ) { if (value._id == selectedSection._id ) {

View File

@@ -1,5 +1,5 @@
<div class="row clearfix"> <div class="row clearfix">
<h4>Reportes de Estudiantes</h4> <h4>Reportes por Estudiante en {{vm.course}} - Sección {{vm.section.name}} - Semestre {{ vm.section.semester }} </h4>
<br> <br>
<button class = "btn-warning btn" <button class = "btn-warning btn"
type = "button" type = "button"
@@ -13,7 +13,7 @@
<thead> <thead>
<tr> <tr>
<th width="20%" style="text-align: center"> <th width="20%" style="text-align: center">
Cedula Cédula
</th> </th>
<th width="20%" style="text-align: center"> <th width="20%" style="text-align: center">
Nombre Nombre
@@ -22,7 +22,7 @@
Apellido Apellido
</th> </th>
<th width="20%" style="text-align: center"> <th width="20%" style="text-align: center">
Reportes por Estudiante Estadisticas del Estudiante
</th> </th>
</tr> </tr>
</thead> </thead>

View File

@@ -0,0 +1,14 @@
<div class="modal-header">
<h3 class="modal-title">Liberar BT</h3>
</div>
<div style="text-align: center" class="modal-body">
{{ mensaje }}
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-show="botonOk" type="button"
ng-click="vm.freeBTAddress(index)">OK</button>
<button class="btn btn-warning" ng-show="botonCancelar" type="button"
ng-click="cancel()">Cancelar</button>
<button class="btn btn-primary" ng-show="otroBotonOk" type="button"
ng-click="ok(urlLo)">Aceptar</button>
</div>

View File

@@ -20,6 +20,7 @@
if (value._id == selectedCourse._id ) { if (value._id == selectedCourse._id ) {
vm.index = key; vm.index = key;
vm.section = value.sections; vm.section = value.sections;
vm.course = value.name;
} }
}); });
}, },
@@ -45,7 +46,8 @@
$rootScope.otroBotonOk = false; $rootScope.otroBotonOk = false;
$rootScope.botonCancelar = true; $rootScope.botonCancelar = true;
$rootScope.rsplice = false; $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({ $scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled, animation: $rootScope.animationsEnabled,

View File

@@ -1,5 +1,5 @@
<div class="row clearfix"> <div class="row clearfix">
<h4>Listado de Secciones</h4></br> <h4>Listado de Secciones en {{vm.course}} </h4></br>
<div> <div>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn-success btn" ng-click="vm.createSection()" style="margin: 10px"> Crear Sección </button> <button class="btn-success btn" ng-click="vm.createSection()" style="margin: 10px"> Crear Sección </button>
@@ -31,10 +31,10 @@
<span ng-show="sortType == 'semester' && sortReverse" class="fa fa-caret-up"></span> <span ng-show="sortType == 'semester' && sortReverse" class="fa fa-caret-up"></span>
</th> </th>
<th width="10%" style="text-align: center"> <th width="10%" style="text-align: center">
Modificar Matricula
</th> </th>
<th width="10%" style="text-align: center"> <th width="10%" style="text-align: center">
Borrar Eliminar
</th> </th>
</tr> </tr>
</thead> </thead>

View File

@@ -5,8 +5,8 @@
.module('app.section') .module('app.section')
.controller('SectionUpdateCtrl', SectionUpdateCtrl) .controller('SectionUpdateCtrl', SectionUpdateCtrl)
SectionUpdateCtrl.$inject = ['$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){ function SectionUpdateCtrl($scope, $rootScope, $state, professors, $modal, selectedSection, selectedCourse, data){
var professorid = $rootScope.professorId; var professorid = $rootScope.professorId;
var vm = this; var vm = this;
vm.section = {}; vm.section = {};
@@ -28,10 +28,57 @@
console.log("Error al obtener los datos."); console.log("Error al obtener los datos.");
}); });
vm.addStudent = function (index) { vm.addStudent = function () {
$state.go('StudentCreate'); $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) { vm.retirarEstudianteModal = function (index) {
$rootScope.index = index; $rootScope.index = index;
$rootScope.botonOk = true; $rootScope.botonOk = true;
@@ -39,7 +86,6 @@
$rootScope.botonCancelar = true; $rootScope.botonCancelar = true;
$rootScope.eliminarLoading = false; $rootScope.eliminarLoading = false;
$rootScope.mensaje = "¿Desea retirar al estudiante "+ vm.students[index].lastname +", "+ vm.students[index].name + "?"; $rootScope.mensaje = "¿Desea retirar al estudiante "+ vm.students[index].lastname +", "+ vm.students[index].name + "?";
$scope.modalInstance = $modal.open({ $scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled, animation: $rootScope.animationsEnabled,
templateUrl: 'partials/section/modal/update_section_modal.html', 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.ok = function () {
$scope.modalInstance.dismiss('cancel'); $scope.modalInstance.dismiss('cancel');
}; };
@@ -88,8 +128,6 @@
vm.back = function () { vm.back = function () {
$state.go('SectionList'); $state.go('SectionList');
}; };
return vm;
}; };
})(); })();

View File

@@ -10,26 +10,37 @@
<table class="table table-bordered table-striped"> <table class="table table-bordered table-striped">
<thead> <thead>
<tr> <tr>
<th width="10%"> <th width="10%" style="text-align: center">
Cedula Cedula
<span ng-show="sortType == 'id' && !sortReverse" class="fa fa-caret-down"></span> <span ng-show="sortType == 'id' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'id' && sortReverse" class="fa fa-caret-up"></span> <span ng-show="sortType == 'id' && sortReverse" class="fa fa-caret-up"></span>
</th> </th>
<th width="20%"> <th width="20%" style="text-align: center">
Nombre Nombre
<span ng-show="sortType == 'name' && !sortReverse" class="fa fa-caret-down"></span> <span ng-show="sortType == 'name' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'name' && sortReverse" class="fa fa-caret-up"></span> <span ng-show="sortType == 'name' && sortReverse" class="fa fa-caret-up"></span>
</th> </th>
<th width="20%"> <th width="20%" style="text-align: center">
Apellido Apellido
<span ng-show="sortType == 'lastname' && !sortReverse" class="fa fa-caret-down"></span> <span ng-show="sortType == 'lastname' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'lastname' && sortReverse" class="fa fa-caret-up"></span> <span ng-show="sortType == 'lastname' && sortReverse" class="fa fa-caret-up"></span>
</th> </th>
<th width="30%"> <th width="20%" style="text-align: center">
Correo Correo
<span ng-show="sortType == 'email' && !sortReverse" class="fa fa-caret-down"></span> <span ng-show="sortType == 'email' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'email' && sortReverse" class="fa fa-caret-up"></span> <span ng-show="sortType == 'email' && sortReverse" class="fa fa-caret-up"></span>
</th> </th>
<th width="10%" style="text-align: center">
Actualizar Correo
</th>
<th width="10%" style="text-align: center">
Dirección BT
<span ng-show="sortType == 'email' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'email' && sortReverse" class="fa fa-caret-up"></span>
</th>
<th width="10%" style="text-align: center">
Liberar Dirección BT
</th>
<th width="10%" style="text-align: center"> <th width="10%" style="text-align: center">
Retirar Retirar
</th> </th>
@@ -42,8 +53,21 @@
<td style="vertical-align:middle">{{ student.lastname }}</td> <td style="vertical-align:middle">{{ student.lastname }}</td>
<td style="vertical-align:middle">{{ student.email }}</td> <td style="vertical-align:middle">{{ student.email }}</td>
<td style="text-align: center"> <td style="text-align: center">
<span title="Click aqui para Eliminar un Estudiante" <span class="glyphicon glyphicon-envelope"
class="glyphicon glyphicon-remove" aria-hidden="true" aria-hidden="true"
ng-click="vm.mailUpdate($index)"
style="cursor:pointer;"></span>
</td>
<td style="vertical-align:middle">{{ student.btaddress }}</td>
<td style="text-align: center">
<span class="glyphicon glyphicon-signal"
aria-hidden="true"
ng-click="vm.freeBTAddressModal($index)"
style="cursor:pointer;"></span>
</td>
<td style="text-align: center">
<span class="glyphicon glyphicon-remove"
aria-hidden="true"
ng-click="vm.retirarEstudianteModal($index)" ng-click="vm.retirarEstudianteModal($index)"
style="cursor:pointer;"></span> style="cursor:pointer;"></span>
</td> </td>

View File

@@ -15,7 +15,7 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<div class="container-fluid"> <div class="container-fluid">
</br> </br>
<a href="#login" class="btn-danger btn" style=" margin: 10px">Salir</a> <a href="#login" class="btn-danger btn" style=" margin: 10px"><span class="glyphicon glyphicon-log-out" aria-hidden="true"></span> Salir</a>
</div> </div>
</ul> </ul>
</div> </div>

View File

@@ -18,11 +18,11 @@
subItems: [ subItems: [
{ {
state: 'ProfessorList', state: 'ProfessorList',
text: 'Listar Profesores' text: 'Listado de Profesores'
}, },
{ {
state: 'ProfessorCreate', state: 'ProfessorCreate',
text: 'Agregar Profesores' text: 'Nuevo Profesor'
} }
] ]
}, },
@@ -31,11 +31,11 @@
subItems: [ subItems: [
{ {
state: 'CourseList', state: 'CourseList',
text: 'Listar Materias' text: 'Listado de Materias'
}, },
{ {
state: 'CourseCreate', state: 'CourseCreate',
text: 'Agregar Materia' text: 'Nueva Materia'
} }
] ]
}, },
@@ -44,7 +44,7 @@
subItems: [ subItems: [
{ {
state: 'courseReport', state: 'courseReport',
text: 'Reportes' text: 'Reportes por Materia'
} }
] ]
} }

View File

@@ -1,12 +1,12 @@
<div class="modal-header"> <div class="modal-header">
<h3 class="modal-title">Modificar Estudiante</h3> <h3 class="modal-title">Actualizar Estudiante</h3>
</div> </div>
<div style="text-align: center" class="modal-body"> <div style="text-align: center" class="modal-body">
{{ mensaje }} {{ mensaje }}
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button class="btn btn-primary" ng-show="botonOk" type="button" <button class="btn btn-primary" ng-show="botonOk" type="button"
ng-click="ok(urlLo)">Aceptar</button> ng-click="ok()">Aceptar</button>
<button class="btn btn-warning" ng-show="botonCancelar" type="button" <button class="btn btn-warning" ng-show="botonCancelar" type="button"
ng-click="cancel()">Cancelar</button> ng-click="cancel()">Cancelar</button>
</div> </div>

View File

@@ -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'
}
}
})
}; };
})(); })();

View File

@@ -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');
};
};
})();

View File

@@ -0,0 +1,54 @@
<div>
<form name="vm.data_input_form" role="form" novalidate
ng-submit="vm.submit()">
<div class="row clearfix">
<h4>Correo Electronico del Alumno {{vm.student.lastname}}, {{vm.student.name}}</h4>
<div class="row clearfix">
<div class="col-md-12 column">
<br><br>
</div>
</div>
<div class="row">
<div class="col-md-4 column">
<label for="correo">Dirección de Correo Actual</label>
<input class="form-control"
ng-model="vm.student.email"
readonly="readonly"/>
</div>
</div>
<div class="row">
<div class="col-md-4 column">
<label for="correo">Nueva Dirección de Correo</label>
<input type="correo" class="form-control"
name="correo" ng-model="vm.newMail"
ng-pattern="/^[a-z]+[a-z0-9._]+@[a-z]+\.[a-z.]{2,5}$/" placeholder="me@example.com" required/>
<div class="error" ng-show="vm.submitted &&
vm.data_input_form.correo.$invalid">
<small class="error"
ng-show="vm.data_input_form.correo.$error.required">
El Correo del Alumno es obligatorio.
</small>
<small class="error"
ng-show="vm.data_input_form.correo.$error.pattern">
El formato del Correo del Alumno es incorrecto.
</small>
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-md-2 column">
<div class="form-group">
<label>&nbsp;</label>
<p class="input-group">
<span class="input-group-btn">
<button type="submit" class="btn-success btn">
Actualizar Dirección de Correo</button>
<button type="button" class="btn-warning btn" style="margin: 10px" ng-click="vm.back()">Regresar</button>
</span>
</p>
</div>
</div>
</div>
</form>
</div>

View File

@@ -1,69 +0,0 @@
<div class="row clearfix">
<div class="col-md-12 column">
</div>
</div>
<form name="vm.data_input_form" role="form" novalidate ng-submit="vm.submit()">
<div class="row clearfix">
<h4>Modificar Estudiante</h4>
<br>
<div class="col-md-12 column well">
<div class="row">
<div class="col-md-4 column">
<label for="cedula">Cedula</label>
<input type="nmumeric" class="form-control"
name="cedula" readonly="readonly"
ng-model="vm.estudiante.Cedula" />
</div>
<div class="col-md-4 column">
<label for="nombre">Nombre</label>
<input type="text" class="form-control"
name="nombre" readonly="readonly"
ng-model="vm.estudiante.Nombre" />
</div>
<div class="col-md-4 column">
<label for="apellido">Apellido</label>
<input type="text" class="form-control"
name="apellido" readonly="readonly"
ng-model="vm.estudiante.Apellido" />
</div>
</div>
<div class="row clearfix"><div class="col-md-12 column"><br><br>
</div></div>
<div class="row">
<div class="col-md-4 column">
<label for="email">Direccion de Correo Electronico</label>
<input type="email" class="form-control"
name="email" ng-model="vm.estudiante.Correo"
ng-pattern="/^[a-z]+[a-z0-9._]+@[a-z]+\.[a-z.]{2,5}$/" placeholder="me@example.com"/>
<small class="error"
ng-show="vm.data_input_form.correo.$error.pattern">
El formato del Correo del Alumno es incorrecto.
</small>
</div>
<div class="col-md-4 column">
<label for="telefono">Numero de Telefono</label>
<input type="phone" class="form-control"
name="telefono" ng-model="vm.estudiante.Telefono"
ng-pattern="/\d{4}-\d{3}-\d{4}/" maxlength="13"
placeholder="0212-574-1234"/>
<small class="error"
ng-show="vm.data_input_form.telefono.$error.pattern">
El formato del Teléfono debe ser: 0212-789-5551.
</small>
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-md-2 column">
<div class="form-group">
<label>&nbsp;</label>
<p class="input-group">
<span class="input-group-btn">
<button type="submit" class="btn-primary btn">Modificar Estudiante</button>
</span>
</p>
</div>
</div>
</div>
</form>

View File

@@ -2,7 +2,7 @@
"name": "M.A.S.A App", "name": "M.A.S.A App",
"description": "M.A.S.A Project", "description": "M.A.S.A Project",
"version": "1.0.0", "version": "1.0.0",
"homepage": "https://github.com/angular/angular-seed", "homepage": "https://bitbucket.org/rey_reyes/masa",
"license": "MIT", "license": "MIT",
"private": true, "private": true,
"dependencies": { "dependencies": {