Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6332 | | Comparar con el anterior | Ultima modificación | Ver Log |

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