Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SistemaGestionAdministrativa
ModuloPersonalCliente
Commits
f0326fb0
Commit
f0326fb0
authored
Jul 12, 2016
by
Teodoro David Nina Mamani
Browse files
Se actualizo la vista para crear y editar cargo
parent
572ddaf3
Changes
6
Hide whitespace changes
Inline
Side-by-side
client/app/cargos/modals/cargos.crear.modal.controller.js
View file @
f0326fb0
...
...
@@ -2,7 +2,7 @@
(()
=>
{
class
CargoCreaModalController
{
constructor
(
$uibModalInstance
,
parametro
,
cargoService
,
EntidadService
,
UnidadService
)
{
constructor
(
$uibModalInstance
,
parametro
,
cargoService
,
EntidadService
,
UnidadService
,
TipoCargoService
)
{
this
.
enviado
=
false
;
this
.
errores
=
{};
this
.
modal
=
$uibModalInstance
;
...
...
@@ -10,11 +10,14 @@
this
.
service
=
cargoService
;
this
.
entidadService
=
EntidadService
;
this
.
unidadService
=
UnidadService
;
this
.
tipoCargoService
=
TipoCargoService
;
this
.
entidad
=
parametro
.
entidad
;
this
.
entidades
=
{};
this
.
unidad
=
parametro
.
unidad
;
this
.
unidades
=
{};
this
.
tipoCargoSeleccionada
=
{};
if
(
!
this
.
entidad
)
{
this
.
entidadService
.
getEntidades
()
...
...
@@ -45,11 +48,25 @@
.
then
(
cargosSuperiores
=>
{
this
.
cargosSuperiores
=
cargosSuperiores
;
});
if
(
this
.
entidad
){
this
.
entidadId
=
this
.
entidad
.
_id
;
this
.
entidadService
.
tiposCargo
(
this
.
entidadId
)
.
then
(
tiposCargos
=>
{
this
.
tiposCargo
=
tiposCargos
;
})
}
// this.tipoCargoService.tiposCargo()
// .then(tiposCargo=> {
// this.tiposCargo = tiposCargo;
// //this.tipoCargo = this.tiposCargo.rows.find(x=>x._id == this.cargo.fk_tipo_cargo)
// })
}
guardarCargo
(
form
)
{
this
.
enviado
=
true
;
if
(
form
.
$valid
)
{
this
.
cargoConvocatoria
.
fk_tipo_cargo
=
this
.
tipoCargoSeleccionada
.
_id
;
this
.
cargoConvocatoria
.
fk_unidad_organizacional
=
this
.
unidadSeleccionada
.
_id
;
if
(
this
.
cargoSuperiorSeleccionada
){
this
.
cargoConvocatoria
.
cargo_superior_id
=
this
.
cargoSuperiorSeleccionada
.
_id
;
...
...
@@ -63,6 +80,28 @@
});
}
}
obtenerUnidad
(
entidadId
)
{
if
(
entidadId
>
0
)
{
this
.
entidadService
.
unidadesOrganizacionales
(
entidadId
)
.
then
(
unidadesOrganizacionales
=>
{
this
.
unidades
=
unidadesOrganizacionales
;
this
.
entidadService
.
tiposCargo
(
entidadId
)
.
then
(
tiposCargos
=>
{
this
.
tiposCargo
=
tiposCargos
;
})
});
}
else
{
this
.
unidades
.
rows
=
{};
this
.
unidades
.
count
=
0
;
this
.
unidadSeleccionada
=
{};
this
.
tiposCargo
=
{};
}
}
//obtenerUnidad
}
angular
.
module
(
'
moduloPersonalApp
'
)
...
...
client/app/cargos/modals/cargos.editar.modal.controller.js
View file @
f0326fb0
'
use strict
'
;
(()
=>
{
class
CargosEditarModalController
{
constructor
(
$uibModalInstance
,
parametro
,
cargoService
,
UnidadService
)
{
constructor
(
$uibModalInstance
,
parametro
,
cargoService
,
UnidadService
,
EntidadService
,
TipoCargoService
)
{
this
.
enviado
=
false
;
this
.
errores
=
{};
this
.
modal
=
$uibModalInstance
;
this
.
service
=
cargoService
;
this
.
unidadService
=
UnidadService
;
this
.
entidadService
=
EntidadService
;
this
.
tipoCargoService
=
TipoCargoService
;
this
.
cargoInicial
=
parametro
.
cargo
;
this
.
cargoConvocatoria
=
Object
.
assign
({
cargo_superior_id
:
null
},
this
.
cargoInicial
);
...
...
@@ -25,6 +27,15 @@
this
.
cargosSuperiores
=
cargosSuperiores
;
this
.
cargoSuperiorSeleccionada
=
this
.
cargosSuperiores
.
rows
.
find
(
x
=>
x
.
_id
===
this
.
cargoInicial
.
cargo_superior_id
);
});
if
(
this
.
cargoInicial
){
this
.
entidadId
=
this
.
entidadSeleccionada
.
_id
;
this
.
entidadService
.
tiposCargo
(
this
.
entidadId
)
.
then
(
tiposCargos
=>
{
this
.
tiposCargo
=
tiposCargos
;
this
.
tipoCargoSeleccionada
=
this
.
tiposCargo
.
rows
.
find
(
x
=>
x
.
_id
===
this
.
cargoInicial
.
fk_tipo_cargo
);
})
}
//if cargo inicial
}
...
...
client/app/cargos/modals/cargos.modal.html
View file @
f0326fb0
...
...
@@ -8,8 +8,9 @@
<div
class=
"col-md-10"
>
<label>
Entidad
</label>
<div
class=
""
>
<select
class=
"form-control"
name=
"entidades"
ng-model=
"vm.entidadSeleccionada"
ng-options=
"crg as (crg.nombre) for crg in vm.entidades.rows"
enabled=
"!vm.entidad"
required
>
<select
class=
"form-control"
id=
"entidades"
ng-model=
"vm.entidadSeleccionada"
enabled=
"!vm.entidad"
ng-options=
"crg as (crg.nombre) for crg in vm.entidades.rows"
ng-change=
"vm.obtenerUnidad(vm.entidadSeleccionada._id)"
required
>
<option
value=
''
>
-- Seleccionar Entidad --
</option>
</select>
<p
class=
"help-block"
ng-show=
"form.entidades.$error.required && vm.enviado"
>
Seleccione Entidad.
...
...
@@ -19,8 +20,9 @@
<div
class=
"col-md-10"
>
<label>
Unidad
</label>
<div
class=
""
>
<select
class=
"form-control"
name=
"unidades"
ng-model=
"vm.unidadSeleccionada"
ng-options=
"crg as (crg.nombre) for crg in vm.unidades.rows"
enabled=
"!vm.unidad"
required
>
<select
class=
"form-control"
id=
"unidades"
ng-disabled=
"!vm.entidadSeleccionada"
ng-model=
"vm.unidadSeleccionada"
ng-options=
"crg as (crg.nombre) for crg in vm.unidades.rows"
required
>
<option
value=
''
>
-- Seleccionar Unidad --
</option>
</select>
<p
class=
"help-block"
ng-show=
"form.unidades.$error.required && vm.enviado"
>
Seleccione unidad.
...
...
@@ -35,6 +37,18 @@
Ingrese nombre del cargo
</p>
</div>
<div
class=
"col-md-10"
>
<label>
Tipo de Cargo
</label>
<div
class=
""
>
<select
name=
"fk_tipo_cargo"
class=
"form-control"
ng-model=
"vm.tipoCargoSeleccionada"
ng-disabled=
"!vm.entidadSeleccionada"
ng-options=
"tpCargo as (tpCargo.nombre) for tpCargo in vm.tiposCargo.rows"
>
<option
value=
''
>
-- Seleccionar Tipo Cargo --
</option>
</select>
<p
class=
"help-block"
ng-show=
"form.fk_tipo_cargo.$error.required && vm.enviado"
>
Ingrese tipo cargo
</p>
</div>
</div>
<div
class=
"col-md-10"
>
<label>
Cargo Superior
</label>
<div
class=
""
>
...
...
@@ -54,7 +68,7 @@
</div>
<div
class=
"modal-footer"
>
<button
class=
"btn btn-primary-outline"
type=
"submit"
ng-disabled=
"!(form.nombre.$dirty || form.unidades.$dirty || form.entidades.$dirty || form.cargoSuperior.$dirty) || form.$invalid"
>
ng-disabled=
"!(form.nombre.$dirty || form.unidades.$dirty || form.entidades.$dirty || form.cargoSuperior.$dirty
|| form.fk_tipo_cargo.$dirty
) || form.$invalid"
>
Guardar
</button>
<button
class=
"btn btn-default"
type=
"button"
ng-click=
"vm.modal.dismiss()"
>
Cancelar
</button>
...
...
client/app/entidades/entidades.service.js
View file @
f0326fb0
...
...
@@ -30,6 +30,10 @@
isArray
:
false
,
method
:
'
GET
'
,
url
:
appConfig
.
serverAddress
+
'
/api/entidades/:id/cargosDisponibles
'
},
tiposCargo
:
{
method
:
'
GET
'
,
url
:
appConfig
.
serverAddress
+
'
/api/entidades/:id/tiposCargo
'
}
})
}
...
...
@@ -73,6 +77,11 @@
cargosDisponibles
(
id
)
{
return
this
.
resource
.
cargosDisponibles
({
id
:
id
}).
$promise
;
}
tiposCargo
(
id
)
{
return
this
.
resource
.
tiposCargo
({
id
:
id
}).
$promise
;
}
}
angular
.
module
(
'
moduloPersonalApp
'
)
...
...
client/app/unidadesOrganizacional/editar/unidadesOrganizacional.editar.controller.js
View file @
f0326fb0
...
...
@@ -9,8 +9,8 @@
this
.
alertas
=
[];
this
.
alertasUnidad
=
[];
this
.
entidadId
=
$stateParams
.
entidadId
;
this
.
cargo
=
$stateParams
.
cargo
;
this
.
estadoAnterior
=
$previousState
;
this
.
entidad
=
{};
this
.
tiposEntidad
=
{};
...
...
@@ -27,10 +27,11 @@
.
then
(
unidadesOrganizacionales
=>
{
this
.
unidadesOrganizacionales
=
unidadesOrganizacionales
;
});
this
.
entidadService
.
getEntidad
(
$stateParam
s
.
entidadId
)
this
.
entidadService
.
getEntidad
(
thi
s
.
entidadId
)
.
then
(
entidad
=>
{
this
.
entidad
=
entidad
;
});
}
//region oficinas
...
...
@@ -119,6 +120,7 @@
}
editarCargo
(
cargo
,
unidad
)
{
this
.
modal
.
open
({
templateUrl
:
'
app/cargos/modals/cargos.modal.html
'
,
controller
:
'
CargoEditarModalCtrl
'
,
...
...
client/app/unidadesOrganizacional/editar/unidadesOrganizacional.editar.html
View file @
f0326fb0
...
...
@@ -79,7 +79,7 @@
<div
class=
"btn-group"
>
<button
type=
"button"
class=
"btn btn-xs btn-primary-outline"
ui-sref=
"cargos.editar({cargoId:cargo._id})"
uib-tooltip=
"Cargo convocatoria"
tooltip-placement=
"bottom-right"
>
<i
class=
"fa fa-th-list fa-lg"
></i></button>
<button
type=
"button"
class=
"btn btn-xs btn-info-outline"
ng-click=
"vm.editarCargo(cargo, unidad);"
uib-tooltip=
"Editar"
tooltip-placement=
"top"
>
<button
type=
"button"
class=
"btn btn-xs btn-info-outline"
ng-click=
"vm.editarCargo(cargo, unidad
);"
uib-tooltip=
"Editar"
tooltip-placement=
"top"
>
<i
class=
"fa fa-edit fa-lg"
></i></button>
<button
type=
"button"
class=
"btn btn-xs btn-danger-outline"
ng-click=
"vm.eliminarCargo(unidad, cargo);"
uib-tooltip=
"eliminar"
tooltip-placement=
"bottom-left"
>
<i
class=
"fa fa-trash fa-lg"
></i></button>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment