Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 889 | Rev 891 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
<?php
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
4
 
5
$roleName = $currentUser->getUserTypeId();
6
 
7
 
8
$routeAdd       = $this->url('settings/competencies/add');
9
$routeDatatable = $this->url('settings/competencies');
28 efrain 10
$routeImport    = $this->url('settings/competencies/import');
1 www 11
 
28 efrain 12
$allowAdd       = $acl->isAllowed($roleName, 'settings/competencies/add') ? 1 : 0;
13
$allowEdit      = $acl->isAllowed($roleName, 'settings/competencies/edit') ? 1 : 0;
14
$allowDelete    = $acl->isAllowed($roleName, 'settings/competencies/delete') ? 1 : 0;
15
$allowImport    = $acl->isAllowed($roleName, 'settings/competencies/import') ? 1 : 0;
1 www 16
 
17
 
18
 
19
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
20
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
21
 
22
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
23
 
24
 
25
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
26
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
27
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
28
 
29
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
30
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
31
 
32
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
33
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
34
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
35
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
36
 
37
 
38
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
39
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
40
 
41
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
42
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
43
 
44
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.js'));
45
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/i18n/es.js'));
46
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.css'));
47
 
48
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.css'));
49
 
874 geraldo 50
// JsRender //
51
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.min.js'));
1 www 52
 
883 geraldo 53
// bootbox Alert //
54
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.min.js'));
1 www 55
 
883 geraldo 56
 
1 www 57
$status_active = \LeadersLinked\Model\Competency::STATUS_ACTIVE;
58
 
