Proyectos de Subversion LeadersLinked - Backend

Rev

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

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