Proyectos de Subversion LeadersLinked - Backend

Rev

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

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