Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 1056 | Rev 1061 | 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
1027 geraldo 65
   jQuery(document).ready(function($) {
1055 geraldo 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;
101
                        } else {
102
                            $.fn.showError(response.data)
103
                        }
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();
142
                            $.ajax({
143
                                'dataType': 'json',
144
                                'accept': 'application/json',
145
                                'method': 'post',
146
                                'url': action,
147
                            }).done(function(response) {
148
                                if (response['success']) {
149
                                    $.fn.showSuccess(response['data']);
150
                                    tableForm.fnDraw();
151
                                } else {
152
                                    $.fn.showError(response['data']);
153
                                }
154
                            }).fail(function(jqXHR, textStatus, errorThrown) {
155
                                $.fn.showError(textStatus);
156
                            }).always(function() {
157
                                NProgress.done();
158
                            });
159
                        },
160
                    });
161
                },
162
                'aoColumns': [{
163
                        'mDataProp': 'name'
164
                    },
165
                    {
166
                        'mDataProp': 'language'
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>';
192
                        }
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
                        }
207
                    }
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-id').val(response['data']['id']),
228
                            $('#form-main #form-name').val(response['data']['name']),
229
                            $('#form-main #job_description_id').val(response['data']['job_description_id']);
230
                        $('#form-main #form-status').val(response['data']['status']);
231
                        sections = response['data']['content'] || [];
232
                        renderData(sections);
233
                        $('#row-lists').hide();
234
                        $('#row-form').show();
235
                    } else {
236
                        $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
237
                    }
238
                }).fail(function(jqXHR, textStatus, errorThrown) {
239
                    $.fn.showError(textStatus);
240
                });
241
            });
242
            /**
243
             * Clicked add new section
244
             */
245
            $('#btn-add-section').click(function(e) {
246
                $('#form-section #id-section').val('');
247
                $('#form-section #title-section').val('');
248
                $('#form-section #text-section').val('');
249
                $('#form-section #type-section').val($('#form-section #type-section option:first').val());
250
                $('#modal-section h4[class="modal-title"]').html('LABEL_ADD LABEL_SECTION');
251
                $('#modal-section').modal('show');
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('Ingrese un nombre');
262
                    return;
977 geraldo 263
                } else {
1055 geraldo 264
                    if ($('#id-section').val() == "") {
265
                        addSection(
266
                            $('#title-section').val(),
267
                            $('#text-section').val(),
268
                            $('#type-section').val(),
269
                        )
270
                    } else {
271
                        editSection(
272
                            $('#id-section').val(),
273
                            $('#title-section').val(),
274
                            $('#text-section').val(),
275
                            $('#type-section').val()
276
                        )
277
                    }
278
                    $('#modal-section').modal('hide');
279
                    return;
977 geraldo 280
                }
1055 geraldo 281
            });
282
            /**
283
             * Clicked remove section
284
             */
285
            $('body').on('click', 'button.btn-delete-section', function(e) {
286
                e.preventDefault();
287
                var id_section = $(this).data('section');
288
                bootbox.confirm({
289
                    title: "LABEL_DELETE LABEL_SECTION",
290
                    message: "LABEL_QUESTION_DELETE",
291
                    buttons: {
292
                        cancel: {
293
                            label: '<i class="fa fa-times"></i> LABEL_CANCEL'
294
                        },
295
                        confirm: {
296
                            label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
297
                        }
298
                    },
299
                    callback: function(result) {
300
                        if (result) {
301
                            removeSection(id_section);
302
                        }
303
                    }
304
                });
305
            });
306
            $('body').on('click', 'button.btn-edit-section', function(e) {
307
                e.preventDefault();
308
                var id = $(this).data('section');
309
                console.log(id);
310
                sections.map((item) => {
311
                    if (item.id_section == id) {
312
                        $('#form-section #id-section').val(item.id_section);
313
                        $('#form-section #title-section').val(item.title);
314
                        $('#form-section #text-text').val(item.text);
315
                        $('#form-section #type-section').val(item.type);
316
                        $('#modal-section').modal('show');
317
                        return;
318
                    }
319
                });
320
            });
321
            /**
322
             * Clicked remove option
323
             */
