Commit 3599598a8981a101775e921d94555ffe0c266d27
1 parent
aebf3565a6
Exists in
master
mejorada la validacion de los escalafones a la hora de seleccionar varios tanto …
…en el frontend como en el backend
Showing
2 changed files
with
196 additions
and
10 deletions
Show diff stats
app/Resources/views/solicitudes/adscripcion.html.twig
... | ... | @@ -83,8 +83,9 @@ |
83 | 83 | if ($('#user_ascenso').prop('checked')) { |
84 | 84 | $('#user_escala').prop('disabled', true); |
85 | 85 | $('#user_oposicion').prop('disabled',true); |
86 | - if($("#user_escala").val() == 1) | |
86 | + if($("#user_escala").val() == 1) { | |
87 | 87 | $('.esc_asistente').show(); |
88 | + } | |
88 | 89 | if($("#user_escala").val() == 2) |
89 | 90 | $('.esc_agregado').show(); |
90 | 91 | if($("#user_escala").val() == 3) |
... | ... | @@ -94,6 +95,39 @@ |
94 | 95 | } |
95 | 96 | |
96 | 97 | |
98 | + if ($('#user_ascenso2').prop('checked')) { | |
99 | + if($("#user_escala").val() == 1) | |
100 | + $('.esc_agregado').show(); | |
101 | + if($("#user_escala").val() == 2) | |
102 | + $('.esc_asociado').show(); | |
103 | + if($("#user_escala").val() == 3) | |
104 | + $('.esc_titular').show(); | |
105 | + } | |
106 | + | |
107 | + | |
108 | + if ($('#user_ascenso3').prop('checked')) { | |
109 | + if($("#user_escala").val() == 1) | |
110 | + $('.esc_asociado').show(); | |
111 | + if(($("#user_escala").val() == 2) && ($('#user_ascenso2').prop('checked') == false)) { | |
112 | + $('.esc_asociado').show(); | |
113 | + }else if ($("#user_escala").val() == 2) { | |
114 | + $('.esc_titular').show(); | |
115 | + } | |
116 | + } | |
117 | + | |
118 | + | |
119 | + if ($('#user_ascenso4').prop('checked')) { | |
120 | + if($("#user_escala").val() == 1) | |
121 | + $('.esc_asociado').show(); | |
122 | + if($("#user_escala").val() == 2) | |
123 | + $('.esc_titular').show(); | |
124 | + if($("#user_escala").val() == 3) | |
125 | + $('.esc_titular').show(); | |
126 | + } | |
127 | + | |
128 | + | |
129 | + | |
130 | + | |
97 | 131 | $('#user_ascenso').click(function() { |
98 | 132 | |
99 | 133 | ... | ... |
src/AppBundle/Controller/AdscripcionController.php
... | ... | @@ -64,20 +64,173 @@ class AdscripcionController extends Controller |
64 | 64 | } |
65 | 65 | |
66 | 66 | |
67 | - if ($form->get('ascenso')->getData()) { | |
68 | - //var_dump($form); | |
69 | - if (!$form->get('fecha_oposicion')->getData()) { | |
70 | - $form->get('fecha_oposicion')->addError(new FormError('Fecha no puede estar en blanco')); | |
67 | + if ( ($form->get('ascenso')->getData()) ) { | |
68 | + //var_dump($form->get('escala')->getData()->getId()); exit; | |
69 | + if($form->get('escala')->getData()->getId() == 1) { | |
70 | + | |
71 | + if (!$form->get('fecha_ascenso_asistente')->getData()) { | |
72 | + $form->get('fecha_ascenso_asistente')->addError(new FormError('Fecha no puede estar en blanco')); | |
73 | + } | |
74 | + | |
75 | + if (!$form->get('documento_asistente')->getData()) { | |
76 | + $form->get('documento_asistente')->addError(new FormError('Si tildó este ascendo, documento de aprobación de ascenso no puede estar en blanco')); | |
77 | + } | |
78 | + | |
71 | 79 | } |
72 | 80 | |
73 | - if (!$form->get('escala')->getData()) { | |
74 | - $form->get('escala')->addError(new FormError('Si selecciona que tiene concurso de oposción, debe seleccionar a que escalafón lo aprobó')); | |
81 | + if($form->get('escala')->getData()->getId() == 2) { | |
82 | + | |
83 | + if (!$form->get('fecha_ascenso_agregado')->getData()) { | |
84 | + $form->get('fecha_ascenso_agregado')->addError(new FormError('Fecha no puede estar en blanco')); | |
85 | + } | |
86 | + | |
87 | + if (!$form->get('documento_agregado')->getData()) { | |
88 | + $form->get('documento_agregado')->addError(new FormError('Si tildó este ascendo, documento de aprobación de ascenso no puede estar en blanco')); | |
89 | + } | |
75 | 90 | } |
76 | 91 | |
77 | - if (!$form->get('documento_oposicion')->getData()) { | |
78 | - $form->get('documento_oposicion')->addError(new FormError('Si selecciona que tiene concurso de oposción, debe subir el digital de la aprobación del concurso')); | |
92 | + if($form->get('escala')->getData()->getId() == 3) { | |
93 | + | |
94 | + if (!$form->get('fecha_ascenso_asociado')->getData()) { | |
95 | + $form->get('fecha_ascenso_asociado')->addError(new FormError('Fecha no puede estar en blanco')); | |
96 | + } | |
97 | + | |
98 | + if (!$form->get('documento_asociado')->getData()) { | |
99 | + $form->get('documento_asociado')->addError(new FormError('Si tildó este ascendo, documento de aprobación de ascenso no puede estar en blanco')); | |
100 | + } | |
101 | + } | |
102 | + | |
103 | + | |
104 | + if($form->get('escala')->getData()->getId() == 4) { | |
105 | + | |
106 | + if (!$form->get('fecha_ascenso_titular')->getData()) { | |
107 | + $form->get('fecha_ascenso_titular')->addError(new FormError('Fecha no puede estar en blanco')); | |
108 | + } | |
109 | + | |
110 | + if (!$form->get('documento_titular')->getData()) { | |
111 | + $form->get('documento_titular')->addError(new FormError('Si tildó este ascendo, documento de aprobación de ascenso no puede estar en blanco')); | |
112 | + } | |
113 | + } | |
114 | + | |
115 | + | |
116 | + } | |
117 | + | |
118 | + | |
119 | + | |
120 | + if ( ($form->get('ascenso2')->getData()) ) { | |
121 | + //var_dump($form->get('escala')->getData()->getId()); exit; | |
122 | + if($form->get('escala')->getData()->getId() == 1) { | |
123 | + | |
124 | + if (!$form->get('fecha_ascenso_agregado')->getData()) { | |
125 | + $form->get('fecha_ascenso_agregado')->addError(new FormError('Fecha no puede estar en blanco')); | |
126 | + } | |
127 | + | |
128 | + if (!$form->get('documento_agregado')->getData()) { | |
129 | + $form->get('documento_agregado')->addError(new FormError('Si tildó este ascendo, documento de aprobación de ascenso no puede estar en blanco')); | |
130 | + } | |
131 | + } | |
132 | + | |
133 | + if($form->get('escala')->getData()->getId() == 2) { | |
134 | + | |
135 | + if (!$form->get('fecha_ascenso_asociado')->getData()) { | |
136 | + $form->get('fecha_ascenso_asociado')->addError(new FormError('Fecha no puede estar en blanco')); | |
137 | + } | |
138 | + | |
139 | + if (!$form->get('documento_asociado')->getData()) { | |
140 | + $form->get('documento_asociado')->addError(new FormError('Si tildó este ascendo, documento de aprobación de ascenso no puede estar en blanco')); | |
141 | + } | |
142 | + } | |
143 | + | |
144 | + if($form->get('escala')->getData()->getId() == 3) { | |
145 | + | |
146 | + if (!$form->get('fecha_ascenso_titular')->getData()) { | |
147 | + $form->get('fecha_ascenso_titular')->addError(new FormError('Fecha no puede estar en blanco')); | |
148 | + } | |
149 | + | |
150 | + if (!$form->get('documento_titular')->getData()) { | |
151 | + $form->get('documento_titular')->addError(new FormError('Si tildó este ascendo, documento de aprobación de ascenso no puede estar en blanco')); | |
152 | + } | |
153 | + } | |
154 | + | |
155 | + | |
156 | + } | |
157 | + | |
158 | + | |
159 | + if ( ($form->get('ascenso3')->getData()) ) { | |
160 | + //var_dump($form->get('escala')->getData()->getId()); exit; | |
161 | + if($form->get('escala')->getData()->getId() == 1) { | |
162 | + | |
163 | + if (!$form->get('fecha_ascenso_asociado')->getData()) { | |
164 | + $form->get('fecha_ascenso_asociado')->addError(new FormError('Fecha no puede estar en blanco')); | |
165 | + } | |
166 | + | |
167 | + if (!$form->get('documento_asociado')->getData()) { | |
168 | + $form->get('documento_asociado')->addError(new FormError('Si tildó este ascendo, documento de aprobación de ascenso no puede estar en blanco')); | |
169 | + } | |
79 | 170 | } |
171 | + | |
172 | + if (($form->get('escala')->getData()->getId() == 2) && ($form->get('ascenso2')->getData() == false )) { | |
173 | + | |
174 | + if (!$form->get('fecha_ascenso_asociado')->getData()) { | |
175 | + $form->get('fecha_ascenso_asociado')->addError(new FormError('Fecha no puede estar en blanco')); | |
176 | + } | |
177 | + | |
178 | + if (!$form->get('documento_asociado')->getData()) { | |
179 | + $form->get('documento_asociado')->addError(new FormError('Si tildó este ascendo, documento de aprobación de ascenso no puede estar en blanco')); | |
180 | + } | |
181 | + }else if ($form->get('escala')->getData()->getId() == 2) { | |
182 | + | |
183 | + if (!$form->get('fecha_ascenso_titular')->getData()) { | |
184 | + $form->get('fecha_ascenso_titular')->addError(new FormError('Fecha no puede estar en blanco')); | |
185 | + } | |
186 | + | |
187 | + if (!$form->get('documento_titular')->getData()) { | |
188 | + $form->get('documento_titular')->addError(new FormError('Si tildó este ascendo, documento de aprobación de ascenso no puede estar en blanco')); | |
189 | + } | |
190 | + } | |
191 | + | |
192 | + | |
80 | 193 | } |
194 | + | |
195 | + | |
196 | + if ( ($form->get('ascenso4')->getData()) ) { | |
197 | + | |
198 | + if($form->get('escala')->getData()->getId() == 1) { | |
199 | + | |
200 | + if (!$form->get('fecha_ascenso_asociado')->getData()) { | |
201 | + $form->get('fecha_ascenso_asociado')->addError(new FormError('Fecha no puede estar en blanco')); | |
202 | + } | |
203 | + | |
204 | + if (!$form->get('documento_asociado')->getData()) { | |
205 | + $form->get('documento_asociado')->addError(new FormError('Si tildó este ascendo, documento de aprobación de ascenso no puede estar en blanco')); | |
206 | + } | |
207 | + } | |
208 | + | |
209 | + if($form->get('escala')->getData()->getId() == 2) { | |
210 | + | |
211 | + if (!$form->get('fecha_ascenso_titular')->getData()) { | |
212 | + $form->get('fecha_ascenso_titular')->addError(new FormError('Fecha no puede estar en blanco')); | |
213 | + } | |
214 | + | |
215 | + if (!$form->get('documento_titular')->getData()) { | |
216 | + $form->get('documento_titular')->addError(new FormError('Si tildó este ascendo, documento de aprobación de ascenso no puede estar en blanco')); | |
217 | + } | |
218 | + } | |
219 | + | |
220 | + if($form->get('escala')->getData()->getId() == 3) { | |
221 | + | |
222 | + if (!$form->get('fecha_ascenso_titular')->getData()) { | |
223 | + $form->get('fecha_ascenso_titular')->addError(new FormError('Fecha no puede estar en blanco')); | |
224 | + } | |
225 | + | |
226 | + if (!$form->get('documento_titular')->getData()) { | |
227 | + $form->get('documento_titular')->addError(new FormError('Si tildó este ascendo, documento de aprobación de ascenso no puede estar en blanco')); | |
228 | + } | |
229 | + } | |
230 | + | |
231 | + } | |
232 | + | |
233 | + | |
81 | 234 | } |
82 | 235 | |
83 | 236 | if ($form->isSubmitted() && $form->isValid()) { |
... | ... | @@ -225,7 +378,6 @@ class AdscripcionController extends Controller |
225 | 378 | $escala4->setIdEscala($agregado); |
226 | 379 | $escala4->setIdTipoEscala($this->getDoctrine()->getRepository('AppBundle:TipoAscenso')->findOneById(2)); |
227 | 380 | $em->persist($escala4); |
228 | - verificar_documentos($this->getUser()->getIdRolInstitucion()->getId(), 7, 2, $em, $servicios); | |
229 | 381 | |
230 | 382 | $constanciaAgregado = $form->get('documento_agregado')->getData(); |
231 | 383 | $nombreAgregado = md5(uniqid()).'.'.$constanciaAgregado->guessExtension(); | ... | ... |