Proyectos de Subversion LeadersLinked - Backend

Rev

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