Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15394 | Rev 16822 | 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
 
18
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
19
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
20
 
15443 efrain 21
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-maxlenght/bootstrap-maxlength.min.js'));
1 www 22
 
23
 
24
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
25
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
26
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
27
 
28
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
29
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
30
 
31
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
32
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
33
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
34
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
35
 
36
 
37
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
38
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
39
 
40
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
41
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
42
 
43
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.js'));
44
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/i18n/es.js'));
45
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.css'));
46
 
47
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.css'));
48
 
874 geraldo 49
// JsRender //
50
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.min.js'));
1 www 51
 
883 geraldo 52
// bootbox Alert //
53
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.min.js'));
1 www 54
 
883 geraldo 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();
161
            $('button.btn-delete').confirmation({
162
                rootSelector: 'button.btn-delete',
163
                title: 'LABEL_ARE_YOU_SURE',
164
                singleton: true,
165
                btnOkLabel: 'LABEL_YES',
166
                btnCancelLabel: 'LABEL_NO',
167
                onConfirm: function(value) {
168
                    action = $(this).data('href');
169
                    NProgress.start();
170
                    $.ajax({
171
                        'dataType': 'json',
172
                        'accept': 'application/json',
173
                        'method': 'post',
174
                        'url': action,
175
                    }).done(function(response) {
176
                        if (response['success']) {
177
                            $.fn.showSuccess(response['data']);
178
                            gridTable.api().ajax.reload(null, false);
179
                        } else {
180
                            $.fn.showError(response['data']);
181
                        }
182
                    }).fail(function(jqXHR, textStatus, errorThrown) {
183
                        $.fn.showError(textStatus);
184
                    }).always(function() {
185
                        NProgress.done();
186
                    });
187
                }
188
            });
189
        },
863 geraldo 190
        'aoColumns': [{
191
                'mDataProp': 'type'
192
            },
193
            {
194
                'mDataProp': 'name'
195
            },
196
            {
197
                'mDataProp': 'status'
198
            },
199
            {
200
                'mDataProp': 'actions'
201
            },
202
        ],
203
        'columnDefs': [{
204
                'targets': 0,
205
                'className': 'text-vertical-middle',
206
            },
207
            {
208
                'targets': 1,
209
                'className': 'text-vertical-middle',
210
            },
211
            {
212
                'targets': -2,
213
                'orderable': false,
214
                'className': 'text-center',
215
                'render': function(data, type, row) {
216
                    checked = data == 'a' ? ' checked="checked" ' : '';
217
                    return '<div class="checkbox checkbox-success">' +
218
                        '<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
219
                        '<label ></label></div>';
1 www 220
                }
221
            },
863 geraldo 222
            {
223
                'targets': -1,
224
                'orderable': false,
225
                'render': function(data, type, row) {
226
                    s = '';
227
                    if (allowEdit) {
228
                        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 229
                    }
863 geraldo 230
                    if (allowDelete) {
4132 stevensc 231
                        s = s + '<button class="btn btn-danger btn-delete" data-href="' + data['link_delete'] + '" data-toggle="delete-confirmation" data-popout="true" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button>&nbsp;';
1 www 232
                    }
863 geraldo 233
                    return s;
1 www 234
                }
863 geraldo 235
            }
236
        ],
237
    });
14989 efrain 238
 
863 geraldo 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': {
15443 efrain 253
                maxlength: 512,
863 geraldo 254
                required: true,
1 www 255
            },
863 geraldo 256
            'status': {
257
                required: false,
1 www 258
            },
14989 efrain 259
 
863 geraldo 260
        },
261
        submitHandler: function(form) {
14989 efrain 262
            if ($('input[type="hidden"].behavior_id').length == 0) {
263
                $.fn.showError('ERROR_NOT_OBSERVABLE_BEHAVIOR');
15394 efrain 264
                return false;
265
            }
891 geraldo 266
                $.ajax({
893 geraldo 267
                    'dataType': 'json',
268
                    'accept': 'application/json',
269
                    'method': 'post',
270
                    'url': $('#form').attr('action'),
14989 efrain 271
                    'data': $('#form').serialize(),
893 geraldo 272
                }).done(function(response) {
273
                    NProgress.start();
274
                    if (response['success']) {
275
                        $.fn.showSuccess(response['data']);
276
                        $('#row-form').hide();
277
                        $('#row-list').show();
278
                        gridTable.api().ajax.reload(null, false);
863 geraldo 279
                    } else {
893 geraldo 280
                        validator.resetForm();
281
                        if (jQuery.type(response['data']) == 'string') {
282
                            $.fn.showError(response['data']);
283
                        } else {
284
                            $.each(response['data'], function(fieldname, errors) {
285
                                $.fn.showFormErrorValidator('#form #' + fieldname, errors);
286
                            });
287
                        }
863 geraldo 288
                    }
893 geraldo 289
                }).fail(function(jqXHR, textStatus, errorThrown) {
290
                    $.fn.showError(textStatus);
291
                }).always(function() {
292
                    NProgress.done();
293
                });
15394 efrain 294
 
295
 
863 geraldo 296
        },
297
        invalidHandler: function(form, validator) {}
298
    });
14989 efrain 299
 
863 geraldo 300
    $('body').on('click', 'button.btn-add', function(e) {
301
        e.preventDefault();
14989 efrain 302
        NProgress.start();
303
 
304
 
305
        $.ajax({
306
            'dataType': 'json',
307
            'method': 'get',
308
            'url': '$routeAdd',
309
        }).done(function(response) {
310
            if (response['success']) {
311
 
312
                $('#table-behaviors tbody').empty();
313
 
314
                $('#select-behavior').children().not(':first').remove();
315
                $.each(response['data']['behaviors'], function(index, element) {
316
                    $('#select-behavior').append($('<option>', {
317
                        value: element.id,
318
                        text: element.description
319
                    }));
320
                });
321
 
322
 
323
                $('span[id="form-title"]').html('LABEL_ADD');
324
                $('#form').attr('action', '$routeAdd');
325
                $('#form #name').val('');
326
                $('#form #competency_type_id').val('').trigger('change');
327
                $('#form #status').bootstrapToggle('on');
15443 efrain 328
                 $('#form #description').val('');
14989 efrain 329
 
330
                validator.resetForm();
331
 
332
                $('#row-form').show();
333
                $('#row-list').hide();
334
            } else {
335
                $.fn.showError(response['data']);
336
            }
337
        }).fail(function(jqXHR, textStatus, errorThrown) {
338
            $.fn.showError(textStatus);
339
        }).always(function() {
340
            NProgress.done();
341
        });
342
 
343
 
344
 
345
 
863 geraldo 346
        return false;
347
    });
14989 efrain 348
 
