Vistas migracion de datos desde moodle

parent 5eabc4c5
......@@ -198,6 +198,7 @@ input[type=checkbox].with-font:checked ~ label:before {
@import 'evaluacionesCargosEtapas/evaluacionesCargosEtapas.scss';
@import 'gruposConvocatoria/gruposConvocatoria.scss';
@import 'main/main.scss';
@import 'migracionMoodle/migracionMoodle.scss';
@import 'personas/personas.scss';
@import 'postulaciones/postulaciones.scss';
@import 'relacionesLaborales/relacionesLaborales.scss';
......
<div class="container">
<div class="row">
<div class="col-sm-3 col-md-3 col-xs-6">
<h4 class="color-primary">Categorias Moodle
<small><span class="label label-default">{{vm.totalElementos}}</span></small>
</h4>
</div>
</div>
<div class="col-md-10">
<uib-alert ng-repeat="alerta in vm.alertas" type="{{alerta.tipo}}" close="vm.alertas.splice($index,1)"
dismiss-on-timeout="3000">{{alerta.mensaje}}
</uib-alert>
</div>
<div class="row">
<div class="table-responsive col-md-10">
<table class="table table-striped">
<thead>
<tr>
<th><a href="">id</a></th>
<th><a href="" ng-click="vm.ordenar('nombres')">Nombre</a></th>
<th colspan="2" class="text-center">Opciones</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="categoria in vm.categorias">
<td>{{categoria.idCategoria}}</td>
<td>{{categoria.nombreCategoria}}</td>
<td class="text-center">
<div class="btn-group" role="group">
<a class="btn btn-success-outline btn-xs" href="#" role="button" ui-sref="migracionMoodle.curso({idCategoria:categoria.idCategoria})">
<i class="fa fa-lg fa-clone"></i>
Cursos
</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<uib-pagination
ng-hide="vm.totalElementos < 10"
total-items="vm.totalElementos"
items-per-page="10"
max-size="8"
force-ellipses="true"
ng-model="vm.paginaActual"
ng-change="vm.cambiarPagina()"
next-text="Siguiente"
previous-Text="Anterior"></uib-pagination>
</div>
</div>
'use strict';
(()=> {
class MigracionMoodleController {
constructor($stateParams, $uibModal, Modal, MigracionMoodleService) {
this.alertas = [];
this.modal = $uibModal;
this.Modal = Modal;
this.service = MigracionMoodleService;
this.categorias = {};
// this.service.getWSCategoria()
this.service.getCategoriasMoodle()
.then((categorias)=>{
this.categorias = categorias;
this.totalElementos = categorias.length;
})
}
}
angular.module('moduloPersonalApp')
.controller('MigracionMoodleCtrl', MigracionMoodleController);
})
();
'use strict';
describe('Controller: MigracionMoodleCtrl', function () {
// load the controller's module
beforeEach(module('moduloPersonalApp'));
var MigracionMoodleCtrl, scope;
// Initialize the controller and a mock scope
beforeEach(inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
MigracionMoodleCtrl = $controller('MigracionMoodleCtrl', {
$scope: scope
});
}));
it('should ...', function () {
expect(1).to.equal(1);
});
});
'use strict';
(()=> {
class MigracionMoodleCursoController {
constructor($stateParams, $previousState, $uibModal, Modal, MigracionMoodleService) {
this.alertas = [];
this.modal = $uibModal;
this.Modal = Modal;
this.estadoAnterior = $previousState;
this.service = MigracionMoodleService;
this.cursos = {};
this.idCategoria = $stateParams.idCategoria;
this.service.getCursosMoodle({id: this.idCategoria })
.then((cursos)=>{
this.cursos = cursos;
this.totalElementos = cursos.length;
})
}
}
angular.module('moduloPersonalApp')
.controller('MigracionMoodleCursoCtrl', MigracionMoodleCursoController);
})
();
<div class="container">
<div class="row">
<div class="col-sm-3 col-md-3 col-xs-6">
<h4 class="color-primary">Cursos Moodle
<small><span class="label label-default">{{vm.totalElementos}}</span></small>
</h4>
</div>
<div class="col-sm-5 col-md-5 col-sm-offset-2">
<div class="pull-right">
<a class="btn btn-default header-button" ng-click="vm.estadoAnterior.go()">
<i class="fa fa-arrow-left"></i>
Regresar
</a>
</div>
</div>
</div>
<div class="col-md-10">
<uib-alert ng-repeat="alerta in vm.alertas" type="{{alerta.tipo}}" close="vm.alertas.splice($index,1)"
dismiss-on-timeout="3000">{{alerta.mensaje}}
</uib-alert>
</div>
<div class="row">
<div class="table-responsive col-md-10">
<table class="table table-striped">
<thead>
<tr>
<th><a href="">id</a></th>
<th><a href="" ng-click="vm.ordenar('nombres')">Nombre</a></th>
<th colspan="2" class="text-center">Opciones</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="curso in vm.cursos">
<td>{{curso.idCurso}}</td>
<td>{{curso.nombreCurso}}</td>
<td class="text-center">
<div class="btn-group" role="group">
<a class="btn btn-success-outline btn-xs" href="#" role="button" ui-sref="migracionMoodle.examen({idCurso:curso.idCurso})">
<i class="fa fa-lg fa-list-ul"></i>
Examenes
</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<uib-pagination
ng-hide="vm.totalElementos < 10"
total-items="vm.totalElementos"
items-per-page="10"
max-size="8"
force-ellipses="true"
ng-model="vm.paginaActual"
ng-change="vm.cambiarPagina()"
next-text="Siguiente"
previous-Text="Anterior"></uib-pagination>
</div>
</div>
'use strict';
(()=> {
class MigracionMoodleExamenController {
constructor($stateParams, $uibModal, Modal, MigracionMoodleService) {
this.alertas = [];
this.modal = $uibModal;
this.Modal = Modal;
this.service = MigracionMoodleService;
this.cursos = {};
this.examenes = {};
this.idCurso = $stateParams.idCurso;
this.service.getExamenesMoodle({id: this.idCurso })
.then((examenes)=>{
this.examenes = examenes;
this.totalElementos = examenes.length;
})
}
migrarDatos(form){
this.enviado = true;
if (form.$valid) {
// console.log( this.examenes );
this.examenes.forEach(examen=>{
if(examen.checked){
this.service.getNotasMoodle({id: examen.id})
.then(notas=>{
console.log(notas);
})
}
})
}
}
}
angular.module('moduloPersonalApp')
.controller('MigracionMoodleExamenCtrl', MigracionMoodleExamenController);
})
();
<div class="container">
<div class="row">
<div class="col-sm-3 col-md-3 col-xs-6">
<h4 class="color-primary">Examenes Moodle
<small><span class="label label-default">{{vm.totalElementos}}</span></small>
</h4>
</div>
<div class="col-sm-7 col-md-5 col-sm-offset-2">
<div class="pull-right btn-group">
<button class="btn btn-default" ui-sref="migracionMoodle.categoria" type="button"><i
class="fa fa-arrow-left"></i>
Cancelar
</button>
</div>
</div>
</div>
<div class="col-md-10">
<uib-alert ng-repeat="alerta in vm.alertas" type="{{alerta.tipo}}" close="vm.alertas.splice($index,1)"
dismiss-on-timeout="3000">{{alerta.mensaje}}
</uib-alert>
</div>
<div class="row">
<form class="form" name="form" ng-submit="vm.migrarDatos(form)" novalidate>
<div class="table-responsive col-md-10">
<table class="table table-striped">
<thead>
<tr>
<th>id</th>
<th>Nombre</th>
<th>Introdución</th>
<th colspan="2" class="text-center">Opciones</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="examen in vm.examenes">
<td>{{examen.idExamen}}</td>
<td>{{examen.nombreExamen}}</td>
<td ng-bind-html="examen.introExamen">{{examen.introExamen}}</td>
<td class="text-center">
<input type="checkbox" ng-model="examen.checked" id="{{examen.idExamen}}" name="seleccionado" >
</td>
</tr>
</tbody>
</table>
</div>
<uib-pagination
ng-hide="vm.totalElementos < 1000"
total-items="vm.totalElementos"
items-per-page="10"
max-size="8"
force-ellipses="true"
ng-model="vm.paginaActual"
ng-change="vm.cambiarPagina()"
next-text="Siguiente"
previous-Text="Anterior"></uib-pagination>
<div class="col-md-10">
<div class="pull-right">
<button class="btn btn-primary-outline" type="submit" ng-disabled="!(examen.checked!=1)">
Migrar Datos
</button>
</div>
</div>
</form>
</div>
</div>
<div class="container">
<div ui-view></div>
</div>
'use strict';
angular.module('moduloPersonalApp')
.config(function ($stateProvider) {
$stateProvider
.state('migracionMoodle', {
abstract: true,
url: '/migracionMoodle',
templateUrl: 'app/migracionMoodle/migracionMoodle.html',
controller: 'MigracionMoodleCtrl',
controllerAs: 'vm'
})
.state('migracionMoodle.categoria', {
url: '',
templateUrl: 'app/migracionMoodle/migracionMoodle.categoria.html'
})
.state('migracionMoodle.curso', {
url: '/cursosMoodle/:idCategoria',
templateUrl: 'app/migracionMoodle/migracionMoodle.curso.html',
controller: 'MigracionMoodleCursoCtrl',
controllerAs: 'vm'
})
.state('migracionMoodle.examen', {
url: '/examenesMoodle/:idCurso',
templateUrl: 'app/migracionMoodle/migracionMoodle.examen.html',
controller: 'MigracionMoodleExamenCtrl',
controllerAs: 'vm'
})
});
'use strict';
(()=> {
class MigracionMoodleService {
constructor($resource, appConfig) {
this.resource = $resource(appConfig.serverAddress + '/api/migracionMoodle/:id', {
id: '@_id'
},
{
update: {method: 'PUT'},
query: {isArray: false},
categoriasMoodle: {
isArray: true,
method: 'GET',
url: appConfig.serverAddress + '/api/migracionMoodle/categoriasMoodle'
},
cursosMoodle: {
isArray: true,
method: 'GET',
url: appConfig.serverAddress + '/api/migracionMoodle/cursosMoodle/:id'
},
examenesMoodle: {
isArray: true,
method: 'GET',
url: appConfig.serverAddress + '/api/migracionMoodle/examenesMoodle/:id'
},
wsCategoria: {
isArray: true,
method: 'GET',
url: appConfig.serverAddress + '/api/migracionMoodle/wsCategoria'
},
notasMoodle: {
isArray: true,
method: 'GET',
url: appConfig.serverAddress + '/api/migracionMoodle/notasMoodle/:id'
}
})
}
getCategoriasMoodle() {
return this.resource.categoriasMoodle().$promise;
}
getCursosMoodle(parametros){
return this.resource.cursosMoodle(parametros).$promise;
}
getExamenesMoodle(parametros){
return this.resource.examenesMoodle(parametros).$promise;
}
getWSCategoria(){
return this.resource.wsCategoria().$promise;
}
getNotasMoodle(parametros){
return this.resource.notasMoodle(parametros).$promise;
}
}
angular.module('moduloPersonalApp')
.service('MigracionMoodleService', MigracionMoodleService);
})
();
'use strict';
describe('Service: migracionMoodle', function () {
// load the service's module
beforeEach(module('moduloPersonalApp'));
// instantiate service
var migracionMoodle;
beforeEach(inject(function (_migracionMoodle_) {
migracionMoodle = _migracionMoodle_;
}));
it('should do something', function () {
expect(!!migracionMoodle).to.be.true;
});
});
......@@ -24,6 +24,10 @@ class NavbarController {
'title':'Tipos Entidad',
'state':'tiposEntidad.lista',
'parentState':'tiposEntidad'
},{
'title':'Migracion Moodle',
'state':'migracionMoodle.categoria',
'parentState':'migracionMoodle'
}];
isCollapsed = true;
......
......@@ -75,7 +75,7 @@
<script src="components/autenticacion/autenticacion.module.js"></script>
<script src="components/modal/modal.module.js"></script>
<script src="components/util/util.module.js"></script>
<script src="app/main/main.controller.js"></script>
<script src="app/migracionMoodle/migracionMoodle.curso.controller.js"></script>
<script src="app/cargos/editar/cargos.editar.controller.js"></script>
<script src="app/cargos/modals/cargos.crear.modal.controller.js"></script>
<script src="app/cargos/modals/cargos.editar.modal.controller.js"></script>
......@@ -127,8 +127,13 @@
<script src="app/gruposConvocatoria/gruposConvocatoria.service.js"></script>
<script src="app/gruposConvocatoria/modals/gruposConvocatoria.crear.modal.controller.js"></script>
<script src="app/gruposConvocatoria/modals/gruposConvocatoria.editar.modal.controller.js"></script>
<script src="app/cargos/cargos.controller.js"></script>
<script src="app/main/main.controller.js"></script>
<script src="app/main/main.js"></script>
<script src="app/migracionMoodle/migracionMoodle.controller.js"></script>
<script src="app/cargos/cargos.controller.js"></script>
<script src="app/migracionMoodle/migracionMoodle.examen.controller.js"></script>
<script src="app/migracionMoodle/migracionMoodle.js"></script>
<script src="app/migracionMoodle/migracionMoodle.service.js"></script>
<script src="app/oficinas/editar/oficinas.editar.controller.js"></script>
<script src="app/oficinas/modals/oficina.entidad.crear.modal.controller.js"></script>
<script src="app/oficinas/modals/oficina.entidad.editar.modal.controller.js"></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment