Commit 0a5420d06e3940de669e1b458231fbca17270737

Authored by ubv
1 parent 80bba350f0
Exists in feature/edson

practica para no perder nada

app/Resources/views/candidato/index.html.twig
@@ -33,6 +33,8 @@ @@ -33,6 +33,8 @@
33 <th>Estado</th> 33 <th>Estado</th>
34 <th>Municipio</th> 34 <th>Municipio</th>
35 <th>Direccion</th> 35 <th>Direccion</th>
  36 + <th>Descripcion Aldea</th>
  37 + <th>Descripcion Estado Civil</th>
36 <th>Actions</th> 38 <th>Actions</th>
37 </tr> 39 </tr>
38 </thead> 40 </thead>
@@ -51,6 +53,8 @@ @@ -51,6 +53,8 @@
51 <td>{{ candidato.estado }}</td> 53 <td>{{ candidato.estado }}</td>
52 <td>{{ candidato.municipio }}</td> 54 <td>{{ candidato.municipio }}</td>
53 <td>{{ candidato.direccion }}</td> 55 <td>{{ candidato.direccion }}</td>
  56 + <td>{{ candidato.aldea }}</td>
  57 + <td>{{ candidato.estadoCivil }}</td>
54 <td> 58 <td>
55 59
56 60
app/Resources/views/candidato/new.html.twig
1 {% extends 'base.html.twig' %} 1 {% extends 'base.html.twig' %}
2 - 2 +
3 {% block body %} 3 {% block body %}
4 <h1>Creacion de Candidato</h1> 4 <h1>Creacion de Candidato</h1>
  5 + {{ form_start(form, {'attr': {'novalidate': 'novalidate'}, 'action': path('candidato_new')}) }}
5 <br> 6 <br>
6 - <h3> Datos Personales </h3>  
7 - <div class="row"> 7 + <div class="panel-group" id="accordion">
  8 + <div class="panel panel-default">
  9 + <div class="panel-heading">
  10 + <h4 class="panel-title">
  11 + <a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
  12 + Datos Personales</a>
  13 + </h4>
  14 + </div>
  15 + <div id="collapse1" class="panel-collapse collapse in">
  16 + <div class="panel-body">
  17 + <div class="row">
8 <div class="col-xs-4"> 18 <div class="col-xs-4">
9 {{ form_label(form.nombre) }} 19 {{ form_label(form.nombre) }}
10 {{ form_widget(form.nombre) }} 20 {{ form_widget(form.nombre) }}
@@ -35,6 +45,15 @@ @@ -35,6 +45,15 @@
35 </span> 45 </span>
36 {% endif %} 46 {% endif %}
37 </div> 47 </div>
  48 + <div class="col-xs-4">
  49 + {{ form_label(form.estadoCivil) }}
  50 + {{ form_widget(form.estadoCivil) }}
  51 + {% if form.estadoCivil.vars.errors[0].message is defined %}
  52 + <span class="help-block">
  53 + {{ form.estadoCivil.vars.errors[0].message }}
  54 + </span>
  55 + {% endif %}
  56 + </div>
38 </div> 57 </div>
39 <div class="row"> 58 <div class="row">
40 <div class="col-xs-4"> 59 <div class="col-xs-4">
@@ -47,8 +66,22 @@ @@ -47,8 +66,22 @@
47 {% endif %} 66 {% endif %}
48 </div> 67 </div>
49 </div> 68 </div>
50 - <br>  
51 - <h3> Datos Academicos </h3> 69 + </div>
  70 + </div>
  71 + </div>
  72 + </div>
  73 + <br>
  74 +
  75 + <div class="panel-group" id="accordion">
  76 + <div class="panel panel-default">
  77 + <div class="panel-heading">
  78 + <h4 class="panel-title">
  79 + <a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
  80 + Datos Academicos</a>
  81 + </h4>
  82 + </div>
  83 + <div id="collapse2" class="panel-collapse collapse">
  84 + <div class="panel-body">
52 <div class="row"> 85 <div class="row">
53 <div class="col-xs-4"> 86 <div class="col-xs-4">
54 87
@@ -93,10 +126,34 @@ @@ -93,10 +126,34 @@
93 </span> 126 </span>
94 {% endif %} 127 {% endif %}
95 </div> 128 </div>
  129 + <div class="col-xs-4">
  130 +
  131 + {{ form_label(form.aldea) }}
  132 + {{ form_widget(form.aldea) }}
  133 + {% if form.aldea.vars.errors[0].message is defined %}
  134 + <span class="help-block">
  135 + {{ form.aldea.vars.errors[0].message }}
  136 + </span>
  137 + {% endif %}
  138 + </div>
96 </div> 139 </div>
97 - <br>  
98 - <br>  
99 - <h3> Ubicacion Geografica </h3> 140 + </div>
  141 + </div>
  142 + </div>
  143 + </div>
  144 + <br>
  145 +
  146 + <div class="panel-group" id="accordion">
  147 + <div class="panel panel-default">
  148 + <div class="panel-heading">
  149 + <h4 class="panel-title">
  150 + <a data-toggle="collapse" data-parent="#accordion" href="#collapse3">
  151 + Ubicacion Geografica</a>
  152 + </h4>
  153 + </div>
  154 + <br>
  155 + <div id="collapse3" class="panel-collapse collapse">
  156 + <div class="panel-body">
100 <div class="row"> 157 <div class="row">
101 <div class="col-xs-4"> 158 <div class="col-xs-4">
102 {{ form_label(form.pais) }} 159 {{ form_label(form.pais) }}
@@ -108,21 +165,13 @@ @@ -108,21 +165,13 @@
108 {% endif %} 165 {% endif %}
109 </div> 166 </div>
110 <div class="col-xs-4"> 167 <div class="col-xs-4">
111 - <div class="form-group">  
112 - <label for="sel1">Seleccione un estado:</label>  
113 - <select class="form-control" id="sel1">  
114 - <option>Seleccione...</option>  
115 - <option>Distrito Capital</option>  
116 - <option>Miranda</option>  
117 - <option>Tachira</option>  
118 - <option>Aragua</option>  
119 - </select>  
120 - {% if form.estado.vars.errors[0].message is defined %}  
121 - <span class="help-block">  
122 - {{ form.estado.vars.errors[0].message }}  
123 - </span> 168 + {{ form_label(form.estado) }}
  169 + {{ form_widget(form.estado) }}
  170 + {% if form.pais.vars.errors[0].message is defined %}
  171 + <span class="help-block">
  172 + {{ form.estado.vars.errors[0].message }}
  173 + </span>
124 {% endif %} 174 {% endif %}
125 - </div>  
126 </div> 175 </div>
127 </div> 176 </div>
128 <div class="row"> 177 <div class="row">
@@ -145,6 +194,9 @@ @@ -145,6 +194,9 @@
145 {% endif %} 194 {% endif %}
146 </div> 195 </div>
147 </div> 196 </div>
  197 + </div>
  198 + </div>
  199 + </div>
148 200
149 <input type="submit" value="Create" /> 201 <input type="submit" value="Create" />
150 202
app/Resources/views/estado/index.html.twig
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 {% block body %} 3 {% block body %}
4 <h1>Estados list</h1> 4 <h1>Estados list</h1>
5 5
6 - <table> 6 + <table class="table table-hover">
7 <thead> 7 <thead>
8 <tr> 8 <tr>
9 <th>Id</th> 9 <th>Id</th>
src/UBV/PracticaBundle/Controller/estadoController.php
@@ -5,7 +5,9 @@ namespace UBV\PracticaBundle\Controller; @@ -5,7 +5,9 @@ namespace UBV\PracticaBundle\Controller;
5 use UBV\PracticaBundle\Entity\estado; 5 use UBV\PracticaBundle\Entity\estado;
6 use Symfony\Bundle\FrameworkBundle\Controller\Controller; 6 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; 7 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
8 -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request; 8 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  9 +use Symfony\Component\HttpFoundation\Request;
  10 +use UBV\PracticaBundle\Form\MunicipioType;
