Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 1031 | Rev 1033 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
977 geraldo 1
<?php
2
$acl = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser = $this->currentUserHelper();
4
 
5
$roleName = $currentUser->getUserTypeId();
6
 
985 geraldo 7
$routeAdd = $this->url('performance-evaluation/forms/add');
8
$routeDatatable = $this->url('performance-evaluation/forms');
977 geraldo 9
$routeDashboard = $this->url('dashboard');
10
 
985 geraldo 11
$allowAdd = $acl->isAllowed($roleName, 'performance-evaluation/forms/add') ? 1 : 0;
12
$allowEdit = $acl->isAllowed($roleName, 'performance-evaluation/forms/edit') ? 1 : 0;
13
$allowDelete = $acl->isAllowed($roleName, 'performance-evaluation/forms/delete') ? 1 : 0;
977 geraldo 14
 
15
 
16
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
17
 
18
 
19
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
20
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
21
 
22
 
23
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
24
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
25
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
26
 
27
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
28
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
29
 
30
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
31
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
32
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
33
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
34
 
35
 
36
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.min.css'));
37
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css'));
38
 
39
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.full.min.js'));
40
 
41
$this->inlineScript()->appendFile($this->basePath('plugins/moment/moment-with-locales.min.js'));
42
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css'));
43
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js'));
44
 
45
 
46
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
47
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
48
 
49
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
50
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
51
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-input-number/input-number-format.jquery.js'));
52
 
53
// bootbox Alert //
54
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.min.js'));
55
 
56
// JsRender //
57
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.min.js'));
58
 
59
$this->inlineScript()->captureStart();
60
echo <<<JS
1006 geraldo 61
 
