Proyectos de Subversion LeadersLinked - Backend

Rev

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