Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16918 | Rev 16929 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

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