Proyectos de Subversion LeadersLinked - Backend

Rev

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