Proyectos de Subversion LeadersLinked - Backend

Rev

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