Create M.A.S.A Version 1.0

This commit is contained in:
Reynaldo Reyes
2016-04-11 00:05:59 -04:30
parent 7fff896e43
commit 1ee3577fe4
60 changed files with 1673 additions and 2137 deletions

View File

@@ -31,6 +31,7 @@
.run(function ($rootScope) {
$rootScope.domainUrl = 'Localhost:3000';
$rootScope.professorId = '56f5fd3a20047f3c15b05f0e';
});
})();

View File

@@ -1,70 +0,0 @@
body {
padding-top: 70px;
padding-bottom: 30px;
}
.box {
margin-bottom: 20px;
background-color: #fff;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.box > h3 {
color: #333;
border-color: #ddd;
border-bottom: 1px solid transparent;
border-top-right-radius: 3px;
border-top-left-radius: 3px;
background-repeat: repeat-x;
display: block;
font-size: 16px;
padding: 10px 15px;
margin-top: 0;
margin-bottom: 0;
}
.box-padding {
padding: 15px;
}
.box-padding > h3 {
margin: -15px;
margin-bottom: 15px;
}
.box-grey {
border-color: #ddd;
}
.box-grey > h3 {
background-color: #f5f5f5;
background-image: -webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);
background-image: linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);
}
.box-blue {
border-color: #bce8f1;
}
.box-blue > h3 {
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
background-image: -webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);
background-image: linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);
}
.box-yellow {
border-color: #faebcc;
}
.box-yellow > h3 {
//color: #8a6d3b;
//background-color: #fcf8e3;
//border-color: #faebcc;
//background-image: -webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);
//background-image: linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);
}

View File

@@ -1,149 +0,0 @@
/***************************** Required styles *****************************/
/**
* For the correct positioning of the placeholder element, the dnd-list and
* it's children must have position: relative
*/
.nestedDemo ul[dnd-list],
.nestedDemo ul[dnd-list] > li {
position: relative;
}
/***************************** Dropzone Styling *****************************/
/**
* The dnd-list should always have a min-height,
* otherwise you can't drop to it once it's empty
*/
.nestedDemo .dropzone ul[dnd-list] {
min-height: 42px;
margin: 0px;
padding-left: 0px;
}
/**
* The dnd-lists's child elements currently MUST have
* position: relative. Otherwise we can not determine
* whether the mouse pointer is in the upper or lower
* half of the element we are dragging over. In other
* browsers we can use event.offsetY for this.
*/
.nestedDemo .dropzone li {
background-color: #fff;
border: 1px solid #ddd;
display: block;
padding: 0px;
}
/**
* Reduce opacity of elements during the drag operation. This allows the user
* to see where he is dropping his element, even if the element is huge. The
* .dndDragging class is automatically set during the drag operation.
*/
.nestedDemo .dropzone .dndDragging {
opacity: 0.7;
}
/**
* The dndDraggingSource class will be applied to the source element of a drag
* operation. It makes sense to hide it to give the user the feeling that he's
* actually moving it. Note that the source element has also .dndDragging class.
*/
.nestedDemo .dropzone .dndDraggingSource {
display: none;
}
/**
* An element with .dndPlaceholder class will be added as child of the dnd-list
* while the user is dragging over it.
*/
.nestedDemo .dropzone .dndPlaceholder {
background-color: #ddd;
min-height: 42px;
display: block;
position: relative;
}
/***************************** Element Selection *****************************/
.nestedDemo .dropzone .selected .item {
color: #3c763d;
background-color: #dff0d8;
}
.nestedDemo .dropzone .selected .box {
border-color: #d6e9c6;
}
.nestedDemo .dropzone .selected .box > h3 {
color: #3c763d;
background-color: #dff0d8;
background-image: linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);
border-color: #d6e9c6;
}
/***************************** Element type specific styles *****************************/
.nestedDemo .dropzone .item {
padding: 10px 15px;
}
.nestedDemo .dropzone .container-element {
margin: 10px;
}
.nestedDemo .dropzone .container-element .column {
float: left;
width: 16.666%;
}
.nestedDemo .dropzone .container-element .columnQuestions {
float: left;
width: 100%;
}
/***************************** Toolbox *****************************/
.nestedDemo .toolbox ul {
list-style: none;
padding-left: 0px;
cursor: move;
}
.nestedDemo .toolbox button {
margin: 5px;
//width: 123px;
opacity: 1.0;
}
.nestedDemo .toolbox .dndDragging {
opacity: 0.5;
}
.nestedDemo .toolbox .dndDraggingSource {
opacity: 1.0;
}
/***************************** Trashcan *****************************/
.nestedDemo .trashcan ul {
list-style: none;
padding-left: 0px;
}
.nestedDemo .trashcan img {
width: 100%;
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
filter: grayscale(100%);
}
.nestedDemo .trashcan .dndDragover img {
width: 100%;
-webkit-filter: none;
-moz-filter: none;
filter: none;
}
.nestedDemo .trashcan .dndPlaceholder {
display: none;
}

View File

@@ -1,59 +0,0 @@
html, body {
height: 100%;
margin: 0px;
padding: 0px
}
.pac-controls {
margin-top: 16px;
border: 1px solid transparent;
border-radius: 2px 0 0 2px;
box-sizing: border-box;
-moz-box-sizing: border-box;
height: 32px !important;
outline: none;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
#pac-input {
background-color: #fff;
padding: 0 11px 0 13px;
width: 400px;
font-family: 'Open Sans', sans-serif;
font-size: 15px;
font-weight: 300;
text-overflow: ellipsis;
}
#pac-input:focus {
border-color: #4d90fe;
margin-left: -1px;
padding-left: 14px; /* Regular padding-left + 1. */
width: 401px;
}
.pac-container {
font-family: 'Open Sans', sans-serif;
}
#type-selector {
color: #fff;
background-color: #4d90fe;
padding: 5px 11px 0px 11px;
}
#type-selector label {
font-family: 'Open Sans', sans-serif;
font-size: 13px;
font-weight: 300;
}
.angular-google-map-container {
width: 100%;
height: 600px;
}
/* fix for Twitter Bootstrap handling of responsive images */
.angular-google-map img {
max-width: inherit;
}

View File

@@ -5,23 +5,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="favicon.ico">
<title>Modulo de Administración de Asistencia</title>
<!-- Bootstrap CSS -->
<!-- CSS -->
<!-- ======================-->
<link href="bower_components/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
<link href="bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" >
<link href="css/nested.css" type="text/css" rel="stylesheet" />
<link href="css/demo-framework.css" type="text/css" rel="stylesheet"/>
<link href="css/search-box-example.css" type="text/css" rel="stylesheet" >
<link href="bower_components/angular-chart.js/dist/angular-chart.css" rel="stylesheet">
<!-- Custom styles for this template -->
<!-- ====================================-->
<link href="css/style.css" rel="stylesheet">
<link href="static/css/style.css" rel="stylesheet">
</head>
<body>
@@ -63,9 +54,11 @@
<!-- Application Javascript -->
<!-- ====================================================-->
<script src="app.js"></script>
<script src="partials/sidebar/sidebar.controllers.js"></script>
<script src="partials/course/course.module.js"></script>
<script src="partials/course/course.controllers.js"></script>
<script src="partials/course/course_create.controller.js"></script>
<script src="partials/course/course_list.controller.js"></script>
<script src="partials/course/course.services.js"></script>
<script src="partials/login/login.module.js"></script>
@@ -73,21 +66,29 @@
<script src="partials/login/login.services.js"></script>
<script src="partials/professor/professor.module.js"></script>
<script src="partials/professor/professor.controllers.js"></script>
<script src="partials/professor/professor_create.controller.js"></script>
<script src="partials/professor/professor_list.controller.js"></script>
<script src="partials/professor/professor_update.controller.js"></script>
<script src="partials/professor/professor.services.js"></script>
<script src="partials/report/report.module.js"></script>
<script src="partials/report/report.controllers.js"></script>
<script src="partials/report/course_report.controller.js"></script>
<script src="partials/report/section_report.controller.js"></script>
<script src="partials/report/student_report.controller.js"></script>
<script src="partials/report/course_assist.controller.js"></script>
<script src="partials/report/section_assist.controller.js"></script>
<script src="partials/report/student_assist.controller.js"></script>
<script src="partials/report/report.services.js"></script>
<script src="partials/section/section.module.js"></script>
<script src="partials/section/section.controllers.js"></script>
<script src="partials/section/section_create.controller.js"></script>
<script src="partials/section/section_list.controller.js"></script>
<script src="partials/section/section_update.controller.js"></script>
<script src="partials/section/section.services.js"></script>
<script src="partials/sidebar/sidebar.controllers.js"></script>
<script src="partials/students/student.module.js"></script>
<script src="partials/students/student.controllers.js"></script>
<script src="partials/students/student_create.controller.js"></script>
<script src="partials/students/student.services.js"></script>
<!-- Angular ui.bootstrap's Javascript instead of Bootstrap Javascript -->

View File

@@ -1,170 +0,0 @@
(function(){
'use strict';
angular
.module('app.course')
.controller('listarMateriaCtrl',listarMateriaCtrl)
.controller('crearMateriaCtrl', crearMateriaCtrl)
listarMateriaCtrl.$inject =
['$scope', '$rootScope', '$location', 'professors', '$modal', 'profesorSeleccionado', 'selectedCourse'];
function listarMateriaCtrl($scope, $rootScope, $location, professors, $modal, profesorSeleccionado, selectedCourse) {
var vm = this;
var professorid = '56f5fd3a20047f3c15b05f0e';
professors.get({ id: professorid },
function (successResult){
vm.professor = successResult;
vm.course = vm.professor.courses;
},
function (){
console.log("Error al obtener los datos.");
});
vm.listarSecciones = function (index) {
selectedCourse._id = vm.course[index]._id;
$location.url('listarMatricula');
};
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.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: '/partials/course/modal/delete_course_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return "";
}
}
});
};
vm.eliminarMateria = function (index) {
$rootScope.botonOk = false;
$rootScope.otroBotonOk = true;
$rootScope.botonCancelar = false;
$rootScope.urlLo = 'listarMateria';
var name = vm.course[index].name;
vm.professor.courses.splice(index, 1);
professors.update({ id: professorid }, vm.professor,
function () {
$rootScope.mensaje = "Materia " + name + " eliminada";
},
function () {
$rootScope.mensaje = "Error eliminando la materia" + name;
});
};
/*vm.modificarMateria = function (index) {
$location.url('modificarMateria');
};*/
$scope.ok = function (urlLo) {
$location.url(urlLo);
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
$rootScope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
return vm;
};
crearMateriaCtrl.$inject =
['$scope','$rootScope', '$modal', '$location', 'professors'];
function crearMateriaCtrl($scope, $rootScope, $modal, $location, professors) {
var vm = this;
vm.submitted = false;
vm.mayorque = false;
$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() {
if (vm.data_input_form.$valid){
vm.course = {
"code": vm.course.code,
"name": vm.course.name,
"credits": vm.course.credits,
"description" : vm.course.description,
};
$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;
}
}
});
vm.professor.courses.push(vm.course);
professors.update({ id: professorid }, vm.professor,
function(){
$rootScope.botonOk = true;
$rootScope.urlLo = 'listarMateria';
$rootScope.mensaje =
"Materia " + vm.course.name + " creada";
},
function(){
$rootScope.botonOk = true;
$rootScope.urlLo = 'listarMateria';
$rootScope.mensaje =
"Error creando la materia " + vm.course.name;
});
}else{
vm.submitted = true;
}
}
$scope.ok = function (urlLo) {
$location.url(urlLo);
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
$rootScope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
return vm;
};
})();