1027 geraldo 62
   jQuery(document).ready(function($) {
977 geraldo 63
    var allowEdit = $allowEdit;
64
    var allowDelete = $allowDelete;
1007 geraldo 65
    var sections = [];
977 geraldo 66
    /**
67
     * Get rows and set data table
68
     */
69
    var tableForm = $('#gridTable').dataTable({
70
        'processing': true,
71
        'serverSide': true,
72
        'searching': true,
73
        'order': [
74
            [0, 'asc']
75
        ],
76
        'ordering': true,
77
        'ordenable': true,
78
        'responsive': true,
79
        'select': false,
80
        'paging': true,
81
        'pagingType': 'simple_numbers',
82
        'ajax': {
83
            'url': '$routeDatatable',
84
            'type': 'get',
85
            'beforeSend': function(request) {
86
                NProgress.start();
87
            },
88
            'dataFilter': function(response) {
89
                var response = jQuery.parseJSON(response);
90
                var json = {};
91
                json.recordsTotal = 0;
92
                json.recordsFiltered = 0;
93
                json.data = [];
94
                if (response.success) {
95
                    json.recordsTotal = response.data.total;
96
                    json.recordsFiltered = response.data.total;
97
                    json.data = response.data.items;
98
                } else {
99
                    $.fn.showError(response.data)
100
                }
101
                return JSON.stringify(json);
102
            }
103
        },
104
        'language': {
105
            'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
106
            'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
107
            'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
108
            'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
109
            'sInfo': 'LABEL_DATATABLE_SINFO',
110
            'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
111
            'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
112
            'sInfoPostFix': '',
113
            'sSearch': 'LABEL_DATATABLE_SSEARCH',
114
            'sUrl': '',
115
            'sInfoThousands': ',',
116
            'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
117
            'oPaginate': {
118
                'sFirst': 'LABEL_DATATABLE_SFIRST',
119
                'sLast': 'LABEL_DATATABLE_SLAST',
120
                'sNext': 'LABEL_DATATABLE_SNEXT',
121
                'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
122
            },
123
            'oAria': {
124
                'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
125
                'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
126
            },
127
        },
128
        'drawCallback': function(settings) {
129
            NProgress.done();
130
            $('button.btn-delete').confirmation({
131
                rootSelector: 'button.btn-delete',
132
                title: 'LABEL_ARE_YOU_SURE',
133
                singleton: true,
134
                btnOkLabel: 'LABEL_YES',
135
                btnCancelLabel: 'LABEL_NO',
136
                onConfirm: function(value) {
137
                    action = $(this).data('href');
138
                    NProgress.start();
139
                    $.ajax({
140
                        'dataType': 'json',
141
                        'accept': 'application/json',
142
                        'method': 'post',
143
                        'url': action,
144
                    }).done(function(response) {
145
                        if (response['success']) {
146
                            $.fn.showSuccess(response['data']);
147
                            tableForm.fnDraw();
148
                        } else {
149
                            $.fn.showError(response['data']);
150
                        }
151
                    }).fail(function(jqXHR, textStatus, errorThrown) {
152
                        $.fn.showError(textStatus);
153
                    }).always(function() {
154
                        NProgress.done();
155
                    });
156
                },
157
            });
158
        },
159
        'aoColumns': [{
160
                'mDataProp': 'name'
161
            },
162
            {
163
                'mDataProp': 'language'
164
            },
165
            {
166
                'mDataProp': 'status'
167
            },
168
            {
169
                'mDataProp': 'actions'
170
            },
171
        ],
172
        'columnDefs': [{
173
                'targets': 0,
174
                'className': 'text-vertical-middle',
175
            },
176
            {
177
                'targets': 1,
178
                'className': 'text-vertical-middle',
179
            },
180
            {
181
                'targets': -2,
182
                'orderable': false,
183
                'className': 'text-center',
184
                'render': function(data, type, row) {
185
                    checked = data == 'a' ? ' checked="checked" ' : '';
186
                    return '<div class="checkbox checkbox-success">' +
187
                        '<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
188
                        '<label ></label></div>';
189
                }
190
            },
191
            {
192
                'targets': -1,
193
                'orderable': false,
194
                'render': function(data, type, row) {
195
                    s = '';
196
                    if (allowEdit) {
197
                        s = s + '<button class="btn btn-primary btn-edit-form" data-href="' + data['link_edit'] + '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button>&nbsp;';
198
                    }
199
                    if (allowDelete) {
200
                        s = s + '<button class="btn btn-danger btn-delete" data-href="' + data['link_delete'] + '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button>&nbsp;';
201
                    }
202
                    return s;
203
                }
204
            }
205
        ],
206
    });
207
    /**
208
     * Clicked on edit form
209
     */
210
    $('body').on('click', 'button.btn-edit-form', function(e) {
211
        e.preventDefault();
212
        form_id = $(this).data('id')
213
        var action = $(this).data('href');
214
        $.ajax({
215
            'dataType': 'json',
216
            'accept': 'application/json',
217
            'method': 'get',
218
            'url': action,
219
        }).done(function(response) {
220
            if (response['success']) {
221
                $('#form-main').attr('action', action);
222
                $('#form-main #form-id').val(response['data']['id']),
1027 geraldo 223
                    $('#form-main #form-continue').val('0');
977 geraldo 224
                $('#form-main #form-name').val(response['data']['name']),
1027 geraldo 225
                    /*----------Set Ckeditor ------------*/
226
                    CKEDITOR.instances['form-description'].setData(response['data']['description']);
977 geraldo 227
                CKEDITOR.instances['form-text'].setData(response['data']['text']);
228
                $('#form-main #form-language').val(response['data']['language']),
1027 geraldo 229
                    $('#form-main #form-status').val(response['data']['status']);
977 geraldo 230
                /*-------------Render Sections -------*/
1006 geraldo 231
                renderSectionData();
1005 geraldo 232
                $('#row-lists').hide();
233
                $('#row-form').show();
977 geraldo 234
                $('#form-main #form-name').focus();
235
            } else {
236
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
237
            }
238
        }).fail(function(jqXHR, textStatus, errorThrown) {
239
            $.fn.showError(textStatus);
240
        });
241
    });
242
    /**
997 geraldo 243
     * Clicked add new section
977 geraldo 244
     */
1004 geraldo 245
    $('#btn-add-section').click(function(e) {
1027 geraldo 246
        $('#form-section #id-section').val('');
1016 geraldo 247
        $('#form-section #title-section').val('');
1012 geraldo 248
        $('#form-section #text-section').val('');
249
        $('#form-section #type-section').val($('#form-section #type-section option:first').val());
1005 geraldo 250
        $('#modal-section h4[class="modal-title"]').html('LABEL_ADD LABEL_SECTION');
993 geraldo 251
        $('#modal-section').modal('show');
977 geraldo 252
    });
253
    /**
997 geraldo 254
     * Clicked edit section
977 geraldo 255
     */
256
    /**
1009 geraldo 257
     * Clicked save section
258
     */
259
    $('#btn-save-section').click(function(e) {
1027 geraldo 260
        if ($('#title-section').val() == '') {
1010 geraldo 261
            $.fn.showError('Ingrese un nombre');
1009 geraldo 262
            return;
1027 geraldo 263
        } else {
264
            if ($('#id-section').val() == "") {
1009 geraldo 265
                addSection(
1016 geraldo 266
                    $('#title-section').val(),
1012 geraldo 267
                    $('#text-section').val(),
268
                    $('#type-section').val(),
1027 geraldo 269
                )
270
            } else {
1009 geraldo 271
                editSection(
1027 geraldo 272
                    $('#id-section').val(),
1016 geraldo 273
                    $('#title-section').val(),
1012 geraldo 274
                    $('#text-section').val(),
275
                    $('#type-section').val()
1027 geraldo 276
                )
1009 geraldo 277
            }
1011 geraldo 278
            $('#modal-section').modal('hide');
1010 geraldo 279
            return;
1009 geraldo 280
        }
281
    });
282
    /**
997 geraldo 283
     * Clicked remove section
977 geraldo 284
     */
1026 geraldo 285
    $('body').on('click', 'button.btn-delete-section', function(e) {
286
        e.preventDefault();
1027 geraldo 287
        var id_section = $(this).data('section');
977 geraldo 288
        bootbox.confirm({
993 geraldo 289
            title: "LABEL_DELETE LABEL_SECTION",
1031 geraldo 290
            message: "LABEL_QUESTION_DELETE",
977 geraldo 291
            buttons: {
292
                cancel: {
293
                    label: '<i class="fa fa-times"></i> LABEL_CANCEL'
294
                },
295
                confirm: {
296
                    label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
297
                }
298
            },
299
            callback: function(result) {
300
                if (result) {
1027 geraldo 301
                    removeSection(id_section);
977 geraldo 302
                }
303
            }
304
        });
305
    });
1026 geraldo 306
    $('body').on('click', 'button.btn-edit-section', function(e) {
307
        e.preventDefault();
1027 geraldo 308
        var id = $(this).data('section');
1029 geraldo 309
        console.log(id);
1027 geraldo 310
        sections.map((item) => {
1030 geraldo 311
            if (item.id_section == id) {
312
                $('#form-section #id-section').val(item.id_section);
1027 geraldo 313
                $('#form-section #title-section').val(item.title);
314
                $('#form-section #text-text').val(item.text);
1032 geraldo 315
                $('#form-section #type-section').val(item.type);
1027 geraldo 316
                $('#modal-section').modal('show');
317
                return;
318
            }
319
        });
320
    });
977 geraldo 321
    /**
1027 geraldo 322
     * Clicked add new Option
323
     */
324
    $('body').on('click', 'button.btn-add-option', function(e) {
325
        e.preventDefault();
326
        var id = $(this).data('section');
327
        $('#section-option').val(id);
328
        $('#modal-option h4[class="modal-title"]').html('LABEL_EDIT LABEL_SECTION');
329
        $('#modal-option').modal('show');
330
        return;
331
    });
332
    /**
333
     * Clicked add new Option
334
     */
335
    $('body').on('click', 'button.btn-save-option', function(e) {
336
        e.preventDefault();
337
        var id = $(this).data('section');
338
        if ($('#id-option').val() == "") {
339
            addOption(
340
                $('#section-option').val(),
341
                $('#title-option').val(),
342
            )
343
        } else {
344
            editOption(
345
                $('#section-option').val(),
346
                $('#id-option').val(),
347
                $('#title-option').val(),
348
            )
349
        }
350
    });
351
    /**
352
     * Clicked edit Option
353
     */
354
    $('body').on('click', 'button.btn-edit-option', function(e) {
355
        e.preventDefault();
356
        var id_section = $(this).data('section');
357
        var id_option = $(this).data('option');
358
        sections.map((item) => {
359
            if (item.id_section == id_section) {
360
                item.options.map((opt) => {
361
                    if (opt.id_option == id_option) {
362
                        $('#id-option').val(opt.id_option);
363
                        $('#section-option').val(id_section);
364
                        $("#title-option").val(opt.title);
365
                        $('#modal-option h4[class="modal-title"]').html('LABEL_EDIT LABEL_SECTION');
366
                        $('#modal-option').modal('show');
367
                        return;
368
                    }
369
                });
370
            }
371
        });
372
    });
373
    /**
374
     * Clicked remove Option
375
     */
376
    $('body').on('click', 'button.btn-add-option', function(e) {
377
        e.preventDefault();
378
        var id_section = $(this).data('section');
379
        var id_option = $(this).data('option');
380
        bootbox.confirm({
381
            title: "LABEL_DELETE LABEL_OPTION",
1031 geraldo 382
            message: "LABEL_QUESTION_DELETE",
1027 geraldo 383
            buttons: {
384
                cancel: {
385
                    label: '<i class="fa fa-times"></i> LABEL_CANCEL'
386
                },
387
                confirm: {
388
                    label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
389
                }
390
            },
391
            callback: function(result) {
392
                if (result) {
393
                    removeOption(id_section, id_option);
394
                }
395
            }
396
        });
397
    });
398
    /**
977 geraldo 399
     * Clicked new Form
400
     */
401
    $('button.btn-add-form').click(function(e) {
402
        $('#form-main').attr('action', '$routeAdd');
403
        $('#form-main #form-id').val('0');
404
        $('#form-main #form-continue').val('0');
405
        $('#form-main #form-name').val('');
1005 geraldo 406
        $('#row-lists').hide();
407
        $('#row-form').show();
977 geraldo 408
        $('#form-main #form-name').focus();
409
    });
410
    /**
411
     * Clicked cancel new/edit Form
412
     */
413
    $('button.btn-edit-cancel').click(function(e) {
414
        e.preventDefault();
1005 geraldo 415
        $('#row-form').hide();
416
        $('#row-lists').show();
977 geraldo 417
    });
418
    /**
419
     * Clicked save and continue new Form
420
     */
421
    $('button.btn-form-save-continue').click(function(e) {
422
        e.preventDefault();
423
        $('#form-main #form-continue').val('1')
424
        $('#form-main').submit();
425
    });
426
    /**
427
     * Clicked save and close new/edit Form
428
     */
429
    $('button.btn-form-save-close').click(function(e) {
430
        e.preventDefault();
431
        $('#form-main #form-continue').val('0')
432
        $('#form-main').submit();
433
    });
434
    /**
435
     * Remove Html Tags
436
     */
1027 geraldo 437
    const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
977 geraldo 438
    /**
439
     * Render Sections data
440
     */
1027 geraldo 441
    const renderData = (data) => {
1011 geraldo 442
        console.log(data);
1013 geraldo 443
        $("#rows").html($("#sectionTemplate").render(data));
1011 geraldo 444
    }
977 geraldo 445
    /**
1007 geraldo 446
     * Add Section to array
977 geraldo 447
     */
1014 geraldo 448
    const addSection = (title, text, type) => {
1007 geraldo 449
        sections.push({
1012 geraldo 450
            'id_section': new Date().getTime(),
1007 geraldo 451
            'title': title,
452
            'type': type,
1009 geraldo 453
            'text': text,
1007 geraldo 454
            'options': []
455
        });
456
        renderData(sections);
457
    }
977 geraldo 458
    /**
1007 geraldo 459
     * Edit item behavior
460
     */
1009 geraldo 461
    const editSection = (id, title, type, text) => {
1007 geraldo 462
        sections.map((item) => {
1012 geraldo 463
            if (item.id_section == id) {
1009 geraldo 464
                item.title = title;
465
                item.type = type;
466
                item.text = text;
1007 geraldo 467
            }
468
        });
469
        renderData(sections);
470
    }
471
    /**
472
     * Remove behavior
473
     */
474
    const removeSection = (id) => {
1012 geraldo 475
        sections = sections.filter((item) => item.id_section != id);
1007 geraldo 476
        renderData(sections);
477
    }
1027 geraldo 478
    /**
1012 geraldo 479
     * Add Option to array
480
     */
481
    const addOption = (section, title) => {
482
        sections.map((item) => {
483
            if (item.id_option == section) {
484
                item.options.push({
485
                    'id_option': new Date().getTime(),
486
                    'title': title,
487
                });
488
            }
489
        });
490
        renderData(sections);
491
    }
492
    /**
1027 geraldo 493
     * Edit item Option
494
     */
1012 geraldo 495
    const editOption = (section, id, tilte) => {
496
        sections.map((item) => {
497
            if (item.id_section == section) {
1027 geraldo 498
                item.options.map((opt) => {
499
                    if (opt.id_option == id) {
1012 geraldo 500
                        opt.title = title
501
                    }
502
                });
503
            }
504
        });
505
        renderData(sections);
506
    }
507
    /**
508
     * Remove Option
509
     */
510
    const removeOption = (section, id) => {
511
        sections.map((item) => {
512
            if (item.id_section == section) {
513
                item.options = item.options.filter((opt) => opt.id_option != id) || []
514
            }
515
        });
516
        renderData(sections);
517
    }
1007 geraldo 518
    /**
977 geraldo 519
     * Clicked refresh button
520
     */
521
    $('button.btn-refresh').click(function(e) {
522
        tableForm.fnDraw();
523
    });
524
});
525
JS;
526
$this->inlineScript()->captureEnd();
527
?>
528
<!-- Content Header (Page header) -->
529
<section class="content-header">
1027 geraldo 530
   <div class="container-fluid">
531
      <div class="row mb-2">
532
         <div class="col-sm-12">
533
            <h1>LABEL_PERFORMANCE_EVALUATION</h1>
534
         </div>
535
      </div>
536
   </div>
537
   <!-- /.container-fluid -->
977 geraldo 538
</section>
539
<section class="content">
1027 geraldo 540
   <div class="container-fluid" id="row-lists">
541
      <div class="row">
542
         <div class="col-12">
543
            <div class="card">
544
               <div class="card-body">
545
                  <table id="gridTable" class="table   table-hover">
546
                     <thead>
547
                        <tr>
548
                           <th>LABEL_NAME</th>
549
                           <th>LABEL_LANGUAGE</th>
550
                           <th>LABEL_ACTIVE</th>
551
                           <th>LABEL_ACTIONS</th>
552
                        </tr>
553
                     </thead>
554
                     <tbody></tbody>
555
                  </table>
556
               </div>
557
               <div class="card-footer clearfix">
558
                  <div style="float:right;">
559
                     <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
560
                     <?php if ($allowAdd) : ?>
561
                     <button type="button" class="btn btn-primary btn-add-form"><i class="fa fa-plus"></i> LABEL_ADD </button>
562
                     <?php endif; ?>
563
                  </div>
564
               </div>
977 geraldo 565
            </div>
