Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6269 | Ir a la última revisión | | 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
    });
342
    $('a.knowledge-category-a').click(function(e) {
6001 efrain 343
        e.preventDefault();
344
 
6056 efrain 345
 
6100 stevensc 346
        $('li.knowledge-category-li').removeClass('knowledge-category-li-selected');
347
        $(this).closest('li.knowledge-category-li').addClass('knowledge-category-li-selected');
6056 efrain 348
 
349
        $.fn.reload();
6001 efrain 350
    });
351
 
6056 efrain 352
    $('#form-filter #search').keyup(function(e) {
6001 efrain 353
 
6056 efrain 354
        e.preventDefault();
6001 efrain 355
 
6056 efrain 356
        $.fn.reload();
357
    })
6001 efrain 358
 
6056 efrain 359
    $('button.btn-search').click(function(e) {
360
        e.preventDefault();
6001 efrain 361
 
6056 efrain 362
        $.fn.reload();
363
    });
6001 efrain 364
 
365
 
6056 efrain 366
    $('body').on('click', 'button.btn-knowledge-edit', function(e) {
367
        e.preventDefault();
368
        var action = $(this).data('link');
369
        NProgress.start();
370
        $.ajax({
371
            'dataType'  : 'json',
372
            'accept'    : 'application/json',
373
            'method'    : 'get',
374
            'url'       :  action,
375
        }).done(function(response) {
376
            if(response['success']) {
6001 efrain 377
 
6056 efrain 378
                $('#form-edit').attr('action', action);
379
                $('#form-edit #category_id').val(response['data']['category_id']).trigger('change');
6001 efrain 380
 
6056 efrain 381
                $('#form-edit #title').val(response['data']['title']);
382
                $('#form-edit #link').val(response['data']['link']);
383
                CKEDITOR.instances.description_edit.setData(response['data']['description']);
384
 
385
                $('#form-edit #image').fileinput('reset');
386
                $('#form-edit #image').val('');
387
                $('#form-edit #attachment').fileinput('reset');
388
                $('#form-edt #attachment').val('');
389
 
390
 
391
                $('#row-list').hide();
392
                $('#row-edit').show();
393
            } else {
394
                $.fn.showError(response['data']);
395
            }
396
        }).fail(function( jqXHR, textStatus, errorThrown) {
397
            $.fn.showError(textStatus);
398
        }).always(function() {
399
            NProgress.done();
400
        });
6001 efrain 401
 
6056 efrain 402
    });
6001 efrain 403
 
404
 
6056 efrain 405
    $('body').on('click', 'button.btn-knowledge-open-attachment', function(e) {
406
        e.preventDefault();
407
        var action = $(this).data('link');
6001 efrain 408
 
6056 efrain 409
        window.open(action)
410
    });
6001 efrain 411
 
412
 
6056 efrain 413
    $('body').on('click', 'button.btn-knowledge-open-link', function(e) {
414
        e.preventDefault();
415
        var action = $(this).data('link');
6001 efrain 416
 
6056 efrain 417
        window.open(action)
418
    });
6001 efrain 419
 
420
 
6178 stevensc 421
    $('#knowledge-add-a').click(function(e) {
6056 efrain 422
        e.preventDefault();
6001 efrain 423
 
6056 efrain 424
        $('#form-add #title').val('');
425
        $('#form-add #link').val('');
426
        CKEDITOR.instances.description_add.setData('');
6001 efrain 427
 
6056 efrain 428
        $('#form-add #image').fileinput('reset');
429
        $('#form-add #image').val('');
430
        $('#form-add #attachment').fileinput('reset');
431
        $('#form-add #attachment').val('');
6001 efrain 432
 
433
 
6056 efrain 434
        $('#row-list').hide();
435
        $('#row-add').show();
436
    });
6001 efrain 437
 
6056 efrain 438
    $('button.btn-cancel').click(function(e) {
439
        e.preventDefault();
6001 efrain 440
 
6056 efrain 441
        $('#row-add').hide();
442
        $('#row-edit').hide();
443
        $('#row-list').show();
444
 
445
    });
6001 efrain 446
 
6056 efrain 447
    $('#form-add #image').fileinput({
448
        theme: 'fa',
449
        language: 'es',
450
        showUpload: false,
451
        dropZoneEnabled: false,
452
        maxFileCount: 1,
453
        allowedFileExtensions: ['jpg', 'jpeg', 'png'],
454
        msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $image_size',
455
    });
6001 efrain 456
 
