Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 17081 | Rev 17085 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
14934 stevensc 1
<?php
1 www 2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
4
 
5
$roleName = $currentUser->getUserTypeId();
6
 
7
 
8
$routeAdd       = $this->url('microlearning/content/topics/add');
9
$routeDatatable = $this->url('microlearning/content/topics');
10
 
11
$allowAdd               = $acl->isAllowed($roleName, 'microlearning/content/topics/add') ? 1 : 0;
12
$allowEdit              = $acl->isAllowed($roleName, 'microlearning/content/topics/edit') ? 1 : 0;
13
$allowDelete            = $acl->isAllowed($roleName, 'microlearning/content/topics/delete') ? 1 : 0;
14
 
15
 
16822 efrain 16
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
17
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
1 www 18
 
16822 efrain 19
$this->inlineScript()->appendFile($this->basePath('assets/vendors/ckeditor/ckeditor.js'));
1 www 20
 
21
 
16822 efrain 22
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/css/fileinput.min.css'));
23
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fas/theme.css'));
1 www 24
 
16843 efrain 25
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/piexif.js'));
26
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/sortable.js'));
16822 efrain 27
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/fileinput.js'));
28
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/locales/es.js'));
29
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/fas/theme.js'));
30
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fas/theme.js'));
1 www 31
 
32
 
33
 
16929 efrain 34
 
35
 
36
 
16822 efrain 37
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.css'));
38
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.css'));
16905 efrain 39
 
16822 efrain 40
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net/jquery.dataTables.js'));
41
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.js'));
42
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/dataTables.responsive.min.js'));
43
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.min.js'));
1 www 44
 
45
 
16822 efrain 46
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
47
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
1 www 48
 
49
 
50
 
51
 
52
 
16822 efrain 53
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-input-number/input-number-format.jquery.js'));
54
 
55
 
1 www 56
$status_active = \LeadersLinked\Model\Degree::STATUS_ACTIVE;
57
 
4697 nelberth 58
 
59
 
4737 nelberth 60
 
1 www 61
$this->inlineScript()->captureStart();
62
echo <<<JS
63
    jQuery( document ).ready(function( $ ) {
64
 
65
        $.validator.setDefaults({
66
            debug: true,
67
            highlight: function(element) {
68
                $(element).addClass('is-invalid');
69
            },
70
            unhighlight: function(element) {
71
                $(element).removeClass('is-invalid');
72
            },
73
            errorElement: 'span',
74
            errorClass: 'error invalid-feedback',
75
            errorPlacement: function(error, element) {
76
                if(element.parent('.btn-file').length) {
77
                    error.insertAfter(element.parent().parent());
78
                } else if(element.parent('.toggle').length) {
79
                    error.insertAfter(element.parent().parent());
80
                } else {
81
                    error.insertAfter(element.parent());
82
                }
83
            }
84
        });
85
 
86
 
87
 
88
 
89
 
90
 
91
        var allowEdit   = $allowEdit;
92
        var allowDelete = $allowDelete;
93
 
94
        var gridTable = $('#gridTable').dataTable( {
95
            'processing': true,
96
            'serverSide': true,
97
            'searching': true,
98
            'order': [[ 0, 'asc' ]],
99
            'ordering':  true,
100
            'ordenable' : true,
101
            'responsive': true,
102
            'select' : false,
103
        	'paging': true,
104
            'pagingType': 'simple_numbers',
105
    		'ajax': {
106
    			'url' : '$routeDatatable',
107
    			'type' : 'get',
108
                'beforeSend': function (request) {
109
                  NProgress.start();
110
                },
17084 stevensc 111
                'data': function ( d ) {
112
                    console.log(d)
113
                    d.topic_uuid = $('#form-filter #topic_uuid').val();
114
                },
1 www 115
                'dataFilter': function(response) {
116
                    var response = jQuery.parseJSON( response );
117
 
118
                    var json                = {};
119
                    json.recordsTotal       = 0;
120
                    json.recordsFiltered    = 0;
121
                    json.data               = [];
122
 
123
 
124
                    if(response.success) {
125
                        json.recordsTotal       = response.data.total;
126
                        json.recordsFiltered    = response.data.total;
127
                        json.data               = response.data.items;
128
                    } else {
129
                        $.fn.showError(response.data)
130
                    }
131
 
132
                    return JSON.stringify( json );
133
                }
134
    		},
135
            'language' : {
136
                'sProcessing':     'LABEL_DATATABLE_SPROCESSING',
137
                'sLengthMenu':     'LABEL_DATATABLE_SLENGTHMENU',
138
                'sZeroRecords':    'LABEL_DATATABLE_SZERORECORDS',
139
                'sEmptyTable':     'LABEL_DATATABLE_SEMPTYTABLE',
140
                'sInfo':           'LABEL_DATATABLE_SINFO',
141
                'sInfoEmpty':      'LABEL_DATATABLE_SINFOEMPTY',
142
                'sInfoFiltered':   'LABEL_DATATABLE_SINFOFILTERED',
143
                'sInfoPostFix':    '',
144
                'sSearch':         'LABEL_DATATABLE_SSEARCH',
145
                'sUrl':            '',
146
                'sInfoThousands':  ',',
147
                'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
148
                'oPaginate': {
149
                    'sFirst':    'LABEL_DATATABLE_SFIRST',
150
                    'sLast':     'LABEL_DATATABLE_SLAST',
151
                    'sNext':     'LABEL_DATATABLE_SNEXT',
152
                    'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
153
                },
154
                'oAria': {
155
                    'sSortAscending':  ': LABEL_DATATABLE_SSORTASCENDING',
156
                    'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
157
                },
158
            },
159
            'drawCallback': function( settings ) {
160
                NProgress.done();
16822 efrain 161
 
1 www 162
            },
163
            'aoColumns': [
164
                { 'mDataProp': 'name' },
165
                { 'mDataProp': 'status' },
166
                { 'mDataProp': 'image' },
167
                { 'mDataProp': 'actions' },
168
    	    ],
169
            'columnDefs': [
170
                {
171
                    'targets': 0,
172
                    'className' : 'text-vertical-middle',
173
                },
174
                {
175
                    'targets': -2,
176
                    'orderable': false,
177
                    'render' : function ( data, type, row ) {
178
                        s = '&nbsp;';
179
 
180
                        if( data )  {
181
                            s = s + '&nbsp;<img class="btn-view-image-app" data-href="' + data + '" data-toggle="tooltip" src="'+data+'" title="LABEL_VIEW" style="width: 40px; object-fit: cover; height: 40px;" /> '
182
                        }  else {
183
                            s = s + '&nbsp;LABEL_IMAGE: <br>';
184
                        }
185
 
186
 
187
                        return s;
188
                    }
189
                },
190
 
191
 
192
                {
193
                    'targets': -1,
194
                    'orderable': false,
195
                    'render' : function ( data, type, row ) {
196
                        s = '';
197
 
198
                        if(allowEdit && data['link_edit']  ) {
16906 efrain 199
                            s = s + '<button class="btn btn-info btn-sm btn-edit" data-href="' + data['link_edit']+ '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pen"></i> LABEL_EDIT </button>&nbsp;';
1 www 200
                        }
201
                        if(allowDelete && data['link_delete']  ) {
202
                            s = s + '<button class="btn btn-danger btn-sm btn-delete" data-href="' + data['link_delete']+ '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button>&nbsp;';
203
                        }
204
                        return s;
205
                    }
206
                }
207
              ],
208
        });
209
 
210
 
16905 efrain 211
    var validatorAdd = $('#form-add').validate({
1 www 212
        debug: true,
213
        onclick: false,
214
        onkeyup: false,
215
        ignore: [],
216
        rules: {
217
            'name': {
218
                required: true,
219
                maxlength: 128,
220
            },
221
            'description': {
222
                updateCkeditor:function() {
223
                        CKEDITOR.instances.description_add.updateElement();
224
                },
225
                required: true
226
            },
227
           'file': {
228
                required: true,
16891 efrain 229
                extension: 'jpg|jpeg|png',
230
                accept: 'image/jpg,image/jpeg,image/png'
1 www 231
            },
232
            'order' : {
233
                required: true,
234
                digits: true,
235
                min: 1,
236
                max: 250
237
            },
238
            'status' : {
239
                required: true,
240
            },
241
        },
242
        submitHandler: function(form)
243
        {
244
            var formdata = false;
245
            if (window.FormData){
246
                formdata = new FormData(form); //form[0]);
247
            }
5709 nelberth 248
 
249
 
250
			$('.info_noticia').prop('disabled', true);
5703 nelberth 251
			NProgress.start();
1 www 252
            $.ajax({
253
                'dataType'  : 'json',
254
                'accept'    : 'application/json',
255
                'method'    : 'post',
16905 efrain 256
                'url'       :  $('#form-add').attr('action'),
1 www 257
                'data'      :  formdata,
258
                'processData': false,
259
                'contentType': false,
260
            }).done(function(response) {
5542 nelberth 261
				console.log(response)
262
				if(response['success']) {
1 www 263
                    $.fn.showSuccess(response['data']);
16891 efrain 264
 
265
                    $('#row-add').hide();
266
                    $('#row-edit').hide();
267
                    $('#row-listing').show();
268
 
269
 
1 www 270
                    gridTable.api().ajax.reload(null, false);
271
                } else {
272
                    validatorAdd.resetForm();
273
                    if(jQuery.type(response['data']) == 'string') {
274
                        $.fn.showError(response['data']);
275
                    } else  {
276
                        $.each(response['data'], function( fieldname, errors ) {
16905 efrain 277
                            $.fn.showFormErrorValidator('#form-add #' + fieldname, errors);
1 www 278
                        });
279
                    }
280
                }
281
            }).fail(function( jqXHR, textStatus, errorThrown) {
5709 nelberth 282
 
16891 efrain 283
 
1 www 284
                $.fn.showError(textStatus);
285
            }).always(function() {
16891 efrain 286
 
1 www 287
                NProgress.done();
288
            });
289
            return false;
290
        },
291
        invalidHandler: function(form, validator) {
292
 
293
        }
294
    });
295
 
16905 efrain 296
    var validatorEdit  = $('#form-edit').validate({
1 www 297
        debug: true,
298
        onclick: false,
299
        onkeyup: false,
300
        ignore: [],
301
        rules: {
302
            'name': {
303
                required: true,
304
                maxlength: 128,
305
            },
306
            'description': {
307
                updateCkeditor:function() {
308
                        CKEDITOR.instances.description_edit.updateElement();
309
                },
310
                required: true
311
            },
312
           'file': {
16945 efrain 313
                required: false,
16891 efrain 314
                extension: 'jpg|jpeg|png',
315
                accept: 'image/jpg,image/jpeg,image/png'
1 www 316
            },
317
            'order' : {
318
                required: true,
319
                digits: true,
320
                min: 1,
321
                max: 250
322
            },
323
            'status' : {
324
                required: true,
325
            },
326
 
327
        },
328
        submitHandler: function(form)
329
        {
330
            var formdata = false;
331
            if (window.FormData){
332
                formdata = new FormData(form); //form[0]);
333
            }
334
 
16891 efrain 335
 
5982 nelberth 336
			NProgress.start();
1 www 337
            $.ajax({
338
                'dataType'  : 'json',
339
                'accept'    : 'application/json',
340
                'method'    : 'post',
16905 efrain 341
                'url'       :  $('#form-edit').attr('action'),
1 www 342
                'data'      :  formdata,
343
                'processData': false,
344
                'contentType': false,
345
            }).done(function(response) {
346
                if(response['success']) {
347
                    $.fn.showSuccess(response['data']);
348
 
16891 efrain 349
 
1 www 350
                    gridTable.api().ajax.reload(null, false);
16891 efrain 351
 
352
 
353
                    $('#row-add').hide();
354
                    $('#row-edit').hide();
355
                    $('#row-listing').show();
356
 
1 www 357
                } else {
16891 efrain 358
                    validatorEdit.resetForm();
1 www 359
                    if(jQuery.type(response['data']) == 'string') {
360
                        $.fn.showError(response['data']);
361
                    } else  {
362
                        $.each(response['data'], function( fieldname, errors ) {
16905 efrain 363
                            $.fn.showFormErrorValidator('#form-edit #' + fieldname, errors);
1 www 364
                        });
365
                    }
366
                }
367
            }).fail(function( jqXHR, textStatus, errorThrown) {
368
                $.fn.showError(textStatus);
369
            }).always(function() {
7060 nelberth 370
 
16891 efrain 371
 
1 www 372
                NProgress.done();
373
            });
374
            return false;
375
        },
376
        invalidHandler: function(form, validator) {
377
 
378
        }
379
    });
380
 
16822 efrain 381
    $('body').on('click', 'button.btn-delete', function(e) {
382
        e.preventDefault();
383
        var action = $(this).data('href');
1 www 384
 
16822 efrain 385
 
386
          swal.fire({
387
            title: 'LABEL_ARE_YOU_SURE',
388
            icon: 'question',
389
            cancelButtonText: 'LABEL_NO',
390
            showCancelButton: true,
391
            confirmButtonText: 'LABEL_YES'
392
          }).then((result) => {
393
            if (result.isConfirmed) {
394
 
395
                    NProgress.start();
396
                    $.ajax({
397
                        'dataType'  : 'json',
398
                        'accept'    : 'application/json',
399
                        'method'    : 'post',
400
                        'url'       :  action,
401
                    }).done(function(response) {
402
                        if(response['success']) {
403
                            $.fn.showSuccess(response['data']);
404
                            gridTable.api().ajax.reload(null, false);
405
                        } else {
406
                            $.fn.showError(response['data']);
407
                        }
408
                    }).fail(function( jqXHR, textStatus, errorThrown) {
409
                        $.fn.showError(textStatus);
410
                    }).always(function() {
411
                        NProgress.done();
412
                    });
413
                }
414
           });
415
        });
416
 
1 www 417
 
418
        $('body').on('click', '.btn-view-image-app', function(e) {
419
            e.preventDefault();
420
 
421
            $('#image-app').attr('src', $(this).data('href'));
16891 efrain 422
            $('#modalPreviewImage').modal('show');
1 www 423
            return false;
424
        });
425
 
16905 efrain 426
        $('#form-add #order').inputNumberFormat({decimal: 0});
5741 nelberth 427
 
1 www 428
 
429
 
430
        $('body').on('click', 'button.btn-add', function(e) {
431
            e.preventDefault();
6015 nelberth 432
 
16905 efrain 433
            $('#form-add #name').val('');
434
            $('#form-add #order').val('1');
435
            $('#form-add #name').val('');
1 www 436
 
16905 efrain 437
            $('#form-add #status').val('');
438
            $('#form-add #file').fileinput('reset');
439
            $('#form-add #file').val('');
16891 efrain 440
 
1 www 441
 
442
 
443
            CKEDITOR.instances.description_add.setData('');
444
            validatorAdd.resetForm();
16891 efrain 445
 
446
            $('#row-edit').hide();
447
            $('#row-listing').hide();
448
            $('#row-add').show();
1 www 449
 
16891 efrain 450
 
5646 nelberth 451
            return false;
452
        });
453
 
16891 efrain 454
 
1 www 455
 
16905 efrain 456
        $('#form-edit #order').inputNumberFormat({decimal: 0});
1 www 457
 
16905 efrain 458
          $('#form-add #file').fileinput({
16891 efrain 459
                theme: 'fa',
460
                language: 'es',
461
                showUpload: false,
462
                dropZoneEnabled: false,
463
                maxFileCount: 1,
16928 efrain 464
                msgPlaceholder:  'LABEL_RECOMMENDED_SIZE $image_size',
16891 efrain 465
                allowedFileExtensions: ['jpeg', 'jpg', 'png'],
466
            });
467
 
16905 efrain 468
            $('#form-edit #file').fileinput({
16891 efrain 469
                theme: 'fa',
470
                language: 'es',
471
                showUpload: false,
472
                dropZoneEnabled: false,
473
                maxFileCount: 1,
16928 efrain 474
                msgPlaceholder:  'LABEL_RECOMMENDED_SIZE $image_size',
16891 efrain 475
                allowedFileExtensions: ['jpeg', 'jpg', 'png'],
476
            });
8591 nelberth 477
 
1 www 478
        $('body').on('click', 'button.btn-edit', function(e) {
479
            e.preventDefault();
6015 nelberth 480
 
1 www 481
            var url = $(this).data('href');
5900 nelberth 482
			NProgress.start();
1 www 483
            $.ajax({
484
                'dataType'  : 'json',
485
                'accept'    : 'application/json',
486
                'method'    : 'get',
487
                'url'       :  url,
488
            }).done(function(response) {
489
                if(response['success']) {
5913 nelberth 490
					console.log(response['data'])
16905 efrain 491
                    $('#form-edit')[0].reset();
1 www 492
 
16905 efrain 493
                    $('#form-edit').attr('action',url);
494
                    $('#form-edit #name').val(response['data']['name']);
495
                    $('#form-edit #order').val(response['data']['order']);
1 www 496
 
16905 efrain 497
					$('#form-edit #status').val(response['data']['status']);
498
                    $('#form-edit #file').fileinput('reset');
499
                    $('#form-edit #file').val('');
1 www 500
 
501
                    CKEDITOR.instances.description_edit.setData(response['data']['description']);
502
                    validatorEdit.resetForm();
16891 efrain 503
 
504
                    $('#row-add').hide();
505
                    $('#row-listing').hide();
506
                    $('#row-edit').show();
507
 
1 www 508
                } else {
509
                    validatorEdit.resetForm();
510
                    if(jQuery.type(response['data']) == 'string') {
511
                        $.fn.showError(response['data']);
512
                    } else  {
513
                        $.each(response['data'], function( fieldname, errors ) {
16905 efrain 514
                            $.fn.showFormErrorValidator('#form-edit #' + fieldname, errors);
1 www 515
                        });
516
                    }
517
                }
518
            }).fail(function( jqXHR, textStatus, errorThrown) {
519
                $.fn.showError(textStatus);
520
            }).always(function() {
521
                NProgress.done();
522
            });
523
        });
524
 
525
        $('body').on('click', 'button.btn-cancel', function(e) {
526
            e.preventDefault();
16891 efrain 527
            $('#row-add').hide();
528
            $('#row-edit').hide();
529
            $('#row-listing').show();
530
 
1 www 531
        });
532
 
533
        $('body').on('click', 'button.btn-refresh', function(e) {
534
            e.preventDefault();
535
            gridTable.api().ajax.reload(null, false);
536
        });
537
 
8290 stevensc 538
        CKEDITOR.replace('description_add', {
539
			toolbar: [
540
                    { name: 'editing', items: ['Scayt'] },
541
                    { name: 'links', items: ['Link', 'Unlink'] },
542
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
543
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
544
                    '/',
545
                    { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
546
                    { name: 'styles', items: ['Styles', 'Format'] },
547
                    { name: 'tools', items: ['Maximize'] }
548
                ],
549
                removePlugins: 'elementspath,Anchor',
550
                heigth: 100
551
		});
552
        CKEDITOR.replace('description_edit', {
553
			toolbar: [
554
                    { name: 'editing', items: ['Scayt'] },
555
                    { name: 'links', items: ['Link', 'Unlink'] },
556
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
557
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
558
                    '/',
559
                    { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
560
                    { name: 'styles', items: ['Styles', 'Format'] },
561
                    { name: 'tools', items: ['Maximize'] }
562
                ],
563
                removePlugins: 'elementspath,Anchor',
564
                heigth: 100
565
		});
1 www 566
 
4798 nelberth 567
 
568
 
5202 nelberth 569
 
1 www 570
    });
571
JS;
572
$this->inlineScript()->captureEnd();
573
?>
574
 
16891 efrain 575
<div class="container">
576
	<div class="card" id="row-listing">
577
	 	<div class="card-header">
578
	 		<h6 class="card-title">LABEL_TOPICS</h6>
579
	 	</div>
580
	 	<div class="card-body">
17081 stevensc 581
            <?php
582
				$form = $this->form;
583
				$form->setAttributes([
584
					'name'    => 'form-filter',
585
					'id'      => 'form-filter',
586
				]);
587
				$form->prepare();
588
				echo $this->form()->openTag($form);
589
            ?>
590
				<div class="row">
591
	 	            <div class="col-12 mt-3">
592
						<?php
593
						    $element = $form->get('capsules_id');
594
						    $element->setAttributes(['class' => 'form-control']);
595
						    $element->setLabel('LABEL_CAPSULES');
596
						    echo $this->formLabel($element);
597
						    echo $this->formSelect($element);
598
						?>
599
	 	            </div>
600
	 	        </div>
601
		    <?php echo $this->form()->closeTag($form); ?>
16891 efrain 602
	 		<div class="row">
603
	 	         <div class="col-12 mt-3">
604
 
605
	 	         						<table id="gridTable" class="table   table-bordered">
14934 stevensc 606
							<thead>
607
								<tr>
608
									<th>LABEL_NAME</th>
609
									<th>LABEL_STATUS</th>
610
									<th>LABEL_DETAILS</th>
611
									<th>LABEL_ACTIONS</th>
612
								</tr>
613
							</thead>
614
							<tbody>
615
							</tbody>
616
						</table>
16891 efrain 617
 
618
	 	         </div>
619
	 	     </div>
620
	 	</div>
621
	 	<div class="card-footer text-right">
16992 efrain 622
			<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-sync"></i> LABEL_REFRESH </button>
16891 efrain 623
			<?php if ($allowAdd) : ?>
624
			<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
625
			<?php endif; ?>
626
	 	</div>
14934 stevensc 627
	</div>
16891 efrain 628
 
629
	<div class="card" id="row-add" style="display:none">
630
	 	<div class="card-header">
631
	 		<h6 class="card-title">LABEL_ADD_TOPIC</h6>
632
	 	</div>
633
	 	<?php
14934 stevensc 634
		$form = $this->formAdd;
635
		$form->setAttributes([
636
			'method'  => 'post',
637
			'action'  => $routeAdd,
16905 efrain 638
			'name'    => 'form-add',
639
			'id'      => 'form-add',
14934 stevensc 640
		]);
5678 nelberth 641
 
14934 stevensc 642
		$form->prepare();
643
		echo $this->form()->openTag($form);
644
		?>
16891 efrain 645
	 	<div class="card-body">
646
			<div class="row">
647
    	 		<div class="col-12 mt-3">
648
    			<?php
649
    			$element = $form->get('name');
650
 
651
    			$element->setAttributes(['class' => 'form-control']);
652
    			$element->setOptions(['label' => 'LABEL_NAME']);
653
    			echo $this->formLabel($element);
654
    			echo $this->formText($element);
655
    			?>
656
    			</div>
657
    		</div>
658
 
659
 
660
             <div class="row">
661
    	 	         	<div class="col-12 mt-3">
662
    			<?php
663
    			$element = $form->get('description');
664
    			$element->setAttributes(['id' => 'description_add', 'class' => 'form-control', 'rows' => '2', 'class' => 'form-control']);
665
    			$element->setOptions(['label' => 'LABEL_DESCRIPTION']);
666
    			echo $this->formLabel($element);
667
    			echo $this->formTextArea($element);
668
    			?>
669
    			</div>
670
    		</div>
671
 
672
             <div class="row">
673
    	 	         	<div class="col-12 mt-3">
674
    			<?php
675
    			$element = $form->get('order');
676
    			$element->setAttributes(['class' => 'form-control']);
677
    			$element->setOptions(['label' => 'LABEL_ORDER']);
678
    			echo $this->formLabel($element);
679
    			echo $this->formText($element);
680
    			?>
681
    			</div>
682
    		</div>
683
 
684
 
685
 
686
             <div class="row">
687
    	 	         	<div class="col-12 mt-3">
688
    			<?php
689
    			$element = $form->get('status');
690
    			$element->setAttributes(['class' => 'form-control']);
691
    			$element->setOptions(['label' => 'LABEL_STATUS']);
692
    			echo $this->formLabel($element);
693
    			echo $this->formSelect($element);
694
 
695
    			?>
696
    			</div>
697
    		</div>
698
 
699
 
700
             <div class="row">
701
    	 		<div class="col-12 mt-3">
702
                            <?php
703
                            $element = $form->get('file');
704
                            $element->setOptions(['label' => 'LABEL_IMAGE']);
705
                            $element->setAttributes(['class' => 'form-control']);
16905 efrain 706
                            $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
16891 efrain 707
                            echo $this->formLabel($element);
708
                            echo $this->formFile($element);
709
                            ?>
710
                	</div>
711
         	</div>
712
	 	</div>
713
	 	<div class="card-footer text-right">
714
	 	     <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
715
      		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
716
	 	</div>
717
	 	<?php echo $this->form()->closeTag($form); ?>
14934 stevensc 718
	</div>
16891 efrain 719
 
720
 
721
	<div class="card" id="row-edit" style="display:none">
722
 
723
	 	<div class="card-header">
724
	 		<h6 class="card-title">LABEL_EDIT_TOPIC</h6>
725
	 	</div>
726
	 	<?php
14934 stevensc 727
		$form = $this->formEdit;
728
		$form->setAttributes([
729
			'method'    => 'post',
16905 efrain 730
			'name'      => 'form-edit',
731
			'id'        => 'form-edit'
14934 stevensc 732
		]);
5895 nelberth 733
 
14934 stevensc 734
		$form->prepare();
735
		echo $this->form()->openTag($form);
736
		?>
16891 efrain 737
 
738
	 	<div class="card-body">
1 www 739
 
16891 efrain 740
  <div class="row">
741
	 	         	<div class="col-12 mt-3">
14934 stevensc 742
			<?php
743
			$element = $form->get('description');
744
			$element->setAttributes(['id' => 'description_edit', 'rows' => '2', 'class' => 'form-control',   'class' => 'form-control']);
745
			$element->setOptions(['label' => 'LABEL_DESCRIPTION']);
746
			echo $this->formLabel($element);
747
			echo $this->formTextArea($element);
748
			?>
16891 efrain 749
			</div>
14934 stevensc 750
		</div>
16891 efrain 751
 
752
         <div class="row">
753
	 	         	<div class="col-12 mt-3">
14934 stevensc 754
			<?php
755
			$element = $form->get('order');
756
			$element->setAttributes(['class' => 'form-control']);
757
			$element->setOptions(['label' => 'LABEL_ORDER']);
758
			echo $this->formLabel($element);
759
			echo $this->formText($element);
760
			?>
16891 efrain 761
			</div>
14934 stevensc 762
		</div>
1 www 763
 
14934 stevensc 764
 
16891 efrain 765
 
766
         <div class="row">
767
	 	         	<div class="col-12 mt-3">
14934 stevensc 768
			<?php
769
			$element = $form->get('status');
770
			$element->setAttributes(['class' => 'form-control']);
771
			$element->setOptions(['label' => 'LABEL_STATUS']);
772
			echo $this->formLabel($element);
773
			echo $this->formSelect($element);
774
			?>
16891 efrain 775
			</div>
14934 stevensc 776
		</div>
777
 
16891 efrain 778
         <div class="row">
779
	 	         	<div class="col-12 mt-3">
780
                        <?php
781
                        $element = $form->get('file');
782
                        $element->setOptions(['label' => 'LABEL_IMAGE']);
783
                        $element->setAttributes(['class' => 'form-control']);
16905 efrain 784
                        $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
16891 efrain 785
                        echo $this->formLabel($element);
786
                        echo $this->formFile($element);
787
                        ?>
788
                    </div>
789
                </div>
790
 
791
 
792
	 	</div>
793
 
794
	 	<div class="card-footer text-right">
795
			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
796
      		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
797
	 	</div>
798
	 	<?php echo $this->form()->closeTag($form); ?>
14934 stevensc 799
	</div>
16891 efrain 800
</div>
14934 stevensc 801
 
802
 
1 www 803
 
804
<!-- The Modal -->
16891 efrain 805
<div class="modal" id="modalPreviewImage">
1 www 806
	<div class="modal-dialog ">
14934 stevensc 807
		<div class="modal-content">
1 www 808
 
14934 stevensc 809
			<!-- Modal Header -->
810
			<div class="modal-header">
16845 efrain 811
				<h6 class="modal-title">LABEL_IMAGE</h6>
16822 efrain 812
				<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
14934 stevensc 813
			</div>
1 www 814
 
14934 stevensc 815
			<!-- Modal body -->
816
			<div class="modal-body text-center">
1 www 817
				<img src="" class="img img-responsive" style="width: 300px; height: auto" id="image-app" />
14934 stevensc 818
			</div>
819
 
820
			<!-- Modal footer -->
16891 efrain 821
			<div class="modal-footer text-right">
16822 efrain 822
				 <button type="button" class="btn btn-light" data-bs-dismiss="modal">LABEL_CLOSE</button>
14934 stevensc 823
			</div>
824
		</div>
1 www 825
	</div>
14934 stevensc 826
</div>