Proyectos de Subversion LeadersLinked - Backend

Rev

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