Proyectos de Subversion LeadersLinked - Backend

Rev

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