Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 1614 | Rev 1617 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1614 Rev 1616
Línea 176... Línea 176...
176
                     $('#form-add #email').val('');
176
                     $('#form-add #email').val('');
177
                     $('#form-add #file').fileinput('reset');
177
                     $('#form-add #file').fileinput('reset');
178
                     $('#form-add #file').val('');
178
                     $('#form-add #file').val('');
179
                     validatorAdd.resetForm();
179
                     validatorAdd.resetForm();
Línea 180... Línea 180...
180
 
180
 
181
                     $('#add-job-box').modal('show');
181
                     $('#add-candidate-box').modal('show');
182
                     return false;
182
                     return false;
Línea 183... Línea 183...
183
                    });
183
                    });
184
 
184
 
185
                    $(".close-box, .btn-add-cancel").on("click", function(e){
185
                    $(".close-box, .btn-add-cancel").on("click", function(e){
-
 
186
                         e.preventDefault();
186
                         e.preventDefault();
187
                         $('#add-candidate-box').modal('hide');
187
                         $('#add-job-box').modal('hide');
188
                         $('#edit-candidate-box').modal('hide');
Línea -... Línea 189...
-
 
189
                         return false;
-
 
190
                    });
-
 
191
 
-
 
192
    var validatorAdd = $('#form-edit').validate({
-
 
193
        debug: true,
-
 
194
        onclick: false,
-
 
195
        onkeyup: false,
-
 
196
        onfocusout: false,
-
 
197
        ignore: [],
-
 
198
        rules: {
-
 
199
            'first_name': {
-
 
200
                required: true,
-
 
201
                maxlength: 128,
-
 
202
            },
-
 
203
            'file': {
-
 
204
                required: false,
-
 
205
                extension: 'pdf|docx',
-
 
206
                accept: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/msword,application/pdf'
-
 
207
            },
-
 
208
            'last_name': {
-
 
209
                required: true,
-
 
210
            },
-
 
211
            'email' :  {
-
 
212
                required: true,
-
 
213
            }
-
 
214
        },
-
 
215
        submitHandler: function(form)
-
 
216
        {
-
 
217
            var formdata = false;
-
 
218
            if (window.FormData){
-
 
219
                formdata = new FormData(form); //form[0]);
-
 
220
            }
-
 
221
 
-
 
222
            $('input[type="submit"]').prop('disabled', true);
-
 
223
 
-
 
224
            $.ajax({
-
 
225
                'dataType'  : 'json',
-
 
226
                'accept'    : 'application/json',
-
 
227
                'method'    : 'post',
-
 
228
                'url'       :  $('#form-edit').attr('action'),
-
 
229
                'data'      :  formdata,
-
 
230
                'processData': false,
-
 
231
                'contentType': false,
-
 
232
            }).done(function(response) {
-
 
233
                if(response['success']) {
-
 
234
                    $.fn.showSuccess(response['data']);
-
 
235
                       
-
 
236
                    $('#edit-candidate-box').modal('hide');
-
 
237
                    gridTable.api().ajax.reload(null, false);
-
 
238
                } else {
-
 
239
                    validatorAdd.resetForm();
-
 
240
                    if(jQuery.type(response['data']) == 'string') {
-
 
241
                        $.fn.showError(response['data']);
-
 
242
                    } else  {
-
 
243
                        $.each(response['data'], function( fieldname, errors ) {
-
 
244
                            $.fn.showFormErrorValidator('#form-edit #' + fieldname, errors);
-
 
245
                        });
-
 
246
                    }
-
 
247
                }
-
 
248
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
249
                $.fn.showError(textStatus);
-
 
250
            }).always(function() {
-
 
251
                NProgress.done();
-
 
252
            });
-
 
253
            return false;
-
 
254
        },
-
 
255
        invalidHandler: function(form, validator) {
-
 
256
            
-
 
257
        }
-
 
258
    });
-
 
259
 
-
 
260
    $('body').on('click', 'button.btn-edit', function(e) {
-
 
261
            e.preventDefault();
-
 
262
    
-
 
263
            var url = $(this).data('href');
-
 
264
            $.ajax({
-
 
265
                'dataType'  : 'json',
-
 
266
                'accept'    : 'application/json',
-
 
267
                'method'    : 'get',
-
 
268
                'url'       :  url,
-
 
269
            }).done(function(response) {
-
 
270
                if(response['success']) {
-
 
271
                    $('#form-topic-edit')[0].reset();
-
 
272
    
-
 
273
                    $('#form-edit').attr('action',url);
-
 
274
                    $('#form-edit #first_name').val(response['data']['first_name']);
-
 
275
                    $('#form-edit #last_name').val(response['data']['last_name']);
-
 
276
                    $('#form-edit #email').val(response['data']['email']);
-
 
277
                    $('#form-edit #file').fileinput('reset');
-
 
278
                    $('#form-edit #file').val('');
-
 
279
 
-
 
280
    
-
 
281
                    $('#form-edit #status').val(response['data']['status']);
-
 
282
 
-
 
283
                    $('#edit-candidate-box').modal('show');
-
 
284
                } else {
-
 
285
                    validatorEdit.resetForm();
-
 
286
                    if(jQuery.type(response['data']) == 'string') {
-
 
287
                        $.fn.showError(response['data']);
-
 
288
                    } else  {
-
 
289
                        $.each(response['data'], function( fieldname, errors ) {
-
 
290
                            $.fn.showFormErrorValidator('#form-edit #' + fieldname, errors);
-
 
291
                        });
-
 
292
                    }
-
 
293
                }
-
 
294
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
295
                $.fn.showError(textStatus);
-
 
296
            }).always(function() {
-
 
297
                NProgress.done();
188
                         return false;
298
            });
189
                    });
299
        });
