Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev Autor Línea Nro. Línea
1 www 1
<?php
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
4
 
5
$roleName = $currentUser->getUserTypeId();
6
 
7
 
8
 
9
$routeDatatable = $this->url('microlearning/content/capsules');
10
 
11
$allowAdd       = $acl->isAllowed($roleName, 'microlearning/content/capsules/add') ? 1 : 0;
12
$allowEdit      = $acl->isAllowed($roleName, 'microlearning/content/capsules/edit') ? 1 : 0;
13
$allowDelete    = $acl->isAllowed($roleName, 'microlearning/content/capsules/delete') ? 1 : 0;
14
$allowUsers     = $acl->isAllowed($roleName, 'microlearning/content/capsules/users') ? 1 : 0;
15
 
16
 
17
 
18
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
19
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
20
 
21
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
22
 
23
 
24
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/css/fileinput.min.css'));
25
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.css'));
26
 
27
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/piexif.js'));
28
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/sortable.js'));
29
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/fileinput.js'));
30
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/locales/es.js'));
31
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/fas/theme.js'));
32
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.js'));
33
 
34
 
35
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
36
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
37
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
38
 
39
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
40
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
41
 
42
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
43
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
44
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
45
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
46
 
6701 nelberth 47
$this->headLink()->appendStylesheet($this->basePath('plugins/nelberth-editor/style.css'));
1 www 48
 
49
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
50
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
51
 
52
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
53
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
54
 
55
 
56
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-input-number/input-number-format.jquery.js'));
57
 
58
 
59
$this->headStyle()->captureStart();
60
echo <<<CSS
61
 
62
 
63
#gridTableUsers {
64
    display: flex;
65
    flex-flow: column;
66
    width: 100%;
67
}
68
 
69
#gridTableUsers thead {
70
    flex: 0 0 auto;
71
}
72
 
73
#gridTableUsers tbody {
74
    flex: 1 1 auto;
75
    display: block;
76
    overflow-y: auto;
77
    overflow-x: hidden;
78
}
79
 
80
#gridTableUsers tr {
81
    width: 100%;
82
    display: table;
83
    table-layout: fixed;
84
}
85
CSS;
86
$this->headStyle()->captureEnd();
87
 
88
$this->headLink()->captureStart();
89
 
90
$this->inlineScript()->captureStart();
91
echo <<<JS
92
    jQuery( document ).ready(function( $ ) {
93
 
94
        $.validator.setDefaults({
95
            debug: true,
96
            highlight: function(element) {
97
                $(element).addClass('is-invalid');
98
            },
99
            unhighlight: function(element) {
100
                $(element).removeClass('is-invalid');
101
            },
102
            errorElement: 'span',
103
            errorClass: 'error invalid-feedback',
104
            errorPlacement: function(error, element) {
105
                if(element.parent('.btn-file').length) {
106
                    error.insertAfter(element.parent().parent());
107
                } else if(element.parent('.toggle').length) {
108
                    error.insertAfter(element.parent().parent());
109
                } else {
110
                    error.insertAfter(element.parent());
111
                }
112
            }
113
        });
114
 
115
 
116
        $.fn.showFormErrorValidator = function(fieldname, errors) {
117
            var field = $(fieldname);
118
            if(field) {
119
                $(field).addClass('is-invalid');
120
 
121
 
122
                var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
123
                if(element.parent('.btn-file').length) {
124
                    error.insertAfter(element.parent().parent());
125
                } else if(element.parent('.toggle').length) {
126
                    error.insertAfter(element.parent().parent());
127
                } else {
128
                    error.insertAfter(element.parent());
129
                }
130
            }
131
        };
132
 
133
 
134
 
135
        var allowEdit   = $allowEdit;
136
        var allowDelete = $allowDelete;
137
        var allowUsers  = $allowUsers;
138
 
139
 
140
        var gridTable = $('#gridTable').dataTable( {
141
            'processing': true,
142
            'serverSide': true,
143
            'searching': true,
144
            'order': [[ 0, 'asc' ]],
145
            'ordering':  true,
146
            'ordenable' : true,
147
            'responsive': true,
148
            'select' : false,
149
        	'paging': true,
150
            'pagingType': 'simple_numbers',
151
 
152
    		'ajax': {
153
    			'url' : '$routeDatatable',
154
    			'type' : 'get',
155
                'data': function ( d ) {
156
                    d.topic_uuid = $('#form-filter #topic_uuid').val();
157
 
158
                },
159
                'beforeSend': function (request) {
160
                  NProgress.start();
161
                },
162
                'dataFilter': function(response) {
163
                    var response = jQuery.parseJSON( response );
164
 
165
                    var json                = {};
166
                    json.recordsTotal       = 0;
167
                    json.recordsFiltered    = 0;
168
                    json.data               = [];
169
 
170
                    if(response.success) {
171
                        $('#form-capsule-add').attr('action', response.data.link_add );
172
 
173
                        json.recordsTotal       = response.data.total;
174
                        json.recordsFiltered    = response.data.total;
175
                        json.data               = response.data.items;
176
                    } else {
177
                        $.fn.showError(response.data)
178
                    }
179
 
180
                    return JSON.stringify( json );
181
                }
182
    		},
183
            'language' : {
184
                'sProcessing':     'LABEL_DATATABLE_SPROCESSING',
185
                'sLengthMenu':     'LABEL_DATATABLE_SLENGTHMENU',
186
                'sZeroRecords':    'LABEL_DATATABLE_SZERORECORDS',
187
                'sEmptyTable':     'LABEL_DATATABLE_SEMPTYTABLE',
188
                'sInfo':           'LABEL_DATATABLE_SINFO',
189
                'sInfoEmpty':      'LABEL_DATATABLE_SINFOEMPTY',
190
                'sInfoFiltered':   'LABEL_DATATABLE_SINFOFILTERED',
191
                'sInfoPostFix':    '',
192
                'sSearch':         'LABEL_DATATABLE_SSEARCH',
193
                'sUrl':            '',
194
                'sInfoThousands':  ',',
195
                'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
196
                'oPaginate': {
197
                    'sFirst':    'LABEL_DATATABLE_SFIRST',
198
                    'sLast':     'LABEL_DATATABLE_SLAST',
199
                    'sNext':     'LABEL_DATATABLE_SNEXT',
200
                    'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
201
                },
202
                'oAria': {
203
                    'sSortAscending':  ': LABEL_DATATABLE_SSORTASCENDING',
204
                    'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
205
                },
206
            },
207
            'drawCallback': function( settings ) {
208
                NProgress.done();
209
                $('button.btn-delete').confirmation({
210
                    rootSelector: 'button.btn-delete',
211
                    title : 'LABEL_ARE_YOU_SURE',
212
                    singleton : true,
213
                    btnOkLabel: 'LABEL_YES',
214
                    btnCancelLabel: 'LABEL_NO',
215
                    onConfirm: function(value) {
216
                        action = $(this).data('href');
217
                        NProgress.start();
218
                        $.ajax({
219
                            'dataType'  : 'json',
220
                            'accept'    : 'application/json',
221
                            'method'    : 'post',
222
                            'url'       :  action,
223
                        }).done(function(response) {
224
                            if(response['success']) {
225
                                $.fn.showSuccess(response['data']);
226
                                gridTable.api().ajax.reload(null, false);
227
                            } else {
228
                                $.fn.showError(response['data']);
229
                            }
230
                        }).fail(function( jqXHR, textStatus, errorThrown) {
231
                            $.fn.showError(textStatus);
232
                        }).always(function() {
233
                            NProgress.done();
234
                        });
235
                    },
236
                });
237
            },
238
            'aoColumns': [
239
                { 'mDataProp': 'name' },
240
                { 'mDataProp': 'details' },
241
                { 'mDataProp': 'images' },
242
                { 'mDataProp': 'actions' },
243
    	    ],
244
            'columnDefs': [
245
                {
246
                    'targets': 0,
247
                    'className' : 'text-vertical-middle',
248
                },
249
                {
250
                    'targets': -3,
251
                    'orderable': false,
252
                    'render' : function ( data, type, row ) {
253
                        var s = '';
254
                        s += 'LABEL_STATUS: ' + data['status']  + '<br/>';
255
 
256
                         if(allowUsers && row['actions']['link_total_users']  ) {
257
                            s += 'LABEL_TOTAL_USERS: ' + data['total_users']  + ' <button class="btn btn-view-total-users" data-href="' + row['actions']['link_total_users'] + '" data-toggle="tooltip" title="LABEL_VIEW"><i class="fa fa-external-link"></i></button> <br>';
258
                         } else {
259
                            s += 'LABEL_TOTAL_USERS: ' + data['total_users']  + '<br/>';
260
                         }
261
                         if(allowUsers && row['actions']['link_total_users_actives']  ) {
262
                            s += 'LABEL_TOTAL_USERS_ACTIVE: ' + data['total_users_active']  + ' <button class="btn btn-view-total-users" data-href="' + row['actions']['link_total_users_actives'] + '" data-toggle="tooltip" title="LABEL_VIEW"><i class="fa fa-external-link"></i></button> <br>';
263
                         } else {
264
                            s += 'LABEL_TOTAL_USERS_ACTIVE: ' + data['total_users_active']  + '<br/>';
265
                         }
266
 
267
                        return s;
268
                    }
269
                },
270
                {
271
                    'targets': -2,
272
                    'orderable': false,
273
                    'render' : function ( data, type, row ) {
274
                        s = '';
275
 
276
                        if( data['image'] )  {
277
                            s = s + '&nbsp; <img class="btn-view-image-app" data-href="' + data['image'] + '" data-toggle="tooltip" src="'+data['image']+'" title="LABEL_VIEW" style="width: 40px; object-fit: cover; height: 40px;" /> '
278
                        }  else {
279
                            s = s + '';
280
                        }
281
 
282
                        if( data['marketplace'] )  {
283
                            s = s + '&nbsp; <img class="btn-view-image-marketplace" data-href="' + data['image'] + '" data-toggle="tooltip" src="'+data['image']+'" title="LABEL_VIEW" style="width: 40px; object-fit: cover; height: 40px;" /> '
284
                        }  else {
285
                            s = s + '';
286
                        }
287
 
288
 
289
 
290
                        return s;
291
                    }
292
                },
293
 
294
 
295
                {
296
                    'targets': -1,
297
                    'orderable': false,
298
                    'render' : function ( data, type, row ) {
299
                        s = '';
300
 
301
                        if(allowEdit && data['link_edit']  ) {
302
                            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-pencil"></i> LABEL_EDIT </button>&nbsp;';
303
                        }
304
                        if(allowDelete && data['link_delete']  ) {
305
                            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;';
306
                        }
307
 
308
                        return s;
309
                    }
310
                }
311
              ],
312
        });
313
 
314
 
6823 nelberth 315
        var seleccionarCampo;
1 www 316
    var validatorAdd = $('#form-capsule-add').validate({
317
        debug: true,
318
        onclick: false,
319
        onkeyup: false,
320
        ignore: [],
321
        rules: {
322
            'name': {
323
                required: true,
324
                maxlength: 128,
325
            },
326
            'description': {
327
                updateCkeditor:function() {
328
                        CKEDITOR.instances.description_add.updateElement();
329
                },
330
                required: true
331
            },
332
           'file': {
333
                required: true,
334
            },
335
            'order' : {
336
                required: true,
337
                digits: true,
338
                min: 1,
339
                max: 250
340
            },
341
           'marketplace': {
6861 nelberth 342
                required: true,
1 www 343
            },
344
            'status' : {
345
                required: true,
346
            },
347
            'privacy' : {
348
                required: true,
349
            },
350
            'type' : {
351
                required: true,
352
            },
353
            'cost' : {
354
                required: function() {
355
                    return $('#form-capsule-add #type').val() == 's';
356
                },
357
                'number' : true,
358
                'min' : 0
359
            }
360
        },
361
        submitHandler: function(form)
362
        {
363
            var formdata = false;
364
            if (window.FormData){
365
                formdata = new FormData(form); //form[0]);
366
            }
367
 
368
            $('input[type="submit"]').prop('disabled', true);
6859 nelberth 369
			NProgress.start();
1 www 370
            $.ajax({
371
                'dataType'  : 'json',
372
                'accept'    : 'application/json',
373
                'method'    : 'post',
374
                'url'       :  $('#form-capsule-add').attr('action'),
375
                'data'      :  formdata,
376
                'processData': false,
377
                'contentType': false,
378
            }).done(function(response) {
379
                if(response['success']) {
380
                    $.fn.showSuccess(response['data']);
381
 
6703 nelberth 382
                    $('body, html').animate({scrollTop: '0px'}, 300);
383
					$('#content1').css('display','block');
384
                    $('.contenido').html('');
385
            		seleccionarCampo.css('display','none');
1 www 386
                    gridTable.api().ajax.reload(null, false);
387
                } else {
388
                    validatorAdd.resetForm();
389
                    if(jQuery.type(response['data']) == 'string') {
390
                        $.fn.showError(response['data']);
391
                    } else  {
392
                        $.each(response['data'], function( fieldname, errors ) {
393
                            $.fn.showFormErrorValidator('#form-capsule-add #' + fieldname, errors);
394
                        });
395
                    }
396
                }
397
            }).fail(function( jqXHR, textStatus, errorThrown) {
398
                $.fn.showError(textStatus);
399
            }).always(function() {
400
                NProgress.done();
401
            });
402
            return false;
403
        },
404
        invalidHandler: function(form, validator) {
405
 
406
        }
407
    });
408
 
409
    var validatorEdit  = $('#form-capsule-edit').validate({
410
        debug: true,
411
        onclick: false,
412
        onkeyup: false,
413
        ignore: [],
414
        rules: {
415
              'name': {
416
                required: true,
417
                maxlength: 128,
418
            },
419
            'description': {
420
                updateCkeditor:function() {
421
                        CKEDITOR.instances.description_edit.updateElement();
422
                },
423
                required: true
424
            },
425
           'file': {
426
                required: false,
427
                extension: 'jpg|jpeg|png',
428
                accept: 'image/jpg,image/jpeg,image/png'
429
            },
430
            'order' : {
431
                required: true,
432
                digits: true,
433
                min: 1,
434
                max: 250
435
            },
436
           'marketplace': {
437
                required: false,
438
                extension: 'jpg|jpeg|png',
439
                accept: 'image/jpg,image/jpeg,image/png'
440
            },
441
            'status' : {
442
                required: true,
443
            },
444
            'privacy' : {
445
                required: true,
446
            },
447
            'type' : {
448
                required: true,
449
            },
450
            'cost' : {
451
                required: function() {
452
                    return $('#form-capsule-edit #type').val() == 's';
453
                },
454
                'number' : true,
455
                'min' : 0
456
            }
457
        },
458
        submitHandler: function(form)
459
        {
460
            var formdata = false;
461
            if (window.FormData){
462
                formdata = new FormData(form); //form[0]);
463
            }
464
 
465
            $('input[type="submit"]').prop('disabled', true);
466
 
467
            $.ajax({
468
                'dataType'  : 'json',
469
                'accept'    : 'application/json',
470
                'method'    : 'post',
471
                'url'       :  $('#form-capsule-edit').attr('action'),
472
                'data'      :  formdata,
473
                'processData': false,
474
                'contentType': false,
475
            }).done(function(response) {
476
                if(response['success']) {
477
                    $.fn.showSuccess(response['data']);
478
 
479
 
480
                    $('#modalCapsuleEdit').modal('hide');
481
                    gridTable.api().ajax.reload(null, false);
482
                } else {
483
                    validatorAdd.resetForm();
484
                    if(jQuery.type(response['data']) == 'string') {
485
                        $.fn.showError(response['data']);
486
                    } else  {
487
                        $.each(response['data'], function( fieldname, errors ) {
488
                            $.fn.showFormErrorValidator('#form-capsule-edit #' + fieldname, errors);
489
                        });
490
                    }
491
                }
492
            }).fail(function( jqXHR, textStatus, errorThrown) {
493
                $.fn.showError(textStatus);
494
            }).always(function() {
495
                NProgress.done();
496
            });
497
            return false;
498
        },
499
        invalidHandler: function(form, validator) {
500
 
501
        }
502
    });
503
 
504
 
505
 
506
        $('body').on('click', '.btn-view-image-marketplace', function(e) {
507
            e.preventDefault();
508
 
509
            $('#image-marketplace').attr('src', $(this).data('href'));
510
            $('#modalAppMarkeplate').modal('show');
511
            return false;
512
        });
513
 
514
        $('body').on('click', '.btn-view-image-app', function(e) {
515
            e.preventDefault();
516
 
517
            $('#image-app').attr('src', $(this).data('href'));
518
            $('#modalImageApp').modal('show');
519
            return false;
520
        });
521
 
522
        $('#form-capsule-add #order').inputNumberFormat({decimal: 0});
523
 
524
 
525
 
526
 
527
        $('body').on('click', 'button.btn-add', function(e) {
528
            e.preventDefault();
529
 
530
            $('#form-capsule-add #name').val('');
531
            $('#form-capsule-add #order').val('1');
532
 
533
            $('#form-capsule-add #privacy').val('');
534
            $('#form-capsule-add #status').val('');
535
            $('#form-capsule-add #cost').val('');
536
            $('#form-capsule-add #form-row-cost').hide();
537
 
538
            CKEDITOR.instances.description_add.setData('');
539
            validatorAdd.resetForm();
540
 
6694 nelberth 541
            $('body, html').animate({scrollTop: '0px'}, 300);
542
		    $('#content1').css('display','none');
543
            seleccionarCampo= $('#modalCapsuleAdd');
544
            seleccionarCampo.css('display','block')
545
		    iniciarEditor(seleccionarCampo)
1 www 546
            return false;
547
        });
548
 
549
 
550
        $('#form-capsule-edit #order').inputNumberFormat({decimal: 0});
551
 
6859 nelberth 552
 
1 www 553
 
554
        $('#form-capsule-edit #marketplace').fileinput({
555
            theme: 'fas',
556
            language: 'es',
557
            showUpload: false,
558
            dropZoneEnabled: false,
559
            maxFileCount: 1,
560
            allowedFileExtensions: ['jpeg', 'jpg', 'png'],
561
            msgPlaceholder: 'LABEL_MARKETPLACE_RECOMMENDED_SIZE $marketplace_size',
562
        });
563
 
564
        $('body').on('click', 'button.btn-edit', function(e) {
565
            e.preventDefault();
566
 
567
            var url = $(this).data('href');
568
            $.ajax({
569
                'dataType'  : 'json',
570
                'accept'    : 'application/json',
571
                'method'    : 'get',
572
                'url'       :  url,
573
            }).done(function(response) {
574
                if(response['success']) {
575
                    $('#form-capsule-edit').attr('action',url);
576
                    $('#form-capsule-edit #name').val(response['data']['name']);
577
                    $('#form-capsule-edit #order').val(response['data']['order']);
578
                    $('#form-capsule-edit #file').fileinput('reset');
579
                    $('#form-capsule-edit #file').val('');
580
 
581
                    $('#form-capsule-edit #marketplace').fileinput('reset');
582
                    $('#form-capsule-edit #marketplace').val('');
583
                    $('#form-capsule-edit #privacy').val(response['data']['privacy']);
584
                    $('#form-capsule-edit #type').val(response['data']['type']);
585
                    $('#form-capsule-edit #status').val(response['data']['status']);
586
 
587
                    if('s' == response['data']['type']) {
588
                        $('#form-capsule-edit #form-row-cost').show();
589
                        $('#form-capsule-edit #cost').val(response['data']['cost']);
590
                    } else {
591
                        $('#form-capsule-edit #form-row-cost').hide();
592
                        $('#form-capsule-edit #cost').val('');
593
                    }
594
 
595
                    CKEDITOR.instances.description_edit.setData(response['data']['description']);
596
                    validatorEdit.resetForm();
597
 
598
 
599
                    $('#modalCapsuleEdit').modal('show');
600
                } else {
601
                    validatorEdit.resetForm();
602
                    if(jQuery.type(response['data']) == 'string') {
603
                        $.fn.showError(response['data']);
604
                    } else  {
605
                        $.each(response['data'], function( fieldname, errors ) {
606
                            $.fn.showFormErrorValidator('#form-capsule-edit #' + fieldname, errors);
607
                        });
608
                    }
609
                }
610
            }).fail(function( jqXHR, textStatus, errorThrown) {
611
                $.fn.showError(textStatus);
612
            }).always(function() {
613
                NProgress.done();
614
            });
615
        });
616
 
6703 nelberth 617
        $('body').on('click', '#ir_atras', function(e) {
1 www 618
            e.preventDefault();
6703 nelberth 619
            $('body, html').animate({scrollTop: '0px'}, 300);
620
			$('#content1').css('display','block');
621
            seleccionarCampo.css('display','none');
622
            $('.contenido').html('');
623
            return false;
1 www 624
        });
625
 
626
 
627
        CKEDITOR.replace('description_add');
628
        CKEDITOR.replace('description_edit');
629
 
630
        $('#form-capsule-add #type').change(function(e) {
631
            e.preventDefault();
632
 
633
            if('s' == $(this).val()) {
634
                $('#form-capsule-add #form-row-cost').show();
635
            } else {
636
                $('#form-capsule-add #cost').val(0);
637
                $('#form-capsule-add #form-row-cost').hide();
638
            }
639
 
640
        });
641
 
642
        $('#form-capsule-edit #type').change(function(e) {
643
            e.preventDefault();
644
 
645
            if('s' == $(this).val()) {
646
                $('#form-capsule-edit #form-row-cost').show();
647
            } else {
648
                $('#form-capsule-edit #cost').val(0);
649
                $('#form-capsule-edit #form-row-cost').hide();
650
            }
651
 
652
        });
653
 
654
        $('#form-capsule-add #order').inputNumberFormat({decimal: 0});
655
        $('#form-capsule-add #cost').inputNumberFormat({decimal: 2});
656
 
657
        $('#form-filter #topic_uuid').change(function(e) {
658
            e.preventDefault();
659
 
660
            gridTable.api().ajax.reload(null, false);
661
 
662
        });
663
 
664
 
665
 
666
 
667
 
668
    $('body').on('click', 'button.btn-view-total-users', function(e) {
669
        e.preventDefault();
670
 
671
        var href = $(this).data('href');
672
        NProgress.start();
673
        $.ajax({
674
            'dataType'  : 'json',
675
            'accept'    : 'application/json',
676
            'method'    : 'get',
677
            'url'       : href,
678
        }).done(function(response) {
679
            if(response['success']) {
680
 
681
                $('#table-users-topic').val(response['data']['topic']);
682
      			$('#table-users-capsule').val(response['data']['capsule']);
683
 
684
                $('#gridTableUsers tbody').empty();
685
 
686
                $.each(response['data']['items'], function(index, item) {
687
 
688
                    console.log(item);
689
 
690
                    var s = '<tr>';
691
                    s = s + '<td>' + item['first_name'] + '</td>';
692
                    s = s + '<td>' + item['last_name'] + '</td>';
693
                    s = s + '<td>' + item['email'] + '</td>';
694
 
695
                    s = s + '<td>';
696
                    if(item['details']['access']) {
697
                        s = s + 'LABEL_ACCESS : ' + item['details']['access'] + '<br>';
698
                    }
699
                    if(item['details']['paid_from']) {
700
                        s = s + 'LABEL_PAID_FROM : ' + item['details']['paid_from'] + '<br>';
701
                    }
702
                    if(item['details']['paid_to']) {
703
                        s = s + 'LABEL_PAID_TO : ' + item['details']['paid_to'] + '<br>';
704
                    }
705
 
706
                    s = s + '</td>';
707
                    s = s + '</tr>';
708
 
709
                    $('#gridTableUsers tbody').append(s);
710
 
711
 
712
                });
713
 
714
                $('#notificationUsersModal').modal('show');
715
 
716
            } else {
717
                $.fn.showError(response['data']);
718
 
719
            }
720
        }).fail(function( jqXHR, textStatus, errorThrown) {
721
            $.fn.showError(textStatus);
722
        }).always(function() {
723
 
724
            NProgress.done();
725
        });
726
        return false;
727
 
728
    });
729
    $('body').on('click', 'button.btn-refresh', function(e) {
730
        e.preventDefault();
731
        gridTable.api().ajax.reload(null, false);
732
    });
6682 nelberth 733
       	/*Script del editor (Aqui comienza el cielo y la tierra) */
6863 nelberth 734
 
735
		var fileToggle=true;
6682 nelberth 736
		var imagenServidorNoticia;
737
		var scroll_altura,viente;
738
		var nombre_user = $(".perfil_u_nombre").text();
739
		var primer_nombre = nombre_user.split(" ")[0];
740
		var nuevoHtmlImagen='<div class="articulo_noticia animated fadeIn"><div class="pasos"><div class="titulo_pasos animated fadeInDown delay-04 fast">LABEL_STEP_1</div><div class="paso_opcion"><div class="responsing_cut"><div class="icon_cut"><span class="fa fa-scissors"></span></div><div class="contenido_cut"><div class="animated fadeInRight delay-04 fast"><div><div class="titulo_cut"><div>LABEL_CUT</div><div class="fa fa-times" id="cerrar_cut_modal"></div></div><div class="opcion_editor recortar10"><div>LABEL_CUT</div><div id="blockCelda"><span class="fa fa-lock"></span></div></div></div></div></div></div><div class="responsing_text"><div class="icon_text"><span class="fa fa-text-width"></span></div><div class="contenido_text"><div class="animated fadeInRight delay-04 fast"><div class="texto"><div class="titulo_text"><div>LABEL_ADD_TEXT</div><div class="fa fa-times" id="cerrar_text_modal"></div></div><input id="texto_input" type="text" name="texto" placeholder="LABEL_ADD_TEXT_HERE"><div class="fonts"><div class="font" id="negritas" data-tooltip="Negritas"><i class="fa fa-bold" aria-hidden="true"></i></div><div class="font" id="italic" data-tooltip="Letra Cursiva"><i class="fa fa-italic" aria-hidden="true"></i></div><input type="color" class="" data-tooltip="Color de la letra" name="" id="color" value="#ffffff"> <input type="number" class="" data-tooltip="Tamaño de la letra" name="" id="font-size" max="500" min="1" step="1" value="48"></div><div class="fonts"><div class="font fa" data-tooltip="Sombra de la letra" id="shadow">A</div><div class="font" id="rectangulo" data-tooltip="Fondo de la letra"><div class="rectangulo">C</div></div><input type="color" name="" id="colorrect" value="#000000" class="" data-tooltip="Color del fondo"> <input type="number" name="" id="opacidad" max="100" min="1" step="1" value="100" class="" data-tooltip="Transparensia del fondo"></div><div class="fonts_style"><div class="fs at" id="arial">LABEL_FONT_ARIAL</div><div class="fs" id="calibri">LABEL_FONT_CALIBRI</div><div class="fs" id="forte">LABEL_FONT_FORTE</div><div class="fs" id="impact">LABEL_FONT_IMPACT</div><div class="fs" id="jokerman">LABEL_FONT_JOKERMAN</div><div class="fs" id="mb">LABEL_FONT_MV_BOLI</div><div class="fs" id="tnr">LABEL_FONT_TIMES_NEW_ROMAN</div><div class="fs" id="verdana">LABEL_FONT_VERDANA</div><div class="fs" id="vivaldi">LABEL_FONT_VIVALDI</div></div></div></div></div></div><div class="responsing_filtros"><div class="icon_filter"><span class="fa fa-eyedropper"></span></div><div class="contenido_filter"><div class="titulo_filtro"><div>LABEL_FILTERS</div><div class="fa fa-times" id="cerrar_filter_modal"></div></div><div class="opciones_imagen"><div class="opcion_editor oa" id="normal">LABEL_FILTER_NORMAL</div><div class="opcion_editor" id="noche">LABEL_FILTER_NIGHT</div><div class="opcion_editor" id="sa">LABEL_FILTER_SAINT_ANA</div><div class="opcion_editor" id="crema">LABEL_FILTER_CREAM</div><div class="opcion_editor" id="magia">LABEL_FILTER_MAGIC</div><div class="opcion_editor" id="relieve">LABEL_FILTER_RELIEF</div><div class="opcion_editor" id="luz">LABEL_FILTER_LIGHT</div><div class="opcion_editor" id="saturacion">LABEL_FILTER_SATURATION</div><div class="opcion_editor" id="retoque">LABEL_FILTER_RETOUCH</div><div class="opcion_editor" id="orange">LABEL_FILTER_ORANGE</div><div class="opcion_editor" id="setenta">LABEL_FILTER_WIND</div><div class="opcion_editor" id="desierto">LABEL_FILTER_DESERT</div><div class="opcion_editor" id="bosque">LABEL_FILTER_FOREST</div><div class="opcion_editor" id="villa">LABEL_FILTER_TOWN</div><div class="opcion_editor" id="rosa">LABEL_FILTER_PINK</div><div class="opcion_editor" id="historia">LABEL_FILTER_HISTORY</div><div class="opcion_editor" id="gris">LABEL_FILTER_GRAY</div><div class="opcion_editor" id="lhs">LABEL_FILTER_OLD_PICTURE</div><div class="opcion_editor" id="encantador">LABEL_FILTER_CHARMING</div><div class="opcion_editor" id="emocion">LABEL_FILTER_EMOTION</div><div class="opcion_editor" id="beige">LABEL_FILTER_BEIGE</div><div class="opcion_editor" id="fine">LABEL_FILTER_FINE</div><div class="opcion_editor" id="lord">LABEL_FILTER_LORD</div><div class="opcion_editor" id="70">LABEL_FILTER_70S</div><div class="opcion_editor" id="arbol">LABEL_FILTER_TREE</div><div class="opcion_editor" id="verano">LABEL_FILTER_SUMMER</div><div class="opcion_editor" id="cf">LABEL_FILTER_COLD_WEATHER</div><div class="opcion_editor" id="angeles">LABEL_FILTER_ANGELS</div><div class="opcion_editor" id="caliente">LABEL_FILTER_HOT</div><div class="opcion_editor" id="otono">LABEL_FILTER_FALL</div><div class="opcion_editor" id="marzo">LABEL_FILTER_MARCH</div><div class="opcion_editor" id="pera">LABEL_FILTER_PEAR</div><div class="opcion_editor" id="comun">LABEL_FILTER_COMMON</div><div class="opcion_editor" id="oro">LABEL_FILTER_GOLD</div><div class="opcion_editor" id="gotico">LABEL_FILTER_GOTHIC</div><div class="opcion_editor" id="forestal">LABEL_FILTER_FORESTRY</div><div class="opcion_editor" id="luna">LABEL_FILTER_MOON</div><div class="opcion_editor" id="fiesta">LABEL_FILTER_PARTY</div></div></div></div><div class="volver"><span class="icon-undo"></span>LABEL_START_OVER</div><div class="paso_1 paso animated bounceInDown delay-04 fast">1</div><div class="paso_2 a1 animated bounceInDown delay-06 fast">2</div><div class="paso_2 b1 animated bounceInDown delay-08 fast">3</div></div></div><div class="editor_imagenes"><div class="fondo_oscuro"></div><div class="editor_imagenes2"><div class="filtros animated fadeInLeft delay-04 fast"><div class="titulo_filtro"><span class="icon-eyedropper fa fa-eyedropper"></span>LABEL_FILTERS</div><div class="opciones_imagen"><div class="opcion_editor oa" id="normal">LABEL_FILTER_NORMAL</div><div class="opcion_editor" id="noche">LABEL_FILTER_NIGHT</div><div class="opcion_editor" id="sa">LABEL_FILTER_SAINT_ANA</div><div class="opcion_editor" id="crema">LABEL_FILTER_CREAM</div><div class="opcion_editor" id="magia">LABEL_FILTER_MAGIC</div><div class="opcion_editor" id="relieve">LABEL_FILTER_RELIEF</div><div class="opcion_editor" id="luz">LABEL_FILTER_LIGHT</div><div class="opcion_editor" id="saturacion">LABEL_FILTER_SATURATION</div><div class="opcion_editor" id="retoque">LABEL_FILTER_RETOUCH</div><div class="opcion_editor" id="orange">LABEL_FILTER_ORANGE</div><div class="opcion_editor" id="setenta">LABEL_FILTER_WIND</div><div class="opcion_editor" id="desierto">LABEL_FILTER_DESERT</div><div class="opcion_editor" id="bosque">LABEL_FILTER_FOREST</div><div class="opcion_editor" id="villa">LABEL_FILTER_TOWN</div><div class="opcion_editor" id="rosa">LABEL_FILTER_PINK</div><div class="opcion_editor" id="historia">LABEL_FILTER_HISTORY</div><div class="opcion_editor" id="gris">LABEL_FILTER_GRAY</div><div class="opcion_editor" id="lhs">LABEL_FILTER_OLD_PICTURE</div><div class="opcion_editor" id="encantador">LABEL_FILTER_CHARMING</div><div class="opcion_editor" id="emocion">LABEL_FILTER_EMOTION</div><div class="opcion_editor" id="beige">LABEL_FILTER_BEIGE</div><div class="opcion_editor" id="fine">LABEL_FILTER_FINE</div><div class="opcion_editor" id="lord">LABEL_FILTER_LORD</div><div class="opcion_editor" id="70">LABEL_FILTER_70S</div><div class="opcion_editor" id="arbol">LABEL_FILTER_TREE</div><div class="opcion_editor" id="verano">LABEL_FILTER_SUMMER</div><div class="opcion_editor" id="cf">LABEL_FILTER_COLD_WEATHER</div><div class="opcion_editor" id="angeles">LABEL_FILTER_ANGELS</div><div class="opcion_editor" id="caliente">LABEL_FILTER_HOT</div><div class="opcion_editor" id="otono">LABEL_FILTER_FALL</div><div class="opcion_editor" id="marzo">LABEL_FILTER_MARCH</div><div class="opcion_editor" id="pera">LABEL_FILTER_PEAR</div><div class="opcion_editor" id="comun">LABEL_FILTER_COMMON</div><div class="opcion_editor" id="oro">LABEL_FILTER_GOLD</div><div class="opcion_editor" id="gotico">LABEL_FILTER_GOTHIC</div><div class="opcion_editor" id="forestal">LABEL_FILTER_FORESTRY</div><div class="opcion_editor" id="luna">LABEL_FILTER_MOON</div><div class="opcion_editor" id="fiesta">LABEL_FILTER_PARTY</div></div></div><div class="canvas_imagen"><div class="canvas recortar"><div class="canvas_subir" id="imagen_noticia"><span class="icon-plus fa fa-plus"></span>LABEL_DRAG_IMAGE_HERE</div></div></div><div class="modificar animated fadeInRight delay-04 fast"><div><div class="titulo_recortar"><span class="icon-ungroup fa fa-scissors"></span>LABEL_CUT</div><div class="opcion_editor recortar10"><div>LABEL_CUT</div><div id="blockCelda"><span class="fa fa-lock"></span></div></div></div><div class="texto"><div class="titulo_texto"><span class="icon-plus fa fa-text-width"></span>LABEL_ADD_TEXT</div><input id="texto_input" type="text" name="texto" placeholder="LABEL_ADD_TEXT_HERE"><div class="fonts"><div class="font" id="negritas" data-tooltip="Negritas"><i class="fa fa-bold" aria-hidden="true"></i></div><div class="font" id="italic" data-tooltip="Letra Cursiva"><i class="fa fa-italic" aria-hidden="true"></i></div><input type="color" class="" data-tooltip="Color de la letra" name="" id="color" value="#ffffff"> <input type="number" class="" data-tooltip="Tamaño de la letra" name="" id="font-size" max="500" min="1" step="1" value="48"></div><div class="fonts"><div class="font fa" data-tooltip="Sombra de la letra" id="shadow">A</div><div class="font" id="rectangulo" data-tooltip="Fondo de la letra"><div class="rectangulo">C</div></div><input type="color" name="" id="colorrect" value="#000000" class="" data-tooltip="Color del fondo"> <input type="number" name="" id="opacidad" max="100" min="1" step="1" value="100" class="" data-tooltip="Transparensia del fondo"></div><div class="fonts_style"><div class="fs at" id="arial">LABEL_FONT_ARIAL</div><div class="fs" id="calibri">LABEL_FONT_CALIBRI</div><div class="fs" id="forte">LABEL_FONT_FORTE</div><div class="fs" id="impact">LABEL_FONT_IMPACT</div><div class="fs" id="jokerman">LABEL_FONT_JOKERMAN</div><div class="fs" id="mb">LABEL_FONT_MV_BOLI</div><div class="fs" id="tnr">LABEL_FONT_TIMES_NEW_ROMAN</div><div class="fs" id="verdana">LABEL_FONT_VERDANA</div><div class="fs" id="vivaldi">LABEL_FONT_VIVALDI</div></div></div></div></div><div class="botones_dimenciones"><div class="scale"><div class="dimenciones"><div id="ancho">1240px</div><div>x</div><div id="alto">720px</div></div><div class="porciento"><div id="menos_scale"><span class="icon-minus fa fa-minus"></span></div><div class="ps"><ul class="cantidades_scale"><li data-scale="2" class="as">200%</li><li data-scale="1" class="as">100%</li><li data-scale="0.75" class="as">75%</li><li data-scale="0.5" class="as">50%</li><li data-scale="0.25" class="as">25%</li></ul><div id="porciento_scale">50%</div></div><div id="mas_scale"><span class="icon-plus fa fa-plus"></span></div></div></div><div class="botones"><button class="boton_normal" id="ir_atras">LABEL_GO_BACK</button><button class="boton_normal" id="boton_recortar">LABEL_DATATABLE_SNEXT</button></div></div></div></div><dav class="fixed_noticia"></dav><dav class="cuadro_noticias animated bounceInUp delay-04" id="cuadro_noticias"><dav class="relative"><div class="titulo_topico">LABEL_TITLE</div><canvas class="imagen_noticias" id="imagen_noticias" width="320" height="480"></canvas></dav><div class="progreso d-flex align-items-center justify-content-between"><progress value="0" max="100"></progress><span class="ml-2">0.0%</span></div></dav>'
741
 
742
		$(document).on("click", ".info_noticia", function(e){
743
			imagenServidorNoticia = elemento.toDataURL("image/jpeg", 1.0);
6863 nelberth 744
			if(fileToggle){
6864 nelberth 745
				e.preventDefault();
6863 nelberth 746
				setTimeout(function(){
747
					iniciarEditor(seleccionarCampo)
748
					fileToggle=false;
749
				},$('.marketplace').val(imagenServidorNoticia.split(',')[1]));
750
			}else{
751
				$('.file').val(imagenServidorNoticia.split(',')[1]);
752
			}
753
 
6682 nelberth 754
			console.log($('.file').val())
755
			$(".c1").addClass("paso");
1 www 756
 
6682 nelberth 757
 
758
		})
759
 
760
		function iniciarEditor(campo, image=''){
761
		 cortar=false;
762
		recorte_listo=false;
763
		texto="";
764
		seis=true;
765
		color="#ffffff";
766
		texto_listo=false,siete=false;
767
		uno=true;
768
		size=48;
769
		cinco=true;
6852 nelberth 770
		blockCelda=true;
6682 nelberth 771
		xf=320,yf =480;
772
		negritas=false, bold="";
773
		shadow = true, nueve=true;
774
		italic=false, ita="";
775
		rectangulo=false, diez=false;
776
     	fontfamily="Arial";
777
     	r=0,g=0,b=0,a=1;
778
		window.clearInterval(editorNoticia);
779
		setTimeout(function(){
780
			scroll_altura=$(".articulo_noticia").offset().top-110;
781
			anchoFondoOscuro = $(".articulo_noticia").width();
782
			altoFondoOscuro = $(".editor_imagenes").height();
783
			$(".fondo_oscuro").css("width",""+anchoFondoOscuro+"px");
784
			$(".fondo_oscuro").css("height",""+altoFondoOscuro+"px");
785
 
786
		},navegacion(nuevoHtmlImagen,campo,image));
787
 
788
		}
789
 
790
		$(document).on("click", ".volver", function(){
791
		var nombre_user = $(".perfil_u_nombre").text();
792
		var primer_nombre = nombre_user.split(" ")[0];
793
		 cortar=false;
794
		cinco=true;
795
		recorte_listo=false;
796
		texto="";
797
		seis=true;
798
		color="#ffffff";
799
		texto_listo=false,siete=false;
800
		uno=true;
801
		size=48;
802
		xf=320,yf =480;
6852 nelberth 803
		blockCelda=true;
6682 nelberth 804
		negritas=false, bold="";
805
		shadow = true, nueve=true;
806
		italic=false, ita="";
807
		rectangulo=false, diez=false;
808
     	fontfamily="Arial";
809
     	r=0,g=0,b=0,a=1;
810
		 var imagenServidorNoticia;
811
         console.log(seleccionarCampo)
812
		window.clearInterval(editorNoticia);
813
		setTimeout(function(){
814
			scroll_altura=$(".articulo_noticia").offset().top-110;
815
			anchoFondoOscuro = $(".articulo_noticia").width();
816
			altoFondoOscuro = $(".editor_imagenes").height();
817
			$(".fondo_oscuro").css("width",""+anchoFondoOscuro+"px");
818
			$(".fondo_oscuro").css("height",""+altoFondoOscuro+"px");
819
 
820
		},navegacion(nuevoHtmlImagen,seleccionarCampo));
821
 
822
		})
823
 
824
		function navegacion(nuevoHtmlImagen,campo,image='',reload=true){
825
                selectorElementoName=campo.find('#name')
826
 
6824 nelberth 827
                selectorElementoEditor=campo.find('#contenido');
6682 nelberth 828
 
829
				if(image!=''){
830
					const getBase64FromUrl = async (url) => {
831
						const data = await fetch(url);
832
						const blob = await data.blob();
833
						return new Promise((resolve) => {
834
							const reader = new FileReader();
835
							reader.readAsDataURL(blob);
836
							reader.onloadend = function() {
837
							const base64data = reader.result;
838
							resolve(base64data);
839
							}
840
						});
841
					}
842
 
843
					getBase64FromUrl(image).then(function(e){
844
						selectorElementoName.trigger('change');
845
						$(".volver").css("display","block")
846
						$(".a1").addClass("paso");
847
						$(".titulo_pasos").html("LABEL_STEP_2");
848
						setTimeout(function(){
849
							recorte_listo=true;
850
							$(".fondo_oscuro").css("display","none");
851
							$("#boton_recortar").removeClass("recortar").text("LABEL_SEND").addClass("info_noticia").attr('type','submit');
852
							$(".recortar10").removeClass("recortar");
853
							$(".canvas").removeClass("recortar");
854
							$(".b1").addClass("paso");
855
							$(".titulo_pasos").html("LABEL_STEP_3");
856
							if(texto!=""){
857
								seis=true;
858
								siete=true;
859
							}
860
							cinco=true;
861
							dos=true;
862
							cuatro=true;
863
							actualizar();
864
 
865
						},editorNoticia(e));
866
 
867
 
868
					})
869
 
870
					setTimeout(function(){
871
						$(".canvas_subir").html('<span class="icon-plus fa fa-spinner"></span> Cargando...')
872
						selectorElementoName.trigger('change');
873
					},selectorElementoEditor.html(nuevoHtmlImagen));
874
				}else{
875
					setTimeout(function(){
876
					    selectorElementoName.trigger('change');
877
					},selectorElementoEditor.html(nuevoHtmlImagen));
878
				}
879
 
880
		}
881
 
882
		$(window).on("scroll", function(){
883
			console.log(scroll_altura)
884
		if($(window).scrollTop()>scroll_altura){
885
			$("#cuadro_noticias").addClass("fixed");
886
		}else{
887
			$("#cuadro_noticias").removeClass("fixed");
888
		}
889
	})
890
 
891
	$(document).on("dragover", "#imagen_noticia", function(e){
892
		e.preventDefault();
893
		e.stopPropagation();
894
		$(this).css({"background":"rgba(0,0,0,.2)"})
895
	})
896
	$(document).on("drop", "#imagen_noticia", function(e){
897
		e.preventDefault();
898
		e.stopPropagation();
899
		$(this).css("background", "none");
900
		var archivo = e.originalEvent.dataTransfer.files;
901
		var img=archivo[0];
902
		if(img.type =="image/jpeg"||img.type =="image/png"){
903
			$(".modificar").removeClass("animated");
904
			var render = new FileReader();
905
			render.readAsDataURL(img);
906
			render.onload = function(e){
907
				$(".volver").css("display","block")
908
				$(".a1").addClass("paso");
909
				$(".titulo_pasos").html("LABEL_STEP_2");
910
				console.log(e.target.result)
911
				editorNoticia(e.target.result)
912
			}
913
		}
914
	})
915
	$(document).on("dragover", "body", function(e){
916
		e.preventDefault();
917
		e.stopPropagation();
918
	})
919
	$(document).on("drop", "body", function(e){
920
		e.preventDefault();
921
		e.stopPropagation();
922
	})
923
 
924
	var canvas='<div class="editorNoticia"><canvas id="editorNoticia">LABEL_NOT_SUPPORTED</canvas></div>';
925
	$(document).on("mouseover", ".editorNoticia", function(){
926
		$("body").css({"overflow": "hidden"});
927
		$(".cuadro_noticias, .fixed_noticia,.tituloEditor,.grid-padre").css("margin-right", "17px")
928
		$(".barra,.footer").css("padding-right","17px")
929
 
930
 
931
	})
932
	$(document).on("mouseover", "#editorNoticia", function(){
933
		if(recorte_listo){
934
			ocho=true;
935
		}
936
	})
937
	$(document).on("mouseout", "#editorNoticia", function(){
938
		if(recorte_listo){
939
			ocho=false;
940
			actualizar2()
941
		}
942
	})
943
	$(document).on("mouseout", ".editorNoticia",function(){
944
		$("body").css({"overflow": "auto"})
945
		$(".cuadro_noticias, .fixed_noticia,.tituloEditor,.grid-padre").css("margin-right", "0px")
946
		$(".barra,.footer").css("padding-right","0px")
947
 
948
	})
949
	$(document).on('mousewheel', ".editorNoticia",function(e){
950
		var ruedita = e.originalEvent.wheelDelta
951
		if(ruedita>0){
952
			scale = scale+(scale/10);
953
			$("#porciento_scale").html((scale*100).toFixed(2)+"%")
954
		}else{
955
			scale = scale-(scale/10);
956
			$("#porciento_scale").html((scale*100).toFixed(2)+"%")
957
		}
958
		$("#editorNoticia").css({"transform": "scale("+scale+")"});
959
	})
960
	$(document).on("click", ".as", function(e){
961
		e.preventDefault();
962
		 scale = $(this).data("scale");
963
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
964
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
965
 
966
	})
967
	$(document).on("click", ".ps", function(e){
968
		e.preventDefault();
969
		$(".cantidades_scale").slideToggle(200).css("display", "block");
970
	})
971
	$(document).on("click", "#cerrar_filter_modal, .icon_filter", function(e){
972
		e.preventDefault();
973
		if(recorte_listo){
974
		$(".contenido_filter").slideToggle(200).css("display", "block");
975
		}
976
	})
977
	$(document).on("click", "#cerrar_text_modal, .icon_text", function(e){
978
		e.preventDefault();
979
		if(recorte_listo){
980
			$(".contenido_text").slideToggle(200).css("display", "block");
981
		}
982
	})
983
 
984
	$(document).on("click", "#cerrar_cut_modal, .icon_cut", function(e){
985
		e.preventDefault();
986
		if(cortar){
987
			$(".contenido_cut").slideToggle(200).css("display", "block");
988
		}
989
 
990
	})
991
	$(document).on("click", "#menos_scale", function(e){
992
		e.preventDefault();
993
		scale = scale-(scale/10);
994
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
995
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
996
	})
997
 
998
	$(document).on("click", "#mas_scale", function(e){
999
		e.preventDefault();
1000
		scale = scale+(scale/10);
1001
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
1002
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
1003
	})
1004
	$(document).on("click", "#noche", function(){
1005
		$(".oa").removeClass("oa")
1006
		filter( .5,1.3,1.31,1.33,1.38);
1007
		$(this).addClass("oa")
1008
	})
1009
	$(document).on("click", "#sa", function(){
1010
		$(".oa").removeClass("oa")
1011
		filter( .7,1.1,1.64,1.66,1.50);
1012
		$(this).addClass("oa")
1013
	})
1014
	$(document).on("click", "#crema", function(){
1015
		$(".oa").removeClass("oa")
1016
		filter( .75,1,1.66,1.60,1.51);
1017
		$(this).addClass("oa")
1018
	})
1019
	$(document).on("click", "#setenta", function(){
1020
		$(".oa").removeClass("oa")
1021
		filter( .8,.75,1.60,1.66,1.58);
1022
		$(this).addClass("oa")
1023
	})
1024
	$(document).on("click", "#orange", function(){
1025
		$(".oa").removeClass("oa")
1026
		filter( .8,1,1.6,1.45,1.49);
1027
		$(this).addClass("oa")
1028
	})
1029
	$(document).on("click", "#relieve", function(){
1030
		$(".oa").removeClass("oa")
1031
		filter( .7,1.2,1.60,1.66,1.58);
1032
		$(this).addClass("oa")
1033
	})
1034
	$(document).on("click", "#bosque", function(){
1035
		$(".oa").removeClass("oa")
1036
		filter( .85,.75,1.47,1.66,1.54);
1037
		$(this).addClass("oa")
1038
	})
1039
	$(document).on("click", "#desierto", function(){
1040
		$(".oa").removeClass("oa")
1041
		filter( .8,.9,1.66,1.43,1.28);
1042
		$(this).addClass("oa")
1043
	})
1044
	$(document).on("click", "#villa", function(){
1045
		$(".oa").removeClass("oa")
1046
		filter( .8,.8,1.71,1.64,1.58);
1047
		$(this).addClass("oa")
1048
	})
1049
	$(document).on("click", "#magia", function(){
1050
		$(".oa").removeClass("oa")
1051
		filter( .7,1.2,1.49,1.49,1.6);
1052
		$(this).addClass("oa")
1053
	})
1054
	$(document).on("click", "#luz", function(){
1055
		$(".oa").removeClass("oa")
1056
		filter( .9,.9,1.45,1.54,1.54);
1057
		$(this).addClass("oa")
1058
	})
1059
	$(document).on("click", "#retoque", function(){
1060
		$(".oa").removeClass("oa")
1061
		filter( .9,1.3,1,1,1);
1062
		$(this).addClass("oa")
1063
	})
1064
	$(document).on("click", "#saturacion", function(){
1065
		$(".oa").removeClass("oa")
1066
		filter( 1,1.5,1,1,1);
1067
		$(this).addClass("oa")
1068
	})
1069
	$(document).on("click", "#rosa", function(){
1070
		$(".oa").removeClass("oa")
1071
		filter( .8,1.2,1.24,.99,1);
1072
		$(this).addClass("oa")
1073
	})
1074
	$(document).on("click", "#historia", function(){
1075
		$(".oa").removeClass("oa")
1076
		filter( .9,1.1,1.33,1.19,.91);
1077
		$(this).addClass("oa")
1078
	})
1079
	$(document).on("click", "#encantador", function(){
1080
		$(".oa").removeClass("oa")
1081
		filter( .9,1.2,26,-12,0,2);
1082
		$(this).addClass("oa")
1083
	})
1084
	$(document).on("click", "#emocion", function(){
1085
		$(".oa").removeClass("oa")
1086
		filter( 1.1,1.4,40,12,-6,2);
1087
		$(this).addClass("oa")
1088
	})
1089
	$(document).on("click", "#beige", function(){
1090
		$(".oa").removeClass("oa")
1091
		filter( .9,1.32,56,47,17,2);
1092
		$(this).addClass("oa")
1093
	})
1094
	$(document).on("click", "#fine", function(){
1095
		$(".oa").removeClass("oa")
1096
		filter( .87,1.19,55,37,23,2);
1097
		$(this).addClass("oa")
1098
	})
1099
	$(document).on("click", "#lord", function(){
1100
		$(".oa").removeClass("oa")
1101
		filter( 1.2,.9,67,13,-23,2);
1102
		$(this).addClass("oa")
1103
	})
1104
	$(document).on("click", "#70", function(){
1105
		$(".oa").removeClass("oa")
1106
		filter( 1.2,1.2,35,7,18,2);
1107
		$(this).addClass("oa")
1108
	})
1109
	$(document).on("click", "#arbol", function(){
1110
		$(".oa").removeClass("oa")
1111
		filter(.92,1.23,-11,11,11,2);
1112
		$(this).addClass("oa")
1113
	})
1114
	$(document).on("click", "#verano", function(){
1115
		$(".oa").removeClass("oa")
1116
		filter( 1,1.4,-3,-1,-12,2);
1117
		$(this).addClass("oa")
1118
	})
1119
	$(document).on("click", "#cf", function(){
1120
		$(".oa").removeClass("oa")
1121
		filter( .85,1.26,-15,2,-1,2);
1122
		$(this).addClass("oa")
1123
	})
1124
	$(document).on("click", "#angeles", function(){
1125
		$(".oa").removeClass("oa")
1126
		filter( 1,1.4,5,12,1,2);
1127
		$(this).addClass("oa")
1128
	})
1129
	$(document).on("click", "#caliente", function(){
1130
		$(".oa").removeClass("oa")
1131
		filter( .9,1.2,43,-17,-55,2);
1132
		$(this).addClass("oa")
1133
	})
1134
	$(document).on("click", "#otono", function(){
1135
		$(".oa").removeClass("oa")
1136
		filter( 1,1.29,29,26,17,2);
1137
		$(this).addClass("oa")
1138
	})
1139
	$(document).on("click", "#marzo", function(){
1140
		$(".oa").removeClass("oa")
1141
		filter( .85,1.3,43,25,-11,2);
1142
		$(this).addClass("oa")
1143
	})
1144
	$(document).on("click", "#pera", function(){
1145
		$(".oa").removeClass("oa")
1146
		filter( .8,1.25,31,41,12,2);
1147
		$(this).addClass("oa")
1148
	})
1149
	$(document).on("click", "#comun", function(){
1150
		$(".oa").removeClass("oa")
1151
		filter( 1,1.36,4,5,1,2);
1152
		$(this).addClass("oa")
1153
	})
1154
	$(document).on("click", "#oro", function(){
1155
		$(".oa").removeClass("oa")
1156
		filter( .9,1.3,37,-25,1,2);
1157
		$(this).addClass("oa")
1158
	})
1159
	$(document).on("click", "#gotico", function(){
1160
		$(".oa").removeClass("oa")
1161
		filter( 1.1,1.3,-47,-42,-30,2);
1162
		$(this).addClass("oa")
1163
	})
1164
	$(document).on("click", "#forestal", function(){
1165
		$(".oa").removeClass("oa")
1166
		filter( 1,1.4,-5,42,11,2);
1167
		$(this).addClass("oa")
1168
	})
1169
	$(document).on("click", "#luna", function(){
1170
		$(".oa").removeClass("oa")
1171
		filter( .9,1.2,-5,-7,4,2);
1172
		$(this).addClass("oa")
1173
	})
1174
	$(document).on("click", "#fiesta", function(){
1175
		$(".oa").removeClass("oa")
1176
		filter( 1.1,1.3,-1,-1,26,2);
1177
		$(this).addClass("oa")
1178
	})
1179
	$(document).on("click", "#gris", function(){
1180
		$(".oa").removeClass("oa")
1181
		filtergris(1,1)
1182
		$(this).addClass("oa")
1183
	})
1184
	$(document).on("click", "#lhs", function(){
1185
		$(".oa").removeClass("oa")
1186
		filtergris(.8,1.5);
1187
		$(this).addClass("oa")
1188
	})
1189
	$(document).on("click", "#normal", function(){
1190
		$(".oa").removeClass("oa")
1191
		$(this).addClass("oa")
1192
		filter();
1193
	})
1194
	var texto_listo=false,siete=false;
1195
	var texto;
1196
	$(document).on("keyup", "#texto_input", function(e){
1197
		e.preventDefault();
1198
		texto = $(this).val();
1199
		if(texto_actualizar){
1200
			siete=true;
1201
		}
1202
		if(texto!=""){
1203
			texto_actualizar=true;
1204
			actualizar2();
1205
		}else{
1206
			actualizar2();
1207
		}
1208
 
1209
	})
1210
	var color="#ffffff";
1211
	$(document).on("change", "#color", function(){
1212
    	color=$(this).val();
1213
    	seis=true;
1214
    	actualizar2();
1215
    })
1216
    var size=48;
1217
    $(document).on("keyup change", "#font-size", function(){
1218
    	size=$(this).val();
1219
    	size = parseInt(size);
1220
    	seis=true;
1221
    	siete=true;
1222
    	actualizar2();
1223
    })
1224
    var negritas=false, bold="";
1225
    $(document).on("click", "#negritas", function(e){
1226
    	e.preventDefault();
1227
    	if(!negritas){
1228
    		bold="bold";
1229
    		$(this).addClass("fa");
1230
    		seis=true;
1231
    		siete=true;
1232
    		actualizar2();
1233
    		negritas=true;
1234
    	}else{
1235
    		bold="";
1236
    		$(this).removeClass("fa");
1237
    		seis=true;
1238
    		siete=true;
1239
    		actualizar2();
1240
    		negritas=false;
1241
    	}
1242
    })
1243
    var italic=false, ita="";
1244
     $(document).on("click", "#italic", function(e){
1245
    	e.preventDefault();
1246
    	if(!italic){
1247
    		ita="italic";
1248
    		$(this).addClass("fa");
1249
    		seis=true;
1250
    		siete=true;
1251
    		actualizar2();
1252
    		italic=true;
1253
    	}else{
1254
    		ita="";
1255
    		$(this).removeClass("fa");
1256
    		seis=true;
1257
    		siete=true;
1258
    		actualizar2();
1259
    		italic=false;
1260
    	}
1261
    })
1262
     var fontfamily="Arial";
1263
     $(document).on("click", ".fs", function(e){
1264
    	e.preventDefault();
1265
    	$(".at").removeClass("at");
1266
    	$(this).addClass("at");
1267
    	fontfamily= $(this).text();
1268
    	seis=true;
1269
    	siete=true;
1270
    	actualizar2();
1271
 
1272
    })
1273
     var shadow = true, nueve=true;
1274
     $(document).on("click","#shadow", function(e){
1275
     	e.preventDefault();
1276
     	if(shadow){
1277
     		$(this).removeClass("fa");
1278
     		seis=true;
1279
     		nueve=false;
1280
     		actualizar2();
1281
     		shadow=false;
1282
     	}else{
1283
     		$(this).addClass("fa");
1284
     		seis=true;
1285
     		nueve=true;
1286
     		actualizar2();
1287
     		shadow=true;
1288
     	}
1289
 
1290
     })
1291
     var rectangulo=false, diez=false, colorrect="#000000";
1292
     $(document).on("click", "#rectangulo", function(e){
1293
     	e.preventDefault();
1294
     	if(!rectangulo){
1295
     		$(this).addClass("fa");
1296
     		diez=true;
1297
     		actualizar2();
1298
     		rectangulo=true;
1299
     	}else{
1300
     		$(this).removeClass("fa");
1301
     		diez=false;
1302
     		actualizar2();
1303
     		rectangulo=false;
1304
     	}
1305
 
1306
     })
1307
     var r=0,g=0,b=0;
1308
    $(document).on("change", "#colorrect", function(){
1309
    	colorrect=$(this).val();
1310
    	r=parseInt(colorrect.slice(1,3),16);
1311
    	g=parseInt(colorrect.slice(3,5),16);
1312
    	b=parseInt(colorrect.slice(5,7),16);
1313
    	seis=true;
1314
    	actualizar2();
1315
    })
1316
    var a=1;
1317
 
1318
    $(document).on("keyup change", "#opacidad", function(){
1319
    	a=$(this).val();
1320
    	a=a/100;
1321
    	seis=true;
1322
    	actualizar2();
1323
    })
1324
	var imaNoti = new Image();
1325
	function filter(brillo=1, contraste=1, rojo=1, verde=1, azul=1, valor=1){
1326
		cuatro=false;
1327
		restaurar(brillo, contraste);
1328
		datos=imagenOriginal.data;
1329
		if(valor==2){
1330
			for (var i =  0; i <datos.length; i+=4) {
1331
				datos[i]=datos[i]+rojo;
1332
				datos[i+1]=datos[i+1]+verde;
1333
				datos[i+2]=datos[i+2]+azul;
1334
			}
1335
		}else{
1336
			for (var i =  0; i <datos.length; i+=4) {
1337
				datos[i]=datos[i]*rojo;
1338
				datos[i+1]=datos[i+1]*verde;
1339
				datos[i+2]=datos[i+2]*azul
1340
			}
1341
		}
1342
		editor.putImageData(imagenOriginal,0,0)
1343
		var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
1344
	    imaNoti.src = imagenNoticia;
1345
		actualizar2();
1346
	}
1347
	function filtergris(brillo=1, contraste=1){
1348
		cuatro=false;
1349
		restaurar(brillo, contraste);
1350
		datos=imagenOriginal.data;
1351
		var auxiliar;
1352
		for (var i =  0; i <datos.length; i+=4) {
1353
			auxiliar = 0.34 * datos[i] + 0.5 *datos[i+1] + 0.16 * datos[i+2];
1354
			datos[i]=auxiliar;
1355
			datos[i+1]=auxiliar;
1356
			datos[i+2]=auxiliar;
1357
		}
1358
 
1359
		editor.putImageData(imagenOriginal,0,0)
1360
		var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
1361
	    imaNoti.src = imagenNoticia;
1362
		actualizar2();
1363
	}
1364
	function restaurar(brillo = 1, contraste=1){
1365
		editor.filter = "none"
1366
		editor.filter = 'contrast('+contraste+') brightness('+brillo+') saturate(1) sepia(0)';
1367
		editor.fillStyle="rgba(255,255,255,1)"
1368
		editor.fillRect(0,0,ancho,alto);
1369
		editor.fillStyle=""+color+"";
1370
		var pxf=0,pyf=0;
1371
			if(xf>=(yf/recorte)){
1372
				pxf=xf/ancho;
1373
				pyf=yf/pxf;
1374
				py=(alto/2)-(pyf/2);
1375
				editor.drawImage(imagen,x,y,xf,yf,0,py,ancho,pyf);
1376
			}else{
1377
				pyf=yf/alto;
1378
				pxf=xf/pyf;
1379
				px=(ancho/2)-(pxf/2);
1380
				editor.drawImage(imagen,x,y,xf,yf,px,0,pxf,alto);
1381
			}
1382
		imagenOriginal = editor.getImageData(0,0,ancho,alto)
1383
	}
1384
	var ocho=false;
1385
	function actualizar2(){
1386
		if(recorte_listo){
1387
		if(cuatro){
1388
			imagenOriginal = editor.getImageData(0,0,ancho,alto)
1389
			var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
1390
	    	imaNoti.src = imagenNoticia;
1391
	    	cuatro=false;
1392
		}
1393
		editor.filter = "none"
1394
		$(imaNoti).ready(function(e){
1395
			noticia.drawImage(imaNoti,0,0,320,480);
1396
			editor.drawImage(imaNoti,0,0,ancho,alto)
1397
			if(texto_actualizar){
1398
				if(texto!=""){
1399
					if(seis){
1400
						ancho_imaNoti = imaNoti.width;
1401
 
1402
						scale_noticia = -(((ancho_imaNoti-320)/ancho_imaNoti)-1);
1403
						editor.fillStyle=""+color+"";
1404
						editor.strokeStyle="rgb(255,255,255)";
1405
						if(nueve){
1406
							editor.shadowColor="rgba(0,0,0,.5)";
1407
							editor.shadowOffsetX=6;
1408
							editor.shadowOffsetY=6;
1409
							editor.shadowBlur=6;
1410
							noticia.shadowColor="rgba(0,0,0,.5)";
1411
							noticia.shadowOffsetX=6*scale_noticia;
1412
							noticia.shadowOffsetY=6*scale_noticia;
1413
							noticia.shadowBlur=6*scale_noticia;
1414
						}else{
1415
							editor.shadowColor="rgba(0,0,0,0)";
1416
							noticia.shadowColor="rgba(0,0,0,0)";
1417
						}
1418
						editor.font=""+ita+" "+bold+" "+size+"px "+fontfamily+"";
1419
						editor.textAlign="start";
1420
						editor.textBaseline="top";
1421
 
1422
						var sizeNoticia = size*scale_noticia;
1423
						noticia.fillStyle=""+color+"";
1424
						noticia.font=""+ita+" "+bold+" "+sizeNoticia+"px "+fontfamily+"";
1425
						noticia.textAlign="start";
1426
						noticia.textBaseline="top";
1427
						seis=false;
1428
					}
1429
					if(siete){
1430
						dimencionesTexto = editor.measureText(texto);
1431
						txf=dimencionesTexto.width+20;
1432
						tyf= (20+size);
1433
						siete=false;
1434
					}
1435
					if(cinco){
1436
						dimencionesTexto = editor.measureText(texto);
1437
						if(xf>=(yf/recorte)){
1438
							tx=(xf/2)-(dimencionesTexto.width/2);
1439
							ty=(xf*recorte/2)-(size/2);
1440
						}else{
1441
							tx=(yf/recorte/2)-(dimencionesTexto.width/2);
1442
							ty=(yf/2)-(size/2);
1443
						}
1444
 
1445
						txf=dimencionesTexto.width+20;
1446
						tyf= size+20;
1447
						cinco=false;
1448
					}
1449
					if(diez){
1450
						editor.fillStyle="rgba("+r+","+g+","+b+","+a+")";
1451
						noticia.fillStyle="rgba("+r+","+g+","+b+","+a+")";
1452
						editor.fillRect(tx-10,ty-10,txf,tyf);
1453
						noticia.fillRect(((tx-10)*scale_noticia),((ty-10)*scale_noticia),txf*scale_noticia,tyf*scale_noticia);
1454
						editor.fillStyle=""+color+"";
1455
						noticia.fillStyle=""+color+"";
1456
 
1457
					}
1458
					editor.fillText(texto,tx,ty);
1459
					noticia.fillText(texto,(tx*scale_noticia),ty*scale_noticia);
1460
					if(ocho){
1461
						editor.strokeRect(tx-10,ty-10,txf,tyf)
1462
						editor.arc(tx+txf,ty+tyf,10,0,Math.PI*2,false);
1463
						editor.fill();
1464
						editor.beginPath();
1465
					}
1466
					texto_listo=true;
1467
				}
1468
			}
1469
		})
1470
 
1471
	}
1472
	}
1473
	function actualizar(){
1474
			$(imagen).ready(function(e){
1475
				if(uno){
1476
					ancho=imagen.width, alto = imagen.height;
1477
					elemento.width = ancho;
1478
					elemento.height = alto;
1479
					$(".scale").css("display","flex");
1480
					mitadX=ancho/2;
1481
					mitadY=alto/2;
1482
					x=mitadX-xf/2;
1483
					y=mitadY-yf/2;
1484
					if(ancho<=alto){
1485
					 scale = -(((alto-450)/alto)-1);
1486
 
1487
					}else{
1488
					 scale = -(((ancho-500)/ancho)-1);
1489
					}
1490
					$("#porciento_scale").html((scale*100).toFixed(2)+"%")
1491
					$("#ancho").html(ancho+"px");
1492
					$("#alto").html(alto+"px");
1493
					uno=false;
1494
				}
1495
				if(dos){
1496
 
1497
					if(xf>=(yf/recorte)){
1498
						alto=xf*recorte;
1499
						ancho=xf;
1500
					}else{
1501
						ancho=yf/recorte;
1502
						alto=yf;
1503
 
1504
					}
1505
					elemento.width = ancho;
1506
					elemento.height = alto;
1507
					if(xf<=yf){
1508
					 scale = -(((yf-450)/yf)-1);
1509
 
1510
					}else{
1511
					 scale = -(((xf-500)/xf)-1);
1512
					}
1513
 
1514
					$("#porciento_scale").html((scale*100).toFixed(2)+"%")
1515
					$("#ancho").html(Math.round(xf)+"px");
1516
					$("#alto").html(Math.round(yf)+"px");
1517
					dos=false;
1518
				}
1519
 
1520
					var pxf=0,pyf=0;
1521
					noticia.fillStyle="rgba(255,255,255,1)"
1522
					noticia.fillRect(0,0,320,480);
1523
				if(xf>=(yf/recorte)){
1524
					pxf=xf/320;
1525
					pyf=yf/pxf;
1526
					py=(480/2)-(pyf/2);
1527
					noticia.drawImage(imagen,x,y,xf,yf,0,py,320,pyf);
1528
				}else{
1529
					pyf=yf/480;
1530
					pxf=xf/pyf;
1531
					px=(320/2)-(pxf/2);
1532
					noticia.drawImage(imagen,x,y,xf,yf,px,0,pxf,480);
1533
				}
1534
 
1535
				$("#editorNoticia").css({"transform": "scale("+scale+")"});
1536
				if(!recorte_listo){
1537
					editor.drawImage(imagen,0,0,ancho,alto);
1538
					editor.fillStyle="rgba(0,0,0,.2)"
1539
					editor.fillRect(0,0,ancho,alto);
1540
					editor.fillStyle="rgba(255,255,255,.1)"
1541
					editor.fillRect(x,y,xf,yf);
1542
					editor.fillStyle="rgba(255,255,255,.5)"
1543
					editor.fillRect(x,y,16,16);
1544
					editor.fillRect((x+xf)-16,y,16,16);
1545
					editor.fillRect(x,y+yf-16,16,16);
1546
					editor.fillRect(x+xf-16,yf+y-16,16,16);
1547
					esta=true;
1548
				}else{
1549
					var pxf=0,pyf=0;
1550
 
1551
					editor.fillStyle="rgba(255,255,255,1)"
1552
					editor.fillRect(0,0,ancho,alto);
1553
					if(xf>=(yf/recorte)){
1554
						pxf=xf/ancho;
1555
						pyf=yf/pxf;
1556
						py=(alto/2)-(pyf/2);
1557
						editor.drawImage(imagen,x,y,xf,yf,0,py,ancho,pyf);
1558
					}else{
1559
						pyf=yf/alto;
1560
						pxf=xf/pyf;
1561
						px=(ancho/2)-(pxf/2);
1562
						editor.drawImage(imagen,x,y,xf,yf,px,0,pxf,alto);
1563
				}
1564
 
1565
				}
1566
			})
1567
		}
1568
	var imagenOriginal;
1569
	var x,y,xf=320,yf =480, elemento,editor,centro, total,scale,dimencionesTexto,ancho_imaNoti,
1570
	recorte_listo=false,alto,ancho,tx,ty,txf,tyf,cuatro=true,texto_actualizar=false,cinco=true,seis=true,cuatro;
1571
	var  mitadY,mitadX, uno=true,dos=false, recorte=480/320, imagen_noticias, scale_noticia, tres=true,rotar=false, cortar=false;;
1572
	var translateX;
1573
 
1574
	$(document).on("click", ".recortar10", function(e){
1575
 
1576
		e.preventDefault();
1577
		recorte_listo=false;
1578
		uno=true;
1579
		$(".fondo_oscuro").css("display","block");
1580
		$("#boton_recortar").addClass("recortar").text("Recortar").removeClass("info_noticia");
1581
		$("#boton_recortar3").addClass("recortar").text("Recortar").removeClass("info_noticia3");
1582
		$(".contenido_text").css("display", "none");
1583
		$(".contenido_filter").css("display", "none");
1584
		$(".recortar10").addClass("recortar");
1585
		$(".canvas").addClass("recortar")
1586
		$(".oa").removeClass("oa");
1587
		$("#normal").addClass("oa");
1588
		$(".b1").removeClass("paso");
1589
		$(".titulo_pasos").html("LABEL_STEP_2");
1590
		window.clearInterval(actualizar2);
1591
		actualizar();
1592
 
1593
	})
1594
 
1595
 
1596
	blockCelda=true;
1597
	$(document).on("click", "#blockCelda", function(e){
1598
		e.preventDefault();
1599
		if(blockCelda){
1600
			$(this).html('<span class="fa fa-unlock"></span>')
1601
 
1602
			blockCelda=false;
1603
		}else{
1604
			$(this).html('<span class="fa fa-lock"></span>')
1605
			blockCelda=true;
1606
		}
1607
		t4=true;
1608
 
1609
	})
1610
	var imagen
1611
	function editorNoticia(img){
1612
		 cortar=true;
1613
		imagen= new Image();
1614
		$(".canvas").html(canvas);
1615
		elemento = document.getElementById("editorNoticia");
1616
		editor = elemento.getContext("2d");
1617
		elemento2 = document.getElementById("imagen_noticias");
1618
		noticia = elemento2.getContext("2d");
1619
 
1620
		$(document).on("click", ".boton_marino.recortar",function(e){
1621
			e.preventDefault();
1622
			recorte_listo=true;
1623
			$(".fondo_oscuro").css("display","none");
6863 nelberth 1624
			if(fileToggle){
1625
				$("#boton_recortar").removeClass("recortar").text("LABEL_SEND").addClass("info_noticia");
1626
 
1627
			}else{
1628
				$("#boton_recortar").removeClass("recortar").text("LABEL_SEND").addClass("info_noticia").attr('type','submit');
1629
			}
6682 nelberth 1630
			$(".recortar10").removeClass("recortar");
1631
			$(".canvas").removeClass("recortar");
1632
			$(".b1").addClass("paso");
1633
			$(".titulo_pasos").html("LABEL_STEP_3");
1634
			if(texto!=""){
1635
				seis=true;
1636
				siete=true;
1637
			}
1638
			cinco=true;
1639
			dos=true;
1640
			cuatro=true;
1641
			actualizar();
1642
		})
1643
 
1644
		var cli = false, t1= false, t2=false,t3=false,t4=false,tcli=false;
1645
		var mouse =[];
1646
 
1647
 
1648
		function raton(elemento, e){
1649
			return {
1650
				x:((e.pageX - elemento.offsetLeft - ((ancho/2)-((ancho*scale)/2)))/scale),
1651
				y:((e.pageY - elemento.offsetTop - ((alto/2)-((alto*scale)/2)))/scale)
1652
			}
1653
		}
1654
 
1655
		imagen.src=img;
1656
		$(".recortar10").addClass("recortar");
1657
		$("#boton_recortar").removeClass("boton_normal").addClass("recortar boton_marino").text("LABEL_CUT")
1658
		actualizar();
1659
 
1660
		$(elemento).mousemove(function(e){
1661
			mouse = raton(this, e);
1662
			//console.log("raton x: "+mouse.x+ " raton Y: " +mouse.y+ " tx: "+tx+" ty: "+ty+" txf:"+(txf+tx)+" tyf:"+(tyf+ty) )
1663
			if(!recorte_listo){
1664
				if(x+16<mouse.x &&(xf+x-16)>mouse.x && y+16<mouse.y && (y+yf-16)>mouse.y){
1665
			 		$(elemento).css("cursor","move");
1666
			 	}else if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && (y+yf-16)<mouse.y && (y+yf)>mouse.y){
1667
			 		$(elemento).css("cursor","nw-resize");
1668
			 	}else if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
1669
			 		$(elemento).css("cursor","ne-resize");
1670
			 	}else if(x<mouse.x &&(16+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
1671
			 		$(elemento).css("cursor","se-resize");
1672
			 	}else if(x<mouse.x &&(16+x)>mouse.x && (y+yf-16)<mouse.y &&(y+yf)>mouse.y){
1673
			 		$(elemento).css("cursor","sw-resize");
1674
			 	}else{
1675
			 		$(elemento).css("cursor","default");
1676
			 	}
1677
			}else if(texto_listo){
1678
				if(tx-10<mouse.x && tx-10+txf>mouse.x && ty-10<mouse.y && ty-10+tyf>mouse.y){
1679
			 		$(elemento).css("cursor","move");
1680
			 	}else if((txf+tx-10)<mouse.x &&(txf+tx-10+20)>mouse.x && (ty-10+tyf)<mouse.y && (ty-10+tyf+20)>mouse.y){
1681
			 		$(elemento).css("cursor","pointer");
1682
			 	}else{
1683
			 		$(elemento).css("cursor","default");
1684
			 	}
1685
			}
1686
			else{
1687
				$(elemento).css("cursor","default");
1688
			}
1689
		})
1690
		$(elemento).mousedown(function(e){
1691
			mouse = raton(this, e);
1692
			if(!recorte_listo){
1693
				if(x+16<mouse.x &&(xf+x-16)>mouse.x && y+16<mouse.y && (y+yf-16)>mouse.y){
1694
			 		cli = true;
1695
			 	}
1696
			 	if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && (y+yf-16)<mouse.y && (y+yf)>mouse.y){
1697
			 		t4 = true;
1698
			 	}
1699
				if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
1700
			 		t3 = true;
1701
			 	}
1702
			 	if(x<mouse.x &&(16+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
1703
			 		t1 = true;
1704
			 	}
1705
			 	if(x<mouse.x &&(16+x)>mouse.x && (y+yf-16)<mouse.y &&(y+yf)>mouse.y){
1706
			 		t2 = true;
1707
			 	}
1708
			}else if(texto_listo){
1709
				if(tx-10<mouse.x && tx-10+txf>mouse.x && ty-10<mouse.y && ty-10+tyf>mouse.y){
1710
			 		tcli=true;
1711
			 	}else if((txf+tx-10)<mouse.x &&(txf+tx-10+20)>mouse.x && (ty-10+tyf)<mouse.y && (ty-10+tyf+20)>mouse.y){
1712
			 		rotar=true;
1713
			 	}
1714
			}
1715
 
1716
		 })
1717
 
1718
		 $(elemento).mousemove(function(e){
1719
		 	mouse = raton(this, e);
1720
		 	if(!recorte_listo){
1721
			 	if(cli){
1722
			 		if((mouse.y-(yf/2))>=0&&(mouse.y+(yf/2))<=alto){
1723
				 		y = (mouse.y-(yf/2));
1724
			 		}else{
1725
			 			if((mouse.y-(yf/2))<0){
1726
			 				y=0;
1727
			 			}
1728
			 			if((mouse.y+(yf/2))>alto){
1729
			 				y=alto-yf;
1730
			 			}
1731
			 		}
1732
			 		if((mouse.x-(xf/2))>=0&&(mouse.x+(xf/2))<=ancho){
1733
			 			x = (mouse.x-(xf/2));
1734
			 		}else{
1735
			 			if((mouse.x-(xf/2))<0){
1736
			 				x=0;
1737
			 			}
1738
			 			if((mouse.x+(xf/2))>ancho){
1739
			 				x=(ancho)-xf;
1740
			 			}
1741
			 		}
1742
			 	}
1743
				if(blockCelda){
1744
			 	if(t4){
1745
			 		if(mouse.y<(alto-10)&&(x+xf)<=(ancho)){
1746
				 		if(Math.round(xf)>=50){
1747
							if(((mouse.y-y)/recorte)>50){
1748
				 				yf=mouse.y-y;
1749
				 				xf=(yf/recorte);
1750
				 			}
1751
						}
1752
			 		}else{
1753
			 			if(mouse.y>=(alto-10)){
1754
			 				yf=alto-y;
1755
				 			xf=(yf/recorte);
1756
				 			t4=false;
1757
			 			}
1758
			 			if(x+xf>(ancho)){
1759
			 				xf=(ancho)-x;
1760
				 			yf=(xf*recorte);
1761
				 			t4=false;
1762
			 			}
1763
			 		}
1764
			 	}
1765
			 	if(t3){
1766
			 		if(mouse.y>0&&(x+xf)<=(ancho)){
1767
				 		if(Math.round(xf)>=50){
1768
							if(((yf+(y-mouse.y))/recorte)>50){
1769
					 			yf=yf+(y-mouse.y);
1770
					 			xf=(yf/recorte);
1771
					 			y=mouse.y;
1772
				 			}
1773
				 		}
1774
 
1775
			 		}else{
1776
			 			if(mouse.y<=0) {
1777
			 				yf=yf+(y-mouse.y);
1778
				 			xf=(yf/recorte);
1779
			 				y=0;
1780
			 				t3=false;
1781
			 			}
1782
			 			if(x+xf>(ancho)){
1783
			 				xf=(ancho)-x;
1784
				 			yf=xf*recorte;
1785
				 			t3=false;
1786
			 			}
1787
			 		}
1788
			 	}
1789
			 	if(t2){
1790
			 		if(mouse.y<(alto-10)&&x>=0){
1791
				 		if(Math.round(xf)>=50){
1792
							if(((mouse.y-y)/recorte)>50){
1793
					 			x=(x+(yf-(mouse.y-y))/recorte);
1794
					 			yf=mouse.y-y;
1795
					 			xf=(yf/recorte);
1796
				 			}
1797
					 	}
1798
 
1799
			 		}else{
1800
			 			if(mouse.y>=(alto-10)) {
1801
			 				yf=alto-y;
1802
				 			xf=(yf/recorte);
1803
				 			t2=false;
1804
			 			}
1805
			 			if(0>x){
1806
			 				x=0;
1807
			 				xf=mouse.y-y;
1808
				 			yf=(xf*recorte);
1809
				 			t2=false;
1810
			 			}
1811
			 		}
1812
			 	}
1813
			 	if(t1){
1814
			 		if(mouse.y>0&&x>=0){
1815
				 		if(Math.round(xf)>=50){
1816
							if(((yf+(y-mouse.y))/recorte)>50){
1817
								yf=yf+(y-mouse.y);
1818
					 			xf=(yf/recorte);
1819
					 			x=(x-(y-mouse.y)/recorte);
1820
					 			y=mouse.y;
1821
							}
1822
				 		}
1823
			 		}else{
1824
			 			if(mouse.y<=0) {
1825
			 				yf=yf+(y-mouse.y);
1826
				 			xf=(yf/recorte);
1827
			 				y=0;
1828
			 				t1=false;
1829
			 			}
1830
			 			if(0>x){
1831
			 				x=0;
1832
			 				xf=yf+(y-mouse.y);
1833
				 			yf=(xf*recorte);
1834
				 			t1=false;
1835
			 			}
1836
			 		}
1837
			 	}
1838
				}else{
1839
				 if(t4){
1840
			 		if(mouse.y<(alto-10-(2/scale))&&mouse.x<=(ancho-(2/scale))){
1841
 
1842
							if((mouse.y-y)>50){
1843
				 				yf=mouse.y-y;
1844
				 			}
1845
							if((mouse.x-x)>50){
1846
								xf=mouse.x-x;
1847
							}
1848
 
1849
			 		}else{
1850
			 			if(mouse.y>=(alto-10-(2/scale))){
1851
			 				yf=alto-y;
1852
			 			}
1853
			 			if(mouse.x>(ancho-(2/scale))){
1854
			 				xf=(ancho)-x;
1855
			 			}
1856
						 t4=false;
1857
			 		}
1858
			 	}
1859
			 	if(t3){
1860
			 		if(mouse.y>(2/scale)&&mouse.x<=(ancho-(2/scale))){
1861
 
1862
							if((yf-(mouse.y-y))>50){
1863
				 				yf=yf-(mouse.y-y);
1864
								y=mouse.y;
1865
				 			}
1866
							if((mouse.x-x)>50){
1867
								xf=mouse.x-x;
1868
							}
1869
 
1870
 
1871
			 		}else{
1872
						if(mouse.x>(ancho-(2/scale))){
1873
							xf=ancho-x;
1874
						}
1875
						if(mouse.y<=(2/scale)){
1876
							yf=yf-(mouse.y-y);
1877
							y=0;
1878
						}
1879
			 			t3=false;
1880
			 		}
1881
			 	}
1882
				/* Izquierda abajo */
1883
			 	if(t2){
1884
			 		if(mouse.y<(alto-10-(2/scale))&&mouse.x>=(2/scale)){
1885
							 if((mouse.y-y)>50){
1886
								yf=mouse.y-y;
1887
				 			}
1888
							if((xf-(mouse.x-x))>50){
1889
								xf=xf-(mouse.x-x);
1890
								x=mouse.x
1891
							}
1892
 
1893
			 		}else{
1894
			 			if(mouse.y>=(alto-10-(2/scale))) {
1895
							yf=alto-y;
1896
			 			}
1897
 
1898
			 			if(mouse.x<(2/scale)){
1899
							xf=xf-(mouse.x-x);
1900
			 				x=0;
1901
			 			}
1902
						 t2=false;
1903
			 		}
1904
			 	}
1905
				/* izquierda arriba */
1906
			 	if(t1){
1907
			 		if(mouse.y>(2/scale)&&mouse.x>=(2/scale)){
1908
 
1909
							if((yf-(mouse.y-y))>50){
1910
				 				yf=yf-(mouse.y-y);
1911
								y=mouse.y;
1912
				 			}
1913
							if((xf-(mouse.x-x))>50){
1914
								xf=xf-(mouse.x-x);
1915
								x=mouse.x
1916
							}
1917
 
1918
			 		}else{
1919
						if(mouse.y<=(2/scale)){
1920
							yf=yf-(mouse.y-y);
1921
							y=0;
1922
						}
1923
						 if(mouse.x<(2/scale)){
1924
							xf=xf-(mouse.x-x);
1925
			 				x=0;
1926
 
1927
			 			}
1928
						 t1=false;
1929
			 		}
1930
			 	}
1931
			}
1932
 
1933
		 	actualizar();
1934
		 	}else if(texto_listo){
1935
		 		if(tcli){
1936
		 			tx=mouse.x-(txf/2)
1937
		 			ty=mouse.y-(tyf/2)
1938
		 		}else if(rotar){
1939
 
1940
		 		}
1941
 
1942
		 		actualizar2();
1943
		 	}
1944
		 })
1945
		 $(elemento).mouseup(function(e){
1946
		 	if(!recorte_listo){
1947
			 	cli=false;
1948
			 	t1=false;
1949
			 	t2=false;
1950
			 	t3=false;
1951
			 	t4=false;
1952
		 	}else if (texto_listo) {
1953
		 		tcli=false;
1954
		 	}
1955
		 })
1956
 
1957
 
1958
	}
1959
	/* Titulo */
1960
 
1961
var titulo_noticia, censor_titulo = true, numero_titulo=0;
1962
	$(document).on("keyup change", "#name", function(e){
1963
	console.log(numero_titulo)
1964
	titulo_noticia = $(this).val();
1965
	titulo_elemento= $(".titulo_topico");
1966
	if(titulo_noticia!=""){
1967
		if(censor_titulo){
1968
			titulo_elemento.html(titulo_noticia);
1969
			if(titulo_elemento.height()>38){
1970
				var titulo_noticia2 = "";
1971
				for(var i =0; i <titulo_noticia.length;i++){
1972
					titulo_noticia2 = titulo_noticia2 + titulo_noticia.split("")[i];
1973
					titulo_elemento.html(titulo_noticia2);
1974
					if(titulo_elemento.height()>38){
1975
						titulo_noticia2 = titulo_noticia2.slice(0,-5) + "...";
1976
						titulo_elemento.html(titulo_noticia2);
1977
						numero_titulo = titulo_noticia2.length;
1978
						censor_titulo=false;
1979
						break;
1980
					}
1981
 
1982
				}
1983
			}else{
1984
				numero_titulo=0;
1985
			}
1986
		}else{
1987
			if(numero_titulo+1>=titulo_noticia.length){
1988
				titulo_elemento.html(titulo_noticia);
1989
				censor_titulo=true;
1990
			}
1991
		}
1992
	}else{
1993
		titulo_elemento.html("LABEL_TITLE");
1994
		censor_titulo = true;
1995
	}
1996
})
1997
 
1 www 1998
});
1999
JS;
2000
$this->inlineScript()->captureEnd();
2001
?>
2002
 
2003
 
2004
 
2005
<!-- Content Header (Page header) -->
2006
<section class="content-header">
2007
	<div class="container-fluid">
2008
    	<div class="row mb-2">
2009
        	<div class="col-sm-12">
2010
            	<h1>LABEL_CAPSULES</h1>
2011
			</div>
2012
		</div>
2013
	</div><!-- /.container-fluid -->
2014
</section>
2015
 
6704 nelberth 2016
<section class="content" id="content1">
1 www 2017
	<div class="container-fluid">
2018
    	<div class="row">
2019
        	<div class="col-12">
2020
				<div class="card">
2021
					<div class="card-header">
2022
						<?php
2023
                        $form = $this->form;
2024
            	        $form->setAttributes([
2025
                            'name'    => 'form-filter',
2026
                            'id'      => 'form-filter',
2027
                        ]);
2028
 
2029
                        $form->prepare();
2030
                        echo $this->form()->openTag($form);
2031
                        ?>
2032
                        <div class="form-group">
2033
                            <?php
2034
                            $element = $form->get('topic_uuid');
2035
 
2036
                            $element->setAttributes(['class' => 'form-control']);
2037
                            $element->setLabel('LABEL_TOPIC');
2038
                            echo $this->formLabel($element);
2039
                            echo $this->formSelect($element);
2040
                            ?>
2041
                        </div>
2042
						<?php echo $this->form()->closeTag($form); ?>
2043
					</div>
2044
					<div class="card-body">
20 steven 2045
        	    		<table id="gridTable" class="table   table-hover">
1 www 2046
                      		<thead>
2047
        						<tr>
2048
                                	<th>LABEL_NAME</th>
2049
                                  	<th>LABEL_DETAILS</th>
2050
                                  	<th>LABEL_IMAGES</th>
2051
                                  	<th>LABEL_ACTIONS</th>
2052
                                </tr>
2053
                       		</thead>
2054
                         	<tbody>
2055
                         	</tbody>
2056
                    	</table>
2057
                   	</div>
2058
                   	<div class="card-footer clearfix">
2059
                   		<div style="float:right;">
2060
							<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
2061
							<?php if($allowAdd) : ?>
2062
							<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
2063
							<?php endif; ?>
2064
						</div>
2065
                 	</div>
2066
          		</div>
2067
           	</div>
2068
        </div>
2069
 	</div>
2070
</section>
2071
 
2072
 
2073
<!-- The Modal -->
6694 nelberth 2074
<div id="modalCapsuleAdd" style='display:none'>
1 www 2075
 
6694 nelberth 2076
 
1 www 2077
            <!-- Modal Header -->
2078
 
6701 nelberth 2079
              <div class="d-flex justify-content-center tituloEditor">
2080
              <h4>LABEL_ADD_CAPSULE</h4>
2081
 
2082
             </div>
1 www 2083
            <!-- Modal body -->
6701 nelberth 2084
      		<div class="grid-padre">
1 www 2085
       			 <?php
2086
       			 $form = $this->formAdd;
2087
            		$form->setAttributes([
2088
                        'method'  => 'post',
2089
            		    'action'  => '',
2090
                        'name'    => 'form-capsule-add',
2091
                        'id'      => 'form-capsule-add',
2092
                    ]);
2093
 
2094
                    $form->prepare();
2095
                    echo $this->form()->openTag($form);
2096
                    ?>
6701 nelberth 2097
    				<div class="form-group grid-1-2">
1 www 2098
    				<?php
2099
                        $element = $form->get('name');
2100
 
2101
                        $element->setAttributes(['class' => 'form-control']);
2102
                        $element->setOptions(['label' => 'LABEL_NAME']);
2103
                        echo $this->formLabel($element);
2104
                        echo $this->formText($element);
2105
                    ?>
2106
				</div>
6701 nelberth 2107
                <div class="form-group grid-1-2">
1 www 2108
                	<?php
2109
                    $element = $form->get('description');
2110
                    $element->setAttributes(['id' => 'description_add', 'class' => 'form-control', 'rows' => '2','class' => 'form-control']);
2111
                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
2112
                    echo $this->formLabel($element);
2113
                    echo $this->formTextArea($element);
2114
                    ?>
2115
   				</div>
6701 nelberth 2116
				<div class="form-group grid-1-2">
1 www 2117
    				<?php
2118
                        $element = $form->get('order');
2119
                        $element->setAttributes(['class' => 'form-control']);
2120
                        $element->setOptions(['label' => 'LABEL_ORDER']);
2121
                        echo $this->formLabel($element);
2122
                        echo $this->formText($element);
2123
                    ?>
2124
				</div>
6854 nelberth 2125
 
6701 nelberth 2126
          		<div class="form-group grid-1-2">
1 www 2127
    				<?php
2128
                        $element = $form->get('status');
2129
                        $element->setAttributes(['class' => 'form-control']);
2130
                        $element->setOptions(['label' => 'LABEL_STATUS']);
2131
                        echo $this->formLabel($element);
2132
                        echo $this->formSelect($element);
2133
                    ?>
2134
				</div>
6701 nelberth 2135
				<div class="form-group grid-1-2">
1 www 2136
    				<?php
2137
                        $element = $form->get('privacy');
2138
                        $element->setAttributes(['class' => 'form-control']);
2139
                        $element->setOptions(['label' => 'LABEL_PRIVACY']);
2140
                        echo $this->formLabel($element);
2141
                        echo $this->formSelect($element);
2142
                    ?>
2143
				</div>
6701 nelberth 2144
				<div class="form-group grid-1-2">
1 www 2145
    				<?php
2146
                        $element = $form->get('type');
2147
                        $element->setAttributes(['class' => 'form-control']);
2148
                        $element->setOptions(['label' => 'LABEL_TYPE']);
2149
                        echo $this->formLabel($element);
2150
                        echo $this->formSelect($element);
2151
                    ?>
2152
				</div>
6701 nelberth 2153
				<div class="form-group grid-1-2" id="form-row-cost">
1 www 2154
    				<?php
2155
                        $element = $form->get('cost');
2156
                        $element->setAttributes(['class' => 'form-control']);
2157
                        $element->setOptions(['label' => 'LABEL_COST']);
2158
                        echo $this->formLabel($element);
2159
                        echo $this->formText($element);
2160
                    ?>
2161
				</div>
6861 nelberth 2162
 
2163
				<?php
1 www 2164
                    $element = $form->get('marketplace');
6861 nelberth 2165
					$element->setAttributes([ 'class' => 'marketplace']);
2166
                    echo $this->formHidden($element);
2167
                ?>
2168
                <?php
6854 nelberth 2169
                    $element = $form->get('file');
2170
					$element->setAttributes([ 'class' => 'file']);
2171
                    echo $this->formHidden($element);
2172
                ?>
6869 nelberth 2173
				<img src=''></img>
6854 nelberth 2174
          		<div class="contenido form-group " id="contenido"></div>
6823 nelberth 2175
 
1 www 2176
     	      		<?php echo $this->form()->closeTag($form); ?>
2177
      		</div>
2178
 
2179
 
6694 nelberth 2180
 
1 www 2181
</div>
2182
 
2183
 
2184
<!-- The Modal -->
2185
<div class="modal" id="modalCapsuleEdit">
2186
	<div class="modal-dialog  modal-xl">
2187
    	<div class="modal-content">
2188
 
2189
            <!-- Modal Header -->
2190
      		<div class="modal-header">
2191
        		<h4 class="modal-title">LABEL_EDIT_CAPSULE</h4>
2192
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
2193
      		</div>
2194
 
2195
            <!-- Modal body -->
2196
      		<div class="modal-body">
2197
       			 <?php
2198
       			  $form = $this->formEdit;
2199
            		$form->setAttributes([
2200
                        'method'    => 'post',
2201
                        'name'      => 'form-capsule-edit',
2202
                        'id'        => 'form-capsule-edit'
2203
                    ]);
2204
 
2205
                    $form->prepare();
2206
                    echo $this->form()->openTag($form);
2207
                ?>
2208
    			<div class="form-group">
2209
    				<?php
2210
                        $element = $form->get('name');
2211
                        $element->setAttributes(['class' => 'form-control']);
2212
                        $element->setOptions(['label' => 'LABEL_NAME']);
2213
                        echo $this->formLabel($element);
2214
                        echo $this->formText($element);
2215
                    ?>
2216
				</div>
2217
                <div class="form-group">
2218
                	<?php
2219
                    $element = $form->get('description');
2220
                    $element->setAttributes(['id' => 'description_edit', 'rows' => '2', 'class' => 'form-control',   'class' => 'form-control']);
2221
                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
2222
                    echo $this->formLabel($element);
2223
                    echo $this->formTextArea($element);
2224
                    ?>
2225
   				</div>
2226
				<div class="form-group">
2227
    				<?php
2228
                        $element = $form->get('order');
2229
                        $element->setAttributes(['class' => 'form-control']);
2230
                        $element->setOptions(['label' => 'LABEL_ORDER']);
2231
                        echo $this->formLabel($element);
2232
                        echo $this->formText($element);
2233
                    ?>
2234
				</div>
2235
				<div class="form-group">
2236
 
2237
 
2238
                 		<?php
2239
                        $element = $form->get('file');
2240
                        $element->setOptions(['label' => 'LABEL_IMAGE']);
2241
                        echo $this->formLabel($element);
2242
                        ?>
2243
                        <div class="file-loading">
2244
                        <?php
2245
                        $element->setAttributes(['class' => 'form-control', 'accept' => 'image/jpg,image/jpeg,image/png']);
2246
                        echo $this->formFile($element);
2247
                        ?>
2248
                	</div>
2249
          		</div>
2250
 
2251
          		<div class="form-group">
2252
    				<?php
2253
                        $element = $form->get('status');
2254
                        $element->setAttributes(['class' => 'form-control']);
2255
                        $element->setOptions(['label' => 'LABEL_STATUS']);
2256
                        echo $this->formLabel($element);
2257
                        echo $this->formSelect($element);
2258
                    ?>
2259
				</div>
2260
				<div class="form-group">
2261
    				<?php
2262
                        $element = $form->get('privacy');
2263
                        $element->setAttributes(['class' => 'form-control']);
2264
                        $element->setOptions(['label' => 'LABEL_PRIVACY']);
2265
                        echo $this->formLabel($element);
2266
                        echo $this->formSelect($element);
2267
                    ?>
2268
				</div>
2269
				<div class="form-group">
2270
    				<?php
2271
                        $element = $form->get('type');
2272
                        $element->setAttributes(['class' => 'form-control']);
2273
                        $element->setOptions(['label' => 'LABEL_TYPE']);
2274
                        echo $this->formLabel($element);
2275
                        echo $this->formSelect($element);
2276
                    ?>
2277
				</div>
2278
				<div class="form-group" id="form-row-cost">
2279
    				<?php
2280
                        $element = $form->get('cost');
2281
                        $element->setAttributes(['class' => 'form-control']);
2282
                        $element->setOptions(['label' => 'LABEL_COST']);
2283
                        echo $this->formLabel($element);
2284
                        echo $this->formText($element);
2285
                    ?>
2286
				</div>
2287
 
2288
 
2289
        				<div class="form-group">
2290
                    		<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2291
                    		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
2292
                   		</div>
2293
     	      		<?php echo $this->form()->closeTag($form); ?>
2294
      		</div>
2295
 
2296
            <!-- Modal footer -->
2297
      		<div class="modal-footer">
2298
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
2299
      		</div>
2300
 
2301
    	</div>
2302
	</div>
2303
</div>
2304
 
2305
 
2306
 
2307
<!-- The Modal -->
2308
<div class="modal" id="modalAppMarkeplate">
2309
	<div class="modal-dialog">
2310
		<div class="modal-content">
2311
        	<!-- Modal Header -->
2312
        	<div class="modal-header">
2313
           		<h4 class="modal-title">LABEL_IMAGE_MARKETPLACE</h4>
2314
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
2315
      		</div>
2316
 
2317
           	<!-- Modal body -->
2318
           	<div class="modal-body text-center">
2319
    			<img src="" class="img img-responsive" style="width: 300px; height: auto" id="image-marketplace" />
2320
          	</div>
2321
 
2322
            <!-- Modal footer -->
2323
  			<div class="modal-footer">
2324
    			<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
2325
      		</div>
2326
      	</div>
2327
	</div>
2328
</div>
2329
 
2330
 
2331
<!-- The Modal -->
2332
<div class="modal" id="modalImageApp">
2333
	<div class="modal-dialog ">
2334
    	<div class="modal-content">
2335
 
2336
            <!-- Modal Header -->
2337
      		<div class="modal-header">
2338
        		<h4 class="modal-title">LABEL_IMAGE</h4>
2339
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
2340
      		</div>
2341
 
2342
            <!-- Modal body -->
2343
            <div class="modal-body text-center">
2344
				<img src="" class="img img-responsive" style="width: 300px; height: auto" id="image-app" />
2345
      		</div>
2346
 
2347
            <!-- Modal footer -->
2348
      		<div class="modal-footer">
2349
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
2350
          	</div>
2351
         </div>
2352
	</div>
2353
</div>
2354
 
2355
 
2356
 
2357
 
2358
 
2359
 
2360
<!-- The Modal -->
2361
<div class="modal" id="notificationUsersModal">
2362
	<div class="modal-dialog modal-xl">
2363
    	<div class="modal-content">
2364
 
2365
            <!-- Modal Header -->
2366
      		<div class="modal-header">
2367
        		<h4 class="modal-title">LABEL_USERS</h4>
2368
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
2369
      		</div>
2370
 
2371
            <!-- Modal body -->
2372
      		<div class="modal-body">
2373
      			<form>
2374
      				<div class="form-group">
2375
      					<label>LABEL_TOPIC</label>
2376
      					<input type="text" readonly="readonly" id="table-users-topic" class="form-control" >
2377
      				</div>
2378
      				<div class="form-group">
2379
      					<label>LABEL_CAPSULE</label>
2380
      					<input type="text" readonly="readonly" id="table-users-capsule" class="form-control" >
2381
      				</div>
2382
      			</form>
2383
      			<div style="height: 300px;overflow: scroll;">
20 steven 2384
				<table id="gridTableUsers" style="width: 100%" class="table   table-hover">
1 www 2385
            		<thead>
2386
            			<tr>
2387
                      		<th>LABEL_FIRST_NAME</th>
2388
                     		<th>LABEL_LAST_NAME</th>
2389
                         	<th>LABEL_EMAIL</th>
2390
                       		<th>LABEL_DETAILS</th>
2391
             			</tr>
2392
                  	</thead>
2393
               		<tbody>
2394
               		</tbody>
2395
         		</table>
2396
         		</div>
2397
 
2398
      		</div>
2399
 
2400
            <!-- Modal footer -->
2401
      		<div class="modal-footer">
2402
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
2403
      		</div>
2404
 
2405
    	</div>
2406
	</div>
2407
</div>
2408
 
2409
 
2410
 
2411
 
2412
 
2413
 
2414
 
2415