Proyectos de Subversion LeadersLinked - Backend

Rev

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