Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 1051 | Rev 1054 | 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
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-name').val('');
1053 geraldo 408
        $('#form-main #job_description_id').val('');
409
        $('#form-main #form-status').val('$status_active');
1049 geraldo 410
        $("#rows").html('');
411
        sections = [];
1005 geraldo 412
        $('#row-lists').hide();
413
        $('#row-form').show();
977 geraldo 414
        $('#form-main #form-name').focus();
415
    });
416
    /**
417
     * Clicked cancel new/edit Form
418
     */
419
    $('button.btn-edit-cancel').click(function(e) {
420
        e.preventDefault();
1005 geraldo 421
        $('#row-form').hide();
422
        $('#row-lists').show();
977 geraldo 423
    });
424
    /**
425
     * Clicked save and close new/edit Form
426
     */
427
    $('button.btn-form-save-close').click(function(e) {
428
        e.preventDefault();
429
        $('#form-main #form-continue').val('0')
430
        $('#form-main').submit();
431
    });
432
    /**
433
     * Remove Html Tags
434
     */
1027 geraldo 435
    const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
977 geraldo 436
    /**
437
     * Render Sections data
438
     */
1027 geraldo 439
    const renderData = (data) => {
1011 geraldo 440
        console.log(data);
1013 geraldo 441
        $("#rows").html($("#sectionTemplate").render(data));
1011 geraldo 442
    }
977 geraldo 443
    /**
1007 geraldo 444
     * Add Section to array
977 geraldo 445
     */
1014 geraldo 446
    const addSection = (title, text, type) => {
1048 geraldo 447
        console.log('add');
1007 geraldo 448
        sections.push({
1012 geraldo 449
            'id_section': new Date().getTime(),
1007 geraldo 450
            'title': title,
451
            'type': type,
1009 geraldo 452
            'text': text,
1007 geraldo 453
            'options': []
454
        });
455
        renderData(sections);
456
    }
977 geraldo 457
    /**
1007 geraldo 458
     * Edit item behavior
459
     */
1033 geraldo 460
    const editSection = (id, title, text, type) => {
1007 geraldo 461
        sections.map((item) => {
1012 geraldo 462
            if (item.id_section == id) {
1009 geraldo 463
                item.title = title;
464
                item.type = type;
465
                item.text = text;
1007 geraldo 466
            }
467
        });
468
        renderData(sections);
469
    }
470
    /**
471
     * Remove behavior
472
     */
473
    const removeSection = (id) => {
1012 geraldo 474
        sections = sections.filter((item) => item.id_section != id);
1007 geraldo 475
        renderData(sections);
476
    }
1027 geraldo 477
    /**
1012 geraldo 478
     * Add Option to array
479
     */
1038 geraldo 480
    const addOption = (id_section, title) => {
1012 geraldo 481
        sections.map((item) => {
1038 geraldo 482
            if (item.id_section == id_section) {
1012 geraldo 483
                item.options.push({
1042 geraldo 484
                     'id_section': id_section,
1012 geraldo 485
                    'id_option': new Date().getTime(),
486
                    'title': title,
487
                });
488
            }
489
        });
490
        renderData(sections);
491
    }
492
    /**
1027 geraldo 493
     * Edit item Option
494
     */
1043 geraldo 495
    const editOption = (id_section, id, title ) => {
1012 geraldo 496
        sections.map((item) => {
1038 geraldo 497
            if (item.id_section == id_section) {
1027 geraldo 498
                item.options.map((opt) => {
499
                    if (opt.id_option == id) {
1012 geraldo 500
                        opt.title = title
501
                    }
502
                });
503
            }
504
        });
505
        renderData(sections);
506
    }
507
    /**
508
     * Remove Option
509
     */
1038 geraldo 510
    const removeOption = (id_section, id) => {
1012 geraldo 511
        sections.map((item) => {
1038 geraldo 512
            if (item.id_section == id_section) {
1012 geraldo 513
                item.options = item.options.filter((opt) => opt.id_option != id) || []
514
            }
515
        });
516
        renderData(sections);
517
    }
1007 geraldo 518
    /**
977 geraldo 519
     * Clicked refresh button
520
     */
521
    $('button.btn-refresh').click(function(e) {
522
        tableForm.fnDraw();
523
    });
524
});
525
JS;
526
$this->inlineScript()->captureEnd();
527
?>
528
<!-- Content Header (Page header) -->
529
<section class="content-header">
1027 geraldo 530
   <div class="container-fluid">
