Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 1044 | Rev 1046 | 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
 
59
$this->inlineScript()->captureStart();
60
echo <<<JS
1006 geraldo 61
 
1027 geraldo 62
   jQuery(document).ready(function($) {
977 geraldo 63
    var allowEdit = $allowEdit;
64
    var allowDelete = $allowDelete;
1007 geraldo 65
    var sections = [];
977 geraldo 66
    /**
67
     * Get rows and set data table
68
     */
69
    var tableForm = $('#gridTable').dataTable({
70
        'processing': true,
71
        'serverSide': true,
72
        'searching': true,
73
        'order': [
74
            [0, 'asc']
75
        ],
76
        'ordering': true,
77
        'ordenable': true,
78
        'responsive': true,
79
        'select': false,
80
        'paging': true,
81
        'pagingType': 'simple_numbers',
82
        'ajax': {
83
            'url': '$routeDatatable',
84
            'type': 'get',
85
            'beforeSend': function(request) {
86
                NProgress.start();
87
            },
88
            'dataFilter': function(response) {
89
                var response = jQuery.parseJSON(response);
90
                var json = {};
91
                json.recordsTotal = 0;
92
                json.recordsFiltered = 0;
93
                json.data = [];
94
                if (response.success) {
95
                    json.recordsTotal = response.data.total;
96
                    json.recordsFiltered = response.data.total;
97
                    json.data = response.data.items;
98
                } else {
99
                    $.fn.showError(response.data)
100
                }
101
                return JSON.stringify(json);
102
            }
103
        },
104
        'language': {
105
            'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
106
            'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
107
            'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
108
            'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
109
            'sInfo': 'LABEL_DATATABLE_SINFO',
110
            'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
111
            'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
112
            'sInfoPostFix': '',
113
            'sSearch': 'LABEL_DATATABLE_SSEARCH',
114
            'sUrl': '',
115
            'sInfoThousands': ',',
116
            'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
117
            'oPaginate': {
118
                'sFirst': 'LABEL_DATATABLE_SFIRST',
119
                'sLast': 'LABEL_DATATABLE_SLAST',
120
                'sNext': 'LABEL_DATATABLE_SNEXT',
121
                'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
122
            },
123
            'oAria': {
124
                'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
125
                'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
126
            },
127
        },
128
        'drawCallback': function(settings) {
129
            NProgress.done();
130
            $('button.btn-delete').confirmation({
131
                rootSelector: 'button.btn-delete',
132
                title: 'LABEL_ARE_YOU_SURE',
133
                singleton: true,
134
                btnOkLabel: 'LABEL_YES',
135
                btnCancelLabel: 'LABEL_NO',
136
                onConfirm: function(value) {
137
                    action = $(this).data('href');
138
                    NProgress.start();
139
                    $.ajax({
140
                        'dataType': 'json',
141
                        'accept': 'application/json',
142
                        'method': 'post',
143
                        'url': action,
144
                    }).done(function(response) {
145
                        if (response['success']) {
146
                            $.fn.showSuccess(response['data']);
147
                            tableForm.fnDraw();
148
                        } else {
149
                            $.fn.showError(response['data']);
150
                        }
151
                    }).fail(function(jqXHR, textStatus, errorThrown) {
152
                        $.fn.showError(textStatus);
153
                    }).always(function() {
154
                        NProgress.done();
155
                    });
156
                },
157
            });
158
        },
159
        'aoColumns': [{
160
                'mDataProp': 'name'
161
            },
162
            {
163
                'mDataProp': 'language'
164
            },
165
            {
166
                'mDataProp': 'status'
167
            },
168
            {
169
                'mDataProp': 'actions'
170
            },
171
        ],
172
        'columnDefs': [{
173
                'targets': 0,
174
                'className': 'text-vertical-middle',
175
            },
176
            {
177
                'targets': 1,
178
                'className': 'text-vertical-middle',
179
            },
180
            {
181
                'targets': -2,
182
                'orderable': false,
183
                'className': 'text-center',
184
                'render': function(data, type, row) {
185
                    checked = data == 'a' ? ' checked="checked" ' : '';
186
                    return '<div class="checkbox checkbox-success">' +
187
                        '<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
188
                        '<label ></label></div>';
189
                }
190
            },
191
            {
192
                'targets': -1,
193
                'orderable': false,
194
                'render': function(data, type, row) {
195
                    s = '';
196
                    if (allowEdit) {
197
                        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;';
198
                    }
199
                    if (allowDelete) {
200
                        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;';
201
                    }
202
                    return s;
203
                }
204
            }
205
        ],
206
    });
207
    /**
208
     * Clicked on edit form
209
     */
210
    $('body').on('click', 'button.btn-edit-form', function(e) {
211
        e.preventDefault();
212
        form_id = $(this).data('id')
213
        var action = $(this).data('href');
214
        $.ajax({
215
            'dataType': 'json',
216
            'accept': 'application/json',
217
            'method': 'get',
218
            'url': action,
219
        }).done(function(response) {
220
            if (response['success']) {
221
                $('#form-main').attr('action', action);
222
                $('#form-main #form-id').val(response['data']['id']),
1027 geraldo 223
                    $('#form-main #form-continue').val('0');
977 geraldo 224
                $('#form-main #form-name').val(response['data']['name']),
1027 geraldo 225
                    /*----------Set Ckeditor ------------*/
226
                    CKEDITOR.instances['form-description'].setData(response['data']['description']);
977 geraldo 227
                CKEDITOR.instances['form-text'].setData(response['data']['text']);
228
                $('#form-main #form-language').val(response['data']['language']),
1027 geraldo 229
                    $('#form-main #form-status').val(response['data']['status']);
977 geraldo 230
                /*-------------Render Sections -------*/
1006 geraldo 231
                renderSectionData();
1005 geraldo 232
                $('#row-lists').hide();
233
                $('#row-form').show();
977 geraldo 234
                $('#form-main #form-name').focus();
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
    });
977 geraldo 321
    /**
1027 geraldo 322
     * Clicked add new Option
323
     */
324
    $('body').on('click', 'button.btn-add-option', function(e) {
325
        e.preventDefault();
326
        var id = $(this).data('section');
327
        $('#section-option').val(id);
1034 geraldo 328
        $('#modal-option h4[class="modal-title"]').html('LABEL_EDIT LABEL_OPTION');
1027 geraldo 329
        $('#modal-option').modal('show');
330
        return;
331
    });
332
    /**
333
     * Clicked add new Option
334
     */
1037 geraldo 335
    $('#btn-save-option').click(function(e) {
336
        if ($('#title-option').val() == '') {
337
            $.fn.showError('Ingrese un texto');
338
            return;
339
        } else {
340
            if ($('#id-option').val() == "") {
1027 geraldo 341
            addOption(
342
                $('#section-option').val(),
343
                $('#title-option').val(),
344
            )
345
        } else {
346
            editOption(
347
                $('#section-option').val(),
348
                $('#id-option').val(),
349
                $('#title-option').val(),
350
            )
351
        }
1037 geraldo 352
            $('#modal-option').modal('hide');
353
            return;
354
        }
1027 geraldo 355
    });
356
    /**
357
     * Clicked edit Option
358
     */
359
    $('body').on('click', 'button.btn-edit-option', function(e) {
360
        e.preventDefault();
361
        var id_section = $(this).data('section');
362
        var id_option = $(this).data('option');
1041 geraldo 363
        console.log(id_section);
364
        console.log(id_option);
1040 geraldo 365
        console.log(sections);
1027 geraldo 366
        sections.map((item) => {
367
            if (item.id_section == id_section) {
368
                item.options.map((opt) => {
369
                    if (opt.id_option == id_option) {
370
                        $('#id-option').val(opt.id_option);
1042 geraldo 371
                        $('#section-option').val(opt.id_section);
1027 geraldo 372
                        $("#title-option").val(opt.title);
1034 geraldo 373
                        $('#modal-option h4[class="modal-title"]').html('LABEL_EDIT LABEL_OPTION');
1027 geraldo 374
                        $('#modal-option').modal('show');
375
                        return;
376
                    }
377
                });
378
            }
379
        });
380
    });
381
    /**
977 geraldo 382
     * Clicked new Form
383
     */
384
    $('button.btn-add-form').click(function(e) {
385
        $('#form-main').attr('action', '$routeAdd');
386
        $('#form-main #form-id').val('0');
387
        $('#form-main #form-continue').val('0');
388
        $('#form-main #form-name').val('');
1005 geraldo 389
        $('#row-lists').hide();
390
        $('#row-form').show();
977 geraldo 391
        $('#form-main #form-name').focus();
392
    });
393
    /**
394
     * Clicked cancel new/edit Form
395
     */
396
    $('button.btn-edit-cancel').click(function(e) {
397
        e.preventDefault();
1005 geraldo 398
        $('#row-form').hide();
399
        $('#row-lists').show();
977 geraldo 400
    });
401
    /**
402
     * Clicked save and continue new Form
403
     */
404
    $('button.btn-form-save-continue').click(function(e) {
405
        e.preventDefault();
406
        $('#form-main #form-continue').val('1')
407
        $('#form-main').submit();
408
    });
409
    /**
410
     * Clicked save and close new/edit Form
411
     */
412
    $('button.btn-form-save-close').click(function(e) {
413
        e.preventDefault();
414
        $('#form-main #form-continue').val('0')
415
        $('#form-main').submit();
416
    });
417
    /**
418
     * Remove Html Tags
419
     */
1027 geraldo 420
    const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
977 geraldo 421
    /**
422
     * Render Sections data
423
     */
1027 geraldo 424
    const renderData = (data) => {
1011 geraldo 425
        console.log(data);
1013 geraldo 426
        $("#rows").html($("#sectionTemplate").render(data));
1011 geraldo 427
    }
977 geraldo 428
    /**
1007 geraldo 429
     * Add Section to array
977 geraldo 430
     */
1014 geraldo 431
    const addSection = (title, text, type) => {
1007 geraldo 432
        sections.push({
1012 geraldo 433
            'id_section': new Date().getTime(),
1007 geraldo 434
            'title': title,
435
            'type': type,
1009 geraldo 436
            'text': text,
1007 geraldo 437
            'options': []
438
        });
439
        renderData(sections);
440
    }
977 geraldo 441
    /**
1007 geraldo 442
     * Edit item behavior
443
     */
1033 geraldo 444
    const editSection = (id, title, text, type) => {
1007 geraldo 445
        sections.map((item) => {
1012 geraldo 446
            if (item.id_section == id) {
1009 geraldo 447
                item.title = title;
448
                item.type = type;
449
                item.text = text;
1007 geraldo 450
            }
451
        });
452
        renderData(sections);
453
    }
454
    /**
455
     * Remove behavior
456
     */
457
    const removeSection = (id) => {
1012 geraldo 458
        sections = sections.filter((item) => item.id_section != id);
1007 geraldo 459
        renderData(sections);
460
    }
1027 geraldo 461
    /**
1012 geraldo 462
     * Add Option to array
463
     */
1038 geraldo 464
    const addOption = (id_section, title) => {
1012 geraldo 465
        sections.map((item) => {
1038 geraldo 466
            if (item.id_section == id_section) {
1012 geraldo 467
                item.options.push({
1042 geraldo 468
                     'id_section': id_section,
1012 geraldo 469
                    'id_option': new Date().getTime(),
470
                    'title': title,
471
                });
472
            }
473
        });
474
        renderData(sections);
475
    }
476
    /**
1027 geraldo 477
     * Edit item Option
478
     */
1043 geraldo 479
    const editOption = (id_section, id, title ) => {
1012 geraldo 480
        sections.map((item) => {
1038 geraldo 481
            if (item.id_section == id_section) {
1027 geraldo 482
                item.options.map((opt) => {
483
                    if (opt.id_option == id) {
1012 geraldo 484
                        opt.title = title
485
                    }
486
                });
487
            }
488
        });
489
        renderData(sections);
490
    }
491
    /**
492
     * Remove Option
493
     */
1038 geraldo 494
    const removeOption = (id_section, id) => {
1012 geraldo 495
        sections.map((item) => {
1038 geraldo 496
            if (item.id_section == id_section) {
1012 geraldo 497
                item.options = item.options.filter((opt) => opt.id_option != id) || []
498
            }
499
        });
500
        renderData(sections);
501
    }
1007 geraldo 502
    /**
977 geraldo 503
     * Clicked refresh button
504
     */
505
    $('button.btn-refresh').click(function(e) {
506
        tableForm.fnDraw();
507
    });
508
});
509
JS;
510
$this->inlineScript()->captureEnd();
511
?>
512
<!-- Content Header (Page header) -->
513
<section class="content-header">
1027 geraldo 514
   <div class="container-fluid">
515
      <div class="row mb-2">
516
         <div class="col-sm-12">
517
            <h1>LABEL_PERFORMANCE_EVALUATION</h1>
518
         </div>
519
      </div>
520
   </div>
521
   <!-- /.container-fluid -->
977 geraldo 522
</section>
523
<section class="content">
1027 geraldo 524
   <div class="container-fluid" id="row-lists">
525
      <div class="row">
526
         <div class="col-12">
527
            <div class="card">
528
               <div class="card-body">
529
                  <table id="gridTable" class="table   table-hover">
530
                     <thead>
531
                        <tr>
532
                           <th>LABEL_NAME</th>
533
                           <th>LABEL_LANGUAGE</th>
534
                           <th>LABEL_ACTIVE</th>
535
                           <th>LABEL_ACTIONS</th>
536
                        </tr>
537
                     </thead>
538
                     <tbody></tbody>
539
                  </table>
540
               </div>
541
               <div class="card-footer clearfix">
542
                  <div style="float:right;">
543
                     <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
544
                     <?php if ($allowAdd) : ?>
545
                     <button type="button" class="btn btn-primary btn-add-form"><i class="fa fa-plus"></i> LABEL_ADD </button>
546
                     <?php endif; ?>
547
                  </div>
548
               </div>
977 geraldo 549
            </div>
1027 geraldo 550
         </div>
551
      </div>
552
   </div>
553
   <!-- Create/Edit Form -->
554
   <div class="row" id="row-form" style="display: none">
555
      <div class="col-xs-12 col-md-12">
556
         <form action="#" name="form-main" id="form-main">
557
            <input type="hidden" name="form-id" id="form-id" value="0" />
558
            <input type="hidden" name="form-continue" id="form-continue" value="0" />
559
            <div class="form-group">
560
               <label for="form-name">LABEL_FIRST_NAME</label>
561
               <input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
1012 geraldo 562
            </div>
1027 geraldo 563
            <div class="row">
564
               <div class="col-xs-12 col-md-12 text-right">
565
                  <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>
566
               </div>
567
            </div>
568
            <br />
569
            <div class="row">
570
               <div class="col-xs-12 col-md-12">
571
                  <div class="panel-group" id="rows"></div>
572
               </div>
573
            </div>
574
            <div class="form-group">
575
               <button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE & LABEL_CLOSE</button>
576
               <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
577
            </div>
578
         </form>
579
      </div>
580
   </div>
581
   <!-- Create/Edit Form-->
582
   <!-- section Modal -->
583
   <div  id="modal-section" class="modal" tabindex="-1" role="dialog">
584
      <div class="modal-dialog modal-lg" role="document">
585
         <form action="#" name="form-section" id="form-section">
586
            <input type="hidden" name="id-section" id="id-section" />
587
            <div class="modal-content">
588
               <div class="modal-header">
589
                  <h4 class="modal-title">LABEL_ADD LABEL_SECTION</h4>
590
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
591
                  <span aria-hidden="true">&times;</span>
592
                  </button>
593
               </div>
594
               <div class="modal-body">
595
                  <div class="form-group">
596
                     <label for="title-section">LABEL_FIRST_NAME</label>
597
                     <input type="text" name="title-section" id="title-section" class="form-control" maxlength="50" value="" />
598
                  </div>
599
                  <div class="form-group">
600
                     <label for="text-section">LABEL_TEXT</label>
601
                     <textarea  name="text-section" id="text-section" rows="5" class="form-control"></textarea>
602
                  </div>
603
                  <div class="form-group">
604
                     <label for="type-section">LABEL_TYPE</label>
605
                     <select name="type-section" id="type-section" class="form-control">
606
                        <option value="simple">Simple</option>
607
                        <option value="multiple">Multiple</option>
608
                     </select>
609
                  </div>
610
               </div>
611
               <div class="modal-footer">
612
                  <button type="button" id="btn-save-section" class="btn btn-primary">LABEL_SAVE</button>
613
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
614
               </div>
615
            </div>
616
         </form>
617
      </div>
618
   </div>
619
   <!-- End Modal section -->
620
   <!-- Modal Options -->
621
   <div  id="modal-option" class="modal" tabindex="-1" role="dialog">
622
      <div class="modal-dialog modal-lg" role="document">
623
         <form action="#" name="form-option" id="form-option">
624
            <input type="hidden" name="section-option" id="section-option" value="" />
625
            <input type="hidden" name="id-option" id="id-option" value="" />
626
            <div class="modal-content">
627
               <div class="modal-header">
628
                  <h4 class="modal-title">LABEL_OPTION</h4>
629
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
630
                  <span aria-hidden="true">&times;</span>
631
                  </button>
632
               </div>
633
               <div class="modal-body">
634
                  <div class="form-group">
635
                     <label for="title-option">LABEL_TEXT</label>
636
                     <!--  ckeditor -->
1035 geraldo 637
                     <textarea  name="title-option" id="title-option" rows="5" class="form-control"></textarea>
1027 geraldo 638
                  </div>
639
               </div>
640
               <div class="modal-footer">
641
                  <button type="button" class="btn btn-primary" id="btn-save-option">LABEL_SAVE</button>
642
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
643
               </div>
644
            </div>
645
         </form>
646
      </div>
647
   </div>
648
   <!-- End Modal Options -->
649
   <!---Template Sections --->
650
   <script id="sectionTemplate" type="text/x-jsrender">
1045 geraldo 651
   <div class="panel panel-default" id="panel-{{:id_section}}">
652
   <div class="panel-heading">
653
      <h4 class="panel-title">
654
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:id_section}}" href="#collapse-{{:id_section}}">
655
         <span class="section-name{{:id_section}}">
656
         {{:name}}
657
         </span>
658
         </a>
659
      </h4>
660
   </div>
661
   <div id="collapse-{{:id_section}}" class="panel-collapse in collapse show">
662
      <div class="panel-body">
663
         <div class="table-responsive">
664
            <table class="table table-bordered">
665
               <thead>
666
                  <tr>
667
                     <th style="width: 10%;">LABEL_ELEMENT</th>
668
                     <th style="width: 30%;">LABEL_TEXT</th>
669
                     <th style="width: 10%;">LABEL_TYPE</th>
670
                     <th style="width: 50%;">LABEL_ACTIONS</th>
671
                  </tr>
672
               </thead>
673
               <tbody>
674
                  <tr class="tr-section">
675
                     <td class="text-left">LABEL_SECTION</td>
676
                     <td class="text-left">{{:title}}</td>
677
                     <td>
678
                        {{if type == 'simple'}} Simple {{/if}}
679
                        {{if type == 'multiple'}} Multiple {{/if}}
680
                     </td>
681
                     <td>
682
                        <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>
683
                        <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>
684
                        {{if type == 'multiple'}}
685
                        <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>
686
                        {{/if}}
687
                     </td>
688
                  </tr>
689
                  {{for options}}
690
                  <tr >
691
                     <td class="text-left">--LABEL_OPTION</td>
692
                     <td class="text-left">
693
                        {{:title}}
694
                     </td>
695
                     <td></td>
696
                     <td>
697
                        <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>
698
                        <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>
699
                     </td>
700
                  </tr>
701
                  {{/for}}
702
               </tbody>
703
            </table>
704
         </div>
1027 geraldo 705
      </div>
1045 geraldo 706
   </div>
707
</div>
1027 geraldo 708
   </script>
709
   <!-- End Template Sections-->
977 geraldo 710
</section>