Commit 28a8457d authored by Teodoro David Nina Mamani's avatar Teodoro David Nina Mamani
Browse files

Se creo la estructura de la vista Escala Salarial.

parent 5bb6c253
......@@ -3,4 +3,5 @@
<div ui-view="entidad"></div>
<div ui-view="oficinasEntidad"></div>
<div ui-view="unidadesOrganizacionales"></div>
<div ui-view="escalasSalarial"></div>
</div>
......@@ -36,6 +36,11 @@ angular.module('moduloPersonalApp')
templateUrl: 'app/unidadesOrganizacional/editar/unidadesOrganizacional.editar.html',
controller: 'UnidadOrganizacionalEditarCtrl',
controllerAs: 'vm'
},
"escalasSalarial": {
templateUrl: 'app/escalasSalarial/editar/escalasSalarial.html',
controller: 'EscalaSalarialCtrl',
controllerAs: 'vm'
}
}
})
......
(()=> {
'use strict';
class EscalaSalarialController {
constructor($stateParams, $uibModal, Modal){
this.errores = {}; // lista de errores
this.modal = $uibModal;
this.Modal = Modal;
this.alertasEscalaSalarial = [];
this.escalasSalarial = [];
this.entidad = {};
this.id = $stateParams.entidadId;
}
crearEscalaSalarial() {
this.modal.open({
templateUrl: 'app/escalasSalarial/modals/escalasSalarial.modal.html',
controller: 'EscalaSalarialCrearModalCtrl',
controllerAs: 'vm',
resolve: {
parametro: {entidad: this.entidad}
}
}).result.then(escala=> {
this.entidad.escala.push(escala);
this.alertasEscalaSalarial.push({
tipo: 'success',
mensaje: 'Se creo correctamente la Escala Salarial: ' + escala.nombre
})
})
}
}
angular.module('moduloPersonalApp')
.controller('EscalaSalarialCtrl', EscalaSalarialController);
})();
<div class="container">
<div class="row">
<div class="col-sm-5 col-md-4 col-xs-6">
<h4 class="color-primary">Escala Salarial</h4>
</div>
<div class="col-sm-5 col-md-4 col-sm-offset-2">
<div class="pull-right">
<button class="btn btn-success-outline" ng-click="vm.crearEscalaSalarial()" type="button"><i class="fa fa-plus"></i>
Añadir Escala Salarial
</button>
</div>
</div>
</div>
<div class="col-md-10">
<uib-alert ng-repeat="alerta in vm.alertasEscalaSalarial" type="{{alerta.tipo}}"
close="vm.alertasEscalaSalarial.splice($index,1)"
dismiss-on-timeout="3000">{{alerta.mensaje}}
</uib-alert>
</div>
<blockquote class="col-md-12 blockquote-primary">
<div class="row">
<div class="table-responsive col-md-10">
<table class="table table-hover">
<thead>
<tr>
<th><a href="" ng-click="vm.ordenar('nivel')">Nivel</a></th>
<th><a href="" ng-click="vm.ordenar('nombre')">Nombre</a></th>
<th class="text-right" width="12%" ng-click="vm.ordenar('monto')">Monto</th>
<th class="text-center" width="12%">Acciones</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="escala in vm.escalasSalarial">
<td>{{escala.nivel}}</td>
<td>{{escala.nombre}}</td>
<td>{{escala.monto}}</td>
<td class="text-center">
<div class="btn-group" role="group">
<a class="btn btn-info-outline btn-xs" href="#" role="button"
ng-click="vm.editarEscalaSalarial(escala)">
<i class="fa fa-edit fa-lg"></i>
</a>
<a class="btn btn-danger-outline btn-xs" href="#" role="button"
ng-click="vm.eliminarEscalaSalarial(escala)">
<i class="fa fa-trash fa-lg"></i>
</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</blockquote>
</div>
(()=> {
'use strict';
class EscalaSalarialService {
constructor($resource, appConfig) {
this.resource = $resource(appConfig.serverAddress + '/api/escalasSalarial/:id', {id: '@_id'}, {
update: {method: 'PUT'},
query: {isArray: false}
})
}
getEscalasSalarial(pametros) {
return this.resource.query(parametros).$promise;
}
getEscalaSalarial(id, parametros) {
return this.resource.get({id: id, parametros}).$promise;
}
crearEscalaSalaria(comentario) {
return this.resource.save(comentario).$promise;
}
editarEscalaSalaria(id, comentario) {
return this.resource.update({id: id}, comentario).$promise;
}
eliminarEscalaSalaria(id) {
return this.resource.remove({id: id}).$promise;
}
}
angular.module('moduloPersonalApp')
.service('EscalaSalarialService', EscalaSalarialService);
})();
'use strict';
describe('Service: escalasSalarial', function () {
// load the service's module
beforeEach(module('moduloPersonalApp'));
// instantiate service
var escalasSalarial;
beforeEach(inject(function (_escalasSalarial_) {
escalasSalarial = _escalasSalarial_;
}));
it('should do something', function () {
expect(!!escalasSalarial).to.be.true;
});
});
(()=> {
'use strict';
class EscalaSalarialCrearModalController {
constructor($stateParams, $uibModal, EntidadService){
this.enviado = false;
this.errores = {};
this.modal = $uibModal;
}
guardarEscalaSalarial(form){
this.enviado = true;
if(form.$valid){
console.log('Form valido crear');
}
}
}
angular.module('moduloPersonalApp')
.controller('EscalaSalarialCrearModalCtrl', EscalaSalarialCrearModalController);
})();
(()=> {
'use strict';
class EscalaSalarialEditarModalController {
constructor($stateParams, $uibModal){
this.enviado = false;
this.errores = {};
this.modal = $uibModal;
}
guardarEscalaSalarial(form){
this.enviado = true;
if(form.$valid){
console.log('Form valido de edicion');
}
}
}
angular.module('moduloPersonalApp')
.controller('EscalaSalarialEditarModalCtrl', EscalaSalarialEditarModalController);
})();
<form class="form" name="form" ng-submit="vm.guardarEscalaSalarial(form)" novalidate>
<div class="modal-header modal-header-primary ">
<button type="button" ng-click="vm.modal.dismiss()" class="close">&times;</button>
<h4 class="modal-title">Escala Salarial</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-10">
<label>Nivel</label>
<div class="">
<input type="text" name="nivel" class="form-control" placeholder="# Nivel de la escala salarial."
ng-model="vm.escala.nivel" required>
<p class="help-block" ng-show="form.nivel.$error.required && vm.enviado">
Ingrese la sigla de la escala salarial.
</p>
</div>
</div>
<div class="col-md-10">
<label>Nombre</label>
<div class="">
<input type="text" name="nombre" class="form-control" placeholder="Nombre de la escala salarial."
ng-model="vm.escala.nombre" required>
<p class="help-block" ng-show="form.nombre.$error.required && vm.enviado">
Ingrese nombre de la escala salarial.
</p>
</div>
</div>
<div class="col-md-10">
<label>Monto</label>
<div class="">
<input type="text" name="monto" class="form-control" placeholder="Monto de la escala salarial."
ng-model="vm.escala.monto" required>
<p class="help-block" ng-show="form.monto.$error.required && vm.enviado">
Ingrese la monto de la escala salarial.
</p>
</div>
</div>
</div>
<div class="form-group has-error">
<p class="help-block">{{ vm.errores.otros}}</p>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary-outline" type="submit"
ng-disabled="!(form.nombre.$dirty || form.monto.$dirty||form.nivel.$dirty)">
Guardar
</button>
<button class="btn btn-default" type="button" ng-click="vm.modal.dismiss()">Cancelar</button>
</div>
</form>
......@@ -73,7 +73,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/personas/personas.controller.js"></script>
<script src="app/personas/editar/personas.editar.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>
......@@ -99,6 +99,10 @@
<script src="app/entidades/modals/entidades.crear.modal.controller.js"></script>
<script src="app/entidades/organigrama/entidades.organigrama.controller.js"></script>
<script src="app/entidadesOficina/entidadesOficina.service.js"></script>
<script src="app/escalasSalarial/editar/escalaSalarial.controller.js"></script>
<script src="app/escalasSalarial/escalasSalarial.service.js"></script>
<script src="app/escalasSalarial/modals/escalasSalarial.crear.modal.controller.js"></script>
<script src="app/escalasSalarial/modals/escalasSalarial.editar.modal.controller.js"></script>
<script src="app/main/main.controller.js"></script>
<script src="app/main/main.js"></script>
<script src="app/oficinas/editar/oficinas.editar.controller.js"></script>
......@@ -108,9 +112,9 @@
<script src="app/oficinas/modals/oficinas.editar.modal.controller.js"></script>
<script src="app/oficinas/oficinas.service.js"></script>
<script src="app/oficinasUnidad/oficinasUnidad.service.js"></script>
<script src="app/personas/editar/personas.editar.controller.js"></script>
<script src="app/personas/modals/personas.crear.modal.controller.js"></script>
<script src="app/cargos/cargos.controller.js"></script>
<script src="app/personas/modals/personas.crear.modal.controller.js"></script>
<script src="app/personas/personas.controller.js"></script>
<script src="app/personas/personas.js"></script>
<script src="app/personas/personas.service.js"></script>
<script src="app/postulaciones/modals/postulaciones.cargo.modal.controller.js"></script>
......
Supports Markdown
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