Proyectos de Subversion LeadersLinked - Backend

Rev

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