1027 geraldo 566
         </div>
567
      </div>
568
   </div>
569
   <!-- Create/Edit Form -->
570
   <div class="row" id="row-form" style="display: none">
571
      <div class="col-xs-12 col-md-12">
572
         <form action="#" name="form-main" id="form-main">
573
            <input type="hidden" name="form-id" id="form-id" value="0" />
574
            <input type="hidden" name="form-continue" id="form-continue" value="0" />
575
            <div class="form-group">
576
               <label for="form-name">LABEL_FIRST_NAME</label>
577
               <input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
1012 geraldo 578
            </div>
1027 geraldo 579
            <div class="row">
580
               <div class="col-xs-12 col-md-12 text-right">
581
                  <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>
582
               </div>
583
            </div>
584
            <br />
585
            <div class="row">
586
               <div class="col-xs-12 col-md-12">
587
                  <div class="panel-group" id="rows"></div>
588
               </div>
589
            </div>
590
            <div class="form-group">
591
               <button type="submit" form="form-main" class="btn btn-info btn-form-save-continue">LABEL_SAVE & LABEL_CONTINUE</button>
592
               <button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE & LABEL_CLOSE</button>
593
               <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
594
            </div>
595
         </form>
596
      </div>
597
   </div>
598
   <!-- Create/Edit Form-->
