Proyectos de Subversion LeadersLinked - Backend

Rev

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