Commit 77fbba66 authored by D’jalmar Gutierrez Titirico's avatar D’jalmar Gutierrez Titirico 🚲

Merge branch 'iss43-Los-modelos-permiten-llaves-foraneas-nulas' into desarrollo

Conflicts:
	client/app/cargos/cargos.scss
	client/app/postulantes/postulantes.lista.html
parents 3d910301 f06a9848
...@@ -20,7 +20,9 @@ ...@@ -20,7 +20,9 @@
<tbody> <tbody>
<tr ng-repeat="cargo in vm.cargos"> <tr ng-repeat="cargo in vm.cargos">
<td>{{cargo.nombre}}</td> <td>{{cargo.nombre}}</td>
<td width="150"><a ng-click="vm.editar(cargo._id)">Editar</a></td> <td width="150">
<a class = "btn btn-info btn-xs" href = "#" role = "button" ng-click="vm.editar(cargo._id)"><i class="fa fa-edit"></i></a>
</td>
<!--Mostrar un dialogo de eliminar--> <!--Mostrar un dialogo de eliminar-->
<!--<td><a ng-click="vm.eliminar(cargo._id)">Eliminar</a></td>--> <!--<td><a ng-click="vm.eliminar(cargo._id)">Eliminar</a></td>-->
</tr> </tr>
......
tags-input .tags .tag-item {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
display: inline-block;
white-space: nowrap;
margin: -1px 5px 5px 0;
height: 22px;
vertical-align: top;
cursor: default;
color: #767676;
background-color: #fff;
border-color: #ccc;
}
.modal-header-success {
color:#fff;
padding:9px 15px;
border-bottom:1px solid #eee;
background-color: #5cb85c;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.modal-header-warning {
color:#fff;
padding:9px 15px;
border-bottom:1px solid #eee;
background-color: #f0ad4e;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.modal-header-danger {
color:#fff;
padding:9px 15px;
border-bottom:1px solid #eee;
background-color: #d9534f;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.modal-header-info {
color:#fff;
padding:9px 15px;
border-bottom:1px solid #eee;
background-color: #5bc0de;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.modal-header-primary {
color:#fff;
padding:9px 15px;
border-bottom:1px solid #eee;
background-color: #428bca;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
<form class="form" name="form" ng-submit="vm.guardarCargo(form)" novalidate> <form class="form" name="form" ng-submit="vm.guardarCargo(form)" novalidate>
<div class="modal-header"> <div class="modal-header modal-header-primary">
<button type="button" ng-click="vm.modal.dismiss()" class="close">&times;</button> <button type="button" ng-click="vm.modal.dismiss()" class="close">&times;</button>
<h4 class="modal-title">Cargo</h4> <h4 class="modal-title">Cargo</h4>
</div> </div>
......
<form class="form" name="form" ng-submit="vm.guardar(form)" novalidate> <form class="form" name="form" ng-submit="vm.guardar(form)" novalidate>
<div class="modal-header"> <div class="modal-header modal-header-primary">
<button type="button" ng-click="vm.modal.dismiss()" class="close">&times;</button> <button type="button" ng-click="vm.modal.dismiss()" class="close">&times;</button>
<h4 class="modal-title">Comentario</h4> <h4 class="modal-title">Comentario</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="row"> <div class="row">
<div class="col-md-10"> <div class="text-right" title="Usuario creador">
<label>Creador</label> {{vm.usuario.nombreCompleto}} <i class="fa fa-comments" title="Usuario creador"></i>
{{vm.usuario.nombreCompleto}} &nbsp;&nbsp;&nbsp;
</div> </div>
<div class="col-md-10"> <div class="col-md-12">
<label>Contenido</label> <label class="control-label" for="contenido">Contenido</label>
<div class=""> <textarea type="text" name="contenido" class="form-control" rows="4" placeholder="Escribe un comentario."
<textarea type="text" name="contenido" class="form-control " ng-model="vm.comentarioSeleccionado.contenido" ng-model="vm.comentarioSeleccionado.contenido" required></textarea>
required></textarea>
<p class="help-block" ng-show="form.contenido.$error.required && vm.enviado"> <p class="help-block" ng-show="form.contenido.$error.required && vm.enviado">
Ingrese el contenido del comentario Ingrese el contenido del comentario
</p> </p>
</div> <br>
<label class="control-label" for="contenido">Al postulante</label>
<p>
{{vm.postulante.nombres}} {{vm.postulante.apellidos}}
</p>
</div>
<div class="form-group has-error">
<p class="help-block">{{ vm.errores.otros}}</p>
</div> </div>
</div> </div>
<div class="form-group has-error">
<p class="help-block">{{ vm.errores.otros}}</p>
</div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button class="btn btn-primary" type="submit" ng-disabled="!form.contenido.$dirty"> <button class="btn btn-primary" type="submit" ng-disabled="!form.contenido.$dirty">
......
<form class="form" name="form" ng-submit="vm.guardar(form)" novalidate> <form class="form" name="form" ng-submit="vm.guardar(form)" novalidate>
<div class="modal-header"> <div class="modal-header modal-header-primary ">
<button type="button" ng-click="vm.modal.dismiss()" class="close">&times;</button> <button type="button" ng-click="vm.modal.dismiss()" class="close">&times;</button>
<h4 class="modal-title">Datos</h4> <h4 class="modal-title">Dato Personal</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="row"> <div class="row">
......
<form class="form" name="form" ng-submit="vm.guardar(form)" novalidate> <form class="form" name="form" ng-submit="vm.guardar(form)" novalidate>
<div class="modal-header"> <div class="modal-header modal-header-primary ">
<button type="button" ng-click="vm.modal.dismiss()" class="close">&times;</button> <button type="button" ng-click="vm.modal.dismiss()" class="close">&times;</button>
<h4 class="modal-title">Postulación</h4> <h4 class="modal-title">Postulación</h4>
</div> </div>
......
<form class="form" name="form" ng-submit="vm.guardar(form)" novalidate> <form class="form" name="form" ng-submit="vm.guardar(form)" novalidate>
<div class="modal-header"> <div class="modal-header modal-header-primary ">
<button type="button" ng-click="vm.modal.dismiss()" class="close">&times;</button> <button type="button" ng-click="vm.modal.dismiss()" class="close">&times;</button>
<h4 class="modal-title">Postulacion</h4> <h4 class="modal-title">Postulación</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="row"> <div class="row">
......
<form class="form" name="form" ng-submit="vm.guardar(form)" novalidate> <form class="form" name="form" ng-submit="vm.guardar(form)" novalidate>
<div class="modal-header"> <div class="modal-header modal-header-primary ">
<button type="button" ng-click="vm.modal.dismiss()" class="close">&times;</button> <button type="button" ng-click="vm.modal.dismiss()" class="close">&times;</button>
<h4 class="modal-title">Postulante</h4> <h4 class="modal-title">Postulante</h4>
</div> </div>
......
...@@ -38,8 +38,10 @@ ...@@ -38,8 +38,10 @@
<tr ng-repeat="postulante in vm.postulantes"> <tr ng-repeat="postulante in vm.postulantes">
<td>{{postulante.nombres}}</td> <td>{{postulante.nombres}}</td>
<td>{{postulante.apellidos}}</td> <td>{{postulante.apellidos}}</td>
<td><a ng-click="vm.editar(postulante._id)">Editar</a></td> <td>
<td><a ng-click="vm.eliminar(postulante)">Eliminar</a></td> <a class = "btn btn-info btn-xs" href = "#" role = "button" ng-click="vm.editar(postulante._id)"><i class="fa fa-edit"></i></a>
<a class = "btn btn-danger btn-xs" href = "#" role = "button" ng-click="vm.eliminar(postulante)"><i class="fa fa-trash"></i></a>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
...@@ -25,14 +25,20 @@ db.Usuario = db.sequelize.import('../api/usuario/usuario.model'); ...@@ -25,14 +25,20 @@ db.Usuario = db.sequelize.import('../api/usuario/usuario.model');
//Insertando las relaciones entre las tablas //Insertando las relaciones entre las tablas
db.Postulante.belongsToMany(db.TipoDato, { db.Postulante.belongsToMany(db.TipoDato, {
foreignKey: 'fk_postulante', foreignKey: {
name: 'fk_postulante',
allowNull: false
},
as: 'Datos', as: 'Datos',
through: { through: {
model: db.DatoPostulante, unique: false model: db.DatoPostulante, unique: false
} }
}); });
db.TipoDato.belongsToMany(db.Postulante, { db.TipoDato.belongsToMany(db.Postulante, {
foreignKey: 'propiedad', foreignKey: {
name: 'propiedad',
allowNull: false
},
as: 'Postulantes', as: 'Postulantes',
through: { through: {
model: db.DatoPostulante, unique: false model: db.DatoPostulante, unique: false
...@@ -41,74 +47,116 @@ db.TipoDato.belongsToMany(db.Postulante, { ...@@ -41,74 +47,116 @@ db.TipoDato.belongsToMany(db.Postulante, {
// relacion n-m entre Postulante y Cargo // relacion n-m entre Postulante y Cargo
db.Postulante.belongsToMany(db.Cargo, { db.Postulante.belongsToMany(db.Cargo, {
foreignKey: 'fk_postulante', foreignKey: {
name: 'fk_postulante',
allowNull: false
},
as: 'Postulaciones', as: 'Postulaciones',
through: { through: {
model: db.Postulacion, unique: false model: db.Postulacion, unique: false
} }
}); });
db.Cargo.belongsToMany(db.Postulante, { db.Cargo.belongsToMany(db.Postulante, {
foreignKey: 'fk_cargo', foreignKey: {
name: 'fk_cargo',
allowNull: false
},
as: 'Postulantes', as: 'Postulantes',
through: {model: db.Postulacion, unique: false} through: {model: db.Postulacion, unique: false}
}); });
//relacion n-1 entre Usuario y Postulante (comentarios) //relacion n-1 entre Usuario y Postulante (comentarios)
db.Postulante.belongsToMany(db.Usuario, { db.Postulante.belongsToMany(db.Usuario, {
foreignKey: 'fk_postulante', foreignKey: {
name: 'fk_postulante',
allowNull: false
},
as: 'Comentarios', as: 'Comentarios',
through: {model: db.Comentario, unique: false} through: {model: db.Comentario, unique: false}
}); });
db.Usuario.belongsToMany(db.Postulante, { db.Usuario.belongsToMany(db.Postulante, {
foreignKey: 'fk_usuario', foreignKey: {
name: 'fk_usuario',
allowNull: false
},
as: 'Comentarios', as: 'Comentarios',
through: {model: db.Comentario, unique: false} through: {model: db.Comentario, unique: false}
}); });
// relacion n-m entre Postulante y Tag // relacion n-m entre Postulante y Tag
db.Postulante.belongsToMany(db.Tag, { db.Postulante.belongsToMany(db.Tag, {
foreignKey: 'fk_postulante', foreignKey: {
name: 'fk_postulante',
allowNull: false
},
as: 'Tags', as: 'Tags',
through: {model: db.TagPostulante, unique: false} through: {model: db.TagPostulante, unique: false}
}); });
db.Tag.belongsToMany(db.Postulante, { db.Tag.belongsToMany(db.Postulante, {
foreignKey: 'fk_tag', foreignKey: {
name: 'fk_tag',
allowNull: false
},
as: 'Postulantes', as: 'Postulantes',
through: {model: db.TagPostulante, unique: false} through: {model: db.TagPostulante, unique: false}
}); });
//relaciones adicionales para usar la funcion "include" en sequelize //relaciones adicionales para usar la funcion "include" en sequelize
db.Postulacion.belongsTo(db.Postulante, { db.Postulacion.belongsTo(db.Postulante, {
foreignKey: 'fk_postulante', foreignKey: {
name: 'fk_postulante',
allowNull: false
},
as: 'Postulante' as: 'Postulante'
}); });
db.Postulacion.belongsTo(db.Cargo, { db.Postulacion.belongsTo(db.Cargo, {
foreignKey: 'fk_cargo', foreignKey: {
name: 'fk_cargo',
allowNull: false
},
as: 'Cargo' as: 'Cargo'
}); });
db.DatoPostulante.belongsTo(db.Postulante, { db.DatoPostulante.belongsTo(db.Postulante, {
foreignKey: 'fk_postulante', foreignKey: {
name: 'fk_postulante',
allowNull: false
},
as: 'Postulante' as: 'Postulante'
}); });
db.DatoPostulante.belongsTo(db.TipoDato, { db.DatoPostulante.belongsTo(db.TipoDato, {
foreignKey: 'propiedad', foreignKey: {
name: 'propiedad',
allowNull: false
},
as: 'TipoDato' as: 'TipoDato'
}); });
db.TagPostulante.belongsTo(db.Postulante, { db.TagPostulante.belongsTo(db.Postulante, {
foreignKey: 'fk_postulante', foreignKey: {
name: 'fk_postulante',
allowNull: false
},
as: 'Postulante' as: 'Postulante'
}); });
db.TagPostulante.belongsTo(db.Tag, { db.TagPostulante.belongsTo(db.Tag, {
foreignKey: 'fk_tag', foreignKey: {
name: 'fk_tag',
allowNull: false
},
as: 'Tag' as: 'Tag'
}); });
db.Comentario.belongsTo(db.Postulante,{ db.Comentario.belongsTo(db.Postulante,{
foreignKey:'fk_postulante', foreignKey: {
name: 'fk_postulante',
allowNull: false
},
as:'Postulante' as:'Postulante'
}); });
db.Comentario.belongsTo(db.Usuario,{ db.Comentario.belongsTo(db.Usuario,{
foreignKey:'fk_usuario', foreignKey: {
name: 'fk_usuario',
allowNull: false
},
as:'Usuario' as:'Usuario'
}); });
......
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