View File

@@ -14,41 +14,41 @@
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
function getRoutes($stateProvider, $urlRouterProvider){
$urlRouterProvider.otherwise('/listarMaterias');
$urlRouterProvider.otherwise('/CourseList');
$stateProvider
.state('listarMateria', {
url: '/listarMateria',
.state('CourseList', {
url: '/CourseList',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'sidebarCtrl'
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/course/list_course.html',
controller: 'listarMateriaCtrl',
controllerAs: "vm"
templateUrl: 'partials/course/course_list.html',
controller: 'CourseListCtrl',
controllerAs: "vm"
}
}
})
.state('crearMateria', {
url: '/crearMateria',
.state('CourseCreate', {
url: '/CourseCreate',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'sidebarCtrl'
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/course/create_course.html',
controller: 'crearMateriaCtrl',
controllerAs: "vm"
templateUrl: 'partials/course/course_create.html',
controller: 'CourseCreateCtrl',
controllerAs: "vm"
}
}
})

View File

@@ -0,0 +1,87 @@
(function(){
'use strict';
angular
.module('app.course')
.controller('CourseCreateCtrl', CourseCreateCtrl)
CourseCreateCtrl.$inject =
['$scope','$rootScope', '$modal', '$location', 'professors'];
function CourseCreateCtrl($scope, $rootScope, $modal, $location, professors) {
var vm = this;
vm.submitted = false;
vm.mayorque = false;
$rootScope.mensaje = "";
var professorid = $rootScope.professorId;
professors.get({ id: professorid },
function (successResult){
vm.professor = successResult;
},
function (){
console.log("Error al obtener los datos.");
});
vm.submit = function() {
if (vm.data_input_form.$valid){
vm.course = {
"code": vm.course.code,
"name": vm.course.name,
"credits": vm.course.credits,
"description" : vm.course.description,
};
$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;
}
}
});
vm.professor.courses.push(vm.course);
professors.update({ id: professorid }, vm.professor,
function(){
$rootScope.botonOk = true;
$rootScope.urlLo = 'listarMateria';
$rootScope.mensaje =
"Materia " + vm.course.name + " creada";
},
function(){
$rootScope.botonOk = true;
$rootScope.urlLo = 'listarMateria';
$rootScope.mensaje =
"Error creando la materia " + vm.course.name;
});
}else{
vm.submitted = true;
}
}
$scope.ok = function (urlLo) {
$location.url(urlLo);
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
$rootScope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
return vm;
};
})();

View File

@@ -0,0 +1,81 @@
(function(){
'use strict';
angular
.module('app.course')
.controller('CourseListCtrl',CourseListCtrl)
CourseListCtrl.$inject =
['$scope', '$rootScope', '$state', 'professors', '$modal', 'profesorSeleccionado', 'selectedCourse'];
function CourseListCtrl($scope, $rootScope, $state, professors, $modal, profesorSeleccionado, selectedCourse) {
var vm = this;
var professorid = $rootScope.professorId;
professors.get({ id: professorid },
function (successResult){
vm.professor = successResult;
vm.course = vm.professor.courses;
},
function (){
console.log("Error al obtener los datos.");
});
vm.listarSecciones = function (index) {
selectedCourse._id = vm.course[index]._id;
$state.go('SectionList');
};
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.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: '/partials/course/modal/delete_course_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return "";
}
}
});
};
vm.eliminarMateria = function (index) {
$rootScope.botonOk = false;
$rootScope.otroBotonOk = true;
$rootScope.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";
},
function () {
$rootScope.mensaje = "Error eliminando la materia" + name;
});
};
$scope.ok = function (urlLo) {
$state.go('CourseList');
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
$rootScope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
return vm;
};
})();

View File

@@ -1,59 +0,0 @@
<div>
<form name="vm.data_input_form" role="form" novalidate
ng-submit="vm.submit()">
<div class="row clearfix">
<h4>Datos de la Materia</h4>
<br>
<div class="col-md-12 column well">
<div class="row">
<div class="col-md-6 column">
<label for="code">Código de la Materia</label>
<input type="numeric" class="form-control"
name="code" ng-model="vm.course.code"
readonly="readonly"/>
</div>
<div class="col-md-6 column">
<label for="name">Nombre de la Materia</label>
<input type="text" class="form-control"
name="name" ng-model="vm.course.name" required/>
<div class="error" ng-show="vm.submitted &&
vm.data_input_form.name.$invalid">
<small class="error"
ng-show="vm.data_input_form.name.$error.required">
El Nombre de la Materia es Obligatorio.
</small>
</div>
</div>
</div>
<div class="row clearfix"><div class="col-md-12 column"><br><br></div></div>
<div class="row">
<div class="col-md-6 column">
<label for="credits">Cantidad de Creditos</label>
<input type="numeric" class="form-control"
name="credits" ng-model="vm.course.credits" maxlength="1" placeholder="5" required/>
<div class="error" ng-show="vm.submitted &&
vm.data_input_form.credits.$invalid">
<small class="error"
ng-show="vm.data_input_form.credits.$error.required">
La Cantidad de Creditos es Obligatoria.
</small>
</div>
</div>
</div>
<div class="row clearfix"><div class="col-md-12 column"><br><br></div></div>
</div>
</div>
<div class="row clearfix">
<div class="col-md-2 column">
<div class="form-group">
<label>&nbsp;</label>
<p class="input-group">
<span class="input-group-btn">
<button type="submit" class="btn-primary btn">Modificar Materia</button>
</span>
</p>
</div>
</div>
</div>
</form>
</div>

View File

@@ -5,22 +5,19 @@
.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 = "";
loginCtrl.$inject = ['$rootScope', '$scope', '$state'];
function loginCtrl($rootScope, $scope, $state){
var vm = this;
vm.user;
vm.submit = function() {
if (vm.data_input_form.$valid){
vm.pkg = {
"Nickname": vm.user.Nickname,
"Password": $rootScope.password
"Nickname": vm.user.nickname,
"Password": vm.user.password
};
$rootScope.mensaje = "";
/*$rootScope.mensaje = "";
$rootScope.bcancel = false;
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
@@ -28,12 +25,12 @@
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return $rootScope.items;
}
items: function () {
return $rootScope.items;
}
}
});
Login.save(vm.pkg,
function(data){
if(data.Data._value != null){
@@ -58,18 +55,16 @@
},
function(){
});
}else{
vm.submitted = true;
});*/
$state.go('CourseList');
}
}
};
$rootScope.open = function($event) {
/*$rootScope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
};*/
$scope.ok = function (urlLo) {
$location.url(urlLo);
@@ -78,9 +73,6 @@
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
return vm; */
};
};
})();

View File

@@ -7,7 +7,7 @@
</div>
<div class="col-md-4 column">
<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">
<small class="error" ng-show="vm.data_input_form.nickname.$error.required">
{{'TAG_NICK_NAME_ERROR'}}
@@ -21,7 +21,7 @@
</div>
<div class="col-md-4 column">
<label for="password">Contraseña</label>
<input type="password" class="form-control" id="password" name="password" ng-model="vm.user.Password" maxlength="8" required/>
<input type="password" class="form-control" id="password" name="password" ng-model="vm.user.password" maxlength="8" required/>
<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">

View File

@@ -1,259 +0,0 @@
(function(){
'use strict';
angular
.module('app.professor')
.controller('listarProfesorCtrl', listarProfesorCtrl)
.controller('crearProfesorCtrl', crearProfesorCtrl)
.controller('actualizarProfesorCtrl', actualizarProfesorCtrl)
listarProfesorCtrl.$inject =
[ '$scope', '$rootScope', '$location', 'professors', '$modal', 'profesorSeleccionado' ];
function listarProfesorCtrl( $scope, $rootScope, $location, professors, $modal, profesorSeleccionado ){
var vm = this;
vm.lista = true;
$rootScope.actOk = false;
$rootScope.loading = true;
$rootScope.table = false;
var profesorArray = [];
professors.query(
function (successResult){
vm.profesor = successResult;
angular.forEach(vm.profesor, function (value){
profesorArray.push({
Cedula:value.id,
Nombre:value.name,
Apellido:value.lastname,
Telefono:value.number,
Correo: value.email
});
});
$rootScope.loading = false;
$rootScope.table = true;
vm.listaProfesor = profesorArray;
},
function(){
console.log("Error al obtener los datos.");
});
vm.eliminarProfesorModal = function (index) {
$rootScope.index = index;
$rootScope.botonOK = true;
$rootScope.botonCancelar = true;
$rootScope.acceptButton = false;
$rootScope.rsplice = false;
$rootScope.mensaje = "¿Seguro que desea eliminar el Profesor?";
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: 'partials/professor/modal/list_professor_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return "";
}
}
});
};
vm.eliminarProfesor = function (index) {
$rootScope.botonOK = false;
$rootScope.acceptButton = true;
$rootScope.botonCancelar = false;
$rootScope.urlLo = 'listarProfesor';
professors.delete({id: vm.profesor[index]._id},
function () {
$rootScope.rsplice = true;
$rootScope.mensaje =
"Profesor " + vm.profesor[index].name + " eliminado";
},
function () {
$rootScope.listarProfesorsLoading = false;
$rootScope.mensaje =
"Error eliminando al Profesor " + vm.profesor[index].name;
});
};
vm.removeProfesorSplice = function(index, rsplice) {
if(rsplice){
vm.listaProfesor.splice(index, 1);
$rootScope.rsplice = false;
}
};
vm.modificarProfesor = function (index) {
profesorSeleccionado._id = vm.profesor[index]._id;
profesorSeleccionado.Cedula = vm.profesor[index].id;
profesorSeleccionado.Nombre = vm.profesor[index].name;
profesorSeleccionado.Apellido= vm.profesor[index].lastname;
profesorSeleccionado.Telefono = vm.profesor[index].number;
profesorSeleccionado.Correo= vm.profesor[index].email;
$location.url('actualizarProfesor');
};
$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;
};
crearProfesorCtrl.$inject =
['$scope','$rootScope', '$location', 'professors', '$modal'];
function crearProfesorCtrl($scope, $rootScope, $location, professors, $modal){
var vm = this;
$rootScope.mensaje = "";
vm.submit = function() {
if (vm.data_input_form.$valid){
var professor = {
"id": vm.profesor.Cedula,
"name": vm.profesor.Nombre,
"lastname": vm.profesor.Apellido,
"email": vm.profesor.Correo,
"number": vm.profesor.Telefono,
"role": "professor",
"password": vm.profesor.Password
};
$rootScope.botonOk = false;
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: 'partials/professor/modal/create_professor_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return $rootScope.items;
}
}
});
professors.save(professor,
function(){
$rootScope.botonOk = true;
$rootScope.urlLo = 'listarProfesor';
$rootScope.mensaje =
"Profesor " + vm.profesor.Apellido + ", " + vm.profesor.Nombre + " agregado";
},
function(){
$rootScope.botonOk = true;
$rootScope.urlLo = 'listarProfesor';
$rootScope.mensaje =
"Error al agregar al profesor " + vm.profesor.Apellido + ", " + vm.profesor.Nombre;
});
}else{
vm.submitted = true;
}
}
$scope.ok = function (urlLo) {
$location.url(urlLo);
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
$rootScope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
return vm;
};
actualizarProfesorCtrl.$inject =
['$scope','$rootScope', '$location', 'professors', '$modal', 'profesorSeleccionado' ];
function actualizarProfesorCtrl ( $scope, $rootScope, $location, professors, $modal, profesorSeleccionado ){
var vm = this;
vm.profesor = profesorSeleccionado;
$rootScope.mensaje = "";
$rootScope.actOk = false;
vm.submit = function() {
var professor = {
"id": vm.profesor.Cedula,
"name": vm.profesor.Nombre,
"lastname": vm.profesor.Apellido,
"email": vm.profesor.Correo,
"number": vm.profesor.Telefono,
"role": "professor",
"password": vm.profesor.Password
};
$rootScope.botonOk = false;
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: 'partials/professor/modal/update_professor_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return $rootScope.items;
}
}
});
professors.update({ id: vm.profesor._id}, professor,
function(){
$rootScope.botonOk = true;
$rootScope.botonCancelar = false;
$rootScope.urlLo = 'listarProfesor';
$rootScope.mensaje =
"Profesor " + vm.profesor.Apellido + ", " + vm.profesor.Nombre + " actualizado";
},
function(){
$rootScope.botonOk = true;
$rootScope.botonCancelar = false;
$rootScope.urlLo = 'listarProfesor';
$rootScope.mensaje =
"Error al modificar al profesor " + vm.profesor.Apellido + ", " + vm.profesor.Nombre;
});
}
$scope.ok = function (urlLo) {
$location.url(urlLo);
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
$rootScope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
return vm;
};
})();