599
   <!-- section Modal -->
600
   <div  id="modal-section" class="modal" tabindex="-1" role="dialog">
601
      <div class="modal-dialog modal-lg" role="document">
602
         <form action="#" name="form-section" id="form-section">
603
            <input type="hidden" name="id-section" id="id-section" />
604
            <div class="modal-content">
605
               <div class="modal-header">
606
                  <h4 class="modal-title">LABEL_ADD LABEL_SECTION</h4>
607
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
608
                  <span aria-hidden="true">&times;</span>
609
                  </button>
610
               </div>
611
               <div class="modal-body">
612
                  <div class="form-group">
613
                     <label for="title-section">LABEL_FIRST_NAME</label>
614
                     <input type="text" name="title-section" id="title-section" class="form-control" maxlength="50" value="" />
615
                  </div>
616
                  <div class="form-group">
617
                     <label for="text-section">LABEL_TEXT</label>
618
                     <textarea  name="text-section" id="text-section" rows="5" class="form-control"></textarea>
619
                  </div>
620
                  <div class="form-group">
621
                     <label for="type-section">LABEL_TYPE</label>
622
                     <select name="type-section" id="type-section" class="form-control">
623
                        <option value="simple">Simple</option>
624
                        <option value="multiple">Multiple</option>
625
                     </select>
