Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 1483 | Rev 1485 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1481 eleazar 1
<?php
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
4
$roleName       = $currentUser->getUserTypeId();
5
 
1482 eleazar 6
$routeDatatable = $this->url('recruitment-and-selection/candidates');
1481 eleazar 7
 
1482 eleazar 8
$allowAdd = $acl->isAllowed($roleName, 'recruitment-and-selection/candidates/add') ? 1 : 0;
9
$allowDelete = $acl->isAllowed($roleName, 'recruitment-and-selection/candidates/delete') ? 1 : 0;
1481 eleazar 10
 
11
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
12
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
13
 
14
 
15
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.min.js'));
16
 
17
 
18
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
19
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
20
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
21
 
22
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
23
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
24
 
25
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
26
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
27
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
28
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
29
 
30
 
31
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
32
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
33
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
34
 
35
 
36
 
37
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
38
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
39
 
40
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
41
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
42
 
43
 
44
$this->inlineScript()->captureStart();
45
echo <<<JS
46
 
47
 
48
jQuery( document ).ready(function( $ ) {
49
 
50
    var allowAdd = $allowAdd;
51
    var allowDelete = $allowDelete
52
 
53
        var gridTable = $('#gridTable').dataTable( {
54
            'processing': true,
55
            'serverSide': true,
56
            'searching': true,
57
            'order': [[ 1, 'asc' ]],
58
            'ordering':  true,
59
            'ordenable' : true,
60
            'responsive': true,
61
            'select' : false,
62
        	'paging': true,
63
            'pagingType': 'simple_numbers',
64
            'lengthMenu': [ [10, 25, 50, -1], [10, 25, 50, 'All'] ],
65
 
66
    		'ajax': {
67
    			'url' : '$routeDatatable',
68
    			'type' : 'get',
69
                'data': function ( d ) {
70
                    d.vacancy_uuid = $('#form-filter #form_uuid').val();
71
 
72
                },
73
                'beforeSend': function (request) {
74
                  NProgress.start();
75
                },
76
                'dataFilter': function(response) {
77
                    var response = jQuery.parseJSON( response );
78
 
79
                    var json                = {};
80
                    json.recordsTotal       = 0;
81
                    json.recordsFiltered    = 0;
82
                    json.data               = [];
83
 
84
                    if(response.success) {
85
                                               json.recordsTotal       = response.data.total;
86
                        json.recordsFiltered    = response.data.total;
87
                        json.data               = response.data.items;
88
                    } else {
89
                        $.fn.showError(response.data)
90
                    }
91
 
92
                    return JSON.stringify( json );
93
                }
94
    		},
95
            'language' : {
96
                'sProcessing':     'LABEL_DATATABLE_SPROCESSING',
97
                'sLengthMenu':     'LABEL_DATATABLE_SLENGTHMENU',
98
                'sZeroRecords':    'LABEL_DATATABLE_SZERORECORDS',
99
                'sEmptyTable':     'LABEL_DATATABLE_SEMPTYTABLE',
100
                'sInfo':           'LABEL_DATATABLE_SINFO',
101
                'sInfoEmpty':      'LABEL_DATATABLE_SINFOEMPTY',
102
                'sInfoFiltered':   'LABEL_DATATABLE_SINFOFILTERED',
103
                'sInfoPostFix':    '',
104
                'sSearch':         'LABEL_DATATABLE_SSEARCH',
105
                'sUrl':            '',
106
                'sInfoThousands':  ',',
107
                'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
108
                'oPaginate': {
109
                    'sFirst':    'LABEL_DATATABLE_SFIRST',
110
                    'sLast':     'LABEL_DATATABLE_SLAST',
111
                    'sNext':     'LABEL_DATATABLE_SNEXT',
112
                    'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
113
                },
114
                'oAria': {
115
                    'sSortAscending':  ': LABEL_DATATABLE_SSORTASCENDING',
116
                    'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
117
                },
118
            },
119
            'drawCallback': function( settings ) {
120
                NProgress.done();
121
                $('button.btn-delete').confirmation({
122
                    rootSelector: 'button.btn-delete',
123
                    title : 'LABEL_ARE_YOU_SURE',
124
                    singleton : true,
125
                    btnOkLabel: 'LABEL_YES',
126
                    btnCancelLabel: 'LABEL_NO',
127
                    onConfirm: function(value) {
128
                        action = $(this).data('href');
129
                        NProgress.start();
130
                        $.ajax({
131
                            'dataType'  : 'json',
132
                            'accept'    : 'application/json',
133
                            'method'    : 'post',
134
                            'url'       :  action,
135
                        }).done(function(response) {
136
                            if(response['success']) {
137
                                $.fn.showSuccess(response['data']);
138
                                gridTable.api().ajax.reload(null, false);
139
                            } else {
140
                                $.fn.showError(response['data']);
141
                            }
142
                        }).fail(function( jqXHR, textStatus, errorThrown) {
143
                            $.fn.showError(textStatus);
144
                        }).always(function() {
145
                            NProgress.done();
146
                        });
147
                    },
148
                });
149
 
1484 eleazar 150
 /*               $('#form-add #file').fileinput({
151
                    theme: 'fas',
152
                    language: 'es',
153
                    showUpload: false,
154
                    dropZoneEnabled: false,
155
                    maxFileCount: 1,
156
                    allowedFileExtensions: ['pdf', 'docx'],
157
                    msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $image_size',
1481 eleazar 158
                });
159
 
1484 eleazar 160
                $('body').on('click', 'button.btn-add', function(e) {
161
                     e.preventDefault();
162
 
163
 
164
                     $('#form-add #first_name').val('');
165
                     $('#form-add #last_name').val('');
166
                     $('#form-add #email').val('');
167
                     $('#form-add #file').fileinput('reset');
168
                     validatorAdd.resetForm();
169
 
170
                     $('#add-job-box').modal('show');
171
                     return false;
172
                    });*/
173
 
1481 eleazar 174
            },
175
            'aoColumns': [
176
                { 'mDataProp': 'first_name' },
177
                { 'mDataProp': 'last_name' },
178
                { 'mDataProp': 'email' },
179
                { 'mDataProp': 'actions' },
180
    	    ],
181
            'columnDefs': [
182
 
183
 
184
                {
185
                    'targets': -1,
186
                    'orderable': false,
187
                    'render' : function ( data, type, row ) {
188
                        s = '';
189
 
190
                        if(allowDelete && data['link_delete']  ) {
191
                            s = s + '<button class="btn btn-danger btn-sm btn-delete" data-href="' + data['link_delete']+ '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-times"></i> LABEL_DELETE </button>&nbsp;';
192
                        }
193
 
194
                        if(allowAdd && data['link_add']  ) {
195
                            s = s + '<button class="btn btn-primary btn-sm btn-add" data-href="' + data['link_add']+ '" data-toggle="tooltip" title="LABEL_ADD"><i class="fa fa-plus"></i> LABEL_ADD </button>&nbsp;';
196
                        }
197
 
198
                        return s;
199
                    }
200
                }
201
              ],
202
        });
203
 
204
    $('#form-filter #form_uuid').change(function(e) {
205
        e.preventDefault();
206
 
207
        gridTable.api().ajax.reload(null, false);
208
    })
209
 
210
 
211
    $('body').on('click', 'button.btn-refresh', function(e) {
212
        e.preventDefault();
213
        gridTable.api().ajax.reload(null, false);
214
    });
215
});
216
JS;
217
$this->inlineScript()->captureEnd();
218
?>
219
 