View File

@@ -14,62 +14,62 @@
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
function getRoutes($stateProvider, $urlRouterProvider){
$urlRouterProvider.otherwise('/listarProfesor');
$urlRouterProvider.otherwise('/ProfessorList');
$stateProvider
.state('listarProfesor', {
url: '/listarProfesor',
.state('ProfessorList', {
url: '/ProfessorList',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'sidebarCtrl'
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/professor/list_professor.html',
controller: 'listarProfesorCtrl',
controllerAs: 'vm'
}
}
templateUrl: 'partials/professor/professor_list.html',
controller: 'ProfessorListCtrl',
controllerAs: 'vm'
}
}
})
.state('crearProfesor', {
url: '/crearProfesor',
.state('ProfessorCreate', {
url: '/ProfessorCreate',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'sidebarCtrl'
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/professor/create_professor.html',
controller: 'crearProfesorCtrl',
controllerAs: 'vm'
}
}
templateUrl: 'partials/professor/professor_create.html',
controller: 'ProfessorCreateCtrl',
controllerAs: 'vm'
}
}
})
.state('actualizarProfesor', {
url: '/actualizarProfesor',
.state('ProfessorUpdate', {
url: '/ProfessorUpdate',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'sidebarCtrl'
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/professor/update_professor.html',
controller: 'actualizarProfesorCtrl',
controllerAs: 'vm'
}
}
templateUrl: 'partials/professor/professor_update.html',
controller: 'ProfessorUpdateCtrl',
controllerAs: 'vm'
}
}
})
};
})();

View File

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

View File

@@ -0,0 +1,76 @@
(function(){
'use strict';
angular
.module('app.professor')
.controller('ProfessorCreateCtrl', ProfessorCreateCtrl)
ProfessorCreateCtrl.$inject =
['$scope','$rootScope', '$state', 'professors', '$modal'];
function ProfessorCreateCtrl($scope, $rootScope, $state, professors, $modal){
var vm = this;
$rootScope.mensaje = "";
vm.submit = function() {
if (vm.data_input_form.$valid){
var professor = {
"id": vm.profesor.Cedula,
"name": vm.profesor.Nombre,
"lastname": vm.profesor.Apellido,
"email": vm.profesor.Correo,
"number": vm.profesor.Telefono,
"role": "professor",
"password": vm.profesor.Password
};
$rootScope.botonOk = false;
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: 'partials/professor/modal/create_professor_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return $rootScope.items;
}
}
});
professors.save(professor,
function(){
$rootScope.botonOk = true;
$rootScope.mensaje =
"Profesor " + vm.profesor.Apellido + ", " + vm.profesor.Nombre + " agregado";
},
function(){
$rootScope.botonOk = true;
$rootScope.urlLo = 'listarProfesor';
$rootScope.mensaje =
"Error al agregar al profesor " + vm.profesor.Apellido + ", " + vm.profesor.Nombre;
});
}else{
vm.submitted = true;
}
}
$scope.ok = function (urlLo) {
$state.go('ProfessorList');
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
$rootScope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
return vm;
};
})();

View File

@@ -0,0 +1,115 @@
(function(){
'use strict';
angular
.module('app.professor')
.controller('ProfessorListCtrl', ProfessorListCtrl)
ProfessorListCtrl.$inject =
[ '$scope', '$rootScope', '$state', 'professors', '$modal', 'profesorSeleccionado' ];
function ProfessorListCtrl( $scope, $rootScope, $state, professors, $modal, profesorSeleccionado ){
var vm = this;
vm.lista = true;
$rootScope.actOk = false;
$rootScope.loading = true;
$rootScope.table = false;
var profesorArray = [];
professors.query(
function (successResult){
vm.profesor = successResult;
angular.forEach(vm.profesor, function (value){
profesorArray.push({
Cedula:value.id,
Nombre:value.name,
Apellido:value.lastname,
Telefono:value.number,
Correo: value.email
});
});
$rootScope.loading = false;
$rootScope.table = true;
vm.listaProfesor = profesorArray;
},
function(){
console.log("Error al obtener los datos.");
});
vm.eliminarProfesorModal = function (index) {
$rootScope.index = index;
$rootScope.botonOK = true;
$rootScope.botonCancelar = true;
$rootScope.acceptButton = false;
$rootScope.rsplice = false;
$rootScope.mensaje = "¿Seguro que desea eliminar el Profesor?";
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: 'partials/professor/modal/list_professor_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return "";
}
}
});
};
vm.eliminarProfesor = function (index) {
$rootScope.botonOK = false;
$rootScope.acceptButton = true;
$rootScope.botonCancelar = false;
professors.delete({id: vm.profesor[index]._id},
function () {
$rootScope.rsplice = true;
$rootScope.mensaje =
"Profesor " + vm.profesor[index].name + " eliminado";
},
function () {
$rootScope.listarProfesorsLoading = false;
$rootScope.mensaje =
"Error eliminando al Profesor " + vm.profesor[index].name;
});
};
vm.removeProfesorSplice = function(index, rsplice) {
if(rsplice){
vm.listaProfesor.splice(index, 1);
$rootScope.rsplice = false;
}
};
vm.modificarProfesor = function (index) {
profesorSeleccionado._id = vm.profesor[index]._id;
profesorSeleccionado.Cedula = vm.profesor[index].id;
profesorSeleccionado.Nombre = vm.profesor[index].name;
profesorSeleccionado.Apellido = vm.profesor[index].lastname;
profesorSeleccionado.Telefono = vm.profesor[index].number;
profesorSeleccionado.Correo = vm.profesor[index].email;
$state.go('ProfessorUpdate');
};
$rootScope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
$scope.ok = function (urlLo) {
$state.go('ProfessorList');
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
return vm;
};
})();

View File

@@ -0,0 +1,73 @@
(function(){
'use strict';
angular
.module('app.professor')
.controller('ProfessorUpdateCtrl', ProfessorUpdateCtrl)
ProfessorUpdateCtrl.$inject =
['$scope','$rootScope', '$state', 'professors', '$modal', 'profesorSeleccionado' ];
function ProfessorUpdateCtrl ( $scope, $rootScope, $state, professors, $modal, profesorSeleccionado ){
var vm = this;
vm.profesor = profesorSeleccionado;
$rootScope.mensaje = "";
$rootScope.actOk = false;
vm.submit = function() {
var professor = {
"id": vm.profesor.Cedula,
"name": vm.profesor.Nombre,
"lastname": vm.profesor.Apellido,
"email": vm.profesor.Correo,
"number": vm.profesor.Telefono,
"role": "professor",
"password": vm.profesor.Password
};
$rootScope.botonOk = false;
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: 'partials/professor/modal/update_professor_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return $rootScope.items;
}
}
});
professors.update({ id: vm.profesor._id}, professor,
function(){
$rootScope.botonOk = true;
$rootScope.botonCancelar = false;
$rootScope.mensaje =
"Profesor " + vm.profesor.Apellido + ", " + vm.profesor.Nombre + " actualizado";
},
function(){
$rootScope.botonOk = true;
$rootScope.botonCancelar = false;
$rootScope.mensaje =
"Error al modificar al profesor " + vm.profesor.Apellido + ", " + vm.profesor.Nombre;
});
}
$scope.ok = function (urlLo) {
$state.go('ProfessorList');
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
$rootScope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
return vm;
};
})();

View File

@@ -0,0 +1,57 @@
(function(){
'use strict';
angular
.module('app.reports')
.controller('CourseAssistCtrl', CourseAssistCtrl)
CourseAssistCtrl.$inject =
['$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedCourse'];
function CourseAssistCtrl($scope, $rootScope, $state, professors, $modal, selectedCourse) {
var vm = this;
var professorid = $rootScope.professorId;
vm.course = null;
vm.lectures = 0;
vm.percentage = 0;
vm.positive = 0;
vm.professor = null;
vm.negative = 0;
professors.get({ id: professorid },
function (successResult){
vm.professor = successResult;
angular.forEach (vm.professor.courses,
function (value, key){
if (value._id == selectedCourse._id ) {
selectedCourse.index = key;
vm.course = value;
}
});
angular.forEach (vm.course.sections,
function (value){
angular.forEach (value.students,
function (valued){
vm.lectures = valued.assistance;
angular.forEach (valued.assistanceTotal,
function (valueda){
if (valueda.assistance) {
vm.positive++;
} else {
vm.negative++;
}
});
});
});
vm.total = vm.positive + vm.negative;
vm.percentage = ((vm.positive/vm.total)/vm.lectures)*100;
},
function (){
console.log("Error al obtener los datos.");
});
vm.back = function (index) {
$state.go('courseReport');
};
};
})();

View File

@@ -0,0 +1,16 @@
<div class="row clearfix col-md-12">
<h4>Asistencia de Materia {{vm.course.name}}</h4>
<br>
</br>
<div class= "row clearfix col-md-12">
<div> Estadisticas </div>
<div> Porcentaje de Asistencia: {{vm.percentage}} % </div>
<div> Total de Dias de Clase: {{vm.lectures}} </div>
</div>
<button class = "btn-warning btn"
type = "button"
style = "margin: 10px"
ng-click = "vm.back()">
Regresar
</button>
</div>