531
      <div class="row mb-2">
532
         <div class="col-sm-12">
533
            <h1>LABEL_PERFORMANCE_EVALUATION</h1>
534
         </div>
535
      </div>
536
   </div>
537
   <!-- /.container-fluid -->
977 geraldo 538
</section>
539
<section class="content">
1027 geraldo 540
   <div class="container-fluid" id="row-lists">
541
      <div class="row">
542
         <div class="col-12">
543
            <div class="card">
544
               <div class="card-body">
545
                  <table id="gridTable" class="table   table-hover">
546
                     <thead>
547
                        <tr>
548
                           <th>LABEL_NAME</th>
549
                           <th>LABEL_LANGUAGE</th>
550
                           <th>LABEL_ACTIVE</th>
551
                           <th>LABEL_ACTIONS</th>
552
                        </tr>
553
                     </thead>
554
                     <tbody></tbody>
555
                  </table>
556
               </div>
557
               <div class="card-footer clearfix">
558
                  <div style="float:right;">
559
                     <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
560
                     <?php if ($allowAdd) : ?>
561
                     <button type="button" class="btn btn-primary btn-add-form"><i class="fa fa-plus"></i> LABEL_ADD </button>
562
                     <?php endif; ?>
563
                  </div>
564
               </div>
977 geraldo 565
            </div>
1027 geraldo 566
         </div>
567
      </div>
568
   </div>
569
   <!-- Create/Edit Form -->
1051 geraldo 570
   <div class="row" id="row-form" style="display: none; padding: 16px;">
1027 geraldo 571
      <div class="col-xs-12 col-md-12">
572
         <form action="#" name="form-main" id="form-main">
573
            <input type="hidden" name="form-id" id="form-id" value="0" />
574
            <input type="hidden" name="form-continue" id="form-continue" value="0" />
575
            <div class="form-group">
576
               <label for="form-name">LABEL_FIRST_NAME</label>
577
               <input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
1012 geraldo 578
            </div>
1050 geraldo 579
            <div class="form-group">
580
                    <label for="job_description_id">LABEL_JOB_DESCRIPTION</label>
581
                    <select name="job_description_id" id="job_description_id" class="form-control">
1051 geraldo 582
                        <option value="">LABEL_SELECT</option>
583
                        <?php foreach ($jobsDescription as $rs): ?>
584
                            <option value="<?php echo $rs->id;?>"><?php echo $rs->name;?></option>
585
                        <?php endforeach; ?>
1050 geraldo 586
                    </select>
587
                </div>
588
            <div class="form-group">
589
                    <label for="form-status">LABEL_STATUS</label>
590
                    <select name="form-status" id="form-status" class="form-control">
591
                        <option value="<?php echo $status_inactive; ?>">LABEL_INACTIVE</option>
592
                        <option value="<?php echo $status_active; ?>">LABEL_ACTIVE</option>
593
                    </select>
594
                </div>
1027 geraldo 595
            <div class="row">
596
               <div class="col-xs-12 col-md-12 text-right">
597
                  <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>
598
               </div>
599
            </div>
600
            <br />
601
            <div class="row">
602
               <div class="col-xs-12 col-md-12">
603
                  <div class="panel-group" id="rows"></div>
604
               </div>
605
            </div>
606
            <div class="form-group">
607
               <button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE & LABEL_CLOSE</button>
608
               <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
609
            </div>
610
         </form>
611
      </div>
612
   </div>
613
   <!-- Create/Edit Form-->
614
   <!-- section Modal -->
615
   <div  id="modal-section" class="modal" tabindex="-1" role="dialog">
616
      <div class="modal-dialog modal-lg" role="document">
617
         <form action="#" name="form-section" id="form-section">
618
            <input type="hidden" name="id-section" id="id-section" />
619
            <div class="modal-content">
620
               <div class="modal-header">
621
                  <h4 class="modal-title">LABEL_ADD LABEL_SECTION</h4>
622
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
623
                  <span aria-hidden="true">&times;</span>
624
                  </button>
625
               </div>
626
               <div class="modal-body">
627
                  <div class="form-group">
628
                     <label for="title-section">LABEL_FIRST_NAME</label>
629
                     <input type="text" name="title-section" id="title-section" class="form-control" maxlength="50" value="" />
630
                  </div>
631
                  <div class="form-group">
632
                     <label for="text-section">LABEL_TEXT</label>
633
                     <textarea  name="text-section" id="text-section" rows="5" class="form-control"></textarea>
634
                  </div>
635
                  <div class="form-group">
636
                     <label for="type-section">LABEL_TYPE</label>
637
                     <select name="type-section" id="type-section" class="form-control">
638
                        <option value="simple">Simple</option>
639
                        <option value="multiple">Multiple</option>
640
                     </select>
641
                  </div>
642
               </div>
643
               <div class="modal-footer">
644
                  <button type="button" id="btn-save-section" class="btn btn-primary">LABEL_SAVE</button>
645
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
646
               </div>
647
            </div>
648
         </form>
649
      </div>
650
   </div>
651
   <!-- End Modal section -->
652
   <!-- Modal Options -->
653
   <div  id="modal-option" class="modal" tabindex="-1" role="dialog">
654
      <div class="modal-dialog modal-lg" role="document">
655
         <form action="#" name="form-option" id="form-option">
656
            <input type="hidden" name="section-option" id="section-option" value="" />
657
            <input type="hidden" name="id-option" id="id-option" value="" />
658
            <div class="modal-content">
659
               <div class="modal-header">
660
                  <h4 class="modal-title">LABEL_OPTION</h4>
661
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
662
                  <span aria-hidden="true">&times;</span>
663
                  </button>
664
               </div>
665
               <div class="modal-body">
666
                  <div class="form-group">
1047 geraldo 667
                     <label for="text-option">LABEL_TEXT</label>
1027 geraldo 668
                     <!--  ckeditor -->
1047 geraldo 669
                     <textarea  name="text-option" id="text-option" rows="5" class="form-control"></textarea>
1027 geraldo 670
                  </div>
671
               </div>
672
               <div class="modal-footer">
673
                  <button type="button" class="btn btn-primary" id="btn-save-option">LABEL_SAVE</button>
674
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
675
               </div>
676
            </div>
677
         </form>
678
      </div>
679
   </div>
1050 geraldo 680
 
1027 geraldo 681
   <!-- End Modal Options -->
682
   <!---Template Sections --->
683
   <script id="sectionTemplate" type="text/x-jsrender">
1045 geraldo 684
   <div class="panel panel-default" id="panel-{{:id_section}}">
685
   <div class="panel-heading">
686
      <h4 class="panel-title">
687
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:id_section}}" href="#collapse-{{:id_section}}">
688
         <span class="section-name{{:id_section}}">
689
         {{:name}}
690
         </span>
691
         </a>
692
      </h4>
693
   </div>
694
   <div id="collapse-{{:id_section}}" class="panel-collapse in collapse show">
695
      <div class="panel-body">
696
         <div class="table-responsive">
697
            <table class="table table-bordered">
698
               <thead>
699
                  <tr>
700
                     <th style="width: 10%;">LABEL_ELEMENT</th>
701
                     <th style="width: 30%;">LABEL_TEXT</th>
702
                     <th style="width: 10%;">LABEL_TYPE</th>
703
                     <th style="width: 50%;">LABEL_ACTIONS</th>
704
                  </tr>
705
               </thead>
706
               <tbody>
707
                  <tr class="tr-section">
708
                     <td class="text-left">LABEL_SECTION</td>
709
                     <td class="text-left">{{:title}}</td>
710
                     <td>
711
                        {{if type == 'simple'}} Simple {{/if}}
712
                        {{if type == 'multiple'}} Multiple {{/if}}
713
                     </td>
714
                     <td>
715
                        <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>
716
                        <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>
717
                        {{if type == 'multiple'}}
718
                        <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>
719
                        {{/if}}
720
                     </td>
721
                  </tr>
722
                  {{for options}}
723
                  <tr >
724
                     <td class="text-left">--LABEL_OPTION</td>
725
                     <td class="text-left">
726
                        {{:title}}
727
                     </td>
728
                     <td></td>
729
                     <td>
730
                        <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>
731
                        <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>
732
                     </td>
733
                  </tr>
734
                  {{/for}}
735
               </tbody>
736
            </table>
737
         </div>
1027 geraldo 738
      </div>
1045 geraldo 739
   </div>
740
</div>
1027 geraldo 741
   </script>
742
   <!-- End Template Sections-->
977 geraldo 743
</section>