59
$this->inlineScript()->captureStart();
60
echo <<<JS
877 geraldo 61
let behaviors = [];
62
jQuery(document).ready(function($) {
863 geraldo 63
    $.validator.setDefaults({
64
        debug: true,
65
        highlight: function(element) {
66
            $(element).addClass('is-invalid');
67
        },
68
        unhighlight: function(element) {
69
            $(element).removeClass('is-invalid');
70
        },
71
        errorElement: 'span',
72
        errorClass: 'error invalid-feedback',
73
        errorPlacement: function(error, element) {
74
            const child = element.children(':first-child');
75
            if (element[0].localName == 'input') {
76
                let _error = error
77
                _error[0].style.display = 'block'
78
                _error.insertBefore(element);
79
            } else if (element.parent('.form-group').length) {
80
                error.insertAfter(element);
81
            } else if (element.parent('.toggle').length) {
82
                error.insertAfter(element.parent().parent());
83
            } else {
84
                error.insertAfter(element.parent());
85
            }
86
        }
87
    });
88
    $.fn.showFormErrorValidator = function(fieldname, errors) {
89
        var field = $(fieldname);
90
        if (field) {
91
            $(field).addClass('is-invalid');
92
            var error = $('<span id="' + fieldname + '-error" class="error invalid-feedback">' + errors + '</div>');
93
            if (field.parent('.form-group').length) {
94
                error.insertAfter(field);
95
            } else if (field.parent('.toggle').length) {
96
                error.insertAfter(field.parent().parent());
97
            } else {
98
                error.insertAfter(field.parent());
99
            }
100
        }
101
    };
102
    var allowEdit = $allowEdit;
103
    var allowDelete = $allowDelete;
104
    var gridTable = $('#gridTable').dataTable({
105
        'processing': true,
106
        'serverSide': true,
107
        'searching': true,
108
        'order': [
109
            [0, 'asc']
110
        ],
111
        'ordering': true,
112
        'ordenable': true,
113
        'responsive': true,
114
        'select': false,
115
        'paging': true,
116
        'pagingType': 'simple_numbers',
117
        'ajax': {
118
            'url': '$routeDatatable',
119
            'type': 'get',
120
            'beforeSend': function(request) {
121
                NProgress.start();
1 www 122
            },
863 geraldo 123
            'dataFilter': function(response) {
124
                var response = jQuery.parseJSON(response);
125
                var json = {};
126
                json.recordsTotal = 0;
127
                json.recordsFiltered = 0;
128
                json.data = [];
129
                if (response.success) {
130
                    json.recordsTotal = response.data.total;
131
                    json.recordsFiltered = response.data.total;
132
                    json.data = response.data.items;
1 www 133
                } else {
863 geraldo 134
                    $.fn.showError(response.data)
1 www 135
                }
863 geraldo 136
                return JSON.stringify(json);
1 www 137
            }
863 geraldo 138
        },
139
        'language': {
140
            'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
141
            'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
142
            'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
143
            'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
144
            'sInfo': 'LABEL_DATATABLE_SINFO',
145
            'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
146
            'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
147
            'sInfoPostFix': '',
148
            'sSearch': 'LABEL_DATATABLE_SSEARCH',
149
            'sUrl': '',
150
            'sInfoThousands': ',',
151
            'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
152
            'oPaginate': {
153
                'sFirst': 'LABEL_DATATABLE_SFIRST',
154
                'sLast': 'LABEL_DATATABLE_SLAST',
155
                'sNext': 'LABEL_DATATABLE_SNEXT',
156
                'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
157
            },
158
            'oAria': {
159
                'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
160
                'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
161
            },
162
        },
163
        'drawCallback': function(settings) {
164
            NProgress.done();
165
            $('button.btn-delete').confirmation({
166
                rootSelector: 'button.btn-delete',
167
                title: 'LABEL_ARE_YOU_SURE',
168
                singleton: true,
169
                btnOkLabel: 'LABEL_YES',
170
                btnCancelLabel: 'LABEL_NO',
171
                onConfirm: function(value) {
172
                    action = $(this).data('href');
173
                    NProgress.start();
174
                    $.ajax({
175
                        'dataType': 'json',
176
                        'accept': 'application/json',
177
                        'method': 'post',
178
                        'url': action,
179
                    }).done(function(response) {
180
                        if (response['success']) {
181
                            $.fn.showSuccess(response['data']);
182
                            gridTable.api().ajax.reload(null, false);
183
                        } else {
184
                            $.fn.showError(response['data']);
185
                        }
186
                    }).fail(function(jqXHR, textStatus, errorThrown) {
187
                        $.fn.showError(textStatus);
188
                    }).always(function() {
189
                        NProgress.done();
190
                    });
1 www 191
                },
863 geraldo 192
            });
193
        },
194
        'aoColumns': [{
195
                'mDataProp': 'type'
196
            },
197
            {
198
                'mDataProp': 'name'
199
            },
200
            {
201
                'mDataProp': 'status'
202
            },
203
            {
204
                'mDataProp': 'actions'
205
            },
206
        ],
207
        'columnDefs': [{
208
                'targets': 0,
209
                'className': 'text-vertical-middle',
210
            },
211
            {
212
                'targets': 1,
213
                'className': 'text-vertical-middle',
214
            },
215
            {
216
                'targets': -2,
217
                'orderable': false,
218
                'className': 'text-center',
219
                'render': function(data, type, row) {
220
                    checked = data == 'a' ? ' checked="checked" ' : '';
221
                    return '<div class="checkbox checkbox-success">' +
222
                        '<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
223
                        '<label ></label></div>';
1 www 224
                }
225
            },
863 geraldo 226
            {
227
                'targets': -1,
228
                'orderable': false,
229
                'render': function(data, type, row) {
230
                    s = '';
231
                    if (allowEdit) {
232
                        s = s + '<button class="btn btn-primary btn-edit" data-href="' + data['link_edit'] + '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button>&nbsp;';
1 www 233
                    }
863 geraldo 234
                    if (allowDelete) {
235
                        s = s + '<button class="btn btn-danger btn-delete" data-href="' + data['link_delete'] + '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button>&nbsp;';
1 www 236
                    }
863 geraldo 237
                    return s;
1 www 238
                }
863 geraldo 239
            }
240
        ],
241
    });
242
    var validator = $('#form').validate({
243
        debug: true,
244
        onclick: false,
245
        onkeyup: false,
246
        ignore: [],
247
        rules: {
248
            'competency_type_id': {
249
                required: true,
250
            },
251
            'name': {
252
                required: true,
253
                maxlength: 128,
254
            },
255
            'description': {
256
                updateCkeditor: function() {
257
                    CKEDITOR.instances.description.updateElement();
1 www 258
                },
863 geraldo 259
                required: true,
1 www 260
            },
863 geraldo 261
            'status': {
262
                required: false,
1 www 263
            },
863 geraldo 264
        },
265
        submitHandler: function(form) {
1 www 266
            $.ajax({
863 geraldo 267
                'dataType': 'json',
268
                'accept': 'application/json',
269
                'method': 'post',
270
                'url': $('#form').attr('action'),
271
                'data': $('#form').serialize()
1 www 272
            }).done(function(response) {
863 geraldo 273
                NProgress.start();
274
                if (response['success']) {
28 efrain 275
                    $.fn.showSuccess(response['data']);
866 geraldo 276
                    $('#row-form').hide();
877 geraldo 277
                    $('#row-list').show();
28 efrain 278
                    gridTable.api().ajax.reload(null, false);
279
                } else {
863 geraldo 280
                    validator.resetForm();
281
                    if (jQuery.type(response['data']) == 'string') {
282
                        $.fn.showError(response['data']);
283
                    } else {
284
                        $.each(response['data'], function(fieldname, errors) {
285
                            $.fn.showFormErrorValidator('#form #' + fieldname, errors);
286
                        });
287
                    }
28 efrain 288
                }
863 geraldo 289
            }).fail(function(jqXHR, textStatus, errorThrown) {
28 efrain 290
                $.fn.showError(textStatus);
291
            }).always(function() {
292
                NProgress.done();
293
            });
294
            return false;
863 geraldo 295
        },
296
        invalidHandler: function(form, validator) {}
297
    });
298
    $('body').on('click', 'button.btn-add', function(e) {
299
        e.preventDefault();
300
        $('span[id="form-title"]').html('LABEL_ADD');
301
        $('#form').attr('action', '$routeAdd');
302
        $('#form #name').val('');
303
        $('#form #competency_type_id').val('').trigger('change');
304
        $('#form #status').bootstrapToggle('on');
305
        CKEDITOR.instances.description.setData('');
306
        validator.resetForm();
866 geraldo 307
        $('#row-form').show();
873 geraldo 308
        $('#row-list').hide();
863 geraldo 309
        return false;
310
    });
311
    $('body').on('click', 'button.btn-edit', function(e) {
312
        e.preventDefault();
313
        NProgress.start();
314
        var action = $(this).data('href');
315
        $.ajax({
316
            'dataType': 'json',
317
            'method': 'get',
318
            'url': action,
319
        }).done(function(response) {
320
            if (response['success']) {
321
                $('span[id="form-title"]').html('LABEL_EDIT');
322
                $('#form').attr('action', action);
323
                $('#form #name').val(response['data']['name']);
324
                $('#form #competency_type_id').val(response['data']['competency_type_id']).trigger('change');
325
                $('#form #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
326
                CKEDITOR.instances.description.setData(response['data']['description']);
327
                validator.resetForm();
866 geraldo 328
                $('#row-form').show();
873 geraldo 329
                $('#row-list').hide();
863 geraldo 330
            } else {
331
                $.fn.showError(response['data']);
332
            }
333
        }).fail(function(jqXHR, textStatus, errorThrown) {
334
            $.fn.showError(textStatus);
335
        }).always(function() {
336
            NProgress.done();
28 efrain 337
        });
863 geraldo 338
        return false;
339
    });
340
    $('body').on('click', 'button.btn-refresh', function(e) {
341
        e.preventDefault();
342
        gridTable.api().ajax.reload(null, false);
343
        return false;
344
    });
345
    $('body').on('click', 'button.btn-import', function(e) {
346
        e.preventDefault();
347
        NProgress.start();
348
        $.ajax({
349
            'dataType': 'json',
350
            'method': 'post',
351
            'url': '$routeImport',
352
        }).done(function(response) {
353
            if (response['success']) {
354
                $.fn.showSuccess(response['data']);
355
                gridTable.api().ajax.reload(null, false);
356
            } else {
357
                $.fn.showError(response['data']);
358
            }
359
        }).fail(function(jqXHR, textStatus, errorThrown) {
360
            $.fn.showError(textStatus);
361
        }).always(function() {
362
            NProgress.done();
1 www 363
        });
863 geraldo 364
        return false;
365
    });
366
    $('body').on('click', 'button.btn-cancel', function(e) {
367
        e.preventDefault();
368
        $('#modal').modal('hide');
369
    });
370
    $('#form #competency_type_id').select2({
371
        theme: 'bootstrap4',
372
        width: '100%',
373
    });
374
    $('#form #status').bootstrapToggle({
375
        'on': 'LABEL_ACTIVE',
376
        'off': 'LABEL_INACTIVE',
377
        'width': '160px',
378
        'height': '40px'
379
    });
380
    CKEDITOR.replace('description');
381
    /**
862 geraldo 382
     * Clicked on add new conduct
383
     */
384
    $('body').on('click', 'button[id="btn-add-conduct"]', function(e) {
385
        e.preventDefault();
386
        $('#form-conduct #conduct-id').val('');
387
        $('#form-conduct #conduct-description').val('');
388
        $('#form-conduct #conduct-level').val('0');
389
        $('#modal-conduct h4[class="modal-title"]').html('LABEL_ADD LABEL_CONDUCT');
390
        $('#modal-conduct').modal('show');
1 www 391
    });
862 geraldo 392
    /**
393
     * Clicked on edit conduct
394
     */
395
    $('body').on('click', 'button.btn-edit-conduct', function(e) {
396
        e.preventDefault();
877 geraldo 397
        var id = $(this).data('conduct');
398
        behaviors.map((item) => {
399
            if (item.id == id) {
882 geraldo 400
                $('#form-conduct #conduct-id').val(item.id);
401
                $('#form-conduct #conduct-description').val(item.description);
402
                $('#form-conduct #conduct-level').val(item.level);
877 geraldo 403
                $('#modal-conduct h4[class="modal-title"]').html('LABEL_EDIT LABEL_CONDUCT');
404
                $('#modal-conduct').modal('show');
862 geraldo 405
                return;
406
            }
877 geraldo 407
        });
862 geraldo 408
    });
409
    /**
410
     * Clicked on remove conduct
411
     */
412
    $('body').on('click', 'button.btn-delete-conduct', function(e) {
413
        e.preventDefault();
888 geraldo 414
        var id = $(this).data('conduct');
862 geraldo 415
        bootbox.confirm({
416
            title: "LABEL_DELETE LABEL_CONDUCT",
417
            message: "LABEL_QUESTION_DELETE",
418
            buttons: {
419
                cancel: {
420
                    label: '<i class="fa fa-times"></i> LABEL_CANCEL'
421
                },
422
                confirm: {
423
                    label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
424
                }
425
            },
426
            callback: function(result) {
886 geraldo 427
                if (result) {
888 geraldo 428
                    removeBehavior(id);
886 geraldo 429
                }
862 geraldo 430
            }
431
        });
432
    });
863 geraldo 433
    /**
879 geraldo 434
     * Clicked cancel new/edit Form
863 geraldo 435
     */
879 geraldo 436
    $('button.btn-conduct-submit').click(function(e) {
437
 
438
        if($("#conduct-description").val()==""){
439
            $.fn.showError('Ingrese una descripción');
883 geraldo 440
            return;
879 geraldo 441
 
442
        }else{
443
 
880 geraldo 444
          $("#conduct-id").val()=="" ?
879 geraldo 445
 
881 geraldo 446
                addBehavior($("#conduct-description").val(), $("#conduct-level").val()) :
884 geraldo 447
                editBehavior($("#conduct-id").val(),$("#conduct-description").val(), $("#conduct-level").val())
879 geraldo 448
 
883 geraldo 449
                $('#modal-conduct').modal('hide');
450
                return;
863 geraldo 451
        }
862 geraldo 452
    });
873 geraldo 453
    /**
454
     * Clicked cancel new/edit Form
455
     */
456
    $('button.btn-edit-cancel').click(function(e) {
457
        e.preventDefault();
458
        $('#row-form').hide();
459
        $('#row-list').show();
460
    });
874 geraldo 461
    /**
462
     * Add Behavior to array
463
     */
877 geraldo 464
    const addBehavior = (description, level) => {
878 geraldo 465
        behaviors.push({
466
            'id': new Date().getTime(),
877 geraldo 467
            'description': description,
874 geraldo 468
            'level': level
878 geraldo 469
        });
874 geraldo 470
        renderData(behaviors);
471
    }
472
    /**
473
     * Edit item behavior
474
     */
877 geraldo 475
    const editBehavior = (id, description, level) => {
476
        behaviors.map((item) => {
477
            if (item.id == id) {
874 geraldo 478
                item.description = description;
479
                item.level = level
480
            }
481
        });
482
        renderData(behaviors);
483
    }
484
    /**
485
     * Remove behavior
486
     */
877 geraldo 487
    const removeBehavior = (id) => {
488
        behaviors = behaviors.filter((item) => item.id != id);
874 geraldo 489
        renderData(behaviors);
490
    }
877 geraldo 491
    /**
874 geraldo 492
     * Render Sections data
493
     */
494
    const renderData = (data) => $("#rows").html($("#behaviorTemplate").render(data));
863 geraldo 495
});
1 www 496
JS;
497
$this->inlineScript()->captureEnd();
498
?>
890 geraldo 499
 
1 www 500
<!-- Content Header (Page header) -->
501
<section class="content-header">
890 geraldo 502
   <div class="container-fluid">
503
      <div class="row mb-2">
504
         <div class="col-sm-12">
505
            <h1>LABEL_COMPETENCIES</h1>
506
         </div>
507
      </div>
508
   </div>
509
   <!-- /.container-fluid -->
1 www 510
</section>
873 geraldo 511
<section class="content" id="row-list">
890 geraldo 512
   <div class="container-fluid">
513
      <div class="row">
514
         <div class="col-12">
515
            <div class="card">
516
               <div class="card-body">
517
                  <table id="gridTable" class="table   table-hover">
518
                     <thead>
519
                        <tr>
520
                           <th>LABEL_TYPE</th>
521
                           <th>LABEL_NAME</th>
522
                           <th>LABEL_ACTIVE</th>
523
                           <th>LABEL_ACTIONS</th>
524
                        </tr>
525
                     </thead>
526
                     <tbody>
527
                     </tbody>
528
                  </table>
529
               </div>
530
               <div class="card-footer clearfix">
531
                  <div style="float:right;">
532
                     <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
533
                     <?php if($allowImport) : ?>
534
                     <button type="button" class="btn btn-primary btn-import"><i class="fa fa-upload"></i> LABEL_IMPORT </button>
535
                     <?php endif; ?>
536
                     <?php if($allowAdd) : ?>
537
                     <button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
538
                     <?php endif; ?>
539
                  </div>
540
               </div>
541
            </div>
542
         </div>
543
      </div>
544
   </div>
545
</section>
1 www 546
 
865 geraldo 547
<!-- The Form creation -->
890 geraldo 548
 
865 geraldo 549
<section class="content" id="row-form" style="display: none">
550
   <div class="container-fluid">
890 geraldo 551
   <div class="row">
552
   <div class="col-md-12 col-sm-12 col-12">
553
      <div class="panel">
554
         <div class="panel-body">
555
            <?php
556
               $form = $this->form;
557
               $form->setAttributes([
558
                   'method'    => 'post',
559
                   'name'      => 'form',
560
                   'id'        => 'form'
561
               ]);
562
 
563
               $form->prepare();
564
               echo $this->form()->openTag($form);
565
               ?>
566
            <div   class="row">
567
               <div class="col-md-4 col-sm-12 col-12">
568
                  <div class="from-group">
569
                     <?php
570
                        $element = $form->get('competency_type_id');
571
                        $element->setOptions(['label' => 'LABEL_TYPE']);
572
 
573
                        echo $this->formLabel($element);
574
                        echo $this->formSelect($element);
575
                        ?>
865 geraldo 576
                  </div>
890 geraldo 577
               </div>
578
               <div class="col-md-4 col-sm-12 col-12">
579
                  <div class="from-group">
580
                     <?php
581
                        $element = $form->get('name');
582
                        $element->setOptions(['label' => 'LABEL_NAME']);
583
                        $element->setAttributes(['class' => 'form-control']);
584
 
585
                        echo $this->formLabel($element);
586
                        echo $this->formText($element);
587
                        ?>
865 geraldo 588
                  </div>
890 geraldo 589
               </div>
590
               <div class="col-md-4 col-sm-12 col-12">
591
                  <div class="from-group">
592
                     <label>LABEL_STATUS</label>
593
                     <br />
594
                     <?php
595
                        $element = $form->get('status');
596
                        $element->setOptions(['label' => 'LABEL_STATUS']);
597
                        // echo $this->formLabel($element);
598
                        echo $this->formCheckbox($element);
599
                        ?>
865 geraldo 600
                  </div>
890 geraldo 601
               </div>
602
               <div class="col-md col-sm-12 col-12">
603
                  <div class="form-group">
604
                     <?php
605
                        $element = $form->get('description');
606
                        $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
607
                        $element->setAttributes(['class' => 'form-control']);
608
 
609
                        echo $this->formLabel($element);
610
                        echo $this->formTextArea($element);
611
                        ?>
865 geraldo 612
                  </div>
890 geraldo 613
               </div>
865 geraldo 614
               <?php echo $this->form()->closeTag($form); ?>
890 geraldo 615
               <div class="col-xs-12 col-md-12 text-right">
616
                  <button class="btn btn-primary" id="btn-add-conduct" data-toggle="tooltip" title="LABEL_ADD LABEL_CONDUCT"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD LABEL_CONDUCT</button>
617
               </div>
618
               <div class="col-xs-12 col-md-12">
619
                  <br/>
885 geraldo 620
                  <div class="table-responsive">
890 geraldo 621
                     <table class="table table-bordered">
885 geraldo 622
                        <thead>
890 geraldo 623
                           <tr>
624
                              <th style="width: 40%;">LABEL_DESCRIPTION</th>
625
                              <th style="width: 20%;">LABEL_LEVEL</th>
626
                              <th style="width: 20%;">LABEL_ACTIONS</th>
627
                           </tr>
885 geraldo 628
                        </thead>
629
                        <tbody id="rows"></tbody>
890 geraldo 630
                     </table>
865 geraldo 631
                  </div>
869 geraldo 632
                  <div class="col-xs-12 col-md-12">
890 geraldo 633
                     <div class="form-group">
634
                        <button type="submit" form="form" class="btn btn-primary">LABEL_SAVE</button>
635
                        <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
636
                     </div>
637
                  </div>
638
               </div>
865 geraldo 639
            </div>
640
         </div>
641
      </div>
642
   </div>
643
</section>
1 www 644
 
890 geraldo 645
<!---end form--->
1 www 646
 
890 geraldo 647
 
648
<!--start modal conduct-->
861 geraldo 649
<div  id="modal-conduct" class="modal" tabindex="-1" role="dialog">
650
   <div class="modal-dialog modal-lg" role="document">
651
      <form action="#" name="form-conduct" id="form-conduct">
862 geraldo 652
         <input type="hidden" name="conduct-id" id="conduct-id" value="" />
864 geraldo 653
         <input type="hidden" name="conduct-competencia" id="conduct-competencia" value="" />
861 geraldo 654
         <div class="modal-content">
655
            <div class="modal-header">
656
               <h4 class="modal-title">LABEL_ADD LABEL_CONDUCT</h4>
657
               <button type="button" class="close" data-dismiss="modal" aria-label="Close">
658
               <span aria-hidden="true">&times;</span>
659
               </button>
660
            </div>
661
            <div class="modal-body">
662
               <div class="form-group">
663
                  <label for="conduct-name">LABEL_DESCRIPTION</label>
864 geraldo 664
                  <input type="text" name="conduct-description" id="conduct-description" class="form-control" maxlength="50" value="" />
861 geraldo 665
               </div>
666
               <div class="form-group">
864 geraldo 667
                  <label for="conduct-value">LABEL_LEVEL</label>
668
                  <select class="form-control" id="conduct-level" name="conduct-level">
890 geraldo 669
                     <option value="0">LABEL_NA</option>
670
                     <option value="1">LABEL_LEVEL_ONE</option>
671
                     <option value="2">LABEL_LEVEL_TWO</option>
672
                     <option value="3">LABEL_LEVEL_THREE</option>
673
                     <option value="4">LABEL_LEVEL_FOUR</option>
861 geraldo 674
                  </select>
675
               </div>
676
            </div>
677
            <div class="modal-footer">
879 geraldo 678
               <button type="button" class="btn btn-primary btn-conduct-submit">LABEL_SAVE</button>
861 geraldo 679
               <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
680
            </div>
681
         </div>
682
      </form>
683
   </div>
684
</div>
890 geraldo 685
<!---end modal conduct --->
861 geraldo 686
 
890 geraldo 687
 
688
<!--start template--->
689
 
874 geraldo 690
<script id="behaviorTemplate" type="text/x-jsrender">
890 geraldo 691
   <tr>
692
       <td class="text-left">{{:description}}</td>
693
       <td>
694
          {{if level == '0'}} LABEL_NA {{/if}}
695
          {{if level == '1' }} LABEL_LEVEL_ONE {{/if}}
696
          {{if level == '2' }} LABEL_LEVEL_TWO {{/if}}
697
          {{if level == '3' }} LABEL_LEVEL_THREE {{/if}}
698
          {{if level == '4' }} LABEL_LEVEL_FOUR {{/if}}
699
       </td>
700
 
701
       <td>
702
           <button class="btn btn-default btn-edit-conduct" data-conduct="{{:id}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT</button>
703
           <button class="btn btn-default btn-delete-conduct" data-conduct="{{:id}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE</button>
704
       </td>
705
   </tr>
706
 
707
</script>
874 geraldo 708
 
890 geraldo 709
<!--end template--->