Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 1040 | Rev 1042 | 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);
371
                        $('#section-option').val(id_section);
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({
468
                    'id_option': new Date().getTime(),
469
                    'title': title,
470
                });
471
            }
472
        });
473
        renderData(sections);
474
    }
475
    /**
1027 geraldo 476
     * Edit item Option
477
     */
1038 geraldo 478
    const editOption = (id_section, id, tilte) => {
1012 geraldo 479
        sections.map((item) => {
1038 geraldo 480
            if (item.id_section == id_section) {
1027 geraldo 481
                item.options.map((opt) => {
482
                    if (opt.id_option == id) {
1012 geraldo 483
                        opt.title = title
484
                    }
485
                });
486
            }
487
        });
488
        renderData(sections);
489
    }
490
    /**
491
     * Remove Option
492
     */
1038 geraldo 493
    const removeOption = (id_section, id) => {
1012 geraldo 494
        sections.map((item) => {
1038 geraldo 495
            if (item.id_section == id_section) {
1012 geraldo 496
                item.options = item.options.filter((opt) => opt.id_option != id) || []
497
            }
498
        });
499
        renderData(sections);
500
    }
1007 geraldo 501
    /**
977 geraldo 502
     * Clicked refresh button
503
     */
504
    $('button.btn-refresh').click(function(e) {
505
        tableForm.fnDraw();
506
    });
507
});
508
JS;
509
$this->inlineScript()->captureEnd();
510
?>
511
<!-- Content Header (Page header) -->
512
<section class="content-header">
1027 geraldo 513
   <div class="container-fluid">
514
      <div class="row mb-2">
515
         <div class="col-sm-12">
516
            <h1>LABEL_PERFORMANCE_EVALUATION</h1>
517
         </div>
518
      </div>
519
   </div>
520
   <!-- /.container-fluid -->
977 geraldo 521
</section>
522
<section class="content">
1027 geraldo 523
   <div class="container-fluid" id="row-lists">
524
      <div class="row">
525
         <div class="col-12">
526
            <div class="card">
527
               <div class="card-body">
528
                  <table id="gridTable" class="table   table-hover">
529
                     <thead>
530
                        <tr>
531
                           <th>LABEL_NAME</th>
532
                           <th>LABEL_LANGUAGE</th>
533
                           <th>LABEL_ACTIVE</th>
534
                           <th>LABEL_ACTIONS</th>
535
                        </tr>
536
                     </thead>
537
                     <tbody></tbody>
538
                  </table>
539
               </div>
540
               <div class="card-footer clearfix">
541
                  <div style="float:right;">
542
                     <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
543
                     <?php if ($allowAdd) : ?>
544
                     <button type="button" class="btn btn-primary btn-add-form"><i class="fa fa-plus"></i> LABEL_ADD </button>
545
                     <?php endif; ?>
546
                  </div>
547
               </div>
977 geraldo 548
            </div>
1027 geraldo 549
         </div>
550
      </div>
551
   </div>
552
   <!-- Create/Edit Form -->
553
   <div class="row" id="row-form" style="display: none">
554
      <div class="col-xs-12 col-md-12">
555
         <form action="#" name="form-main" id="form-main">
556
            <input type="hidden" name="form-id" id="form-id" value="0" />
557
            <input type="hidden" name="form-continue" id="form-continue" value="0" />
558
            <div class="form-group">
559
               <label for="form-name">LABEL_FIRST_NAME</label>
560
               <input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
1012 geraldo 561
            </div>
1027 geraldo 562
            <div class="row">
563
               <div class="col-xs-12 col-md-12 text-right">
564
                  <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>
565
               </div>
566
            </div>
567
            <br />
568
            <div class="row">
569
               <div class="col-xs-12 col-md-12">
570
                  <div class="panel-group" id="rows"></div>
571
               </div>
572
            </div>
573
            <div class="form-group">
574
               <button type="submit" form="form-main" class="btn btn-info btn-form-save-continue">LABEL_SAVE & LABEL_CONTINUE</button>
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">
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>
1040 geraldo 668
                                  <th style="width: 30%;">LABEL_TEXT</th>
1027 geraldo 669
                                  <th style="width: 10%;">LABEL_TYPE</th>
1040 geraldo 670
                                  <th style="width: 50%;">LABEL_ACTIONS</th>
1027 geraldo 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
 
679
                                      {{if type == 'simple'}} Simple {{/if}}
680
                                      {{if type == 'multiple'}} Multiple {{/if}}
681
 
682
 
683
                                  </td>
684
                                  <td>
685
                                      <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>
686
 
687
                                      <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>
688
 
689
                                       {{if type == 'multiple'}}
690
                                      <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>
691
                                      {{/if}}
692
                                  </td>
693
                              </tr>
694
                              {{for options}}
695
                              <tr >
696
                                  <td class="text-left">--LABEL_OPTION</td>
697
                                  <td class="text-left">
698
                                      {{:title}}
699
                                  </td>
700
                                  <td></td>
701
                                  <td>
1040 geraldo 702
                                      <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>
1027 geraldo 703
 
704
 
1040 geraldo 705
                                      <buttonclass="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>
1027 geraldo 706
 
707
                                  </td>
708
                              </tr>
709
 
710
                              {{/for}}
711
                          </tbody>
712
                      </table>
713
                  </div>
714
              </div>
715
          </div>
716
      </div>
717
 
718
   </script>
719
   <!-- End Template Sections-->
977 geraldo 720
</section>