9 11
10 /** 12 /**
11 * Estado controller. 13 * Estado controller.
@@ -57,6 +59,7 @@ class estadoController extends Controller @@ -57,6 +59,7 @@ class estadoController extends Controller
57 )); 59 ));
58 } 60 }
59 61
  62 +
60 /** 63 /**
61 * Finds and displays a estado entity. 64 * Finds and displays a estado entity.
62 * 65 *
src/UBV/PracticaBundle/Controller/municipioController.php
@@ -5,7 +5,8 @@ namespace UBV\PracticaBundle\Controller; @@ -5,7 +5,8 @@ namespace UBV\PracticaBundle\Controller;
5 use UBV\PracticaBundle\Entity\municipio; 5 use UBV\PracticaBundle\Entity\municipio;
6 use Symfony\Bundle\FrameworkBundle\Controller\Controller; 6 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; 7 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
8 -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request; 8 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  9 +use Symfony\Component\HttpFoundation\Request;
9 10
10 /** 11 /**
11 * Municipio controller. 12 * Municipio controller.
src/UBV/PracticaBundle/Entity/candidato.php
@@ -4,6 +4,10 @@ namespace UBV\PracticaBundle\Entity; @@ -4,6 +4,10 @@ namespace UBV\PracticaBundle\Entity;
4 4
5 use Doctrine\ORM\Mapping as ORM; 5 use Doctrine\ORM\Mapping as ORM;
6 6
  7 +use Symfony\Component\Validator\Constraints as Assert;
  8 +use Symfony\Component\Validator\Constraints\NotBlank;
  9 +use Symfony\Component\Validator\Constraints\Length;
  10 +
7 /** 11 /**
8 * candidato 12 * candidato
9 * 13 *
@@ -22,6 +26,21 @@ class candidato @@ -22,6 +26,21 @@ class candidato
22 private $id; 26 private $id;
23 27
24 /** 28 /**
  29 + *
  30 + * @Assert\NotNull(message= "Por favor introduzca su Nombre", groups={"Default"})
  31 + * @Assert\NotBlank( message= "Por favor introduzca un Nombre valido", groups={"Default"})
  32 + * @Assert\Length(
  33 + * min = 2,
  34 + * max = 45,
  35 + * minMessage = "Tu Nombre debe tener como minimo {{ limit }} letras",
  36 + * maxMessage = "Tu Nombre no debe exceder de {{ limit }} letras"
  37 + * )
  38 + * @Assert\Regex(
  39 + * pattern="/\d/",
  40 + * match=false,
  41 + * message="Tu Nombre no debe contener numeros"
  42 + *)
  43 + *
25 * @var string 44 * @var string
26 * 45 *
27 * @ORM\Column(name="nombre", type="string", length=255) 46 * @ORM\Column(name="nombre", type="string", length=255)
@@ -29,6 +48,21 @@ class candidato @@ -29,6 +48,21 @@ class candidato
29 private $nombre; 48 private $nombre;
30 49
31 /** 50 /**
  51 + *
  52 + * @Assert\NotNull(message= "Por favor introduzca su Nombre", groups={"Default"})
  53 + * @Assert\NotBlank( message= "Por favor introduzca un Nombre valido", groups={"Default"})
  54 + * @Assert\Length(
  55 + * min = 2,
  56 + * max = 45,
  57 + * minMessage = "Tu Nombre debe tener como minimo {{ limit }} letras",
  58 + * maxMessage = "Tu Nombre no debe exceder de {{ limit }} letras"
  59 + * )
  60 + * @Assert\Regex(
  61 + * pattern="/\d/",
  62 + * match=false,
  63 + * message="Tu Nombre no debe contener numeros"
  64 + *)
  65 + *
32 * @var string 66 * @var string
33 * 67 *
34 * @ORM\Column(name="apellido", type="string", length=255) 68 * @ORM\Column(name="apellido", type="string", length=255)
@@ -36,6 +70,17 @@ class candidato @@ -36,6 +70,17 @@ class candidato
36 private $apellido; 70 private $apellido;
37 71
38 /** 72 /**
  73 + *
  74 + * @Assert\NotNull(message= "Por favor introduzca su Cedula", groups={"Default"})
  75 + * @Assert\NotBlank( message= "Por favor introduzca una Cedula valida", groups={"Default"})
  76 + * @Assert\Length(
  77 + * min = 2,
  78 + * max = 45,
  79 + * minMessage = "Tu Cedula debe tener como minimo {{ limit }} numeros",
  80 + * maxMessage = "Tu Cedula no debe exceder de {{ limit }} numeros"
  81 + * )
  82 + *
  83 + *
39 * @var int 84 * @var int
40 * 85 *
41 * @ORM\Column(name="cedula", type="integer", unique=true) 86 * @ORM\Column(name="cedula", type="integer", unique=true)
@@ -50,6 +95,16 @@ class candidato @@ -50,6 +95,16 @@ class candidato
50 private $activo; 95 private $activo;
51 96
52 /** 97 /**
  98 + *
  99 + * @Assert\NotNull(message= "Por favor introduzca su Direccion", groups={"Default"})
  100 + * @Assert\NotBlank( message= "Por favor introduzca una Direccion correcta", groups={"Default"})
  101 + * @Assert\Length(
  102 + * min = 2,
  103 + * max = 150,
  104 + * minMessage = "Tu Direccion debe tener como minimo {{ limit }} numeros",
  105 + * maxMessage = "Tu Direccion no debe exceder de {{ limit }} numeros"
  106 + * )
  107 + *
53 * @var string 108 * @var string
54 * 109 *
55 * @ORM\Column(name="instruccion", type="string", length=255) 110 * @ORM\Column(name="instruccion", type="string", length=255)
@@ -57,6 +112,16 @@ class candidato @@ -57,6 +112,16 @@ class candidato
57 private $instruccion; 112 private $instruccion;
58 113
59 /** 114 /**
  115 + *
  116 + * @Assert\NotNull(message= "Por favor introduzca su Direccion", groups={"Default"})
  117 + * @Assert\NotBlank( message= "Por favor introduzca una Direccion correcta", groups={"Default"})
  118 + * @Assert\Length(
  119 + * min = 2,
  120 + * max = 150,
  121 + * minMessage = "Tu Direccion debe tener como minimo {{ limit }} numeros",
  122 + * maxMessage = "Tu Direccion no debe exceder de {{ limit }} numeros"
  123 + * )
  124 + *
60 * @var string 125 * @var string
61 * 126 *
62 * @ORM\Column(name="ocupacion", type="string", length=255) 127 * @ORM\Column(name="ocupacion", type="string", length=255)
@@ -71,6 +136,16 @@ class candidato @@ -71,6 +136,16 @@ class candidato
71 private $promedio; 136 private $promedio;
72 137
73 /** 138 /**
  139 + *
  140 + * @Assert\NotNull(message= "Por favor introduzca su Direccion", groups={"Default"})
  141 + * @Assert\NotBlank( message= "Por favor introduzca una Direccion correcta", groups={"Default"})
  142 + * @Assert\Length(
  143 + * min = 2,
  144 + * max = 150,
  145 + * minMessage = "Tu Direccion debe tener como minimo {{ limit }} numeros",
  146 + * maxMessage = "Tu Direccion no debe exceder de {{ limit }} numeros"
  147 + * )
  148 + *
74 * @var string 149 * @var string
75 * 150 *
76 * @ORM\Column(name="institucion", type="string", length=255) 151 * @ORM\Column(name="institucion", type="string", length=255)
@@ -78,6 +153,16 @@ class candidato @@ -78,6 +153,16 @@ class candidato
78 private $institucion; 153 private $institucion;
79 154
80 /** 155 /**
  156 + *
  157 + * @Assert\NotNull(message= "Por favor introduzca su Nombre", groups={"Default"})
  158 + * @Assert\NotBlank( message= "Por favor introduzca un Nombre valido", groups={"Default"})
  159 + * @Assert\Length(
  160 + * min = 2,
  161 + * max = 45,
  162 + * minMessage = "Tu Nombre debe tener como minimo {{ limit }} letras",
  163 + * maxMessage = "Tu Nombre no debe exceder de {{ limit }} letras"
  164 + * )
  165 + *
81 * @var string 166 * @var string
82 * 167 *
83 * @ORM\Column(name="pais", type="string", length=255) 168 * @ORM\Column(name="pais", type="string", length=255)
@@ -92,6 +177,16 @@ class candidato @@ -92,6 +177,16 @@ class candidato
92 private $estado; 177 private $estado;
93 178
94 /** 179 /**
  180 + *
  181 + * @Assert\NotNull(message= "Por favor introduzca su Nombre", groups={"Default"})
  182 + * @Assert\NotBlank( message= "Por favor introduzca un Nombre valido", groups={"Default"})
  183 + * @Assert\Length(
  184 + * min = 2,
  185 + * max = 45,
  186 + * minMessage = "Tu Nombre debe tener como minimo {{ limit }} letras",
  187 + * maxMessage = "Tu Nombre no debe exceder de {{ limit }} letras"
  188 + * )
  189 + *
95 * @var string 190 * @var string
96 * 191 *
97 * @ORM\Column(name="municipio", type="string", length=255) 192 * @ORM\Column(name="municipio", type="string", length=255)
@@ -99,12 +194,43 @@ class candidato @@ -99,12 +194,43 @@ class candidato
99 private $municipio; 194 private $municipio;
100 195
101 /** 196 /**
  197 + *
  198 + * @Assert\NotNull(message= "Por favor introduzca su Nombre", groups={"Default"})
  199 + * @Assert\NotBlank( message= "Por favor introduzca un Nombre valido", groups={"Default"})
  200 + * @Assert\Length(
  201 + * min = 2,
  202 + * max = 45,
  203 + * minMessage = "Tu Nombre debe tener como minimo {{ limit }} letras",
  204 + * maxMessage = "Tu Nombre no debe exceder de {{ limit }} letras"
  205 + * )
  206 + *
102 * @var string 207 * @var string
103 * 208 *
104 * @ORM\Column(name="direccion", type="string", length=255) 209 * @ORM\Column(name="direccion", type="string", length=255)
105 */ 210 */
106 private $direccion; 211 private $direccion;
107 212
  213 + /**
  214 + * @var
  215 + *
  216 + * @ORM\ManyToOne(targetEntity="aldea", inversedBy="candidatos", cascade={"persist", "remove"})
  217 + * @ORM\JoinColumn(name="aldea_id", referencedColumnName="id", nullable=true)
  218 + *
  219 + *
  220 + */
  221 + private $aldea;
  222 +
  223 + /**
  224 + * @var
  225 + *
  226 + * @ORM\ManyToOne(targetEntity="estadoCivil", inversedBy="candidatos", cascade={"persist", "remove"})
  227 + * @ORM\JoinColumn(name="estadoCivil_id", referencedColumnName="id", nullable=true)
  228 + *
  229 + *
  230 + */
  231 + private $estadoCivil;
  232 +
  233 +
108 234
109 /** 235 /**
110 * Get id 236 * Get id
@@ -403,5 +529,55 @@ class candidato @@ -403,5 +529,55 @@ class candidato
403 { 529 {
404 return $this->direccion; 530 return $this->direccion;
405 } 531 }
  532 +
  533 + /**
  534 + * Set Aldea
  535 + *
  536 + * @param \UBV\PracticaBundle\Entity\Aldea $aldea
  537 + *
  538 + * @return candidato
  539 + */
  540 + public function setAldea(\UBV\PracticaBundle\Entity\Aldea $aldea)
  541 + {
  542 + $this->aldea = $aldea;
  543 +
  544 + return $this;
  545 + }
  546 +
  547 + /**
  548 + * Get Aldea
  549 + *
  550 + * @return \UBV\PracticaBundle\Entity\Aldea
  551 + */
  552 + public function getAldea()
  553 + {
  554 + return $this->aldea;
  555 + }
  556 +
  557 +
  558 +
  559 + /**
  560 + * Set estadoCivil
  561 + *
  562 + * @param \UBV\PracticaBundle\Entity\estadoCivil $estadoCivil
  563 + *
  564 + * @return candidato
  565 + */
  566 + public function setestadoCivil(\UBV\PracticaBundle\Entity\estadoCivil $estadoCivil=null)
  567 + {
  568 + $this->estadoCivil = $estadoCivil;
  569 +
  570 + return $this;
  571 + }
  572 +
  573 + /**
  574 + * Get estadoCivil
  575 + *
  576 + * @return \UBV\PracticaBundle\Entity\estadoCivil
  577 + */
  578 + public function getestadoCivil()
  579 + {
  580 + return $this->estadoCivil;
  581 + }
