Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 1053 Rev 1054
Línea 60... Línea 60...
60
$status_active = \LeadersLinked\Model\CompanyPerformanceEvaluationForm::STATUS_ACTIVE;
60
$status_active = \LeadersLinked\Model\CompanyPerformanceEvaluationForm::STATUS_ACTIVE;
61
$status_inactive = \LeadersLinked\Model\CompanyPerformanceEvaluationForm::STATUS_INACTIVE;
61
$status_inactive = \LeadersLinked\Model\CompanyPerformanceEvaluationForm::STATUS_INACTIVE;
Línea 62... Línea 62...
62
 
62
 
63
$this->inlineScript()->captureStart();
63
$this->inlineScript()->captureStart();
64
echo <<<JS
-
 
65
   
64
echo <<<JS
66
   jQuery(document).ready(function($) {
65
   jQuery(document).ready(function($) {
67
    var allowEdit = $allowEdit;
66
    var allowEdit = $allowEdit;
68
    var allowDelete = $allowDelete;
67
    var allowDelete = $allowDelete;
69
    var sections = [];
68
    var sections = [];
Línea 225... Línea 224...
225
                $("#rows").html('');
224
                $("#rows").html('');
226
                sections = [];
225
                sections = [];
227
                $('#form-main').attr('action', action);
226
                $('#form-main').attr('action', action);
228
                $('#form-main #form-id').val(response['data']['id']),
227
                $('#form-main #form-id').val(response['data']['id']),
229
                $('#form-main #form-name').val(response['data']['name']),
228
                $('#form-main #form-name').val(response['data']['name']),
-
 
229
        $('#form-main #job_description_id').val(response['data']['job_description_id']);
-
 
230
        $('#form-main #form-status').val(response['data']['status']);
-
 
231
        sections=response['data']['content'] || [];
-
 
232
                renderData(sections);
230
                $('#row-lists').hide();
233
                $('#row-lists').hide();
231
                $('#row-form').show();
234
                $('#row-form').show();
232
            } else {
235
            } else {
233
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
236
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
234
            }
237
            }
Línea 423... Línea 426...
423
    });
426
    });
424
    /**
427
    /**
425
     * Clicked save and close new/edit Form
428
     * Clicked save and close new/edit Form
426
     */
429
     */
427
    $('button.btn-form-save-close').click(function(e) {
430
    $('button.btn-form-save-close').click(function(e) {
-
 
431
 
428
        e.preventDefault();
432
        e.preventDefault();
-
 
433
 
-
 
434
        if($('#form-name').val()==''){
-
 
435
            $.fn.showError('Ingrese un nombre');
-
 
436
        }
429
        $('#form-main #form-continue').val('0')
437
        else if($('#form-status').val()==''){
-
 
438
            $.fn.showError('Seleccione un status');
-
 
439
        }
-
 
440
        else if($('#job_description_id').val()==''){
-
 
441
            $.fn.showError('Seleccione una descripción de cargo');
-
 
442
        }
-
 
443
        else if(sections.length == 0){
-
 
444
            $.fn.showError('Debe ingresar al menos una sección');
-
 
445
        }else{
-
 
446
 
-
 
447
            var formId = parseInt($('#form-main #form-id').val());
-
 
448
 
-
 
449
                var data = {
-
 
450
                    'id': formId,
-
 
451
                    'name': $('#form-main #form-name').val(),
-
 
452
                    'job_description_id': $('#form-main #job_description_id').val(),
-
 
453
                    'status': $('#form-main #form-status').val(),
-
 
454
                    'content': JSON.stringify(objFormGenerator.sections)
-
 
455
                }
-
 
456
                $.ajax({
-
 
457
                    'dataType': 'json',
-
 
458
                    'method': 'post',
-
 
459
                    'url': $('#form-main').attr('action'),
-
 
460
                    'data': data,
-
 
461
                }).done(function(response) {
-
 
462
                    if (response['success']) {
-
 
463
                        $.fn.showSuccess(response['data']);
-
 
464
                            $('#row-form').hide();
-
 
465
                            $('#row-lists').show();
-
 
466
                        /*---------- Reset Form -------- */
430
        $('#form-main').submit();
467
                        $('#form-main')[0].reset();
-
 
468
                        /*--------Reset Sections ----------*/
-
 
469
                        sections = [];
-
 
470
                        tableForm.fnDraw();
-
 
471
                    } else {
-
 
472
                        $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
-
 
473
                    }
-
 
474
 
-
 
475
        }
-
 
476
     
431
    });
477
    });
432
    /**
478
    /**
433
     * Remove Html Tags
479
     * Remove Html Tags
434
     */
480
     */
435
    const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
481
    const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
Línea 442... Línea 488...
442
    }
488
    }
443
    /**
489
    /**
444
     * Add Section to array
490
     * Add Section to array
445
     */
491
     */
446
    const addSection = (title, text, type) => {
492
    const addSection = (title, text, type) => {
447
        console.log('add');
-
 
448
        sections.push({
493
        sections.push({
449
            'id_section': new Date().getTime(),
494
            'id_section': new Date().getTime(),
450
            'title': title,
495
            'title': title,
451
            'type': type,
496
            'type': type,
452
            'text': text,
497
            'text': text,
Línea 535... Línea 580...
535
      </div>
580
      </div>
536
   </div>
581
   </div>
537
   <!-- /.container-fluid -->
582
   <!-- /.container-fluid -->
538
</section>
583
</section>
539
<section class="content">
584
<section class="content">
540
   <div class="container-fluid" id="row-lists">
585
   <div class="container-fluid" id="">
541
      <div class="row">
586
      <div class="row">
542
         <div class="col-12">
587
         <div class="col-12">
543
            <div class="card">
588
            <div class="card">
544
               <div class="card-body">
589
               <div class="card-body">
545
                  <table id="gridTable" class="table   table-hover">
590
                  <table id="gridTable" class="table   table-hover">