Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev Autor Línea Nro. Línea
977 geraldo 1
<?php
2
$acl = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser = $this->currentUserHelper();
4
 
5
$roleName = $currentUser->getUserTypeId();
6
 
985 geraldo 7
$routeAdd = $this->url('performance-evaluation/forms/add');
8
$routeDatatable = $this->url('performance-evaluation/forms');
977 geraldo 9
$routeDashboard = $this->url('dashboard');
10
 
985 geraldo 11
$allowAdd = $acl->isAllowed($roleName, 'performance-evaluation/forms/add') ? 1 : 0;
12
$allowEdit = $acl->isAllowed($roleName, 'performance-evaluation/forms/edit') ? 1 : 0;
13
$allowDelete = $acl->isAllowed($roleName, 'performance-evaluation/forms/delete') ? 1 : 0;
977 geraldo 14
 
15
 
16
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
17
 
18
 
19
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
20
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
21
 
22
 
23
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
24
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
25
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
26
 
27
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
28
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
29
 
30
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
31
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
32
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
33
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
34
 
35
 
36
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.min.css'));
37
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css'));
38
 
39
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.full.min.js'));
40
 
41
$this->inlineScript()->appendFile($this->basePath('plugins/moment/moment-with-locales.min.js'));
42
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css'));
43
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js'));
44
 
45
 
46
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
47
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
48
 
49
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
50
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
51
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-input-number/input-number-format.jquery.js'));
52
 
53
// bootbox Alert //
54
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.min.js'));
55
 
56
// JsRender //
57
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.min.js'));
58
 
1050 geraldo 59
 
1053 geraldo 60
$status_active = \LeadersLinked\Model\CompanyPerformanceEvaluationForm::STATUS_ACTIVE;
61
$status_inactive = \LeadersLinked\Model\CompanyPerformanceEvaluationForm::STATUS_INACTIVE;
1050 geraldo 62
 
