Proyectos de Subversion LeadersLinked - Backend

Rev

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