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