406 } 582 }
407 583
src/UBV/PracticaBundle/Entity/estado.php
@@ -25,16 +25,24 @@ class estado @@ -25,16 +25,24 @@ class estado
25 * @var string 25 * @var string
26 * 26 *
27 * @ORM\Column(name="descripcion", type="string", length=255) 27 * @ORM\Column(name="descripcion", type="string", length=255)
28 - */ 28 + *
  29 + *
  30 + */
29 private $descripcion; 31 private $descripcion;
30 32
  33 +
31 /** 34 /**
32 * @var int 35 * @var int
33 * 36 *
34 * @ORM\Column(name="codigo", type="integer") 37 * @ORM\Column(name="codigo", type="integer")
  38 + *
  39 + *
  40 + *
35 */ 41 */
36 private $codigo; 42 private $codigo;
37 43
  44 +
  45 +
38 46
39 /** 47 /**
40 * Get id 48 * Get id
@@ -93,6 +101,7 @@ class estado @@ -93,6 +101,7 @@ class estado
93 { 101 {
94 return $this->codigo; 102 return $this->codigo;
95 } 103 }
  104 +
96 public function __toString(){ 105 public function __toString(){
97 106
98 return $this->getDescripcion(); 107 return $this->getDescripcion();
src/UBV/PracticaBundle/Entity/municipio.php
@@ -4,6 +4,8 @@ namespace UBV\PracticaBundle\Entity; @@ -4,6 +4,8 @@ namespace UBV\PracticaBundle\Entity;
4 4
5 use Doctrine\ORM\Mapping as ORM; 5 use Doctrine\ORM\Mapping as ORM;
6 6
  7 +use Symfony\Component\Validator\Constraints as Assert;
  8 +
7 /** 9 /**
8 * municipio 10 * municipio
9 * 11 *
@@ -18,6 +20,9 @@ class municipio @@ -18,6 +20,9 @@ class municipio
18 * @ORM\Column(name="id", type="integer") 20 * @ORM\Column(name="id", type="integer")
19 * @ORM\Id 21 * @ORM\Id
20 * @ORM\GeneratedValue(strategy="AUTO") 22 * @ORM\GeneratedValue(strategy="AUTO")
  23 + *
  24 + *
  25 + *
21 */ 26 */
22 private $id; 27 private $id;
23 28
@@ -25,6 +30,9 @@ class municipio @@ -25,6 +30,9 @@ class municipio
25 * @var string 30 * @var string
26 * 31 *
27 * @ORM\Column(name="descripcion", type="string", length=255) 32 * @ORM\Column(name="descripcion", type="string", length=255)
  33 + *
  34 + *
  35 + *