6056 efrain 457
    $('#form-add #attachment').fileinput({
458
        theme: 'fa',
459
        language: 'es',
460
        showUpload: false,
461
        dropZoneEnabled: false,
462
        maxFileCount: 1,
463
        allowedFileExtensions: ['jpg', 'jpeg', 'png', 'pdf', 'wav', 'mp3', 'mp4', 'mpeg','webm'],
464
        msgPlaceholder: 'LABEL_EXTENSIONS_ALLOWED jpg, jpeg, png, pdf, wav, mp3, mp4, mpeg, webm',
465
    });
6001 efrain 466
 
6056 efrain 467
    $('#form-add #category_id').select2({
468
        theme: 'bootstrap4',
469
    });
6001 efrain 470
 
471
 
472
 
6056 efrain 473
    $('#form-edit #image').fileinput({
474
        theme: 'fa',
475
        language: 'es',
476
        showUpload: false,
477
        dropZoneEnabled: false,
478
        maxFileCount: 1,
479
        allowedFileExtensions: ['jpg', 'jpeg', 'png'],
480
        msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $image_size',
481
    });
6001 efrain 482
 
6056 efrain 483
    $('#form-edit #attachment').fileinput({
484
        theme: 'fa',
485
        language: 'es',
486
        showUpload: false,
487
        dropZoneEnabled: false,
488
        maxFileCount: 1,
489
        allowedFileExtensions: ['jpg', 'jpeg', 'png', 'pdf', 'wav', 'mp3', 'mp4', 'mpeg','webm'],
490
        msgPlaceholder: 'LABEL_EXTENSIONS_ALLOWED jpg, jpeg, png, pdf, wav, mp3, mp4, mpeg, webm',
491
    });
6001 efrain 492
 
6056 efrain 493
    $('#form-edit #category_id').select2({
494
        theme: 'bootstrap4',
495
    });
6001 efrain 496
 
497
 
6056 efrain 498
    CKEDITOR.replace('description_add', {
499
        toolbar: [
500
                    { name: 'editing', items: ['Scayt'] },
501
                    { name: 'links', items: ['Link', 'Unlink'] },
502
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
503
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
504
                    '/',
505
                    { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
506
                    { name: 'styles', items: ['Styles', 'Format'] },
507
                    { name: 'tools', items: ['Maximize'] }
508
                ],
509
                removePlugins: 'elementspath,Anchor',
510
                heigth: 100
511
    });
6001 efrain 512
 
6056 efrain 513
    CKEDITOR.replace('description_edit',{
514
        toolbar: [
515
                    { name: 'editing', items: ['Scayt'] },
516
                    { name: 'links', items: ['Link', 'Unlink'] },
517
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
518
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
519
                    '/',
520
                    { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
521
                    { name: 'styles', items: ['Styles', 'Format'] },
522
                    { name: 'tools', items: ['Maximize'] }
523
                ],
524
                removePlugins: 'elementspath,Anchor',
525
                heigth: 100
526
    });
6001 efrain 527
 
6056 efrain 528
     $.fn.reload()
6001 efrain 529
 
530
 
6056 efrain 531
});
532
JS;
6094 stevensc 533
 
6056 efrain 534
$this->inlineScript()->captureEnd();
6094 stevensc 535
$this->headLink()->appendStylesheet('/look-and-field/knowledge.css');
536
?>
6001 efrain 537
 
6185 stevensc 538
<section class="companies-info container px-0">
6173 stevensc 539
    <div class="company-title">
6178 stevensc 540
        <h1 class="title mx-auto">LABEL_KNOWLEDGE_AREA_TITLE</h1>
6172 stevensc 541
        <?php if ($content_edit && $allowAdd) : ?>
6178 stevensc 542
            <h2 class="title cursor-pointer" id="knowledge-add-a">
543
                LABEL_KNOWLEDGE_AREA_ADD
544
            </h2>
6172 stevensc 545
        <?php endif; ?>
6094 stevensc 546
    </div>
6001 efrain 547
 
6185 stevensc 548
    <div class="row gap-3" id="row-list">
6098 stevensc 549
        <div class="knowledge-category-list col-12 col-md-3">
6094 stevensc 550
            <ul>
6100 stevensc 551
                <li class="knowledge-category-li knowledge-category-li-selected">
552
                    <a class="knowledge-category-a" href="" data-uuid="">LABEL_KNOWLEDGE_AREA_CATEGORY_ALL</a>
6094 stevensc 553
                </li>
554
                <?php
555
                foreach ($categories as $categorie) :
556
                ?>
6100 stevensc 557
                    <li class="knowledge-category-li">
558
                        <a class="knowledge-category-a" href="" data-uuid="<?php echo $categorie['uuid'] ?>"><?php echo $categorie['name'] ?></a>
6094 stevensc 559
                    </li>
6056 efrain 560
 
6094 stevensc 561
                <?php endforeach; ?>
562
            </ul>
563
        </div>
6056 efrain 564
 
6001 efrain 565
 
