Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 899 | Rev 901 | 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) {
893 geraldo 266
            if (behaviors.length == 0) {
891 geraldo 267
                $.fn.showError('Debe ingresar al menos una conducta deseable');
893 geraldo 268
            } else {
891 geraldo 269
                $.ajax({
893 geraldo 270
                    'dataType': 'json',
271
                    'accept': 'application/json',
272
                    'method': 'post',
273
                    'url': $('#form').attr('action'),
274
                    'data': {
275
                        'name': $('#name').val(),
276
                        'description': $('#description').val(),
277
                        'competency_type_id': $('#competency_type_id').val(),
278
                        'status': $('#status').val(),
279
                        'behaviors': JSON.stringify(behaviors)
280
                    }
281
                }).done(function(response) {
282
                    NProgress.start();
283
                    if (response['success']) {
284
                        $.fn.showSuccess(response['data']);
285
                        $('#row-form').hide();
286
                        $('#row-list').show();
287
                        gridTable.api().ajax.reload(null, false);
863 geraldo 288
                    } else {
893 geraldo 289
                        validator.resetForm();
290
                        if (jQuery.type(response['data']) == 'string') {
291
                            $.fn.showError(response['data']);
292
                        } else {
293
                            $.each(response['data'], function(fieldname, errors) {
294
                                $.fn.showFormErrorValidator('#form #' + fieldname, errors);
295
                            });
296
                        }
863 geraldo 297
                    }
893 geraldo 298
                }).fail(function(jqXHR, textStatus, errorThrown) {
299
                    $.fn.showError(textStatus);
300
                }).always(function() {
301
                    NProgress.done();
302
                });
891 geraldo 303
            }
28 efrain 304
            return false;
863 geraldo 305
        },
306
        invalidHandler: function(form, validator) {}
307
    });
308
    $('body').on('click', 'button.btn-add', function(e) {
309
        e.preventDefault();
310
        $('span[id="form-title"]').html('LABEL_ADD');
311
        $('#form').attr('action', '$routeAdd');
312
        $('#form #name').val('');
313
        $('#form #competency_type_id').val('').trigger('change');
314
        $('#form #status').bootstrapToggle('on');
894 geraldo 315
        behaviors=[];
863 geraldo 316
        CKEDITOR.instances.description.setData('');
317
        validator.resetForm();
866 geraldo 318
        $('#row-form').show();
873 geraldo 319
        $('#row-list').hide();
900 geraldo 320
        $("#rows").html('');
863 geraldo 321
        return false;
322
    });
323
    $('body').on('click', 'button.btn-edit', function(e) {
324
        e.preventDefault();
325
        NProgress.start();
326
        var action = $(this).data('href');
900 geraldo 327
        $("#rows").html('');
863 geraldo 328
        $.ajax({
329
            'dataType': 'json',
330
            'method': 'get',
331
            'url': action,
332
        }).done(function(response) {
333
            if (response['success']) {
334
                $('span[id="form-title"]').html('LABEL_EDIT');
335
                $('#form').attr('action', action);
336
                $('#form #name').val(response['data']['name']);
337
                $('#form #competency_type_id').val(response['data']['competency_type_id']).trigger('change');
338
                $('#form #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
339
                CKEDITOR.instances.description.setData(response['data']['description']);
894 geraldo 340
                behaviors=response['data']['behaviors'] || [];
863 geraldo 341
                validator.resetForm();
866 geraldo 342
                $('#row-form').show();
873 geraldo 343
                $('#row-list').hide();
863 geraldo 344
            } else {
345
                $.fn.showError(response['data']);
346
            }
347
        }).fail(function(jqXHR, textStatus, errorThrown) {
348
            $.fn.showError(textStatus);
349
        }).always(function() {
350
            NProgress.done();
28 efrain 351
        });
863 geraldo 352
        return false;
353
    });
354
    $('body').on('click', 'button.btn-refresh', function(e) {
355
        e.preventDefault();
356
        gridTable.api().ajax.reload(null, false);
357
        return false;
358
    });
359
    $('body').on('click', 'button.btn-import', function(e) {
360
        e.preventDefault();
361
        NProgress.start();
362
        $.ajax({
363
            'dataType': 'json',
364
            'method': 'post',
365
            'url': '$routeImport',
366
        }).done(function(response) {
367
            if (response['success']) {
368
                $.fn.showSuccess(response['data']);
369
                gridTable.api().ajax.reload(null, false);
370
            } else {
371
                $.fn.showError(response['data']);
372
            }
373
        }).fail(function(jqXHR, textStatus, errorThrown) {
374
            $.fn.showError(textStatus);
375
        }).always(function() {
376
            NProgress.done();
1 www 377
        });
863 geraldo 378
        return false;
379
    });
380
    $('body').on('click', 'button.btn-cancel', function(e) {
381
        e.preventDefault();
382
        $('#modal').modal('hide');
383
    });
384
    $('#form #competency_type_id').select2({
385
        theme: 'bootstrap4',
386
        width: '100%',
387
    });
388
    $('#form #status').bootstrapToggle({
389
        'on': 'LABEL_ACTIVE',
390
        'off': 'LABEL_INACTIVE',
391
        'width': '160px',
392
        'height': '40px'
393
    });
394
    CKEDITOR.replace('description');
395
    /**
862 geraldo 396
     * Clicked on add new conduct
397
     */
398
    $('body').on('click', 'button[id="btn-add-conduct"]', function(e) {
399
        e.preventDefault();
400
        $('#form-conduct #conduct-id').val('');
401
        $('#form-conduct #conduct-description').val('');
402
        $('#form-conduct #conduct-level').val('0');
403
        $('#modal-conduct h4[class="modal-title"]').html('LABEL_ADD LABEL_CONDUCT');
404
        $('#modal-conduct').modal('show');
1 www 405
    });
862 geraldo 406
    /**
407
     * Clicked on edit conduct
408
     */
409
    $('body').on('click', 'button.btn-edit-conduct', function(e) {
410
        e.preventDefault();
877 geraldo 411
        var id = $(this).data('conduct');
412
        behaviors.map((item) => {
413
            if (item.id == id) {
882 geraldo 414
                $('#form-conduct #conduct-id').val(item.id);
415
                $('#form-conduct #conduct-description').val(item.description);
416
                $('#form-conduct #conduct-level').val(item.level);
877 geraldo 417
                $('#modal-conduct h4[class="modal-title"]').html('LABEL_EDIT LABEL_CONDUCT');
418
                $('#modal-conduct').modal('show');
862 geraldo 419
                return;
420
            }
877 geraldo 421
        });
862 geraldo 422
    });
423
    /**
424
     * Clicked on remove conduct
425
     */
426
    $('body').on('click', 'button.btn-delete-conduct', function(e) {
427
        e.preventDefault();
888 geraldo 428
        var id = $(this).data('conduct');
862 geraldo 429
        bootbox.confirm({
430
            title: "LABEL_DELETE LABEL_CONDUCT",
431
            message: "LABEL_QUESTION_DELETE",
432
            buttons: {
433
                cancel: {
434
                    label: '<i class="fa fa-times"></i> LABEL_CANCEL'
435
                },
436
                confirm: {
437
                    label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
438
                }
439
            },
440
            callback: function(result) {
886 geraldo 441
                if (result) {
888 geraldo 442
                    removeBehavior(id);
886 geraldo 443
                }
862 geraldo 444
            }
445
        });
446
    });
863 geraldo 447
    /**
879 geraldo 448
     * Clicked cancel new/edit Form
863 geraldo 449
     */
879 geraldo 450
    $('button.btn-conduct-submit').click(function(e) {
893 geraldo 451
        if ($("#conduct-description").val() == "") {
879 geraldo 452
            $.fn.showError('Ingrese una descripción');
883 geraldo 453
            return;
893 geraldo 454
        } else {
455
            $("#conduct-id").val() == "" ?
881 geraldo 456
                addBehavior($("#conduct-description").val(), $("#conduct-level").val()) :
893 geraldo 457
                editBehavior($("#conduct-id").val(), $("#conduct-description").val(), $("#conduct-level").val())
458
            $('#modal-conduct').modal('hide');
459
            return;
863 geraldo 460
        }
862 geraldo 461
    });
873 geraldo 462
    /**
463
     * Clicked cancel new/edit Form
464
     */
465
    $('button.btn-edit-cancel').click(function(e) {
466
        e.preventDefault();
467
        $('#row-form').hide();
468
        $('#row-list').show();
469
    });
874 geraldo 470
    /**
471
     * Add Behavior to array
472
     */
877 geraldo 473
    const addBehavior = (description, level) => {
878 geraldo 474
        behaviors.push({
475
            'id': new Date().getTime(),
877 geraldo 476
            'description': description,
874 geraldo 477
            'level': level
878 geraldo 478
        });
874 geraldo 479
        renderData(behaviors);
480
    }
481
    /**
482
     * Edit item behavior
483
     */
877 geraldo 484
    const editBehavior = (id, description, level) => {
485
        behaviors.map((item) => {
486
            if (item.id == id) {
874 geraldo 487
                item.description = description;
488
                item.level = level
489
            }
490
        });
491
        renderData(behaviors);
492
    }
493
    /**
494
     * Remove behavior
495
     */
877 geraldo 496
    const removeBehavior = (id) => {
497
        behaviors = behaviors.filter((item) => item.id != id);
874 geraldo 498
        renderData(behaviors);
499
    }
877 geraldo 500
    /**
874 geraldo 501
     * Render Sections data
502
     */
503
    const renderData = (data) => $("#rows").html($("#behaviorTemplate").render(data));
863 geraldo 504
});
1 www 505
JS;
506
$this->inlineScript()->captureEnd();
507
?>
890 geraldo 508
 
1 www 509
<!-- Content Header (Page header) -->
510
<section class="content-header">
890 geraldo 511
   <div class="container-fluid">
512
      <div class="row mb-2">
513
         <div class="col-sm-12">
514
            <h1>LABEL_COMPETENCIES</h1>
515
         </div>
516
      </div>
517
   </div>
518
   <!-- /.container-fluid -->
1 www 519
</section>
873 geraldo 520
<section class="content" id="row-list">
890 geraldo 521
   <div class="container-fluid">
522
      <div class="row">
523
         <div class="col-12">
524
            <div class="card">
525
               <div class="card-body">
526
                  <table id="gridTable" class="table   table-hover">
527
                     <thead>
528
                        <tr>
529
                           <th>LABEL_TYPE</th>
530
                           <th>LABEL_NAME</th>
531
                           <th>LABEL_ACTIVE</th>
532
                           <th>LABEL_ACTIONS</th>
533
                        </tr>
534
                     </thead>
535
                     <tbody>
536
                     </tbody>
537
                  </table>
538
               </div>
539
               <div class="card-footer clearfix">
540
                  <div style="float:right;">
541
                     <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
542
                     <?php if($allowImport) : ?>
543
                     <button type="button" class="btn btn-primary btn-import"><i class="fa fa-upload"></i> LABEL_IMPORT </button>
544
                     <?php endif; ?>
545
                     <?php if($allowAdd) : ?>
546
                     <button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
547
                     <?php endif; ?>
548
                  </div>
549
               </div>
550
            </div>
551
         </div>
552
      </div>
553
   </div>
554
</section>
1 www 555
 
865 geraldo 556
<!-- The Form creation -->
890 geraldo 557
 
865 geraldo 558
<section class="content" id="row-form" style="display: none">
559
   <div class="container-fluid">
890 geraldo 560
   <div class="row">
561
   <div class="col-md-12 col-sm-12 col-12">
562
      <div class="panel">
563
         <div class="panel-body">
564
            <?php
565
               $form = $this->form;
566
               $form->setAttributes([
567
                   'method'    => 'post',
568
                   'name'      => 'form',
569
                   'id'        => 'form'
570
               ]);
571
 
572
               $form->prepare();
573
               echo $this->form()->openTag($form);
574
               ?>
575
            <div   class="row">
576
               <div class="col-md-4 col-sm-12 col-12">
577
                  <div class="from-group">
578
                     <?php
579
                        $element = $form->get('competency_type_id');
580
                        $element->setOptions(['label' => 'LABEL_TYPE']);
581
 
582
                        echo $this->formLabel($element);
583
                        echo $this->formSelect($element);
584
                        ?>
865 geraldo 585
                  </div>
890 geraldo 586
               </div>
587
               <div class="col-md-4 col-sm-12 col-12">
588
                  <div class="from-group">
589
                     <?php
590
                        $element = $form->get('name');
591
                        $element->setOptions(['label' => 'LABEL_NAME']);
592
                        $element->setAttributes(['class' => 'form-control']);
593
 
594
                        echo $this->formLabel($element);
595
                        echo $this->formText($element);
596
                        ?>
865 geraldo 597
                  </div>
890 geraldo 598
               </div>
599
               <div class="col-md-4 col-sm-12 col-12">
600
                  <div class="from-group">
601
                     <label>LABEL_STATUS</label>
602
                     <br />
603
                     <?php
604
                        $element = $form->get('status');
605
                        $element->setOptions(['label' => 'LABEL_STATUS']);
606
                        // echo $this->formLabel($element);
607
                        echo $this->formCheckbox($element);
608
                        ?>
865 geraldo 609
                  </div>
890 geraldo 610
               </div>
611
               <div class="col-md col-sm-12 col-12">
612
                  <div class="form-group">
613
                     <?php
614
                        $element = $form->get('description');
615
                        $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
616
                        $element->setAttributes(['class' => 'form-control']);