863 geraldo 349
    $('body').on('click', 'button.btn-edit', function(e) {
350
        e.preventDefault();
4134 stevensc 351
        $("button.btn-delete").confirmation('hide');
863 geraldo 352
        NProgress.start();
353
        var action = $(this).data('href');
354
        $.ajax({
355
            'dataType': 'json',
356
            'method': 'get',
357
            'url': action,
358
        }).done(function(response) {
14289 kerby 359
            console.log(response)
863 geraldo 360
            if (response['success']) {
361
                $('span[id="form-title"]').html('LABEL_EDIT');
362
                $('#form').attr('action', action);
363
                $('#form #name').val(response['data']['name']);
364
                $('#form #competency_type_id').val(response['data']['competency_type_id']).trigger('change');
365
                $('#form #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
15443 efrain 366
                $('#form #description').val(response['data']['description']);
14989 efrain 367
 
368
 
369
                $('input[type="hidden"].behavior').remove();
370
                $('#select-behavior').children().not(':first').remove();
371
 
372
 
373
                $('#table-behaviors tbody').empty();
374
 
375
                $.each(response['data']['behaviors'], function(index, element) {
376
                    $('#select-behavior').append($('<option>', {
377
                        value: element.id,
378
                        text: element.description
379
                    }));
380
 
381
                    if(element.checked ) {
382
                        let data = {
383
                            id : element.id,
384
                            description : element.description,
385
                        };
386
 
387
                        $('#table-behaviors tbody').append(
388
                            $('#trBehaviorTemplate').render( data )
389
                        );
390
 
391
 
392
                    }
393
                 });
394
 
395
 
396
 
397
 
863 geraldo 398
                validator.resetForm();
866 geraldo 399
                $('#row-form').show();
873 geraldo 400
                $('#row-list').hide();
863 geraldo 401
            } else {
402
                $.fn.showError(response['data']);
403
            }
404
        }).fail(function(jqXHR, textStatus, errorThrown) {
405
            $.fn.showError(textStatus);
406
        }).always(function() {
407
            NProgress.done();
28 efrain 408
        });
863 geraldo 409
        return false;
410
    });
14989 efrain 411
 
863 geraldo 412
    $('body').on('click', 'button.btn-refresh', function(e) {
413
        e.preventDefault();
414
        gridTable.api().ajax.reload(null, false);
415
        return false;
416
    });
14989 efrain 417
 
863 geraldo 418
    $('body').on('click', 'button.btn-import', function(e) {
419
        e.preventDefault();
420
        NProgress.start();
421
        $.ajax({
422
            'dataType': 'json',
423
            'method': 'post',
424
            'url': '$routeImport',
425
        }).done(function(response) {
426
            if (response['success']) {
427
                $.fn.showSuccess(response['data']);
428
                gridTable.api().ajax.reload(null, false);
429
            } else {
430
                $.fn.showError(response['data']);
431
            }
432
        }).fail(function(jqXHR, textStatus, errorThrown) {
433
            $.fn.showError(textStatus);
434
        }).always(function() {
435
            NProgress.done();
1 www 436
        });
863 geraldo 437
        return false;
438
    });
14989 efrain 439
 
863 geraldo 440
    $('body').on('click', 'button.btn-cancel', function(e) {
441
        e.preventDefault();
14989 efrain 442
        $('#row-form').hide();
443
        $('#row-list').show();
863 geraldo 444
    });
14989 efrain 445
 
863 geraldo 446
    $('#form #competency_type_id').select2({
447
        theme: 'bootstrap4',
448
        width: '100%',
449
    });
1226 geraldo 450
 
14989 efrain 451
    $('#select-behavior').select2({
1226 geraldo 452
        theme: 'bootstrap4',
453
        width: '100%',
454
    });
455
 
863 geraldo 456
    $('#form #status').bootstrapToggle({
457
        'on': 'LABEL_ACTIVE',
458
        'off': 'LABEL_INACTIVE',
459
        'width': '160px',
460
        'height': '40px'
461
    });
15443 efrain 462
 
463
    $('#form #description').maxlength({
464
        alwaysShow: true,
465
        validate: true
3842 stevensc 466
    });
14989 efrain 467
 
468
 
15443 efrain 469
 
14989 efrain 470
    $('body').on('click', 'button.btn-remove-behavior', function(e) {
862 geraldo 471
        e.preventDefault();
14989 efrain 472
 
473
        var key = '#tr_behavior_id_' + $(this).data('id');
474
        var element = $(key);
475
        if(element) {
476
            $(element).remove();
477
        }
478
 
479
        return false;
480
 
481
 
482
 
483
 
484
 
485
        /*
862 geraldo 486
        bootbox.confirm({
487
            title: "LABEL_DELETE LABEL_CONDUCT",
488
            message: "LABEL_QUESTION_DELETE",
489
            buttons: {
490
                cancel: {
491
                    label: '<i class="fa fa-times"></i> LABEL_CANCEL'
492
                },
493
                confirm: {
494
                    label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
495
                }
496
            },
497
            callback: function(result) {
886 geraldo 498
                if (result) {
888 geraldo 499
                    removeBehavior(id);
886 geraldo 500
                }
862 geraldo 501
            }
14989 efrain 502
        });*/
862 geraldo 503
    });
14989 efrain 504
 
505
    $('#btn-select-behavior').click(function(e) {
506
        e.preventDefault();
507
 
508
        var id  = $('#select-behavior option:selected').val();
15036 stevensc 509
 
14989 efrain 510
        if(!id) {
511
            return false;
863 geraldo 512
        }
14989 efrain 513
 
514
        var description = $('#select-behavior option:selected').text();
515
        var key         = '#tr_behavior_id_' + id ;
516
 
517
        console.log("key = "  + key);
518
        var element     = $(key);
519
 
520
 
521
        console.log(element);
522
        if(element.length > 0) {
523
 
524
            $.fn.showError( 'ERROR_BEHAVIOR_WAS_PREVIOUSLY_ADDED');
525
            return false;
526
        }
527
 
528
        let data = {
529
            id : id,
530
            description : description,
531
        };
532
 
533
        $('#table-behaviors tbody').append(
534
            $('#trBehaviorTemplate').render( data )
535
        );
536
 
537
        return false;
538
 
539
 
540
 
862 geraldo 541
    });
14989 efrain 542
 
543
 
544
 
873 geraldo 545
    $('button.btn-edit-cancel').click(function(e) {
546
        e.preventDefault();
547
        $('#row-form').hide();
548
        $('#row-list').show();
549
    });
14989 efrain 550
 
551
 
552
 
553
 
863 geraldo 554
});
1115 geraldo 555
 
