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
c3085508
Commit
c3085508
authored
Jul 21, 2016
by
D’jalmar Gutierrez Titirico
🚲
Browse files
se agrego la posibilidad de editar las entidades en el organigrama
parent
76b82545
Changes
10
Show whitespace changes
Inline
Side-by-side
client/app/cargos/modals/cargos.editar.modal.controller.js
View file @
c3085508
...
...
@@ -14,23 +14,23 @@
this
.
cargoConvocatoria
=
Object
.
assign
({
cargo_superior_id
:
null
},
this
.
cargoInicial
);
this
.
entidadSeleccionada
=
parametro
.
entidad
;
this
.
entidades
=
{
rows
:
[
this
.
entidadSeleccionada
],
count
:
1
}
this
.
entidades
=
{
rows
:
[
this
.
entidadSeleccionada
],
count
:
1
}
;
this
.
unidad
=
parametro
.
unidad
;
this
.
un
idadService
.
getUnidades
(
)
this
.
ent
idadService
.
unidadesOrganizacionales
(
this
.
entidadSeleccionada
.
_id
)
.
then
(
unidades
=>
{
this
.
unidades
=
unidades
;
this
.
unidadSeleccionada
=
this
.
unidades
.
rows
.
find
(
x
=>
x
.
_id
===
this
.
unidad
.
_id
);
});
this
.
s
ervice
.
getC
argos
()
this
.
unidadS
ervice
.
c
argos
(
this
.
unidad
.
_id
)
.
then
(
cargosSuperiores
=>
{
this
.
cargosSuperiores
=
cargosSuperiores
;
this
.
cargoSuperiorSeleccionada
=
this
.
cargosSuperiores
.
rows
.
find
(
x
=>
x
.
_id
===
this
.
cargoInicial
.
cargo_superior_id
);
});
if
(
this
.
cargoInicial
){
if
(
this
.
cargoInicial
)
{
this
.
entidadId
=
this
.
entidadSeleccionada
.
_id
;
this
.
entidadService
.
tiposCargo
(
this
.
entidadId
)
.
then
(
tiposCargos
=>
{
.
then
(
tiposCargos
=>
{
this
.
tiposCargo
=
tiposCargos
;
this
.
tipoCargoSeleccionada
=
this
.
tiposCargo
.
rows
.
find
(
x
=>
x
.
_id
===
this
.
cargoInicial
.
fk_tipo_cargo
);
})
...
...
client/app/entidades/entidades.service.js
View file @
c3085508
...
...
@@ -26,6 +26,7 @@
method
:
'
GET
'
,
url
:
appConfig
.
serverAddress
+
'
/api/entidades/:id/convocatorias
'
},
cargosDisponibles
:
{
isArray
:
false
,
method
:
'
GET
'
,
...
...
client/app/entidades/modals/entidades.editar.modal.controller.js
0 → 100644
View file @
c3085508
'
use strict
'
;
(()
=>
{
class
EntidadEditarModalController
{
constructor
(
$uibModalInstance
,
parametros
,
EntidadService
,
tipoEntidadService
)
{
this
.
enviado
=
false
;
this
.
errores
=
{};
this
.
modal
=
$uibModalInstance
;
this
.
service
=
EntidadService
;
this
.
entidad
=
parametros
.
entidad
;
this
.
entidades
=
Object
.
assign
({},
this
.
entidad
);
this
.
entidadesSuperior
=
{};
tipoEntidadService
.
getTiposEntidad
({
ordenarPor
:
'
nombre
'
})
.
then
(
tipoEntidad
=>
{
this
.
tiposEntidad
=
tipoEntidad
;
this
.
tipoEntidadSeleccionado
=
this
.
tiposEntidad
.
rows
.
find
(
x
=>
x
.
_id
==
this
.
entidad
.
fk_tipo_entidad
);
});
EntidadService
.
getEntidades
()
.
then
(
entidad
=>
{
this
.
entidadesSuperior
=
entidad
;
this
.
entidadesSuperiorSeleccionado
=
this
.
entidadesSuperior
.
rows
.
find
(
x
=>
x
.
_id
==
this
.
entidad
.
fk_entidad_superior
);
});
}
guardarEntidad
(
form
)
{
this
.
enviado
=
true
;
if
(
form
.
$valid
)
{
this
.
entidades
.
fk_tipo_entidad
=
this
.
tipoEntidadSeleccionado
.
_id
;
if
(
this
.
entidadesSuperiorSeleccionado
)
{
this
.
entidades
.
fk_entidad_superior
=
this
.
entidadesSuperiorSeleccionado
.
_id
;
}
this
.
service
.
editarEntidad
(
this
.
entidad
.
_id
,
this
.
entidades
)
.
then
(
entidad
=>
{
this
.
modal
.
close
(
entidad
);
})
.
catch
(
err
=>
{
this
.
errores
.
otros
=
err
.
data
.
message
;
})
}
}
}
angular
.
module
(
'
moduloPersonalApp
'
)
.
controller
(
'
EntidadEditarModalCtrl
'
,
EntidadEditarModalController
);
})();
client/app/entidades/organigrama/entidades.organigrama.controller.js
View file @
c3085508
...
...
@@ -1271,13 +1271,13 @@
enlaceEliminar
.
innerText
=
'
Eliminar
'
;
enlaceEditar
.
innerText
=
'
Editar
'
;
itemEditar
.
appendChild
(
enlaceEditar
);
itemEliminar
.
appendChild
(
enlaceEliminar
);
//
itemEliminar.appendChild(enlaceEliminar);
lista
.
className
=
'
dropdown-menu
'
;
lista
.
setAttribute
(
'
uib-dropdown-menu
'
,
''
);
lista
.
setAttribute
(
'
aria-labelledby
'
,
"
simple-dropdown
"
);
lista
.
appendChild
(
itemEditar
);
lista
.
appendChild
(
itemEliminar
);
//
lista.appendChild(itemEliminar);
icono
.
className
=
'
fa fa-ellipsis-v fa-lg
'
;
boton
.
className
=
'
btn btn-default
'
;
...
...
@@ -1469,7 +1469,7 @@
}
formatearArbol
(
raiz
)
{
raiz
.
text
=
{
name
:
raiz
.
title
+
'
'
+
raiz
.
orden
,
title
:
raiz
.
name
};
raiz
.
text
=
{
name
:
raiz
.
title
,
title
:
raiz
.
name
};
if
(
!
raiz
.
name
)
{
raiz
.
pseudo
=
true
;
}
...
...
@@ -1514,7 +1514,7 @@
raiz
.
text
.
node
.
children
[
1
].
lastChild
.
setAttribute
(
'
ng-click
'
,
'
vm.moverNodo(vm.
'
+
nombreNodo
+
'
, 1)
'
);
//agregando los eventos 'ng-click' para editar, eliminar y crear nodos
raiz
.
text
.
node
.
children
[
2
].
lastChild
.
children
[
0
].
setAttribute
(
'
ng-click
'
,
'
vm.editarNodo(vm.
'
+
nombreNodo
+
'
)
'
);
raiz
.
text
.
node
.
children
[
2
].
lastChild
.
children
[
1
].
setAttribute
(
'
ng-click
'
,
'
vm.
elimin
arNodo(vm.
'
+
nombreNodo
+
'
)
'
);
//
raiz.text.node.children[2].lastChild.children[1].setAttribute('ng-click', 'vm.
cre
arNodo(vm.' + nombreNodo + ')');
if
(
raiz
.
text
.
node
.
childElementCount
>
3
)
{
raiz
.
text
.
node
.
lastChild
.
setAttribute
(
'
ng-click
'
,
'
vm.colapsar(vm.
'
+
nombreNodo
+
'
)
'
);
raiz
.
text
.
node
.
lastChild
.
firstChild
.
setAttribute
(
'
ng-class
'
,
"
{'fa-angle-up':!vm.
"
+
nombreNodo
+
"
.colapsado, 'fa-angle-down':vm.
"
+
nombreNodo
+
"
.colapsado}
"
);
...
...
@@ -1565,13 +1565,15 @@
nodo
.
entidad
=
entidad
;
this
.
modal
.
open
({
templateUrl
:
'
app/entidades/modals/entidades.crear.modal.html
'
,
controller
:
'
Entidad
Cre
arModalCtrl
'
,
controller
:
'
Entidad
Edit
arModalCtrl
'
,
controllerAs
:
'
vm
'
,
resolve
:
{
parametro
:
{
entidad
:
this
.
entidad
,
unidad
:
un
idad
}
parametro
s
:
{
entidad
:
nodo
.
ent
idad
}
}
}).
result
.
then
(
entidad
=>
{
nodo
.
entidad
=
Object
.
assign
(
node
.
entidad
,
entidad
);
nodo
.
text
.
node
.
firstChild
.
innerText
=
entidad
.
nombre
;
this
.
alertas
.
push
({
tipo
:
'
success
'
,
mensaje
:
'
Se creo correctamente la oficina:
'
+
oficina
.
nombre
...
...
@@ -1607,23 +1609,32 @@
});
break
;
case
'
cargo
'
:
this
.
cargoService
.
getCargo
(
nodo
.
cargoId
)
console
.
log
(
nodo
);
this
.
cargoService
.
getCargo
(
nodo
.
_id
)
.
then
(
cargo
=>
{
nodo
.
cargo
=
cargo
;
return
this
.
unidadOrganizacionalService
.
getUnidad
(
cargo
.
fk_unidad_organizacional
);
})
.
then
((
unidad
)
=>
{
nodo
.
unidad
=
unidad
;
return
this
.
service
.
getEntidad
(
unidad
.
fk_entidad
);
})
.
then
((
entidad
)
=>
{
nodo
.
entidad
=
entidad
;
this
.
modal
.
open
({
templateUrl
:
'
app/
unidadesOrganizacional/modals/unidadesOrganizacional
.modal.html
'
,
controller
:
'
UnidadOrganizacional
EditarModalCtrl
'
,
templateUrl
:
'
app/
cargos/modals/cargos
.modal.html
'
,
controller
:
'
Cargo
EditarModalCtrl
'
,
controllerAs
:
'
vm
'
,
resolve
:
{
parametro
:
{
entidad
:
entidad
,
unidad
:
nodo
.
unidad
Organizacional
}
parametro
:
{
entidad
:
entidad
,
unidad
:
nodo
.
unidad
,
cargo
:
nodo
.
cargo
}
}
}).
result
.
then
(
unidad
=>
{
nodo
.
unidadOrganizacional
=
Object
.
assign
(
nodo
.
unidadOrganizacional
,
unidad
);
nodo
.
text
.
node
.
firstChild
.
innerText
=
unidad
.
nombre
;
.
then
(
cargo
=>
{
nodo
.
cargo
=
Object
.
assign
(
nodo
.
cargo
,
cargo
);
nodo
.
text
.
node
.
firstChild
.
innerText
=
cargo
.
nombre
;
this
.
alertas
.
push
({
tipo
:
'
success
'
,
mensaje
:
'
Se
actualizó la Unidad Organizacional:
'
+
unidad
.
nombre
mensaje
:
'
Se
el cargo :
'
+
cargo
.
nombre
})
})
})
...
...
@@ -1631,14 +1642,48 @@
}
}
eliminarNodo
(
nodo
)
{
console
.
log
(
'
eliminar
'
);
crearNodo
(
nodo
)
{
switch
(
nodo
.
tipo
)
{
case
'
entidad
'
:
this
.
modal
.
open
({
templateUrl
:
'
app/entidades/modals/entidades.crear.modal.html
'
,
controller
:
'
EntidadCrearModalCtrl
'
,
controllerAs
:
'
vm
'
}).
result
.
then
(
entidad
=>
{
this
.
alertas
.
push
({
tipo
:
'
success
'
,
mensaje
:
'
Se creo correctamente la oficina:
'
+
oficina
.
nombre
})
});
break
;
case
'
unidadOrganizacional
'
:
this
.
modal
.
open
({
templateUrl
:
'
app/unidadesOrganizacional/modals/unidadesOrganizacional.modal.html
'
,
controller
:
'
UnidadOrganizacionalCrearModalCtrl
'
,
controllerAs
:
'
vm
'
,
resolve
:
{
parametro
:
{}}
}).
result
.
then
(
unidad
=>
{
this
.
alertas
.
push
({
tipo
:
'
success
'
,
mensaje
:
'
Se actualizó la Unidad Organizacional:
'
+
unidad
.
nombre
})
});
break
;
case
'
cargo
'
:
this
.
modal
.
open
({
templateUrl
:
'
app/cargos/modals/cargos.modal.html
'
,
controller
:
'
CargoCrearModalCtrl
'
,
controllerAs
:
'
vm
'
,
resolve
:
{
parametro
:
{}}
}).
result
.
then
(
cargo
=>
{
this
.
alertas
.
push
({
tipo
:
'
success
'
,
mensaje
:
'
Se el cargo :
'
+
cargo
.
nombre
})
});
break
;
}
}
...
...
client/app/entidades/organigrama/entidades.organigrama.html
View file @
c3085508
...
...
@@ -11,32 +11,8 @@
</div>
</div>
</div>
<!--<div class="container-fluid">-->
<!--<div class="row">-->
<!--<div id="chart" class="orgchart-primary">-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<br>-->
<div
class=
"container-fluid"
>
<div
class=
"row"
>
<div
class=
"chart"
id=
"collapsable-example"
></div>
</div>
</div>
<div
class=
"row"
>
<button
class=
"btn btn-primary-outline"
ng-click=
"vm.borrar()"
>
Borrar
</button>
</div>
<div
class=
"row"
>
<span
uib-dropdown
on-toggle=
"toggled(open)"
>
<a
href
id=
"simple-dropdown"
uib-dropdown-toggle
>
<span
class=
"caret"
></span>
</a>
<ul
class=
"dropdown-menu"
uib-dropdown-menu
aria-labelledby=
"simple-dropdown"
>
<li>
asdasd
</li>
<li>
asdasd
</li>
</ul>
</span>
</div>
</div>
client/app/personas/modals/personas.editar.modal.controller.js
View file @
c3085508
...
...
@@ -16,16 +16,13 @@
this
.
enviado
=
true
;
if
(
form
.
$valid
)
{
this
.
service
.
editarPersona
(
this
.
persona
.
_id
,
this
.
persona
)
.
then
((
persona
)
=>
{
.
then
((
persona
)
=>
{
this
.
modal
.
close
(
persona
);
})
}
}
}
//class
angular
.
module
(
'
moduloPersonalApp
'
)
.
controller
(
'
PersonaEditarModalCtrl
'
,
PersonaEditarModalController
);
angular
.
module
(
'
moduloPersonalApp
'
)
.
controller
(
'
PersonaEditarModalCtrl
'
,
PersonaEditarModalController
);
})();
client/app/unidadesOrganizacional/modals/unidadesOrganizacional.editar.modal.controller.js
View file @
c3085508
'
use strict
'
;
(()
=>
{
class
UnidadOrganizacionalEditarModalController
{
constructor
(
$uibModalInstance
,
parametro
,
UnidadService
)
{
constructor
(
$uibModalInstance
,
parametro
,
UnidadService
,
EntidadService
)
{
this
.
enviado
=
false
;
this
.
errores
=
{};
this
.
modal
=
$uibModalInstance
;
this
.
service
=
UnidadService
;
this
.
entidadService
=
EntidadService
;
this
.
unidadInicial
=
parametro
.
unidad
;
this
.
unidad
=
Object
.
assign
({},
this
.
unidadInicial
);
...
...
@@ -13,7 +15,7 @@
this
.
entidadSeleccionada
=
parametro
.
entidad
;
this
.
entidades
=
{
rows
:
[
this
.
entidadSeleccionada
],
count
:
1
};
this
.
service
.
getUnidades
(
)
this
.
entidadService
.
unidadesOrganizacionales
(
this
.
unidadInicial
.
fk_entidad
)
.
then
(
unidadesSuperiores
=>
{
this
.
unidadesSuperiores
=
unidadesSuperiores
;
this
.
unidadSuperiorSeleccionada
=
this
.
unidadesSuperiores
.
rows
.
find
(
x
=>
x
.
_id
==
this
.
unidadInicial
.
unidad_superior_id
);
...
...
@@ -28,7 +30,7 @@
if
(
form
.
$valid
)
{
if
(
this
.
unidadSuperiorSeleccionada
)
{
this
.
unidad
.
unidad_superior_id
=
this
.
unidadSuperiorSeleccionada
.
_id
;
}
else
{
}
else
{
this
.
unidad
.
unidad_superior_id
=
this
.
unidadSuperiorSeleccionada
;
}
this
.
service
.
editarUnidad
(
this
.
unidad
.
_id
,
this
.
unidad
)
...
...
client/app/unidadesOrganizacional/unidadesOrganizacional.service.js
View file @
c3085508
...
...
@@ -10,6 +10,11 @@
method
:
'
PUT
'
,
isArray
:
true
,
url
:
appConfig
.
serverAddress
+
'
/api/unidadesOrganizacional/:id/ordenarCargos
'
},
cargos
:
{
isArray
:
false
,
method
:
'
GET
'
,
url
:
appConfig
.
serverAddress
+
'
/api/unidadesOrganizacional/:id/cargos
'
}
});
}
...
...
@@ -34,6 +39,10 @@
ordenarCargos
(
id
,
parametros
)
{
return
this
.
resource
.
ordenarCargos
({
id
:
id
},
parametros
).
$promise
;
}
cargos
(
id
)
{
return
this
.
resource
.
cargos
({
id
:
id
}).
$promise
;
}
}
angular
.
module
(
'
moduloPersonalApp
'
)
...
...
client/components/organigrama/framework/angular-treant-js/custom-colored.scss
View file @
c3085508
...
...
@@ -28,7 +28,7 @@ abbr, acronym {
/* optional Container STYLES */
.chart
{
height
:
8
6
0px
;
height
:
9
80px
;
margin
:
5px
;
width
:
100%
;
margin
:
5px
auto
;
...
...
client/index.html
View file @
c3085508
...
...
@@ -80,7 +80,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/oficinas/modals/oficinas.
edit
ar.modal.controller.js"
></script>
<script
src=
"app/oficinas/modals/oficinas.
cre
ar.modal.controller.js"
></script>
<script
src=
"app/cargos/cargos.js"
></script>
<script
src=
"app/cargos/cargos.service.js"
></script>
<script
src=
"app/cargos/editar/cargos.editar.controller.js"
></script>
...
...
@@ -113,6 +113,7 @@
<script
src=
"app/entidades/entidades.js"
></script>
<script
src=
"app/entidades/entidades.service.js"
></script>
<script
src=
"app/entidades/modals/entidades.crear.modal.controller.js"
></script>
<script
src=
"app/entidades/modals/entidades.editar.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/etapas/etapas.controller.js"
></script>
...
...
@@ -137,8 +138,8 @@
<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>
<script
src=
"app/oficinas/modals/oficinas.crear.modal.controller.js"
></script>
<script
src=
"app/calificaciones/calificaciones.service.js"
></script>
<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>
...
...
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