977 geraldo 63
$this->inlineScript()->captureStart();
64
echo <<<JS
1027 geraldo 65
   jQuery(document).ready(function($) {
977 geraldo 66
    var allowEdit = $allowEdit;
67
    var allowDelete = $allowDelete;
1007 geraldo 68
    var sections = [];
977 geraldo 69
    /**
70
     * Get rows and set data table
71
     */
72
    var tableForm = $('#gridTable').dataTable({
73
        'processing': true,
74
        'serverSide': true,
75
        'searching': true,
76
        'order': [
77
            [0, 'asc']
78
        ],
79
        'ordering': true,
80
        'ordenable': true,
81
        'responsive': true,
82
        'select': false,
83
        'paging': true,
84
        'pagingType': 'simple_numbers',
85
        'ajax': {
86
            'url': '$routeDatatable',
87
            'type': 'get',
88
            'beforeSend': function(request) {
89
                NProgress.start();
90
            },
91
            'dataFilter': function(response) {
92
                var response = jQuery.parseJSON(response);
93
                var json = {};
94
                json.recordsTotal = 0;
95
                json.recordsFiltered = 0;
96
                json.data = [];
97
                if (response.success) {
98
                    json.recordsTotal = response.data.total;
99
                    json.recordsFiltered = response.data.total;
100
                    json.data = response.data.items;
101
                } else {
102
                    $.fn.showError(response.data)
103
                }
104
                return JSON.stringify(json);
105
            }
106
        },
107
        'language': {
108
            'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
109
            'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
110
            'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
111
            'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
112
            'sInfo': 'LABEL_DATATABLE_SINFO',
113
            'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
114
            'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
115
            'sInfoPostFix': '',
116
            'sSearch': 'LABEL_DATATABLE_SSEARCH',
117
            'sUrl': '',
118
            'sInfoThousands': ',',
119
            'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
120
            'oPaginate': {
121
                'sFirst': 'LABEL_DATATABLE_SFIRST',
122
                'sLast': 'LABEL_DATATABLE_SLAST',
123
                'sNext': 'LABEL_DATATABLE_SNEXT',
124
                'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
125
            },
126
            'oAria': {
127
                'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
128
                'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
129
            },
130
        },
131
        'drawCallback': function(settings) {
132
            NProgress.done();
133
            $('button.btn-delete').confirmation({
134
                rootSelector: 'button.btn-delete',
135
                title: 'LABEL_ARE_YOU_SURE',
136
                singleton: true,
137
                btnOkLabel: 'LABEL_YES',
138
                btnCancelLabel: 'LABEL_NO',
139
                onConfirm: function(value) {
140
                    action = $(this).data('href');
141
                    NProgress.start();
142
                    $.ajax({
143
                        'dataType': 'json',
144
                        'accept': 'application/json',
145
                        'method': 'post',
146
                        'url': action,
147
                    }).done(function(response) {
148
                        if (response['success']) {
149
                            $.fn.showSuccess(response['data']);
150
                            tableForm.fnDraw();
151
                        } else {
152
                            $.fn.showError(response['data']);
153
                        }
154
                    }).fail(function(jqXHR, textStatus, errorThrown) {
155
                        $.fn.showError(textStatus);
156
                    }).always(function() {
157
                        NProgress.done();
158
                    });
159
                },
160
            });
161
        },
162
        'aoColumns': [{
163
                'mDataProp': 'name'
164
            },
165
            {
166
                'mDataProp': 'language'
167
            },
168
            {
169
                'mDataProp': 'status'
170
            },
171
            {
172
                'mDataProp': 'actions'
173
            },
174
        ],
175
        'columnDefs': [{
176
                'targets': 0,
177
                'className': 'text-vertical-middle',
178
            },
179
            {
180
                'targets': 1,
181
                'className': 'text-vertical-middle',
182
            },
183
            {
184
                'targets': -2,
185
                'orderable': false,
186
                'className': 'text-center',
187
                'render': function(data, type, row) {
188
                    checked = data == 'a' ? ' checked="checked" ' : '';
189
                    return '<div class="checkbox checkbox-success">' +
190
                        '<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
191
                        '<label ></label></div>';
192
                }
193
            },
194
            {
195
                'targets': -1,
196
                'orderable': false,
197
                'render': function(data, type, row) {
198
                    s = '';
199
                    if (allowEdit) {
200
                        s = s + '<button class="btn btn-primary btn-edit-form" data-href="' + data['link_edit'] + '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button>&nbsp;';
201
                    }
202
                    if (allowDelete) {
203
                        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;';
204
                    }
205
                    return s;
206
                }
207
            }
208
        ],
209
    });
210
    /**
211
     * Clicked on edit form
212
     */
213
    $('body').on('click', 'button.btn-edit-form', function(e) {
214
        e.preventDefault();
215
        form_id = $(this).data('id')
216
        var action = $(this).data('href');
217
        $.ajax({
218
            'dataType': 'json',
219
            'accept': 'application/json',
220
            'method': 'get',
221
            'url': action,
222
        }).done(function(response) {
223
            if (response['success']) {
1047 geraldo 224
                $("#rows").html('');
225
                sections = [];
977 geraldo 226
                $('#form-main').attr('action', action);
227
                $('#form-main #form-id').val(response['data']['id']),
228
                $('#form-main #form-name').val(response['data']['name']),
1054 geraldo 229
        $('#form-main #job_description_id').val(response['data']['job_description_id']);
230
        $('#form-main #form-status').val(response['data']['status']);
231
        sections=response['data']['content'] || [];
232
                renderData(sections);
1005 geraldo 233
                $('#row-lists').hide();
234
                $('#row-form').show();
977 geraldo 235
            } else {
236
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
237
            }
238
        }).fail(function(jqXHR, textStatus, errorThrown) {
239
            $.fn.showError(textStatus);
240
        });
241
    });
242
    /**
997 geraldo 243
     * Clicked add new section
977 geraldo 244
     */
1004 geraldo 245
    $('#btn-add-section').click(function(e) {
1027 geraldo 246
        $('#form-section #id-section').val('');
1016 geraldo 247
        $('#form-section #title-section').val('');
1012 geraldo 248
        $('#form-section #text-section').val('');
249
        $('#form-section #type-section').val($('#form-section #type-section option:first').val());
1005 geraldo 250
        $('#modal-section h4[class="modal-title"]').html('LABEL_ADD LABEL_SECTION');
993 geraldo 251
        $('#modal-section').modal('show');
977 geraldo 252
    });
253
    /**
997 geraldo 254
     * Clicked edit section
977 geraldo 255
     */
256
    /**
1009 geraldo 257
     * Clicked save section
258
     */
259
    $('#btn-save-section').click(function(e) {
1027 geraldo 260
        if ($('#title-section').val() == '') {
1010 geraldo 261
            $.fn.showError('Ingrese un nombre');
1009 geraldo 262
            return;
1027 geraldo 263
        } else {
264
            if ($('#id-section').val() == "") {
1009 geraldo 265
                addSection(
1016 geraldo 266
                    $('#title-section').val(),
1012 geraldo 267
                    $('#text-section').val(),
268
                    $('#type-section').val(),
1027 geraldo 269
                )
270
            } else {
1009 geraldo 271
                editSection(
1027 geraldo 272
                    $('#id-section').val(),
1016 geraldo 273
                    $('#title-section').val(),
1012 geraldo 274
                    $('#text-section').val(),
275
                    $('#type-section').val()
1027 geraldo 276
                )
1009 geraldo 277
            }
1011 geraldo 278
            $('#modal-section').modal('hide');
1010 geraldo 279
            return;
1009 geraldo 280
        }
281
    });
282
    /**
997 geraldo 283
     * Clicked remove section
977 geraldo 284
     */
1026 geraldo 285
    $('body').on('click', 'button.btn-delete-section', function(e) {
286
        e.preventDefault();
1027 geraldo 287
        var id_section = $(this).data('section');
977 geraldo 288
        bootbox.confirm({
993 geraldo 289
            title: "LABEL_DELETE LABEL_SECTION",
1031 geraldo 290
            message: "LABEL_QUESTION_DELETE",
977 geraldo 291
            buttons: {
292
                cancel: {
293
                    label: '<i class="fa fa-times"></i> LABEL_CANCEL'
294
                },
295
                confirm: {
296
                    label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
297
                }
298
            },
299
            callback: function(result) {
300
                if (result) {
1027 geraldo 301
                    removeSection(id_section);
977 geraldo 302
                }
303
            }
304
        });
305
    });
1026 geraldo 306
    $('body').on('click', 'button.btn-edit-section', function(e) {
307
        e.preventDefault();
1027 geraldo 308
        var id = $(this).data('section');
1029 geraldo 309
        console.log(id);
1027 geraldo 310
        sections.map((item) => {
1030 geraldo 311
            if (item.id_section == id) {
312
                $('#form-section #id-section').val(item.id_section);
1027 geraldo 313
                $('#form-section #title-section').val(item.title);
314
                $('#form-section #text-text').val(item.text);
1032 geraldo 315
                $('#form-section #type-section').val(item.type);
1027 geraldo 316
                $('#modal-section').modal('show');
317
                return;
318
            }
319
        });
320
    });
1046 geraldo 321
     /**
322
     * Clicked remove option
323
     */
324
    $('body').on('click', 'button.btn-delete-option', function(e) {
325
        e.preventDefault();
326
        var id_section = $(this).data('section');
327
        var id_option = $(this).data('option');
328
        bootbox.confirm({
329
            title: "LABEL_DELETE LABEL_OPTION",
330
            message: "LABEL_QUESTION_DELETE",
331
            buttons: {
332
                cancel: {
333
                    label: '<i class="fa fa-times"></i> LABEL_CANCEL'
334
                },
335
                confirm: {
336
                    label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
337
                }
338
            },
339
            callback: function(result) {
340
                if (result) {
341
                    removeOption(id_section, id_option);
342
                }
343
            }
344
        });
345
    });
977 geraldo 346
    /**
1027 geraldo 347
     * Clicked add new Option
348
     */
349
    $('body').on('click', 'button.btn-add-option', function(e) {
350
        e.preventDefault();
351
        var id = $(this).data('section');
352
        $('#section-option').val(id);
1047 geraldo 353
        $('#text-option').val('');
1034 geraldo 354
        $('#modal-option h4[class="modal-title"]').html('LABEL_EDIT LABEL_OPTION');
1027 geraldo 355
        $('#modal-option').modal('show');
356
        return;
357
    });
358
    /**
359
     * Clicked add new Option
360
     */
1037 geraldo 361
    $('#btn-save-option').click(function(e) {
1047 geraldo 362
        if ($('#text-option').val() == '') {
1037 geraldo 363
            $.fn.showError('Ingrese un texto');
364
            return;
365
        } else {
366
            if ($('#id-option').val() == "") {
1027 geraldo 367
            addOption(
368
                $('#section-option').val(),
1047 geraldo 369
                $('#text-option').val(),
1027 geraldo 370
            )
371
        } else {
372
            editOption(
373
                $('#section-option').val(),
374
                $('#id-option').val(),
1047 geraldo 375
                $('#text-option').val(),
1027 geraldo 376
            )
377
        }
1037 geraldo 378
            $('#modal-option').modal('hide');
379
            return;
380
        }
1027 geraldo 381
    });
382
    /**
383
     * Clicked edit Option
384
     */
385
    $('body').on('click', 'button.btn-edit-option', function(e) {
386
        e.preventDefault();
387
        var id_section = $(this).data('section');
388
        var id_option = $(this).data('option');
389
        sections.map((item) => {
390
            if (item.id_section == id_section) {
391
                item.options.map((opt) => {
392
                    if (opt.id_option == id_option) {
393
                        $('#id-option').val(opt.id_option);
1042 geraldo 394
                        $('#section-option').val(opt.id_section);
1047 geraldo 395
                        $("#text-option").val(opt.title);
1034 geraldo 396
                        $('#modal-option h4[class="modal-title"]').html('LABEL_EDIT LABEL_OPTION');
1027 geraldo 397
                        $('#modal-option').modal('show');
398
                        return;
399
                    }
400
                });
401
            }
402
        });
403
    });
404
    /**
977 geraldo 405
     * Clicked new Form
406
     */
407
    $('button.btn-add-form').click(function(e) {
408
        $('#form-main').attr('action', '$routeAdd');
409
        $('#form-main #form-id').val('0');
410
        $('#form-main #form-name').val('');
1053 geraldo 411
        $('#form-main #job_description_id').val('');
412
        $('#form-main #form-status').val('$status_active');
1049 geraldo 413
        $("#rows").html('');
414
        sections = [];
1005 geraldo 415
        $('#row-lists').hide();
416
        $('#row-form').show();
977 geraldo 417
        $('#form-main #form-name').focus();
418
    });
419
    /**
420
     * Clicked cancel new/edit Form
421
     */
422
    $('button.btn-edit-cancel').click(function(e) {
423
        e.preventDefault();
1005 geraldo 424
        $('#row-form').hide();
425
        $('#row-lists').show();
977 geraldo 426
    });
427
    /**
428
     * Clicked save and close new/edit Form
429
     */
430
    $('button.btn-form-save-close').click(function(e) {
1054 geraldo 431
 
977 geraldo 432
        e.preventDefault();
1054 geraldo 433
 
434
        if($('#form-name').val()==''){
435
            $.fn.showError('Ingrese un nombre');
436
        }
437
        else if($('#form-status').val()==''){
438
            $.fn.showError('Seleccione un status');
439
        }
440
        else if($('#job_description_id').val()==''){
441
            $.fn.showError('Seleccione una descripción de cargo');
442
        }
443
        else if(sections.length == 0){
444
            $.fn.showError('Debe ingresar al menos una sección');
445
        }else{
446
 
447
            var formId = parseInt($('#form-main #form-id').val());
448
 
449
                var data = {
450
                    'id': formId,
451
                    'name': $('#form-main #form-name').val(),
452
                    'job_description_id': $('#form-main #job_description_id').val(),
453
                    'status': $('#form-main #form-status').val(),
454
                    'content': JSON.stringify(objFormGenerator.sections)
455
                }
456
                $.ajax({
457
                    'dataType': 'json',
458
                    'method': 'post',
459
                    'url': $('#form-main').attr('action'),
460
                    'data': data,
461
                }).done(function(response) {
462
                    if (response['success']) {
463
                        $.fn.showSuccess(response['data']);
464
                            $('#row-form').hide();
465
                            $('#row-lists').show();
466
                        /*---------- Reset Form -------- */
467
                        $('#form-main')[0].reset();
468
                        /*--------Reset Sections ----------*/
469
                        sections = [];
470
                        tableForm.fnDraw();
471
                    } else {
472
                        $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
473
                    }
474
 
475
        }
476
 
977 geraldo 477
    });
478
    /**
479
     * Remove Html Tags
480
     */
1027 geraldo 481
    const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
977 geraldo 482
    /**
483
     * Render Sections data
484
     */
1027 geraldo 485
    const renderData = (data) => {
1011 geraldo 486
        console.log(data);
1013 geraldo 487
        $("#rows").html($("#sectionTemplate").render(data));
1011 geraldo 488
    }
977 geraldo 489
    /**
1007 geraldo 490
     * Add Section to array
977 geraldo 491
     */
1014 geraldo 492
    const addSection = (title, text, type) => {
1007 geraldo 493
        sections.push({
1012 geraldo 494
            'id_section': new Date().getTime(),
1007 geraldo 495
            'title': title,
496
            'type': type,
1009 geraldo 497
            'text': text,
1007 geraldo 498
            'options': []
499
        });
500
        renderData(sections);
501
    }
977 geraldo 502
    /**
1007 geraldo 503
     * Edit item behavior
504
     */
1033 geraldo 505
    const editSection = (id, title, text, type) => {
1007 geraldo 506
        sections.map((item) => {
1012 geraldo 507
            if (item.id_section == id) {
1009 geraldo 508
                item.title = title;
509
                item.type = type;
510
                item.text = text;
1007 geraldo 511
            }
512
        });
513
        renderData(sections);
514
    }
515
    /**
516
     * Remove behavior
517
     */
518
    const removeSection = (id) => {
1012 geraldo 519
        sections = sections.filter((item) => item.id_section != id);
1007 geraldo 520
        renderData(sections);
521
    }
1027 geraldo 522
    /**
1012 geraldo 523
     * Add Option to array
524
     */
1038 geraldo 525
    const addOption = (id_section, title) => {
1012 geraldo 526
        sections.map((item) => {
1038 geraldo 527
            if (item.id_section == id_section) {
1012 geraldo 528
                item.options.push({
1042 geraldo 529
                     'id_section': id_section,
1012 geraldo 530
                    'id_option': new Date().getTime(),
531
                    'title': title,
532
                });
533
            }
534
        });
535
        renderData(sections);
536
    }
537
    /**
1027 geraldo 538
     * Edit item Option
539
     */
1043 geraldo 540
    const editOption = (id_section, id, title ) => {
1012 geraldo 541
        sections.map((item) => {
1038 geraldo 542
            if (item.id_section == id_section) {
1027 geraldo 543
                item.options.map((opt) => {
544
                    if (opt.id_option == id) {
1012 geraldo 545
                        opt.title = title
546
                    }
547
                });
548
            }
549
        });
550
        renderData(sections);
551
    }
552
    /**
553
     * Remove Option
554
     */
1038 geraldo 555
    const removeOption = (id_section, id) => {
1012 geraldo 556
        sections.map((item) => {
1038 geraldo 557
            if (item.id_section == id_section) {
1012 geraldo 558
                item.options = item.options.filter((opt) => opt.id_option != id) || []
559
            }
560
        });
561
        renderData(sections);
562
    }
1007 geraldo 563
    /**
977 geraldo 564
     * Clicked refresh button
565
     */
566
    $('button.btn-refresh').click(function(e) {
567
        tableForm.fnDraw();
568
    });
569
});
570
JS;
571
$this->inlineScript()->captureEnd();
572
?>
573
<!-- Content Header (Page header) -->
574
<section class="content-header">
1027 geraldo 575
   <div class="container-fluid">
576
      <div class="row mb-2">
577
         <div class="col-sm-12">
578
            <h1>LABEL_PERFORMANCE_EVALUATION</h1>
579
         </div>
580
      </div>
581
   </div>
582
   <!-- /.container-fluid -->
977 geraldo 583
</section>
584
<section class="content">
1054 geraldo 585
   <div class="container-fluid" id="">
1027 geraldo 586
      <div class="row">
587
         <div class="col-12">
588
            <div class="card">
589
               <div class="card-body">
590
                  <table id="gridTable" class="table   table-hover">
591
                     <thead>
592
                        <tr>
593
                           <th>LABEL_NAME</th>
594
                           <th>LABEL_LANGUAGE</th>
595
                           <th>LABEL_ACTIVE</th>
596
                           <th>LABEL_ACTIONS</th>
597
                        </tr>
598
                     </thead>
599
                     <tbody></tbody>
600
                  </table>
601
               </div>
602
               <div class="card-footer clearfix">
603
                  <div style="float:right;">
604
                     <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
605
                     <?php if ($allowAdd) : ?>
606
                     <button type="button" class="btn btn-primary btn-add-form"><i class="fa fa-plus"></i> LABEL_ADD </button>
607
                     <?php endif; ?>
608
                  </div>
609
               </div>
977 geraldo 610
            </div>
1027 geraldo 611
         </div>
612
      </div>
613
   </div>
614
   <!-- Create/Edit Form -->
1051 geraldo 615
   <div class="row" id="row-form" style="display: none; padding: 16px;">
1027 geraldo 616
      <div class="col-xs-12 col-md-12">
617
         <form action="#" name="form-main" id="form-main">
618
            <input type="hidden" name="form-id" id="form-id" value="0" />
619
            <input type="hidden" name="form-continue" id="form-continue" value="0" />
620
            <div class="form-group">
621
               <label for="form-name">LABEL_FIRST_NAME</label>
622
               <input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
1012 geraldo 623
            </div>
1050 geraldo 624
            <div class="form-group">
625
                    <label for="job_description_id">LABEL_JOB_DESCRIPTION</label>
626
                    <select name="job_description_id" id="job_description_id" class="form-control">
1051 geraldo 627
                        <option value="">LABEL_SELECT</option>
628
                        <?php foreach ($jobsDescription as $rs): ?>
629
                            <option value="<?php echo $rs->id;?>"><?php echo $rs->name;?></option>
630
                        <?php endforeach; ?>
1050 geraldo 631
                    </select>
632
                </div>
633
            <div class="form-group">
634
                    <label for="form-status">LABEL_STATUS</label>
635
                    <select name="form-status" id="form-status" class="form-control">
636
                        <option value="<?php echo $status_inactive; ?>">LABEL_INACTIVE</option>
637
                        <option value="<?php echo $status_active; ?>">LABEL_ACTIVE</option>
638
                    </select>
639
                </div>
1027 geraldo 640
            <div class="row">
641
               <div class="col-xs-12 col-md-12 text-right">
642
                  <button type="button" class="btn btn-primary" id="btn-add-section" data-toggle="tooltip" title="LABEL_ADD LABEL_SECTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD LABEL_SECTION</button>
643
               </div>
644
            </div>
645
            <br />
646
            <div class="row">
647
               <div class="col-xs-12 col-md-12">
648
                  <div class="panel-group" id="rows"></div>
649
               </div>
650
            </div>
651
            <div class="form-group">
652
               <button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE & LABEL_CLOSE</button>
653
               <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
654
            </div>
655
         </form>
656
      </div>
657
   </div>
658
   <!-- Create/Edit Form-->
659
   <!-- section Modal -->
660
   <div  id="modal-section" class="modal" tabindex="-1" role="dialog">
661
      <div class="modal-dialog modal-lg" role="document">
662
         <form action="#" name="form-section" id="form-section">
663
            <input type="hidden" name="id-section" id="id-section" />
664
            <div class="modal-content">
665
               <div class="modal-header">
666
                  <h4 class="modal-title">LABEL_ADD LABEL_SECTION</h4>
667
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
668
                  <span aria-hidden="true">&times;</span>
669
                  </button>
670
               </div>
671
               <div class="modal-body">
672
                  <div class="form-group">
673
                     <label for="title-section">LABEL_FIRST_NAME</label>
674
                     <input type="text" name="title-section" id="title-section" class="form-control" maxlength="50" value="" />
675
                  </div>
676
                  <div class="form-group">
677
                     <label for="text-section">LABEL_TEXT</label>
678
                     <textarea  name="text-section" id="text-section" rows="5" class="form-control"></textarea>
679
                  </div>
680
                  <div class="form-group">
681
                     <label for="type-section">LABEL_TYPE</label>
682
                     <select name="type-section" id="type-section" class="form-control">
683
                        <option value="simple">Simple</option>
684
                        <option value="multiple">Multiple</option>
685
                     </select>
686
                  </div>
687
               </div>
688
               <div class="modal-footer">
689
                  <button type="button" id="btn-save-section" class="btn btn-primary">LABEL_SAVE</button>
690
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
691
               </div>
692
            </div>
693
         </form>
694
      </div>
695
   </div>
696
   <!-- End Modal section -->
697
   <!-- Modal Options -->
698
   <div  id="modal-option" class="modal" tabindex="-1" role="dialog">
699
      <div class="modal-dialog modal-lg" role="document">
700
         <form action="#" name="form-option" id="form-option">
701
            <input type="hidden" name="section-option" id="section-option" value="" />
702
            <input type="hidden" name="id-option" id="id-option" value="" />
703
            <div class="modal-content">
704
               <div class="modal-header">
705
                  <h4 class="modal-title">LABEL_OPTION</h4>
706
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
707
                  <span aria-hidden="true">&times;</span>
708
                  </button>
709
               </div>
710
               <div class="modal-body">
711
                  <div class="form-group">
1047 geraldo 712
                     <label for="text-option">LABEL_TEXT</label>
1027 geraldo 713
                     <!--  ckeditor -->
1047 geraldo 714
                     <textarea  name="text-option" id="text-option" rows="5" class="form-control"></textarea>
1027 geraldo 715
                  </div>
716
               </div>
717
               <div class="modal-footer">
718
                  <button type="button" class="btn btn-primary" id="btn-save-option">LABEL_SAVE</button>
719
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
720
               </div>
721
            </div>
722
         </form>
723
      </div>
724
   </div>
1050 geraldo 725
 
1027 geraldo 726
   <!-- End Modal Options -->
727
   <!---Template Sections --->
728
   <script id="sectionTemplate" type="text/x-jsrender">
1045 geraldo 729
   <div class="panel panel-default" id="panel-{{:id_section}}">
730
   <div class="panel-heading">
731
      <h4 class="panel-title">
732
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:id_section}}" href="#collapse-{{:id_section}}">
733
         <span class="section-name{{:id_section}}">
734
         {{:name}}
735
         </span>
736
         </a>
737
      </h4>
738
   </div>
739
   <div id="collapse-{{:id_section}}" class="panel-collapse in collapse show">
740
      <div class="panel-body">
741
         <div class="table-responsive">
742
            <table class="table table-bordered">
743
               <thead>
744
                  <tr>
745
                     <th style="width: 10%;">LABEL_ELEMENT</th>
746
                     <th style="width: 30%;">LABEL_TEXT</th>
747
                     <th style="width: 10%;">LABEL_TYPE</th>
748
                     <th style="width: 50%;">LABEL_ACTIONS</th>
749
                  </tr>
750
               </thead>
751
               <tbody>
752
                  <tr class="tr-section">
753
                     <td class="text-left">LABEL_SECTION</td>
754
                     <td class="text-left">{{:title}}</td>
755
                     <td>
756
                        {{if type == 'simple'}} Simple {{/if}}
757
                        {{if type == 'multiple'}} Multiple {{/if}}
758
                     </td>
759
                     <td>
760
                        <button  class="btn btn-default btn-edit-section" data-section="{{:id_section}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_SECTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_SECTION </button>
761
                        <button  class="btn btn-default btn-delete-section" data-section="{{:id_section}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_SECTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_SECTION </button>
762
                        {{if type == 'multiple'}}
763
                        <button type="button" class="btn btn-default btn-add-option" data-section="{{:id_section}}" data-toggle="tooltip"  data-original-title="LABEL_ADD  LABEL_OPTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD  LABEL_OPTION </button>
764
                        {{/if}}
765
                     </td>
766
                  </tr>
767
                  {{for options}}
768
                  <tr >
769
                     <td class="text-left">--LABEL_OPTION</td>
770
                     <td class="text-left">
771
                        {{:title}}
772
                     </td>
773
                     <td></td>
774
                     <td>
775
                        <button class="btn btn-default btn-edit-option" data-section="{{:id_section}}" data-option="{{:id_option}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_OPTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_OPTION</button>
776
                        <button class="btn btn-default btn-delete-option" data-section="{{:id_section}}" data-option="{{:id_option}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_OPTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_OPTION</button>
777
                     </td>
778
                  </tr>
779
                  {{/for}}
780
               </tbody>
781
            </table>
782
         </div>
1027 geraldo 783
      </div>
1045 geraldo 784
   </div>
785
</div>
1027 geraldo 786
   </script>
787
   <!-- End Template Sections-->
977 geraldo 788
</section>