Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 876 | Rev 878 | 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
    /**
431
     * Validate rules form conduct
432
     */
433
    var validatorFormConduct = $("#form-conduct").validate({
434
        ignore: [],
435
        errorClass: 'help-block',
436
        errorElement: 'span',
437
        rules: {
438
            'conduct-description': {
439
                required: false,
440
            },
441
            'conduct-level': {
442
                required: true,
443
            },
444
        },
445
        highlight: function(element) {
446
            $(element).closest('.form-group').addClass('has-error');
447
        },
448
        unhighlight: function(element) {
449
            $(element).closest('.form-group').removeClass('has-error');
450
        },
451
        errorPlacement: function(error, element) {
452
            if (element.attr("data-error-container")) {
453
                error.appendTo(element.attr("data-error-container"));
454
            } else {
455
                error.insertAfter(element);
456
            }
457
        },
458
        invalidHandler: function(form, validator) {
459
            if (!validator.numberOfInvalids())
460
                return;
461
            $('html, body').animate({
462
                scrollTop: $(validator.errorList[0].element).offset().top - 100
463
            }, 1000);
464
        },
465
        submitHandler: function(form) {
466
            var id = $('#form-conduct #conduct-id').val();
467
            if (id) {} else {}
468
            $('#modal-conduct').modal('hide');
469
            return false;
470
        }
862 geraldo 471
    });
873 geraldo 472
    /**
473
     * Clicked cancel new/edit Form
474
     */
475
    $('button.btn-edit-cancel').click(function(e) {
476
        e.preventDefault();
477
        $('#row-form').hide();
478
        $('#row-list').show();
479
    });
874 geraldo 480
    /**
481
     * Add Behavior to array
482
     */
877 geraldo 483
    const addBehavior = (description, level) => {
484
        var d = new Date();
874 geraldo 485
        behaviors.push(
877 geraldo 486
            'id': d.getTime(),
487
            'description': description,
874 geraldo 488
            'level': level
489
        );
490
        renderData(behaviors);
491
    }
492
    /**
493
     * Edit item behavior
494
     */
877 geraldo 495
    const editBehavior = (id, description, level) => {
496
        behaviors.map((item) => {
497
            if (item.id == id) {
874 geraldo 498
                item.description = description;
499
                item.level = level
500
            }
501
        });
502
        renderData(behaviors);
503
    }
504
    /**
505
     * Remove behavior
506
     */
877 geraldo 507
    const removeBehavior = (id) => {
508
        behaviors = behaviors.filter((item) => item.id != id);
874 geraldo 509
        renderData(behaviors);
510
    }
877 geraldo 511
    /**
874 geraldo 512
     * Render Sections data
513
     */
514
    const renderData = (data) => $("#rows").html($("#behaviorTemplate").render(data));
863 geraldo 515
});
1 www 516
JS;
517
$this->inlineScript()->captureEnd();
518
?>
519
 
520
 
521
 
522
 
523
 
524
<!-- Content Header (Page header) -->
525
<section class="content-header">
526
	<div class="container-fluid">
527
    	<div class="row mb-2">
528
        	<div class="col-sm-12">
529
            	<h1>LABEL_COMPETENCIES</h1>
530
			</div>
531
		</div>
532
	</div><!-- /.container-fluid -->
533
</section>
534
 
873 geraldo 535
<section class="content" id="row-list">
1 www 536
	<div class="container-fluid">
537
    	<div class="row">
538
        	<div class="col-12">
539
				<div class="card">
540
					<div class="card-body">
20 steven 541
        	    		<table id="gridTable" class="table   table-hover">
1 www 542
                      		<thead>
543
        						<tr>
544
        							<th>LABEL_TYPE</th>
545
                                	<th>LABEL_NAME</th>
546
                                  	<th>LABEL_ACTIVE</th>
547
                                  	<th>LABEL_ACTIONS</th>
548
                                </tr>
549
                       		</thead>
550
                         	<tbody>
551
                         	</tbody>
552
                    	</table>
553
                   	</div>
554
                   	<div class="card-footer clearfix">
555
                   		<div style="float:right;">
556
							<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
28 efrain 557
							<?php if($allowImport) : ?>
558
							<button type="button" class="btn btn-primary btn-import"><i class="fa fa-upload"></i> LABEL_IMPORT </button>
559
							<?php endif; ?>
1 www 560
							<?php if($allowAdd) : ?>
561
							<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
562
							<?php endif; ?>
563
						</div>
564
                 	</div>
565
          		</div>
566
           	</div>
567
        </div>
568
 	</div>
569
</section>
570
 
865 geraldo 571
<!-- The Form creation -->
572
<section class="content" id="row-form" style="display: none">
573
   <div class="container-fluid">
574
      <div class="row">
867 geraldo 575
      <div class="col-md-12 col-sm-12 col-12">
865 geraldo 576
         <div class="panel">
870 geraldo 577
 
1 www 578
            <!-- Modal body -->
865 geraldo 579
            <div class="panel-body">
580
               <?php
581
                  $form = $this->form;
582
                  $form->setAttributes([
583
                      'method'    => 'post',
584
                      'name'      => 'form',
585
                      'id'        => 'form'
586
                  ]);
587
 
588
                  $form->prepare();
589
                  echo $this->form()->openTag($form);
590
                  ?>
871 geraldo 591
               <div   class="row">
865 geraldo 592
                  <div class="col-md-4 col-sm-12 col-12">