6188 stevensc 566
        <div class="col px-0">
6094 stevensc 567
            <div class="search-box">
568
                <form id="form-filter" name="form-filter">
569
                    <input type="text" name="search" id="search" class="form-control"><button class="btn btn-search">LABEL_SEARCH</button>
570
                </form>
571
            </div>
6001 efrain 572
 
6182 stevensc 573
            <div id="knowledge-record-list" class="knowledge-record-list mt-3">
6094 stevensc 574
            </div>
6001 efrain 575
 
6094 stevensc 576
            <div id="knowledge-record-pagination">
577
            </div>
6001 efrain 578
 
6094 stevensc 579
        </div>
580
    </div>
6001 efrain 581
 
6056 efrain 582
 
583
 
6094 stevensc 584
    <div class="row" id="row-add" style="display: none">
585
        <div class="col-12">
586
            <div class="card">
587
                <?php
6056 efrain 588
                $form = $this->formAdd;
589
                $form->setAttributes([
590
                    'method'    => 'post',
591
                    'name'      => 'form-add',
592
                    'id'        => 'form-add',
593
                    //'action'    => $routeAdd,
594
                ]);
6001 efrain 595
 
6056 efrain 596
                $form->prepare();
597
                echo $this->form()->openTag($form);
598
                ?>
599
                <div class="card-header">
600
                    <h4 class="modal-title">LABEL_ADD</h4>
601
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
602
                </div>
6001 efrain 603
 
6056 efrain 604
                <!-- Modal body -->
605
                <div class="card-body">
6094 stevensc 606
 
6056 efrain 607
                    <div class="form-group">
608
                        <?php
609
                        $element = $form->get('category_id');
610
                        $element->setOptions(['label' => 'LABEL_CATEGORY']);
611
                        $element->setAttributes(['class' => 'form-control']);
6094 stevensc 612
 
6056 efrain 613
                        echo $this->formLabel($element);
614
                        echo $this->formSelect($element);
615
                        ?>
616
                    </div>
6094 stevensc 617
                    <div class="form-group">
6056 efrain 618
                        <?php
619
                        $element = $form->get('title');
620
                        $element->setOptions(['label' => 'LABEL_TITLE']);
621
                        $element->setAttributes(['class' => 'form-control']);
6094 stevensc 622
 
6056 efrain 623
                        echo $this->formLabel($element);
624
                        echo $this->formText($element);
625
                        ?>
626
                    </div>
6094 stevensc 627
                    <div class="form-group">
6056 efrain 628
                        <?php
629
                        $element = $form->get('description');
630
                        $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
631
                        $element->setAttributes(['class' => 'form-control', 'id' => 'description_add']);
6094 stevensc 632
 
6056 efrain 633
                        echo $this->formLabel($element);
634
                        echo $this->formTextArea($element);
635
                        ?>
636
                    </div>
6094 stevensc 637
                    <div class="form-group">
6056 efrain 638
                        <?php
639
                        $element = $form->get('image');
640
                        $element->setOptions(['label' => 'LABEL_IMAGE']);
641
                        $element->setAttributes(['class' => 'form-control']);
6094 stevensc 642
 
6056 efrain 643
                        echo $this->formLabel($element);
644
                        echo $this->formFile($element);
645
                        ?>
646
                    </div>
6094 stevensc 647
                    <div class="form-group">
6056 efrain 648
                        <?php
649
                        $element = $form->get('attachment');
650
                        $element->setOptions(['label' => 'LABEL_ATTACHMENT']);
651
                        $element->setAttributes(['class' => 'form-control']);
6094 stevensc 652
 
6056 efrain 653
                        echo $this->formLabel($element);
654
                        echo $this->formFile($element);
655
                        ?>
656
                    </div>
6094 stevensc 657
                    <div class="form-group">
6056 efrain 658
                        <?php
659
                        $element = $form->get('link');
660
                        $element->setOptions(['label' => 'LABEL_LINK']);
661
                        $element->setAttributes(['class' => 'form-control']);
6094 stevensc 662
 
6056 efrain 663
                        echo $this->formLabel($element);
664
                        echo $this->formText($element);
665
                        ?>
666
                    </div>
667
                </div>
668
                <div class="card-footer">
6094 stevensc 669
                    <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
670
                    <button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
6056 efrain 671
                </div>
6094 stevensc 672
                <?php echo $this->form()->closeTag($form); ?>
6056 efrain 673
 
6001 efrain 674
            </div>
6056 efrain 675
        </div>
676
    </div>
6094 stevensc 677
 
678
    <div class="row" id="row-edit" style="display: none">
679
        <div class="col-12">
680
            <div class="card">
681
                <?php
6056 efrain 682
                $form = $this->formEdit;