28 */ 36 */
29 private $descripcion; 37 private $descripcion;
30 38
@@ -32,6 +40,8 @@ class municipio @@ -32,6 +40,8 @@ class municipio
32 * @var string 40 * @var string
33 * 41 *
34 * @ORM\Column(name="codigo", type="string", length=255) 42 * @ORM\Column(name="codigo", type="string", length=255)
  43 + *
  44 + *
35 */ 45 */
36 private $codigo; 46 private $codigo;
37 47
@@ -42,6 +52,7 @@ class municipio @@ -42,6 +52,7 @@ class municipio
42 * @ORM\JoinColumn(name="estado_id", referencedColumnName="id", nullable=false) 52 * @ORM\JoinColumn(name="estado_id", referencedColumnName="id", nullable=false)
43 * 53 *
44 * 54 *
  55 + *
45 */ 56 */
46 private $estado; 57 private $estado;
47 58
src/UBV/PracticaBundle/Form/candidatoType.php
@@ -5,6 +5,8 @@ namespace UBV\PracticaBundle\Form; @@ -5,6 +5,8 @@ namespace UBV\PracticaBundle\Form;
5 use Symfony\Component\Form\AbstractType; 5 use Symfony\Component\Form\AbstractType;
6 use Symfony\Component\Form\FormBuilderInterface; 6 use Symfony\Component\Form\FormBuilderInterface;
7 use Symfony\Component\OptionsResolver\OptionsResolver; 7 use Symfony\Component\OptionsResolver\OptionsResolver;
  8 +use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  9 +use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
