Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 1242 Rev 1243
Línea 214... Línea 214...
214
    /**
214
    /**
215
     * Clicked on edit form
215
     * Clicked on edit form
216
     */
216
     */
217
    $('body').on('click', 'button.btn-edit-form', function(e) {
217
    $('body').on('click', 'button.btn-edit-form', function(e) {
218
        e.preventDefault();
218
        e.preventDefault();
-
 
219
        renderCompetenciesData([]);
219
        form_id = $(this).data('id')
220
        form_id = $(this).data('id')
220
        var action = $(this).data('href');
221
        var action = $(this).data('href');
221
        $.ajax({
222
        $.ajax({
222
            'dataType': 'json',
223
            'dataType': 'json',
223
            'accept': 'application/json',
224
            'accept': 'application/json',
Línea 392... Línea 393...
392
        $('#form-main #form-name').val('');
393
        $('#form-main #form-name').val('');
393
        $('#form-main #job_description_id').val('').trigger('change');
394
        $('#form-main #job_description_id').val('').trigger('change');
394
        $('#form-main #form-status').val('$status_active');
395
        $('#form-main #form-status').val('$status_active');
395
        CKEDITOR.instances['form-text'].setData('');
396
        CKEDITOR.instances['form-text'].setData('');
396
        CKEDITOR.instances['form-description'].setData('');
397
        CKEDITOR.instances['form-description'].setData('');
-
 
398
        renderCompetenciesData([]);
397
        $('#row-lists').hide();
399
        $('#row-lists').hide();
398
        $('#row-form').show();
400
        $('#row-form').show();
399
        $('#form-main #form-name').focus();
401
        $('#form-main #form-name').focus();
400
        return;
402
        return;
401
    });
403
    });
Línea 423... Línea 425...
423
        for (var instanceName in CKEDITOR.instances) {
425
        for (var instanceName in CKEDITOR.instances) {
424
            CKEDITOR.instances[instanceName].updateElement();
426
            CKEDITOR.instances[instanceName].updateElement();
425
        }
427
        }
426
        saveData(0);
428
        saveData(0);
427
    });
429
    });
428
 
-
 
429
    /**
430
    /**
430
     * Save Form Data
431
     * Save Form Data
431
     */
432
     */
432
    const saveData = (action) => {
433
    const saveData = (action) => {
433
 
-
 
434
        if ($('#form-name').val() == '') {
434
        if ($('#form-name').val() == '') {
435
            $.fn.showError('ERROR_ENTER_NAME');
435
            $.fn.showError('ERROR_ENTER_NAME');
436
        } else if ($('#form-description').val() == '') {
436
        } else if ($('#form-description').val() == '') {
437
            $.fn.showError('ERROR_ENTER_DESCRIPTION');
437
            $.fn.showError('ERROR_ENTER_DESCRIPTION');
438
        } else if ($('#form-text').val() == '') {
438
        } else if ($('#form-text').val() == '') {
Línea 457... Línea 457...
457
                    'content': JSON.stringify(sections)
457
                    'content': JSON.stringify(sections)
458
                },
458
                },
459
            }).done(function(response) {
459
            }).done(function(response) {
460
                if (response['success']) {
460
                if (response['success']) {
461
                    $.fn.showSuccess(response['data']);
461
                    $.fn.showSuccess(response['data']);
462
                    if (action ==1) {
462
                    if (action == 1) {
463
                        $('#form-main').attr('action', response['action_edit']);
463
                        $('#form-main').attr('action', response['action_edit']);
464
                    } else {
464
                    } else {
465
                        $('#row-form').hide();
465
                        $('#row-form').hide();
466
                        $('#row-lists').show();
466
                        $('#row-lists').show();
467
                        /*---------- Reset Form -------- */
467
                        /*---------- Reset Form -------- */
Línea 495... Línea 495...
495
        sections.push({
495
        sections.push({
496
            'id_section': new Date().getTime(),
496
            'id_section': new Date().getTime(),
497
            'title': title,
497
            'title': title,
498
            'type': type,
498
            'type': type,
499
            'text': text,
499
            'text': text,
500
            'answer':'',
500
            'answer': '',
501
            'options': []
501
            'options': []
502
        });
502
        });
503
        return renderData(sections);
503
        return renderData(sections);
504
    }
504
    }
505
    /**
505
    /**
Línea 530... Línea 530...
530
            if (item.id_section == id_section) {
530
            if (item.id_section == id_section) {
531
                item.options.push({
531
                item.options.push({
532
                    'id_section': id_section,
532
                    'id_section': id_section,
533
                    'id_option': new Date().getTime(),
533
                    'id_option': new Date().getTime(),
534
                    'title': title,
534
                    'title': title,
535
                    'answer':''
535
                    'answer': ''
536
                });
536
                });
537
            }
537
            }
538
        });
538
        });
539
        return renderData(sections);
539
        return renderData(sections);
540
    }
540
    }
Línea 569... Línea 569...
569
     */
569
     */
570
    $('button.btn-refresh').click(function(e) {
570
    $('button.btn-refresh').click(function(e) {
571
        tableForm.fnDraw();
571
        tableForm.fnDraw();
572
        return;
572
        return;
573
    });
573
    });
-
 
574
    /**
-
 
575
     * Initialize select Jobdescription
574
 
576
     */
575
    $('#job_description_id').select2({
577
    $('#job_description_id').select2({
576
        theme: 'bootstrap4',
578
        theme: 'bootstrap4',
577
        width: '100%',
579
        width: '100%',
578
    });
580
    });
-
 
581
    /**
-
 
582
     * On change selecte JobDescription
579
 
583
     */
580
    $('#job_description_id').on('change', function() {
584
    $('#job_description_id').on('change', function() {
581
 if($("#job_description_id").val()!=''){
585
        if ($("#job_description_id").val() != '') {
-
 
586
            $.getJSON("/settings/jobs-description/edit/" + $("#job_description_id").val(), function(data) {
-
 
587
                if (data['success']) {
-
 
588
                    renderCompetenciesData(data['data']['competencies_selected']);
-
 
589
                }
-
 
590
            });
-
 
591
        }
582
 
592
    });
Línea 583... Línea -...
583
 
-
 
-
 
593
 
584
    $.getJSON("/settings/jobs-description/edit/"+$("#job_description_id").val(), function(data) {
594
    /**
585
            console.log(data);
595
     * Render Competencies data
-
 
596
     */
-
 
597
    const renderCompetenciesData = (data) => {
-
 
598
        data.length > 0 ?
-
 
599
            $("#rows-job-competencies").html($("#competencyTemplate").render(data)) :
586
        });
600
            $("#rows-job-competencies").html('');
587
 }
-
 
588
});
601
    }
589
});
602
});
Línea 590... Línea 603...
590
JS;
603
JS;
591
 
