Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 1629 Rev 1630
Línea 2... Línea 2...
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
3
$currentUser    = $this->currentUserHelper();
4
$roleName       = $currentUser->getUserTypeId();
4
$roleName       = $currentUser->getUserTypeId();
Línea 5... Línea 5...
5
 
5
 
-
 
6
$routeDatatable = $this->url('recruitment-and-selection/candidates');
6
$routeDatatable = $this->url('recruitment-and-selection/candidates');
7
$routeEmail = $this->url('recruitment-and-selection/candidates/email');
Línea 7... Línea 8...
7
$routeAdd = $this->url('recruitment-and-selection/candidates/add', ['vacancy_uuid' => 'UUID_PLACEHOLDER']);
8
$routeAdd = $this->url('recruitment-and-selection/candidates/add', ['vacancy_uuid' => 'UUID_PLACEHOLDER']);
8
 
9
 
9
$allowAdd = $acl->isAllowed($roleName, 'recruitment-and-selection/candidates/add') ? 1 : 0;
10
$allowAdd = $acl->isAllowed($roleName, 'recruitment-and-selection/candidates/add') ? 1 : 0;
-
 
11
$allowDelete = $acl->isAllowed($roleName, 'recruitment-and-selection/candidates/delete') ? 1 : 0;
Línea 10... Línea 12...
10
$allowDelete = $acl->isAllowed($roleName, 'recruitment-and-selection/candidates/delete') ? 1 : 0;
12
$allowEdit = $acl->isAllowed($roleName, 'recruitment-and-selection/candidates/edit') ? 1 : 0;
11
$allowEdit = $acl->isAllowed($roleName, 'recruitment-and-selection/candidates/edit') ? 1 : 0;
13
$allowEmail = $acl->isAllowed($roleName, 'recruitment-and-selection/candidates/email') ? 1 : 0;
Línea 60... Línea 62...
60
jQuery( document ).ready(function( $ ) {
62
jQuery( document ).ready(function( $ ) {
Línea 61... Línea 63...
61
 
63
 
62
    var allowAdd = $allowAdd;
64
    var allowAdd = $allowAdd;
63
    var allowDelete = $allowDelete;
65
    var allowDelete = $allowDelete;
-
 
66
    var allowEdit = $allowEdit;
Línea 64... Línea 67...
64
    var allowEdit = $allowEdit;
67
    var allowEmail = $allowEmail;
65
 
68
 
66
        var gridTable = $('#gridTable').dataTable( {
69
        var gridTable = $('#gridTable').dataTable( {
67
            'processing': true,
70
            'processing': true,
Línea 370... Línea 373...
370
        invalidHandler: function(form, validator) {
373
        invalidHandler: function(form, validator) {
Línea 371... Línea 374...
371
            
374
            
372
        }
375
        }
Línea -... Línea 376...
-
 
376
    });
-
 
377
 
-
 
378
    var validatorAdd = $('#form-add').validate({
-
 
379
        debug: true,
-
 
380
        onclick: false,
-
 
381
        onkeyup: false,
-
 
382
        onfocusout: false,
-
 
383
        ignore: [],
-
 
384
       /* rules: {
-
 
385
            'first_name': {
-
 
386
                required: true,
-
 
387
                maxlength: 128,
-
 
388
            },
-
 
389
            'file': {
-
 
390
                required: false,
-
 
391
                extension: 'pdf|docx',
-
 
392
                accept: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/msword,application/pdf'
-
 
393
            },
-
 
394
            'last_name': {
-
 
395
                required: true,
-
 
396
            },
-
 
397
            'email' :  {
-
 
398
                required: true,
-
 
399
            }, 
-
 
400
            'status' : {
-
 
401
                required: true,
-
 
402
            }
-
 
403
        },*/
-
 
404
        submitHandler: function(form)
-
 
405
        {
-
 
406
            var formdata = false;
-
 
407
            if (window.FormData){
-
 
408
                formdata = new FormData(form); //form[0]);
-
 
409
            }
-
 
410
 
-
 
411
            $('input[type="email"]').prop('disabled', true);
-
 
412
 
-
 
413
            $.ajax({
-
 
414
                'dataType'  : 'json',
-
 
415
                'accept'    : 'application/json',
-
 
416
                'method'    : 'get',
-
 
417
                'url'       :  $('#form-add').attr('email'),
-
 
418
                'data'      :  formdata,
-
 
419
                'processData': false,
-
 
420
                'contentType': false,
-
 
421
            }).done(function(response) {
-
 
422
                if(response['success']) {
-
 
423
                    $.fn.showSuccess(response['data']);
-
 
424
                       
-
 
425
                    $('#add-candidate-box').modal('hide');
-
 
426
                    gridTable.api().ajax.reload(null, false);
-
 
427
                } else {
-
 
428
                    validatorAdd.resetForm();
-
 
429
                    if(jQuery.type(response['data']) == 'string') {
-
 
430
                        $.fn.showError(response['data']);
-
 
431
                    } else  {
-
 
432
                        $.each(response['data'], function( fieldname, errors ) {
-
 
433
                            $.fn.showFormErrorValidator('#form-add #' + fieldname, errors);
-
 
434
                        });
-
 
435
                    }
-
 
436
                }
-
 
437
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
438
                $.fn.showError(textStatus);
-
 
439
            }).always(function() {
-
 
440
                NProgress.done();
-
 
441
            });
-
 
442
            return false;
-
 
443
        },
-
 
444
        invalidHandler: function(form, validator) {
-
 
445
            
-
 
446
        }
373
    });
447
    });
374
 
448
 
375
            },
449
            },
376
            'aoColumns': [
450
            'aoColumns': [
377
                { 'mDataProp': 'first_name' },
451
                { 'mDataProp': 'first_name' },
Línea 506... Línea 580...
506
	    //$form = $this->formA;
580
	    //$form = $this->formA;
507
	    $form->setAttributes([
581
	    $form->setAttributes([
508
	       'method'    => 'post',
582
	       'method'    => 'post',
509
	        'name'      => 'form-add',
583
	        'name'      => 'form-add',
510
            'action'    => $routeAdd,
584
            'action'    => $routeAdd,
-
 
585
            'email'     => $routeEmail,
511
	        'id'        => 'form-add'
586
	        'id'        => 'form-add'
512
	    ]);  
587
	    ]);  
513
	    $form->prepare();
588
	    $form->prepare();
514
	    echo $this->form()->openTag($form);
589
	    echo $this->form()->openTag($form);
Línea 569... Línea 644...
569
                    ?>
644
                    ?>
570
				</div>
645
				</div>
571
          	</div>          	
646
          	</div>          	
572
         	<div class="modal-footer">
647
         	<div class="modal-footer">
573
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
648
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
-
 
649
    			<button type="email" class="btn btn-email">LABEL_CHECK_EMAIL</button>
574
    			<button type="button" class="btn btn-default btn-add-cancel">LABEL_CANCEL</button>
650
    			<button type="button" class="btn btn-default btn-add-cancel">LABEL_CANCEL</button>
575
          	</div>
651
          	</div>
576
      	<?php echo $this->form()->closeTag($form); ?>	
652
      	<?php echo $this->form()->closeTag($form); ?>	
577
    	</div>
653
    	</div>
578
	</div>
654
	</div>