Proyectos de Subversion LeadersLinked - Backend

Rev

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