Se modificaron las llaves foraneas para que no acepten nulas, y se modifico hojas de estilo

parent 2b48a699
......@@ -20,7 +20,9 @@
<tbody>
<tr ng-repeat="cargo in vm.cargos">
<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-->
<!--<td><a ng-click="vm.eliminar(cargo._id)">Eliminar</a></td>-->
</tr>
......
......@@ -15,3 +15,63 @@ tags-input .tags .tag-item {
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>
<div class="modal-header">
<div class="modal-header modal-header-primary">
<button type="button" ng-click="vm.modal.dismiss()" class="close">&times;</button>
<h4 class="modal-title">Cargo</h4>
</div>
......
<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>
<h4 class="modal-title">Comentario</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-10">
<label>Creador</label> {{vm.usuario.nombreCompleto}}
<div class="text-right" title="Usuario creador">
<i class="fa fa-comments" title="Usuario creador"></i>
{{vm.usuario.nombreCompleto}} &nbsp;&nbsp;&nbsp;
</div>
<div class="col-md-10">
<label>Contenido</label>
<div class="">
<textarea type="text" name="contenido" class="form-control " ng-model="vm.comentarioSeleccionado.contenido"
required></textarea>
<div class="col-md-12">
<label class="control-label" for="contenido">Contenido</label>
<textarea type="text" name="contenido" class="form-control" rows="4" placeholder="Escribe un comentario."
ng-model="vm.comentarioSeleccionado.contenido" required></textarea>
<p class="help-block" ng-show="form.contenido.$error.required && vm.enviado">
Ingrese el contenido del comentario
</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 class="form-group has-error">
<p class="help-block">{{ vm.errores.otros}}</p>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary" type="submit" ng-disabled="!form.contenido.$dirty">
......
<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>
<h4 class="modal-title">Datos</h4>
<h4 class="modal-title">Dato Personal</h4>
</div>
<div class="modal-body">
<div class="row">
......
<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>
<h4 class="modal-title">Postulación</h4>
</div>
......
<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>
<h4 class="modal-title">Postulacion</h4>
<h4 class="modal-title">Postulación</h4>
</div>
<div class="modal-body">
<div class="row">
......
<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>
<h4 class="modal-title">Postulante</h4>
</div>
......
......@@ -16,15 +16,17 @@
<tr>
<th>Nombres</th>
<th>Apellidos</th>
<th colspan="2">Opciones</th>
<th>Opciones</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="postulante in vm.postulantes">
<td>{{postulante.nombres}}</td>
<td>{{postulante.apellidos}}</td>
<td><a ng-click="vm.editar(postulante._id)">Editar</a></td>
<td><a ng-click="vm.eliminar(postulante)">Eliminar</a></td>
<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>
</tbody>
</table>
......
......@@ -25,14 +25,20 @@ db.Usuario = db.sequelize.import('../api/usuario/usuario.model');
//Insertando las relaciones entre las tablas
db.Postulante.belongsToMany(db.TipoDato, {
foreignKey: 'fk_postulante',
foreignKey: {
name: 'fk_postulante',
allowNull: false
},
as: 'Datos',
through: {
model: db.DatoPostulante, unique: false
}
});
db.TipoDato.belongsToMany(db.Postulante, {
foreignKey: 'propiedad',
foreignKey: {
name: 'propiedad',
allowNull: false
},
as: 'Postulantes',
through: {
model: db.DatoPostulante, unique: false
......@@ -41,74 +47,116 @@ db.TipoDato.belongsToMany(db.Postulante, {
// relacion n-m entre Postulante y Cargo
db.Postulante.belongsToMany(db.Cargo, {
foreignKey: 'fk_postulante',
foreignKey: {
name: 'fk_postulante',
allowNull: false
},
as: 'Postulaciones',
through: {
model: db.Postulacion, unique: false
}
});
db.Cargo.belongsToMany(db.Postulante, {
foreignKey: 'fk_cargo',
foreignKey: {
name: 'fk_cargo',
allowNull: false
},
as: 'Postulantes',
through: {model: db.Postulacion, unique: false}
});
//relacion n-1 entre Usuario y Postulante (comentarios)
db.Postulante.belongsToMany(db.Usuario, {
foreignKey: 'fk_postulante',
foreignKey: {
name: 'fk_postulante',
allowNull: false
},
as: 'Comentarios',
through: {model: db.Comentario, unique: false}
});
db.Usuario.belongsToMany(db.Postulante, {
foreignKey: 'fk_usuario',
foreignKey: {
name: 'fk_usuario',
allowNull: false
},
as: 'Comentarios',
through: {model: db.Comentario, unique: false}
});
// relacion n-m entre Postulante y Tag
db.Postulante.belongsToMany(db.Tag, {
foreignKey: 'fk_postulante',
foreignKey: {
name: 'fk_postulante',
allowNull: false
},
as: 'Tags',
through: {model: db.TagPostulante, unique: false}
});
db.Tag.belongsToMany(db.Postulante, {
foreignKey: 'fk_tag',
foreignKey: {
name: 'fk_tag',
allowNull: false
},
as: 'Postulantes',
through: {model: db.TagPostulante, unique: false}
});
//relaciones adicionales para usar la funcion "include" en sequelize
db.Postulacion.belongsTo(db.Postulante, {
foreignKey: 'fk_postulante',
foreignKey: {
name: 'fk_postulante',
allowNull: false
},
as: 'Postulante'
});
db.Postulacion.belongsTo(db.Cargo, {
foreignKey: 'fk_cargo',
foreignKey: {
name: 'fk_cargo',
allowNull: false
},
as: 'Cargo'
});
db.DatoPostulante.belongsTo(db.Postulante, {
foreignKey: 'fk_postulante',
foreignKey: {
name: 'fk_postulante',
allowNull: false
},
as: 'Postulante'
});
db.DatoPostulante.belongsTo(db.TipoDato, {
foreignKey: 'propiedad',
foreignKey: {
name: 'propiedad',
allowNull: false
},
as: 'TipoDato'
});
db.TagPostulante.belongsTo(db.Postulante, {
foreignKey: 'fk_postulante',
foreignKey: {
name: 'fk_postulante',
allowNull: false
},
as: 'Postulante'
});
db.TagPostulante.belongsTo(db.Tag, {
foreignKey: 'fk_tag',
foreignKey: {
name: 'fk_tag',
allowNull: false
},
as: 'Tag'
});
db.Comentario.belongsTo(db.Postulante,{
foreignKey:'fk_postulante',
foreignKey: {
name: 'fk_postulante',
allowNull: false
},
as:'Postulante'
});
db.Comentario.belongsTo(db.Usuario,{
foreignKey:'fk_usuario',
foreignKey: {
name: 'fk_usuario',
allowNull: false
},
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