Proyectos de Subversion LeadersLinked - Backend

Rev

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