190
 
300
 
191
    var validatorAdd = $('#form-add').validate({
301
    var validatorAdd = $('#form-add').validate({
192
        debug: true,
302
        debug: true,
Línea 230... Línea 340...
230
                'contentType': false,
340
                'contentType': false,
231
            }).done(function(response) {
341
            }).done(function(response) {
232
                if(response['success']) {
342
                if(response['success']) {
233
                    $.fn.showSuccess(response['data']);
343
                    $.fn.showSuccess(response['data']);
Línea 234... Línea 344...
234
                       
344
                       
235
                    $('#add-job-box').modal('hide');
345
                    $('#add-candidate-box').modal('hide');
236
                    gridTable.api().ajax.reload(null, false);
346
                    gridTable.api().ajax.reload(null, false);
237
                } else {
347
                } else {
238
                    validatorAdd.resetForm();
348
                    validatorAdd.resetForm();
239
                    if(jQuery.type(response['data']) == 'string') {
349
                    if(jQuery.type(response['data']) == 'string') {
Línea 271... Línea 381...
271
                    'orderable': false,
381
                    'orderable': false,
272
                    'render' : function ( data, type, row ) {
382
                    'render' : function ( data, type, row ) {
273
                        s = '';
383
                        s = '';
Línea 274... Línea 384...
274
                        
384
                        
275
                        if (allowEdit) {
385
                        if (allowEdit) {
276
                        s = s + '<button class="btn btn-primary btn-edit-form" data-href="' + data['link_edit'] + '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button>&nbsp;';
386
                        s = s + '<button class="btn btn-info btn-sm btn-edit" data-href="' + data['link_edit']+ '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button>&nbsp;';
Línea 277... Línea 387...
277
                        }
387
                        }
278
 
388
 
279
                        if(allowDelete && data['link_delete']  ) {
389
                        if(allowDelete && data['link_delete']  ) {
Línea 380... Línea 490...
380
          		</div>
490
          		</div>
381
           	</div>     
491
           	</div>     
382
        </div>          
492
        </div>          
383
 	</div>
493
 	</div>
384
</section> 
494
</section> 
-
 
495
 
-
 
496
<!-- The Add Modal -->
385
<div class="modal" tabindex="-1" role="dialog" id="add-job-box">
497
<div class="modal" tabindex="-1" role="dialog" id="add-candidate-box">
386
	<div class="modal-dialog" role="document">
498
	<div class="modal-dialog" role="document">
387
		<?php 
499
		<?php 
388
	    //$form = $this->formA;
500
	    //$form = $this->formA;
389
	    $form->setAttributes([
501
	    $form->setAttributes([
390
	       'method'    => 'post',
502
	       'method'    => 'post',
Línea 402... Línea 514...
402
      		</div>
514
      		</div>
403
      		<div class="modal-body">
515
      		<div class="modal-body">
404
      			<div class="form-group">
516
      			<div class="form-group">
405
    				<?php 
517
    				<?php 
406
                        $element = $form->get('first_name');
518
                        $element = $form->get('first_name');
-
 
519
                        $element->setOptions(['label' => 'LABEL_FIRST_NAME']);
-
 
520
                        $element->setAttributes(['class' => 'form-control']); 
-
 
521
                        echo $this->formLabel($element);
-
 
522
                        echo $this->formText($element);
-
 
523
                    ?>
-
 
524
				</div>
-
 
525
				<div class="form-group">
-
 
526
    				<?php 
-
 
527
                        $element = $form->get('last_name');
-
 
528
                        $element->setOptions(['label' => 'LABEL_LAST_NAME']);
-
 
529
                        $element->setAttributes(['class' => 'form-control']); 
-
 
530
                        echo $this->formLabel($element);
-
 
531
                        echo $this->formText($element);
-
 
532
                    ?>
-
 
533
				</div>
-
 
534
      			<div class="form-group">
-
 
535
    				<?php 
-
 
536
                        $element = $form->get('email');
-
 
537
                        $element->setOptions(['label' => 'LABEL_EMAIL']);
-
 
538
                        $element->setAttributes(['class' => 'form-control']); 
-
 
539
                        echo $this->formLabel($element);
-
 
540
                        echo $this->formText($element);
-
 
541
                    ?>
-
 
542
				</div>
-
 
543
				
-
 
544
				<div class="form-group">
-
 
545
    				<?php 
-
 
546
                    $element = $form->get('file');
-
 
547
                        
-
 
548
                    $element->setAttributes(['class' => 'form-control',  'accept' => 'pdf/docx']);
-
 
549
                    $element->setOptions(['label' => 'LABEL_CURRICULUM']);
-
 
550
                    echo $this->formLabel($element);
-
 
551
                    ?>
-
 
552
                    <div class="file-loading">
-
 
553
                    	<?php echo $this->formFile($element); ?>
-
 
554
                    </div>
-
 
555
				</div>
-
 
556
          	</div>          	
-
 
557
         	<div class="modal-footer">
-
 
558
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
-
 
559
    			<button type="button" class="btn btn-default btn-add-cancel">LABEL_CANCEL</button>
-
 
560
          	</div>
-
 
561
      	<?php echo $this->form()->closeTag($form); ?>	
-
 
562
    	</div>
-
 
563
	</div>
-
 
564
</div>
-
 
565
 
-
 
566
<!-- The Edit Modal -->
-
 
567
<div class="modal" tabindex="-1" role="dialog" id="edit-candidate-box">
-
 
568
	<div class="modal-dialog" role="document">
-
 
569
		<?php 
-
 
570
	    $form->setAttributes([
-
 
571
	       'method'    => 'post',
-
 
572
	        'name'      => 'form-edit',
-
 
573
	        'id'        => 'form-edit'
-
 
574
	    ]);  
-
 
575
	    $form->prepare();
-
 
576
	    echo $this->form()->openTag($form);
-
 
577
	    
-
 
578
	    ?>
-
 
579
    	<div class="modal-content">
-
 
580
      		<div class="modal-header">
-
 
581
        		<h3 class="modal-title">LABEL_CANDIDATE</h3>
-
 
582
      		</div>
-
 
583
      		<div class="modal-body">
-
 
584
      			<div class="form-group">
-
 
585
    				<?php 
-
 
586
                        $element = $form->get('first_name');
407
                        $element->setOptions(['label' => 'LABEL_FIRST_NAME']);
587
                        $element->setOptions(['label' => 'LABEL_FIRST_NAME']);
408
                        $element->setAttributes(['class' => 'form-control']); 
588
                        $element->setAttributes(['class' => 'form-control']); 
409
                        echo $this->formLabel($element);
589
                        echo $this->formLabel($element);
410
                        echo $this->formText($element);
590
                        echo $this->formText($element);
411
                    ?>
591
                    ?>