Proyectos de Subversion LeadersLinked - Backend

Rev

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

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