617
 
618
                        echo $this->formLabel($element);
619
                        echo $this->formTextArea($element);
620
                        ?>
865 geraldo 621
                  </div>
890 geraldo 622
               </div>
865 geraldo 623
               <?php echo $this->form()->closeTag($form); ?>
890 geraldo 624
               <div class="col-xs-12 col-md-12 text-right">
625
                  <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>
626
               </div>
627
               <div class="col-xs-12 col-md-12">
628
                  <br/>
885 geraldo 629
                  <div class="table-responsive">
890 geraldo 630
                     <table class="table table-bordered">
885 geraldo 631
                        <thead>
890 geraldo 632
                           <tr>
633
                              <th style="width: 40%;">LABEL_DESCRIPTION</th>
634
                              <th style="width: 20%;">LABEL_LEVEL</th>
635
                              <th style="width: 20%;">LABEL_ACTIONS</th>
636
                           </tr>
885 geraldo 637
                        </thead>
638
                        <tbody id="rows"></tbody>
890 geraldo 639
                     </table>
865 geraldo 640
                  </div>
869 geraldo 641
                  <div class="col-xs-12 col-md-12">
890 geraldo 642
                     <div class="form-group">
643
                        <button type="submit" form="form" class="btn btn-primary">LABEL_SAVE</button>
644
                        <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
645
                     </div>
646
                  </div>
647
               </div>
865 geraldo 648
            </div>
649
         </div>
650
      </div>
651
   </div>
652
</section>
1 www 653
 
890 geraldo 654
<!---end form--->
1 www 655
 
890 geraldo 656
 
657
<!--start modal conduct-->
861 geraldo 658
<div  id="modal-conduct" class="modal" tabindex="-1" role="dialog">
659
   <div class="modal-dialog modal-lg" role="document">
660
      <form action="#" name="form-conduct" id="form-conduct">
862 geraldo 661
         <input type="hidden" name="conduct-id" id="conduct-id" value="" />
864 geraldo 662
         <input type="hidden" name="conduct-competencia" id="conduct-competencia" value="" />
861 geraldo 663
         <div class="modal-content">
664
            <div class="modal-header">
665
               <h4 class="modal-title">LABEL_ADD LABEL_CONDUCT</h4>
666
               <button type="button" class="close" data-dismiss="modal" aria-label="Close">
667
               <span aria-hidden="true">&times;</span>
668
               </button>
669
            </div>
670
            <div class="modal-body">
671
               <div class="form-group">
672
                  <label for="conduct-name">LABEL_DESCRIPTION</label>
899 geraldo 673
                  <input type="text" name="conduct-description" id="conduct-description" class="form-control" maxlength="250" value="" />
861 geraldo 674
               </div>
675
               <div class="form-group">
864 geraldo 676
                  <label for="conduct-value">LABEL_LEVEL</label>
677
                  <select class="form-control" id="conduct-level" name="conduct-level">
890 geraldo 678
                     <option value="0">LABEL_NA</option>
679
                     <option value="1">LABEL_LEVEL_ONE</option>
680
                     <option value="2">LABEL_LEVEL_TWO</option>
681
                     <option value="3">LABEL_LEVEL_THREE</option>
682
                     <option value="4">LABEL_LEVEL_FOUR</option>
861 geraldo 683
                  </select>
684
               </div>
685
            </div>
686
            <div class="modal-footer">
879 geraldo 687
               <button type="button" class="btn btn-primary btn-conduct-submit">LABEL_SAVE</button>
861 geraldo 688
               <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
689
            </div>
690
         </div>
691
      </form>
692
   </div>
693
</div>
890 geraldo 694
<!---end modal conduct --->
861 geraldo 695
 
890 geraldo 696
 
697
<!--start template--->
698
 
874 geraldo 699
<script id="behaviorTemplate" type="text/x-jsrender">
890 geraldo 700
   <tr>
701
       <td class="text-left">{{:description}}</td>
702
       <td>
703
          {{if level == '0'}} LABEL_NA {{/if}}
704
          {{if level == '1' }} LABEL_LEVEL_ONE {{/if}}
705
          {{if level == '2' }} LABEL_LEVEL_TWO {{/if}}
706
          {{if level == '3' }} LABEL_LEVEL_THREE {{/if}}
707
          {{if level == '4' }} LABEL_LEVEL_FOUR {{/if}}
708
       </td>
709
 
710
       <td>
711
           <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>
712
           <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>
713
       </td>
714
   </tr>
715
 
716
</script>
874 geraldo 717
 
890 geraldo 718
<!--end template--->