1 www 556
JS;
557
$this->inlineScript()->captureEnd();
558
?>
3896 stevensc 559
 
1 www 560
<!-- Content Header (Page header) -->
561
<section class="content-header">
3896 stevensc 562
    <div class="container-fluid">
563
        <div class="row mb-2">
564
            <div class="col-sm-12">
565
                <h1>LABEL_COMPETENCIES</h1>
566
            </div>
567
        </div>
568
    </div>
569
    <!-- /.container-fluid -->
1 www 570
</section>
873 geraldo 571
<section class="content" id="row-list">
3896 stevensc 572
    <div class="container-fluid">
573
        <div class="row">
574
            <div class="col-12">
575
                <div class="card">
576
                    <div class="card-body">
577
                        <table id="gridTable" class="table   table-hover">
578
                            <thead>
579
                                <tr>
580
                                    <th>LABEL_TYPE</th>
581
                                    <th>LABEL_NAME</th>
582
                                    <th>LABEL_ACTIVE</th>
583
                                    <th>LABEL_ACTIONS</th>
584
                                </tr>
585
                            </thead>
586
                            <tbody>
587
                            </tbody>
588
                        </table>
589
                    </div>
590
                    <div class="card-footer clearfix">
591
                        <div style="float:right;">
592
                            <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
593
                            <?php if ($allowImport) : ?>
594
                                <button type="button" class="btn btn-primary btn-import"><i class="fa fa-upload"></i> LABEL_IMPORT </button>
595
                            <?php endif; ?>
596
                            <?php if ($allowAdd) : ?>
597
                                <button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
598
                            <?php endif; ?>
599
                        </div>
600
                    </div>
601
                </div>
890 geraldo 602
            </div>
3896 stevensc 603
        </div>
604
    </div>
890 geraldo 605
</section>
14989 efrain 606
 
865 geraldo 607
<!-- The Form creation -->
608
<section class="content" id="row-form" style="display: none">
3896 stevensc 609
    <div class="container-fluid">
610
        <div class="row">
611
            <div class="col-md-12 col-sm-12 col-12">
612
                <div class="panel">
613
                    <div class="panel-body">
1110 geraldo 614
                        <?php
3896 stevensc 615
                        $form = $this->form;
616
                        $form->setAttributes([
617
                            'method'    => 'post',
618
                            'name'      => 'form',
619
                            'id'        => 'form'
620
                        ]);
621
 
622
                        $form->prepare();
623
                        echo $this->form()->openTag($form);
624
                        ?>
1111 geraldo 625
                        <div class="row">
3896 stevensc 626
                            <div class="col-md-4 col-sm-12 col-12">
627
                                <div class="from-group">
628
                                    <?php
629
                                    $element = $form->get('competency_type_id');
630
                                    $element->setOptions(['label' => 'LABEL_TYPE']);
631
 
632
                                    echo $this->formLabel($element);