View File

@@ -0,0 +1,43 @@
(function(){
'use strict';
angular
.module('app.reports')
.controller('CourseReportCtrl', CourseReportCtrl)
CourseReportCtrl.$inject =
['$scope', '$rootScope', '$state', 'professors', '$modal', 'profesorSeleccionado', 'selectedCourse'];
function CourseReportCtrl($scope, $rootScope, $state, professors, $modal, profesorSeleccionado, selectedCourse) {
var vm = this;
var professorid = $rootScope.professorId;
professors.get({ id: professorid },
function (successResult){
vm.professor = successResult;
vm.course = vm.professor.courses;
},
function (){
console.log("Error al obtener los datos.");
});
vm.courseReports = function (index) {
selectedCourse._id = vm.course[index]._id;
$state.go('courseAssist');
};
vm.listSections = function (index) {
selectedCourse._id = vm.course[index]._id;
$state.go('sectionReport');
};
$scope.ok = function () {
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
};
})();

View File

@@ -0,0 +1,53 @@
<div class="row clearfix">
<h4>Reportes de Materias</h4>
<br>
</br>
<div>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th width="10%" style="text-align: center">
Código
</th>
<th width="20%" style="text-align: center">
Nombre
</th>
<th width="5%" style="text-align: center">
Creditos
</th>
<th width="40%" style="text-align: center">
Descripción
</th>
<th width="15%" style="text-align: center">
Reportes de Materia
</th>
<th width="10%" style="text-align: center">
Secciones
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="course in vm.course">
<td style="vertical-align:middle">{{ course.code }}</td>
<td style="vertical-align:middle">{{ course.name }}</td>
<td style="vertical-align:middle">{{ course.credits }}</td>
<td style="vertical-align:middle">{{ course.description }}</td>
<td style="text-align: center">
<span
class="glyphicon glyphicon-list-alt"
aria-hidden="true"
ng-click="vm.courseReports($index)"
style="cursor:pointer"></span>
</td>
<td style="text-align: center">
<span
class="glyphicon glyphicon-list"
aria-hidden="true"
ng-click="vm.listSections($index)"
style="cursor:pointer"></span>
</td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@@ -1,105 +0,0 @@
(function(){
'use strict';
angular
.module('app.reports')
.controller('poblacionNacimientoCtrl', poblacionNacimientoCtrl)
.controller('poblacionActivaCtrl', poblacionActivaCtrl)
.controller('hombresEdadCtrl', hombresEdadCtrl)
.controller('mujeresEdadCtrl', mujeresEdadCtrl)
.controller('comidasDiaCtrl', comidasDiaCtrl)
.controller('nivelEducacionCtrl', nivelEducacionCtrl)
.controller('serviciosHogaresCtrl', serviciosHogaresCtrl)
.controller('ingresosAnualesCtrl', ingresosAnualesCtrl)
poblacionNacimientoCtrl.$inject = ['$rootScope', 'ReportJson'];
function poblacionNacimientoCtrl($rootScope, ReportJson){
$rootScope.labelPoblacionNacimiento = ['Extranjeros', 'Residentes'];
ReportJson.get({id:$rootScope.elementId}, function(data) {
$rootScope.dataPoblacionNacimiento = data.Data[0].dataPoblacionNacimiento;
});
};
poblacionActivaCtrl.$inject = ['$rootScope', 'ReportJson'];
function poblacionActivaCtrl($rootScope, ReportJson){
$rootScope.labelsPoblacionActiva = ['Hombres', 'Mujeres'];
$rootScope.seriesPoblacionActiva = ['Economicamente Pasivos', 'Economicamente Activos'];
$rootScope.dataPoblacionActiva = [];
ReportJson.get({id:$rootScope.elementId},function(data) {
$rootScope.dataPoblacionActiva = data.Data[0].dataPoblacionActiva;
});
};
hombresEdadCtrl.$inject = ['$rootScope', 'ReportJson'];
function hombresEdadCtrl($rootScope, ReportJson){
$rootScope.labelsHombresEdad = ['0-6', '7-12','13-18', '19-25','26-44', '45-60','61-99', '80-84', '90+'];
$rootScope.seriesHombresEdad = ['Hombres por Generacion'];
$rootScope.dataHombresEdad = [];
ReportJson.get({id:$rootScope.elementId},function(data) {
$rootScope.dataHombresEdad = data.Data[0].dataHombresEdad;
});
};
mujeresEdadCtrl.$inject = ['$rootScope', 'ReportJson'];
function mujeresEdadCtrl($rootScope, ReportJson){
$rootScope.labelsMujeresEdad = ['0-6', '7-12','13-18', '19-25','26-44', '45-60','61-99', '80-84', '90+'];
$rootScope.seriesMujeresEdad = ['Mujeres por Generacion'];
$rootScope.dataMujeresEdad = [];
ReportJson.get({id:$rootScope.elementId},function(data) {
$rootScope.dataMujeresEdad = data.Data[0].dataMujeresEdad;
});
};
comidasDiaCtrl.$inject = ['$rootScope', 'ReportJson'];
function comidasDiaCtrl($rootScope, ReportJson){
$rootScope.labelsComidasDia = ['Desayuno', 'Almuerzo', 'Cena'];
$rootScope.dataComidasDia = [];
ReportJson.get({id:$rootScope.elementId},function(data) {
$rootScope.dataComidasDia = [data.Data[0].dataComidasDia];
});
};
nivelEducacionCtrl.$inject = ['$rootScope', 'ReportJson'];
function nivelEducacionCtrl($rootScope, ReportJson){
$rootScope.labelsNivelEducacion = ['Nivel de Educacion Superior', 'Nivel de Educacion Media'];
ReportJson.get({id:$rootScope.elementId},function(data) {
$rootScope.dataNivelEducacion = data.Data[0].dataNivelEducacion;
});
};
serviciosHogaresCtrl.$inject = ['$rootScope', 'ReportJson'];
function serviciosHogaresCtrl($rootScope, ReportJson){
$rootScope.labelsServiciosHogares = ['Agua', 'Gas', 'Electricidad' , 'Linea Telefonica'];
$rootScope.dataServiciosHogares = [];
ReportJson.get({id:$rootScope.elementId},function(data) {
$rootScope.dataServiciosHogares = [data.Data[0].dataServiciosHogares];
});
};
ingresosAnualesCtrl.$inject = ['$rootScope', 'ReportJson'];
function ingresosAnualesCtrl($rootScope, ReportJson){
$rootScope.labelsIngresosAnuales = ['Menos de 10.000', 'De 11.000 a 20.000', 'De 21.000 a 35.000' , 'De 35.000 a 50.000'];
ReportJson.get({id:$rootScope.elementId},function(data) {
$rootScope.dataIngresosAnuales = data.Data[0].dataIngresosAnuales;
});
};
})();

View File

@@ -1,116 +0,0 @@
<section>
<div class="page-header">
<h1>Reportes</h1>
</div>
<div class="row">
<div class="col-lg-6 col-sm-12 ng-scope"
ng-controller="poblacionNacimientoCtrl">
<div class="panel panel-default">
<div class="panel-heading">Reporte Alumno
</div>
<div class="panel-body">
<div class="chart-container">
<canvas class="chart chart-pie"
chart-data="dataPoblacionNacimiento"
chart-labels="labelPoblacionNacimiento"></canvas>
<chart-legend>
<ul class="line-legend">
<li><span style="background-color:rgba(151,187,205,1)"></span>{{'TAG_FOREIGN' }} </li>
<li><span style="background-color:rgba(220,220,220,1)"></span>{{'TAG_RESIDENT' }} </li>
</ul>
</chart-legend>
</div>
</div>
</div>
</div>
<div class="col-lg-6 col-sm-12 code">
<div class="ng-isolate-scope">
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-sm-12 code">
<div class="ng-isolate-scope">
</div>
</div>
<div class="row">
<div class="col-lg-6 col-sm-12 ng-scope"
ng-controller="poblacionActivaCtrl">
<div class="panel panel-default">
<div class="panel-heading">Reporte por Clase
</div>
<div class="panel-body">
<div class="chart-container">
<canvas class="chart chart-bar"
chart-data="dataPoblacionActiva"
chart-labels="labelsPoblacionActiva"
chart-series="seriesPoblacionActiva"></canvas>
<chart-legend>
<ul class="line-legend">
<li><span style="background-color:rgba(151,187,205,1)"></span>{{'TAG_ECONOMIC_PASSIVE' }} </li>
<li><span style="background-color:rgba(220,220,220,1)"></span>{{'TAG_ECONOMIC_ACTIVE' }} </li>
</ul>
</chart-legend>
</div>
</div>
</div>
</div>
<div class="col-lg-6 col-sm-12 code">
<div class="ng-isolate-scope">
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-sm-12 ng-scope"
ng-controller="hombresEdadCtrl">
<div class="panel panel-default">
<div class="panel-heading">Reporte por Sección
</div>
<div class="panel-body">
<div class="chart-container">
<canvas class="chart chart-bar"
chart-data="dataHombresEdad"
chart-labels="labelsHombresEdad"
chart-series="seriesHombresEdad"></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-sm-12 code">
<div class="ng-isolate-scope">
</div>
</div>
<div class="row">
<div class="col-lg-6 col-sm-12 ng-scope"
ng-controller="mujeresEdadCtrl">
<div class="panel panel-default">
<div class="panel-heading">Reporte por Materia
</div>
<div class="panel-body">
<div class="chart-container">
<canvas class="chart chart-bar"
chart-data="dataMujeresEdad"
chart-labels="labelsMujeresEdad"
chart-series="seriesMujeresEdad"></canvas>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-6 col-sm-12 code">
<div class="ng-isolate-scope">
</div>
</div>
</div>
</section>

View File

@@ -14,68 +14,110 @@
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
function getRoutes($stateProvider, $urlRouterProvider){
$urlRouterProvider.otherwise('/reportes');
$urlRouterProvider.otherwise('/reportesPorMateria');
$stateProvider
.state('poblacionNacimiento', {
url: '/reportes',
.state('courseReport', {
url: '/reportesPorMateria',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'sidebarCtrl'
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/reportes/reportes.html',
controller: 'poblacionNacimientoCtrl',
controllerAs: 'vm'
}
}
templateUrl: 'partials/report/course_report.html',
controller: 'CourseReportCtrl',
controllerAs: 'vm'
}
}
})
.state('poblacionActiva', {
url: '/poblacionActivaCtrl',
templateUrl: 'partials/reportes/reportes.html',
controller: 'poblacionActivaCtrl',
controllerAs: 'vm'
.state('sectionReport', {
url: '/reportesPorSeccion',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/report/section_report.html',
controller: 'SectionReportCtrl',
controllerAs: 'vm'
}
}
})
.state('hombresEdad', {
url: '/hombresEdad',
templateUrl: 'partials/reportes/reportes.html',
controller: 'hombresEdadCtrl',
controllerAs: 'vm'
.state('studentReport', {
url: '/reportesPorEstudiante',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/report/student_report.html',
controller: 'StudentReportCtrl',
controllerAs: 'vm'
}
}
})
.state('mujeresEdad', {
url: '/mujeresEdad',
templateUrl: 'partials/reportes/reportes.html',
controller: 'mujeresEdadCtrl',
controllerAs: 'vm'
.state('studentAssist', {
url: '/asistenciaPorEstudiante',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/report/student_assist.html',
controller: 'StudentAssistCtrl',
controllerAs: 'vm'
}
}
})
.state('comidasDia', {
url: '/comidasDia',
templateUrl: 'partials/reportes/reportes.html',
controller: 'comidasDiaCtrl',
controllerAs: 'vm'
.state('sectionAssist', {
url: '/asistenciaPorSeccion',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/report/section_assist.html',
controller: 'SectionAssistCtrl',
controllerAs: 'vm'
}
}
})
.state('nivelEducacion', {
url: '/nivelEducacion',
templateUrl: 'partials/reportes/reportes.html',
controller: 'nivelEducacionCtrl',
controllerAs: 'vm'
})
.state('serviciosHogares', {
url: '/serviciosHogares',
templateUrl: 'partials/reportes/reportes.html',
controller: 'serviciosHogaresCtrl',
controllerAs: 'vm'
})
.state('ingresosAnuales', {
url: '/ingresosAnuales',
templateUrl: 'partials/reportes/reportes.html',
controller: 'ingresosAnualesCtrl',
controllerAs: 'vm'
.state('courseAssist', {
url: '/asistenciaPorMateria',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/report/course_assist.html',
controller: 'CourseAssistCtrl',
controllerAs: 'vm'
}
}
})
};
})();