8 10
9 class candidatoType extends AbstractType 11 class candidatoType extends AbstractType
10 { 12 {
@@ -14,18 +16,72 @@ class candidatoType extends AbstractType @@ -14,18 +16,72 @@ class candidatoType extends AbstractType
14 public function buildForm(FormBuilderInterface $builder, array $options) 16 public function buildForm(FormBuilderInterface $builder, array $options)
15 { 17 {
16 $builder 18 $builder
17 - ->add('nombre','text', array( 'label'=> 'Nombre', 'attr' => array('class' => 'form-control','placeholder'=>'Introduzca Nombre'), 'label_attr' => array('class' => 'control-label'),))  
18 - ->add('apellido','text', array( 'label'=> 'Apellido', 'attr' => array('class' => 'form-control','placeholder'=>'Introduzca Apellido'), 'label_attr' => array('class' => 'control-label'),))  
19 - ->add('cedula','integer', array( 'label'=> 'Cedula', 'attr' => array('class' => 'form-control','placeholder'=>'Ej.12345678'), 'label_attr' => array('class' => 'control-label'),)) 19 + ->add('nombre','text', array(
  20 + 'label'=> 'Nombre', 'attr' => array(
  21 + 'class' => 'form-control','placeholder'=>'Introduzca Nombre'), 'label_attr' => array(
  22 + 'class' => 'control-label'),))
  23 + ->add('apellido','text', array(
  24 + 'label'=> 'Apellido', 'attr' => array(
  25 + 'class' => 'form-control','placeholder'=>'Introduzca Apellido'), 'label_attr' => array(
  26 + 'class' => 'control-label'),))
  27 + ->add('cedula','integer', array(
  28 + 'label'=> 'Cedula', 'attr' => array(
  29 + 'class' => 'form-control','placeholder'=>'Ej.12345678'), 'label_attr' => array(
  30 + 'class' => 'control-label'),))
20 ->add('activo') 31 ->add('activo')
21 - ->add('instruccion','text', array( 'label'=> 'Instruccion Academica', 'attr' => array('class' => 'form-control','placeholder'=>'Nivel Academico'), 'label_attr' => array('class' => 'control-label'),))  
22 - ->add('ocupacion','text', array( 'label'=> 'Ocupacion/Profesion', 'attr' => array('class' => 'form-control','placeholder'=>'Ej. Carpintero'), 'label_attr' => array('class' => 'control-label'),))  
23 - ->add('promedio','number', array( 'label'=> 'Promedio', 'attr' => array('class' => 'form-control','step'=>'0.01','placeholder'=>'Introduzca Promedio'), 'label_attr' => array('class' => 'control-label'),))  
24 - ->add('institucion','text', array( 'label'=> 'Institucion', 'attr' => array('class' => 'form-control','placeholder'=>'Institucion/Universidad/Empresa'), 'label_attr' => array('class' => 'control-label'),))  
25 - ->add('pais','text', array( 'label'=> 'Pais', 'attr' => array('class' => 'form-control','placeholder'=>'Seleccione'), 'label_attr' => array('class' => 'control-label'),))  
26 - ->add('estado','text', array( 'label'=> 'Estado', 'attr' => array('class' => 'form-control','placeholder'=>'Estado'), 'label_attr' => array('class' => 'control-label'),))  
27 - ->add('municipio','text', array( 'label'=> 'Municipio', 'attr' => array('class' => 'form-control','placeholder'=>'Municipio'), 'label_attr' => array('class' => 'control-label'),))  
28 - ->add('direccion','text', array( 'label'=> 'Direccion', 'attr' => array('class' => 'form-control','placeholder'=>'Direccion de Domicilio'), 'label_attr' => array('class' => 'control-label'),)); 32 + ->add('instruccion','text', array(
  33 + 'label'=> 'Instruccion Academica', 'attr' => array(
  34 + 'class' => 'form-control','placeholder'=>'Nivel Academico'), 'label_attr' => array(
  35 + 'class' => 'control-label'),))
  36 + ->add('ocupacion','text', array(
  37 + 'label'=> 'Ocupacion/Profesion', 'attr' => array(
  38 + 'class' => 'form-control','placeholder'=>'Ej. Carpintero'), 'label_attr' => array(
  39 + 'class' => 'control-label'),))
  40 + ->add('promedio','number', array(
  41 + 'label'=> 'Promedio', 'attr' => array(
  42 + 'class' => 'form-control','step'=>'0.01','placeholder'=>'Introduzca Promedio'), 'label_attr' => array(
  43 + 'class' => 'control-label'),))
  44 + ->add('institucion','text', array(
  45 + 'label'=> 'Institucion', 'attr' => array(
  46 + 'class' => 'form-control','placeholder'=>'Institucion/Universidad/Empresa'), 'label_attr' => array(
  47 + 'class' => 'control-label'),))
  48 + ->add('pais','text', array(
  49 + 'label'=> 'Pais', 'attr' => array(
  50 + 'class' => 'form-control','placeholder'=>'Ej. Venezuela'), 'label_attr' => array(
  51 + 'class' => 'control-label'),))
  52 + ->add('estado', 'choice', array(
  53 + 'choices' => array(
  54 + 'DC' => 'Distrito Capital',
  55 + 'M' => 'Miranda',
  56 + 'T' => 'Tachira',
  57 + 'A' => 'Aragua',
  58 + ),
  59 + 'required' => false,
  60 + 'empty_value' => 'Seleccione...',
  61 + 'empty_data' => null
  62 + ))
  63 + ->add('municipio','text', array(
  64 + 'label'=> 'Municipio', 'attr' => array(
  65 + 'class' => 'form-control','placeholder'=>'Municipio'), 'label_attr' => array(
  66 + 'class' => 'control-label'),))
  67 + ->add('direccion','text', array(
  68 + 'label'=> 'Direccion', 'attr' => array(
  69 + 'class' => 'form-control','placeholder'=>'Direccion de Domicilio'), 'label_attr' => array(
  70 + 'class' => 'control-label'),))
  71 + ->add('aldea','text', array(
  72 + 'label'=> 'Aldea', 'attr' => array(
  73 + 'class' => 'form-control','placeholder'=>'Direccion de Aldea'), 'label_attr' => array(
  74 + 'class' => 'control-label'),))
  75 + ->add('estadoCivil', EntityType::class, array(
  76 + 'disabled'=>false,
  77 + 'class' => 'UBVPracticaBundle:EstadoCivil',
  78 + 'label' =>"Estado Civil",
  79 + 'empty_data' => "0",
  80 + 'placeholder'=>"Seleccione...",
  81 + 'attr' => array('class' => 'form-control form-control-choice','placeholder'=>''),
  82 + 'label_attr' => array('class' => 'control-label'),
  83 + ));
  84 +
29 }/** 85 }/**
30 * {@inheritdoc} 86 * {@inheritdoc}
31 */ 87 */
src/UBV/PracticaBundle/Form/estadoType.php
@@ -5,6 +5,8 @@ namespace UBV\PracticaBundle\Form; @@ -5,6 +5,8 @@ namespace UBV\PracticaBundle\Form;
5 use Symfony\Component\Form\AbstractType; 5 use Symfony\Component\Form\AbstractType;
6 use Symfony\Component\Form\FormBuilderInterface; 6 use Symfony\Component\Form\FormBuilderInterface;
7 use Symfony\Component\OptionsResolver\OptionsResolver; 7 use Symfony\Component\OptionsResolver\OptionsResolver;
  8 +use UBV\PracticaBundle\Entity\Estado;
  9 +use UBV\PracticaBundle\Entity\Municipio;
8 10
9 class estadoType extends AbstractType 11 class estadoType extends AbstractType
10 { 12 {
@@ -13,7 +15,11 @@ class estadoType extends AbstractType @@ -13,7 +15,11 @@ class estadoType extends AbstractType
13 */ 15 */
14 public function buildForm(FormBuilderInterface $builder, array $options) 16 public function buildForm(FormBuilderInterface $builder, array $options)
15 { 17 {
16 - $builder->add('descripcion')->add('codigo'); 18 + $builder
  19 + ->add('descripcion')
  20 + ->add('codigo',new municipioType())
  21 + ->getForm();
  22 +
17 }/** 23 }/**
18 * {@inheritdoc} 24 * {@inheritdoc}
19 */ 25 */
src/UBV/PracticaBundle/Form/municipioType.php
@@ -13,7 +13,10 @@ class municipioType extends AbstractType @@ -13,7 +13,10 @@ class municipioType extends AbstractType
13 */ 13 */
14 public function buildForm(FormBuilderInterface $builder, array $options) 14 public function buildForm(FormBuilderInterface $builder, array $options)
15 { 15 {
16 - $builder->add('descripcion')->add('codigo')->add('estado'); 16 + $builder
  17 + ->add('descripcion')
  18 + ->add('codigo')
  19 + ->add('estado');
17 }/** 20 }/**
18 * {@inheritdoc} 21 * {@inheritdoc}
19 */ 22 */