Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 1026 | Rev 1028 | 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",
290
            message: "LABEL_SECTION_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');
309
        sections.map((item) => {
310
            if (section.id == id) {
311
                $('#form-section #id-section').val(item.section_id);
312
                $('#form-section #title-section').val(item.title);
313
                $('#form-section #text-text').val(item.text);
314
                $('#form-section #type-section').val(item.section);
315
                $('#modal-section').modal('show');
316
                return;
317
            }
318
        });
319
    });
977 geraldo 320
    /**
1027 geraldo 321
     * Clicked add new Option
322
     */
323
    $('body').on('click', 'button.btn-add-option', function(e) {
324
        e.preventDefault();
325
        var id = $(this).data('section');
326
        $('#section-option').val(id);
327
        $('#modal-option h4[class="modal-title"]').html('LABEL_EDIT LABEL_SECTION');
328
        $('#modal-option').modal('show');
329
        return;
330
    });
331
    /**
332
     * Clicked add new Option
333
     */
334
    $('body').on('click', 'button.btn-save-option', function(e) {
335
        e.preventDefault();
336
        var id = $(this).data('section');
337
        if ($('#id-option').val() == "") {
338
            addOption(
339
                $('#section-option').val(),
340
                $('#title-option').val(),
341
            )
342
        } else {
343
            editOption(
344
                $('#section-option').val(),
345
                $('#id-option').val(),
346
                $('#title-option').val(),
347
            )
348
        }
349
    });
350
    /**
351
     * Clicked edit Option
352
     */
353
    $('body').on('click', 'button.btn-edit-option', function(e) {
354
        e.preventDefault();
355
        var id_section = $(this).data('section');
356
        var id_option = $(this).data('option');
357
        sections.map((item) => {
358
            if (item.id_section == id_section) {
359
                item.options.map((opt) => {
360
                    if (opt.id_option == id_option) {
361
                        $('#id-option').val(opt.id_option);
362
                        $('#section-option').val(id_section);
363
                        $("#title-option").val(opt.title);
364
                        $('#modal-option h4[class="modal-title"]').html('LABEL_EDIT LABEL_SECTION');
365
                        $('#modal-option').modal('show');
366
                        return;
367
                    }
368
                });
369
            }
370
        });
371
    });
372
    /**
373
     * Clicked remove Option
374
     */
375
    $('body').on('click', 'button.btn-add-option', function(e) {
376
        e.preventDefault();
377
        var id_section = $(this).data('section');
378
        var id_option = $(this).data('option');
379
        bootbox.confirm({
380
            title: "LABEL_DELETE LABEL_OPTION",
381
            message: "LABEL_SECTION_DELETE",
382
            buttons: {
383
                cancel: {
384
                    label: '<i class="fa fa-times"></i> LABEL_CANCEL'
385
                },
386
                confirm: {
387
                    label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
388
                }
389
            },
390
            callback: function(result) {
391
                if (result) {
392
                    removeOption(id_section, id_option);
393
                }
394
            }
395
        });
396
    });
397
    /**
977 geraldo 398
     * Clicked new Form
399
     */
400
    $('button.btn-add-form').click(function(e) {
401
        $('#form-main').attr('action', '$routeAdd');
402
        $('#form-main #form-id').val('0');
403
        $('#form-main #form-continue').val('0');
404
        $('#form-main #form-name').val('');
1005 geraldo 405
        $('#row-lists').hide();
406
        $('#row-form').show();
977 geraldo 407
        $('#form-main #form-name').focus();
408
    });
409
    /**
410
     * Clicked cancel new/edit Form
411
     */
412
    $('button.btn-edit-cancel').click(function(e) {
413
        e.preventDefault();
1005 geraldo 414
        $('#row-form').hide();
415
        $('#row-lists').show();
977 geraldo 416
    });
417
    /**
418
     * Clicked save and continue new Form
419
     */
420
    $('button.btn-form-save-continue').click(function(e) {
421
        e.preventDefault();
422
        $('#form-main #form-continue').val('1')
423
        $('#form-main').submit();
424
    });
425
    /**
426
     * Clicked save and close new/edit Form
427
     */
428
    $('button.btn-form-save-close').click(function(e) {
429
        e.preventDefault();
430
        $('#form-main #form-continue').val('0')
431
        $('#form-main').submit();
432
    });
433
    /**
434
     * Remove Html Tags
435
     */
1027 geraldo 436
    const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
977 geraldo 437
    /**
438
     * Render Sections data
439
     */
1027 geraldo 440
    const renderData = (data) => {
1011 geraldo 441
        console.log(data);
1013 geraldo 442
        $("#rows").html($("#sectionTemplate").render(data));
1011 geraldo 443
    }
977 geraldo 444
    /**
1007 geraldo 445
     * Add Section to array
977 geraldo 446
     */
1014 geraldo 447
    const addSection = (title, text, type) => {
1007 geraldo 448
        sections.push({
1012 geraldo 449
            'id_section': new Date().getTime(),
1007 geraldo 450
            'title': title,
451
            'type': type,
1009 geraldo 452
            'text': text,
1007 geraldo 453
            'options': []
454
        });
455
        renderData(sections);
456
    }
