Update routes, mongoose schema and web flow

This commit is contained in:
Reynaldo Reyes
2016-03-27 23:24:28 -04:30
parent b8b65e64d7
commit 7fff896e43
34 changed files with 735 additions and 631 deletions

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

View 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/sidebar.html',
controller: 'sidebarCtrl'
},
navbar: {
templateUrl: 'partials/sidebar/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'
})
};
})();

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