Proyectos de Subversion LeadersLinked - Backend

Rev

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