977 geraldo 457
    /**
1007 geraldo 458
     * Edit item behavior
459
     */
1009 geraldo 460
    const editSection = (id, title, type, text) => {
1007 geraldo 461
        sections.map((item) => {
1012 geraldo 462
            if (item.id_section == id) {
1009 geraldo 463
                item.title = title;
464
                item.type = type;
465
                item.text = text;
1007 geraldo 466
            }
467
        });
468
        renderData(sections);
469
    }
470
    /**
471
     * Remove behavior
472
     */
473
    const removeSection = (id) => {
1012 geraldo 474
        sections = sections.filter((item) => item.id_section != id);
1007 geraldo 475
        renderData(sections);
476
    }
1027 geraldo 477
    /**
1012 geraldo 478
     * Add Option to array
479
     */
480
    const addOption = (section, title) => {
481
        sections.map((item) => {
482
            if (item.id_option == section) {
483
                item.options.push({
484
                    'id_option': new Date().getTime(),
485
                    'title': title,
486
                });
487
            }
488
        });
489
        renderData(sections);
490
    }
491
    /**
1027 geraldo 492
     * Edit item Option
493
     */
1012 geraldo 494
    const editOption = (section, id, tilte) => {
495
        sections.map((item) => {
496
            if (item.id_section == section) {
1027 geraldo 497
                item.options.map((opt) => {
498
                    if (opt.id_option == id) {
1012 geraldo 499
                        opt.title = title
500
                    }
501
                });
502
            }
503
        });
504
        renderData(sections);
505
    }
506
    /**
507
     * Remove Option
508
     */
509
    const removeOption = (section, id) => {
510
        sections.map((item) => {
511
            if (item.id_section == section) {
512
                item.options = item.options.filter((opt) => opt.id_option != id) || []
513
            }
514
        });
515
        renderData(sections);
516
    }
1007 geraldo 517
    /**
977 geraldo 518
     * Clicked refresh button
519
     */
520
    $('button.btn-refresh').click(function(e) {
521
        tableForm.fnDraw();
522
    });
523
});
524
JS;
525
$this->inlineScript()->captureEnd();
526
?>
527
<!-- Content Header (Page header) -->
528
<section class="content-header">
1027 geraldo 529
   <div class="container-fluid">
530
      <div class="row mb-2">
531
         <div class="col-sm-12">
532
            <h1>LABEL_PERFORMANCE_EVALUATION</h1>
533
         </div>
534
      </div>
535
   </div>
536
   <!-- /.container-fluid -->
977 geraldo 537
</section>
538
<section class="content">
1027 geraldo 539
   <div class="container-fluid" id="row-lists">
540
      <div class="row">
541
         <div class="col-12">
542
            <div class="card">
543
               <div class="card-body">
544
                  <table id="gridTable" class="table   table-hover">
545
                     <thead>
546
                        <tr>
547
                           <th>LABEL_NAME</th>
548
                           <th>LABEL_LANGUAGE</th>
549
                           <th>LABEL_ACTIVE</th>
550
                           <th>LABEL_ACTIONS</th>
551
                        </tr>
552
                     </thead>
553
                     <tbody></tbody>
554
                  </table>
555
               </div>
556
               <div class="card-footer clearfix">
557
                  <div style="float:right;">
558
                     <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
559
                     <?php if ($allowAdd) : ?>
560
                     <button type="button" class="btn btn-primary btn-add-form"><i class="fa fa-plus"></i> LABEL_ADD </button>
561
                     <?php endif; ?>
562
                  </div>
563
               </div>
977 geraldo 564
            </div>
1027 geraldo 565
         </div>
566
      </div>
567
   </div>
568
   <!-- Create/Edit Form -->
569
   <div class="row" id="row-form" style="display: none">
570
      <div class="col-xs-12 col-md-12">
571
         <form action="#" name="form-main" id="form-main">
572
            <input type="hidden" name="form-id" id="form-id" value="0" />
573
            <input type="hidden" name="form-continue" id="form-continue" value="0" />
574
            <div class="form-group">
575
               <label for="form-name">LABEL_FIRST_NAME</label>
576
               <input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
1012 geraldo 577
            </div>
1027 geraldo 578
            <div class="row">
579
               <div class="col-xs-12 col-md-12 text-right">
580
                  <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>
581
               </div>
582
            </div>
583
            <br />
584
            <div class="row">
585
               <div class="col-xs-12 col-md-12">
586
                  <div class="panel-group" id="rows"></div>
587
               </div>
588
            </div>
589
            <div class="form-group">
590
               <button type="submit" form="form-main" class="btn btn-info btn-form-save-continue">LABEL_SAVE & LABEL_CONTINUE</button>
591
               <button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE & LABEL_CLOSE</button>
592
               <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
593
            </div>
594
         </form>
595
      </div>
596
   </div>
597
   <!-- Create/Edit Form-->
598
   <!-- section Modal -->
599
   <div  id="modal-section" class="modal" tabindex="-1" role="dialog">