220
 
221
<!-- Content Header (Page header) -->
222
<section class="content-header">
223
	<div class="container-fluid">
224
    	<div class="row mb-2">
225
        	<div class="col-sm-12">
226
            	<h1>LABEL_CANDIDATES</h1>
227
			</div>
228
		</div>
229
	</div><!-- /.container-fluid -->
230
</section>
231
 
232
<section class="content">
233
	<div class="container-fluid">
234
    	<div class="row">
235
        	<div class="col-12">
236
				<div class="card">
237
					<div class="card-header">
238
						<?php
239
                        $form = $this->form;
240
            	        $form->setAttributes([
241
                            'name'    => 'form-filter',
242
                            'id'      => 'form-filter',
243
                        ]);
244
 
245
                        $form->prepare();
246
                        echo $this->form()->openTag($form);
247
                        ?>
248
                        <div class="row">
249
                            <div class="col-md-6 col-sm-12">
250
                                <div class="form-group">
251
                                    <?php
252
                                    $element = $form->get('form_uuid');
253
 
1484 eleazar 254
                                    $element->setOptions(['label' => 'LABEL_VACANCIES']);
1481 eleazar 255
 
256
                                    $element->setAttributes(['class' => 'form-control']);
257
                                    echo $this->formLabel($element);
258
                                    echo $this->formSelect($element);
259
                                    ?>
260
                                </div>
261
                            </div>
262
 
263
                        </div>
264
						<?php echo $this->form()->closeTag($form); ?>
265
					</div>
266
					<div class="card-body">
267
        	    		<table id="gridTable" class="table   table-hover">
268
                      		<thead>
269
        						<tr>
270
                                	<th>LABEL_FIRST_NAME</th>
271
                                	<th>LABEL_LAST_NAME</th>
272
                                	<th>LABEL_EMAIL</th>
273
                                  	<th>LABEL_ACTIONS</th>
274
                                </tr>
275
                       		</thead>
276
                         	<tbody>
277
                         	</tbody>
278
                    	</table>
279
                   	</div>
1483 eleazar 280
                       <div class="card-footer clearfix">
281
                       		<div style="float:right;">
282
    							<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
283
    							<?php if($allowAdd) : ?>
284
    							<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
285
    							<?php endif; ?>
286
    						</div>
287
                     	</div>
1481 eleazar 288
          		</div>
289
           	</div>
290
        </div>
291
 	</div>
292
</section>