View File

@@ -3,14 +3,14 @@
angular
.module('app.reports')
.factory('ReportJson', ReportJson)
//.factory('ReportJson', ReportJson)
.value('id',{})
ReportJson.$inject = ['$resource','$rootScope'];
/*ReportJson.$inject = ['$resource','$rootScope'];
function ReportJson($resource, $rootScope){
return $resource('http://'+$rootScope.domainUrl+'/api/reports/:id');
//var json="data/data.json";
//return $resource(json);
};
//return $resource('http://'+$rootScope.domainUrl+'/api/reports/:id');
var json="data/data.json";
return $resource(json);
};*/
})();

View File

@@ -0,0 +1,54 @@
(function(){
'use strict';
angular
.module('app.reports')
.controller('SectionAssistCtrl', SectionAssistCtrl)
SectionAssistCtrl.$inject =
['$scope', '$rootScope','$state', 'professors', '$modal', 'selectedCourse', 'selectedSection', 'selectedStudent'];
function SectionAssistCtrl($scope, $rootScope, $state, professors, $modal, selectedCourse, selectedSection, selectedStudent) {
var vm = this;
var professorid = $rootScope.professorId;
vm.section = [];
vm.lectures = 0;
vm.percentage = 0;
vm.positive = 0;
vm.professor = null;
vm.negative = 0;
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.section = value;
}
});
angular.forEach (vm.section.students,
function (value){
vm.lectures = value.assistance;
angular.forEach (value.assistanceTotal,
function (valued){
if (valued.assistance) {
vm.positive++;
} else {
vm.negative++;
}
});
});
vm.total = vm.positive + vm.negative;
vm.percentage = ((vm.positive/vm.total)/vm.lectures)*100;
},
function (){
console.log("Error al obtener los datos.");
});
vm.back = function (index) {
$state.go('sectionReport');
};
};
})();

View File

@@ -0,0 +1,16 @@
<div class="row clearfix col-md-12">
<h4>Asistencia de Sección {{vm.section.name}}</h4>
<br>
</br>
<div class= "row clearfix col-md-12">
<div> Estadisticas </div>
<div> Porcentaje de Asistencia: {{vm.percentage}} % </div>
<div> Total de Dias de Clase: {{vm.lectures}} </div>
</div>
<button class = "btn-warning btn"
type = "button"
style = "margin: 10px"
ng-click = "vm.back()">
Regresar
</button>
</div>

View File

@@ -0,0 +1,56 @@
(function(){
'use strict';
angular
.module('app.reports')
.controller('SectionReportCtrl', SectionReportCtrl)
SectionReportCtrl.$inject =
['$scope', '$rootScope', '$state', 'professors', '$modal', 'profesorSeleccionado', 'selectedCourse', 'selectedSection'];
function SectionReportCtrl($scope, $rootScope, $state, professors, $modal, profesorSeleccionado, selectedCourse, selectedSection) {
var vm = this;
var professorid = $rootScope.professorId;
vm.section = [];
vm.professor = null;
professors.get({ id: professorid },
function (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 (){
console.log("Error al obtener los datos.");
});
vm.back = function (index) {
$state.go('courseReport');
};
vm.sectionReport = function (index) {
selectedSection._id = vm.section[index]._id;
selectedCourse.index = vm.index;
$state.go('sectionAssist');
};
vm.listStudents = function (index) {
selectedSection._id = vm.section[index]._id;
selectedCourse.index = vm.index;
$state.go('studentReport');
};
$scope.ok = function () {
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
};
})();

View File

@@ -0,0 +1,57 @@
<div class="row clearfix">
<h4>Reportes de Secciones</h4>
<br>
</br>
<div>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th width="20%" style="text-align: center">
Sección
</th>
<th width="20%" style="text-align: center">
Nombre de la Materia
</th>
<th width="20%" style="text-align: center">
Codigo de la Materia
</th>
<th width="10%" style="text-align: center">
Semestre
</th>
<th width="20%" style="text-align: center">
Reportes por Sección
</th>
<th width="10%" style="text-align: center">
Estudiantes
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat = "section in vm.section">
<td style="vertical-align:middle">{{ section.name }}</td>
<td style="vertical-align:middle">{{ section.course }}</td>
<td style="vertical-align:middle">{{ section.code }}</td>
<td style="vertical-align:middle">{{ section.semester }}</td>
<td style="text-align: center">
<span class="glyphicon glyphicon-list-alt"
aria-hidden="true"
ng-click="vm.sectionReport($index)"
style="cursor:pointer"></span>
</td>
<td style="text-align: center">
<span class="glyphicon glyphicon-list"
aria-hidden="true"
ng-click="vm.listStudents($index)"
style="cursor:pointer"></span>
</td>
</tr>
</tbody>
</table>
</div>
<button class = "btn-warning btn"
type = "button"
style = "margin: 10px"
ng-click = "vm.back()">
Regresar
</button>
</div>

View File

@@ -0,0 +1,52 @@
(function(){
'use strict';
angular
.module('app.reports')
.controller('StudentAssistCtrl', StudentAssistCtrl)
StudentAssistCtrl.$inject =
['$scope', '$rootScope','$state', 'professors', '$modal', 'selectedCourse', 'selectedSection', 'selectedStudent'];
function StudentAssistCtrl($scope, $rootScope, $state, professors, $modal, selectedCourse, selectedSection, selectedStudent) {
var vm = this;
var professorid = $rootScope.professorId;
vm.section = [];
vm.lectures = 0;
vm.percentage = 0;
vm.positive = 0;
vm.professor = null;
vm.negative = 0;
professors.get({ id: professorid },
function (successResult){
vm.professor = successResult;
angular.forEach (vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students,
function (value, key){
if (value._id == selectedStudent._id ) {
selectedStudent.index = key;
vm.assistances = value.assistanceTotal;
vm.student = value;
vm.lectures = value.assistance;
}
});
angular.forEach (vm.assistances,
function (value){
if (value.assistance) {
vm.positive++;
} else {
vm.negative++;
}
});
vm.total = vm.positive + vm.negative;
vm.percentage = ((vm.positive/vm.total)/vm.lectures)*100;
},
function (){
console.log("Error al obtener los datos.");
});
vm.back = function (index) {
$state.go('studentReport');
};
};
})();

View File

@@ -0,0 +1,42 @@
<div class="row clearfix col-md-6">
<h4>Asistencia - {{vm.student.lastname}}, {{vm.student.name}}</h4>
<br>
</br>
<div class= "row clearfix col-md-6">
<div> Estadisticas </div>
<div ng-style="vm.percentage < 75 && {'color': 'red'} || vm.percentage >76 && {'color': 'green'}"> Porcentaje de Asistencia: {{vm.percentage}} % </div>
<div> Total de Dias de Clase: {{vm.lectures}} </div>
<div> Total de Asistencias: {{vm.positive}} </div>
<div> Total de Inasistencias: {{vm.negative}} </div>
<br>
</div>
<div>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th width="20%" style="text-align: center">
Dia
</th>
<th width="20%" style="text-align: center">
Asistencia
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="assistance in vm.assistances">
<td style="vertical-align:middle">{{ assistance.day }}</td>
<td ng-style="assistance.assistance === false && {'color': 'red'} || assistance.assistance === true && {'color': 'green'}"
style="vertical-align:middle">{{ assistance.assistance }}
</td>
</tr>
</tbody>
</table>
</div>
<button class = "btn-warning btn"
type = "button"
style = "margin: 10px"
ng-click = "vm.back()">
Regresar
</button>
</div>

View File

@@ -0,0 +1,49 @@
(function(){
'use strict';
angular
.module('app.reports')
.controller('StudentReportCtrl', StudentReportCtrl)
StudentReportCtrl.$inject =
['$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedCourse', 'selectedSection', 'selectedStudent'];
function StudentReportCtrl($scope, $rootScope, $state, professors, $modal, selectedCourse, selectedSection, selectedStudent) {
var vm = this;
var professorid = $rootScope.professorId;
vm.section = [];
vm.professor = null;
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.studentReports = function (index) {
selectedStudent._id = vm.students[index]._id;
$state.go('studentAssist');
};
vm.back = function (index) {
$state.go('sectionReport');
};
$scope.ok = function () {
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
};
})();

View File

@@ -0,0 +1,44 @@
<div class="row clearfix">
<h4>Reportes de Estudiantes</h4>
<br>
</br>
<div>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th width="20%" style="text-align: center">
Cedula
</th>
<th width="20%" style="text-align: center">
Nombre
</th>
<th width="20%" style="text-align: center">
Apellido
</th>
<th width="20%" style="text-align: center">
Reportes por Estudiante
</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.name }}</td>
<td style="vertical-align:middle">{{ student.lastname }}</td>
<td style="text-align: center">
<span class="glyphicon glyphicon-list-alt"
aria-hidden="true"
ng-click="vm.studentReports($index)"
style="cursor:pointer"></span>
</td>
</tr>
</tbody>
</table>
</div>
<button class = "btn-warning btn"
type = "button"
style = "margin: 10px"
ng-click = "vm.back()">
Regresar
</button>
</div>

View File

@@ -1,328 +0,0 @@
(function(){
'use strict';
angular
.module('app.section')
.controller('listarMatriculaCtrl', listarMatriculaCtrl)
.controller('crearMatriculaCtrl', crearMatriculaCtrl)
.controller('actualizarMatriculaCtrl', actualizarMatriculaCtrl)
listarMatriculaCtrl.$inject = [ '$scope', '$rootScope', '$location', 'professors', '$modal', 'selectedCourse', 'selectedSection'];
function listarMatriculaCtrl ( $scope, $rootScope, $location, professors, $modal, selectedCourse, selectedSection ){
var vm = this;
var professorid = '56f5fd3a20047f3c15b05f0e';
vm.section = [];
vm.professor = null;
professors.get({ id: professorid },
function (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 (){
console.log("Error al obtener los datos.");
});
/**************************Eliminar Matricula**************************/
/* En este proceso, primero se llama a un Modal el cual se cerciora que
el usuario se asegure de eliminar la matricula escogida, el usuario al
confirmar su decision llama automaticamente a la funcion que hara la
llamada a servicio que borrara la matricula de la base de datos.
*/
vm.createSection = function () {
$location.url('crearMatricula');
};
vm.eliminarMatriculaModal = function (index) {
$rootScope.index = index;
$rootScope.botonOk = true;
$rootScope.otroBotonOk = false;
$rootScope.botonCancelar = true;
$rootScope.rsplice = false;
$rootScope.mensaje = "¿Seguro que desea eliminar la sección?";
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: '/partials/section/modal/delete_section_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return "";
}
}
});
};
vm.eliminarMatricula = function (index) {
$rootScope.botonOk = false;
$rootScope.otroBotonOk = true;
$rootScope.botonCancelar = false;
$rootScope.urlLo = 'listarMatricula';
var name = vm.section[index].name;
vm.professor.courses[vm.index].sections.splice(index, 1);
professors.update({ id: professorid }, vm.professor,
function () {
$rootScope.rsplice = true;
$rootScope.mensaje = "Sección " + name + " eliminada";
},
function () {
$rootScope.mensaje = "Error eliminando la sección " + name;
});
};
vm.eliminarMatriculaSplice = function (index, rsplice) {
if(rsplice){
}
};
/*************************Fin de Eliminar Matricula*******************/
vm.modificarMatricula = function (index) {
selectedSection._id = vm.section[index]._id;
selectedCourse.index = vm.index;
$location.url('actualizarMatricula');
};
$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;
};
crearMatriculaCtrl.$inject =
['$scope','$rootScope', '$location', 'professors', '$modal', 'selectedCourse'];
function crearMatriculaCtrl($scope, $rootScope, $location, professors, $modal, selectedCourse){
var professorid = '56f5fd3a20047f3c15b05f0e';
var vm = this;
vm.course = {};
vm.selectedCourse = selectedCourse;
vm.submitted = false;
vm.semester, vm.section, vm.materias;
$rootScope.mensaje = "";
vm.students = [];
professors.get({ id: professorid },
function (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 (){
console.log("Error al obtener los datos.");
});
vm.submit = function () {
if (vm.data_input_form.$valid){
vm.package = {
"name": vm.name,
"code": vm.course.code,
"course": vm.course.name,
"semester": vm.semester,
"students": vm.students
};
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: 'partials/section/modal/create_section_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return $rootScope.items;
}
}
});
vm.professor.courses[vm.index].sections.push(vm.package);
professors.update({ id: professorid }, vm.professor,
function(){
$rootScope.botonOk = true;
$rootScope.urlLo = 'listarMatricula';
$rootScope.mensaje = "Sección " + vm.name + " creada";
},
function(){
$rootScope.botonOk = true;
$rootScope.urlLo = 'listarMatricula';
$rootScope.mensaje = "Error creando la seccion " + vm.name;
});
}else{
vm.submitted = true;
}
};
var xlf = document.getElementById('xlf');
function handleFile(e) {
var files = e.target.files;
var i,f,z;
var student = {};
for (i = 0, f = files[i]; i != files.length; ++i) {
var reader = new FileReader();
var name = f.name;
reader.onload = function(e) {
var data = e.target.result;
var workbook = XLSX.read(data, {type: 'binary'});
var sheet = workbook.SheetNames[0];
var worksheet = workbook.Sheets[sheet];
/* Find desired cell containing semester and section */
vm.semester = worksheet['B5'].v;
vm.name = worksheet['B9'].v;
//$scope.$apply();
for (z in worksheet) {
/* all keys that do not begin with "!" correspond to cell addresses */
if (z[0] === '!') continue;
if ((z[0] >'B') && (z[1] > 0) && (z[2] > 1)) {
/* 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] =='D') student.name = worksheet[z].v;
if (z[0] =='E') 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*/
vm.students.push(student);
student = {};
}
}
};
$scope.$apply();
};
reader.readAsBinaryString(f);
}
}
if(xlf.addEventListener) xlf.addEventListener('change', handleFile, false);
$scope.ok = function (urlLo) {
$location.url(urlLo);
$scope.modalInstance.dismiss('cancel');
};
$rootScope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
return vm;
};
actualizarMatriculaCtrl.$inject = ['$scope', '$rootScope', '$location', 'professors', '$modal', 'selectedSection', 'selectedCourse'];
function actualizarMatriculaCtrl($scope, $rootScope, $location, professors, $modal, selectedSection, selectedCourse){
var professorid = '56f5fd3a20047f3c15b05f0e';
var vm = this;
vm.section = {};
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.addStudent = function (index) {
$location.url('crearEstudiante');
};
vm.retirarEstudianteModal = function (index) {
$rootScope.index = index;
$rootScope.botonOk = true;
$rootScope.otroBotonOk = false;
$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',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return "";
}
}
});
};
vm.retirarEstudiante = function (index) {
vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students.splice(index, 1);
professors.update({ id: professorid }, vm.professor,
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) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
$scope.ok = function () {
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
return vm;
};
})();