600
      <div class="modal-dialog modal-lg" role="document">
601
         <form action="#" name="form-section" id="form-section">
602
            <input type="hidden" name="id-section" id="id-section" />
603
            <div class="modal-content">
604
               <div class="modal-header">
605
                  <h4 class="modal-title">LABEL_ADD LABEL_SECTION</h4>
606
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
607
                  <span aria-hidden="true">&times;</span>
608
                  </button>
609
               </div>
610
               <div class="modal-body">
611
                  <div class="form-group">
612
                     <label for="title-section">LABEL_FIRST_NAME</label>
613
                     <input type="text" name="title-section" id="title-section" class="form-control" maxlength="50" value="" />
614
                  </div>
615
                  <div class="form-group">
616
                     <label for="text-section">LABEL_TEXT</label>
617
                     <textarea  name="text-section" id="text-section" rows="5" class="form-control"></textarea>
618
                  </div>
619
                  <div class="form-group">
620
                     <label for="type-section">LABEL_TYPE</label>
621
                     <select name="type-section" id="type-section" class="form-control">
622
                        <option value="simple">Simple</option>
623
                        <option value="multiple">Multiple</option>
624
                     </select>
625
                  </div>
626
               </div>
627
               <div class="modal-footer">
628
                  <button type="button" id="btn-save-section" class="btn btn-primary">LABEL_SAVE</button>
629
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
630
               </div>
631
            </div>
632
         </form>
633
      </div>
634
   </div>
635
   <!-- End Modal section -->
636
   <!-- Modal Options -->
637
   <div  id="modal-option" class="modal" tabindex="-1" role="dialog">
638
      <div class="modal-dialog modal-lg" role="document">
639
         <form action="#" name="form-option" id="form-option">
640
            <input type="hidden" name="section-option" id="section-option" value="" />
641
            <input type="hidden" name="id-option" id="id-option" value="" />
642
            <div class="modal-content">
643
               <div class="modal-header">
644
                  <h4 class="modal-title">LABEL_OPTION</h4>
645
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
646
                  <span aria-hidden="true">&times;</span>
647
                  </button>
648
               </div>
649
               <div class="modal-body">
650
                  <div class="form-group">
651
                     <label for="title-option">LABEL_TEXT</label>
652
                     <!--  ckeditor -->
653
                     <textarea  name="title-option" id="title-option" rows="5" class="ckeditor form-control"></textarea>
654
                  </div>
655
               </div>
656
               <div class="modal-footer">
657
                  <button type="button" class="btn btn-primary" id="btn-save-option">LABEL_SAVE</button>
658
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
659
               </div>
660
            </div>
661
         </form>
662
      </div>
663
   </div>
664
   <!-- End Modal Options -->
665
   <!---Template Sections --->
666
   <script id="sectionTemplate" type="text/x-jsrender">
667
      <div class="panel panel-default" id="panel-{{:id_section}}">
668
          <div class="panel-heading">
669
              <h4 class="panel-title">
670
                  <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:id_section}}" href="#collapse-{{:id_section}}">
671
                      <span class="section-name{{:id_section}}">
672
                          {{:name}}
673
                      </span>
674
                  </a>
675
              </h4>
676
          </div>
677
          <div id="collapse-{{:id_section}}" class="panel-collapse in collapse show">
678
              <div class="panel-body">
679
                  <div class="table-responsive">
680
                      <table class="table table-bordered">
681
                          <thead>
682
                              <tr>
683
                                  <th style="width: 10%;">LABEL_ELEMENT</th>
684
                                  <th style="width: 40%;">LABEL_TEXT</th>
685
                                  <th style="width: 10%;">LABEL_TYPE</th>
686
                                  <th style="width: 30%;">LABEL_ACTIONS</th>
687
                              </tr>
688
                          </thead>
689
                          <tbody>
690
                              <tr class="tr-section">
691
                                  <td class="text-left">LABEL_SECTION</td>
692
                                  <td class="text-left">{{:title}}</td>
693
                                  <td>
694
 
695
                                      {{if type == 'simple'}} Simple {{/if}}
696
                                      {{if type == 'multiple'}} Multiple {{/if}}
697
 
698
 
699
                                  </td>
700
                                  <td>
701
                                      <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>
702
 
703
                                      <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>
704
 
705
                                       {{if type == 'multiple'}}
706
                                      <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>
707
                                      {{/if}}
708
                                  </td>
709
                              </tr>
710
                              {{for options}}
711
                              <tr >
712
                                  <td class="text-left">--LABEL_OPTION</td>
713
                                  <td class="text-left">
714
                                      {{:title}}
715
                                  </td>
716
                                  <td></td>
717
                                  <td></td>
718
                                  <td>
719
                                      <button type="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>
720
 
721
 
722
                                      <button type="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>
723
 
724
                                  </td>
725
                              </tr>
726
 
727
                              {{/for}}
728
                          </tbody>
729
                      </table>
730
                  </div>
731
              </div>
732
          </div>
733
      </div>
734
 
735
   </script>
736
   <!-- End Template Sections-->
977 geraldo 737
</section>