| 6094 |
stevensc |
1 |
<?php
|
| 6001 |
efrain |
2 |
$acl = $this->viewModel()->getRoot()->getVariable('acl');
|
|
|
3 |
$currentUser = $this->currentUserHelper();
|
|
|
4 |
$roleName = $currentUser->getUserTypeId();
|
|
|
5 |
|
| 6056 |
efrain |
6 |
$routeAdd = $this->url('knowledge-area/add');
|
|
|
7 |
$allowAdd = $acl->isAllowed($roleName, 'knowledge-area/add') ? 1 : 0;
|
| 6001 |
efrain |
8 |
|
|
|
9 |
|
| 6056 |
efrain |
10 |
$route = $this->url('knowledge-area');
|
| 6001 |
efrain |
11 |
|
| 6056 |
efrain |
12 |
$this->inlineScript()->appendFile($this->basePath('vendors/ckeditor/ckeditor.js'));
|
|
|
13 |
|
|
|
14 |
$this->headLink()->appendStylesheet($this->basePath('vendors/nprogress/nprogress.css'));
|
|
|
15 |
$this->inlineScript()->appendFile($this->basePath('vendors/nprogress/nprogress.js'));
|
|
|
16 |
|
|
|
17 |
$this->headLink()->appendStylesheet($this->basePath('vendors/select2/css/select2.min.css'));
|
|
|
18 |
$this->headLink()->appendStylesheet($this->basePath('vendors/select2-bootstrap4-theme/select2-bootstrap4.min.css'));
|
|
|
19 |
$this->inlineScript()->appendFile($this->basePath('vendors/select2/js/select2.min.js'));
|
|
|
20 |
|
| 6001 |
efrain |
21 |
$this->inlineScript()->appendFile($this->basePath('vendors/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
|
|
|
22 |
$this->inlineScript()->appendFile($this->basePath('vendors/jsrender/jsrender.min.js'));
|
|
|
23 |
|
| 6056 |
efrain |
24 |
$this->headLink()->appendStylesheet($this->basePath('vendors/bootstrap-fileinput/css/fileinput.min.css'));
|
|
|
25 |
$this->headLink()->appendStylesheet($this->basePath('vendors/bootstrap-fileinput/themes/explorer-fa/theme.css'));
|
|
|
26 |
|
|
|
27 |
$this->inlineScript()->appendFile($this->basePath('vendors/bootstrap-fileinput/js/plugins/piexif.js'));
|
|
|
28 |
$this->inlineScript()->appendFile($this->basePath('vendors/bootstrap-fileinput/js/plugins/sortable.js'));
|
|
|
29 |
$this->inlineScript()->appendFile($this->basePath('vendors/bootstrap-fileinput/js/fileinput.js'));
|
|
|
30 |
$this->inlineScript()->appendFile($this->basePath('vendors/bootstrap-fileinput/js/locales/es.js'));
|
|
|
31 |
$this->inlineScript()->appendFile($this->basePath('vendors/bootstrap-fileinput/themes/fa/theme.js'));
|
|
|
32 |
$this->inlineScript()->appendFile($this->basePath('vendors/bootstrap-fileinput/themes/explorer-fa/theme.js'));
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
$this->inlineScript()->appendFile($this->basePath('vendors/jquery-validation/jquery.validate.js'));
|
|
|
36 |
$this->inlineScript()->appendFile($this->basePath('vendors/jquery-validation/additional-methods.js'));
|
|
|
37 |
$this->inlineScript()->appendFile($this->basePath('vendors/jquery-validation/localization/messages_es.js'));
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
|
| 6001 |
efrain |
41 |
$this->inlineScript()->captureStart();
|
|
|
42 |
echo <<<JS
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
jQuery( document ).ready(function( $ ) {
|
| 6056 |
efrain |
47 |
$.fn.reload = function() {
|
| 6001 |
efrain |
48 |
|
| 6056 |
efrain |
49 |
|
| 6001 |
efrain |
50 |
|
|
|
51 |
NProgress.start();
|
|
|
52 |
$.ajax({
|
|
|
53 |
'dataType' : 'json',
|
|
|
54 |
'accept' : 'application/json',
|
|
|
55 |
'method' : 'get',
|
| 6056 |
efrain |
56 |
'url' : '$route',
|
| 6001 |
efrain |
57 |
'data' : {
|
| 6056 |
efrain |
58 |
'search' : $('#form-filter #search').val(),
|
| 6100 |
stevensc |
59 |
'category_id' : $('li.knowledge-category-li-selected > a.knowledge-category-a').data('uuid') ,
|
| 6056 |
efrain |
60 |
|
| 6001 |
efrain |
61 |
}
|
|
|
62 |
}).done(function(response) {
|
|
|
63 |
if(response['success']) {
|
| 6056 |
efrain |
64 |
$('#knowledge-record-list').empty();
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
if(response['data']['items'].length > 0) {
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
|
71 |
$( "#knowledge-record-list" ).html(
|
|
|
72 |
$( "#recordTemplate" ).render( response['data']['items'] )
|
| 6001 |
efrain |
73 |
);
|
|
|
74 |
} else {
|
|
|
75 |
var html = '<div class="company-title"><div class="widget widget-jobs"><div class="sd-title">ERROR_NO_RECORD_MATCHED_YOUR_QUERY</div></div></div>';
|
| 6056 |
efrain |
76 |
$( "#knowledge-record-list" ).html(html);
|
| 6001 |
efrain |
77 |
}
|
|
|
78 |
|
|
|
79 |
|
| 6056 |
efrain |
80 |
$('button.btn-knowledge-delete').confirmation({
|
|
|
81 |
rootSelector: 'button.btn-knowledge-delete',
|
| 6001 |
efrain |
82 |
title : 'LABEL_ARE_YOU_SURE',
|
|
|
83 |
singleton : true,
|
|
|
84 |
btnOkLabel: 'LABEL_YES',
|
|
|
85 |
btnCancelLabel: 'LABEL_NO',
|
|
|
86 |
onConfirm: function(value) {
|
|
|
87 |
var action = $(this).data('link');
|
|
|
88 |
NProgress.start();
|
|
|
89 |
$.ajax({
|
|
|
90 |
'dataType' : 'json',
|
|
|
91 |
'accept' : 'application/json',
|
|
|
92 |
'method' : 'post',
|
|
|
93 |
'url' : action,
|
|
|
94 |
}).done(function(response) {
|
|
|
95 |
if(response['success']) {
|
|
|
96 |
$.fn.showSuccess(response['data']);
|
|
|
97 |
|
| 6056 |
efrain |
98 |
$.fn.reload();
|
| 6001 |
efrain |
99 |
} else {
|
|
|
100 |
$.fn.showError(response['data']);
|
|
|
101 |
}
|
|
|
102 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
103 |
$.fn.showError(textStatus);
|
|
|
104 |
}).always(function() {
|
|
|
105 |
NProgress.done();
|
|
|
106 |
});
|
|
|
107 |
|
|
|
108 |
return false;
|
|
|
109 |
},
|
|
|
110 |
});
|
|
|
111 |
|
|
|
112 |
} else {
|
|
|
113 |
$.fn.showError(response['data']);
|
|
|
114 |
}
|
|
|
115 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
116 |
$.fn.showError(textStatus);
|
|
|
117 |
}).always(function() {
|
|
|
118 |
NProgress.done();
|
|
|
119 |
});
|
|
|
120 |
|
|
|
121 |
}
|
|
|
122 |
|
|
|
123 |
|
|
|
124 |
$('#form-connection-search #search').keyup(function(e) {
|
|
|
125 |
e.preventDefault();
|
|
|
126 |
|
|
|
127 |
var search = $('#form-connection-search #search').val()
|
|
|
128 |
if(search.length > 0) {
|
|
|
129 |
var search = $('#form-connection-search #search').val().trim()
|
|
|
130 |
if(search.length > 0) {
|
|
|
131 |
$.fn.reload(search);
|
|
|
132 |
} else {
|
|
|
133 |
$('#form-connection-search #search').val('');
|
|
|
134 |
}
|
|
|
135 |
} else {
|
|
|
136 |
$.fn.reload('');
|
|
|
137 |
}
|
|
|
138 |
|
|
|
139 |
});
|
|
|
140 |
|
| 6056 |
efrain |
141 |
$.validator.setDefaults({
|
|
|
142 |
debug: true,
|
|
|
143 |
highlight: function(element) {
|
|
|
144 |
$(element).addClass('is-invalid');
|
|
|
145 |
},
|
|
|
146 |
unhighlight: function(element) {
|
|
|
147 |
$(element).removeClass('is-invalid');
|
|
|
148 |
},
|
|
|
149 |
errorElement: 'span',
|
|
|
150 |
errorClass: 'error invalid-feedback',
|
|
|
151 |
errorPlacement: function(error, element) {
|
|
|
152 |
if(element.parent('.btn-file').length) {
|
|
|
153 |
error.insertAfter(element.parent().parent());
|
|
|
154 |
} else if(element.parent('.toggle').length) {
|
|
|
155 |
error.insertAfter(element.parent().parent());
|
|
|
156 |
} else {
|
|
|
157 |
error.insertAfter(element.parent());
|
|
|
158 |
}
|
|
|
159 |
}
|
|
|
160 |
});
|
|
|
161 |
|
|
|
162 |
|
|
|
163 |
$.fn.showFormErrorValidator = function(fieldname, errors) {
|
|
|
164 |
var field = $(fieldname);
|
|
|
165 |
if(field) {
|
|
|
166 |
$(field).addClass('is-invalid');
|
|
|
167 |
|
|
|
168 |
|
|
|
169 |
var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
|
|
|
170 |
if(element.parent('.btn-file').length) {
|
|
|
171 |
error.insertAfter(element.parent().parent());
|
|
|
172 |
} else if(element.parent('.toggle').length) {
|
|
|
173 |
error.insertAfter(element.parent().parent());
|
|
|
174 |
} else {
|
|
|
175 |
error.insertAfter(element.parent());
|
|
|
176 |
}
|
|
|
177 |
}
|
|
|
178 |
};
|
|
|
179 |
|
|
|
180 |
var validatorAdd = $('#form-add').validate({
|
|
|
181 |
debug: true,
|
|
|
182 |
onclick: false,
|
|
|
183 |
onkeyup: false,
|
|
|
184 |
ignore: [],
|
|
|
185 |
rules: {
|
|
|
186 |
'category_id': {
|
|
|
187 |
required: true,
|
|
|
188 |
},
|
|
|
189 |
'title': {
|
|
|
190 |
required: true,
|
|
|
191 |
maxlength: 128,
|
|
|
192 |
},
|
|
|
193 |
'description': {
|
|
|
194 |
updateCkeditor:function() {
|
|
|
195 |
CKEDITOR.instances.description_add.updateElement();
|
|
|
196 |
},
|
|
|
197 |
required: true
|
|
|
198 |
},
|
|
|
199 |
'image': {
|
|
|
200 |
required: true,
|
|
|
201 |
extension: 'jpg|jpeg|png',
|
|
|
202 |
accept: 'image/jpg,image/jpeg,image/png'
|
|
|
203 |
},
|
|
|
204 |
'attachment': {
|
|
|
205 |
required: false,
|
|
|
206 |
extension: 'pdf|wav|mp3|webm,mp4,webm',
|
|
|
207 |
accept: 'application/pdf, audio/wav, audio/mpeg, video/webm,video/mpeg,video/mp4'
|
|
|
208 |
},
|
|
|
209 |
'link': {
|
|
|
210 |
required: false,
|
|
|
211 |
maxlength: 250,
|
|
|
212 |
url: true,
|
|
|
213 |
},
|
|
|
214 |
},
|
|
|
215 |
submitHandler: function(form)
|
|
|
216 |
{
|
|
|
217 |
var formdata = false;
|
|
|
218 |
if (window.FormData){
|
|
|
219 |
formdata = new FormData(form); //form[0]);
|
|
|
220 |
}
|
|
|
221 |
|
|
|
222 |
|
|
|
223 |
NProgress.start();
|
|
|
224 |
$.ajax({
|
|
|
225 |
'dataType' : 'json',
|
|
|
226 |
'accept' : 'application/json',
|
|
|
227 |
'method' : 'post',
|
|
|
228 |
'url' : '$routeAdd',
|
|
|
229 |
'data' : formdata,
|
|
|
230 |
'processData': false,
|
|
|
231 |
'contentType': false,
|
|
|
232 |
}).done(function(response) {
|
|
|
233 |
console.log(response)
|
|
|
234 |
if(response['success']) {
|
|
|
235 |
$.fn.showSuccess(response['data']);
|
|
|
236 |
$.fn.reload();
|
|
|
237 |
|
|
|
238 |
$('#row-add').hide();
|
|
|
239 |
$('#row-list').show();
|
|
|
240 |
|
|
|
241 |
} else {
|
|
|
242 |
validatorAdd.resetForm();
|
|
|
243 |
if(jQuery.type(response['data']) == 'string') {
|
|
|
244 |
$.fn.showError(response['data']);
|
|
|
245 |
} else {
|
|
|
246 |
$.each(response['data'], function( fieldname, errors ) {
|
|
|
247 |
$.fn.showFormErrorValidator('#form-add #' + fieldname, errors);
|
|
|
248 |
});
|
|
|
249 |
}
|
|
|
250 |
}
|
|
|
251 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
252 |
$.fn.showError(textStatus);
|
|
|
253 |
}).always(function() {
|
|
|
254 |
NProgress.done();
|
|
|
255 |
});
|
|
|
256 |
return false;
|
|
|
257 |
},
|
|
|
258 |
invalidHandler: function(form, validator) {
|
|
|
259 |
|
|
|
260 |
}
|
|
|
261 |
});
|
|
|
262 |
|
|
|
263 |
|
|
|
264 |
var validatorEdit = $('#form-edit').validate({
|
|
|
265 |
debug: true,
|
|
|
266 |
onclick: false,
|
|
|
267 |
onkeyup: false,
|
|
|
268 |
ignore: [],
|
|
|
269 |
rules: {
|
|
|
270 |
'category_id': {
|
|
|
271 |
required: true,
|
|
|
272 |
},
|
|
|
273 |
'title': {
|
|
|
274 |
required: true,
|
|
|
275 |
maxlength: 128,
|
|
|
276 |
},
|
|
|
277 |
'description': {
|
|
|
278 |
updateCkeditor:function() {
|
|
|
279 |
CKEDITOR.instances.description_edit.updateElement();
|
|
|
280 |
},
|
|
|
281 |
required: true
|
|
|
282 |
},
|
|
|
283 |
'image': {
|
|
|
284 |
required: false,
|
|
|
285 |
extension: 'jpg|jpeg|png',
|
|
|
286 |
accept: 'image/jpg,image/jpeg,image/png'
|
|
|
287 |
},
|
|
|
288 |
'attachment': {
|
|
|
289 |
required: false,
|
|
|
290 |
extension: 'pdf|wav|mp3|webm,mp4,webm',
|
|
|
291 |
accept: 'application/pdf, audio/wav, audio/mpeg, video/webm,video/mpeg,video/mp4'
|
|
|
292 |
},
|
|
|
293 |
'link': {
|
|
|
294 |
required: false,
|
|
|
295 |
maxlength: 250,
|
|
|
296 |
url: true,
|
|
|
297 |
},
|
|
|
298 |
},
|
|
|
299 |
submitHandler: function(form)
|
|
|
300 |
{
|
|
|
301 |
var formdata = false;
|
|
|
302 |
if (window.FormData){
|
|
|
303 |
formdata = new FormData(form); //form[0]);
|
|
|
304 |
}
|
|
|
305 |
|
|
|
306 |
|
|
|
307 |
NProgress.start();
|
|
|
308 |
$.ajax({
|
|
|
309 |
'dataType' : 'json',
|
|
|
310 |
'accept' : 'application/json',
|
|
|
311 |
'method' : 'post',
|
|
|
312 |
'url' : $('#form-edit').attr('action'),
|
|
|
313 |
'data' : formdata,
|
|
|
314 |
'processData': false,
|
|
|
315 |
'contentType': false,
|
|
|
316 |
}).done(function(response) {
|
|
|
317 |
console.log(response)
|
|
|
318 |
if(response['success']) {
|
|
|
319 |
$.fn.showSuccess(response['data']);
|
|
|
320 |
$.fn.reload();
|
|
|
321 |
|
|
|
322 |
$('#row-edit').hide();
|
|
|
323 |
$('#row-list').show();
|
|
|
324 |
|
|
|
325 |
} else {
|
|
|
326 |
validatorAdd.resetForm();
|
|
|
327 |
if(jQuery.type(response['data']) == 'string') {
|
|
|
328 |
$.fn.showError(response['data']);
|
|
|
329 |
} else {
|
|
|
330 |
$.each(response['data'], function( fieldname, errors ) {
|
|
|
331 |
$.fn.showFormErrorValidator('#form-edit #' + fieldname, errors);
|
|
|
332 |
});
|
|
|
333 |
}
|
|
|
334 |
}
|
|
|
335 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
336 |
$.fn.showError(textStatus);
|
|
|
337 |
}).always(function() {
|
|
|
338 |
NProgress.done();
|
|
|
339 |
});
|
|
|
340 |
return false;
|
|
|
341 |
},
|
|
|
342 |
invalidHandler: function(form, validator) {
|
|
|
343 |
|
|
|
344 |
}
|
|
|
345 |
});
|
|
|
346 |
$('a.knowledge-category-a').click(function(e) {
|
| 6001 |
efrain |
347 |
e.preventDefault();
|
|
|
348 |
|
| 6056 |
efrain |
349 |
|
| 6100 |
stevensc |
350 |
$('li.knowledge-category-li').removeClass('knowledge-category-li-selected');
|
|
|
351 |
$(this).closest('li.knowledge-category-li').addClass('knowledge-category-li-selected');
|
| 6056 |
efrain |
352 |
|
|
|
353 |
$.fn.reload();
|
| 6001 |
efrain |
354 |
});
|
|
|
355 |
|
| 6056 |
efrain |
356 |
$('#form-filter #search').keyup(function(e) {
|
| 6001 |
efrain |
357 |
|
| 6056 |
efrain |
358 |
e.preventDefault();
|
| 6001 |
efrain |
359 |
|
| 6056 |
efrain |
360 |
$.fn.reload();
|
|
|
361 |
})
|
| 6001 |
efrain |
362 |
|
| 6056 |
efrain |
363 |
$('button.btn-search').click(function(e) {
|
|
|
364 |
e.preventDefault();
|
| 6001 |
efrain |
365 |
|
| 6056 |
efrain |
366 |
$.fn.reload();
|
|
|
367 |
});
|
| 6001 |
efrain |
368 |
|
|
|
369 |
|
| 6056 |
efrain |
370 |
$('body').on('click', 'button.btn-knowledge-edit', function(e) {
|
|
|
371 |
e.preventDefault();
|
|
|
372 |
var action = $(this).data('link');
|
|
|
373 |
NProgress.start();
|
|
|
374 |
$.ajax({
|
|
|
375 |
'dataType' : 'json',
|
|
|
376 |
'accept' : 'application/json',
|
|
|
377 |
'method' : 'get',
|
|
|
378 |
'url' : action,
|
|
|
379 |
}).done(function(response) {
|
|
|
380 |
if(response['success']) {
|
| 6001 |
efrain |
381 |
|
| 6056 |
efrain |
382 |
$('#form-edit').attr('action', action);
|
|
|
383 |
$('#form-edit #category_id').val(response['data']['category_id']).trigger('change');
|
| 6001 |
efrain |
384 |
|
| 6056 |
efrain |
385 |
$('#form-edit #title').val(response['data']['title']);
|
|
|
386 |
$('#form-edit #link').val(response['data']['link']);
|
|
|
387 |
CKEDITOR.instances.description_edit.setData(response['data']['description']);
|
|
|
388 |
|
|
|
389 |
$('#form-edit #image').fileinput('reset');
|
|
|
390 |
$('#form-edit #image').val('');
|
|
|
391 |
$('#form-edit #attachment').fileinput('reset');
|
|
|
392 |
$('#form-edt #attachment').val('');
|
|
|
393 |
|
|
|
394 |
|
|
|
395 |
$('#row-list').hide();
|
|
|
396 |
$('#row-edit').show();
|
|
|
397 |
} else {
|
|
|
398 |
$.fn.showError(response['data']);
|
|
|
399 |
}
|
|
|
400 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
401 |
$.fn.showError(textStatus);
|
|
|
402 |
}).always(function() {
|
|
|
403 |
NProgress.done();
|
|
|
404 |
});
|
| 6001 |
efrain |
405 |
|
| 6056 |
efrain |
406 |
});
|
| 6001 |
efrain |
407 |
|
|
|
408 |
|
| 6056 |
efrain |
409 |
$('body').on('click', 'button.btn-knowledge-open-attachment', function(e) {
|
|
|
410 |
e.preventDefault();
|
|
|
411 |
var action = $(this).data('link');
|
| 6001 |
efrain |
412 |
|
| 6056 |
efrain |
413 |
window.open(action)
|
|
|
414 |
});
|
| 6001 |
efrain |
415 |
|
|
|
416 |
|
| 6056 |
efrain |
417 |
$('body').on('click', 'button.btn-knowledge-open-link', function(e) {
|
|
|
418 |
e.preventDefault();
|
|
|
419 |
var action = $(this).data('link');
|
| 6001 |
efrain |
420 |
|
| 6056 |
efrain |
421 |
window.open(action)
|
|
|
422 |
});
|
| 6001 |
efrain |
423 |
|
|
|
424 |
|
| 6178 |
stevensc |
425 |
$('#knowledge-add-a').click(function(e) {
|
| 6056 |
efrain |
426 |
e.preventDefault();
|
| 6001 |
efrain |
427 |
|
| 6056 |
efrain |
428 |
$('#form-add #title').val('');
|
|
|
429 |
$('#form-add #link').val('');
|
|
|
430 |
CKEDITOR.instances.description_add.setData('');
|
| 6001 |
efrain |
431 |
|
| 6056 |
efrain |
432 |
$('#form-add #image').fileinput('reset');
|
|
|
433 |
$('#form-add #image').val('');
|
|
|
434 |
$('#form-add #attachment').fileinput('reset');
|
|
|
435 |
$('#form-add #attachment').val('');
|
| 6001 |
efrain |
436 |
|
|
|
437 |
|
| 6056 |
efrain |
438 |
$('#row-list').hide();
|
|
|
439 |
$('#row-add').show();
|
|
|
440 |
});
|
| 6001 |
efrain |
441 |
|
| 6056 |
efrain |
442 |
$('button.btn-cancel').click(function(e) {
|
|
|
443 |
e.preventDefault();
|
| 6001 |
efrain |
444 |
|
| 6056 |
efrain |
445 |
$('#row-add').hide();
|
|
|
446 |
$('#row-edit').hide();
|
|
|
447 |
$('#row-list').show();
|
|
|
448 |
|
|
|
449 |
});
|
| 6001 |
efrain |
450 |
|
| 6056 |
efrain |
451 |
$('#form-add #image').fileinput({
|
|
|
452 |
theme: 'fa',
|
|
|
453 |
language: 'es',
|
|
|
454 |
showUpload: false,
|
|
|
455 |
dropZoneEnabled: false,
|
|
|
456 |
maxFileCount: 1,
|
|
|
457 |
allowedFileExtensions: ['jpg', 'jpeg', 'png'],
|
|
|
458 |
msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $image_size',
|
|
|
459 |
});
|
| 6001 |
efrain |
460 |
|
| 6056 |
efrain |
461 |
$('#form-add #attachment').fileinput({
|
|
|
462 |
theme: 'fa',
|
|
|
463 |
language: 'es',
|
|
|
464 |
showUpload: false,
|
|
|
465 |
dropZoneEnabled: false,
|
|
|
466 |
maxFileCount: 1,
|
|
|
467 |
allowedFileExtensions: ['jpg', 'jpeg', 'png', 'pdf', 'wav', 'mp3', 'mp4', 'mpeg','webm'],
|
|
|
468 |
msgPlaceholder: 'LABEL_EXTENSIONS_ALLOWED jpg, jpeg, png, pdf, wav, mp3, mp4, mpeg, webm',
|
|
|
469 |
});
|
| 6001 |
efrain |
470 |
|
| 6056 |
efrain |
471 |
$('#form-add #category_id').select2({
|
|
|
472 |
theme: 'bootstrap4',
|
|
|
473 |
});
|
| 6001 |
efrain |
474 |
|
|
|
475 |
|
|
|
476 |
|
| 6056 |
efrain |
477 |
$('#form-edit #image').fileinput({
|
|
|
478 |
theme: 'fa',
|
|
|
479 |
language: 'es',
|
|
|
480 |
showUpload: false,
|
|
|
481 |
dropZoneEnabled: false,
|
|
|
482 |
maxFileCount: 1,
|
|
|
483 |
allowedFileExtensions: ['jpg', 'jpeg', 'png'],
|
|
|
484 |
msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $image_size',
|
|
|
485 |
});
|
| 6001 |
efrain |
486 |
|
| 6056 |
efrain |
487 |
$('#form-edit #attachment').fileinput({
|
|
|
488 |
theme: 'fa',
|
|
|
489 |
language: 'es',
|
|
|
490 |
showUpload: false,
|
|
|
491 |
dropZoneEnabled: false,
|
|
|
492 |
maxFileCount: 1,
|
|
|
493 |
allowedFileExtensions: ['jpg', 'jpeg', 'png', 'pdf', 'wav', 'mp3', 'mp4', 'mpeg','webm'],
|
|
|
494 |
msgPlaceholder: 'LABEL_EXTENSIONS_ALLOWED jpg, jpeg, png, pdf, wav, mp3, mp4, mpeg, webm',
|
|
|
495 |
});
|
| 6001 |
efrain |
496 |
|
| 6056 |
efrain |
497 |
$('#form-edit #category_id').select2({
|
|
|
498 |
theme: 'bootstrap4',
|
|
|
499 |
});
|
| 6001 |
efrain |
500 |
|
|
|
501 |
|
| 6056 |
efrain |
502 |
CKEDITOR.replace('description_add', {
|
|
|
503 |
toolbar: [
|
|
|
504 |
{ name: 'editing', items: ['Scayt'] },
|
|
|
505 |
{ name: 'links', items: ['Link', 'Unlink'] },
|
|
|
506 |
{ name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
|
|
|
507 |
{ name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
|
|
|
508 |
'/',
|
|
|
509 |
{ name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
|
|
|
510 |
{ name: 'styles', items: ['Styles', 'Format'] },
|
|
|
511 |
{ name: 'tools', items: ['Maximize'] }
|
|
|
512 |
],
|
|
|
513 |
removePlugins: 'elementspath,Anchor',
|
|
|
514 |
heigth: 100
|
|
|
515 |
});
|
| 6001 |
efrain |
516 |
|
| 6056 |
efrain |
517 |
CKEDITOR.replace('description_edit',{
|
|
|
518 |
toolbar: [
|
|
|
519 |
{ name: 'editing', items: ['Scayt'] },
|
|
|
520 |
{ name: 'links', items: ['Link', 'Unlink'] },
|
|
|
521 |
{ name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
|
|
|
522 |
{ name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
|
|
|
523 |
'/',
|
|
|
524 |
{ name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
|
|
|
525 |
{ name: 'styles', items: ['Styles', 'Format'] },
|
|
|
526 |
{ name: 'tools', items: ['Maximize'] }
|
|
|
527 |
],
|
|
|
528 |
removePlugins: 'elementspath,Anchor',
|
|
|
529 |
heigth: 100
|
|
|
530 |
});
|
| 6001 |
efrain |
531 |
|
| 6056 |
efrain |
532 |
$.fn.reload()
|
| 6001 |
efrain |
533 |
|
|
|
534 |
|
| 6056 |
efrain |
535 |
});
|
|
|
536 |
JS;
|
| 6094 |
stevensc |
537 |
|
| 6056 |
efrain |
538 |
$this->inlineScript()->captureEnd();
|
| 6094 |
stevensc |
539 |
$this->headLink()->appendStylesheet('/look-and-field/knowledge.css');
|
|
|
540 |
?>
|
| 6001 |
efrain |
541 |
|
| 6185 |
stevensc |
542 |
<section class="companies-info container px-0">
|
| 6173 |
stevensc |
543 |
<div class="company-title">
|
| 6178 |
stevensc |
544 |
<h1 class="title mx-auto">LABEL_KNOWLEDGE_AREA_TITLE</h1>
|
| 6172 |
stevensc |
545 |
<?php if ($content_edit && $allowAdd) : ?>
|
| 6178 |
stevensc |
546 |
<h2 class="title cursor-pointer" id="knowledge-add-a">
|
|
|
547 |
LABEL_KNOWLEDGE_AREA_ADD
|
|
|
548 |
</h2>
|
| 6172 |
stevensc |
549 |
<?php endif; ?>
|
| 6094 |
stevensc |
550 |
</div>
|
| 6001 |
efrain |
551 |
|
| 6185 |
stevensc |
552 |
<div class="row gap-3" id="row-list">
|
| 6098 |
stevensc |
553 |
<div class="knowledge-category-list col-12 col-md-3">
|
| 6094 |
stevensc |
554 |
<ul>
|
| 6100 |
stevensc |
555 |
<li class="knowledge-category-li knowledge-category-li-selected">
|
|
|
556 |
<a class="knowledge-category-a" href="" data-uuid="">LABEL_KNOWLEDGE_AREA_CATEGORY_ALL</a>
|
| 6094 |
stevensc |
557 |
</li>
|
|
|
558 |
<?php
|
|
|
559 |
foreach ($categories as $categorie) :
|
|
|
560 |
?>
|
| 6100 |
stevensc |
561 |
<li class="knowledge-category-li">
|
|
|
562 |
<a class="knowledge-category-a" href="" data-uuid="<?php echo $categorie['uuid'] ?>"><?php echo $categorie['name'] ?></a>
|
| 6094 |
stevensc |
563 |
</li>
|
| 6056 |
efrain |
564 |
|
| 6094 |
stevensc |
565 |
<?php endforeach; ?>
|
|
|
566 |
</ul>
|
|
|
567 |
</div>
|
| 6056 |
efrain |
568 |
|
| 6001 |
efrain |
569 |
|
| 6188 |
stevensc |
570 |
<div class="col px-0">
|
| 6094 |
stevensc |
571 |
<div class="search-box">
|
|
|
572 |
<form id="form-filter" name="form-filter">
|
|
|
573 |
<input type="text" name="search" id="search" class="form-control"><button class="btn btn-search">LABEL_SEARCH</button>
|
|
|
574 |
</form>
|
|
|
575 |
</div>
|
| 6001 |
efrain |
576 |
|
| 6182 |
stevensc |
577 |
<div id="knowledge-record-list" class="knowledge-record-list mt-3">
|
| 6094 |
stevensc |
578 |
</div>
|
| 6001 |
efrain |
579 |
|
| 6094 |
stevensc |
580 |
<div id="knowledge-record-pagination">
|
|
|
581 |
</div>
|
| 6001 |
efrain |
582 |
|
| 6094 |
stevensc |
583 |
</div>
|
|
|
584 |
</div>
|
| 6001 |
efrain |
585 |
|
| 6056 |
efrain |
586 |
|
|
|
587 |
|
| 6094 |
stevensc |
588 |
<div class="row" id="row-add" style="display: none">
|
|
|
589 |
<div class="col-12">
|
|
|
590 |
<div class="card">
|
|
|
591 |
<?php
|
| 6056 |
efrain |
592 |
$form = $this->formAdd;
|
|
|
593 |
$form->setAttributes([
|
|
|
594 |
'method' => 'post',
|
|
|
595 |
'name' => 'form-add',
|
|
|
596 |
'id' => 'form-add',
|
|
|
597 |
//'action' => $routeAdd,
|
|
|
598 |
]);
|
| 6001 |
efrain |
599 |
|
| 6056 |
efrain |
600 |
$form->prepare();
|
|
|
601 |
echo $this->form()->openTag($form);
|
|
|
602 |
?>
|
|
|
603 |
<div class="card-header">
|
|
|
604 |
<h4 class="modal-title">LABEL_ADD</h4>
|
|
|
605 |
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
|
606 |
</div>
|
| 6001 |
efrain |
607 |
|
| 6056 |
efrain |
608 |
<!-- Modal body -->
|
|
|
609 |
<div class="card-body">
|
| 6094 |
stevensc |
610 |
|
| 6056 |
efrain |
611 |
<div class="form-group">
|
|
|
612 |
<?php
|
|
|
613 |
$element = $form->get('category_id');
|
|
|
614 |
$element->setOptions(['label' => 'LABEL_CATEGORY']);
|
|
|
615 |
$element->setAttributes(['class' => 'form-control']);
|
| 6094 |
stevensc |
616 |
|
| 6056 |
efrain |
617 |
echo $this->formLabel($element);
|
|
|
618 |
echo $this->formSelect($element);
|
|
|
619 |
?>
|
|
|
620 |
</div>
|
| 6094 |
stevensc |
621 |
<div class="form-group">
|
| 6056 |
efrain |
622 |
<?php
|
|
|
623 |
$element = $form->get('title');
|
|
|
624 |
$element->setOptions(['label' => 'LABEL_TITLE']);
|
|
|
625 |
$element->setAttributes(['class' => 'form-control']);
|
| 6094 |
stevensc |
626 |
|
| 6056 |
efrain |
627 |
echo $this->formLabel($element);
|
|
|
628 |
echo $this->formText($element);
|
|
|
629 |
?>
|
|
|
630 |
</div>
|
| 6094 |
stevensc |
631 |
<div class="form-group">
|
| 6056 |
efrain |
632 |
<?php
|
|
|
633 |
$element = $form->get('description');
|
|
|
634 |
$element->setOptions(['label' => 'LABEL_DESCRIPTION']);
|
|
|
635 |
$element->setAttributes(['class' => 'form-control', 'id' => 'description_add']);
|
| 6094 |
stevensc |
636 |
|
| 6056 |
efrain |
637 |
echo $this->formLabel($element);
|
|
|
638 |
echo $this->formTextArea($element);
|
|
|
639 |
?>
|
|
|
640 |
</div>
|
| 6094 |
stevensc |
641 |
<div class="form-group">
|
| 6056 |
efrain |
642 |
<?php
|
|
|
643 |
$element = $form->get('image');
|
|
|
644 |
$element->setOptions(['label' => 'LABEL_IMAGE']);
|
|
|
645 |
$element->setAttributes(['class' => 'form-control']);
|
| 6094 |
stevensc |
646 |
|
| 6056 |
efrain |
647 |
echo $this->formLabel($element);
|
|
|
648 |
echo $this->formFile($element);
|
|
|
649 |
?>
|
|
|
650 |
</div>
|
| 6094 |
stevensc |
651 |
<div class="form-group">
|
| 6056 |
efrain |
652 |
<?php
|
|
|
653 |
$element = $form->get('attachment');
|
|
|
654 |
$element->setOptions(['label' => 'LABEL_ATTACHMENT']);
|
|
|
655 |
$element->setAttributes(['class' => 'form-control']);
|
| 6094 |
stevensc |
656 |
|
| 6056 |
efrain |
657 |
echo $this->formLabel($element);
|
|
|
658 |
echo $this->formFile($element);
|
|
|
659 |
?>
|
|
|
660 |
</div>
|
| 6094 |
stevensc |
661 |
<div class="form-group">
|
| 6056 |
efrain |
662 |
<?php
|
|
|
663 |
$element = $form->get('link');
|
|
|
664 |
$element->setOptions(['label' => 'LABEL_LINK']);
|
|
|
665 |
$element->setAttributes(['class' => 'form-control']);
|
| 6094 |
stevensc |
666 |
|
| 6056 |
efrain |
667 |
echo $this->formLabel($element);
|
|
|
668 |
echo $this->formText($element);
|
|
|
669 |
?>
|
|
|
670 |
</div>
|
|
|
671 |
</div>
|
|
|
672 |
<div class="card-footer">
|
| 6094 |
stevensc |
673 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
|
|
674 |
<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
|
| 6056 |
efrain |
675 |
</div>
|
| 6094 |
stevensc |
676 |
<?php echo $this->form()->closeTag($form); ?>
|
| 6056 |
efrain |
677 |
|
| 6001 |
efrain |
678 |
</div>
|
| 6056 |
efrain |
679 |
</div>
|
|
|
680 |
</div>
|
| 6094 |
stevensc |
681 |
|
|
|
682 |
<div class="row" id="row-edit" style="display: none">
|
|
|
683 |
<div class="col-12">
|
|
|
684 |
<div class="card">
|
|
|
685 |
<?php
|
| 6056 |
efrain |
686 |
$form = $this->formEdit;
|
|
|
687 |
$form->setAttributes([
|
|
|
688 |
'method' => 'post',
|
|
|
689 |
'name' => 'form-edit',
|
|
|
690 |
'id' => 'form-edit',
|
|
|
691 |
//'action' => $routeAdd,
|
|
|
692 |
]);
|
|
|
693 |
|
|
|
694 |
$form->prepare();
|
|
|
695 |
echo $this->form()->openTag($form);
|
|
|
696 |
?>
|
|
|
697 |
<div class="card-header">
|
|
|
698 |
<h4 class="modal-title">LABEL_EDIT</h4>
|
|
|
699 |
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
|
700 |
</div>
|
|
|
701 |
|
|
|
702 |
<!-- Modal body -->
|
|
|
703 |
<div class="card-body">
|
| 6094 |
stevensc |
704 |
|
| 6056 |
efrain |
705 |
<div class="form-group">
|
|
|
706 |
<?php
|
|
|
707 |
$element = $form->get('category_id');
|
|
|
708 |
$element->setOptions(['label' => 'LABEL_CATEGORY']);
|
|
|
709 |
$element->setAttributes(['class' => 'form-control']);
|
| 6094 |
stevensc |
710 |
|
| 6056 |
efrain |
711 |
echo $this->formLabel($element);
|
|
|
712 |
echo $this->formSelect($element);
|
|
|
713 |
?>
|
|
|
714 |
</div>
|
| 6094 |
stevensc |
715 |
<div class="form-group">
|
| 6056 |
efrain |
716 |
<?php
|
|
|
717 |
$element = $form->get('title');
|
|
|
718 |
$element->setOptions(['label' => 'LABEL_TITLE']);
|
|
|
719 |
$element->setAttributes(['class' => 'form-control']);
|
| 6094 |
stevensc |
720 |
|
| 6056 |
efrain |
721 |
echo $this->formLabel($element);
|
|
|
722 |
echo $this->formText($element);
|
|
|
723 |
?>
|
|
|
724 |
</div>
|
| 6094 |
stevensc |
725 |
<div class="form-group">
|
| 6056 |
efrain |
726 |
<?php
|
|
|
727 |
$element = $form->get('description');
|
|
|
728 |
$element->setOptions(['label' => 'LABEL_DESCRIPTION']);
|
|
|
729 |
$element->setAttributes(['class' => 'form-control', 'id' => 'description_edit']);
|
| 6094 |
stevensc |
730 |
|
| 6056 |
efrain |
731 |
echo $this->formLabel($element);
|
|
|
732 |
echo $this->formTextArea($element);
|
|
|
733 |
?>
|
|
|
734 |
</div>
|
| 6094 |
stevensc |
735 |
<div class="form-group">
|
| 6056 |
efrain |
736 |
<?php
|
|
|
737 |
$element = $form->get('image');
|
|
|
738 |
$element->setOptions(['label' => 'LABEL_IMAGE']);
|
|
|
739 |
$element->setAttributes(['class' => 'form-control']);
|
| 6094 |
stevensc |
740 |
|
| 6056 |
efrain |
741 |
echo $this->formLabel($element);
|
|
|
742 |
echo $this->formFile($element);
|
|
|
743 |
?>
|
|
|
744 |
</div>
|
| 6094 |
stevensc |
745 |
<div class="form-group">
|
| 6056 |
efrain |
746 |
<?php
|
|
|
747 |
$element = $form->get('attachment');
|
|
|
748 |
$element->setOptions(['label' => 'LABEL_ATTACHMENT']);
|
|
|
749 |
$element->setAttributes(['class' => 'form-control']);
|
| 6094 |
stevensc |
750 |
|
| 6056 |
efrain |
751 |
echo $this->formLabel($element);
|
|
|
752 |
echo $this->formFile($element);
|
|
|
753 |
?>
|
|
|
754 |
</div>
|
| 6094 |
stevensc |
755 |
<div class="form-group">
|
| 6056 |
efrain |
756 |
<?php
|
|
|
757 |
$element = $form->get('link');
|
|
|
758 |
$element->setOptions(['label' => 'LABEL_LINK']);
|
|
|
759 |
$element->setAttributes(['class' => 'form-control']);
|
| 6094 |
stevensc |
760 |
|
| 6056 |
efrain |
761 |
echo $this->formLabel($element);
|
|
|
762 |
echo $this->formText($element);
|
|
|
763 |
?>
|
|
|
764 |
</div>
|
|
|
765 |
</div>
|
|
|
766 |
<div class="card-footer">
|
| 6094 |
stevensc |
767 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
|
|
768 |
<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
|
| 6056 |
efrain |
769 |
</div>
|
| 6094 |
stevensc |
770 |
<?php echo $this->form()->closeTag($form); ?>
|
| 6056 |
efrain |
771 |
|
| 6001 |
efrain |
772 |
</div>
|
| 6056 |
efrain |
773 |
</div>
|
|
|
774 |
</div>
|
| 6001 |
efrain |
775 |
|
| 6094 |
stevensc |
776 |
|
| 6056 |
efrain |
777 |
</section>
|
|
|
778 |
|
|
|
779 |
<script id="recordTemplate" type="text/x-jsrender">
|
| 6094 |
stevensc |
780 |
<div class="knowledge-record-card">
|
|
|
781 |
<div class="knowledge-record-card-actions">
|
|
|
782 |
{{if link_edit }}
|
|
|
783 |
<button data-link="{{>link_edit}}" class="btn-knowledge-edit"> <i class="fa fa-pencil" aria-hidden="true"></i> </button>
|
|
|
784 |
{{/if}}
|
|
|
785 |
{{if link_delete }}
|
|
|
786 |
<button data-link="{{>link_delete}}" class="btn-knowledge-delete"> <i class="fa fa-trash" aria-hidden="true"></i> </button>
|
|
|
787 |
{{/if}}
|
|
|
788 |
</div>
|
| 6098 |
stevensc |
789 |
<a href="{{>link_view}}" target="_blank" class="knowledge-record-card-actions-view">
|
|
|
790 |
<img src="{{>image}}" alt="{{>title}} image">
|
|
|
791 |
</a>
|
|
|
792 |
<h3>{{>category}}</h3>
|
|
|
793 |
<h2>{{>title}}</h2>
|
|
|
794 |
<p>{{>description}}</p>
|
| 6094 |
stevensc |
795 |
</div>
|
|
|
796 |
</script>
|