Update routes, mongoose schema and web flow
This commit is contained in:
@@ -2,14 +2,14 @@
|
|||||||
'user strict';
|
'user strict';
|
||||||
|
|
||||||
angular.module('app', [
|
angular.module('app', [
|
||||||
'app.course',
|
'app.course',
|
||||||
'app.login',
|
'app.login',
|
||||||
'app.professor',
|
'app.professor',
|
||||||
'app.reports',
|
'app.reports',
|
||||||
'app.section',
|
'app.section',
|
||||||
'app.student',
|
'app.student',
|
||||||
'ngResource',
|
'ngResource',
|
||||||
'ui.router'
|
'ui.router'
|
||||||
])
|
])
|
||||||
|
|
||||||
.config(function($stateProvider, $urlRouterProvider) {
|
.config(function($stateProvider, $urlRouterProvider) {
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
url: '/login',
|
url: '/login',
|
||||||
views: {
|
views: {
|
||||||
content: {
|
content: {
|
||||||
templateUrl: 'login.html',
|
templateUrl: 'partials/login/login.html',
|
||||||
controller: 'loginCtrl',
|
controller: 'loginCtrl',
|
||||||
controllerAs: 'vm'
|
controllerAs: 'vm'
|
||||||
}
|
}
|
||||||
@@ -33,5 +33,4 @@
|
|||||||
$rootScope.domainUrl = 'Localhost:3000';
|
$rootScope.domainUrl = 'Localhost:3000';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Thirdpary JavaScript and modules. -->
|
<!-- Thirdparty JavaScript and modules. -->
|
||||||
<!-- ================================================== -->
|
<!-- ================================================== -->
|
||||||
<script src="bower_components/angular/angular.js"></script>
|
<script src="bower_components/angular/angular.js"></script>
|
||||||
<script src="bower_components/angular-route/angular-route.js"></script>
|
<script src="bower_components/angular-route/angular-route.js"></script>
|
||||||
@@ -62,33 +62,33 @@
|
|||||||
|
|
||||||
<!-- Application Javascript -->
|
<!-- Application Javascript -->
|
||||||
<!-- ====================================================-->
|
<!-- ====================================================-->
|
||||||
<script src="js/app.js"></script>
|
<script src="app.js"></script>
|
||||||
|
|
||||||
<script src="js/course/course.module.js"></script>
|
<script src="partials/course/course.module.js"></script>
|
||||||
<script src="js/course/course.controllers.js"></script>
|
<script src="partials/course/course.controllers.js"></script>
|
||||||
<script src="js/course/course.services.js"></script>
|
<script src="partials/course/course.services.js"></script>
|
||||||
|
|
||||||
<script src="js/login/login.module.js"></script>
|
<script src="partials/login/login.module.js"></script>
|
||||||
<script src="js/login/login.controllers.js"></script>
|
<script src="partials/login/login.controllers.js"></script>
|
||||||
<script src="js/login/login.services.js"></script>
|
<script src="partials/login/login.services.js"></script>
|
||||||
|
|
||||||
<script src="js/professor/professor.module.js"></script>
|
<script src="partials/professor/professor.module.js"></script>
|
||||||
<script src="js/professor/professor.controllers.js"></script>
|
<script src="partials/professor/professor.controllers.js"></script>
|
||||||
<script src="js/professor/professor.services.js"></script>
|
<script src="partials/professor/professor.services.js"></script>
|
||||||
|
|
||||||
<script src="js/report/report.module.js"></script>
|
<script src="partials/report/report.module.js"></script>
|
||||||
<script src="js/report/report.controllers.js"></script>
|
<script src="partials/report/report.controllers.js"></script>
|
||||||
<script src="js/report/report.services.js"></script>
|
<script src="partials/report/report.services.js"></script>
|
||||||
|
|
||||||
<script src="js/section/section.module.js"></script>
|
<script src="partials/section/section.module.js"></script>
|
||||||
<script src="js/section/section.controllers.js"></script>
|
<script src="partials/section/section.controllers.js"></script>
|
||||||
<script src="js/section/section.services.js"></script>
|
<script src="partials/section/section.services.js"></script>
|
||||||
|
|
||||||
<script src="js/sidebar/sidebar.controllers.js"></script>
|
<script src="partials/sidebar/sidebar.controllers.js"></script>
|
||||||
|
|
||||||
<script src="js/student/student.module.js"></script>
|
<script src="partials/students/student.module.js"></script>
|
||||||
<script src="js/student/student.controllers.js"></script>
|
<script src="partials/students/student.controllers.js"></script>
|
||||||
<script src="js/student/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 -->
|
||||||
<!-- ==================================================== -->
|
<!-- ==================================================== -->
|
||||||
|
|||||||
@@ -1,175 +0,0 @@
|
|||||||
(function(){
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
angular
|
|
||||||
.module('app.login')
|
|
||||||
.controller('loginCtrl', loginCtrl)
|
|
||||||
.controller('ModalInstanceLoginCtrl', ModalInstanceLoginCtrl)
|
|
||||||
.constant('datepickerPopupConfig', {
|
|
||||||
datepickerPopup: 'yyyy-MM-dd',
|
|
||||||
html5Types: {
|
|
||||||
date: 'yyyy-MM-dd',
|
|
||||||
'datetime-local': 'yyyy-MM-ddTHH:mm:ss.sss',
|
|
||||||
'month': 'yyyy-MM'
|
|
||||||
},
|
|
||||||
currentText: 'Hoy',
|
|
||||||
clearText: 'Limpiar',
|
|
||||||
closeText: 'Cerrar',
|
|
||||||
closeOnDateSelection: true,
|
|
||||||
appendToBody: false,
|
|
||||||
showButtonBar: true
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
ModalInstanceLoginCtrl.$inject = ['$scope', '$modalInstance', 'items', '$location'];
|
|
||||||
function ModalInstanceLoginCtrl($scope, $modalInstance, items, $location){
|
|
||||||
|
|
||||||
$scope.items = items;
|
|
||||||
|
|
||||||
$scope.okLogin = function (actOk, urlLo) {
|
|
||||||
//$modalInstance.close($scope.selected.item);
|
|
||||||
if(actOk){
|
|
||||||
$location.url(urlLo);
|
|
||||||
$modalInstance.dismiss('cancel');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.cancel = function () {
|
|
||||||
$modalInstance.dismiss('cancel');
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
loginCtrl.$inject = ['$rootScope', '$location', 'Login', 'Rol','GetRol', 'hash', '$http', 'user', '$modal'];
|
|
||||||
function loginCtrl($rootScope, $location, Login, Rol, GetRol, hash, $http, user, $modal){
|
|
||||||
var vm = this;
|
|
||||||
|
|
||||||
|
|
||||||
//$http.get("http://cesar:12316/api/Rol")
|
|
||||||
//.success(function(response) {$rootScope.namesw = response.Data;});
|
|
||||||
|
|
||||||
vm.user = user;
|
|
||||||
vm.submitted = false;
|
|
||||||
vm.mayorque = false;
|
|
||||||
$rootScope.items = "";
|
|
||||||
$rootScope.mensaje = "";
|
|
||||||
vm.submit = function() {
|
|
||||||
//var verificar = false;
|
|
||||||
if (vm.data_input_form.$valid){
|
|
||||||
// se implementa todo lo necesario antes de pasar a la siguiente página.
|
|
||||||
vm.pkg = {
|
|
||||||
|
|
||||||
"Nickname": vm.user.Nickname,
|
|
||||||
"Password": $rootScope.password
|
|
||||||
|
|
||||||
};
|
|
||||||
//$rootScope.mostrar = false;
|
|
||||||
$rootScope.loadingLogin = true;
|
|
||||||
$rootScope.mensaje = "";
|
|
||||||
$rootScope.bcancel = false;
|
|
||||||
$modal.open({
|
|
||||||
animation: $rootScope.animationsEnabled,
|
|
||||||
templateUrl: 'myModalContentLogin.html',
|
|
||||||
controller: 'ModalInstanceLoginCtrl',
|
|
||||||
size: 'sm',
|
|
||||||
resolve: {
|
|
||||||
items: function () {
|
|
||||||
return $rootScope.items;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Login.save(vm.pkg,
|
|
||||||
function(data){
|
|
||||||
//$rootScope.mostrar = true;
|
|
||||||
$rootScope.loadingLogin = false;
|
|
||||||
//verificar = data.Data._value;
|
|
||||||
if(data.Data._value != null){
|
|
||||||
//$rootScope.bok = true;
|
|
||||||
$rootScope.actOk = true;
|
|
||||||
$rootScope.urlLo = 'mapasReportes';
|
|
||||||
$rootScope.bcancel = false;
|
|
||||||
|
|
||||||
}else{
|
|
||||||
$rootScope.bcancel = true;
|
|
||||||
$rootScope.mensaje = data.Data._error;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
function(data){
|
|
||||||
verificar = data.Data;
|
|
||||||
if(verificar){
|
|
||||||
alert("no existe el usuario");
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
GetRol.get({id:vm.user.Nickname}, function(data){
|
|
||||||
$rootScope.role = data.Data;
|
|
||||||
}
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
//$location.url('/preview/');
|
|
||||||
}else{
|
|
||||||
|
|
||||||
vm.submitted = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vm.onSelectChange = function () {
|
|
||||||
if(vm.genero == "Masculino"){
|
|
||||||
$rootScope.Gender = "M";
|
|
||||||
//alert("hola " + vm.valorRol.Name);
|
|
||||||
}
|
|
||||||
if(vm.genero == "Femenino"){
|
|
||||||
$rootScope.Gender = "F";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//$rootScope.password="s3cret";
|
|
||||||
$rootScope.getHash = function(message) {
|
|
||||||
var hashResult = hash(message);
|
|
||||||
$rootScope.password = hashResult;
|
|
||||||
return hashResult;
|
|
||||||
};
|
|
||||||
|
|
||||||
vm.generos = ['', 'Masculino', 'Femenino'];
|
|
||||||
vm.genero = vm.generos[0];
|
|
||||||
|
|
||||||
Rol.get(
|
|
||||||
function(data){
|
|
||||||
$rootScope.rol = data.Data;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
vm.toggleMin = function() {
|
|
||||||
vm.maxDate = vm.maxDate ? null : new Date();
|
|
||||||
};
|
|
||||||
vm.toggleMin();
|
|
||||||
|
|
||||||
$rootScope.open = function($event) {
|
|
||||||
$event.preventDefault();
|
|
||||||
$event.stopPropagation();
|
|
||||||
|
|
||||||
$rootScope.opened = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
$rootScope.open2 = function($eventt) {
|
|
||||||
$eventt.preventDefault();
|
|
||||||
$eventt.stopPropagation();
|
|
||||||
|
|
||||||
$rootScope.openedd = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
$rootScope.dateOptions = {
|
|
||||||
formatYear: 'yy',
|
|
||||||
startingDay: 1
|
|
||||||
};
|
|
||||||
|
|
||||||
return vm;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
(function(){
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
angular
|
|
||||||
.module('app')
|
|
||||||
.controller('sidebarCtrl', ['$scope',
|
|
||||||
function($scope) {
|
|
||||||
|
|
||||||
var that = this;
|
|
||||||
$scope.showChilds = function(item){
|
|
||||||
item.active = !item.active;};
|
|
||||||
|
|
||||||
$scope.items = [
|
|
||||||
{
|
|
||||||
|
|
||||||
text: 'Modulo de Administración',
|
|
||||||
subItems: [
|
|
||||||
{
|
|
||||||
state: 'listarProfesor',
|
|
||||||
text: 'Listar Profesores'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
state: 'crearProfesor',
|
|
||||||
text: 'Agregar Profesores'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
|
|
||||||
text: 'Modulo de Materias',
|
|
||||||
subItems: [
|
|
||||||
{
|
|
||||||
state: 'listarMateria',
|
|
||||||
text: 'Listar Materias'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
state: 'crearMateria',
|
|
||||||
text: 'Agregar Materia'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
|
|
||||||
text: 'Modulo de Estudiantes',
|
|
||||||
subItems: [
|
|
||||||
{
|
|
||||||
state: 'listarEstudiante',
|
|
||||||
text: 'Listar Estudiantes'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
state: 'crearEstudiante',
|
|
||||||
text: 'Agregar Estudiantes'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
|
|
||||||
text: 'Modulo de Matriculas',
|
|
||||||
subItems: [
|
|
||||||
{
|
|
||||||
state: 'listarMatricula',
|
|
||||||
text: 'Listar Matricula'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
state: 'crearMatricula',
|
|
||||||
text: 'Crear Matricula'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
|
|
||||||
text: 'Modulo de Reportes',
|
|
||||||
subItems: [
|
|
||||||
{
|
|
||||||
state: 'reportesAlumno',
|
|
||||||
text: 'Reportes por Alumno'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
state: 'reportesClase',
|
|
||||||
text: 'Reportes por Clase'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
state: 'reportesSeccion',
|
|
||||||
text: 'Reportes por Seccion'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
state: 'reportesMateria',
|
|
||||||
text: 'Reportes por Materia'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
}])
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -7,21 +7,25 @@
|
|||||||
.controller('crearMateriaCtrl', crearMateriaCtrl)
|
.controller('crearMateriaCtrl', crearMateriaCtrl)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
listarMateriaCtrl.$inject =
|
listarMateriaCtrl.$inject =
|
||||||
['$scope', '$rootScope', '$location', 'courses', '$modal'];
|
['$scope', '$rootScope', '$location', 'professors', '$modal', 'profesorSeleccionado', 'selectedCourse'];
|
||||||
function listarMateriaCtrl($scope, $rootScope, $location, courses, $modal) {
|
function listarMateriaCtrl($scope, $rootScope, $location, professors, $modal, profesorSeleccionado, selectedCourse) {
|
||||||
var vm = this;
|
var vm = this;
|
||||||
var array = [];
|
var professorid = '56f5fd3a20047f3c15b05f0e';
|
||||||
|
|
||||||
courses.query(
|
professors.get({ id: professorid },
|
||||||
function (successResult){
|
function (successResult){
|
||||||
vm.course = successResult;
|
vm.professor = successResult;
|
||||||
|
vm.course = vm.professor.courses;
|
||||||
},
|
},
|
||||||
function (){
|
function (){
|
||||||
console.log("Error al obtener los datos.");
|
console.log("Error al obtener los datos.");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
vm.listarSecciones = function (index) {
|
||||||
|
selectedCourse._id = vm.course[index]._id;
|
||||||
|
$location.url('listarMatricula');
|
||||||
|
};
|
||||||
|
|
||||||
vm.eliminarMateriaModal = function (index) {
|
vm.eliminarMateriaModal = function (index) {
|
||||||
$rootScope.index = index;
|
$rootScope.index = index;
|
||||||
@@ -51,10 +55,10 @@
|
|||||||
$rootScope.botonCancelar = false;
|
$rootScope.botonCancelar = false;
|
||||||
$rootScope.urlLo = 'listarMateria';
|
$rootScope.urlLo = 'listarMateria';
|
||||||
var name = vm.course[index].name;
|
var name = vm.course[index].name;
|
||||||
|
vm.professor.courses.splice(index, 1);
|
||||||
|
|
||||||
courses.delete({ id: vm.course[index]._id },
|
professors.update({ id: professorid }, vm.professor,
|
||||||
function () {
|
function () {
|
||||||
$rootScope.rsplice = true;
|
|
||||||
$rootScope.mensaje = "Materia " + name + " eliminada";
|
$rootScope.mensaje = "Materia " + name + " eliminada";
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
@@ -62,16 +66,9 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
vm.eliminarMateriaSplice = function(index, rsplice) {
|
/*vm.modificarMateria = function (index) {
|
||||||
if(rsplice){
|
|
||||||
vm.course.splice(index, 1);
|
|
||||||
$rootScope.rsplice = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
vm.modificarMateria = function (index) {
|
|
||||||
$location.url('modificarMateria');
|
$location.url('modificarMateria');
|
||||||
};
|
};*/
|
||||||
|
|
||||||
$scope.ok = function (urlLo) {
|
$scope.ok = function (urlLo) {
|
||||||
$location.url(urlLo);
|
$location.url(urlLo);
|
||||||
@@ -92,13 +89,22 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
crearMateriaCtrl.$inject =
|
crearMateriaCtrl.$inject =
|
||||||
['$scope','$rootScope', '$modal', '$location', 'courses'];
|
['$scope','$rootScope', '$modal', '$location', 'professors'];
|
||||||
function crearMateriaCtrl($scope, $rootScope, $modal, $location, courses) {
|
function crearMateriaCtrl($scope, $rootScope, $modal, $location, professors) {
|
||||||
|
|
||||||
var vm = this;
|
var vm = this;
|
||||||
vm.submitted = false;
|
vm.submitted = false;
|
||||||
vm.mayorque = false;
|
vm.mayorque = false;
|
||||||
$rootScope.mensaje = "";
|
$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() {
|
vm.submit = function() {
|
||||||
|
|
||||||
@@ -123,7 +129,8 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
courses.save(vm.course,
|
vm.professor.courses.push(vm.course);
|
||||||
|
professors.update({ id: professorid }, vm.professor,
|
||||||
function(){
|
function(){
|
||||||
$rootScope.botonOk = true;
|
$rootScope.botonOk = true;
|
||||||
$rootScope.urlLo = 'listarMateria';
|
$rootScope.urlLo = 'listarMateria';
|
||||||
@@ -21,11 +21,11 @@
|
|||||||
url: '/listarMateria',
|
url: '/listarMateria',
|
||||||
views: {
|
views: {
|
||||||
sidebar: {
|
sidebar: {
|
||||||
templateUrl: 'partials/sidebar.html',
|
templateUrl: 'partials/sidebar/sidebar.html',
|
||||||
controller: 'sidebarCtrl'
|
controller: 'sidebarCtrl'
|
||||||
},
|
},
|
||||||
navbar: {
|
navbar: {
|
||||||
templateUrl: 'partials/navbar.html'
|
templateUrl: 'partials/sidebar/navbar.html'
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
templateUrl: 'partials/course/list_course.html',
|
templateUrl: 'partials/course/list_course.html',
|
||||||
@@ -39,11 +39,11 @@
|
|||||||
url: '/crearMateria',
|
url: '/crearMateria',
|
||||||
views: {
|
views: {
|
||||||
sidebar: {
|
sidebar: {
|
||||||
templateUrl: 'partials/sidebar.html',
|
templateUrl: 'partials/sidebar/sidebar.html',
|
||||||
controller: 'sidebarCtrl'
|
controller: 'sidebarCtrl'
|
||||||
},
|
},
|
||||||
navbar: {
|
navbar: {
|
||||||
templateUrl: 'partials/navbar.html'
|
templateUrl: 'partials/sidebar/navbar.html'
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
templateUrl: 'partials/course/create_course.html',
|
templateUrl: 'partials/course/create_course.html',
|
||||||
@@ -7,52 +7,52 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="10%">
|
<th width="10%">
|
||||||
<a href="" ng-click="sortType = 'code';
|
Código
|
||||||
sortReverse = !sortReverse">
|
<span ng-show="sortType == 'code' &&
|
||||||
Código
|
!sortReverse" class="fa fa-caret-down"></span>
|
||||||
<span ng-show="sortType == 'code' &&
|
<span ng-show="sortType == 'code' &&
|
||||||
!sortReverse" class="fa fa-caret-down"></span>
|
sortReverse" class="fa fa-caret-up"></span>
|
||||||
<span ng-show="sortType == 'code' &&
|
|
||||||
sortReverse" class="fa fa-caret-up"></span>
|
|
||||||
</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th width="20%">
|
<th width="20%">
|
||||||
<a href="" ng-click="sortType = 'name';
|
Nombre
|
||||||
sortReverse = !sortReverse">
|
<span ng-show="sortType == 'name' &&
|
||||||
Nombre
|
!sortReverse" class="fa fa-caret-down"></span>
|
||||||
<span ng-show="sortType == 'name' &&
|
<span ng-show="sortType == 'name' &&
|
||||||
!sortReverse" class="fa fa-caret-down"></span>
|
sortReverse" class="fa fa-caret-up"></span>
|
||||||
<span ng-show="sortType == 'name' &&
|
|
||||||
sortReverse" class="fa fa-caret-up"></span>
|
|
||||||
</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th width="10%">
|
<th width="10%">
|
||||||
<a href=""
|
Creditos
|
||||||
ng-click="sortType = 'credits';
|
<span ng-show="sortType == 'credits' &&
|
||||||
sortReverse = !sortReverse">
|
!sortReverse" class="fa fa-caret-down"></span>
|
||||||
Creditos
|
<span ng-show="sortType == 'credits' && sortReverse" class="fa fa-caret-up"></span>
|
||||||
<span ng-show="sortType == 'credits' &&
|
|
||||||
!sortReverse" class="fa fa-caret-down"></span>
|
|
||||||
<span ng-show="sortType == 'credits' && sortReverse" class="fa fa-caret-up"></span>
|
|
||||||
</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th width="50%" style="text-align: center">
|
<th width="40%" style="text-align: center">
|
||||||
<a href="">
|
|
||||||
Descripción
|
Descripción
|
||||||
</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th width="10%" style="text-align: center">
|
<th width="10%" style="text-align: center">
|
||||||
<a>Eliminar</a>
|
Secciones
|
||||||
|
</th>
|
||||||
|
<th width="10%" style="text-align: center">
|
||||||
|
Eliminar
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="course in vm.course | orderBy:sortType:sortReverse | filter:searchUser">
|
<tr ng-repeat="course in vm.course">
|
||||||
<td style="vertical-align:middle">{{ course.code }}</td>
|
<td style="vertical-align:middle">{{ course.code }}</td>
|
||||||
<td style="vertical-align:middle">{{ course.name }}</td>
|
<td style="vertical-align:middle">{{ course.name }}</td>
|
||||||
<td style="vertical-align:middle">{{ course.credits }}</td>
|
<td style="vertical-align:middle">{{ course.credits }}</td>
|
||||||
<td style="vertical-align:middle">{{ course.description }}</td>
|
<td style="vertical-align:middle">{{ course.description }}</td>
|
||||||
|
<td style="text-align: center">
|
||||||
|
<span
|
||||||
|
title="Click aqui para ver Secciones"
|
||||||
|
class="glyphicon glyphicon-list"
|
||||||
|
aria-hidden="true"
|
||||||
|
ng-click="vm.listarSecciones($index)"
|
||||||
|
style="cursor:pointer"></span>
|
||||||
|
</td>
|
||||||
<td style="text-align: center">
|
<td style="text-align: center">
|
||||||
<span
|
<span
|
||||||
title="Click aqui para Eliminar la Materia"
|
title="Click aqui para Eliminar la Materia"
|
||||||
@@ -61,10 +61,8 @@
|
|||||||
ng-click="vm.eliminarMateriaModal($index)"
|
ng-click="vm.eliminarMateriaModal($index)"
|
||||||
style="cursor:pointer"></span>
|
style="cursor:pointer"></span>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show=false > {{ vm.eliminarMateriaSplice(index, rsplice) }}</div>
|
|
||||||
</div>
|
</div>
|
||||||
86
app/partials/login/login.controllers.js
Normal file
86
app/partials/login/login.controllers.js
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
(function(){
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.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 = "";
|
||||||
|
vm.submit = function() {
|
||||||
|
if (vm.data_input_form.$valid){
|
||||||
|
vm.pkg = {
|
||||||
|
"Nickname": vm.user.Nickname,
|
||||||
|
"Password": $rootScope.password
|
||||||
|
};
|
||||||
|
|
||||||
|
$rootScope.mensaje = "";
|
||||||
|
$rootScope.bcancel = false;
|
||||||
|
$scope.modalInstance = $modal.open({
|
||||||
|
animation: $rootScope.animationsEnabled,
|
||||||
|
templateUrl: 'LoginModal.html',
|
||||||
|
scope: $scope,
|
||||||
|
size: 'sm',
|
||||||
|
resolve: {
|
||||||
|
items: function () {
|
||||||
|
return $rootScope.items;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Login.save(vm.pkg,
|
||||||
|
function(data){
|
||||||
|
if(data.Data._value != null){
|
||||||
|
$rootScope.actOk = true;
|
||||||
|
$rootScope.urlLo = 'listarProfesor';
|
||||||
|
$rootScope.bcancel = false;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$rootScope.bcancel = true;
|
||||||
|
$rootScope.mensaje = data.Data._error;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(data){
|
||||||
|
verificar = data.Data;
|
||||||
|
if(verificar){
|
||||||
|
alert("no existe el usuario");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
GetRol.get({id:vm.user.Nickname},
|
||||||
|
function(data){
|
||||||
|
$rootScope.role = data.Data;
|
||||||
|
},
|
||||||
|
function(){
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}else{
|
||||||
|
vm.submitted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$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; */
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<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">Nombre de Usuario</label>
|
<label for="nickname">Cedula 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">
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
(function(){
|
(function(){
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular
|
angular
|
||||||
@@ -16,19 +15,16 @@
|
|||||||
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
|
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
|
||||||
function getRoutes($stateProvider, $urlRouterProvider){
|
function getRoutes($stateProvider, $urlRouterProvider){
|
||||||
$urlRouterProvider.otherwise('/');
|
$urlRouterProvider.otherwise('/');
|
||||||
|
|
||||||
$stateProvider
|
$stateProvider
|
||||||
.state('root', {
|
.state('root', {
|
||||||
url: '',
|
url: '',
|
||||||
views: {
|
views: {
|
||||||
content: {
|
content: {
|
||||||
templateUrl: 'login.html',
|
templateUrl: 'partials/login/login.html',
|
||||||
controller: 'LoginCtrl',
|
controller: 'loginCtrl',
|
||||||
controllerAs: 'vm'
|
controllerAs: 'vm'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
@@ -4,7 +4,6 @@
|
|||||||
angular
|
angular
|
||||||
.module('app.login')
|
.module('app.login')
|
||||||
.factory('Login', Login)
|
.factory('Login', Login)
|
||||||
.factory('Rol', Rol)
|
|
||||||
.factory('GetRol', GetRol)
|
.factory('GetRol', GetRol)
|
||||||
.factory('hash', hash)
|
.factory('hash', hash)
|
||||||
.value('algoritmo','SHA-1')
|
.value('algoritmo','SHA-1')
|
||||||
@@ -14,13 +13,7 @@
|
|||||||
|
|
||||||
Login.$inject = ['$resource','$rootScope'];
|
Login.$inject = ['$resource','$rootScope'];
|
||||||
function Login($resource, $rootScope){
|
function Login($resource, $rootScope){
|
||||||
return $resource('http://'+$rootScope.domainUrl+'/api/VerifyUser');
|
return $resource('http://'+$rootScope.domainUrl+'/api/VerifyUser');
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
Rol.$inject = ['$resource','$rootScope'];
|
|
||||||
function Rol($resource, $rootScope){
|
|
||||||
return $resource('http://'+$rootScope.domainUrl+'/api/Rol');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GetRol.$inject = ['$resource','$rootScope'];
|
GetRol.$inject = ['$resource','$rootScope'];
|
||||||
@@ -75,6 +75,15 @@
|
|||||||
El Formato del Número de Teléfono es incorrecto.
|
El Formato del Número de Teléfono es incorrecto.
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-4 column">
|
||||||
|
<label for="password">Contraseña</label>
|
||||||
|
<input type="password" class="form-control" ng-model="vm.profesor.Password" maxlength="8" required/>
|
||||||
|
<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">
|
||||||
|
La Contraseña del Profesor es obligatorio.
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,31 +6,25 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="20%">
|
<th width="20%">
|
||||||
<a href="" ng-click="sortType = 'Cedula'; sortReverse = !sortReverse">
|
Cedula
|
||||||
Cedula
|
<span ng-show="sortType == 'Cedula' && !sortReverse" class="fa fa-caret-down"></span>
|
||||||
<span ng-show="sortType == 'Cedula' && !sortReverse" class="fa fa-caret-down"></span>
|
<span ng-show="sortType == 'Cedula' && sortReverse" class="fa fa-caret-up"></span>
|
||||||
<span ng-show="sortType == 'Cedula' && sortReverse" class="fa fa-caret-up"></span>
|
|
||||||
</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th width="20%">
|
<th width="20%">
|
||||||
<a href="" ng-click="sortType = 'Nombre'; sortReverse = !sortReverse">
|
Nombre
|
||||||
Nombre
|
<span ng-show="sortType == 'Nombre' && !sortReverse" class="fa fa-caret-down"></span>
|
||||||
<span ng-show="sortType == 'Nombre' && !sortReverse" class="fa fa-caret-down"></span>
|
<span ng-show="sortType == 'Nombre' && sortReverse" class="fa fa-caret-up"></span>
|
||||||
<span ng-show="sortType == 'Nombre' && sortReverse" class="fa fa-caret-up"></span>
|
|
||||||
</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th width="20%">
|
<th width="20%">
|
||||||
<a href="" ng-click="sortType = 'Apellido'; sortReverse = !sortReverse">
|
Apellido
|
||||||
Apellido
|
<span ng-show="sortType == 'Apellido' && !sortReverse" class="fa fa-caret-down"></span>
|
||||||
<span ng-show="sortType == 'Apellido' && !sortReverse" class="fa fa-caret-down"></span>
|
<span ng-show="sortType == 'Apellido' && sortReverse" class="fa fa-caret-up"></span>
|
||||||
<span ng-show="sortType == 'Apellido' && sortReverse" class="fa fa-caret-up"></span>
|
|
||||||
</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th width="20%" style="text-align: center">
|
<th width="20%" style="text-align: center">
|
||||||
<a>Modificar</a>
|
Modificar
|
||||||
</th>
|
</th>
|
||||||
<th width="20%" style="text-align: center">
|
<th width="20%" style="text-align: center">
|
||||||
<a>Borrar</a>
|
Borrar
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -49,5 +43,4 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show=false > {{ vm.removeProfesorSplice(index, rsplice) }}</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
|
|
||||||
var profesorArray = [];
|
var profesorArray = [];
|
||||||
professors.query(
|
professors.query(
|
||||||
function(data){
|
function (successResult){
|
||||||
vm.profesor = data;
|
vm.profesor = successResult;
|
||||||
angular.forEach(vm.profesor, function (value){
|
angular.forEach(vm.profesor, function (value){
|
||||||
profesorArray.push({
|
profesorArray.push({
|
||||||
Cedula:value.id,
|
Cedula:value.id,
|
||||||
@@ -132,6 +132,8 @@
|
|||||||
"lastname": vm.profesor.Apellido,
|
"lastname": vm.profesor.Apellido,
|
||||||
"email": vm.profesor.Correo,
|
"email": vm.profesor.Correo,
|
||||||
"number": vm.profesor.Telefono,
|
"number": vm.profesor.Telefono,
|
||||||
|
"role": "professor",
|
||||||
|
"password": vm.profesor.Password
|
||||||
};
|
};
|
||||||
|
|
||||||
$rootScope.botonOk = false;
|
$rootScope.botonOk = false;
|
||||||
@@ -197,12 +199,13 @@
|
|||||||
vm.submit = function() {
|
vm.submit = function() {
|
||||||
|
|
||||||
var professor = {
|
var professor = {
|
||||||
"_id": vm.profesor._id,
|
|
||||||
"id": vm.profesor.Cedula,
|
"id": vm.profesor.Cedula,
|
||||||
"name": vm.profesor.Nombre,
|
"name": vm.profesor.Nombre,
|
||||||
"lastname": vm.profesor.Apellido,
|
"lastname": vm.profesor.Apellido,
|
||||||
"email": vm.profesor.Correo,
|
"email": vm.profesor.Correo,
|
||||||
"number": vm.profesor.Telefono,
|
"number": vm.profesor.Telefono,
|
||||||
|
"role": "professor",
|
||||||
|
"password": vm.profesor.Password
|
||||||
};
|
};
|
||||||
|
|
||||||
$rootScope.botonOk = false;
|
$rootScope.botonOk = false;
|
||||||
@@ -218,7 +221,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
professors.update(professor,
|
professors.update({ id: vm.profesor._id}, professor,
|
||||||
function(){
|
function(){
|
||||||
$rootScope.botonOk = true;
|
$rootScope.botonOk = true;
|
||||||
$rootScope.botonCancelar = false;
|
$rootScope.botonCancelar = false;
|
||||||
@@ -21,12 +21,12 @@
|
|||||||
url: '/listarProfesor',
|
url: '/listarProfesor',
|
||||||
views: {
|
views: {
|
||||||
sidebar: {
|
sidebar: {
|
||||||
templateUrl: 'partials/sidebar.html',
|
templateUrl: 'partials/sidebar/sidebar.html',
|
||||||
controller: 'sidebarCtrl'
|
controller: 'sidebarCtrl'
|
||||||
|
|
||||||
},
|
},
|
||||||
navbar: {
|
navbar: {
|
||||||
templateUrl: 'partials/navbar.html'
|
templateUrl: 'partials/sidebar/navbar.html'
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
templateUrl: 'partials/professor/list_professor.html',
|
templateUrl: 'partials/professor/list_professor.html',
|
||||||
@@ -40,11 +40,11 @@
|
|||||||
url: '/crearProfesor',
|
url: '/crearProfesor',
|
||||||
views: {
|
views: {
|
||||||
sidebar: {
|
sidebar: {
|
||||||
templateUrl: 'partials/sidebar.html',
|
templateUrl: 'partials/sidebar/sidebar.html',
|
||||||
controller: 'sidebarCtrl'
|
controller: 'sidebarCtrl'
|
||||||
},
|
},
|
||||||
navbar: {
|
navbar: {
|
||||||
templateUrl: 'partials/navbar.html'
|
templateUrl: 'partials/sidebar/navbar.html'
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
templateUrl: 'partials/professor/create_professor.html',
|
templateUrl: 'partials/professor/create_professor.html',
|
||||||
@@ -58,11 +58,11 @@
|
|||||||
url: '/actualizarProfesor',
|
url: '/actualizarProfesor',
|
||||||
views: {
|
views: {
|
||||||
sidebar: {
|
sidebar: {
|
||||||
templateUrl: 'partials/sidebar.html',
|
templateUrl: 'partials/sidebar/sidebar.html',
|
||||||
controller: 'sidebarCtrl'
|
controller: 'sidebarCtrl'
|
||||||
},
|
},
|
||||||
navbar: {
|
navbar: {
|
||||||
templateUrl: 'partials/navbar.html'
|
templateUrl: 'partials/sidebar/navbar.html'
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
templateUrl: 'partials/professor/update_professor.html',
|
templateUrl: 'partials/professor/update_professor.html',
|
||||||
@@ -4,6 +4,8 @@
|
|||||||
angular
|
angular
|
||||||
.module('app.professor')
|
.module('app.professor')
|
||||||
.factory('professors', professors)
|
.factory('professors', professors)
|
||||||
|
.value('selectedCourse',{})
|
||||||
|
.value('selectedSection',{})
|
||||||
.value('profesorSeleccionado',{});
|
.value('profesorSeleccionado',{});
|
||||||
|
|
||||||
professors.$inject = ['$resource','$rootScope'];
|
professors.$inject = ['$resource','$rootScope'];
|
||||||
@@ -22,11 +22,11 @@
|
|||||||
url: '/reportes',
|
url: '/reportes',
|
||||||
views: {
|
views: {
|
||||||
sidebar: {
|
sidebar: {
|
||||||
templateUrl: 'partials/sidebar.html',
|
templateUrl: 'partials/sidebar/sidebar.html',
|
||||||
controller: 'sidebarCtrl'
|
controller: 'sidebarCtrl'
|
||||||
},
|
},
|
||||||
navbar: {
|
navbar: {
|
||||||
templateUrl: 'partials/navbar.html'
|
templateUrl: 'partials/sidebar/navbar.html'
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
templateUrl: 'partials/reportes/reportes.html',
|
templateUrl: 'partials/reportes/reportes.html',
|
||||||
@@ -2,25 +2,21 @@
|
|||||||
<form name="vm.data_input_form" role="form" novalidate
|
<form name="vm.data_input_form" role="form" novalidate
|
||||||
ng-submit="vm.submit()">
|
ng-submit="vm.submit()">
|
||||||
<div class="row clearfix">
|
<div class="row clearfix">
|
||||||
<h4>Nueva Matricula</h4>
|
<h4>Nueva Sección</h4>
|
||||||
<br>
|
<br>
|
||||||
<div class="col-md-12 column well">
|
<div class="col-md-12 column well">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4 column">
|
<div class="col-md-4 column">
|
||||||
<label>Nombre de la Materia</label>
|
<label>Nombre de la Materia</label>
|
||||||
<select
|
<input type="text" class="form-control"
|
||||||
class="form-control"
|
name="materia" readonly="readonly"
|
||||||
ng-model="vm.valorMateria"
|
ng-model="vm.course.name" required/>
|
||||||
ng-options="materia.name for materia in vm.materias"
|
|
||||||
>
|
|
||||||
<option value="">{{materia.name}}</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 column">
|
<div class="col-md-4 column">
|
||||||
<label for="codigo">Codigo de la Materia</label>
|
<label for="codigo">Codigo de la Materia</label>
|
||||||
<input type="text" class="form-control"
|
<input type="text" class="form-control"
|
||||||
name="codigo" readonly="readonly"
|
name="codigo" readonly="readonly"
|
||||||
ng-model="vm.valorMateria.code" required/>
|
ng-model="vm.course.code" required/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 column">
|
<div class="col-md-4 column">
|
||||||
<label for="semestre">Semestre</label>
|
<label for="semestre">Semestre</label>
|
||||||
@@ -72,6 +68,49 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<table class="table table-bordered table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="20%">
|
||||||
|
<a href="" ng-click="sortType = 'Cedula';
|
||||||
|
sortReverse = !sortReverse">
|
||||||
|
Cedula
|
||||||
|
<span ng-show="sortType == 'Cedula' &&
|
||||||
|
!sortReverse" class="fa fa-caret-down"></span>
|
||||||
|
<span ng-show="sortType == 'Cedula' &&
|
||||||
|
sortReverse" class="fa fa-caret-up"></span>
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
<th width="40%">
|
||||||
|
<a href="" ng-click="sortType = 'Apellido';
|
||||||
|
sortReverse = !sortReverse">
|
||||||
|
Apellido
|
||||||
|
<span ng-show="sortType == 'Apellido' &&
|
||||||
|
!sortReverse" class="fa fa-caret-down"></span>
|
||||||
|
<span ng-show="sortType == 'Apellido' &&
|
||||||
|
sortReverse" class="fa fa-caret-up"></span>
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
<th width="40%">
|
||||||
|
<a href="" ng-click="sortType = 'Nombre';
|
||||||
|
sortReverse = !sortReverse">
|
||||||
|
Nombre
|
||||||
|
<span ng-show="sortType == 'Nombre' &&
|
||||||
|
!sortReverse" class="fa fa-caret-down"></span>
|
||||||
|
<span ng-show="sortType == 'Nombre' &&
|
||||||
|
sortReverse" class="fa fa-caret-up"></span>
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat="student in vm.students">
|
||||||
|
<td style="vertical-align:middle">{{ student.id }}</td>
|
||||||
|
<td style="vertical-align:middle">{{ student.lastname }}</td>
|
||||||
|
<td style="vertical-align:middle">{{ student.name }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,50 +1,42 @@
|
|||||||
<div class="row clearfix">
|
<div class="row clearfix">
|
||||||
<h4>Listado de Secciones</h4></br>
|
<h4>Listado de Secciones</h4></br>
|
||||||
<div>
|
<div>
|
||||||
|
<button class="btn-success btn" ng-click="vm.createSection()" style="margin: 10px"> Crear Sección </button>
|
||||||
|
</br>
|
||||||
|
</br>
|
||||||
<table class="table table-bordered table-striped">
|
<table class="table table-bordered table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="20%">
|
<th width="20%">
|
||||||
<a href="" ng-click="sortType = 'name';
|
|
||||||
sortReverse = !sortReverse">
|
|
||||||
Sección
|
Sección
|
||||||
<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>
|
||||||
</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th width="20%">
|
<th width="20%">
|
||||||
<a href=""
|
|
||||||
ng-click="sortType = 'course'; sortReverse = !sortReverse">
|
|
||||||
Nombre de la Materia
|
Nombre de la Materia
|
||||||
<span ng-show="sortType == 'course' && !sortReverse" class="fa fa-caret-down"></span>
|
<span ng-show="sortType == 'course' && !sortReverse" class="fa fa-caret-down"></span>
|
||||||
<span ng-show="sortType == 'course' && sortReverse" class="fa fa-caret-up"></span>
|
<span ng-show="sortType == 'course' && sortReverse" class="fa fa-caret-up"></span>
|
||||||
</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th width="20%">
|
<th width="20%">
|
||||||
<a href="" ng-click="sortType = 'code'; sortReverse = !sortReverse">
|
|
||||||
Codigo de la Materia
|
Codigo de la Materia
|
||||||
<span ng-show="sortType == 'code' && !sortReverse" class="fa fa-caret-down"></span>
|
<span ng-show="sortType == 'code' && !sortReverse" class="fa fa-caret-down"></span>
|
||||||
<span ng-show="sortType == 'code' && sortReverse" class="fa fa-caret-up"></span>
|
<span ng-show="sortType == 'code' && sortReverse" class="fa fa-caret-up"></span>
|
||||||
</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th width="20%">
|
<th width="20%">
|
||||||
<a href="" ng-click="sortType = 'semester'; sortReverse = !sortReverse">
|
|
||||||
Semestre
|
Semestre
|
||||||
<span ng-show="sortType == 'semester' && !sortReverse" class="fa fa-caret-down"></span>
|
<span ng-show="sortType == 'semester' && !sortReverse" class="fa fa-caret-down"></span>
|
||||||
<span ng-show="sortType == 'semester' && sortReverse" class="fa fa-caret-up"></span>
|
<span ng-show="sortType == 'semester' && sortReverse" class="fa fa-caret-up"></span>
|
||||||
</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th width="10%" style="text-align: center">
|
<th width="10%" style="text-align: center">
|
||||||
<a>Modificar</a>
|
Modificar
|
||||||
</th>
|
</th>
|
||||||
<th width="10%" style="text-align: center">
|
<th width="10%" style="text-align: center">
|
||||||
<a>Borrar</a>
|
Borrar
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat = "section in vm.section | orderBy:sortType:sortReverse | filter:searchUser">
|
<tr ng-repeat = "section in vm.section">
|
||||||
<td style="vertical-align:middle">{{ section.name }}</td>
|
<td style="vertical-align:middle">{{ section.name }}</td>
|
||||||
<td style="vertical-align:middle">{{ section.course }}</td>
|
<td style="vertical-align:middle">{{ section.course }}</td>
|
||||||
<td style="vertical-align:middle">{{ section.code }}</td>
|
<td style="vertical-align:middle">{{ section.code }}</td>
|
||||||
@@ -65,5 +57,5 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show=false > {{ vm.eliminarMatriculaSplice(index, rsplice) }}</div>
|
<a href="#listarMateria" class="btn-warning btn" style=" margin: 10px">Regresar</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -7,15 +7,23 @@
|
|||||||
.controller('crearMatriculaCtrl', crearMatriculaCtrl)
|
.controller('crearMatriculaCtrl', crearMatriculaCtrl)
|
||||||
.controller('actualizarMatriculaCtrl', actualizarMatriculaCtrl)
|
.controller('actualizarMatriculaCtrl', actualizarMatriculaCtrl)
|
||||||
|
|
||||||
listarMatriculaCtrl.$inject = [ '$scope', '$rootScope', '$location', 'sections', '$modal', 'matriculaSeleccionada'];
|
listarMatriculaCtrl.$inject = [ '$scope', '$rootScope', '$location', 'professors', '$modal', 'selectedCourse', 'selectedSection'];
|
||||||
function listarMatriculaCtrl ( $scope, $rootScope, $location, sections, $modal, matriculaSeleccionada ){
|
function listarMatriculaCtrl ( $scope, $rootScope, $location, professors, $modal, selectedCourse, selectedSection ){
|
||||||
|
|
||||||
var vm = this;
|
var vm = this;
|
||||||
var matriculaArray = [];
|
var professorid = '56f5fd3a20047f3c15b05f0e';
|
||||||
|
vm.section = [];
|
||||||
|
vm.professor = null;
|
||||||
|
|
||||||
sections.query(
|
professors.get({ id: professorid },
|
||||||
function (successResult){
|
function (successResult){
|
||||||
vm.section = 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 (){
|
function (){
|
||||||
console.log("Error al obtener los datos.");
|
console.log("Error al obtener los datos.");
|
||||||
@@ -29,6 +37,11 @@
|
|||||||
llamada a servicio que borrara la matricula de la base de datos.
|
llamada a servicio que borrara la matricula de la base de datos.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
vm.createSection = function () {
|
||||||
|
$location.url('crearMatricula');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
vm.eliminarMatriculaModal = function (index) {
|
vm.eliminarMatriculaModal = function (index) {
|
||||||
$rootScope.index = index;
|
$rootScope.index = index;
|
||||||
$rootScope.botonOk = true;
|
$rootScope.botonOk = true;
|
||||||
@@ -57,7 +70,8 @@
|
|||||||
$rootScope.urlLo = 'listarMatricula';
|
$rootScope.urlLo = 'listarMatricula';
|
||||||
var name = vm.section[index].name;
|
var name = vm.section[index].name;
|
||||||
|
|
||||||
sections.delete({ id: vm.section[index]._id },
|
vm.professor.courses[vm.index].sections.splice(index, 1);
|
||||||
|
professors.update({ id: professorid }, vm.professor,
|
||||||
function () {
|
function () {
|
||||||
$rootScope.rsplice = true;
|
$rootScope.rsplice = true;
|
||||||
$rootScope.mensaje = "Sección " + name + " eliminada";
|
$rootScope.mensaje = "Sección " + name + " eliminada";
|
||||||
@@ -69,28 +83,21 @@
|
|||||||
|
|
||||||
vm.eliminarMatriculaSplice = function (index, rsplice) {
|
vm.eliminarMatriculaSplice = function (index, rsplice) {
|
||||||
if(rsplice){
|
if(rsplice){
|
||||||
vm.section.splice(index, 1);
|
|
||||||
$rootScope.rsplice = false;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*************************Fin de Eliminar Matricula********************/
|
/*************************Fin de Eliminar Matricula*******************/
|
||||||
|
|
||||||
|
|
||||||
vm.modificarMatricula = function (index) {
|
vm.modificarMatricula = function (index) {
|
||||||
matriculaSeleccionada._id = vm.section[index]._id;
|
selectedSection._id = vm.section[index]._id;
|
||||||
matriculaSeleccionada.name = vm.section[index].name;
|
selectedCourse.index = vm.index;
|
||||||
matriculaSeleccionada.code = vm.section[index].code;
|
|
||||||
matriculaSeleccionada.course = vm.section[index].course;
|
|
||||||
matriculaSeleccionada.semester = vm.section[index].semester;
|
|
||||||
matriculaSeleccionada.students = vm.section[index].students;
|
|
||||||
$location.url('actualizarMatricula');
|
$location.url('actualizarMatricula');
|
||||||
};
|
};
|
||||||
|
|
||||||
$rootScope.open = function($event) {
|
$rootScope.open = function($event) {
|
||||||
$event.preventDefault();
|
$event.preventDefault();
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
|
|
||||||
$rootScope.opened = true;
|
$rootScope.opened = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -107,30 +114,43 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
crearMatriculaCtrl.$inject =
|
crearMatriculaCtrl.$inject =
|
||||||
['$scope','$rootScope', '$location', 'sections', '$modal', 'courses'];
|
['$scope','$rootScope', '$location', 'professors', '$modal', 'selectedCourse'];
|
||||||
function crearMatriculaCtrl($scope, $rootScope, $location, sections, $modal, courses){
|
function crearMatriculaCtrl($scope, $rootScope, $location, professors, $modal, selectedCourse){
|
||||||
|
var professorid = '56f5fd3a20047f3c15b05f0e';
|
||||||
var vm = this;
|
var vm = this;
|
||||||
|
vm.course = {};
|
||||||
|
vm.selectedCourse = selectedCourse;
|
||||||
vm.submitted = false;
|
vm.submitted = false;
|
||||||
vm.semester, vm.section, vm.materias;
|
vm.semester, vm.section, vm.materias;
|
||||||
$rootScope.mensaje = "";
|
$rootScope.mensaje = "";
|
||||||
vm.students = [];
|
vm.students = [];
|
||||||
|
|
||||||
courses.query(
|
professors.get({ id: professorid },
|
||||||
function (successResult) {
|
function (successResult){
|
||||||
vm.materias = 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 () {
|
function (){
|
||||||
vm.materias = null;
|
console.log("Error al obtener los datos.");
|
||||||
});
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
vm.submit = function () {
|
vm.submit = function () {
|
||||||
|
|
||||||
if (vm.data_input_form.$valid){
|
if (vm.data_input_form.$valid){
|
||||||
vm.package = {
|
vm.package = {
|
||||||
"name": vm.name,
|
"name": vm.name,
|
||||||
"code": vm.valorMateria.code,
|
"code": vm.course.code,
|
||||||
"course": vm.valorMateria.name,
|
"course": vm.course.name,
|
||||||
"semester": vm.semester,
|
"semester": vm.semester,
|
||||||
"students": vm.students
|
"students": vm.students
|
||||||
};
|
};
|
||||||
@@ -147,7 +167,8 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
sections.save(vm.package,
|
vm.professor.courses[vm.index].sections.push(vm.package);
|
||||||
|
professors.update({ id: professorid }, vm.professor,
|
||||||
function(){
|
function(){
|
||||||
$rootScope.botonOk = true;
|
$rootScope.botonOk = true;
|
||||||
$rootScope.urlLo = 'listarMatricula';
|
$rootScope.urlLo = 'listarMatricula';
|
||||||
@@ -180,7 +201,7 @@
|
|||||||
/* Find desired cell containing semester and section */
|
/* Find desired cell containing semester and section */
|
||||||
vm.semester = worksheet['B5'].v;
|
vm.semester = worksheet['B5'].v;
|
||||||
vm.name = worksheet['B9'].v;
|
vm.name = worksheet['B9'].v;
|
||||||
$scope.$apply();
|
//$scope.$apply();
|
||||||
|
|
||||||
for (z in worksheet) {
|
for (z in worksheet) {
|
||||||
/* all keys that do not begin with "!" correspond to cell addresses */
|
/* all keys that do not begin with "!" correspond to cell addresses */
|
||||||
@@ -189,8 +210,9 @@
|
|||||||
/* 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*/
|
/* 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] =='C') student.id = worksheet[z].v;
|
||||||
if (z[0] =='D') student.name = worksheet[z].v;
|
if (z[0] =='D') student.name = worksheet[z].v;
|
||||||
if (z[0] =='E') {
|
if (z[0] =='E') student.lastname = worksheet[z].v;
|
||||||
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*/
|
/*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);
|
vm.students.push(student);
|
||||||
student = {};
|
student = {};
|
||||||
@@ -198,6 +220,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
$scope.$apply();
|
||||||
};
|
};
|
||||||
reader.readAsBinaryString(f);
|
reader.readAsBinaryString(f);
|
||||||
}
|
}
|
||||||
@@ -219,26 +242,38 @@
|
|||||||
return vm;
|
return vm;
|
||||||
};
|
};
|
||||||
|
|
||||||
actualizarMatriculaCtrl.$inject = ['$scope', '$rootScope', '$location', 'sections', '$modal', 'matriculaSeleccionada'];
|
actualizarMatriculaCtrl.$inject = ['$scope', '$rootScope', '$location', 'professors', '$modal', 'selectedSection', 'selectedCourse'];
|
||||||
function actualizarMatriculaCtrl($scope, $rootScope, $location, sections, $modal, matriculaSeleccionada){
|
function actualizarMatriculaCtrl($scope, $rootScope, $location, professors, $modal, selectedSection, selectedCourse){
|
||||||
|
var professorid = '56f5fd3a20047f3c15b05f0e';
|
||||||
var vm = this;
|
var vm = this;
|
||||||
vm.section = matriculaSeleccionada;
|
vm.section = {};
|
||||||
vm.students = matriculaSeleccionada.students;
|
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.actualizarMatricula = function() {
|
vm.addStudent = function (index) {
|
||||||
|
$location.url('crearEstudiante');
|
||||||
}
|
};
|
||||||
|
|
||||||
vm.retirarEstudianteModal = function (index) {
|
vm.retirarEstudianteModal = function (index) {
|
||||||
$rootScope.index = index;
|
$rootScope.index = index;
|
||||||
|
|
||||||
$rootScope.botonOk = true;
|
$rootScope.botonOk = true;
|
||||||
$rootScope.otroBotonOk = false;
|
$rootScope.otroBotonOk = false;
|
||||||
$rootScope.botonCancelar = true;
|
$rootScope.botonCancelar = true;
|
||||||
|
|
||||||
$rootScope.rsplice = false;
|
|
||||||
$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 + "?";
|
||||||
|
|
||||||
@@ -256,37 +291,21 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
vm.retirarEstudiante = function (index) {
|
vm.retirarEstudiante = function (index) {
|
||||||
$rootScope.rsplice = true;
|
vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students.splice(index, 1);
|
||||||
};
|
|
||||||
|
|
||||||
vm.retirarEstudianteSplice = function(index, rsplice) {
|
professors.update({ id: professorid }, vm.professor,
|
||||||
if (rsplice) {
|
function (){
|
||||||
vm.students.splice(index, 1);
|
$rootScope.botonOk = false;
|
||||||
$rootScope.rsplice = false;
|
$rootScope.otroBotonOk = true;
|
||||||
|
$rootScope.botonCancelar = false;
|
||||||
vm.section = {
|
$rootScope.mensaje = "Sección "+ vm.section.name +" actualizada";
|
||||||
"_id": vm.section._id,
|
},
|
||||||
"name": vm.section.name,
|
function (){
|
||||||
"code": vm.section.code,
|
$rootScope.botonOk = false;
|
||||||
"course": vm.section.name,
|
$rootScope.otroBotonOk = true;
|
||||||
"semester": vm.section.semester,
|
$rootScope.botonCancelar = false;
|
||||||
"students": vm.students
|
$rootScope.mensaje = "Error al actualizar la Sección "+ vm.section.name;
|
||||||
};
|
});
|
||||||
|
|
||||||
sections.update(vm.section,
|
|
||||||
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) {
|
$rootScope.open = function($event) {
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
(function(){
|
(function(){
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular
|
angular
|
||||||
@@ -23,11 +22,11 @@
|
|||||||
url: '/listarMatricula',
|
url: '/listarMatricula',
|
||||||
views: {
|
views: {
|
||||||
sidebar: {
|
sidebar: {
|
||||||
templateUrl: 'partials/sidebar.html',
|
templateUrl: 'partials/sidebar/sidebar.html',
|
||||||
controller: 'sidebarCtrl'
|
controller: 'sidebarCtrl'
|
||||||
},
|
},
|
||||||
navbar: {
|
navbar: {
|
||||||
templateUrl: 'partials/navbar.html'
|
templateUrl: 'partials/sidebar/navbar.html'
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
templateUrl: 'partials/section/list_section.html',
|
templateUrl: 'partials/section/list_section.html',
|
||||||
@@ -41,11 +40,11 @@
|
|||||||
url: '/crearMatricula',
|
url: '/crearMatricula',
|
||||||
views: {
|
views: {
|
||||||
sidebar: {
|
sidebar: {
|
||||||
templateUrl: 'partials/sidebar.html',
|
templateUrl: 'partials/sidebar/sidebar.html',
|
||||||
controller: 'sidebarCtrl'
|
controller: 'sidebarCtrl'
|
||||||
},
|
},
|
||||||
navbar: {
|
navbar: {
|
||||||
templateUrl: 'partials/navbar.html'
|
templateUrl: 'partials/sidebar/navbar.html'
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
templateUrl: 'partials/section/create_section.html',
|
templateUrl: 'partials/section/create_section.html',
|
||||||
@@ -59,11 +58,11 @@
|
|||||||
url: '/actualizarMatricula',
|
url: '/actualizarMatricula',
|
||||||
views: {
|
views: {
|
||||||
sidebar: {
|
sidebar: {
|
||||||
templateUrl: 'partials/sidebar.html',
|
templateUrl: 'partials/sidebar/sidebar.html',
|
||||||
controller: 'sidebarCtrl'
|
controller: 'sidebarCtrl'
|
||||||
},
|
},
|
||||||
navbar: {
|
navbar: {
|
||||||
templateUrl: 'partials/navbar.html'
|
templateUrl: 'partials/sidebar/navbar.html'
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
templateUrl: 'partials/section/update_section.html',
|
templateUrl: 'partials/section/update_section.html',
|
||||||
@@ -1,41 +1,42 @@
|
|||||||
<div class="row clearfix">
|
<div class="row clearfix">
|
||||||
<h4>Estudiantes Inscritos en {{ vm.section.course }} - Seccion {{ vm.section.name }} - Semestre {{ vm.section.semester }}</h4>
|
<h4>Estudiantes Inscritos en {{ vm.section.course }} - Seccion {{ vm.section.name }} - Semestre {{ vm.section.semester }}</h4>
|
||||||
<br>
|
<br>
|
||||||
|
<button class="btn-success btn" ng-click="vm.addStudent()" style="margin: 10px"> Agregar Estudiante </button><br><br>
|
||||||
<div>
|
<div>
|
||||||
<table class="table table-bordered table-striped">
|
<table class="table table-bordered table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="20%">
|
<th width="10%">
|
||||||
<a href="" ng-click="sortType = 'id'; sortReverse = !sortReverse">
|
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>
|
|
||||||
</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th width="20%">
|
<th width="20%">
|
||||||
<a href="" ng-click="sortType = 'name'; sortReverse = !sortReverse">
|
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>
|
|
||||||
</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th width="20%">
|
<th width="20%">
|
||||||
<a href="" ng-click="sortType = 'lastname'; sortReverse = !sortReverse">
|
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>
|
|
||||||
</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th width="20%" style="text-align: center">
|
<th width="30%">
|
||||||
<a>Retirar</a>
|
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">
|
||||||
|
Retirar
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="student in vm.students | orderBy:sortType:sortReverse | filter:searchUser">
|
<tr ng-repeat="student in vm.students">
|
||||||
<td style="vertical-align:middle">{{ student.id }}</td>
|
<td style="vertical-align:middle">{{ student.id }}</td>
|
||||||
<td style="vertical-align:middle">{{ student.name }}</td>
|
<td style="vertical-align:middle">{{ student.name }}</td>
|
||||||
<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="text-align: center">
|
<td style="text-align: center">
|
||||||
<span title="Click aqui para Eliminar un Estudiante"
|
<span title="Click aqui para Eliminar un Estudiante"
|
||||||
class="glyphicon glyphicon-remove" aria-hidden="true"
|
class="glyphicon glyphicon-remove" aria-hidden="true"
|
||||||
@@ -46,8 +47,6 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="btn-primary btn" ng-click="vm.actualizarMatricula()">Guardar Cambios</button>
|
|
||||||
<div ng-show = false> {{ vm.retirarEstudianteSplice(index, rsplice) }}</div>
|
|
||||||
<div class="container-fluid ">
|
<div class="container-fluid ">
|
||||||
<a href="#listarMatricula" class="btn-warning btn" style=" margin: 10px">Regresar</a>
|
<a href="#listarMatricula" class="btn-warning btn" style=" margin: 10px">Regresar</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,8 +13,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="navbar" class="navbar-collapse collapse">
|
<div id="navbar" class="navbar-collapse collapse">
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
<div class="container-fluid ">
|
<div class="container-fluid">
|
||||||
<a href="#login" class="btn-warning btn" style=" margin: 10px">Salir</a>
|
</br>
|
||||||
|
<a href="#login" class="btn-danger btn" style=" margin: 10px">Salir</a>
|
||||||
</div>
|
</div>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
69
app/partials/sidebar/sidebar.controllers.js
Normal file
69
app/partials/sidebar/sidebar.controllers.js
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
(function(){
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('app')
|
||||||
|
.controller('sidebarCtrl', sidebarCtrl)
|
||||||
|
|
||||||
|
sidebarCtrl.$inject = ['$scope'];
|
||||||
|
function sidebarCtrl($scope) {
|
||||||
|
|
||||||
|
var that = this;
|
||||||
|
$scope.showChilds = function(item){
|
||||||
|
item.active = !item.active;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.items = [
|
||||||
|
{
|
||||||
|
|
||||||
|
text: 'Modulo de Administración',
|
||||||
|
subItems: [
|
||||||
|
{
|
||||||
|
state: 'listarProfesor',
|
||||||
|
text: 'Listar Profesores'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
state: 'crearProfesor',
|
||||||
|
text: 'Agregar Profesores'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
|
||||||
|
text: 'Modulo de Materias',
|
||||||
|
subItems: [
|
||||||
|
{
|
||||||
|
state: 'listarMateria',
|
||||||
|
text: 'Listar Materias'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
state: 'crearMateria',
|
||||||
|
text: 'Agregar Materia'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
|
||||||
|
text: 'Modulo de Reportes',
|
||||||
|
subItems: [
|
||||||
|
{
|
||||||
|
state: 'reportesAlumno',
|
||||||
|
text: 'Reportes por Alumno'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
state: 'reportesClase',
|
||||||
|
text: 'Reportes por Clase'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
state: 'reportesSeccion',
|
||||||
|
text: 'Reportes por Seccion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
state: 'reportesMateria',
|
||||||
|
text: 'Reportes por Materia'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
})();
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
<br><br></div></div>
|
<br><br></div></div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4 column">
|
<div class="col-md-4 column">
|
||||||
<label for="correo">Direccion de Correo</label>
|
<label for="correo">Dirección de Correo</label>
|
||||||
<input type="correo" class="form-control"
|
<input type="correo" class="form-control"
|
||||||
name="correo" ng-model="vm.estudiante.Correo"
|
name="correo" ng-model="vm.estudiante.Correo"
|
||||||
ng-pattern="/^[a-z]+[a-z0-9._]+@[a-z]+\.[a-z.]{2,5}$/" placeholder="me@example.com" required/>
|
ng-pattern="/^[a-z]+[a-z0-9._]+@[a-z]+\.[a-z.]{2,5}$/" placeholder="me@example.com" required/>
|
||||||
@@ -62,17 +62,6 @@
|
|||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 column">
|
|
||||||
<label for="telefono">Numero de Telefono</label>
|
|
||||||
<input type="telefono" class="form-control"
|
|
||||||
name="telefono" ng-model="vm.estudiante.Telefono"
|
|
||||||
ng-pattern="/\d{4}-\d{3}-\d{4}/" maxlength="13"
|
|
||||||
placeholder="0424-123-9876"/>
|
|
||||||
<small class="error"
|
|
||||||
ng-show="vm.data_input_form.telefono.$error.pattern">
|
|
||||||
El Formato del Numero de Telefono es incorrecto.
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -83,11 +72,12 @@
|
|||||||
<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-primary btn">
|
||||||
Agregar Alumno</button>
|
Agregar Alumno </button>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<a href="#actualizarMatricula" class="btn-warning btn" style=" margin: 10px">Regresar</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -116,13 +116,25 @@
|
|||||||
return vm;
|
return vm;
|
||||||
};
|
};
|
||||||
|
|
||||||
crearEstudianteCtrl.$inject = ['$scope','$rootScope', '$location', 'students', '$modal'];
|
crearEstudianteCtrl.$inject = ['$scope', '$rootScope', '$location', 'professors', '$modal', 'selectedSection', 'selectedCourse'];
|
||||||
function crearEstudianteCtrl($scope, $rootScope, $location, students, $modal){
|
function crearEstudianteCtrl($scope, $rootScope, $location, professors, $modal, selectedSection, selectedCourse){
|
||||||
|
|
||||||
var vm = this;
|
var vm = this;
|
||||||
|
var duplicated = false;
|
||||||
|
var professorid = '56f5fd3a20047f3c15b05f0e';
|
||||||
|
vm.professor = {};
|
||||||
$rootScope.mensaje = "";
|
$rootScope.mensaje = "";
|
||||||
$rootScope.actOk = false;
|
$rootScope.actOk = false;
|
||||||
|
|
||||||
|
professors.get({ id: professorid },
|
||||||
|
function (successResult){
|
||||||
|
vm.professor = successResult;
|
||||||
|
},
|
||||||
|
function (){
|
||||||
|
console.log("Error al obtener los datos.");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
vm.submit = function() {
|
vm.submit = function() {
|
||||||
|
|
||||||
if (vm.data_input_form.$valid){
|
if (vm.data_input_form.$valid){
|
||||||
@@ -130,8 +142,7 @@
|
|||||||
"id": vm.estudiante.Cedula,
|
"id": vm.estudiante.Cedula,
|
||||||
"name": vm.estudiante.Nombre,
|
"name": vm.estudiante.Nombre,
|
||||||
"lastname": vm.estudiante.Apellido,
|
"lastname": vm.estudiante.Apellido,
|
||||||
"email": vm.estudiante.Correo,
|
"email": vm.estudiante.Correo
|
||||||
"number": vm.estudiante.Telefono,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$rootScope.crearEstudianteLoading = true;
|
$rootScope.crearEstudianteLoading = true;
|
||||||
@@ -148,22 +159,34 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
students.save(person,
|
angular.forEach (vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students,
|
||||||
function(){
|
function (value){
|
||||||
$rootScope.botonOk = true;
|
if(value.id == vm.estudiante.Cedula) duplicated = true;
|
||||||
$rootScope.urlLo = 'listarEstudiante';
|
});
|
||||||
$rootScope.mensaje = "Estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre + " agregado";
|
if (!duplicated){
|
||||||
$rootScope.crearEstudianteLoading = false;
|
vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students.push(person);
|
||||||
},
|
|
||||||
|
|
||||||
function(){
|
professors.update({ id: professorid }, vm.professor,
|
||||||
$rootScope.botonOk = true;
|
function(){
|
||||||
$rootScope.urlLo = 'listarEstudiante';
|
$rootScope.botonOk = true;
|
||||||
$rootScope.mensaje = "Error al agregar al estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre;
|
$rootScope.urlLo = 'actualizarMatricula';
|
||||||
$rootScope.crearEstudianteLoading = false;
|
$rootScope.mensaje = "Estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre + " agregado";
|
||||||
});
|
$rootScope.crearEstudianteLoading = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
function(){
|
||||||
|
$rootScope.botonOk = true;
|
||||||
|
$rootScope.urlLo = 'actualizarMatricula';
|
||||||
|
$rootScope.mensaje = "Error al agregar al estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre;
|
||||||
|
$rootScope.crearEstudianteLoading = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$rootScope.botonOk = true;
|
||||||
|
$rootScope.urlLo = 'actualizarMatricula';
|
||||||
|
$rootScope.mensaje = "Estudiante con cedula " + vm.estudiante.Cedula + " ya esta en la lista.";
|
||||||
|
$rootScope.crearEstudianteLoading = false;
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
vm.submitted = true;
|
vm.submitted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,12 +21,12 @@
|
|||||||
url: '/listarEstudiante',
|
url: '/listarEstudiante',
|
||||||
views: {
|
views: {
|
||||||
sidebar: {
|
sidebar: {
|
||||||
templateUrl: 'partials/sidebar.html',
|
templateUrl: 'partials/sidebar/sidebar.html',
|
||||||
controller: 'sidebarCtrl'
|
controller: 'sidebarCtrl'
|
||||||
|
|
||||||
},
|
},
|
||||||
navbar: {
|
navbar: {
|
||||||
templateUrl: 'partials/navbar.html'
|
templateUrl: 'partials/sidebar/navbar.html'
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
templateUrl: 'partials/students/list_students.html',
|
templateUrl: 'partials/students/list_students.html',
|
||||||
@@ -40,11 +40,11 @@
|
|||||||
url: '/crearEstudiante',
|
url: '/crearEstudiante',
|
||||||
views: {
|
views: {
|
||||||
sidebar: {
|
sidebar: {
|
||||||
templateUrl: 'partials/sidebar.html',
|
templateUrl: 'partials/sidebar/sidebar.html',
|
||||||
controller: 'sidebarCtrl'
|
controller: 'sidebarCtrl'
|
||||||
},
|
},
|
||||||
navbar: {
|
navbar: {
|
||||||
templateUrl: 'partials/navbar.html'
|
templateUrl: 'partials/sidebar/navbar.html'
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
templateUrl: 'partials/students/create_students.html',
|
templateUrl: 'partials/students/create_students.html',
|
||||||
@@ -58,11 +58,11 @@
|
|||||||
url: '/actualizarEstudiante',
|
url: '/actualizarEstudiante',
|
||||||
views: {
|
views: {
|
||||||
sidebar: {
|
sidebar: {
|
||||||
templateUrl: 'partials/sidebar.html',
|
templateUrl: 'partials/sidebar/sidebar.html',
|
||||||
controller: 'sidebarCtrl'
|
controller: 'sidebarCtrl'
|
||||||
},
|
},
|
||||||
navbar: {
|
navbar: {
|
||||||
templateUrl: 'partials/navbar.html'
|
templateUrl: 'partials/sidebar/navbar.html'
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
templateUrl: 'partials/students/update_students.html',
|
templateUrl: 'partials/students/update_students.html',
|
||||||
277
app/server.js
277
app/server.js
@@ -1,54 +1,201 @@
|
|||||||
|
var mongoose = require('mongoose');
|
||||||
var express = require('express');
|
var express = require('express');
|
||||||
var app = express();
|
var app = express();
|
||||||
var mongojs = require('mongojs');
|
var db = mongoose.connection;
|
||||||
var db = mongojs('AttendanceDB',
|
//var Professor = require('./models/professor');
|
||||||
['Courses', 'Professors', 'Sections', 'Students']);
|
|
||||||
var bodyParser = require('body-parser');
|
var bodyParser = require('body-parser');
|
||||||
|
|
||||||
app.use(express.static(__dirname));
|
app.use(express.static(__dirname));
|
||||||
app.use(bodyParser.json());
|
app.use(bodyParser.json());
|
||||||
|
|
||||||
app.get('/students', function(req, res){
|
db.on('error', console.error);
|
||||||
console.log('Received get all request');
|
db.once('open', function() {
|
||||||
db.Students.find(function(err, docs){
|
|
||||||
|
var assitanceSchema = new mongoose.Schema({
|
||||||
|
day: Date
|
||||||
|
});
|
||||||
|
|
||||||
|
var studentSchema = new mongoose.Schema({
|
||||||
|
id: Number,
|
||||||
|
name: String,
|
||||||
|
lastname: String,
|
||||||
|
email: String,
|
||||||
|
assistance: Number,
|
||||||
|
btaddress: String,
|
||||||
|
assistanceTotal: [Date]
|
||||||
|
});
|
||||||
|
|
||||||
|
var sectionSchema = new mongoose.Schema({
|
||||||
|
name: String,
|
||||||
|
code: Number,
|
||||||
|
course: String,
|
||||||
|
semester: String,
|
||||||
|
assistance: Number,
|
||||||
|
students: [studentSchema]
|
||||||
|
});
|
||||||
|
|
||||||
|
var courseSchema = new mongoose.Schema({
|
||||||
|
code: Number,
|
||||||
|
name: String,
|
||||||
|
credits: Number,
|
||||||
|
description: String,
|
||||||
|
sections: [sectionSchema]
|
||||||
|
});
|
||||||
|
|
||||||
|
var professorSchema = new mongoose.Schema({
|
||||||
|
id: Number,
|
||||||
|
name: String,
|
||||||
|
lastname: String,
|
||||||
|
email: String,
|
||||||
|
number: String,
|
||||||
|
role: String,
|
||||||
|
password: String,
|
||||||
|
courses: [courseSchema]
|
||||||
|
});
|
||||||
|
|
||||||
|
var Professor = mongoose.model('Professor', professorSchema);
|
||||||
|
|
||||||
|
//Professor CRUD
|
||||||
|
|
||||||
|
app.get('/professors', function(req, res){
|
||||||
|
console.log('Received get all professors request');
|
||||||
|
Professor.find(function(err, docs){
|
||||||
|
console.log(docs);
|
||||||
|
res.json(docs);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get('/professors/:id', function(req, res){
|
||||||
|
console.log('Received get professor request');
|
||||||
|
console.log(req.params);
|
||||||
|
Professor.findOne(req.params.id,
|
||||||
|
function(err, docs){
|
||||||
|
console.log(docs);
|
||||||
|
res.json(docs);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
app.post('/professors', function(req, res){
|
||||||
|
console.log('Received add professor request');
|
||||||
|
console.log(req.body);
|
||||||
|
|
||||||
|
var professor = new Professor({
|
||||||
|
id: req.body.id,
|
||||||
|
name: req.body.name,
|
||||||
|
lastname: req.body.lastname,
|
||||||
|
email: req.body.email,
|
||||||
|
number: req.body.number,
|
||||||
|
role: req.body.role,
|
||||||
|
password: req.body.password,
|
||||||
|
course: [
|
||||||
|
{ name:"Materia" }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
professor.save(
|
||||||
|
function(err, docs){
|
||||||
|
console.log(docs);
|
||||||
|
res.json(docs);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
app.delete('/professors/:id', function(req, res){
|
||||||
|
console.log("Received delete professor request...");
|
||||||
|
console.log(req.params);
|
||||||
|
Professor.findByIdAndRemove(req.params.id,
|
||||||
|
function(err, docs){
|
||||||
|
console.log(docs);
|
||||||
|
res.json(docs);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
app.put('/professors/:id', function(req, res){
|
||||||
|
console.log("Received update professor request");
|
||||||
|
console.log("params:" + req.params);
|
||||||
|
console.log("body:" + req.body);
|
||||||
|
Professor.findById(req.params.id, function (err, professor) {
|
||||||
|
if (err)
|
||||||
|
res.send(err);
|
||||||
|
if (typeof req.body.email != 'undefined') professor.email = req.body.email;
|
||||||
|
if (typeof req.body.number != 'undefined') professor.number = req.body.number;
|
||||||
|
if (typeof req.body.courses != 'undefined') professor.courses = req.body.courses;
|
||||||
|
|
||||||
|
professor.save(function(err, docs){
|
||||||
|
if (err)
|
||||||
|
res.send(err);
|
||||||
|
console.log(docs);
|
||||||
|
res.json(docs);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
mongoose.connect('mongodb://localhost/AttendanceDB');
|
||||||
|
|
||||||
|
app.listen(3000);
|
||||||
|
console.log("server running on port 3000");
|
||||||
|
|
||||||
|
|
||||||
|
/*var debug = require('debug')('passport-mongo');
|
||||||
|
var app = require('./app');
|
||||||
|
|
||||||
|
app.set('port', process.env.PORT || 3000);
|
||||||
|
|
||||||
|
var server = app.listen(app.get('port'), function() {
|
||||||
|
debug('Express server listening on port ' + server.address().port);
|
||||||
|
});*/
|
||||||
|
/*
|
||||||
|
var express = require('express');
|
||||||
|
var app = express();
|
||||||
|
var mongojs = require('mongojs');
|
||||||
|
var db = mongojs('AttendanceDB',
|
||||||
|
['DB', 'Courses', 'Professors', 'Sections', 'Students']);
|
||||||
|
var bodyParser = require('body-parser');
|
||||||
|
|
||||||
|
app.use(express.static(__dirname));
|
||||||
|
app.use(bodyParser.json());
|
||||||
|
|
||||||
|
app.get('/professors', function(req, res){
|
||||||
|
console.log('Received get all professors request');
|
||||||
|
db.DB.find(function(err, docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/students/:id', function(req, res){
|
app.get('/professors/:id', function(req, res){
|
||||||
console.log('Received get request');
|
console.log('Received get professor request');
|
||||||
db.Students.findOne(
|
db.DB.findOne({_id: new mongojs.ObjectId(req.params.id)},
|
||||||
{_id: new mongojs.ObjectId(req.params.id)}, function(err, docs){
|
function(err, docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/students', function(req, res){
|
app.post('/professors', function(req, res){
|
||||||
console.log('Received add request');
|
console.log('Received add professor request');
|
||||||
console.log(req.body);
|
console.log(req.body);
|
||||||
db.Students.insert(req.body, function(docs){
|
db.DB.insert(req.body, function(docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
app.delete('/students/:id', function(req, res){
|
app.delete('/professors/:id', function(req, res){
|
||||||
console.log("Received delete request...");
|
console.log("Received delete professor request...");
|
||||||
db.Students.remove(
|
db.DB.remove({_id: new mongojs.ObjectId(req.params.id)},
|
||||||
{_id: new mongojs.ObjectId(req.params.id)}, function(err, docs){
|
function(err, docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.put('/students', function(req, res){
|
app.put('/professors', function(req, res){
|
||||||
console.log("Received update request");
|
console.log("Received update professor request");
|
||||||
console.log(req.body);
|
console.log(req.body);
|
||||||
db.Students.findAndModify({query:
|
db.DB.findAndModify({query:
|
||||||
{"_id": new mongojs.ObjectId(req.body._id)},
|
{"_id": new mongojs.ObjectId(req.body._id)},
|
||||||
update: {$set: {email: req.body.email, number: req.body.number}}
|
update: {$set: {email: req.body.email, number: req.body.number, courses: req.body.courses}}
|
||||||
}, function(err, docs){
|
}, function(err, docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
@@ -56,51 +203,63 @@ app.put('/students', function(req, res){
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.get('/courses', function(req, res){
|
app.get('/courses', function(req, res){
|
||||||
console.log('Received get all request');
|
console.log('Received get all courses request');
|
||||||
db.Courses.find(function(err, docs){
|
db.DB.find(function(err, docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/courses/:id', function(req, res){
|
app.get('/courses/:id', function(req, res){
|
||||||
console.log('Received get request');
|
console.log('Received get courses request');
|
||||||
db.Courses.findOne(
|
db.DB.findOne({_id: new mongojs.ObjectId(req.params.id)},
|
||||||
{_id: new mongojs.ObjectId(req.params.id)}, function(err, docs){
|
function(err, docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/courses', function(req, res){
|
app.post('/courses', function(req, res){
|
||||||
console.log('Received add request');
|
console.log('Received add courses request');
|
||||||
console.log(req.body);
|
console.log(req.body);
|
||||||
db.Courses.insert(req.body, function(docs){
|
db.DB.insert(req.body, function(docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
app.delete('/courses/:id', function(req, res){
|
app.delete('/courses/:id', function(req, res){
|
||||||
console.log("Received delete request...");
|
console.log("Received delete courses request...");
|
||||||
db.Courses.remove(
|
db.DB.remove({_id: new mongojs.ObjectId(req.params.id)},
|
||||||
{_id: new mongojs.ObjectId(req.params.id)}, function(err, docs){
|
function(err, docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.put('/courses', function(req, res){
|
||||||
|
console.log("Received update courses request");
|
||||||
|
console.log(req.body);
|
||||||
|
db.DB.findAndModify({query:
|
||||||
|
{"_id": new mongojs.ObjectId(req.body._id)},
|
||||||
|
update: {$set: {sections: req.body.sections}}
|
||||||
|
}, function(err, docs){
|
||||||
|
console.log(docs);
|
||||||
|
res.json(docs);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
app.get('/sections', function(req, res){
|
app.get('/sections', function(req, res){
|
||||||
console.log('Received get all request');
|
console.log('Received get all sections request');
|
||||||
db.Sections.find(function(err, docs){
|
db.DB.find(function(err, docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/sections/:id', function(req, res){
|
app.get('/sections/:id', function(req, res){
|
||||||
console.log('Received get request');
|
console.log('Received get section request');
|
||||||
db.Sections.findOne(
|
db.DB.findOne(
|
||||||
{_id: new mongojs.ObjectId(req.params.id)}, function(err, docs){
|
{_id: new mongojs.ObjectId(req.params.id)}, function(err, docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
@@ -108,17 +267,17 @@ app.get('/sections/:id', function(req, res){
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.post('/sections', function(req, res){
|
app.post('/sections', function(req, res){
|
||||||
console.log('Received add request');
|
console.log('Received add section request');
|
||||||
console.log(req.body);
|
console.log(req.body);
|
||||||
db.Sections.insert(req.body, function(docs){
|
db.DB.insert(req.body, function(docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
app.delete('/sections/:id', function(req, res){
|
app.delete('/sections/:id', function(req, res){
|
||||||
console.log("Received delete request...");
|
console.log("Received delete section request...");
|
||||||
db.Sections.remove(
|
db.DB.remove(
|
||||||
{_id: new mongojs.ObjectId(req.params.id)}, function(err, docs){
|
{_id: new mongojs.ObjectId(req.params.id)}, function(err, docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
@@ -126,9 +285,9 @@ app.delete('/sections/:id', function(req, res){
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.put('/sections', function(req, res){
|
app.put('/sections', function(req, res){
|
||||||
console.log("Received update request");
|
console.log("Received update section request");
|
||||||
console.log(req.body);
|
console.log(req.body);
|
||||||
db.Sections.findAndModify({query:
|
db.DB.findAndModify({query:
|
||||||
{"_id": new mongojs.ObjectId(req.body._id)},
|
{"_id": new mongojs.ObjectId(req.body._id)},
|
||||||
update: {$set: {students: req.body.students}}
|
update: {$set: {students: req.body.students}}
|
||||||
}, function(err, docs){
|
}, function(err, docs){
|
||||||
@@ -137,45 +296,45 @@ app.put('/sections', function(req, res){
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/professors', function(req, res){
|
app.get('/students', function(req, res){
|
||||||
console.log('Received get all request');
|
console.log('Received get all students request');
|
||||||
db.Professors.find(function(err, docs){
|
db.DB.find(function(err, docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/professors/:id', function(req, res){
|
app.get('/students/:id', function(req, res){
|
||||||
console.log('Received get request');
|
console.log('Received get student request');
|
||||||
db.Professors.findOne({_id: new mongojs.ObjectId(req.params.id)},
|
db.DB.findOne(
|
||||||
function(err, docs){
|
{_id: new mongojs.ObjectId(req.params.id)}, function(err, docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/professors', function(req, res){
|
app.post('/students', function(req, res){
|
||||||
console.log('Received add request');
|
console.log('Received add student request');
|
||||||
console.log(req.body);
|
console.log(req.body);
|
||||||
db.Professors.insert(req.body, function(docs){
|
db.DB.insert(req.body, function(docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
app.delete('/professors/:id', function(req, res){
|
app.delete('/students/:id', function(req, res){
|
||||||
console.log("Received delete request...");
|
console.log("Received delete student request...");
|
||||||
db.Professors.remove({_id: new mongojs.ObjectId(req.params.id)},
|
db.DB.remove(
|
||||||
function(err, docs){
|
{_id: new mongojs.ObjectId(req.params.id)}, function(err, docs){
|
||||||
console.log(docs);
|
console.log(docs);
|
||||||
res.json(docs);
|
res.json(docs);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.put('/professors', function(req, res){
|
app.put('/students', function(req, res){
|
||||||
console.log("Received update request");
|
console.log("Received update student request");
|
||||||
console.log(req.body);
|
console.log(req.body);
|
||||||
db.Professors.findAndModify({query:
|
db.DB.findAndModify({query:
|
||||||
{"_id": new mongojs.ObjectId(req.body._id)},
|
{"_id": new mongojs.ObjectId(req.body._id)},
|
||||||
update: {$set: {email: req.body.email, number: req.body.number}}
|
update: {$set: {email: req.body.email, number: req.body.number}}
|
||||||
}, function(err, docs){
|
}, function(err, docs){
|
||||||
@@ -185,4 +344,4 @@ app.put('/professors', function(req, res){
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.listen(3000);
|
app.listen(3000);
|
||||||
console.log("server running on port 3000");
|
console.log("server running on port 3000");*/
|
||||||
Reference in New Issue
Block a user