633
                                    echo $this->formSelect($element);
634
                                    ?>
635
                                </div>
636
                            </div>
637
                            <div class="col-md-4 col-sm-12 col-12">
638
                                <div class="from-group">
639
                                    <?php
640
                                    $element = $form->get('name');
641
                                    $element->setOptions(['label' => 'LABEL_NAME']);
642
                                    $element->setAttributes(['class' => 'form-control']);
643
 
644
                                    echo $this->formLabel($element);
645
                                    echo $this->formText($element);
646
                                    ?>
647
                                </div>
648
                            </div>
649
                            <div class="col-md-4 col-sm-12 col-12">
650
                                <div class="from-group">
651
                                    <label>LABEL_STATUS</label>
652
                                    <br />
653
                                    <?php
654
                                    $element = $form->get('status');
655
                                    $element->setOptions(['label' => 'LABEL_STATUS']);
656
                                    // echo $this->formLabel($element);
657
                                    echo $this->formCheckbox($element);
658
                                    ?>
659
                                </div>
660
                            </div>
661
                            <div class="col-md-12 col-sm-12 col-12">
662
                                <div class="form-group">
663
                                    <?php
664
                                    $element = $form->get('description');
665
                                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
666
                                    $element->setAttributes(['class' => 'form-control']);
667
 
668
                                    echo $this->formLabel($element);
669
                                    echo $this->formTextArea($element);
670
                                    ?>
671
                                </div>
672
                            </div>
14989 efrain 673
 
3896 stevensc 674
                            <div class="col-md-12 col-sm-12 col-12">
675
                                <div class="form-group">
676
                                    <div class="row">
14989 efrain 677
                                        <div class="col-md-8 col-sm-8 col-xs-12">
678
                                            <select name="select-behavior" id="select-behavior" >
15036 stevensc 679
                                           		<option value="">LABEL_SELECT</option>
3896 stevensc 680
                                            </select>
681
                                        </div>
682
                                        <div class="col-md-4 col-sm-4 col-xs-12">
14989 efrain 683
                                            <button type="button" class="btn btn-primary" id="btn-select-behavior" data-toggle="tooltip" title="LABEL_ADD LABEL_BEHAVIOR">LABEL_ADD LABEL_BEHAVIOR</button>
3896 stevensc 684
                                        </div>
685
                                    </div>
686
                                </div>
687
                            </div>
1111 geraldo 688
                        </div>
3896 stevensc 689
                        <div class="col-xs-12 col-md-12">
690
                            <br />
691
                            <div class="table-responsive">
14989 efrain 692
                                <table id="table-behaviors" class="table table-bordered">
3896 stevensc 693
                                    <thead>
694
                                        <tr>
695
                                            <th style="width: 60%;">LABEL_DESCRIPTION</th>
696
                                            <th style="width: 20%;">LABEL_ACTIONS</th>
697
                                        </tr>
698
                                    </thead>
14989 efrain 699
                                    <tbody >
700
                                    </tbody>
3896 stevensc 701
                                </table>
702
                            </div>
14989 efrain 703
                            <div class="col-xs-12 col-md-12 text-right">
704
 
3896 stevensc 705
                                    <button type="submit" form="form" class="btn btn-primary">LABEL_SAVE</button>
706
                                    <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
14989 efrain 707
 
3896 stevensc 708
                            </div>
709
                        </div>
14989 efrain 710
                         <?php echo $this->form()->closeTag($form); ?>
3896 stevensc 711
                    </div>
712
                </div>
865 geraldo 713
            </div>
3896 stevensc 714
        </div>
865 geraldo 715
</section>
14989 efrain 716
 
717
<script id="trBehaviorTemplate" type="text/x-jsrender">
718
    <tr id="tr_behavior_id_{{:id}}">
719
 
720
       <td class="text-left">
721
         <input type="hidden" class="behavior_id" name="behavior_id[]" value="{{:id}}" />
722
         {{:description}}
723
       </td>
890 geraldo 724
       <td>
14989 efrain 725
           <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 726
       </td>
727
   </tr>
728
</script>