Initial commit
This commit is contained in:
37
app/js/app.js
Normal file
37
app/js/app.js
Normal file
@@ -0,0 +1,37 @@
|
||||
(function (){
|
||||
'user strict';
|
||||
|
||||
angular.module('app', [
|
||||
'app.course',
|
||||
'app.login',
|
||||
'app.professor',
|
||||
'app.reports',
|
||||
'app.section',
|
||||
'app.student',
|
||||
'ngResource',
|
||||
'ui.router'
|
||||
])
|
||||
|
||||
.config(function($stateProvider, $urlRouterProvider) {
|
||||
|
||||
$urlRouterProvider.otherwise('/');
|
||||
|
||||
$stateProvider
|
||||
.state('login', {
|
||||
url: '/login',
|
||||
views: {
|
||||
content: {
|
||||
templateUrl: 'login.html',
|
||||
controller: 'loginCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
.run(function ($rootScope) {
|
||||
$rootScope.domainUrl = 'Localhost:3000';
|
||||
});
|
||||
|
||||
|
||||
})();
|
176
app/js/course/course.controllers.js
Normal file
176
app/js/course/course.controllers.js
Normal file
@@ -0,0 +1,176 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.course')
|
||||
.controller('listarMateriaCtrl',listarMateriaCtrl)
|
||||
.controller('crearMateriaCtrl', crearMateriaCtrl)
|
||||
|
||||
listarMateriaCtrl.$inject =
|
||||
['$scope', '$rootScope', '$location', 'courses', '$modal'];
|
||||
function listarMateriaCtrl($scope, $rootScope, $location, courses, $modal) {
|
||||
var vm = this;
|
||||
$rootScope.table = false;
|
||||
|
||||
var materiaArreglo = [];
|
||||
courses.query(
|
||||
function(data){
|
||||
vm.materia = data;
|
||||
angular.forEach(vm.materia, function (value){
|
||||
materiaArreglo.push({
|
||||
Codigo:value.Codigo,
|
||||
Nombre:value.Nombre,
|
||||
Creditos:value.Creditos,
|
||||
Descripcion:value.Descripcion
|
||||
});
|
||||
});
|
||||
$rootScope.table = true;
|
||||
vm.listaMateria = materiaArreglo;
|
||||
},
|
||||
function(data){
|
||||
console.log("Error al obtener los datos.");
|
||||
|
||||
});
|
||||
|
||||
vm.eliminarMateriaModal = function (index) {
|
||||
$rootScope.index = index;
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.otroBotonOk = false;
|
||||
$rootScope.botonCancelar = true;
|
||||
$rootScope.rsplice = false;
|
||||
$rootScope.loading = 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.loadingListarForm = true;
|
||||
$rootScope.botonOk = false;
|
||||
$rootScope.otroBotonOk = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
$rootScope.urlLo = 'listarMateria';
|
||||
$rootScope.rsplice = true;
|
||||
|
||||
courses.delete({ id: vm.materia[index]._id },
|
||||
function() {
|
||||
$rootScope.loadingListarForm = false;
|
||||
$rootScope.mensaje = "Materia eliminada";
|
||||
},
|
||||
function() {
|
||||
$rootScope.loadingListarForm = false;
|
||||
$rootScope.mensaje = "Error eliminado materia";
|
||||
});
|
||||
};
|
||||
|
||||
vm.eliminarMateriaSplice = function(index, rsplice) {
|
||||
if(rsplice){
|
||||
vm.listaMateria.splice(index, 1);
|
||||
$rootScope.rsplice = false;
|
||||
}
|
||||
};
|
||||
|
||||
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', 'courses'];
|
||||
function crearMateriaCtrl($scope, $rootScope, $modal, $location, courses) {
|
||||
|
||||
var vm = this;
|
||||
vm.submitted = false;
|
||||
vm.mayorque = false;
|
||||
$rootScope.mensaje = "";
|
||||
|
||||
vm.submit = function() {
|
||||
|
||||
if (vm.data_input_form.$valid){
|
||||
vm.course = {
|
||||
|
||||
"Codigo": vm.materia.Codigo,
|
||||
"Nombre": vm.materia.Nombre,
|
||||
"Creditos": vm.materia.Creditos,
|
||||
"Descripcion" : vm.materia.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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
courses.save(vm.course,
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'listarMateria';
|
||||
$rootScope.mensaje =
|
||||
"Materia " + vm.materia.Nombre + " creada";
|
||||
},
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'listarMateria';
|
||||
$rootScope.mensaje =
|
||||
"Error creando la materia " + vm.materia.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;
|
||||
};
|
||||
})();
|
57
app/js/course/course.module.js
Normal file
57
app/js/course/course.module.js
Normal file
@@ -0,0 +1,57 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module("app.course", ['ui.router', 'ui.bootstrap'])
|
||||
.run(addStateToScope)
|
||||
.config(getRoutes);
|
||||
|
||||
addStateToScope.$inject = ['$rootScope', '$state', '$stateParams'];
|
||||
function addStateToScope($rootScope, $state, $stateParams){
|
||||
$rootScope.$state = $state;
|
||||
$rootScope.$stateParams = $stateParams;
|
||||
};
|
||||
|
||||
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
|
||||
function getRoutes($stateProvider, $urlRouterProvider){
|
||||
$urlRouterProvider.otherwise('/listarMaterias');
|
||||
|
||||
$stateProvider
|
||||
.state('listarMateria', {
|
||||
url: '/listarMateria',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/course/list_course.html',
|
||||
controller: 'listarMateriaCtrl',
|
||||
controllerAs: "vm"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.state('crearMateria', {
|
||||
url: '/crearMateria',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/course/create_course.html',
|
||||
controller: 'crearMateriaCtrl',
|
||||
controllerAs: "vm"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
};
|
||||
})();
|
13
app/js/course/course.services.js
Normal file
13
app/js/course/course.services.js
Normal file
@@ -0,0 +1,13 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.course')
|
||||
.factory('courses', courses)
|
||||
.value('id',{});
|
||||
|
||||
courses.$inject = ['$resource','$rootScope'];
|
||||
function courses($resource, $rootScope){
|
||||
return $resource('http://'+$rootScope.domainUrl+'/courses/:id', null);
|
||||
};
|
||||
})();
|
175
app/js/login/login.controllers.js
Normal file
175
app/js/login/login.controllers.js
Normal file
@@ -0,0 +1,175 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.login')
|
||||
.controller('loginCtrl', loginCtrl)
|
||||
.controller('ModalInstanceLoginCtrl', ModalInstanceLoginCtrl)
|
||||
.constant('datepickerPopupConfig', {
|
||||
datepickerPopup: 'yyyy-MM-dd',
|
||||
html5Types: {
|
||||
date: 'yyyy-MM-dd',
|
||||
'datetime-local': 'yyyy-MM-ddTHH:mm:ss.sss',
|
||||
'month': 'yyyy-MM'
|
||||
},
|
||||
currentText: 'Hoy',
|
||||
clearText: 'Limpiar',
|
||||
closeText: 'Cerrar',
|
||||
closeOnDateSelection: true,
|
||||
appendToBody: false,
|
||||
showButtonBar: true
|
||||
});
|
||||
|
||||
|
||||
ModalInstanceLoginCtrl.$inject = ['$scope', '$modalInstance', 'items', '$location'];
|
||||
function ModalInstanceLoginCtrl($scope, $modalInstance, items, $location){
|
||||
|
||||
$scope.items = items;
|
||||
|
||||
$scope.okLogin = function (actOk, urlLo) {
|
||||
//$modalInstance.close($scope.selected.item);
|
||||
if(actOk){
|
||||
$location.url(urlLo);
|
||||
$modalInstance.dismiss('cancel');
|
||||
}
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
loginCtrl.$inject = ['$rootScope', '$location', 'Login', 'Rol','GetRol', 'hash', '$http', 'user', '$modal'];
|
||||
function loginCtrl($rootScope, $location, Login, Rol, GetRol, hash, $http, user, $modal){
|
||||
var vm = this;
|
||||
|
||||
|
||||
//$http.get("http://cesar:12316/api/Rol")
|
||||
//.success(function(response) {$rootScope.namesw = response.Data;});
|
||||
|
||||
vm.user = user;
|
||||
vm.submitted = false;
|
||||
vm.mayorque = false;
|
||||
$rootScope.items = "";
|
||||
$rootScope.mensaje = "";
|
||||
vm.submit = function() {
|
||||
//var verificar = false;
|
||||
if (vm.data_input_form.$valid){
|
||||
// se implementa todo lo necesario antes de pasar a la siguiente página.
|
||||
vm.pkg = {
|
||||
|
||||
"Nickname": vm.user.Nickname,
|
||||
"Password": $rootScope.password
|
||||
|
||||
};
|
||||
//$rootScope.mostrar = false;
|
||||
$rootScope.loadingLogin = true;
|
||||
$rootScope.mensaje = "";
|
||||
$rootScope.bcancel = false;
|
||||
$modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: 'myModalContentLogin.html',
|
||||
controller: 'ModalInstanceLoginCtrl',
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return $rootScope.items;
|
||||
}
|
||||
}
|
||||
});
|
||||
Login.save(vm.pkg,
|
||||
function(data){
|
||||
//$rootScope.mostrar = true;
|
||||
$rootScope.loadingLogin = false;
|
||||
//verificar = data.Data._value;
|
||||
if(data.Data._value != null){
|
||||
//$rootScope.bok = true;
|
||||
$rootScope.actOk = true;
|
||||
$rootScope.urlLo = 'mapasReportes';
|
||||
$rootScope.bcancel = false;
|
||||
|
||||
}else{
|
||||
$rootScope.bcancel = true;
|
||||
$rootScope.mensaje = data.Data._error;
|
||||
}
|
||||
},
|
||||
function(data){
|
||||
verificar = data.Data;
|
||||
if(verificar){
|
||||
alert("no existe el usuario");
|
||||
}
|
||||
|
||||
})
|
||||
GetRol.get({id:vm.user.Nickname}, function(data){
|
||||
$rootScope.role = data.Data;
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
//$location.url('/preview/');
|
||||
}else{
|
||||
|
||||
vm.submitted = true;
|
||||
}
|
||||
}
|
||||
|
||||
vm.onSelectChange = function () {
|
||||
if(vm.genero == "Masculino"){
|
||||
$rootScope.Gender = "M";
|
||||
//alert("hola " + vm.valorRol.Name);
|
||||
}
|
||||
if(vm.genero == "Femenino"){
|
||||
$rootScope.Gender = "F";
|
||||
}
|
||||
};
|
||||
|
||||
//$rootScope.password="s3cret";
|
||||
$rootScope.getHash = function(message) {
|
||||
var hashResult = hash(message);
|
||||
$rootScope.password = hashResult;
|
||||
return hashResult;
|
||||
};
|
||||
|
||||
vm.generos = ['', 'Masculino', 'Femenino'];
|
||||
vm.genero = vm.generos[0];
|
||||
|
||||
Rol.get(
|
||||
function(data){
|
||||
$rootScope.rol = data.Data;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
vm.toggleMin = function() {
|
||||
vm.maxDate = vm.maxDate ? null : new Date();
|
||||
};
|
||||
vm.toggleMin();
|
||||
|
||||
$rootScope.open = function($event) {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
|
||||
$rootScope.opened = true;
|
||||
};
|
||||
|
||||
$rootScope.open2 = function($eventt) {
|
||||
$eventt.preventDefault();
|
||||
$eventt.stopPropagation();
|
||||
|
||||
$rootScope.openedd = true;
|
||||
};
|
||||
|
||||
$rootScope.dateOptions = {
|
||||
formatYear: 'yy',
|
||||
startingDay: 1
|
||||
};
|
||||
|
||||
return vm;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
})();
|
34
app/js/login/login.module.js
Normal file
34
app/js/login/login.module.js
Normal file
@@ -0,0 +1,34 @@
|
||||
(function(){
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module("app.login", ['ui.router', 'ui.bootstrap'])
|
||||
.run(addStateToScope)
|
||||
.config(getRoutes);
|
||||
|
||||
addStateToScope.$inject = ['$rootScope', '$state', '$stateParams'];
|
||||
function addStateToScope($rootScope, $state, $stateParams){
|
||||
$rootScope.$state = $state;
|
||||
$rootScope.$stateParams = $stateParams;
|
||||
};
|
||||
|
||||
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
|
||||
function getRoutes($stateProvider, $urlRouterProvider){
|
||||
$urlRouterProvider.otherwise('/');
|
||||
|
||||
$stateProvider
|
||||
.state('root', {
|
||||
url: '',
|
||||
views: {
|
||||
content: {
|
||||
templateUrl: 'login.html',
|
||||
controller: 'LoginCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
};
|
||||
})();
|
56
app/js/login/login.services.js
Normal file
56
app/js/login/login.services.js
Normal file
@@ -0,0 +1,56 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.login')
|
||||
.factory('Login', Login)
|
||||
.factory('Rol', Rol)
|
||||
.factory('GetRol', GetRol)
|
||||
.factory('hash', hash)
|
||||
.value('algoritmo','SHA-1')
|
||||
.value('user',{})
|
||||
.value('id',{})
|
||||
|
||||
|
||||
Login.$inject = ['$resource','$rootScope'];
|
||||
function Login($resource, $rootScope){
|
||||
return $resource('http://'+$rootScope.domainUrl+'/api/VerifyUser');
|
||||
|
||||
};
|
||||
|
||||
Rol.$inject = ['$resource','$rootScope'];
|
||||
function Rol($resource, $rootScope){
|
||||
return $resource('http://'+$rootScope.domainUrl+'/api/Rol');
|
||||
};
|
||||
|
||||
GetRol.$inject = ['$resource','$rootScope'];
|
||||
function GetRol($resource, $rootScope){
|
||||
return $resource('http://'+$rootScope.domainUrl+'/api/User/:id');
|
||||
};
|
||||
|
||||
hash.$inject = ['algoritmo'];
|
||||
function hash(algoritmo){
|
||||
|
||||
var hashFunction;
|
||||
|
||||
if (algoritmo==="MD5") {
|
||||
hashFunction=CryptoJS.MD5;
|
||||
} else if (algoritmo==="SHA-1") {
|
||||
hashFunction=CryptoJS.SHA1;
|
||||
} else if (algoritmo==="SHA-2-256") {
|
||||
hashFunction=CryptoJS.SHA256;
|
||||
} else if (algoritmo==="SHA-2-512") {
|
||||
hashFunction=CryptoJS.SHA512;
|
||||
} else {
|
||||
throw Error("El tipo de algoritmo no es válido:"+algoritmo);
|
||||
}
|
||||
|
||||
var hash=function(message) {
|
||||
var objHashResult=hashFunction(message);
|
||||
var strHashResult=objHashResult.toString(CryptoJS.enc.Base64);
|
||||
|
||||
return strHashResult;
|
||||
}
|
||||
return hash;
|
||||
};
|
||||
})();
|
256
app/js/professor/professor.controllers.js
Normal file
256
app/js/professor/professor.controllers.js
Normal file
@@ -0,0 +1,256 @@
|
||||
(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(data){
|
||||
vm.profesor = data;
|
||||
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,
|
||||
};
|
||||
|
||||
$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._id,
|
||||
"id": vm.profesor.Cedula,
|
||||
"name": vm.profesor.Nombre,
|
||||
"lastname": vm.profesor.Apellido,
|
||||
"email": vm.profesor.Correo,
|
||||
"number": vm.profesor.Telefono,
|
||||
};
|
||||
|
||||
$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(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;
|
||||
};
|
||||
|
||||
})();
|
75
app/js/professor/professor.module.js
Normal file
75
app/js/professor/professor.module.js
Normal file
@@ -0,0 +1,75 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module("app.professor", ['ui.router', 'ui.bootstrap'])
|
||||
.run(addStateToScope)
|
||||
.config(getRoutes);
|
||||
|
||||
addStateToScope.$inject = ['$rootScope', '$state', '$stateParams'];
|
||||
function addStateToScope($rootScope, $state, $stateParams){
|
||||
$rootScope.$state = $state;
|
||||
$rootScope.$stateParams = $stateParams;
|
||||
};
|
||||
|
||||
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
|
||||
function getRoutes($stateProvider, $urlRouterProvider){
|
||||
$urlRouterProvider.otherwise('/listarProfesor');
|
||||
|
||||
$stateProvider
|
||||
.state('listarProfesor', {
|
||||
url: '/listarProfesor',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/professor/list_professor.html',
|
||||
controller: 'listarProfesorCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.state('crearProfesor', {
|
||||
url: '/crearProfesor',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/professor/create_professor.html',
|
||||
controller: 'crearProfesorCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.state('actualizarProfesor', {
|
||||
url: '/actualizarProfesor',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/professor/update_professor.html',
|
||||
controller: 'actualizarProfesorCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
})();
|
16
app/js/professor/professor.services.js
Normal file
16
app/js/professor/professor.services.js
Normal file
@@ -0,0 +1,16 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.professor')
|
||||
.factory('professors', professors)
|
||||
.value('profesorSeleccionado',{});
|
||||
|
||||
professors.$inject = ['$resource','$rootScope'];
|
||||
function professors($resource, $rootScope){
|
||||
return $resource('http://'+$rootScope.domainUrl+'/professors/:id', null,
|
||||
{
|
||||
'update': {method:'PUT'}
|
||||
});
|
||||
};
|
||||
})();
|
105
app/js/report/report.controllers.js
Normal file
105
app/js/report/report.controllers.js
Normal file
@@ -0,0 +1,105 @@
|
||||
(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;
|
||||
});
|
||||
};
|
||||
|
||||
})();
|
81
app/js/report/report.module.js
Normal file
81
app/js/report/report.module.js
Normal file
@@ -0,0 +1,81 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module("app.reports", ['ui.router', 'ui.bootstrap', 'chart.js'])
|
||||
.run(addStateToScope)
|
||||
.config(getRoutes);
|
||||
|
||||
addStateToScope.$inject = ['$rootScope', '$state', '$stateParams'];
|
||||
function addStateToScope($rootScope, $state, $stateParams){
|
||||
$rootScope.$state = $state;
|
||||
$rootScope.$stateParams = $stateParams;
|
||||
};
|
||||
|
||||
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
|
||||
function getRoutes($stateProvider, $urlRouterProvider){
|
||||
$urlRouterProvider.otherwise('/reportes');
|
||||
|
||||
$stateProvider
|
||||
|
||||
.state('poblacionNacimiento', {
|
||||
url: '/reportes',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/reportes/reportes.html',
|
||||
controller: 'poblacionNacimientoCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('poblacionActiva', {
|
||||
url: '/poblacionActivaCtrl',
|
||||
templateUrl: 'partials/reportes/reportes.html',
|
||||
controller: 'poblacionActivaCtrl',
|
||||
controllerAs: 'vm'
|
||||
})
|
||||
.state('hombresEdad', {
|
||||
url: '/hombresEdad',
|
||||
templateUrl: 'partials/reportes/reportes.html',
|
||||
controller: 'hombresEdadCtrl',
|
||||
controllerAs: 'vm'
|
||||
})
|
||||
.state('mujeresEdad', {
|
||||
url: '/mujeresEdad',
|
||||
templateUrl: 'partials/reportes/reportes.html',
|
||||
controller: 'mujeresEdadCtrl',
|
||||
controllerAs: 'vm'
|
||||
})
|
||||
.state('comidasDia', {
|
||||
url: '/comidasDia',
|
||||
templateUrl: 'partials/reportes/reportes.html',
|
||||
controller: 'comidasDiaCtrl',
|
||||
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'
|
||||
})
|
||||
};
|
||||
})();
|
16
app/js/report/report.services.js
Normal file
16
app/js/report/report.services.js
Normal file
@@ -0,0 +1,16 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.reports')
|
||||
.factory('ReportJson', ReportJson)
|
||||
.value('id',{})
|
||||
|
||||
ReportJson.$inject = ['$resource','$rootScope'];
|
||||
function ReportJson($resource, $rootScope){
|
||||
return $resource('http://'+$rootScope.domainUrl+'/api/reports/:id');
|
||||
//var json="data/data.json";
|
||||
//return $resource(json);
|
||||
};
|
||||
|
||||
})();
|
298
app/js/section/section.controllers.js
Normal file
298
app/js/section/section.controllers.js
Normal file
@@ -0,0 +1,298 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.section')
|
||||
.controller('listarMatriculaCtrl', listarMatriculaCtrl)
|
||||
.controller('crearMatriculaCtrl', crearMatriculaCtrl)
|
||||
.controller('actualizarMatriculaCtrl', actualizarMatriculaCtrl)
|
||||
|
||||
listarMatriculaCtrl.$inject = [ '$scope', '$rootScope', '$location', 'sections', '$modal', 'matriculaSeleccionada'];
|
||||
function listarMatriculaCtrl ( $scope, $rootScope, $location, sections, $modal, matriculaSeleccionada ){
|
||||
|
||||
var vm = this;
|
||||
vm.lista = true;
|
||||
$rootScope.actOk = false;
|
||||
$rootScope.loading = true;
|
||||
$rootScope.table = false;
|
||||
|
||||
vm.submit = function() {
|
||||
}
|
||||
|
||||
var matriculaArray = [];
|
||||
sections.query(
|
||||
function(successResult){
|
||||
vm.matricula = successResult;
|
||||
angular.forEach(vm.matricula, function (value){
|
||||
matriculaArray.push({
|
||||
Nombre:value.Nombre,
|
||||
Codigo:value.Codigo,
|
||||
Materia:value.Materia,
|
||||
Semestre:value.Semestre,
|
||||
Estudiantes: value.Estudiantes
|
||||
});
|
||||
});
|
||||
$rootScope.loading = false;
|
||||
$rootScope.table = true;
|
||||
vm.listaMatricula = matriculaArray;
|
||||
},
|
||||
function(data){
|
||||
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.eliminarMatriculaModal = function (index) {
|
||||
|
||||
$rootScope.index = index;
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.otroBotonOk = false;
|
||||
$rootScope.botonCancelar = true;
|
||||
$rootScope.rsplice = false;
|
||||
$rootScope.eliminarLoading = false;
|
||||
$rootScope.mensaje = "¿Seguro que desea eliminar la matricula?";
|
||||
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: 'partials/matricula/modal/eliminar_matricula_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';
|
||||
$rootScope.eliminarLoading = true;
|
||||
var name = vm.matricula[index].Nombre;
|
||||
|
||||
sections.delete({ id: vm.matricula[index]._id },
|
||||
function (successResult) {
|
||||
$rootScope.eliminarLoading = false;
|
||||
$rootScope.rsplice = true;
|
||||
$rootScope.mensaje = "Sección " + name + " eliminada.";
|
||||
},
|
||||
function (errorResult) {
|
||||
$rootScope.eliminarLoading = false;
|
||||
$rootScope.mensaje = "Error al eliminar la sección " + name;
|
||||
console.log('Could not delete from server');
|
||||
});
|
||||
};
|
||||
|
||||
vm.eliminarMatriculaSplice = function (index, rsplice) {
|
||||
if(rsplice){
|
||||
vm.listaMatricula.splice(index, 1);
|
||||
$rootScope.rsplice = false;
|
||||
}
|
||||
};
|
||||
|
||||
/*************************Fin de Eliminar Matricula********************/
|
||||
|
||||
|
||||
vm.modificarMatricula = function (index) {
|
||||
matriculaSeleccionada.Nombre = vm.matricula[index].Nombre;
|
||||
matriculaSeleccionada.Codigo = vm.matricula[index].Codigo;
|
||||
matriculaSeleccionada.Materia = vm.matricula[index].Materia;
|
||||
matriculaSeleccionada.Semestre = vm.matricula[index].Semestre;
|
||||
matriculaSeleccionada.Estudiantes= vm.matricula[index].Estudiantes;
|
||||
$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', 'sections', '$modal', 'courses'];
|
||||
function crearMatriculaCtrl($scope, $rootScope, $location, sections, $modal, courses){
|
||||
|
||||
var vm = this;
|
||||
vm.submitted = false;
|
||||
$rootScope.mensaje = "";
|
||||
|
||||
courses.query(
|
||||
function (successResult) {
|
||||
vm.materias = successResult;
|
||||
},
|
||||
function () {
|
||||
vm.materias = null;
|
||||
});
|
||||
|
||||
vm.submit = function() {
|
||||
|
||||
if (vm.data_input_form.$valid){
|
||||
vm.section = {
|
||||
|
||||
"section": vm.matricula.Nombre,
|
||||
"code": vm.valorMateria.Codigo,
|
||||
"course": vm.valorMateria.Nombre,
|
||||
"semester": vm.matricula.Semestre,
|
||||
"students": vm.matricula.Estudiantes,
|
||||
};
|
||||
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: 'partials/matricula/modal/crear_matricula_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return $rootScope.items;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sections.save(vm.section,
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'listarMatricula';
|
||||
$rootScope.mensaje = "Sección " + vm.matricula.Nombre + " creada";
|
||||
},
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'listarMatricula';
|
||||
$rootScope.mensaje = "Error creando la seccion " + vm.matricula.Nombre;
|
||||
});
|
||||
}else{
|
||||
vm.submitted = true;
|
||||
}
|
||||
};
|
||||
|
||||
vm.cargarEstudiantes = function () {
|
||||
|
||||
};
|
||||
|
||||
$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', 'sections', '$modal', 'matriculaSeleccionada'];
|
||||
function actualizarMatriculaCtrl($scope, $rootScope, $location, sections, $modal, matriculaSeleccionada){
|
||||
|
||||
var vm = this;
|
||||
vm.lista = true;
|
||||
$rootScope.loading = true;
|
||||
$rootScope.table = false;
|
||||
vm.matricula = matriculaSeleccionada;
|
||||
vm.listaEstudiantes = vm.matricula.Estudiantes;
|
||||
|
||||
|
||||
vm.actualizarMatricula = function() {
|
||||
sections.update(section,
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
$rootScope.urlLo = 'listarMatricula';
|
||||
$rootScope.mensaje = "Sección actualizada";
|
||||
},
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
$rootScope.urlLo = 'listarMatricula';
|
||||
$rootScope.mensaje = "Error al actualizar la Sección ";
|
||||
});
|
||||
}
|
||||
|
||||
vm.retirarEstudianteModal = function (index) {
|
||||
$rootScope.index = index;
|
||||
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.otroBotonOk = false;
|
||||
$rootScope.botonCancelar = true;
|
||||
|
||||
$rootScope.rsplice = false;
|
||||
$rootScope.eliminarLoading = false;
|
||||
$rootScope.mensaje = "¿Desea retirar este estudiante de la Sección?";
|
||||
|
||||
$scope.modalInstance = $modal.open({
|
||||
animation: $rootScope.animationsEnabled,
|
||||
templateUrl: 'partials/matricula/modal/actualizar_matricula_modal.html',
|
||||
scope: $scope,
|
||||
size: 'sm',
|
||||
resolve: {
|
||||
items: function () {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
vm.retirarEstudiante = function (index) {
|
||||
$rootScope.botonOk = false;
|
||||
$rootScope.otroBotonOk = true;
|
||||
$rootScope.botonCancelar = false;
|
||||
$rootScope.urlLo = 'actualizarMatricula';
|
||||
};
|
||||
|
||||
vm.retirarEstudianteSplice = function(index, rsplice) {
|
||||
if(rsplice){
|
||||
vm.listaEstudiantes.splice(index, 1);
|
||||
$rootScope.rsplice = false;
|
||||
|
||||
var section = {
|
||||
'section': vm.matricula.Nombre,
|
||||
'code': vm.matricula.Codigo,
|
||||
'course': vm.matricula.Seccion,
|
||||
'semester': vm.matricula.Semestre,
|
||||
'students': vm.listaEstudiantes
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
$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;
|
||||
};
|
||||
|
||||
})();
|
79
app/js/section/section.module.js
Normal file
79
app/js/section/section.module.js
Normal file
@@ -0,0 +1,79 @@
|
||||
(function(){
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module("app.section", ['ui.router', 'ui.bootstrap'])
|
||||
.run(addStateToScope)
|
||||
.config(getRoutes);
|
||||
|
||||
addStateToScope.$inject = ['$rootScope', '$state', '$stateParams'];
|
||||
function addStateToScope($rootScope, $state, $stateParams){
|
||||
$rootScope.$state = $state;
|
||||
$rootScope.$stateParams = $stateParams;
|
||||
};
|
||||
|
||||
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
|
||||
function getRoutes($stateProvider, $urlRouterProvider){
|
||||
$urlRouterProvider.otherwise('/listarMatricula');
|
||||
|
||||
$stateProvider
|
||||
|
||||
.state('listarMatricula', {
|
||||
url: '/listarMatricula',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/section/list_section.html',
|
||||
controller: 'listarMatriculaCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.state('crearMatricula', {
|
||||
url: '/crearMatricula',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/section/create_section.html',
|
||||
controller: 'crearMatriculaCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.state('actualizarMatricula', {
|
||||
url: '/actualizarMatricula',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/section/update_section.html',
|
||||
controller: 'actualizarMatriculaCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
};
|
||||
})();
|
||||
|
23
app/js/section/section.services.js
Normal file
23
app/js/section/section.services.js
Normal file
@@ -0,0 +1,23 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.section')
|
||||
.factory('sections', sections)
|
||||
.factory('courses', courses)
|
||||
.value('matriculaSeleccionada',{});
|
||||
|
||||
sections.$inject = ['$resource','$rootScope'];
|
||||
function sections($resource, $rootScope){
|
||||
return $resource('http://'+$rootScope.domainUrl+'/sections/:id', null,
|
||||
{
|
||||
'update': {method:'PUT'}
|
||||
});
|
||||
};
|
||||
|
||||
courses.$inject = ['$resource','$rootScope'];
|
||||
function courses($resource, $rootScope){
|
||||
return $resource('http://'+$rootScope.domainUrl+'/courses');
|
||||
};
|
||||
|
||||
})();
|
97
app/js/sidebar/sidebar.controllers.js
Normal file
97
app/js/sidebar/sidebar.controllers.js
Normal file
@@ -0,0 +1,97 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app')
|
||||
.controller('sidebarCtrl', ['$scope',
|
||||
function($scope) {
|
||||
|
||||
var that = this;
|
||||
$scope.showChilds = function(item){
|
||||
item.active = !item.active;};
|
||||
|
||||
$scope.items = [
|
||||
{
|
||||
|
||||
text: 'Modulo de Administración',
|
||||
subItems: [
|
||||
{
|
||||
state: 'listarProfesor',
|
||||
text: 'Listar Profesores'
|
||||
},
|
||||
{
|
||||
state: 'crearProfesor',
|
||||
text: 'Agregar Profesores'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
text: 'Modulo de Materias',
|
||||
subItems: [
|
||||
{
|
||||
state: 'listarMateria',
|
||||
text: 'Listar Materias'
|
||||
},
|
||||
{
|
||||
state: 'crearMateria',
|
||||
text: 'Agregar Materia'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
text: 'Modulo de Estudiantes',
|
||||
subItems: [
|
||||
{
|
||||
state: 'listarEstudiante',
|
||||
text: 'Listar Estudiantes'
|
||||
},
|
||||
{
|
||||
state: 'crearEstudiante',
|
||||
text: 'Agregar Estudiantes'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
text: 'Modulo de Matriculas',
|
||||
subItems: [
|
||||
{
|
||||
state: 'listarMatricula',
|
||||
text: 'Listar Matricula'
|
||||
},
|
||||
{
|
||||
state: 'crearMatricula',
|
||||
text: 'Crear Matricula'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
text: 'Modulo de Reportes',
|
||||
subItems: [
|
||||
{
|
||||
state: 'reportesAlumno',
|
||||
text: 'Reportes por Alumno'
|
||||
},
|
||||
{
|
||||
state: 'reportesClase',
|
||||
text: 'Reportes por Clase'
|
||||
},
|
||||
{
|
||||
state: 'reportesSeccion',
|
||||
text: 'Reportes por Seccion'
|
||||
},
|
||||
{
|
||||
state: 'reportesMateria',
|
||||
text: 'Reportes por Materia'
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
}])
|
||||
|
||||
})();
|
258
app/js/student/student.controllers.js
Normal file
258
app/js/student/student.controllers.js
Normal file
@@ -0,0 +1,258 @@
|
||||
(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', 'students', '$modal'];
|
||||
function crearEstudianteCtrl($scope, $rootScope, $location, students, $modal){
|
||||
|
||||
var vm = this;
|
||||
$rootScope.mensaje = "";
|
||||
$rootScope.actOk = false;
|
||||
|
||||
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,
|
||||
"number": vm.estudiante.Telefono,
|
||||
};
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
students.save(person,
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'listarEstudiante';
|
||||
$rootScope.mensaje = "Estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre + " agregado";
|
||||
$rootScope.crearEstudianteLoading = false;
|
||||
},
|
||||
|
||||
function(){
|
||||
$rootScope.botonOk = true;
|
||||
$rootScope.urlLo = 'listarEstudiante';
|
||||
$rootScope.mensaje = "Error al agregar al estudiante " + vm.estudiante.Apellido + ", " + vm.estudiante.Nombre;
|
||||
$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;
|
||||
};
|
||||
|
||||
})();
|
75
app/js/student/student.module.js
Normal file
75
app/js/student/student.module.js
Normal file
@@ -0,0 +1,75 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module("app.student", ['ui.router', 'ui.bootstrap'])
|
||||
.run(addStateToScope)
|
||||
.config(getRoutes);
|
||||
|
||||
addStateToScope.$inject = ['$rootScope', '$state', '$stateParams'];
|
||||
function addStateToScope($rootScope, $state, $stateParams){
|
||||
$rootScope.$state = $state;
|
||||
$rootScope.$stateParams = $stateParams;
|
||||
};
|
||||
|
||||
getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
|
||||
function getRoutes($stateProvider, $urlRouterProvider){
|
||||
$urlRouterProvider.otherwise('/listarEstudiante');
|
||||
|
||||
$stateProvider
|
||||
.state('listarEstudiante', {
|
||||
url: '/listarEstudiante',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/students/list_students.html',
|
||||
controller: 'listarEstudianteCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.state('crearEstudiante', {
|
||||
url: '/crearEstudiante',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/students/create_students.html',
|
||||
controller: 'crearEstudianteCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.state('actualizarEstudiante', {
|
||||
url: '/actualizarEstudiante',
|
||||
views: {
|
||||
sidebar: {
|
||||
templateUrl: 'partials/sidebar.html',
|
||||
controller: 'sidebarCtrl'
|
||||
},
|
||||
navbar: {
|
||||
templateUrl: 'partials/navbar.html'
|
||||
},
|
||||
content: {
|
||||
templateUrl: 'partials/students/update_students.html',
|
||||
controller: 'actualizarEstudianteCtrl',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
})();
|
16
app/js/student/student.services.js
Normal file
16
app/js/student/student.services.js
Normal file
@@ -0,0 +1,16 @@
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app.student')
|
||||
.factory('students', students)
|
||||
.value('estudianteSeleccionado',{});
|
||||
|
||||
students.$inject = ['$resource','$rootScope'];
|
||||
function students($resource, $rootScope){
|
||||
return $resource('http://'+$rootScope.domainUrl+'/students/:id', null,
|
||||
{
|
||||
'update': {method:'PUT'}
|
||||
});
|
||||
};
|
||||
})();
|
Reference in New Issue
Block a user