871 geraldo 593
                     <div class="from-group">
865 geraldo 594
                        <?php
595
                           $element = $form->get('competency_type_id');
596
                           $element->setOptions(['label' => 'LABEL_TYPE']);
597
 
598
                           echo $this->formLabel($element);
599
                           echo $this->formSelect($element);
600
                           ?>
601
                     </div>
602
                  </div>
868 geraldo 603
                  <div class="col-md-4 col-sm-12 col-12">
871 geraldo 604
                     <div class="from-group">
865 geraldo 605
                        <?php
606
                           $element = $form->get('name');
607
                           $element->setOptions(['label' => 'LABEL_NAME']);
608
                           $element->setAttributes(['class' => 'form-control']);
609
 
610
                           echo $this->formLabel($element);
611
                           echo $this->formText($element);
612
                           ?>
613
                     </div>
614
                  </div>
868 geraldo 615
                  <div class="col-md-4 col-sm-12 col-12">
871 geraldo 616
                     <div class="from-group">
865 geraldo 617
                        <label>LABEL_STATUS</label>
618
                        <br />
619
                        <?php
620
                           $element = $form->get('status');
621
                           $element->setOptions(['label' => 'LABEL_STATUS']);
622
                           // echo $this->formLabel($element);
623
                           echo $this->formCheckbox($element);
624
                           ?>
625
                     </div>
626
                  </div>
872 geraldo 627
 
868 geraldo 628
 
865 geraldo 629
                  <div class="col-md col-sm-12 col-12">
630
                     <div class="form-group">
631
                        <?php
632
                           $element = $form->get('description');
633
                           $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
634
                           $element->setAttributes(['class' => 'form-control']);
635
 
636
                           echo $this->formLabel($element);
637
                           echo $this->formTextArea($element);
638
                           ?>
639
                     </div>
640
                  </div>
868 geraldo 641
 
865 geraldo 642
               <?php echo $this->form()->closeTag($form); ?>
868 geraldo 643
 
644
 
865 geraldo 645
                  <div class="col-xs-12 col-md-12 text-right">
646
                     <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>
647
                  </div>
868 geraldo 648
 
649
 
865 geraldo 650
                  <div class="col-xs-12 col-md-12">
651
                     <div class="panel-group" id="rows"></div>
652
                  </div>
869 geraldo 653
                  <div class="col-xs-12 col-md-12">
654
                  <div class="form-group">
865 geraldo 655
               <button type="submit" form="form" class="btn btn-primary">LABEL_SAVE</button>
873 geraldo 656
               <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
865 geraldo 657
            </div>
869 geraldo 658
                </div>
659
            </div>
660
            <!-- Modal footer -->
661
 
865 geraldo 662
         </div>
663
      </div>
867 geraldo 664
                </div>
865 geraldo 665
   </div>
666
</section>
1 www 667
 
668
 
861 geraldo 669
<div  id="modal-conduct" class="modal" tabindex="-1" role="dialog">
670
   <div class="modal-dialog modal-lg" role="document">
671
      <form action="#" name="form-conduct" id="form-conduct">
862 geraldo 672
         <input type="hidden" name="conduct-id" id="conduct-id" value="" />
864 geraldo 673
         <input type="hidden" name="conduct-competencia" id="conduct-competencia" value="" />
861 geraldo 674
         <div class="modal-content">
675
            <div class="modal-header">
676
               <h4 class="modal-title">LABEL_ADD LABEL_CONDUCT</h4>
677
               <button type="button" class="close" data-dismiss="modal" aria-label="Close">
678
               <span aria-hidden="true">&times;</span>
679
               </button>
680
            </div>
681
            <div class="modal-body">
682
               <div class="form-group">
683
                  <label for="conduct-name">LABEL_DESCRIPTION</label>
864 geraldo 684
                  <input type="text" name="conduct-description" id="conduct-description" class="form-control" maxlength="50" value="" />
861 geraldo 685
               </div>
686
               <div class="form-group">
864 geraldo 687
                  <label for="conduct-value">LABEL_LEVEL</label>
688
                  <select class="form-control" id="conduct-level" name="conduct-level">
861 geraldo 689
                     <option value="0">No aplica</option>
864 geraldo 690
                     <option value="1">Uno</option>
861 geraldo 691
                     <option value="2">Dos</option>
692
                     <option value="3">Tres</option>
693
                     <option value="4">Cuatro</option>
694
                  </select>
695
               </div>
696
            </div>
697
            <div class="modal-footer">
698
               <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
699
               <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
700
            </div>
701
         </div>
702
      </form>
703
   </div>
704
</div>
705
 
874 geraldo 706
<script id="behaviorTemplate" type="text/x-jsrender">
707
 <div class="table-responsive">
708
                    <table class="table table-bordered">
709
                        <thead>
710
                            <tr>
711
 
712
                                <th style="width: 60%;">LABEL_DESCRIPTION</th>
713
                                <th style="width: 20%;">LABEL_LEVEL</th>
714
                                <th style="width: 20%;">LABEL_ACTIONS</th>
715
                            </tr>
716
                        </thead>
717
                        <tbody>
718
                            <tr >
719
                                <td class="text-left">{{:description}}</td>
720
                                <td>{{:level}}</td>
721
 
722
                                <td>
723
                                    <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>
724
                                    <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>
725
 
726
                                </td>
727
                            </tr>
728
 
729
                        </tbody>
730
                    </table>
731
                </div>
732
    </script>