View File

@@ -14,59 +14,59 @@
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
function getRoutes($stateProvider, $urlRouterProvider){
$urlRouterProvider.otherwise('/listarMatricula');
$urlRouterProvider.otherwise('/SectionList');
$stateProvider
.state('listarMatricula', {
url: '/listarMatricula',
.state('SectionList', {
url: '/SectionList',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'sidebarCtrl'
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/section/list_section.html',
controller: 'listarMatriculaCtrl',
templateUrl: 'partials/section/section_list.html',
controller: 'SectionListCtrl',
controllerAs: 'vm'
}
}
})
.state('crearMatricula', {
url: '/crearMatricula',
.state('SectionCreate', {
url: '/SectionCreate',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'sidebarCtrl'
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/section/create_section.html',
controller: 'crearMatriculaCtrl',
templateUrl: 'partials/section/section_create.html',
controller: 'SectionCreateCtrl',
controllerAs: 'vm'
}
}
})
.state('actualizarMatricula', {
url: '/actualizarMatricula',
.state('SectionUpdate', {
url: '/SectionUpdate',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'sidebarCtrl'
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/section/update_section.html',
controller: 'actualizarMatriculaCtrl',
templateUrl: 'partials/section/section_update.html',
controller: 'SectionUpdateCtrl',
controllerAs: 'vm'
}
}

View File

@@ -0,0 +1,134 @@
(function(){
'use strict';
angular
.module('app.section')
.controller('SectionCreateCtrl', SectionCreateCtrl)
SectionCreateCtrl.$inject =
['$scope','$rootScope', '$state', 'professors', '$modal', 'selectedCourse'];
function SectionCreateCtrl($scope, $rootScope, $state, professors, $modal, selectedCourse){
var professorid = $rootScope.professorId;
var vm = this;
vm.course = {};
vm.selectedCourse = selectedCourse;
vm.submitted = false;
vm.semester, vm.section, vm.materias;
$rootScope.mensaje = "";
vm.students = [];
professors.get({ id: professorid },
function (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 (){
console.log("Error al obtener los datos.");
});
vm.submit = function () {
if (vm.data_input_form.$valid){
vm.package = {
"name": vm.name,
"code": vm.course.code,
"course": vm.course.name,
"semester": vm.semester,
"students": vm.students
};
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: 'partials/section/modal/create_section_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return $rootScope.items;
}
}
});
vm.professor.courses[vm.index].sections.push(vm.package);
professors.update({ id: professorid }, vm.professor,
function(){
$rootScope.botonOk = true;
$rootScope.mensaje = "Sección " + vm.name + " creada";
},
function(){
$rootScope.botonOk = true;
$rootScope.mensaje = "Error creando la seccion " + vm.name;
});
}else{
vm.submitted = true;
}
};
var xlf = document.getElementById('xlf');
function handleFile(e) {
var files = e.target.files;
var i,f,z;
var student = {};
for (i = 0, f = files[i]; i != files.length; ++i) {
var reader = new FileReader();
var name = f.name;
reader.onload = function(e) {
var data = e.target.result;
var workbook = XLSX.read(data, {type: 'binary'});
var sheet = workbook.SheetNames[0];
var worksheet = workbook.Sheets[sheet];
/* Find desired cell containing semester and section */
vm.semester = worksheet['B5'].v;
vm.name = worksheet['B9'].v;
//$scope.$apply();
for (z in worksheet) {
/* all keys that do not begin with "!" correspond to cell addresses */
if (z[0] === '!') continue;
if ((z[0] >'B') && (z[1] > 0) && (z[2] > 1)) {
/* 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] =='D') student.name = worksheet[z].v;
if (z[0] =='E') 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*/
vm.students.push(student);
student = {};
}
}
};
$scope.$apply();
};
reader.readAsBinaryString(f);
}
}
if(xlf.addEventListener) xlf.addEventListener('change', handleFile, false);
$scope.ok = function (urlLo) {
$state.go('SectionList');
$scope.modalInstance.dismiss('cancel');
};
$rootScope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
return vm;
};
})();

View File

@@ -0,0 +1,115 @@
(function(){
'use strict';
angular
.module('app.section')
.controller('SectionListCtrl', SectionListCtrl)
SectionListCtrl.$inject = [ '$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedCourse', 'selectedSection'];
function SectionListCtrl ( $scope, $rootScope, $state, professors, $modal, selectedCourse, selectedSection ){
var vm = this;
var professorid = $rootScope.professorId;
vm.section = [];
vm.professor = null;
professors.get({ id: professorid },
function (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 (){
console.log("Error al obtener los datos.");
});
/**************************Eliminar Matricula**************************/
/* En este proceso, primero se llama a un Modal el cual se cerciora que
el usuario se asegure de eliminar la matricula escogida, el usuario al
confirmar su decision llama automaticamente a la funcion que hara la
llamada a servicio que borrara la matricula de la base de datos.
*/
vm.createSection = function () {
$state.go('SectionCreate');
};
vm.eliminarMatriculaModal = function (index) {
$rootScope.index = index;
$rootScope.botonOk = true;
$rootScope.otroBotonOk = false;
$rootScope.botonCancelar = true;
$rootScope.rsplice = false;
$rootScope.mensaje = "¿Seguro que desea eliminar la sección?";
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: '/partials/section/modal/delete_section_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return "";
}
}
});
};
vm.eliminarMatricula = function (index) {
$rootScope.botonOk = false;
$rootScope.otroBotonOk = true;
$rootScope.botonCancelar = false;
var name = vm.section[index].name;
vm.professor.courses[vm.index].sections.splice(index, 1);
professors.update({ id: professorid }, vm.professor,
function () {
$rootScope.rsplice = true;
$rootScope.mensaje = "Sección " + name + " eliminada";
},
function () {
$rootScope.mensaje = "Error eliminando la sección " + name;
});
};
vm.eliminarMatriculaSplice = function (index, rsplice) {
if(rsplice){
}
};
/*************************Fin de Eliminar Matricula*******************/
vm.modificarMatricula = function (index) {
selectedSection._id = vm.section[index]._id;
selectedCourse.index = vm.index;
$state.go('SectionUpdate');
};
$rootScope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
$scope.ok = function (urlLo) {
$state.go('SectionList');
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
vm.back = function () {
$state.go('CourseList');
};
return vm;
};
})();