626
                  </div>
627
               </div>
628
               <div class="modal-footer">
629
                  <button type="button" id="btn-save-section" class="btn btn-primary">LABEL_SAVE</button>
630
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
631
               </div>
632
            </div>
633
         </form>
634
      </div>
635
   </div>
636
   <!-- End Modal section -->
637
   <!-- Modal Options -->
638
   <div  id="modal-option" class="modal" tabindex="-1" role="dialog">
639
      <div class="modal-dialog modal-lg" role="document">
640
         <form action="#" name="form-option" id="form-option">
641
            <input type="hidden" name="section-option" id="section-option" value="" />
642
            <input type="hidden" name="id-option" id="id-option" value="" />
643
            <div class="modal-content">
644
               <div class="modal-header">
645
                  <h4 class="modal-title">LABEL_OPTION</h4>
646
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
647
                  <span aria-hidden="true">&times;</span>
648
                  </button>
649
               </div>
650
               <div class="modal-body">
651
                  <div class="form-group">
652
                     <label for="title-option">LABEL_TEXT</label>
653
                     <!--  ckeditor -->
654
                     <textarea  name="title-option" id="title-option" rows="5" class="ckeditor form-control"></textarea>
655
                  </div>
656
               </div>
657
               <div class="modal-footer">
658
                  <button type="button" class="btn btn-primary" id="btn-save-option">LABEL_SAVE</button>
659
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
660
               </div>
661
            </div>
662
         </form>
663
      </div>
664
   </div>
665
   <!-- End Modal Options -->
666
   <!---Template Sections --->
667
   <script id="sectionTemplate" type="text/x-jsrender">
668
      <div class="panel panel-default" id="panel-{{:id_section}}">
669
          <div class="panel-heading">
670
              <h4 class="panel-title">
671
                  <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:id_section}}" href="#collapse-{{:id_section}}">
672
                      <span class="section-name{{:id_section}}">
673
                          {{:name}}
674
                      </span>
675
                  </a>
676
              </h4>
677
          </div>
678
          <div id="collapse-{{:id_section}}" class="panel-collapse in collapse show">
679
              <div class="panel-body">
680
                  <div class="table-responsive">
681
                      <table class="table table-bordered">
682
                          <thead>
683
                              <tr>
684
                                  <th style="width: 10%;">LABEL_ELEMENT</th>
685
                                  <th style="width: 40%;">LABEL_TEXT</th>
686
                                  <th style="width: 10%;">LABEL_TYPE</th>
687
                                  <th style="width: 30%;">LABEL_ACTIONS</th>
688
                              </tr>
689
                          </thead>
690
                          <tbody>
691
                              <tr class="tr-section">
692
                                  <td class="text-left">LABEL_SECTION</td>
693
                                  <td class="text-left">{{:title}}</td>
694
                                  <td>
695
 
696
                                      {{if type == 'simple'}} Simple {{/if}}
697
                                      {{if type == 'multiple'}} Multiple {{/if}}
698
 
699
 
700
                                  </td>
701
                                  <td>
702
                                      <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>
703
 
704
                                      <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>
705
 
706
                                       {{if type == 'multiple'}}
707
                                      <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>
708
                                      {{/if}}
709
                                  </td>
710
                              </tr>
711
                              {{for options}}
712
                              <tr >
713
                                  <td class="text-left">--LABEL_OPTION</td>
714
                                  <td class="text-left">
715
                                      {{:title}}
716
                                  </td>
717
                                  <td></td>
718
                                  <td></td>
719
                                  <td>
720
                                      <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>
721
 
722
 
723
                                      <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>
724
 
725
                                  </td>
726
                              </tr>
727
 
728
                              {{/for}}
729
                          </tbody>
730
                      </table>
731
                  </div>
732
              </div>
733
          </div>
734
      </div>
735
 
736
   </script>
737
   <!-- End Template Sections-->
977 geraldo 738
</section>