604
 
Línea 782... Línea 795...
782
                     <th style="width: 10%;">LABEL_TYPE</th>
795
                     <th style="width: 10%;">LABEL_TYPE</th>
783
                     <th style="width: 50%;">LABEL_ACTIONS</th>
796
                     <th style="width: 50%;">LABEL_ACTIONS</th>
784
                  </tr>
797
                  </tr>
785
               </thead>
798
               </thead>
786
               <tbody>
799
               <tbody>
787
                  <tr class="tr-section">
800
                  <tr>
788
                     <td class="text-left">LABEL_SECTION</td>
801
                     <td class="text-left">LABEL_SECTION</td>
789
                     <td class="text-left">{{:title}}</td>
802
                     <td class="text-left">{{:title}}</td>
790
                     <td>
803
                     <td>
791
                        {{if type == 'simple'}} Simple {{/if}}
804
                        {{if type == 'simple'}} Simple {{/if}}
792
                        {{if type == 'multiple'}} Multiple {{/if}}
805
                        {{if type == 'multiple'}} Multiple {{/if}}
Línea 818... Línea 831...
818
      </div>
831
      </div>
819
   </div>
832
   </div>
820
</div>
833
</div>
821
   </script>
834
   </script>
822
   <!-- End Template Sections-->
835
   <!-- End Template Sections-->
-
 
836
 
-
 
837
  <!---Template Competencies --->
-
 
838
   <script id="competencyTemplate" type="text/x-jsrender">
-
 
839
   <div class="panel panel-default" id="panel-{{:competency_id}}">
-
 
840
   <div class="panel-heading">
-
 
841
      <h4 class="panel-title" style="    font-size: 18px;">
-
 
842
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:competency_id}}" href="#collapse-{{:competency_id}}">
-
 
843
         <span class="competency-name{{:competency_id}}">
-
 
844
         {{:~getType(competency_type_id).name}} - {{:name}}
-
 
845
         </span>
-
 
846
         </a>
-
 
847
      </h4>
-
 
848
   </div>
-
 
849
   <div id="collapse-{{:competency_id}}" class="panel-collapse in collapse show">
-
 
850
      <div class="panel-body">
-
 
851
         <div class="table-responsive">
-
 
852
            <table class="table table-bordered">
-
 
853
               <thead>
-
 
854
                  <tr>
-
 
855
                     <th style="width: 20%;">LABEL_ELEMENT</th>
-
 
856
                     <th style="width: 50%;">LABEL_TITLE</th>
-
 
857
                     <th style="width: 10%;">LABEL_LEVEL</th>
-
 
858
                  </tr>
-
 
859
               </thead>
-
 
860
               <tbody>
-
 
861
                  <tr>
-
 
862
                     <td class="text-left">LABEL_COMPETENCY</td>
-
 
863
                     <td class="text-left">{{:name}}</td>
-
 
864
                     <td></td>
-
 
865
                  </tr>
-
 
866
                  {{for behaviors}}
-
 
867
                  <tr >
-
 
868
                     <td class="text-left">--LABEL_CONDUCT</td>
-
 
869
                     <td class="text-left">
-
 
870
                        {{:description}}
-
 
871
                     </td>
-
 
872
                     <td>
-
 
873
          {{if level == '0'}} LABEL_NA {{/if}} 
-
 
874
          {{if level == '1' }} LABEL_LEVEL_ONE {{/if}} 
-
 
875
          {{if level == '2' }} LABEL_LEVEL_TWO {{/if}} 
-
 
876
          {{if level == '3' }} LABEL_LEVEL_THREE {{/if}} 
-
 
877
          {{if level == '4' }} LABEL_LEVEL_FOUR {{/if}} 
-
 
878
       </td>
-
 
879
                     
-
 
880
                  </tr>
-
 
881
                  {{/for}}
-
 
882
               </tbody>
-
 
883
            </table>
-
 
884
         </div>
-
 
885
      </div>
-
 
886
   </div>
-
 
887
</div>
-
 
888
   </script>
-
 
889
    <!-- End Template Competencies-->
-
 
890
   
823
</section>
891
</section>
824
892