View File

@@ -57,5 +57,5 @@
</tbody>
</table>
</div>
<a href="#listarMateria" class="btn-warning btn" style=" margin: 10px">Regresar</a>
<a class="btn-warning btn" style="margin: 10px" ng-click="vm.back()">Regresar</a>
</div>

View File

@@ -0,0 +1,95 @@
(function(){
'use strict';
angular
.module('app.section')
.controller('SectionUpdateCtrl', SectionUpdateCtrl)
SectionUpdateCtrl.$inject = ['$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedSection', 'selectedCourse'];
function SectionUpdateCtrl($scope, $rootScope, $state, professors, $modal, selectedSection, selectedCourse){
var professorid = $rootScope.professorId;
var vm = this;
vm.section = {};
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.addStudent = function (index) {
$state.go('StudentCreate');
};
vm.retirarEstudianteModal = function (index) {
$rootScope.index = index;
$rootScope.botonOk = true;
$rootScope.otroBotonOk = false;
$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',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return "";
}
}
});
};
vm.retirarEstudiante = function (index) {
vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students.splice(index, 1);
professors.update({ id: professorid }, vm.professor,
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) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
$scope.ok = function () {
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
vm.back = function () {
$state.go('SectionList');
};
return vm;
};
})();

View File

@@ -48,6 +48,6 @@
</table>
</div>
<div class="container-fluid ">
<a href="#listarMatricula" class="btn-warning btn" style=" margin: 10px">Regresar</a>
<a class="btn-warning btn" style="margin: 10px" ng-click="vm.back()">Regresar</a>
</div>
</div>

View File

@@ -7,9 +7,9 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#/listarMateria"><img alt="ucv" src="img/logo_ucv.jpg" class="img-circle" width="60" height="60"></a>
<a class="navbar-brand" href="#/listarMateria"><img alt="ciencias" src="img/logo_ciencias.jpg" class="img-rounded" width="60" height="60"></a>
<a class="navbar-brand" href="#/listarMateria"><img alt="computacion" src="img/logo_computacion.jpg" lass="img-thumbnail" width="270" height="60"></a>
<a class="navbar-brand" href="#/listarMateria"><img alt="ucv" src="static/img/logo_ucv.jpg" class="img-circle" width="60" height="60"></a>
<a class="navbar-brand" href="#/listarMateria"><img alt="ciencias" src="static/img/logo_ciencias.jpg" class="img-rounded" width="60" height="60"></a>
<a class="navbar-brand" href="#/listarMateria"><img alt="computacion" src="static/img/logo_computacion.jpg" lass="img-thumbnail" width="270" height="60"></a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">

View File

@@ -3,11 +3,10 @@
angular
.module('app')
.controller('sidebarCtrl', sidebarCtrl)
.controller('SidebarCtrl', SidebarCtrl)
sidebarCtrl.$inject = ['$scope'];
function sidebarCtrl($scope) {
SidebarCtrl.$inject = ['$scope'];
function SidebarCtrl($scope) {
var that = this;
$scope.showChilds = function(item){
item.active = !item.active;
@@ -15,53 +14,38 @@
$scope.items = [
{
text: 'Modulo de Administración',
text: 'Modulo de Administración',
subItems: [
{
state: 'listarProfesor',
state: 'ProfessorList',
text: 'Listar Profesores'
},
{
state: 'crearProfesor',
state: 'ProfessorCreate',
text: 'Agregar Profesores'
}
]
},
{
text: 'Modulo de Materias',
text: 'Modulo de Materias',
subItems: [
{
state: 'listarMateria',
state: 'CourseList',
text: 'Listar Materias'
},
{
state: 'crearMateria',
state: 'CourseCreate',
text: 'Agregar Materia'
}
]
},
{
text: 'Modulo de Reportes',
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'
}
state: 'courseReport',
text: 'Reportes'
}
]
}
];

View File

@@ -2,7 +2,7 @@
<ul class="nav nav-sidebar">
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar" data-ng-controller="sidebarCtrl as vm">
<div class="col-sm-3 col-md-2 sidebar" data-ng-controller="SidebarCtrl as vm">
<ul class="nav nav-sidebar">
<li ng-repeat="item in items" ng-click="showChilds(item)">
<a>{{item.text}}</a>

View File

@@ -1,67 +0,0 @@
<div class="row clearfix">
<h4>Listado de Estudiantes</h4>
<br>
<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="20%">
<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>
<th width="20%">
<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="20%" style="text-align: center">
<a>Modificar</a>
</th>
<th width="20%" style="text-align: center">
<a>Borrar</a>
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="estudiante in vm.listaEstudiantes">
<td style="vertical-align:middle">{{ estudiante.Cedula }}</td>
<td style="vertical-align:middle">{{ estudiante.Nombre }}</td>
<td style="vertical-align:middle">{{ estudiante.Apellido }}</td>
<td style="text-align: center">
<span title="Click aqui para Modificar un Estudiante" class="glyphicon glyphicon-edit" aria-hidden="true"
ng-click="vm.modificarEstudiante($index)"
style="cursor:pointer"></span>
</td>
<td style="text-align: center">
<span title="Click aqui para Eliminar un Estudiante"
class="glyphicon glyphicon-remove" aria-hidden="true"
ng-click="vm.eliminarEstudianteModal($index)"
style="cursor:pointer"></span>
</td>
</tr>
</tbody>
</table>
</div>
<div ng-show=false > {{vm.removeEstudianteSplice(index, rsplice)}}</div>
</div>

View File

@@ -1,281 +0,0 @@
(function(){
'use strict';
angular
.module('app.student')
.controller('listarEstudianteCtrl', listarEstudianteCtrl)
.controller('crearEstudianteCtrl', crearEstudianteCtrl)
.controller('actualizarEstudianteCtrl', actualizarEstudianteCtrl)
listarEstudianteCtrl.$inject = [ '$scope', '$rootScope', '$location', 'students', '$modal', 'estudianteSeleccionado' ];
function listarEstudianteCtrl( $scope, $rootScope, $location, students, $modal, estudianteSeleccionado ){
var vm = this;
vm.lista = true;
$rootScope.actOk = false;
$rootScope.loading = true;
$rootScope.table = false;
var estudiantesArray = [];
students.query(
function(data){
vm.estudiantes = data;
angular.forEach(vm.estudiantes, function (value){
estudiantesArray.push({
Cedula:value.id,
Nombre:value.name,
Apellido:value.lastname,
Telefono:value.number,
Correo: value.email
});
});
$rootScope.loading = false;
$rootScope.table = true;
vm.listaEstudiantes = estudiantesArray;
},
function(){
console.log("Error al obtener los datos.");
});
vm.eliminarEstudianteModal = function (index) {
$rootScope.index = index;
$rootScope.botonOK = true;
$rootScope.botonCancelar = true;
$rootScope.acceptButton = false;
$rootScope.rsplice = false;
$rootScope.listarEstudiantesLoading = true;
$rootScope.mensaje = "¿Seguro que desea eliminar el Estudiante?";
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: 'partials/students/modal/list_students_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return "";
}
}
});
};
vm.eliminarEstudiante = function (index) {
$rootScope.botonOK = false;
$rootScope.acceptButton = true;
$rootScope.botonCancelar = false;
$rootScope.urlLo = 'listarEstudiante';
$rootScope.listarEstudiantesLoading = true;
students.delete({id: vm.estudiantes[index]._id},
function (successResult) {
$rootScope.listarEstudiantesLoading = false;
$rootScope.rsplice = true;
$rootScope.mensaje = "Usuario " + vm.estudiantes[index].name + " eliminado";
},
function (errorResult) {
$rootScope.listarEstudiantesLoading = false;
$rootScope.mensaje = "Error eliminando al Usuario " + vm.estudiantes[index].name;
});
};
vm.removeEstudianteSplice = function(index, rsplice) {
if(rsplice){
vm.listaEstudiantes.splice(index, 1);
$rootScope.rsplice = false;
}
};
vm.modificarEstudiante = function (index) {
estudianteSeleccionado._id = vm.estudiantes[index]._id;
estudianteSeleccionado.Cedula = vm.estudiantes[index].id;
estudianteSeleccionado.Nombre = vm.estudiantes[index].name;
estudianteSeleccionado.Apellido= vm.estudiantes[index].lastname;
estudianteSeleccionado.Telefono = vm.estudiantes[index].number;
estudianteSeleccionado.Correo= vm.estudiantes[index].email;
$location.url('actualizarEstudiante');
};
$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;
};
crearEstudianteCtrl.$inject = ['$scope', '$rootScope', '$location', 'professors', '$modal', 'selectedSection', 'selectedCourse'];
function crearEstudianteCtrl($scope, $rootScope, $location, professors, $modal, selectedSection, selectedCourse){
var vm = this;
var duplicated = false;
var professorid = '56f5fd3a20047f3c15b05f0e';
vm.professor = {};
$rootScope.mensaje = "";
$rootScope.actOk = false;
professors.get({ id: professorid },
function (successResult){
vm.professor = successResult;
},
function (){
console.log("Error al obtener los datos.");
});
vm.submit = function() {
if (vm.data_input_form.$valid){
var person = {
"id": vm.estudiante.Cedula,
"name": vm.estudiante.Nombre,
"lastname": vm.estudiante.Apellido,
"email": vm.estudiante.Correo
};
$rootScope.crearEstudianteLoading = true;
$rootScope.botonOk = false;
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: 'partials/students/modal/create_students_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return $rootScope.items;
}
}
});
angular.forEach (vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students,
function (value){
if(value.id == vm.estudiante.Cedula) duplicated = true;
});
if (!duplicated){
vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students.push(person);
professors.update({ id: professorid }, vm.professor,
function(){
$rootScope.botonOk = true;
$rootScope.urlLo = 'actualizarMatricula';
$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{
vm.submitted = true;
}
}
$scope.ok = function (urlLo) {
$location.url(urlLo);
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
$rootScope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
return vm;
};
actualizarEstudianteCtrl.$inject = [ '$scope','$rootScope', '$location', 'students', '$modal', 'estudianteSeleccionado' ];
function actualizarEstudianteCtrl ( $scope, $rootScope, $location, students, $modal, estudianteSeleccionado ){
var vm = this;
vm.estudiante = estudianteSeleccionado;
$rootScope.mensaje = "";
$rootScope.actOk = false;
vm.submit = function() {
var student = {
"_id": vm.estudiante._id,
"id": vm.estudiante.Cedula,
"name": vm.estudiante.Nombre,
"lastname": vm.estudiante.Apellido,
"email": vm.estudiante.Correo,
"number": vm.estudiante.Telefono,
};
$rootScope.botonOk = false;
$rootScope.modificarEstudianteLoading = true;
$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;
}
}
});
students.update(student,
function(){
$rootScope.botonOk = true;
$rootScope.botonCancelar = false;
$rootScope.urlLo = 'listarEstudiante';
$rootScope.mensaje = "Estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre + " actualizado";
},
function(){
$rootScope.botonOk = true;
$rootScope.botonCancelar = false;
$rootScope.urlLo = 'listarEstudiante';
$rootScope.mensaje = "Error al modificar al estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre;
});
}
$scope.ok = function (urlLo) {
$location.url(urlLo);
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
$rootScope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
return vm;
};
})();

