Proyectos de Subversion LeadersLinked - Backend

Rev

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