324
            $('body').on('click', 'button.btn-delete-option', function(e) {
325
                e.preventDefault();
326
                var id_section = $(this).data('section');
327
                var id_option = $(this).data('option');
328
                bootbox.confirm({
329
                    title: "LABEL_DELETE LABEL_OPTION",
330
                    message: "LABEL_QUESTION_DELETE",
331
                    buttons: {
332
                        cancel: {
333
                            label: '<i class="fa fa-times"></i> LABEL_CANCEL'
334
                        },
335
                        confirm: {
336
                            label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
337
                        }
338
                    },
339
                    callback: function(result) {
340
                        if (result) {
341
                            removeOption(id_section, id_option);
342
                        }
343
                    }
344
                });
345
            });
346
            /**
347
             * Clicked add new Option
348
             */
349
            $('body').on('click', 'button.btn-add-option', function(e) {
350
                e.preventDefault();
351
                var id = $(this).data('section');
352
                $('#section-option').val(id);
353
                $('#text-option').val('');
354
                $('#modal-option h4[class="modal-title"]').html('LABEL_EDIT LABEL_OPTION');
355
                $('#modal-option').modal('show');
356
                return;
357
            });
358
            /**
359
             * Clicked add new Option
360
             */
361
            $('#btn-save-option').click(function(e) {
362
                if ($('#text-option').val() == '') {
363
                    $.fn.showError('Ingrese un texto');
364
                    return;
365
                } else {
366
                    if ($('#id-option').val() == "") {
367
                        addOption(
368
                            $('#section-option').val(),
369
                            $('#text-option').val(),
370
                        )
371
                    } else {
372
                        editOption(
373
                            $('#section-option').val(),
374
                            $('#id-option').val(),
375
                            $('#text-option').val(),
376
                        )
377
                    }
378
                    $('#modal-option').modal('hide');
379
                    return;
380
                }
381
            });
382
            /**
383
             * Clicked edit Option
384
             */
385
            $('body').on('click', 'button.btn-edit-option', function(e) {
386
                e.preventDefault();
387
                var id_section = $(this).data('section');
388
                var id_option = $(this).data('option');
389
                sections.map((item) => {
390
                    if (item.id_section == id_section) {
391
                        item.options.map((opt) => {
392
                            if (opt.id_option == id_option) {
393
                                $('#id-option').val(opt.id_option);
394
                                $('#section-option').val(opt.id_section);
395
                                $("#text-option").val(opt.title);
396
                                $('#modal-option h4[class="modal-title"]').html('LABEL_EDIT LABEL_OPTION');
397
                                $('#modal-option').modal('show');
398
                                return;
399
                            }
400
                        });
401
                    }
402
                });
403
            });
404
            /**
405
             * Clicked new Form
406
             */
407
            $('button.btn-add-form').click(function(e) {
408
                $('#form-main').attr('action', '$routeAdd');
409
                $('#form-main #form-id').val('0');
410
                $('#form-main #form-name').val('');
411
                $('#form-main #job_description_id').val('');
412
                $('#form-main #form-status').val('$status_active');
413
                $("#rows").html('');
414
                sections = [];
415
                $('#row-lists').hide();
416
                $('#row-form').show();
417
                $('#form-main #form-name').focus();
418
            });
419
            /**
420
             * Clicked cancel new/edit Form
421
             */
422
            $('button.btn-edit-cancel').click(function(e) {
423
                e.preventDefault();
424
                $('#row-form').hide();
425
                $('#row-lists').show();
426
            });
427
            /**
428
             * Clicked save and close new/edit Form
429
             */
430
            $('button.btn-form-save-close').click(function(e) {
431
                e.preventDefault();
432
                if ($('#form-name').val() == '') {
433
                    $.fn.showError('Ingrese un nombre');
434
                } else if ($('#form-status').val() == '') {
435
                    $.fn.showError('Seleccione un status');
436
                } else if ($('#job_description_id').val() == '') {
437
                    $.fn.showError('Seleccione una descripción de cargo');
438
                } else if (sections.length == 0) {
439
                    $.fn.showError('Debe ingresar al menos una sección');
440
                } else {
441
                    var formId = parseInt($('#form-main #form-id').val());
442
                    var data = {
443
                        'id': formId,
444
                        'name': $('#form-main #form-name').val(),
445
                        'job_description_id': $('#form-main #job_description_id').val(),
446
                        'status': $('#form-main #form-status').val(),
1057 geraldo 447
                        'content': JSON.stringify(sections)
1055 geraldo 448
                    }
977 geraldo 449
                    $.ajax({
450
                        'dataType': 'json',
451
                        'method': 'post',
1055 geraldo 452
                        'url': $('#form-main').attr('action'),
453
                        'data': data,
977 geraldo 454
                    }).done(function(response) {
455
                        if (response['success']) {
456
                            $.fn.showSuccess(response['data']);
1055 geraldo 457
                            $('#row-form').hide();
458
                            $('#row-lists').show();
459
                            /*---------- Reset Form -------- */
460
                            $('#form-main')[0].reset();
461
                            /*--------Reset Sections ----------*/
462
                            sections = [];
977 geraldo 463
                            tableForm.fnDraw();
464
                        } else {
1055 geraldo 465
                            $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
977 geraldo 466
                        }
467
                    });
1055 geraldo 468
                }
977 geraldo 469
            });
1055 geraldo 470
            /**
471
             * Remove Html Tags
472
             */
473
            const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
474
            /**
475
             * Render Sections data
476
             */
477
            const renderData = (data) => {
478
                console.log(data);
479
                $("#rows").html($("#sectionTemplate").render(data));
977 geraldo 480
            }
1055 geraldo 481
            /**
482
             * Add Section to array
483
             */
484
            const addSection = (title, text, type) => {
485
                sections.push({
486
                    'id_section': new Date().getTime(),
487
                    'title': title,
488
                    'type': type,
489
                    'text': text,
490
                    'options': []
491
                });
1054 geraldo 492
                renderData(sections);
977 geraldo 493
            }
1055 geraldo 494
            /**
495
             * Edit item behavior
496
             */
497
            const editSection = (id, title, text, type) => {
498
                sections.map((item) => {
499
                    if (item.id_section == id) {
500
                        item.title = title;
501
                        item.type = type;
502
                        item.text = text;
503
                    }
504
                });
505
                renderData(sections);
1009 geraldo 506
            }
1055 geraldo 507
            /**
508
             * Remove behavior
509
             */
510
            const removeSection = (id) => {
511
                sections = sections.filter((item) => item.id_section != id);
512
                renderData(sections);
977 geraldo 513
            }
1055 geraldo 514
            /**
515
             * Add Option to array
516
             */
517
            const addOption = (id_section, title) => {
518
                sections.map((item) => {
519
                    if (item.id_section == id_section) {
520
                        item.options.push({
521
                            'id_section': id_section,
522
                            'id_option': new Date().getTime(),
523
                            'title': title,
524
                        });
1027 geraldo 525
                    }
526
                });
1055 geraldo 527
                renderData(sections);
1027 geraldo 528
            }
1055 geraldo 529
            /**
530
             * Edit item Option
531
             */
532
            const editOption = (id_section, id, title) => {
533
                sections.map((item) => {
534
                    if (item.id_section == id_section) {
535
                        item.options.map((opt) => {
536
                            if (opt.id_option == id) {
537
                                opt.title = title
538
                            }
539
                        });
1054 geraldo 540
                    }
1012 geraldo 541
                });
1055 geraldo 542
                renderData(sections);
1012 geraldo 543
            }
1055 geraldo 544
            /**
545
             * Remove Option
546
             */
547
            const removeOption = (id_section, id) => {
548
                sections.map((item) => {
549
                    if (item.id_section == id_section) {
550
                        item.options = item.options.filter((opt) => opt.id_option != id) || []
1012 geraldo 551
                    }
552
                });
1055 geraldo 553
                renderData(sections);
1012 geraldo 554
            }
1055 geraldo 555
            /**
556
             * Clicked refresh button
557
             */
558
            $('button.btn-refresh').click(function(e) {
559
                tableForm.fnDraw();
560
            });
977 geraldo 561
});
562
JS;
563
$this->inlineScript()->captureEnd();
564
?>
565
<!-- Content Header (Page header) -->
566
<section class="content-header">
1027 geraldo 567
   <div class="container-fluid">
568
      <div class="row mb-2">
569
         <div class="col-sm-12">
570
            <h1>LABEL_PERFORMANCE_EVALUATION</h1>
571
         </div>
572
      </div>
573
   </div>
574
   <!-- /.container-fluid -->
977 geraldo 575
</section>
576
<section class="content">
1056 geraldo 577
   <div class="container-fluid" id="row-lists">
1027 geraldo 578
      <div class="row">
579
         <div class="col-12">
580
            <div class="card">
581
               <div class="card-body">
582
                  <table id="gridTable" class="table   table-hover">
583
                     <thead>
584
                        <tr>
585
                           <th>LABEL_NAME</th>
586
                           <th>LABEL_LANGUAGE</th>
587
                           <th>LABEL_ACTIVE</th>
588
                           <th>LABEL_ACTIONS</th>
589
                        </tr>
590
                     </thead>
591
                     <tbody></tbody>
592
                  </table>
593
               </div>
594
               <div class="card-footer clearfix">
595
                  <div style="float:right;">
596
                     <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
597
                     <?php if ($allowAdd) : ?>
598
                     <button type="button" class="btn btn-primary btn-add-form"><i class="fa fa-plus"></i> LABEL_ADD </button>
599
                     <?php endif; ?>
600
                  </div>
601
               </div>
977 geraldo 602
            </div>
1027 geraldo 603
         </div>
604
      </div>
605
   </div>
606
   <!-- Create/Edit Form -->
1051 geraldo 607
   <div class="row" id="row-form" style="display: none; padding: 16px;">
1027 geraldo 608
      <div class="col-xs-12 col-md-12">
609
         <form action="#" name="form-main" id="form-main">
610
            <input type="hidden" name="form-id" id="form-id" value="0" />
611
            <input type="hidden" name="form-continue" id="form-continue" value="0" />
612
            <div class="form-group">
613
               <label for="form-name">LABEL_FIRST_NAME</label>
614
               <input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
1012 geraldo 615
            </div>
1050 geraldo 616
            <div class="form-group">
617
                    <label for="job_description_id">LABEL_JOB_DESCRIPTION</label>
618
                    <select name="job_description_id" id="job_description_id" class="form-control">
1051 geraldo 619
                        <option value="">LABEL_SELECT</option>
620
                        <?php foreach ($jobsDescription as $rs): ?>
621
                            <option value="<?php echo $rs->id;?>"><?php echo $rs->name;?></option>
622
                        <?php endforeach; ?>
1050 geraldo 623
                    </select>
624
                </div>
625
            <div class="form-group">
626
                    <label for="form-status">LABEL_STATUS</label>
627
                    <select name="form-status" id="form-status" class="form-control">
628
                        <option value="<?php echo $status_inactive; ?>">LABEL_INACTIVE</option>
629
                        <option value="<?php echo $status_active; ?>">LABEL_ACTIVE</option>
630
                    </select>
631
                </div>
1027 geraldo 632
            <div class="row">
633
               <div class="col-xs-12 col-md-12 text-right">
634
                  <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>
635
               </div>
636
            </div>
637
            <br />
638
            <div class="row">
639
               <div class="col-xs-12 col-md-12">
640
                  <div class="panel-group" id="rows"></div>
641
               </div>
642
            </div>
643
            <div class="form-group">
644
               <button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE & LABEL_CLOSE</button>
645
               <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
646
            </div>
647
         </form>
648
      </div>
649
   </div>
650
   <!-- Create/Edit Form-->
651
   <!-- section Modal -->
652
   <div  id="modal-section" class="modal" tabindex="-1" role="dialog">
653
      <div class="modal-dialog modal-lg" role="document">
654
         <form action="#" name="form-section" id="form-section">
655
            <input type="hidden" name="id-section" id="id-section" />
656
            <div class="modal-content">
657
               <div class="modal-header">
658
                  <h4 class="modal-title">LABEL_ADD LABEL_SECTION</h4>
659
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
660
                  <span aria-hidden="true">&times;</span>
661
                  </button>
662
               </div>
663
               <div class="modal-body">
664
                  <div class="form-group">
665
                     <label for="title-section">LABEL_FIRST_NAME</label>
666
                     <input type="text" name="title-section" id="title-section" class="form-control" maxlength="50" value="" />
667
                  </div>
668
                  <div class="form-group">
669
                     <label for="text-section">LABEL_TEXT</label>
670
                     <textarea  name="text-section" id="text-section" rows="5" class="form-control"></textarea>
671
                  </div>
672
                  <div class="form-group">
673
                     <label for="type-section">LABEL_TYPE</label>
674
                     <select name="type-section" id="type-section" class="form-control">
675
                        <option value="simple">Simple</option>
676
                        <option value="multiple">Multiple</option>
677
                     </select>
678
                  </div>
679
               </div>
680
               <div class="modal-footer">
681
                  <button type="button" id="btn-save-section" class="btn btn-primary">LABEL_SAVE</button>
682
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
683
               </div>
684
            </div>
685
         </form>
686
      </div>
687
   </div>
688
   <!-- End Modal section -->
689
   <!-- Modal Options -->
690
   <div  id="modal-option" class="modal" tabindex="-1" role="dialog">
691
      <div class="modal-dialog modal-lg" role="document">
692
         <form action="#" name="form-option" id="form-option">
693
            <input type="hidden" name="section-option" id="section-option" value="" />
694
            <input type="hidden" name="id-option" id="id-option" value="" />
695
            <div class="modal-content">
696
               <div class="modal-header">
697
                  <h4 class="modal-title">LABEL_OPTION</h4>
698
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
699
                  <span aria-hidden="true">&times;</span>
700
                  </button>
701
               </div>
702
               <div class="modal-body">
703
                  <div class="form-group">
1047 geraldo 704
                     <label for="text-option">LABEL_TEXT</label>
1027 geraldo 705
                     <!--  ckeditor -->
1047 geraldo 706
                     <textarea  name="text-option" id="text-option" rows="5" class="form-control"></textarea>
1027 geraldo 707
                  </div>
708
               </div>
709
               <div class="modal-footer">
710
                  <button type="button" class="btn btn-primary" id="btn-save-option">LABEL_SAVE</button>
711
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
712
               </div>
713
            </div>
714
         </form>
715
      </div>
716
   </div>
1050 geraldo 717
 
1027 geraldo 718
   <!-- End Modal Options -->
719
   <!---Template Sections --->
720
   <script id="sectionTemplate" type="text/x-jsrender">
1045 geraldo 721
   <div class="panel panel-default" id="panel-{{:id_section}}">
722
   <div class="panel-heading">
723
      <h4 class="panel-title">
724
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:id_section}}" href="#collapse-{{:id_section}}">
725
         <span class="section-name{{:id_section}}">
726
         {{:name}}
727
         </span>
728
         </a>
729
      </h4>
730
   </div>
731
   <div id="collapse-{{:id_section}}" class="panel-collapse in collapse show">
732
      <div class="panel-body">
733
         <div class="table-responsive">
734
            <table class="table table-bordered">
735
               <thead>
736
                  <tr>
737
                     <th style="width: 10%;">LABEL_ELEMENT</th>
738
                     <th style="width: 30%;">LABEL_TEXT</th>
739
                     <th style="width: 10%;">LABEL_TYPE</th>
740
                     <th style="width: 50%;">LABEL_ACTIONS</th>
741
                  </tr>
742
               </thead>
743
               <tbody>
744
                  <tr class="tr-section">
745
                     <td class="text-left">LABEL_SECTION</td>
746
                     <td class="text-left">{{:title}}</td>
747
                     <td>
748
                        {{if type == 'simple'}} Simple {{/if}}
749
                        {{if type == 'multiple'}} Multiple {{/if}}
750
                     </td>
751
                     <td>
752
                        <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>
753
                        <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>
754
                        {{if type == 'multiple'}}
755
                        <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>
756
                        {{/if}}
757
                     </td>
758
                  </tr>
759
                  {{for options}}
760
                  <tr >
761
                     <td class="text-left">--LABEL_OPTION</td>
762
                     <td class="text-left">
763
                        {{:title}}
764
                     </td>
765
                     <td></td>
766
                     <td>
767
                        <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>
768
                        <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>
769
                     </td>
770
                  </tr>
771
                  {{/for}}
772
               </tbody>
773
            </table>
774
         </div>
1027 geraldo 775
      </div>
1045 geraldo 776
   </div>
777
</div>
1027 geraldo 778
   </script>
779
   <!-- End Template Sections-->
977 geraldo 780
</section>