View File

@@ -14,62 +14,25 @@
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
function getRoutes($stateProvider, $urlRouterProvider){
$urlRouterProvider.otherwise('/listarEstudiante');
$urlRouterProvider.otherwise('/StudentCreate');
$stateProvider
.state('listarEstudiante', {
url: '/listarEstudiante',
.state('StudentCreate', {
url: '/StudentCreate',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'sidebarCtrl'
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'SidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/students/list_students.html',
controller: 'listarEstudianteCtrl',
controllerAs: 'vm'
}
}
})
.state('crearEstudiante', {
url: '/crearEstudiante',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'sidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/students/create_students.html',
controller: 'crearEstudianteCtrl',
controllerAs: 'vm'
}
}
})
.state('actualizarEstudiante', {
url: '/actualizarEstudiante',
views: {
sidebar: {
templateUrl: 'partials/sidebar/sidebar.html',
controller: 'sidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/navbar.html'
},
content: {
templateUrl: 'partials/students/update_students.html',
controller: 'actualizarEstudianteCtrl',
controllerAs: 'vm'
}
}
templateUrl: 'partials/students/student_create.html',
controller: 'StudentCreateCtrl',
controllerAs: 'vm'
}
}
})
};
})();

View File

@@ -0,0 +1,103 @@
(function(){
'use strict';
angular
.module('app.student')
.controller('StudentCreateCtrl', StudentCreateCtrl)
StudentCreateCtrl.$inject = ['$scope', '$rootScope', '$state', 'professors', '$modal', 'selectedSection', 'selectedCourse'];
function StudentCreateCtrl($scope, $rootScope, $state, professors, $modal, selectedSection, selectedCourse){
var vm = this;
var duplicated = false;
var professorid = $rootScope.professorId;
vm.professor = {};
$rootScope.mensaje = "";
$rootScope.actOk = false;
professors.get({ id: professorid },
function (successResult){
vm.professor = successResult;
},
function (){
console.log("Error al obtener los datos.");
});
vm.submit = function() {
if (vm.data_input_form.$valid){
var person = {
"id": vm.estudiante.Cedula,
"name": vm.estudiante.Nombre,
"lastname": vm.estudiante.Apellido,
"email": vm.estudiante.Correo
};
$rootScope.crearEstudianteLoading = true;
$rootScope.botonOk = false;
$scope.modalInstance = $modal.open({
animation: $rootScope.animationsEnabled,
templateUrl: 'partials/students/modal/create_students_modal.html',
scope: $scope,
size: 'sm',
resolve: {
items: function () {
return $rootScope.items;
}
}
});
angular.forEach (vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students,
function (value){
if(value.id == vm.estudiante.Cedula) duplicated = true;
});
if (!duplicated){
vm.professor.courses[selectedCourse.index].sections[selectedSection.index].students.push(person);
professors.update({ id: professorid }, vm.professor,
function(){
$rootScope.botonOk = true;
$rootScope.urlLo = 'actualizarMatricula';
$rootScope.mensaje = "Estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre + " agregado";
$rootScope.crearEstudianteLoading = false;
},
function(){
$rootScope.botonOk = true;
$rootScope.mensaje = "Error al agregar al estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre;
$rootScope.crearEstudianteLoading = false;
});
} else {
$rootScope.botonOk = true;
$rootScope.mensaje = "Estudiante con cedula " + vm.estudiante.Cedula + " ya esta en la lista.";
$rootScope.crearEstudianteLoading = false;
}
}else{
vm.submitted = true;
}
}
$scope.ok = function (urlLo) {
$state.go('SectionUpdate');
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
$rootScope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$rootScope.opened = true;
};
vm.back = function () {
$state.go('SectionUpdate');
};
return vm;
};
})();

View File

@@ -79,5 +79,5 @@
</div>
</div>
</form>
<a href="#actualizarMatricula" class="btn-warning btn" style=" margin: 10px">Regresar</a>
<a class="btn-warning btn" style="margin: 10px" ng-click="vm.back()">Regresar</a>
</div>

View File

@@ -12,7 +12,8 @@ db.on('error', console.error);
db.once('open', function() {
var assitanceSchema = new mongoose.Schema({
day: Date
day: String,
assistance: Boolean
});
var studentSchema = new mongoose.Schema({
@@ -22,20 +23,19 @@ db.once('open', function() {
email: String,
assistance: Number,
btaddress: String,
assistanceTotal: [Date]
assistanceTotal: [assitanceSchema]
});
var sectionSchema = new mongoose.Schema({
name: String,
code: Number,
code: String,
course: String,
semester: String,
assistance: Number,
students: [studentSchema]
});
var courseSchema = new mongoose.Schema({
code: Number,
code: String,
name: String,
credits: Number,
description: String,
@@ -58,26 +58,26 @@ db.once('open', function() {
//Professor CRUD
app.get('/professors', function(req, res){
console.log('Received get all professors request');
console.log('Received GET ALL professors request');
Professor.find(function(err, docs){
console.log(docs);
//console.log(docs);
res.json(docs);
})
});
app.get('/professors/:id', function(req, res){
console.log('Received get professor request');
console.log('Received GET professor request');
console.log(req.params);
Professor.findOne(req.params.id,
function(err, docs){
console.log(docs);
//console.log(docs);
res.json(docs);
})
});
app.post('/professors', function(req, res){
console.log('Received add professor request');
console.log(req.body);
console.log('Received ADD professor request');
//console.log(req.body);
var professor = new Professor({
id: req.body.id,
@@ -94,23 +94,23 @@ db.once('open', function() {
professor.save(
function(err, docs){
console.log(docs);
//console.log(docs);
res.json(docs);
})
});
app.delete('/professors/:id', function(req, res){
console.log("Received delete professor request...");
console.log("Received DELETE professor request...");
console.log(req.params);
Professor.findByIdAndRemove(req.params.id,
function(err, docs){
console.log(docs);
//console.log(docs);
res.json(docs);
});
});
app.put('/professors/:id', function(req, res){
console.log("Received update professor request");
console.log("Received UPDATE professor request");
console.log("params:" + req.params);
console.log("body:" + req.body);
Professor.findById(req.params.id, function (err, professor) {
@@ -133,215 +133,4 @@ db.once('open', function() {
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);
res.json(docs);
})
});
app.get('/professors/:id', function(req, res){
console.log('Received get professor request');
db.DB.findOne({_id: new mongojs.ObjectId(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);
db.DB.insert(req.body, function(docs){
console.log(docs);
res.json(docs);
})
});
app.delete('/professors/:id', function(req, res){
console.log("Received delete professor request...");
db.DB.remove({_id: new mongojs.ObjectId(req.params.id)},
function(err, docs){
console.log(docs);
res.json(docs);
});
});
app.put('/professors', function(req, res){
console.log("Received update professor request");
console.log(req.body);
db.DB.findAndModify({query:
{"_id": new mongojs.ObjectId(req.body._id)},
update: {$set: {email: req.body.email, number: req.body.number, courses: req.body.courses}}
}, function(err, docs){
console.log(docs);
res.json(docs);
})
});
app.get('/courses', function(req, res){
console.log('Received get all courses request');
db.DB.find(function(err, docs){
console.log(docs);
res.json(docs);
})
});
app.get('/courses/:id', function(req, res){
console.log('Received get courses request');
db.DB.findOne({_id: new mongojs.ObjectId(req.params.id)},
function(err, docs){
console.log(docs);
res.json(docs);
})
});
app.post('/courses', function(req, res){
console.log('Received add courses request');
console.log(req.body);
db.DB.insert(req.body, function(docs){
console.log(docs);
res.json(docs);
})
});
app.delete('/courses/:id', function(req, res){
console.log("Received delete courses request...");
db.DB.remove({_id: new mongojs.ObjectId(req.params.id)},
function(err, docs){
console.log(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){
console.log('Received get all sections request');
db.DB.find(function(err, docs){
console.log(docs);
res.json(docs);
})
});
app.get('/sections/:id', function(req, res){
console.log('Received get section request');
db.DB.findOne(
{_id: new mongojs.ObjectId(req.params.id)}, function(err, docs){
console.log(docs);
res.json(docs);
})
});
app.post('/sections', function(req, res){
console.log('Received add section request');
console.log(req.body);
db.DB.insert(req.body, function(docs){
console.log(docs);
res.json(docs);
})
});
app.delete('/sections/:id', function(req, res){
console.log("Received delete section request...");
db.DB.remove(
{_id: new mongojs.ObjectId(req.params.id)}, function(err, docs){
console.log(docs);
res.json(docs);
});
});
app.put('/sections', function(req, res){
console.log("Received update section request");
console.log(req.body);
db.DB.findAndModify({query:
{"_id": new mongojs.ObjectId(req.body._id)},
update: {$set: {students: req.body.students}}
}, function(err, docs){
console.log(docs);
res.json(docs);
})
});
app.get('/students', function(req, res){
console.log('Received get all students request');
db.DB.find(function(err, docs){
console.log(docs);
res.json(docs);
})
});
app.get('/students/:id', function(req, res){
console.log('Received get student request');
db.DB.findOne(
{_id: new mongojs.ObjectId(req.params.id)}, function(err, docs){
console.log(docs);
res.json(docs);
})
});
app.post('/students', function(req, res){
console.log('Received add student request');
console.log(req.body);
db.DB.insert(req.body, function(docs){
console.log(docs);
res.json(docs);
})
});
app.delete('/students/:id', function(req, res){
console.log("Received delete student request...");
db.DB.remove(
{_id: new mongojs.ObjectId(req.params.id)}, function(err, docs){
console.log(docs);
res.json(docs);
});
});
app.put('/students', function(req, res){
console.log("Received update student request");
console.log(req.body);
db.DB.findAndModify({query:
{"_id": new mongojs.ObjectId(req.body._id)},
update: {$set: {email: req.body.email, number: req.body.number}}
}, function(err, docs){
console.log(docs);
res.json(docs);
})
});
app.listen(3000);
console.log("server running on port 3000");*/
console.log("server running on port 3000");

View File

@@ -127,4 +127,12 @@ svg .state:hover , .state.active {
.regionlist > div > div {
display: inline-block;
width: 48%;
}
.showGreen {
color: green;
}
.showFalse {
color: red;
}

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB