Proyectos de Subversion LeadersLinked - Backend

Rev

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