15542 |
efrain |
1 |
<?php
|
|
|
2 |
$acl = $this->viewModel()->getRoot()->getVariable('acl');
|
|
|
3 |
$currentUser = $this->currentUserHelper();
|
|
|
4 |
|
|
|
5 |
$roleName = $currentUser->getUserTypeId();
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
$routeAdd = $this->url('engagement/rewards/add');
|
|
|
12 |
$routeDatatable = $this->url('engagement/rewards');
|
|
|
13 |
|
|
|
14 |
$allowAdd = $acl->isAllowed($roleName, 'engagement/rewards/add') ? 1 : 0;
|
|
|
15 |
$allowEdit = $acl->isAllowed($roleName, 'engagement/rewards/edit') ? 1 : 0;
|
|
|
16 |
$allowDelete = $acl->isAllowed($roleName, 'engagement/rewards/delete') ? 1 : 0;
|
|
|
17 |
|
|
|
18 |
|
16822 |
efrain |
19 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
|
|
|
20 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
|
15542 |
efrain |
21 |
|
16822 |
efrain |
22 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/jquery.validate.js'));
|
|
|
23 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/additional-methods.js'));
|
|
|
24 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/localization/messages_es.js'));
|
15542 |
efrain |
25 |
|
16822 |
efrain |
26 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.css'));
|
15542 |
efrain |
27 |
|
16822 |
efrain |
28 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net/jquery.dataTables.js'));
|
|
|
29 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.js'));
|
15542 |
efrain |
30 |
|
|
|
31 |
|
16822 |
efrain |
32 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/css/fileinput.min.css'));
|
|
|
33 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fas/theme.css'));
|
15542 |
efrain |
34 |
|
16843 |
efrain |
35 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/piexif.js'));
|
|
|
36 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/sortable.js'));
|
16822 |
efrain |
37 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/fileinput.js'));
|
|
|
38 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/locales/es.js'));
|
|
|
39 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/fas/theme.js'));
|
|
|
40 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fas/theme.js'));
|
15542 |
efrain |
41 |
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
|
16822 |
efrain |
45 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
|
|
|
46 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
|
15542 |
efrain |
47 |
|
|
|
48 |
|
|
|
49 |
|
|
|
50 |
|
16822 |
efrain |
51 |
|
|
|
52 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-input-number/input-number-format.jquery.js'));
|
|
|
53 |
|
15542 |
efrain |
54 |
$status_active = \LeadersLinked\Model\DailyPulseEmoji::STATUS_ACTIVE;
|
|
|
55 |
|
|
|
56 |
$this->inlineScript()->captureStart();
|
|
|
57 |
echo <<<JS
|
|
|
58 |
jQuery( document ).ready(function( $ ) {
|
|
|
59 |
|
|
|
60 |
$.validator.setDefaults({
|
|
|
61 |
debug: true,
|
|
|
62 |
highlight: function(element) {
|
|
|
63 |
$(element).addClass('is-invalid');
|
|
|
64 |
},
|
|
|
65 |
unhighlight: function(element) {
|
|
|
66 |
$(element).removeClass('is-invalid');
|
|
|
67 |
},
|
|
|
68 |
errorElement: 'span',
|
|
|
69 |
errorClass: 'error invalid-feedback',
|
|
|
70 |
errorPlacement: function(error, element) {
|
|
|
71 |
if(element.parent('.form-group').length) {
|
|
|
72 |
error.insertAfter(element);
|
|
|
73 |
} else if(element.parent('.toggle').length) {
|
|
|
74 |
error.insertAfter(element.parent().parent());
|
|
|
75 |
} else {
|
|
|
76 |
error.insertAfter(element.parent());
|
|
|
77 |
}
|
|
|
78 |
}
|
|
|
79 |
});
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
$.fn.showFormErrorValidator = function(fieldname, errors) {
|
|
|
83 |
var field = $(fieldname);
|
|
|
84 |
if(field) {
|
|
|
85 |
$(field).addClass('is-invalid');
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
|
|
|
89 |
if(field.parent('.form-group').length) {
|
|
|
90 |
error.insertAfter(field);
|
|
|
91 |
} else if(field.parent('.toggle').length) {
|
|
|
92 |
error.insertAfter(field.parent().parent());
|
|
|
93 |
} else {
|
|
|
94 |
error.insertAfter(field.parent());
|
|
|
95 |
}
|
|
|
96 |
}
|
|
|
97 |
};
|
|
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
var allowEdit = $allowEdit;
|
|
|
103 |
var allowDelete = $allowDelete;
|
|
|
104 |
|
|
|
105 |
var gridTable = $('#gridTable').dataTable( {
|
|
|
106 |
'processing': true,
|
|
|
107 |
'serverSide': true,
|
|
|
108 |
'searching': true,
|
|
|
109 |
'order': [[ 0, 'asc' ]],
|
|
|
110 |
'ordering': true,
|
|
|
111 |
'ordenable' : true,
|
|
|
112 |
'responsive': true,
|
|
|
113 |
'select' : false,
|
|
|
114 |
'paging': true,
|
|
|
115 |
'pagingType': 'simple_numbers',
|
|
|
116 |
'ajax': {
|
|
|
117 |
'url' : '$routeDatatable',
|
|
|
118 |
'type' : 'get',
|
|
|
119 |
'beforeSend': function (request) {
|
|
|
120 |
NProgress.start();
|
|
|
121 |
},
|
|
|
122 |
'dataFilter': function(response) {
|
|
|
123 |
var response = jQuery.parseJSON( response );
|
|
|
124 |
|
|
|
125 |
var json = {};
|
|
|
126 |
json.recordsTotal = 0;
|
|
|
127 |
json.recordsFiltered = 0;
|
|
|
128 |
json.data = [];
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
if(response.success) {
|
|
|
132 |
json.recordsTotal = response.data.total;
|
|
|
133 |
json.recordsFiltered = response.data.total;
|
|
|
134 |
json.data = response.data.items;
|
|
|
135 |
} else {
|
|
|
136 |
$.fn.showError(response.data)
|
|
|
137 |
}
|
|
|
138 |
|
|
|
139 |
return JSON.stringify( json );
|
|
|
140 |
}
|
|
|
141 |
},
|
|
|
142 |
'language' : {
|
|
|
143 |
'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
|
|
|
144 |
'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
|
|
|
145 |
'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
|
|
|
146 |
'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
|
|
|
147 |
'sInfo': 'LABEL_DATATABLE_SINFO',
|
|
|
148 |
'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
|
|
|
149 |
'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
|
|
|
150 |
'sInfoPostFix': '',
|
|
|
151 |
'sSearch': 'LABEL_DATATABLE_SSEARCH',
|
|
|
152 |
'sUrl': '',
|
|
|
153 |
'sInfoThousands': ',',
|
|
|
154 |
'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
|
|
|
155 |
'oPaginate': {
|
|
|
156 |
'sFirst': 'LABEL_DATATABLE_SFIRST',
|
|
|
157 |
'sLast': 'LABEL_DATATABLE_SLAST',
|
|
|
158 |
'sNext': 'LABEL_DATATABLE_SNEXT',
|
|
|
159 |
'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
|
|
|
160 |
},
|
|
|
161 |
'oAria': {
|
|
|
162 |
'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
|
|
|
163 |
'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
|
|
|
164 |
},
|
|
|
165 |
},
|
|
|
166 |
'drawCallback': function( settings ) {
|
|
|
167 |
NProgress.done();
|
16822 |
efrain |
168 |
|
15542 |
efrain |
169 |
},
|
|
|
170 |
'aoColumns': [
|
|
|
171 |
{ 'mDataProp': 'name' },
|
|
|
172 |
{ 'mDataProp': 'points' },
|
|
|
173 |
{ 'mDataProp': 'status' },
|
|
|
174 |
{ 'mDataProp': 'image' },
|
|
|
175 |
{ 'mDataProp': 'actions' },
|
|
|
176 |
],
|
|
|
177 |
'columnDefs': [
|
|
|
178 |
{
|
|
|
179 |
'targets': 0,
|
|
|
180 |
'className' : 'text-vertical-middle',
|
|
|
181 |
},
|
|
|
182 |
{
|
|
|
183 |
'targets': 1,
|
|
|
184 |
'className' : 'text-right text-vertical-middle',
|
|
|
185 |
},
|
|
|
186 |
{
|
|
|
187 |
'targets': 2,
|
|
|
188 |
'orderable': false,
|
|
|
189 |
'className' : 'text-center',
|
|
|
190 |
'render' : function ( data, type, row ) {
|
|
|
191 |
|
16822 |
efrain |
192 |
checked = data == 'a' ? 'checked' : '';
|
|
|
193 |
return '<div class="form-check">' +
|
|
|
194 |
'<input type="checkbox" class="form-check-input" disabled="" checked="' + checked + '">' +
|
|
|
195 |
'<label class="form-check-label" for="checkCheckedDisabled"></label></div>' ;
|
15542 |
efrain |
196 |
}
|
|
|
197 |
},
|
|
|
198 |
{
|
|
|
199 |
'targets': 3,
|
|
|
200 |
'orderable': false,
|
|
|
201 |
'render' : function ( data, type, row ) {
|
|
|
202 |
s = '';
|
|
|
203 |
|
|
|
204 |
if( data ) {
|
|
|
205 |
s = '<img src="' + data + '" style="width:128px; height:auto">';
|
|
|
206 |
}
|
|
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
|
210 |
return s;
|
|
|
211 |
}
|
|
|
212 |
},
|
|
|
213 |
{
|
|
|
214 |
'targets': 4,
|
|
|
215 |
'orderable': false,
|
|
|
216 |
'render' : function ( data, type, row ) {
|
|
|
217 |
s = '';
|
|
|
218 |
|
|
|
219 |
if(allowEdit && data['link_edit']) {
|
|
|
220 |
s = s + '<button class="btn btn-primary btn-edit" data-href="' + data['link_edit']+ '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button> ';
|
|
|
221 |
}
|
|
|
222 |
if(allowDelete && data['link_delete']) {
|
|
|
223 |
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> ';
|
|
|
224 |
}
|
|
|
225 |
return s;
|
|
|
226 |
}
|
|
|
227 |
}
|
|
|
228 |
],
|
|
|
229 |
});
|
|
|
230 |
|
|
|
231 |
|
|
|
232 |
var validatorAdd = $('#form-add').validate({
|
|
|
233 |
debug: true,
|
|
|
234 |
onclick: false,
|
|
|
235 |
onkeyup: false,
|
|
|
236 |
ignore: [],
|
|
|
237 |
rules: {
|
|
|
238 |
'name': {
|
|
|
239 |
required: true,
|
|
|
240 |
maxlength: 128,
|
|
|
241 |
},
|
|
|
242 |
'points': {
|
|
|
243 |
required: true,
|
|
|
244 |
min: 0,
|
|
|
245 |
|
|
|
246 |
},
|
|
|
247 |
|
|
|
248 |
'image': {
|
|
|
249 |
required: true,
|
|
|
250 |
extension: 'jpg|jpeg|png',
|
|
|
251 |
accept: 'image/jpg,image/jpeg,image/png'
|
|
|
252 |
},
|
|
|
253 |
'status': {
|
|
|
254 |
required: false,
|
|
|
255 |
|
|
|
256 |
},
|
|
|
257 |
},
|
|
|
258 |
submitHandler: function(form)
|
|
|
259 |
{
|
|
|
260 |
var formdata = false;
|
|
|
261 |
if (window.FormData){
|
|
|
262 |
formdata = new FormData(form); //form[0]);
|
|
|
263 |
}
|
|
|
264 |
|
|
|
265 |
|
|
|
266 |
$.ajax({
|
|
|
267 |
'dataType' : 'json',
|
|
|
268 |
'accept' : 'application/json',
|
|
|
269 |
'method' : 'post',
|
|
|
270 |
'url' : $('#form-add').attr('action'),
|
|
|
271 |
'data' : formdata ? formdata : $('#form-add').serialize(),
|
|
|
272 |
'processData': false,
|
|
|
273 |
'contentType': false,
|
|
|
274 |
}).done(function(response) {
|
|
|
275 |
NProgress.start();
|
|
|
276 |
if(response['success']) {
|
|
|
277 |
$.fn.showSuccess(response['data']);
|
|
|
278 |
|
|
|
279 |
$('#modal-add').modal('hide');
|
|
|
280 |
|
|
|
281 |
|
|
|
282 |
gridTable.api().ajax.reload(null, false);
|
|
|
283 |
} else {
|
|
|
284 |
validatorAdd.resetForm();
|
|
|
285 |
if(jQuery.type(response['data']) == 'string') {
|
|
|
286 |
$.fn.showError(response['data']);
|
|
|
287 |
} else {
|
|
|
288 |
$.each(response['data'], function( fieldname, errors ) {
|
|
|
289 |
$.fn.showFormErrorValidator('#form-add #' + fieldname, errors);
|
|
|
290 |
});
|
|
|
291 |
}
|
|
|
292 |
}
|
|
|
293 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
294 |
$.fn.showError(textStatus);
|
|
|
295 |
}).always(function() {
|
|
|
296 |
NProgress.done();
|
|
|
297 |
});
|
|
|
298 |
return false;
|
|
|
299 |
},
|
|
|
300 |
invalidHandler: function(form, validator) {
|
|
|
301 |
}
|
|
|
302 |
});
|
|
|
303 |
|
|
|
304 |
var validatorEdit = $('#form-edit').validate({
|
|
|
305 |
debug: true,
|
|
|
306 |
onclick: false,
|
|
|
307 |
onkeyup: false,
|
|
|
308 |
ignore: [],
|
|
|
309 |
rules: {
|
|
|
310 |
'name': {
|
|
|
311 |
required: true,
|
|
|
312 |
maxlength: 128,
|
|
|
313 |
},
|
|
|
314 |
'points': {
|
|
|
315 |
required: true,
|
|
|
316 |
min: 0,
|
|
|
317 |
|
|
|
318 |
},
|
|
|
319 |
|
|
|
320 |
'image': {
|
|
|
321 |
required: false,
|
|
|
322 |
extension: 'jpg|jpeg|png',
|
|
|
323 |
accept: 'image/jpg,image/jpeg,image/png'
|
|
|
324 |
},
|
|
|
325 |
'status': {
|
|
|
326 |
required: false,
|
|
|
327 |
|
|
|
328 |
},
|
|
|
329 |
},
|
|
|
330 |
submitHandler: function(form)
|
|
|
331 |
{
|
|
|
332 |
var formdata = false;
|
|
|
333 |
if (window.FormData){
|
|
|
334 |
formdata = new FormData(form); //form[0]);
|
|
|
335 |
}
|
|
|
336 |
|
|
|
337 |
|
|
|
338 |
$.ajax({
|
|
|
339 |
'dataType' : 'json',
|
|
|
340 |
'accept' : 'application/json',
|
|
|
341 |
'method' : 'post',
|
|
|
342 |
'url' : $('#form-edit').attr('action'),
|
|
|
343 |
'data' : formdata ? formdata : $('#form-edit').serialize(),
|
|
|
344 |
'processData': false,
|
|
|
345 |
'contentType': false,
|
|
|
346 |
}).done(function(response) {
|
|
|
347 |
NProgress.start();
|
|
|
348 |
if(response['success']) {
|
|
|
349 |
$.fn.showSuccess(response['data']);
|
|
|
350 |
|
|
|
351 |
$('#modal-edit').modal('hide');
|
|
|
352 |
|
|
|
353 |
|
|
|
354 |
gridTable.api().ajax.reload(null, false);
|
|
|
355 |
} else {
|
|
|
356 |
validatorEdit.resetForm();
|
|
|
357 |
if(jQuery.type(response['data']) == 'string') {
|
|
|
358 |
$.fn.showError(response['data']);
|
|
|
359 |
} else {
|
|
|
360 |
$.each(response['data'], function( fieldname, errors ) {
|
|
|
361 |
$.fn.showFormErrorValidator('#form-edit #' + fieldname, errors);
|
|
|
362 |
});
|
|
|
363 |
}
|
|
|
364 |
}
|
|
|
365 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
366 |
$.fn.showError(textStatus);
|
|
|
367 |
}).always(function() {
|
|
|
368 |
NProgress.done();
|
|
|
369 |
});
|
|
|
370 |
return false;
|
|
|
371 |
},
|
|
|
372 |
invalidHandler: function(form, validator) {
|
|
|
373 |
}
|
|
|
374 |
});
|
|
|
375 |
|
|
|
376 |
$('body').on('click', 'button.btn-add', function(e) {
|
|
|
377 |
e.preventDefault();
|
|
|
378 |
|
|
|
379 |
|
|
|
380 |
$('#form-add #status').bootstrapToggle('on')
|
|
|
381 |
$('#form-add #points').val('0');
|
|
|
382 |
$('#form-add #name').val('');
|
|
|
383 |
$('#form-add #image').fileinput('reset');
|
|
|
384 |
$('#form-add #image').val('');
|
|
|
385 |
|
|
|
386 |
validatorAdd.resetForm();
|
|
|
387 |
$('#modal-add').modal('show');
|
|
|
388 |
|
|
|
389 |
});
|
|
|
390 |
|
|
|
391 |
$('body').on('click', 'button.btn-edit', function(e) {
|
|
|
392 |
e.preventDefault();
|
|
|
393 |
NProgress.start();
|
|
|
394 |
var action = $(this).data('href');
|
|
|
395 |
|
|
|
396 |
$.ajax({
|
|
|
397 |
'dataType' : 'json',
|
|
|
398 |
'method' : 'get',
|
|
|
399 |
'url' : action,
|
|
|
400 |
}).done(function(response) {
|
|
|
401 |
if(response['success']) {
|
|
|
402 |
|
|
|
403 |
$('#form-edit').attr('action', action);
|
|
|
404 |
$('#form-edit #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
|
|
|
405 |
$('#form-edit #points').val(response['data']['points']);
|
|
|
406 |
$('#form-edit #name').val(response['data']['name']);
|
|
|
407 |
$('#form-edit #image').fileinput('reset');
|
|
|
408 |
$('#form-edit #image').val('');
|
|
|
409 |
|
|
|
410 |
validatorEdit.resetForm();
|
|
|
411 |
|
|
|
412 |
$('#modal-edit').modal('show');
|
|
|
413 |
} else {
|
|
|
414 |
$.fn.showError(response['data']);
|
|
|
415 |
}
|
|
|
416 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
417 |
$.fn.showError(textStatus);
|
|
|
418 |
}).always(function() {
|
|
|
419 |
NProgress.done();
|
|
|
420 |
});
|
|
|
421 |
});
|
|
|
422 |
|
|
|
423 |
$('body').on('click', 'button.btn-refresh', function(e) {
|
|
|
424 |
e.preventDefault();
|
|
|
425 |
gridTable.api().ajax.reload(null, false);
|
|
|
426 |
});
|
16822 |
efrain |
427 |
|
|
|
428 |
$('body').on('click', 'button.btn-delete', function(e) {
|
|
|
429 |
e.preventDefault();
|
|
|
430 |
var action = $(this).data('href');
|
|
|
431 |
|
|
|
432 |
|
|
|
433 |
swal.fire({
|
|
|
434 |
title: 'LABEL_ARE_YOU_SURE',
|
|
|
435 |
icon: 'question',
|
|
|
436 |
cancelButtonText: 'LABEL_NO',
|
|
|
437 |
showCancelButton: true,
|
|
|
438 |
confirmButtonText: 'LABEL_YES'
|
|
|
439 |
}).then((result) => {
|
|
|
440 |
if (result.isConfirmed) {
|
|
|
441 |
|
|
|
442 |
NProgress.start();
|
|
|
443 |
$.ajax({
|
|
|
444 |
'dataType' : 'json',
|
|
|
445 |
'accept' : 'application/json',
|
|
|
446 |
'method' : 'post',
|
|
|
447 |
'url' : action,
|
|
|
448 |
}).done(function(response) {
|
|
|
449 |
if(response['success']) {
|
|
|
450 |
$.fn.showSuccess(response['data']);
|
|
|
451 |
gridTable.api().ajax.reload(null, false);
|
|
|
452 |
} else {
|
|
|
453 |
$.fn.showError(response['data']);
|
|
|
454 |
}
|
|
|
455 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
456 |
$.fn.showError(textStatus);
|
|
|
457 |
}).always(function() {
|
|
|
458 |
NProgress.done();
|
|
|
459 |
});
|
|
|
460 |
}
|
|
|
461 |
});
|
|
|
462 |
});
|
15542 |
efrain |
463 |
|
|
|
464 |
|
|
|
465 |
$('body').on('click', 'button.btn-cancel', function(e) {
|
|
|
466 |
e.preventDefault();
|
|
|
467 |
$('#modal-add').modal('hide');
|
|
|
468 |
$('#modal-edit').modal('hide');
|
|
|
469 |
});
|
|
|
470 |
|
|
|
471 |
|
|
|
472 |
$('#form-add #status').bootstrapToggle({'on' : 'LABEL_ACTIVE', 'off' : 'LABEL_INACTIVE', 'width' : '160px', 'height' : '40px'});
|
|
|
473 |
$('#form-edit #status').bootstrapToggle({'on' : 'LABEL_ACTIVE', 'off' : 'LABEL_INACTIVE', 'width' : '160px', 'height' : '40px'});
|
|
|
474 |
|
|
|
475 |
$('#form-add #points').inputNumberFormat({decimal: 0});
|
|
|
476 |
$('#form-add #image').fileinput({
|
|
|
477 |
theme: 'fa',
|
|
|
478 |
language: 'es',
|
|
|
479 |
showUpload: false,
|
|
|
480 |
dropZoneEnabled: false,
|
|
|
481 |
maxFileCount: 1,
|
|
|
482 |
placeholder: 'LABEL_RECOMMENDED_SIZE $targetSize',
|
|
|
483 |
allowedFileExtensions: ['jpeg', 'jpg', 'png'],
|
|
|
484 |
});
|
|
|
485 |
|
|
|
486 |
$('#form-edit #image').fileinput({
|
|
|
487 |
theme: 'fa',
|
|
|
488 |
language: 'es',
|
|
|
489 |
showUpload: false,
|
|
|
490 |
dropZoneEnabled: false,
|
|
|
491 |
maxFileCount: 1,
|
|
|
492 |
placeholder: 'LABEL_RECOMMENDED_SIZE $targetSize',
|
|
|
493 |
allowedFileExtensions: ['jpeg', 'jpg', 'png'],
|
|
|
494 |
});
|
|
|
495 |
|
|
|
496 |
|
|
|
497 |
});
|
|
|
498 |
JS;
|
|
|
499 |
$this->inlineScript()->captureEnd();
|
|
|
500 |
?>
|
|
|
501 |
|
|
|
502 |
|
16822 |
efrain |
503 |
<div class="container">
|
15542 |
efrain |
504 |
<div class="row">
|
16891 |
efrain |
505 |
<div class="col-12 mt-3">
|
15542 |
efrain |
506 |
<div class="card">
|
16822 |
efrain |
507 |
<h6 class="card-title">LABEL_ENGAGEMENT_REWARDS</h6>
|
15542 |
efrain |
508 |
<div class="card-body">
|
16845 |
efrain |
509 |
<table id="gridTable" class="table table-striped table-bordered">
|
15542 |
efrain |
510 |
<thead>
|
|
|
511 |
<tr>
|
|
|
512 |
<th>LABEL_NAME</th>
|
|
|
513 |
<th>LABEL_POINTS</th>
|
|
|
514 |
<th>LABEL_STATUS</th>
|
|
|
515 |
<th>LABEL_IMAGE</th>
|
|
|
516 |
<th>LABEL_ACTIONS</th>
|
|
|
517 |
</tr>
|
|
|
518 |
</thead>
|
|
|
519 |
<tbody>
|
|
|
520 |
</tbody>
|
|
|
521 |
</table>
|
|
|
522 |
</div>
|
|
|
523 |
<div class="card-footer clearfix">
|
|
|
524 |
<div style="float:right;">
|
|
|
525 |
<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
|
|
|
526 |
<?php if ($allowAdd) : ?>
|
|
|
527 |
<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
|
|
|
528 |
<?php endif; ?>
|
|
|
529 |
|
|
|
530 |
</div>
|
|
|
531 |
</div>
|
|
|
532 |
</div>
|
|
|
533 |
</div>
|
|
|
534 |
</div>
|
16822 |
efrain |
535 |
</div>
|
15542 |
efrain |
536 |
|
|
|
537 |
<!-- The Modal -->
|
|
|
538 |
<div class="modal" id="modal-add">
|
|
|
539 |
<div class="modal-dialog modal-xl">
|
|
|
540 |
<div class="modal-content">
|
|
|
541 |
|
|
|
542 |
<!-- Modal Header -->
|
|
|
543 |
<div class="modal-header">
|
16845 |
efrain |
544 |
<h6 class="modal-title">LABEL_ENGAGEMENT_ADD_REWARD</h6>
|
16822 |
efrain |
545 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
|
15542 |
efrain |
546 |
</div>
|
|
|
547 |
|
|
|
548 |
<!-- Modal body -->
|
|
|
549 |
<div class="modal-body">
|
|
|
550 |
<?php
|
|
|
551 |
$form = $this->formAdd;
|
|
|
552 |
$form->setAttributes([
|
|
|
553 |
'method' => 'post',
|
|
|
554 |
'name' => 'form-add',
|
|
|
555 |
'id' => 'form-add',
|
|
|
556 |
'action' => $routeAdd,
|
|
|
557 |
]);
|
|
|
558 |
|
|
|
559 |
$form->prepare();
|
|
|
560 |
echo $this->form()->openTag($form);
|
|
|
561 |
?>
|
|
|
562 |
<div class="form-group">
|
|
|
563 |
<?php
|
|
|
564 |
$element = $form->get('name');
|
|
|
565 |
$element->setOptions(['label' => 'LABEL_NAME']);
|
|
|
566 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
567 |
|
|
|
568 |
echo $this->formLabel($element);
|
|
|
569 |
echo $this->formText($element);
|
|
|
570 |
?>
|
|
|
571 |
</div>
|
|
|
572 |
<div class="form-group">
|
|
|
573 |
<?php
|
|
|
574 |
$element = $form->get('points');
|
|
|
575 |
$element->setOptions(['label' => 'LABEL_POINTS']);
|
|
|
576 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
577 |
|
|
|
578 |
echo $this->formLabel($element);
|
|
|
579 |
echo $this->formNumber($element);
|
|
|
580 |
?>
|
|
|
581 |
</div>
|
|
|
582 |
<div class="form-group">
|
|
|
583 |
<?php
|
|
|
584 |
|
|
|
585 |
$element = $form->get('status');
|
|
|
586 |
$element->setOptions(['label' => 'LABEL_STATUS']);
|
|
|
587 |
|
|
|
588 |
echo $this->formLabel($element);
|
|
|
589 |
echo '<br/>';
|
|
|
590 |
echo $this->formCheckbox($element);
|
|
|
591 |
?>
|
|
|
592 |
</div>
|
|
|
593 |
<div class="form-group">
|
|
|
594 |
<?php
|
|
|
595 |
$element = $form->get('image');
|
|
|
596 |
$element->setOptions(['label' => 'LABEL_IMAGE']);
|
|
|
597 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
598 |
|
|
|
599 |
echo $this->formLabel($element);
|
|
|
600 |
echo $this->formFile($element);
|
|
|
601 |
?>
|
|
|
602 |
</div>
|
|
|
603 |
<div class="text-right">
|
|
|
604 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
|
|
605 |
<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
|
|
|
606 |
</div>
|
|
|
607 |
<?php echo $this->form()->closeTag($form); ?>
|
|
|
608 |
</div>
|
|
|
609 |
|
|
|
610 |
|
|
|
611 |
</div>
|
|
|
612 |
</div>
|
|
|
613 |
</div>
|
|
|
614 |
|
|
|
615 |
<!-- The Modal -->
|
|
|
616 |
<div class="modal" id="modal-edit">
|
|
|
617 |
<div class="modal-dialog modal-xl">
|
|
|
618 |
<div class="modal-content">
|
|
|
619 |
|
|
|
620 |
<!-- Modal Header -->
|
|
|
621 |
<div class="modal-header">
|
16845 |
efrain |
622 |
<h6 class="modal-title">LABEL_ENGAGEMENT_EDIT_REWARD</h6>
|
16822 |
efrain |
623 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
|
15542 |
efrain |
624 |
</div>
|
|
|
625 |
|
|
|
626 |
<!-- Modal body -->
|
|
|
627 |
<div class="modal-body">
|
|
|
628 |
<?php
|
|
|
629 |
$form = $this->formEdit;
|
|
|
630 |
$form->setAttributes([
|
|
|
631 |
'method' => 'post',
|
|
|
632 |
'name' => 'form-edit',
|
|
|
633 |
'id' => 'form-edit'
|
|
|
634 |
]);
|
|
|
635 |
|
|
|
636 |
$form->prepare();
|
|
|
637 |
echo $this->form()->openTag($form);
|
|
|
638 |
?>
|
|
|
639 |
<div class="form-group">
|
|
|
640 |
<?php
|
|
|
641 |
$element = $form->get('name');
|
|
|
642 |
$element->setOptions(['label' => 'LABEL_NAME']);
|
|
|
643 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
644 |
|
|
|
645 |
echo $this->formLabel($element);
|
|
|
646 |
echo $this->formText($element);
|
|
|
647 |
?>
|
|
|
648 |
</div>
|
|
|
649 |
<div class="form-group">
|
|
|
650 |
<?php
|
|
|
651 |
$element = $form->get('points');
|
|
|
652 |
$element->setOptions(['label' => 'LABEL_POINTS']);
|
|
|
653 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
654 |
|
|
|
655 |
echo $this->formLabel($element);
|
|
|
656 |
echo $this->formNumber($element);
|
|
|
657 |
?>
|
|
|
658 |
</div>
|
|
|
659 |
<div class="form-group">
|
|
|
660 |
<?php
|
|
|
661 |
|
|
|
662 |
$element = $form->get('status');
|
|
|
663 |
$element->setOptions(['label' => 'LABEL_STATUS']);
|
|
|
664 |
|
|
|
665 |
echo $this->formLabel($element);
|
|
|
666 |
echo '<br/>';
|
|
|
667 |
echo $this->formCheckbox($element);
|
|
|
668 |
?>
|
|
|
669 |
</div>
|
|
|
670 |
<div class="form-group">
|
|
|
671 |
<?php
|
|
|
672 |
$element = $form->get('image');
|
|
|
673 |
$element->setOptions(['label' => 'LABEL_IMAGE']);
|
|
|
674 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
675 |
|
|
|
676 |
echo $this->formLabel($element);
|
|
|
677 |
echo $this->formFile($element);
|
|
|
678 |
?>
|
|
|
679 |
</div>
|
|
|
680 |
<div class="text-right">
|
|
|
681 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
|
|
682 |
<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
|
|
|
683 |
</div>
|
|
|
684 |
<?php echo $this->form()->closeTag($form); ?>
|
|
|
685 |
</div>
|
|
|
686 |
|
|
|
687 |
|
|
|
688 |
</div>
|
|
|
689 |
</div>
|
|
|
690 |
</div>
|