Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 1484 | Rev 1486 | 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
 
1485 eleazar 150
                $('#form-add #file').fileinput({
1484 eleazar 151
                    theme: 'fas',
152
                    language: 'es',
153
                    showUpload: false,
154
                    dropZoneEnabled: false,
155
                    maxFileCount: 1,
156
                    allowedFileExtensions: ['pdf', 'docx'],
1481 eleazar 157
                });
158
 
1484 eleazar 159
                $('body').on('click', 'button.btn-add', function(e) {
160
                     e.preventDefault();
161
 
162
 
163
                     $('#form-add #first_name').val('');
164
                     $('#form-add #last_name').val('');
165
                     $('#form-add #email').val('');
166
                     $('#form-add #file').fileinput('reset');
167
                     validatorAdd.resetForm();
168
 
169
                     $('#add-job-box').modal('show');
170
                     return false;
1485 eleazar 171
                    });
1484 eleazar 172
 
1485 eleazar 173
                    $(".close-box, .btn-add-job-cancel").on("click", function(e){
174
                         e.preventDefault();
175
                         $('#add-job-box').modal('hide');
176
                         return false;
177
                    });
178
 
1481 eleazar 179
            },
180
            'aoColumns': [
181
                { 'mDataProp': 'first_name' },
182
                { 'mDataProp': 'last_name' },
183
                { 'mDataProp': 'email' },
184
                { 'mDataProp': 'actions' },
185
    	    ],
186
            'columnDefs': [
187
 
188
 
189
                {
190
                    'targets': -1,
191
                    'orderable': false,
192
                    'render' : function ( data, type, row ) {
193
                        s = '';
194
 
195
                        if(allowDelete && data['link_delete']  ) {
196
                            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;';
197
                        }
198
 
199
                        if(allowAdd && data['link_add']  ) {
200
                            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;';
201
                        }
202
 
203
                        return s;
204
                    }
205
                }
206
              ],
207
        });
208
 
209
    $('#form-filter #form_uuid').change(function(e) {
210
        e.preventDefault();
211
 
212
        gridTable.api().ajax.reload(null, false);
213
    })
214
 
215
 
216
    $('body').on('click', 'button.btn-refresh', function(e) {
217
        e.preventDefault();
218
        gridTable.api().ajax.reload(null, false);
219
    });
220
});
221
JS;
222
$this->inlineScript()->captureEnd();
223
?>
224
 
225
 
226
<!-- Content Header (Page header) -->
227
<section class="content-header">
228
	<div class="container-fluid">
229
    	<div class="row mb-2">
230
        	<div class="col-sm-12">
231
            	<h1>LABEL_CANDIDATES</h1>
232
			</div>
233
		</div>
234
	</div><!-- /.container-fluid -->
235
</section>
236
 
237
<section class="content">
238
	<div class="container-fluid">
239
    	<div class="row">
240
        	<div class="col-12">
241
				<div class="card">
242
					<div class="card-header">
243
						<?php
244
                        $form = $this->form;
245
            	        $form->setAttributes([
246
                            'name'    => 'form-filter',
247
                            'id'      => 'form-filter',
248
                        ]);
249
 
250
                        $form->prepare();
251
                        echo $this->form()->openTag($form);
252
                        ?>
253
                        <div class="row">
254
                            <div class="col-md-6 col-sm-12">
255
                                <div class="form-group">
256
                                    <?php
257
                                    $element = $form->get('form_uuid');
258
 
1484 eleazar 259
                                    $element->setOptions(['label' => 'LABEL_VACANCIES']);
1481 eleazar 260
 
261
                                    $element->setAttributes(['class' => 'form-control']);
262
                                    echo $this->formLabel($element);
263
                                    echo $this->formSelect($element);
264
                                    ?>
265
                                </div>
266
                            </div>
267
 
268
                        </div>
269
						<?php echo $this->form()->closeTag($form); ?>
270
					</div>
271
					<div class="card-body">
272
        	    		<table id="gridTable" class="table   table-hover">
273
                      		<thead>
274
        						<tr>
275
                                	<th>LABEL_FIRST_NAME</th>
276
                                	<th>LABEL_LAST_NAME</th>
277
                                	<th>LABEL_EMAIL</th>
278
                                  	<th>LABEL_ACTIONS</th>
279
                                </tr>
280
                       		</thead>
281
                         	<tbody>
282
                         	</tbody>
283
                    	</table>
284
                   	</div>
1483 eleazar 285
                       <div class="card-footer clearfix">
286
                       		<div style="float:right;">
287
    							<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
288
    							<?php if($allowAdd) : ?>
289
    							<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
290
    							<?php endif; ?>
291
    						</div>
292
                     	</div>
1481 eleazar 293
          		</div>
294
           	</div>
295
        </div>
296
 	</div>
297
</section>
1485 eleazar 298
<div class="modal" tabindex="-1" role="dialog" id="add-job-box">
299
	<div class="modal-dialog" role="document">
300
		<?php
301
	    $form = $this->formAdd;
302
	    $form->setAttributes([
303
	       'method'    => 'post',
304
	        'name'      => 'form-add',
305
	        'id'        => 'form-add'
306
	    ]);
307
	    $form->prepare();
308
	    echo $this->form()->openTag($form);
309
 
310
	    ?>
311
    	<div class="modal-content">
312
      		<div class="modal-header">
313
        		<h3 class="modal-title">LABEL_NEW_CANDIDATE</h3>
314
      		</div>
315
      		<div class="modal-body">
316
      			<div class="form-group">
317
    				<?php
318
                        $element = $form->get('first_name');
319
                        $element->setOptions(['label' => 'LABEL_FIRST_NAME']);
320
                        $element->setAttributes(['class' => 'form-control']);
321
                        echo $this->formLabel($element);
322
                        echo $this->formText($element);
323
                    ?>
324
				</div>
325
				<div class="form-group">
326
    				<?php
327
                        $element = $form->get('last_name');
328
                        $element->setOptions(['label' => 'LABEL_LAST_NAME']);
329
                        $element->setAttributes(['class' => 'form-control']);
330
                        echo $this->formLabel($element);
331
                        echo $this->formText($element);
332
                    ?>
333
				</div>
334
      			<div class="form-group">
335
    				<?php
336
                        $element = $form->get('email');
337
                        $element->setOptions(['label' => 'LABEL_EMAIL']);
338
                        $element->setAttributes(['class' => 'form-control']);
339
                        echo $this->formLabel($element);
340
                        echo $this->formText($element);
341
                    ?>
342
				</div>
343
 
344
				<div class="form-group">
345
    				<?php
346
                    $element = $form->get('file');
347
 
348
                    $element->setAttributes(['class' => 'form-control',  'accept' => 'pdf/docx']);
349
                    $element->setOptions(['label' => 'LABEL_CURRICULUM']);
350
                    echo $this->formLabel($element);
351
                    ?>
352
                    <div class="file-loading">
353
                    	<?php echo $this->formFile($element); ?>
354
				</div>
355
          	</div>
356
         	<div class="modal-footer">
357
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
358
    			<button type="button" class="btn btn-default btn-add-cancel">LABEL_CANCEL</button>
359
          	</div>
360
      	<?php echo $this->form()->closeTag($form); ?>
361
    	</div>
362
	</div>
363
</div>