Update repo with several changes
This commit is contained in:
@@ -89,6 +89,7 @@
|
||||
|
||||
<script src="partials/students/student.module.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>
|
||||
|
||||
<!-- Angular ui.bootstrap's Javascript instead of Bootstrap Javascript -->
|
||||
|
@@ -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);
|
||||
};
|
||||
})();
|
||||
|
@@ -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');
|
||||
};
|
||||
};
|
||||
})();
|
@@ -62,7 +62,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row clearfix"><div class="col-md-12 column"><br><br></div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row clearfix">
|
||||
@@ -71,8 +70,8 @@
|
||||
<label> </label>
|
||||
<p class="input-group">
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" class="btn-primary btn">
|
||||
Crear Materia</button>
|
||||
<button type="submit" class="btn-success btn">Crear Materia</button>
|
||||
<button type="button" class="btn-warning btn" style="margin: 10px" ng-click="vm.back()">Regresar</button>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
|
@@ -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;
|
||||
});
|
||||
};
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<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>
|
||||
<div>
|
||||
|
@@ -6,11 +6,11 @@
|
||||
<div class="col-md-4 column">
|
||||
</div>
|
||||
<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/>
|
||||
<div class="error" ng-show="vm.submitted && vm.data_input_form.nickname.$invalid">
|
||||
<small class="error" ng-show="vm.data_input_form.nickname.$error.required">
|
||||
{{'TAG_NICK_NAME_ERROR'}}
|
||||
La Cédula del profesor es Obligatoria.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
@@ -25,7 +25,7 @@
|
||||
<div ng-show=false> {{ vm.password = vm.user.Password }}</div>
|
||||
<div class="error" ng-show="vm.submitted && vm.data_input_form.password.$invalid">
|
||||
<small class="error" ng-show="vm.data_input_form.password.$error.required">
|
||||
{{'TAG_PASSWORD_ERROR'}}
|
||||
La Contraseña es Obligatoria.
|
||||
</small>
|
||||
</div>
|
||||
<div ng-show=false>{{getHash(vm.password)}}</div>
|
||||
@@ -40,7 +40,13 @@
|
||||
<label> </label>
|
||||
<p class="input-group">
|
||||
<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>
|
||||
</p>
|
||||
|
||||
|
@@ -7,7 +7,8 @@
|
||||
.value('selectedCourse',{})
|
||||
.value('selectedSection',{})
|
||||
.value('selectedStudent',{})
|
||||
.value('profesorSeleccionado',{});
|
||||
.value('profesorSeleccionado',{})
|
||||
.value('data',{});
|
||||
|
||||
professors.$inject = ['$resource','$rootScope'];
|
||||
function professors($resource, $rootScope){
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<div class="row clearfix">
|
||||
<h4>Reportes de Materias</h4>
|
||||
<h4>Reportes por Materia</h4>
|
||||
<br>
|
||||
</br>
|
||||
<div>
|
||||
@@ -15,11 +15,11 @@
|
||||
<th width="5%" style="text-align: center">
|
||||
Creditos
|
||||
</th>
|
||||
<th width="40%" style="text-align: center">
|
||||
<th width="35%" style="text-align: center">
|
||||
Descripción
|
||||
</th>
|
||||
<th width="15%" style="text-align: center">
|
||||
Reportes de Materia
|
||||
<th width="20%" style="text-align: center">
|
||||
Estadisticas de la Materia
|
||||
</th>
|
||||
<th width="10%" style="text-align: center">
|
||||
Secciones
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<div class="row clearfix">
|
||||
<h4>Reportes de Secciones</h4>
|
||||
<h4>Reportes por Sección en {{vm.course}}</h4>
|
||||
<br>
|
||||
<button class = "btn-warning btn"
|
||||
type = "button"
|
||||
@@ -25,7 +25,7 @@
|
||||
Semestre
|
||||
</th>
|
||||
<th width="20%" style="text-align: center">
|
||||
Reportes por Sección
|
||||
Estadisticas de la Sección
|
||||
</th>
|
||||
<th width="10%" style="text-align: center">
|
||||
Estudiantes
|
||||
|
@@ -16,6 +16,7 @@
|
||||
professors.get({ id: professorid },
|
||||
function (successResult){
|
||||
vm.professor = successResult;
|
||||
vm.course = vm.professor.courses[selectedCourse.index].name;
|
||||
angular.forEach (vm.professor.courses[selectedCourse.index].sections,
|
||||
function (value, key){
|
||||
if (value._id == selectedSection._id ) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<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>
|
||||
<button class = "btn-warning btn"
|
||||
type = "button"
|
||||
@@ -13,7 +13,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%" style="text-align: center">
|
||||
Cedula
|
||||
Cédula
|
||||
</th>
|
||||
<th width="20%" style="text-align: center">
|
||||
Nombre
|
||||
@@ -22,7 +22,7 @@
|
||||
Apellido
|
||||
</th>
|
||||
<th width="20%" style="text-align: center">
|
||||
Reportes por Estudiante
|
||||
Estadisticas del Estudiante
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
14
app/partials/section/modal/student_bt_removal_modal.html
Normal file
14
app/partials/section/modal/student_bt_removal_modal.html
Normal 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>
|
@@ -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,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<div class="row clearfix">
|
||||
<h4>Listado de Secciones</h4></br>
|
||||
<h4>Listado de Secciones en {{vm.course}} </h4></br>
|
||||
<div>
|
||||
<span class="input-group-btn">
|
||||
<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>
|
||||
</th>
|
||||
<th width="10%" style="text-align: center">
|
||||
Modificar
|
||||
Matricula
|
||||
</th>
|
||||
<th width="10%" style="text-align: center">
|
||||
Borrar
|
||||
Eliminar
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@@ -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;
|
||||
};
|
||||
|
||||
})();
|
@@ -10,26 +10,37 @@
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="10%">
|
||||
<th width="10%" style="text-align: center">
|
||||
Cedula
|
||||
<span ng-show="sortType == 'id' && !sortReverse" class="fa fa-caret-down"></span>
|
||||
<span ng-show="sortType == 'id' && sortReverse" class="fa fa-caret-up"></span>
|
||||
</th>
|
||||
<th width="20%">
|
||||
<th width="20%" style="text-align: center">
|
||||
Nombre
|
||||
<span ng-show="sortType == 'name' && !sortReverse" class="fa fa-caret-down"></span>
|
||||
<span ng-show="sortType == 'name' && sortReverse" class="fa fa-caret-up"></span>
|
||||
</th>
|
||||
<th width="20%">
|
||||
<th width="20%" style="text-align: center">
|
||||
Apellido
|
||||
<span ng-show="sortType == 'lastname' && !sortReverse" class="fa fa-caret-down"></span>
|
||||
<span ng-show="sortType == 'lastname' && sortReverse" class="fa fa-caret-up"></span>
|
||||
</th>
|
||||
<th width="30%">
|
||||
<th width="20%" style="text-align: center">
|
||||
Correo
|
||||
<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">
|
||||
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">
|
||||
Retirar
|
||||
</th>
|
||||
@@ -42,8 +53,21 @@
|
||||
<td style="vertical-align:middle">{{ student.lastname }}</td>
|
||||
<td style="vertical-align:middle">{{ student.email }}</td>
|
||||
<td style="text-align: center">
|
||||
<span title="Click aqui para Eliminar un Estudiante"
|
||||
class="glyphicon glyphicon-remove" aria-hidden="true"
|
||||
<span class="glyphicon glyphicon-envelope"
|
||||
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)"
|
||||
style="cursor:pointer;"></span>
|
||||
</td>
|
||||
|
@@ -15,7 +15,7 @@
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<div class="container-fluid">
|
||||
</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>
|
||||
</ul>
|
||||
</div>
|
||||
|
@@ -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,7 +44,7 @@
|
||||
subItems: [
|
||||
{
|
||||
state: 'courseReport',
|
||||
text: 'Reportes'
|
||||
text: 'Reportes por Materia'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -1,12 +1,12 @@
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">Modificar Estudiante</h3>
|
||||
<h3 class="modal-title">Actualizar Estudiante</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="ok(urlLo)">Aceptar</button>
|
||||
ng-click="ok()">Aceptar</button>
|
||||
<button class="btn btn-warning" ng-show="botonCancelar" type="button"
|
||||
ng-click="cancel()">Cancelar</button>
|
||||
</div>
|
@@ -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'
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
})();
|
||||
|
82
app/partials/students/student_update.controller.js
Normal file
82
app/partials/students/student_update.controller.js
Normal 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');
|
||||
};
|
||||
};
|
||||
})();
|
54
app/partials/students/student_update.html
Normal file
54
app/partials/students/student_update.html
Normal 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> </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>
|
@@ -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> </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>
|
@@ -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": {
|
||||
|
Reference in New Issue
Block a user