683
                $form->setAttributes([
684
                    'method'    => 'post',
685
                    'name'      => 'form-edit',
686
                    'id'        => 'form-edit',
687
                    //'action'    => $routeAdd,
688
                ]);
689
 
690
                $form->prepare();
691
                echo $this->form()->openTag($form);
692
                ?>
693
                <div class="card-header">
694
                    <h4 class="modal-title">LABEL_EDIT</h4>
695
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
696
                </div>
697
 
698
                <!-- Modal body -->
699
                <div class="card-body">
6094 stevensc 700
 
6056 efrain 701
                    <div class="form-group">
702
                        <?php
703
                        $element = $form->get('category_id');
704
                        $element->setOptions(['label' => 'LABEL_CATEGORY']);
705
                        $element->setAttributes(['class' => 'form-control']);
6094 stevensc 706
 
6056 efrain 707
                        echo $this->formLabel($element);
708
                        echo $this->formSelect($element);
709
                        ?>
710
                    </div>
6094 stevensc 711
                    <div class="form-group">
6056 efrain 712
                        <?php
713
                        $element = $form->get('title');
714
                        $element->setOptions(['label' => 'LABEL_TITLE']);
715
                        $element->setAttributes(['class' => 'form-control']);
6094 stevensc 716
 
6056 efrain 717
                        echo $this->formLabel($element);
718
                        echo $this->formText($element);
719
                        ?>
720
                    </div>
6094 stevensc 721
                    <div class="form-group">
6056 efrain 722
                        <?php
723
                        $element = $form->get('description');
724
                        $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
725
                        $element->setAttributes(['class' => 'form-control', 'id' => 'description_edit']);
6094 stevensc 726
 
6056 efrain 727
                        echo $this->formLabel($element);
728
                        echo $this->formTextArea($element);
729
                        ?>
730
                    </div>
6094 stevensc 731
                    <div class="form-group">
6056 efrain 732
                        <?php
733
                        $element = $form->get('image');
734
                        $element->setOptions(['label' => 'LABEL_IMAGE']);
735
                        $element->setAttributes(['class' => 'form-control']);
6094 stevensc 736
 
6056 efrain 737
                        echo $this->formLabel($element);
738
                        echo $this->formFile($element);
739
                        ?>
740
                    </div>
6094 stevensc 741
                    <div class="form-group">
6056 efrain 742
                        <?php
743
                        $element = $form->get('attachment');
744
                        $element->setOptions(['label' => 'LABEL_ATTACHMENT']);
745
                        $element->setAttributes(['class' => 'form-control']);
6094 stevensc 746
 
6056 efrain 747
                        echo $this->formLabel($element);
748
                        echo $this->formFile($element);
749
                        ?>
750
                    </div>
6094 stevensc 751
                    <div class="form-group">
6056 efrain 752
                        <?php
753
                        $element = $form->get('link');
754
                        $element->setOptions(['label' => 'LABEL_LINK']);
755
                        $element->setAttributes(['class' => 'form-control']);
6094 stevensc 756
 
6056 efrain 757
                        echo $this->formLabel($element);
758
                        echo $this->formText($element);
759
                        ?>
760
                    </div>
761
                </div>
762
                <div class="card-footer">
6094 stevensc 763
                    <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
764
                    <button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
6056 efrain 765
                </div>
6094 stevensc 766
                <?php echo $this->form()->closeTag($form); ?>
6056 efrain 767
 
6001 efrain 768
            </div>
6056 efrain 769
        </div>
770
    </div>
6001 efrain 771
 
6094 stevensc 772
 
6056 efrain 773
</section>
774
 
775
<script id="recordTemplate" type="text/x-jsrender">
6094 stevensc 776
    <div class="knowledge-record-card">
6261 stevensc 777
        <a href="{{>link_view}}"  target="_blank" class="knowledge-record-card-actions-view">
778
            <img src="{{>image}}" alt="{{>title}} image">
779
        </a>
6269 stevensc 780
        <div class="d-flex align-items-center justify-content-between">
6094 stevensc 781
            {{if link_edit }}
782
            <button data-link="{{>link_edit}}" class="btn-knowledge-edit"> <i class="fa fa-pencil" aria-hidden="true"></i> </button>
783
            {{/if}}
784
            {{if link_delete }}
785
            <button data-link="{{>link_delete}}" class="btn-knowledge-delete"> <i class="fa fa-trash" aria-hidden="true"></i> </button>
786
            {{/if}}
787
        </div>
6098 stevensc 788
        <h3>{{>category}}</h3>
6332 stevensc 789
        <a href="{{>link_view}}"  target="_blank">
790
            <h2>{{>title}}</h2>
791
        </a>
6098 stevensc 792
        <p>{{>description}}</p>
6094 stevensc 793
    </div>
794
</script>